summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers')
-rw-r--r--connectivity/source/drivers/adabas/BCatalog.cxx169
-rw-r--r--connectivity/source/drivers/adabas/BColumns.cxx183
-rw-r--r--connectivity/source/drivers/adabas/BConnection.cxx274
-rw-r--r--connectivity/source/drivers/adabas/BDatabaseMetaData.cxx156
-rw-r--r--connectivity/source/drivers/adabas/BDriver.cxx1870
-rw-r--r--connectivity/source/drivers/adabas/BFunctions.cxx256
-rw-r--r--connectivity/source/drivers/adabas/BGroup.cxx93
-rw-r--r--connectivity/source/drivers/adabas/BGroups.cxx94
-rw-r--r--connectivity/source/drivers/adabas/BIndex.cxx105
-rw-r--r--connectivity/source/drivers/adabas/BIndexColumns.cxx123
-rw-r--r--connectivity/source/drivers/adabas/BIndexes.cxx194
-rw-r--r--connectivity/source/drivers/adabas/BKeys.cxx183
-rw-r--r--connectivity/source/drivers/adabas/BPreparedStatement.cxx78
-rw-r--r--connectivity/source/drivers/adabas/BResultSet.cxx225
-rw-r--r--connectivity/source/drivers/adabas/BResultSetMetaData.cxx87
-rw-r--r--connectivity/source/drivers/adabas/BStatement.cxx81
-rw-r--r--connectivity/source/drivers/adabas/BTable.cxx378
-rw-r--r--connectivity/source/drivers/adabas/BTables.cxx523
-rw-r--r--connectivity/source/drivers/adabas/BUser.cxx332
-rw-r--r--connectivity/source/drivers/adabas/BUsers.cxx130
-rw-r--r--connectivity/source/drivers/adabas/BViews.cxx197
-rw-r--r--connectivity/source/drivers/adabas/Bservices.cxx115
-rwxr-xr-xconnectivity/source/drivers/adabas/adabas.component35
-rwxr-xr-xconnectivity/source/drivers/adabas/adabas.mxp.map146
-rw-r--r--connectivity/source/drivers/adabas/adabas.xcu130
-rwxr-xr-xconnectivity/source/drivers/adabas/adabas.xml25
-rwxr-xr-xconnectivity/source/drivers/adabas/exports.dxp1
-rwxr-xr-xconnectivity/source/drivers/adabas/makefile.mk114
-rw-r--r--connectivity/source/drivers/ado/ACallableStatement.cxx237
-rw-r--r--connectivity/source/drivers/ado/ACatalog.cxx127
-rw-r--r--connectivity/source/drivers/ado/AColumn.cxx307
-rw-r--r--connectivity/source/drivers/ado/AColumns.cxx150
-rw-r--r--connectivity/source/drivers/ado/AConnection.cxx633
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaData.cxx1086
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx610
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx1219
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx235
-rw-r--r--connectivity/source/drivers/ado/ADriver.cxx306
-rw-r--r--connectivity/source/drivers/ado/AGroup.cxx190
-rw-r--r--connectivity/source/drivers/ado/AGroups.cxx90
-rw-r--r--connectivity/source/drivers/ado/AIndex.cxx159
-rw-r--r--connectivity/source/drivers/ado/AIndexes.cxx92
-rw-r--r--connectivity/source/drivers/ado/AKey.cxx169
-rw-r--r--connectivity/source/drivers/ado/AKeyColumn.cxx71
-rw-r--r--connectivity/source/drivers/ado/AKeyColumns.cxx97
-rw-r--r--connectivity/source/drivers/ado/AKeys.cxx115
-rw-r--r--connectivity/source/drivers/ado/APreparedStatement.cxx566
-rw-r--r--connectivity/source/drivers/ado/AResultSet.cxx1175
-rw-r--r--connectivity/source/drivers/ado/AResultSetMetaData.cxx264
-rw-r--r--connectivity/source/drivers/ado/AStatement.cxx844
-rw-r--r--connectivity/source/drivers/ado/ATable.cxx259
-rw-r--r--connectivity/source/drivers/ado/ATables.cxx117
-rw-r--r--connectivity/source/drivers/ado/AUser.cxx227
-rw-r--r--connectivity/source/drivers/ado/AUsers.cxx89
-rw-r--r--connectivity/source/drivers/ado/AView.cxx125
-rw-r--r--connectivity/source/drivers/ado/AViews.cxx106
-rw-r--r--connectivity/source/drivers/ado/Aolevariant.cxx794
-rw-r--r--connectivity/source/drivers/ado/Aservices.cxx123
-rw-r--r--connectivity/source/drivers/ado/Awrapado.cxx2205
-rwxr-xr-xconnectivity/source/drivers/ado/ado.component35
-rw-r--r--connectivity/source/drivers/ado/ado.xcu269
-rwxr-xr-xconnectivity/source/drivers/ado/ado.xml27
-rwxr-xr-xconnectivity/source/drivers/ado/ado_post_sys_include.h35
-rwxr-xr-xconnectivity/source/drivers/ado/ado_pre_sys_include.h40
-rw-r--r--connectivity/source/drivers/ado/adoimp.cxx339
-rwxr-xr-xconnectivity/source/drivers/ado/exports.dxp2
-rwxr-xr-xconnectivity/source/drivers/ado/makefile.mk124
-rw-r--r--connectivity/source/drivers/calc/CCatalog.cxx82
-rw-r--r--connectivity/source/drivers/calc/CColumns.cxx57
-rw-r--r--connectivity/source/drivers/calc/CConnection.cxx293
-rw-r--r--connectivity/source/drivers/calc/CDatabaseMetaData.cxx470
-rw-r--r--connectivity/source/drivers/calc/CDriver.cxx107
-rw-r--r--connectivity/source/drivers/calc/CPreparedStatement.cxx45
-rw-r--r--connectivity/source/drivers/calc/CResultSet.cxx192
-rw-r--r--connectivity/source/drivers/calc/CStatement.cxx45
-rw-r--r--connectivity/source/drivers/calc/CTable.cxx869
-rw-r--r--connectivity/source/drivers/calc/CTables.cxx62
-rwxr-xr-xconnectivity/source/drivers/calc/CalcDriver.xml30
-rw-r--r--connectivity/source/drivers/calc/Cservices.cxx114
-rwxr-xr-xconnectivity/source/drivers/calc/calc.component35
-rw-r--r--connectivity/source/drivers/calc/calc.xcu63
-rwxr-xr-xconnectivity/source/drivers/calc/exports.dxp1
-rwxr-xr-xconnectivity/source/drivers/calc/makefile.mk99
-rw-r--r--connectivity/source/drivers/dbase/DCatalog.cxx72
-rw-r--r--connectivity/source/drivers/dbase/DCode.cxx133
-rw-r--r--connectivity/source/drivers/dbase/DColumns.cxx92
-rw-r--r--connectivity/source/drivers/dbase/DConnection.cxx133
-rw-r--r--connectivity/source/drivers/dbase/DDatabaseMetaData.cxx415
-rw-r--r--connectivity/source/drivers/dbase/DDriver.cxx129
-rw-r--r--connectivity/source/drivers/dbase/DIndex.cxx645
-rw-r--r--connectivity/source/drivers/dbase/DIndexColumns.cxx96
-rw-r--r--connectivity/source/drivers/dbase/DIndexIter.cxx306
-rw-r--r--connectivity/source/drivers/dbase/DIndexes.cxx136
-rw-r--r--connectivity/source/drivers/dbase/DNoException.cxx623
-rw-r--r--connectivity/source/drivers/dbase/DPreparedStatement.cxx45
-rw-r--r--connectivity/source/drivers/dbase/DResultSet.cxx247
-rw-r--r--connectivity/source/drivers/dbase/DStatement.cxx46
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx2798
-rw-r--r--connectivity/source/drivers/dbase/DTables.cxx146
-rw-r--r--connectivity/source/drivers/dbase/Dservices.cxx114
-rwxr-xr-xconnectivity/source/drivers/dbase/dbase.component35
-rwxr-xr-xconnectivity/source/drivers/dbase/dbase.mxp.map171
-rw-r--r--connectivity/source/drivers/dbase/dbase.xcu100
-rwxr-xr-xconnectivity/source/drivers/dbase/dbase.xml31
-rw-r--r--connectivity/source/drivers/dbase/dindexnode.cxx1016
-rwxr-xr-xconnectivity/source/drivers/dbase/exports.dxp1
-rwxr-xr-xconnectivity/source/drivers/dbase/makefile.mk137
-rw-r--r--connectivity/source/drivers/evoab/LServices.cxx114
-rwxr-xr-xconnectivity/source/drivers/evoab/exports.dxp1
-rw-r--r--connectivity/source/drivers/evoab2/EApi.cxx138
-rwxr-xr-xconnectivity/source/drivers/evoab2/EApi.h145
-rw-r--r--connectivity/source/drivers/evoab2/NCatalog.cxx102
-rw-r--r--connectivity/source/drivers/evoab2/NCatalog.hxx58
-rw-r--r--connectivity/source/drivers/evoab2/NColumns.cxx93
-rw-r--r--connectivity/source/drivers/evoab2/NColumns.hxx60
-rw-r--r--connectivity/source/drivers/evoab2/NConnection.cxx293
-rw-r--r--connectivity/source/drivers/evoab2/NConnection.hxx126
-rw-r--r--connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx1196
-rw-r--r--connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx237
-rw-r--r--connectivity/source/drivers/evoab2/NDebug.cxx43
-rw-r--r--connectivity/source/drivers/evoab2/NDebug.hxx45
-rw-r--r--connectivity/source/drivers/evoab2/NDriver.cxx192
-rw-r--r--connectivity/source/drivers/evoab2/NDriver.hxx101
-rw-r--r--connectivity/source/drivers/evoab2/NPreparedStatement.cxx338
-rw-r--r--connectivity/source/drivers/evoab2/NPreparedStatement.hxx141
-rw-r--r--connectivity/source/drivers/evoab2/NResultSet.cxx1024
-rw-r--r--connectivity/source/drivers/evoab2/NResultSet.hxx186
-rw-r--r--connectivity/source/drivers/evoab2/NResultSetMetaData.cxx197
-rw-r--r--connectivity/source/drivers/evoab2/NResultSetMetaData.hxx91
-rw-r--r--connectivity/source/drivers/evoab2/NServices.cxx116
-rw-r--r--connectivity/source/drivers/evoab2/NStatement.cxx685
-rw-r--r--connectivity/source/drivers/evoab2/NStatement.hxx291
-rw-r--r--connectivity/source/drivers/evoab2/NTable.cxx90
-rw-r--r--connectivity/source/drivers/evoab2/NTable.hxx70
-rw-r--r--connectivity/source/drivers/evoab2/NTables.cxx105
-rw-r--r--connectivity/source/drivers/evoab2/NTables.hxx56
-rwxr-xr-xconnectivity/source/drivers/evoab2/evoab.component34
-rwxr-xr-xconnectivity/source/drivers/evoab2/evoab.xml28
-rw-r--r--connectivity/source/drivers/evoab2/evoab2.xcu76
-rwxr-xr-xconnectivity/source/drivers/evoab2/makefile.mk121
-rw-r--r--connectivity/source/drivers/file/FCatalog.cxx123
-rw-r--r--connectivity/source/drivers/file/FColumns.cxx96
-rw-r--r--connectivity/source/drivers/file/FConnection.cxx463
-rw-r--r--connectivity/source/drivers/file/FDatabaseMetaData.cxx1225
-rw-r--r--connectivity/source/drivers/file/FDateFunctions.cxx292
-rw-r--r--connectivity/source/drivers/file/FDriver.cxx287
-rw-r--r--connectivity/source/drivers/file/FNoException.cxx126
-rw-r--r--connectivity/source/drivers/file/FNumericFunctions.cxx252
-rw-r--r--connectivity/source/drivers/file/FPreparedStatement.cxx635
-rw-r--r--connectivity/source/drivers/file/FResultSet.cxx1872
-rw-r--r--connectivity/source/drivers/file/FResultSetMetaData.cxx221
-rw-r--r--connectivity/source/drivers/file/FStatement.cxx828
-rw-r--r--connectivity/source/drivers/file/FStringFunctions.cxx269
-rw-r--r--connectivity/source/drivers/file/FTable.cxx259
-rw-r--r--connectivity/source/drivers/file/FTables.cxx81
-rw-r--r--connectivity/source/drivers/file/fanalyzer.cxx343
-rw-r--r--connectivity/source/drivers/file/fcode.cxx514
-rw-r--r--connectivity/source/drivers/file/fcomp.cxx925
-rwxr-xr-xconnectivity/source/drivers/file/file.xml30
-rwxr-xr-xconnectivity/source/drivers/file/makefile.mk108
-rw-r--r--connectivity/source/drivers/file/quotedstring.cxx166
-rw-r--r--connectivity/source/drivers/flat/ECatalog.cxx75
-rw-r--r--connectivity/source/drivers/flat/EColumns.cxx58
-rw-r--r--connectivity/source/drivers/flat/EConnection.cxx185
-rw-r--r--connectivity/source/drivers/flat/EDatabaseMetaData.cxx268
-rw-r--r--connectivity/source/drivers/flat/EDriver.cxx147
-rw-r--r--connectivity/source/drivers/flat/EPreparedStatement.cxx46
-rw-r--r--connectivity/source/drivers/flat/EResultSet.cxx190
-rw-r--r--connectivity/source/drivers/flat/EStatement.cxx45
-rw-r--r--connectivity/source/drivers/flat/ETable.cxx926
-rw-r--r--connectivity/source/drivers/flat/ETables.cxx64
-rw-r--r--connectivity/source/drivers/flat/Eservices.cxx114
-rwxr-xr-xconnectivity/source/drivers/flat/exports.dxp1
-rwxr-xr-xconnectivity/source/drivers/flat/flat.component35
-rwxr-xr-xconnectivity/source/drivers/flat/flat.mxp.map139
-rw-r--r--connectivity/source/drivers/flat/flat.xcu120
-rwxr-xr-xconnectivity/source/drivers/flat/flat.xml31
-rwxr-xr-xconnectivity/source/drivers/flat/makefile.mk115
-rw-r--r--connectivity/source/drivers/hsqldb/HCatalog.cxx167
-rw-r--r--connectivity/source/drivers/hsqldb/HColumns.cxx92
-rw-r--r--connectivity/source/drivers/hsqldb/HConnection.cxx386
-rw-r--r--connectivity/source/drivers/hsqldb/HDriver.cxx924
-rw-r--r--connectivity/source/drivers/hsqldb/HStorage.hxx120
-rw-r--r--connectivity/source/drivers/hsqldb/HStorageAccess.cxx554
-rw-r--r--connectivity/source/drivers/hsqldb/HStorageMap.cxx365
-rw-r--r--connectivity/source/drivers/hsqldb/HTable.cxx429
-rw-r--r--connectivity/source/drivers/hsqldb/HTables.cxx202
-rw-r--r--connectivity/source/drivers/hsqldb/HTerminateListener.cxx68
-rw-r--r--connectivity/source/drivers/hsqldb/HTerminateListener.hxx67
-rw-r--r--connectivity/source/drivers/hsqldb/HTools.cxx76
-rw-r--r--connectivity/source/drivers/hsqldb/HUser.cxx353
-rw-r--r--connectivity/source/drivers/hsqldb/HUsers.cxx122
-rw-r--r--connectivity/source/drivers/hsqldb/HView.cxx216
-rw-r--r--connectivity/source/drivers/hsqldb/HViews.cxx172
-rw-r--r--connectivity/source/drivers/hsqldb/Hservices.cxx116
-rw-r--r--connectivity/source/drivers/hsqldb/StorageFileAccess.cxx183
-rw-r--r--connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx309
-rw-r--r--connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx222
-rw-r--r--connectivity/source/drivers/hsqldb/accesslog.cxx86
-rw-r--r--connectivity/source/drivers/hsqldb/accesslog.hxx148
-rwxr-xr-xconnectivity/source/drivers/hsqldb/exports.dxp28
-rwxr-xr-xconnectivity/source/drivers/hsqldb/hsqldb.component35
-rwxr-xr-xconnectivity/source/drivers/hsqldb/hsqldb.map33
-rw-r--r--connectivity/source/drivers/hsqldb/hsqldb.xcu78
-rwxr-xr-xconnectivity/source/drivers/hsqldb/hsqldb.xml26
-rwxr-xr-xconnectivity/source/drivers/hsqldb/hsqlui.hrc35
-rw-r--r--connectivity/source/drivers/hsqldb/hsqlui.src48
-rwxr-xr-xconnectivity/source/drivers/hsqldb/makefile.mk126
-rw-r--r--connectivity/source/drivers/jdbc/Array.cxx144
-rw-r--r--connectivity/source/drivers/jdbc/Blob.cxx147
-rw-r--r--connectivity/source/drivers/jdbc/Boolean.cxx54
-rw-r--r--connectivity/source/drivers/jdbc/CallableStatement.cxx360
-rw-r--r--connectivity/source/drivers/jdbc/Class.cxx75
-rw-r--r--connectivity/source/drivers/jdbc/Clob.cxx148
-rw-r--r--connectivity/source/drivers/jdbc/ConnectionLog.cxx137
-rw-r--r--connectivity/source/drivers/jdbc/ContextClassLoader.cxx134
-rw-r--r--connectivity/source/drivers/jdbc/DatabaseMetaData.cxx1465
-rw-r--r--connectivity/source/drivers/jdbc/Date.cxx55
-rw-r--r--connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx143
-rw-r--r--connectivity/source/drivers/jdbc/Exception.cxx50
-rw-r--r--connectivity/source/drivers/jdbc/InputStream.cxx112
-rw-r--r--connectivity/source/drivers/jdbc/JBigDecimal.cxx91
-rw-r--r--connectivity/source/drivers/jdbc/JConnection.cxx876
-rw-r--r--connectivity/source/drivers/jdbc/JDriver.cxx258
-rw-r--r--connectivity/source/drivers/jdbc/JStatement.cxx831
-rw-r--r--connectivity/source/drivers/jdbc/Object.cxx428
-rw-r--r--connectivity/source/drivers/jdbc/PreparedStatement.cxx668
-rw-r--r--connectivity/source/drivers/jdbc/Reader.cxx121
-rw-r--r--connectivity/source/drivers/jdbc/Ref.cxx63
-rw-r--r--connectivity/source/drivers/jdbc/ResultSet.cxx1088
-rw-r--r--connectivity/source/drivers/jdbc/ResultSetMetaData.cxx239
-rw-r--r--connectivity/source/drivers/jdbc/SQLException.cxx101
-rw-r--r--connectivity/source/drivers/jdbc/SQLWarning.cxx50
-rw-r--r--connectivity/source/drivers/jdbc/String.cxx64
-rw-r--r--connectivity/source/drivers/jdbc/Throwable.cxx71
-rw-r--r--connectivity/source/drivers/jdbc/Timestamp.cxx194
-rwxr-xr-xconnectivity/source/drivers/jdbc/exports.dxp1
-rwxr-xr-xconnectivity/source/drivers/jdbc/jdbc.component34
-rwxr-xr-xconnectivity/source/drivers/jdbc/jdbc.mxp.map152
-rw-r--r--connectivity/source/drivers/jdbc/jdbc.xcu219
-rwxr-xr-xconnectivity/source/drivers/jdbc/jdbc.xml28
-rw-r--r--connectivity/source/drivers/jdbc/jservices.cxx117
-rwxr-xr-xconnectivity/source/drivers/jdbc/makefile.mk120
-rw-r--r--connectivity/source/drivers/jdbc/tools.cxx277
-rw-r--r--connectivity/source/drivers/kab/KCatalog.cxx127
-rw-r--r--connectivity/source/drivers/kab/KCatalog.hxx67
-rw-r--r--connectivity/source/drivers/kab/KColumns.cxx101
-rw-r--r--connectivity/source/drivers/kab/KColumns.hxx57
-rw-r--r--connectivity/source/drivers/kab/KConnection.cxx331
-rw-r--r--connectivity/source/drivers/kab/KConnection.hxx142
-rw-r--r--connectivity/source/drivers/kab/KDEInit.cxx158
-rwxr-xr-xconnectivity/source/drivers/kab/KDEInit.h47
-rw-r--r--connectivity/source/drivers/kab/KDatabaseMetaData.cxx1083
-rw-r--r--connectivity/source/drivers/kab/KDatabaseMetaData.hxx216
-rw-r--r--connectivity/source/drivers/kab/KDriver.cxx475
-rw-r--r--connectivity/source/drivers/kab/KDriver.hxx226
-rw-r--r--connectivity/source/drivers/kab/KPreparedStatement.cxx393
-rw-r--r--connectivity/source/drivers/kab/KPreparedStatement.hxx122
-rw-r--r--connectivity/source/drivers/kab/KResultSet.cxx990
-rw-r--r--connectivity/source/drivers/kab/KResultSet.hxx227
-rw-r--r--connectivity/source/drivers/kab/KResultSetMetaData.cxx190
-rw-r--r--connectivity/source/drivers/kab/KResultSetMetaData.hxx95
-rw-r--r--connectivity/source/drivers/kab/KServices.cxx117
-rw-r--r--connectivity/source/drivers/kab/KStatement.cxx587
-rw-r--r--connectivity/source/drivers/kab/KStatement.hxx173
-rw-r--r--connectivity/source/drivers/kab/KTable.cxx99
-rw-r--r--connectivity/source/drivers/kab/KTable.hxx71
-rw-r--r--connectivity/source/drivers/kab/KTables.cxx93
-rw-r--r--connectivity/source/drivers/kab/KTables.hxx64
-rwxr-xr-xconnectivity/source/drivers/kab/exports.dxp1
-rw-r--r--connectivity/source/drivers/kab/kab.xcu46
-rwxr-xr-xconnectivity/source/drivers/kab/kab.xml77
-rwxr-xr-xconnectivity/source/drivers/kab/kab1.component34
-rwxr-xr-xconnectivity/source/drivers/kab/kabdrv.map9
-rw-r--r--connectivity/source/drivers/kab/kcondition.cxx232
-rw-r--r--connectivity/source/drivers/kab/kcondition.hxx163
-rw-r--r--connectivity/source/drivers/kab/kfields.cxx97
-rw-r--r--connectivity/source/drivers/kab/kfields.hxx50
-rw-r--r--connectivity/source/drivers/kab/korder.cxx91
-rw-r--r--connectivity/source/drivers/kab/korder.hxx77
-rwxr-xr-xconnectivity/source/drivers/kab/makefile.mk149
-rw-r--r--connectivity/source/drivers/macab/MacabAddressBook.cxx258
-rw-r--r--connectivity/source/drivers/macab/MacabAddressBook.hxx75
-rw-r--r--connectivity/source/drivers/macab/MacabCatalog.cxx127
-rw-r--r--connectivity/source/drivers/macab/MacabCatalog.hxx67
-rw-r--r--connectivity/source/drivers/macab/MacabColumns.cxx101
-rw-r--r--connectivity/source/drivers/macab/MacabColumns.hxx57
-rw-r--r--connectivity/source/drivers/macab/MacabConnection.cxx326
-rw-r--r--connectivity/source/drivers/macab/MacabConnection.hxx134
-rw-r--r--connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx1127
-rw-r--r--connectivity/source/drivers/macab/MacabDatabaseMetaData.hxx215
-rw-r--r--connectivity/source/drivers/macab/MacabDriver.cxx350
-rw-r--r--connectivity/source/drivers/macab/MacabDriver.hxx199
-rw-r--r--connectivity/source/drivers/macab/MacabGroup.cxx104
-rw-r--r--connectivity/source/drivers/macab/MacabGroup.hxx53
-rw-r--r--connectivity/source/drivers/macab/MacabHeader.cxx346
-rw-r--r--connectivity/source/drivers/macab/MacabHeader.hxx74
-rw-r--r--connectivity/source/drivers/macab/MacabPreparedStatement.cxx410
-rw-r--r--connectivity/source/drivers/macab/MacabPreparedStatement.hxx122
-rw-r--r--connectivity/source/drivers/macab/MacabRecord.cxx350
-rw-r--r--connectivity/source/drivers/macab/MacabRecord.hxx80
-rw-r--r--connectivity/source/drivers/macab/MacabRecords.cxx1215
-rw-r--r--connectivity/source/drivers/macab/MacabRecords.hxx139
-rw-r--r--connectivity/source/drivers/macab/MacabResultSet.cxx1076
-rw-r--r--connectivity/source/drivers/macab/MacabResultSet.hxx229
-rw-r--r--connectivity/source/drivers/macab/MacabResultSetMetaData.cxx227
-rw-r--r--connectivity/source/drivers/macab/MacabResultSetMetaData.hxx97
-rw-r--r--connectivity/source/drivers/macab/MacabServices.cxx117
-rw-r--r--connectivity/source/drivers/macab/MacabStatement.cxx614
-rw-r--r--connectivity/source/drivers/macab/MacabStatement.hxx177
-rw-r--r--connectivity/source/drivers/macab/MacabTable.cxx99
-rw-r--r--connectivity/source/drivers/macab/MacabTable.hxx71
-rw-r--r--connectivity/source/drivers/macab/MacabTables.cxx93
-rw-r--r--connectivity/source/drivers/macab/MacabTables.hxx64
-rwxr-xr-xconnectivity/source/drivers/macab/exports.dxp1
-rw-r--r--connectivity/source/drivers/macab/macab.xcu46
-rwxr-xr-xconnectivity/source/drivers/macab/macab.xml77
-rwxr-xr-xconnectivity/source/drivers/macab/macab1.component34
-rw-r--r--connectivity/source/drivers/macab/macabcondition.cxx253
-rw-r--r--connectivity/source/drivers/macab/macabcondition.hxx170
-rw-r--r--connectivity/source/drivers/macab/macaborder.cxx89
-rw-r--r--connectivity/source/drivers/macab/macaborder.hxx77
-rw-r--r--connectivity/source/drivers/macab/macabutilities.hxx152
-rwxr-xr-xconnectivity/source/drivers/macab/makefile.mk138
-rw-r--r--connectivity/source/drivers/mozab/MCatalog.cxx128
-rw-r--r--connectivity/source/drivers/mozab/MCatalog.hxx65
-rw-r--r--connectivity/source/drivers/mozab/MColumnAlias.cxx195
-rw-r--r--connectivity/source/drivers/mozab/MColumnAlias.hxx88
-rw-r--r--connectivity/source/drivers/mozab/MColumns.cxx101
-rw-r--r--connectivity/source/drivers/mozab/MColumns.hxx60
-rw-r--r--connectivity/source/drivers/mozab/MConfigAccess.cxx271
-rw-r--r--connectivity/source/drivers/mozab/MConfigAccess.hxx41
-rw-r--r--connectivity/source/drivers/mozab/MConnection.cxx607
-rw-r--r--connectivity/source/drivers/mozab/MConnection.hxx233
-rw-r--r--connectivity/source/drivers/mozab/MDatabaseMetaData.cxx1033
-rw-r--r--connectivity/source/drivers/mozab/MDatabaseMetaData.hxx207
-rw-r--r--connectivity/source/drivers/mozab/MDriver.cxx333
-rw-r--r--connectivity/source/drivers/mozab/MDriver.hxx113
-rw-r--r--connectivity/source/drivers/mozab/MExtConfigAccess.hxx48
-rw-r--r--connectivity/source/drivers/mozab/MPreparedStatement.cxx546
-rw-r--r--connectivity/source/drivers/mozab/MPreparedStatement.hxx170
-rw-r--r--connectivity/source/drivers/mozab/MResultSet.cxx1980
-rw-r--r--connectivity/source/drivers/mozab/MResultSet.hxx369
-rw-r--r--connectivity/source/drivers/mozab/MResultSetMetaData.cxx214
-rw-r--r--connectivity/source/drivers/mozab/MResultSetMetaData.hxx101
-rw-r--r--connectivity/source/drivers/mozab/MServices.cxx160
-rw-r--r--connectivity/source/drivers/mozab/MStatement.cxx564
-rw-r--r--connectivity/source/drivers/mozab/MStatement.hxx214
-rw-r--r--connectivity/source/drivers/mozab/MTable.cxx97
-rw-r--r--connectivity/source/drivers/mozab/MTable.hxx72
-rw-r--r--connectivity/source/drivers/mozab/MTables.cxx104
-rw-r--r--connectivity/source/drivers/mozab/MTables.hxx57
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx283
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx104
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx156
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx43
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx141
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx87
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx347
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSInit.hxx47
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx635
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfile.hxx76
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.cxx243
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.hxx85
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx422
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx125
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx116
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.hxx74
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSRunnable.cxx100
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSRunnable.hxx69
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/makefile.mk95
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/mozbootstrap.component34
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/mozilla_nsinit.h57
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/mozilla_nsprofile.h92
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/mozilla_nsprofiledirserviceprovider.h44
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/mozilla_profile_discover.h49
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/mozilla_profilemanager.h87
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/post_include_windows.h33
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/pre_include_windows.h34
-rwxr-xr-xconnectivity/source/drivers/mozab/exports.dxp1
-rwxr-xr-xconnectivity/source/drivers/mozab/makefile.mk194
-rwxr-xr-xconnectivity/source/drivers/mozab/makefile_mozab.mk127
-rwxr-xr-xconnectivity/source/drivers/mozab/mozab.component37
-rw-r--r--connectivity/source/drivers/mozab/mozab.xcu154
-rwxr-xr-xconnectivity/source/drivers/mozab/mozab.xml80
-rw-r--r--connectivity/source/drivers/mozab/mozab2.xcu118
-rwxr-xr-xconnectivity/source/drivers/mozab/mozabdrv.map8
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx805
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx78
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx80
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx453
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx78
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSDeclares.hxx54
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx84
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx407
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.hxx116
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx88
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.hxx60
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx143
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNameMapper.hxx86
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx826
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx282
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx637
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx137
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx134
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx68
-rwxr-xr-xconnectivity/source/drivers/mozab/mozillasrc/makefile.mk77
-rwxr-xr-xconnectivity/source/drivers/mozab/post_include_mozilla.h61
-rwxr-xr-xconnectivity/source/drivers/mozab/pre_include_mozilla.h65
-rw-r--r--connectivity/source/drivers/mysql/YCatalog.cxx176
-rw-r--r--connectivity/source/drivers/mysql/YColumns.cxx92
-rw-r--r--connectivity/source/drivers/mysql/YDriver.cxx484
-rw-r--r--connectivity/source/drivers/mysql/YTable.cxx387
-rw-r--r--connectivity/source/drivers/mysql/YTables.cxx246
-rw-r--r--connectivity/source/drivers/mysql/YUser.cxx352
-rw-r--r--connectivity/source/drivers/mysql/YUsers.cxx120
-rw-r--r--connectivity/source/drivers/mysql/YViews.cxx165
-rw-r--r--connectivity/source/drivers/mysql/Yservices.cxx115
-rwxr-xr-xconnectivity/source/drivers/mysql/exports.dxp1
-rwxr-xr-xconnectivity/source/drivers/mysql/makefile.mk92
-rwxr-xr-xconnectivity/source/drivers/mysql/mysql.component35
-rw-r--r--connectivity/source/drivers/mysql/mysql.xcu258
-rwxr-xr-xconnectivity/source/drivers/mysql/mysql.xml27
-rw-r--r--connectivity/source/drivers/odbc/OFunctions.cxx249
-rw-r--r--connectivity/source/drivers/odbc/ORealDriver.cxx371
-rw-r--r--connectivity/source/drivers/odbc/ORealDriver.hxx53
-rwxr-xr-xconnectivity/source/drivers/odbc/makefile.mk87
-rwxr-xr-xconnectivity/source/drivers/odbc/odbc.component34
-rw-r--r--connectivity/source/drivers/odbc/odbc.xcu180
-rwxr-xr-xconnectivity/source/drivers/odbc/odbc.xml26
-rw-r--r--connectivity/source/drivers/odbc/oservices.cxx116
-rw-r--r--connectivity/source/drivers/odbcbase/OConnection.cxx672
-rw-r--r--connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx1744
-rw-r--r--connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx1340
-rw-r--r--connectivity/source/drivers/odbcbase/ODriver.cxx231
-rw-r--r--connectivity/source/drivers/odbcbase/OPreparedStatement.cxx978
-rw-r--r--connectivity/source/drivers/odbcbase/OResultSet.cxx1768
-rw-r--r--connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx318
-rw-r--r--connectivity/source/drivers/odbcbase/OStatement.cxx1162
-rw-r--r--connectivity/source/drivers/odbcbase/OTools.cxx908
-rwxr-xr-xconnectivity/source/drivers/odbcbase/makefile.mk90
441 files changed, 0 insertions, 110725 deletions
diff --git a/connectivity/source/drivers/adabas/BCatalog.cxx b/connectivity/source/drivers/adabas/BCatalog.cxx
deleted file mode 100644
index bae14af719..0000000000
--- a/connectivity/source/drivers/adabas/BCatalog.cxx
+++ /dev/null
@@ -1,169 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "adabas/BCatalog.hxx"
-#include "adabas/BConnection.hxx"
-#include "adabas/BGroups.hxx"
-#include "adabas/BUsers.hxx"
-#include "adabas/BTables.hxx"
-#include "adabas/BViews.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <comphelper/types.hxx>
-
-
-// -------------------------------------------------------------------------
-using namespace connectivity;
-using namespace connectivity::adabas;
-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;
-// -----------------------------------------------------------------------------
-OAdabasCatalog::OAdabasCatalog(SQLHANDLE _aConnectionHdl, OAdabasConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon)
- ,m_pConnection(_pCon)
- ,m_aConnectionHdl(_aConnectionHdl)
-{
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OAdabasCatalog::buildName(const Reference< XRow >& _xRow)
-{
- ::rtl::OUString sName;
- sName = _xRow->getString(2);
- if ( sName.getLength() )
- sName += OAdabasCatalog::getDot();
- sName += _xRow->getString(3);
-
- return sName;
-}
-// -----------------------------------------------------------------------------
-void OAdabasCatalog::fillVector(const ::rtl::OUString& _sQuery,TStringVector& _rVector)
-{
- Reference< XStatement > xStmt = m_pConnection->createStatement( );
- OSL_ENSURE(xStmt.is(),"OAdabasCatalog::fillVector: Could not create a statement!");
- Reference< XResultSet > xResult = xStmt->executeQuery(_sQuery);
-
- fillNames(xResult,_rVector);
- ::comphelper::disposeComponent(xStmt);
-
-}
-// -------------------------------------------------------------------------
-void OAdabasCatalog::refreshTables()
-{
- TStringVector aVector;
- {
- Sequence< ::rtl::OUString > aTypes(1);
- aTypes[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%"));
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),
- aTypes);
- fillNames(xResult,aVector);
- }
-
- if(m_pTables)
- m_pTables->reFill(aVector);
- else
- m_pTables = new OTables(m_xMetaData,*this,m_aMutex,aVector);
-}
-// -------------------------------------------------------------------------
-void OAdabasCatalog::refreshViews()
-{
- TStringVector aVector;
- static const ::rtl::OUString s_sView(RTL_CONSTASCII_USTRINGPARAM("SELECT DISTINCT NULL,DOMAIN.VIEWDEFS.OWNER, DOMAIN.VIEWDEFS.VIEWNAME FROM DOMAIN.VIEWDEFS"));
- fillVector(s_sView,aVector);
-
- if(m_pViews)
- m_pViews->reFill(aVector);
- else
- m_pViews = new OViews(m_xMetaData,*this,m_aMutex,aVector);
-}
-// -------------------------------------------------------------------------
-void OAdabasCatalog::refreshGroups()
-{
- TStringVector aVector;
- static const ::rtl::OUString s_sGroup(RTL_CONSTASCII_USTRINGPARAM("SELECT DISTINCT NULL,NULL,GROUPNAME FROM DOMAIN.USERS WHERE GROUPNAME IS NOT NULL AND GROUPNAME <> ' '"));
- fillVector(s_sGroup,aVector);
- if(m_pGroups)
- m_pGroups->reFill(aVector);
- else
- m_pGroups = new OGroups(*this,m_aMutex,aVector,m_pConnection,this);
-}
-// -------------------------------------------------------------------------
-void OAdabasCatalog::refreshUsers()
-{
- TStringVector aVector;
- static const ::rtl::OUString s_sUsers(RTL_CONSTASCII_USTRINGPARAM("SELECT DISTINCT NULL,NULL,USERNAME FROM DOMAIN.USERS WHERE USERNAME IS NOT NULL AND USERNAME <> ' ' AND USERNAME <> 'CONTROL'"));
- fillVector(s_sUsers,aVector);
-
- if(m_pUsers)
- m_pUsers->reFill(aVector);
- else
- m_pUsers = new OUsers(*this,m_aMutex,aVector,m_pConnection,this);
-}
-// -------------------------------------------------------------------------
-const ::rtl::OUString& OAdabasCatalog::getDot()
-{
- static const ::rtl::OUString sDot(RTL_CONSTASCII_USTRINGPARAM("."));
- return sDot;
-}
-// -----------------------------------------------------------------------------
-void OAdabasCatalog::correctColumnProperties(sal_Int32 /*_nPrec*/, sal_Int32& _rnType,::rtl::OUString& _rsTypeName)
-{
- switch(_rnType)
- {
- case DataType::DECIMAL:
- {
- static const ::rtl::OUString sDecimal(RTL_CONSTASCII_USTRINGPARAM("DECIMAL"));
- if(_rnType == DataType::DECIMAL && _rsTypeName == sDecimal)
- _rnType = DataType::NUMERIC;
- }
- break;
- case DataType::FLOAT:
- // if(_nPrec >= 16)
- {
- static const ::rtl::OUString sDouble(RTL_CONSTASCII_USTRINGPARAM("DOUBLE PRECISION"));
- _rsTypeName = sDouble;
- _rnType = DataType::DOUBLE;
- }
-// else if(_nPrec > 15)
-// {
-// static const ::rtl::OUString sReal( RTL_CONSTASCII_USTRINGPARAM( "REAL" ));
-// _rsTypeName = sReal;
-// _rnType = DataType::REAL;
-// }
- break;
- }
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BColumns.cxx b/connectivity/source/drivers/adabas/BColumns.cxx
deleted file mode 100644
index aa62a6a4d8..0000000000
--- a/connectivity/source/drivers/adabas/BColumns.cxx
+++ /dev/null
@@ -1,183 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "adabas/BColumns.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include "adabas/BTable.hxx"
-#include "adabas/BTables.hxx"
-#include "adabas/BCatalog.hxx"
-#include <comphelper/types.hxx>
-#include "connectivity/dbtools.hxx"
-#include <comphelper/property.hxx>
-
-using namespace ::comphelper;
-using namespace connectivity::adabas;
-using namespace connectivity::sdbcx;
-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;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName)
-{
- Reference< XResultSet > xResult = m_pTable->getMetaData()->getColumns(Any(),
- m_pTable->getSchema(),m_pTable->getTableName(),_rName);
-
- sdbcx::ObjectType xRet = NULL;
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while(xResult->next())
- {
- if(xRow->getString(4) == _rName)
- {
- sal_Int32 nType = xRow->getInt(5);
- ::rtl::OUString sTypeName = xRow->getString(6);
- sal_Int32 nPrec = xRow->getInt(7);
- OAdabasCatalog::correctColumnProperties(nPrec,nType,sTypeName);
- sal_Bool bAutoIncrement = sal_False;
- if ( !_rName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("DEFAULT")) && !m_pTable->getSchema().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("DOMAIN")) && !m_pTable->getTableName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("COLUMNS")) )
- {
- Reference< XStatement > xStmt = m_pTable->getMetaData()->getConnection()->createStatement( );
- ::rtl::OUString sQuery(RTL_CONSTASCII_USTRINGPARAM("SELECT \"DEFAULT\" FROM DOMAIN.COLUMNS WHERE OWNER = '"));
- sQuery += m_pTable->getSchema();
- sQuery += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("' AND TABLENAME = '"));
- sQuery += m_pTable->getTableName() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("' AND COLUMNNAME = '"));
- sQuery += _rName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'"));
- try
- {
- Reference< XResultSet > xResult2 = xStmt->executeQuery(sQuery);
- Reference< XRow > xRow2(xResult2,UNO_QUERY);
- if ( xRow2.is() && xResult2->next() )
- bAutoIncrement = xRow2->getString(1) == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DEFAULT STAMP"));
- }
- catch(const Exception&)
- {
- }
- }
-
- xRet = new OColumn(_rName,
- sTypeName,
- xRow->getString(13),
- xRow->getString(12),
- xRow->getInt(11),
- nPrec,
- xRow->getInt(9),
- nType,
- bAutoIncrement,sal_False,sal_False,sal_True);
- break;
- }
- }
- ::comphelper::disposeComponent(xResult);
- }
-
- return xRet;
-}
-
-// -------------------------------------------------------------------------
-void OColumns::impl_refresh() throw(RuntimeException)
-{
- m_pTable->refreshColumns();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OColumns::createDescriptor()
-{
- return new OColumn(sal_True);
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OColumns::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- ::osl::MutexGuard aGuard(m_rMutex);
- if ( m_pTable->isNew() )
- return cloneDescriptor( descriptor );
-
- ::rtl::OUString aSql(RTL_CONSTASCII_USTRINGPARAM("ALTER TABLE "));
- ::rtl::OUString sQuote = m_pTable->getMetaData()->getIdentifierQuoteString( );
- const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
-
- m_pTable->beginTransAction();
- try
- {
- aSql += ::dbtools::quoteName(sQuote,m_pTable->getSchema()) + sDot + ::dbtools::quoteName(sQuote,m_pTable->getTableName());
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ADD ("));
- aSql += ::dbtools::quoteName(sQuote,_rForName);
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "));
- aSql += OTables::getColumnSqlType(descriptor);
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" )"));
-
- Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement();
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
-
- m_pTable->alterNotNullValue(getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))),_rForName);
- }
- catch(const Exception&)
- {
- m_pTable->rollbackTransAction();
- throw;
- }
- m_pTable->endTransAction();
-
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OColumns::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName)
-{
- OSL_ENSURE(m_pTable,"OColumns::dropByName: Table is null!");
- if(!m_pTable->isNew())
- {
- ::rtl::OUString aSql(RTL_CONSTASCII_USTRINGPARAM("ALTER TABLE "));
- ::rtl::OUString sQuote = m_pTable->getMetaData()->getIdentifierQuoteString( );
- const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
-
- aSql += ::dbtools::quoteName(sQuote,m_pTable->getSchema()) + sDot + ::dbtools::quoteName(sQuote,m_pTable->getTableName());
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DROP "));
- aSql += ::dbtools::quoteName(sQuote,_sElementName);
-
- Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( );
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BConnection.cxx b/connectivity/source/drivers/adabas/BConnection.cxx
deleted file mode 100644
index 9aae67312c..0000000000
--- a/connectivity/source/drivers/adabas/BConnection.cxx
+++ /dev/null
@@ -1,274 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include "adabas/BConnection.hxx"
-#include "adabas/BDriver.hxx"
-#include "adabas/BCatalog.hxx"
-#include "odbc/OFunctions.hxx"
-#include "odbc/OTools.hxx"
-#include "adabas/BDatabaseMetaData.hxx"
-#include "adabas/BStatement.hxx"
-#include "adabas/BPreparedStatement.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <connectivity/dbcharset.hxx>
-#include "connectivity/sqliterator.hxx"
-#include <connectivity/sqlparse.hxx>
-
-#include <string.h>
-
-using namespace connectivity::adabas;
-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;
-
-
-//------------------------------------------------------------------------------
-namespace starlang = ::com::sun::star::lang;
-// --------------------------------------------------------------------------------
-OAdabasConnection::OAdabasConnection(const SQLHANDLE _pDriverHandle, connectivity::odbc::ODBCDriver* _pDriver)
- : OConnection_BASE2(_pDriverHandle,_pDriver)
-{
- m_bUseOldDateFormat = sal_True;
-}
-//-----------------------------------------------------------------------------
-SQLRETURN OAdabasConnection::Construct( const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- m_aConnectionHandle = SQL_NULL_HANDLE;
- setURL(url);
- setConnectionInfo(info);
-
- // Connection allozieren
- N3SQLAllocHandle(SQL_HANDLE_DBC,m_pDriverHandleCopy,&m_aConnectionHandle);
- if(m_aConnectionHandle == SQL_NULL_HANDLE)
- throw SQLException();
-
- const PropertyValue *pBegin = info.getConstArray();
- const PropertyValue *pEnd = pBegin + info.getLength();
- ::rtl::OUString sHostName;
-
- sal_Int32 nLen = url.indexOf(':');
- nLen = url.indexOf(':',nLen+1);
- ::rtl::OUString aDSN(url.copy(nLen+1)),aUID,aPWD;
- sal_Int32 nTimeout = 20;
- for(;pBegin != pEnd;++pBegin)
- {
- if ( !pBegin->Name.compareToAscii("Timeout") )
- pBegin->Value >>= nTimeout;
- else if(!pBegin->Name.compareToAscii("user"))
- pBegin->Value >>= aUID;
- else if(!pBegin->Name.compareToAscii("password"))
- pBegin->Value >>= aPWD;
- else if(!pBegin->Name.compareToAscii("HostName"))
- pBegin->Value >>= sHostName;
- else if(0 == pBegin->Name.compareToAscii("CharSet"))
- {
- ::rtl::OUString sIanaName;
- OSL_VERIFY( pBegin->Value >>= sIanaName );
-
- ::dbtools::OCharsetMap aLookupIanaName;
- ::dbtools::OCharsetMap::const_iterator aLookup = aLookupIanaName.find(sIanaName, ::dbtools::OCharsetMap::IANA());
- if (aLookup != aLookupIanaName.end())
- m_nTextEncoding = (*aLookup).getEncoding();
- else
- m_nTextEncoding = RTL_TEXTENCODING_DONTKNOW;
- if(m_nTextEncoding == RTL_TEXTENCODING_DONTKNOW)
- m_nTextEncoding = osl_getThreadTextEncoding();
- }
- }
- m_sUser = aUID;
-
- if ( sHostName.getLength() )
- aDSN = sHostName + rtl::OUString(static_cast<sal_Unicode>(':')) + aDSN;
- SQLRETURN nSQLRETURN = openConnectionWithAuth(aDSN,nTimeout, aUID,aPWD);
-
- return nSQLRETURN;
-}
-//-----------------------------------------------------------------------------
-SQLRETURN OAdabasConnection::openConnectionWithAuth(const ::rtl::OUString& aConnectStr,sal_Int32 nTimeOut, const ::rtl::OUString& _uid,const ::rtl::OUString& _pwd)
-{
- if (m_aConnectionHandle == SQL_NULL_HANDLE)
- return -1;
-
- SQLRETURN nSQLRETURN = 0;
- SDB_ODBC_CHAR szDSN[4096];
- SDB_ODBC_CHAR szUID[20];
- SDB_ODBC_CHAR szPWD[20];
-
- memset(szDSN,'\0',4096);
- memset(szUID,'\0',20);
- memset(szPWD,'\0',20);
-
- ::rtl::OString aConStr(::rtl::OUStringToOString(aConnectStr,getTextEncoding()));
- ::rtl::OString aUID(::rtl::OUStringToOString(_uid,getTextEncoding()));
- ::rtl::OString aPWD(::rtl::OUStringToOString(_pwd,getTextEncoding()));
- memcpy(szDSN, (SDB_ODBC_CHAR*) aConStr.getStr(), ::std::min<sal_Int32>((sal_Int32)2048,aConStr.getLength()));
- memcpy(szUID, (SDB_ODBC_CHAR*) aUID.getStr(), ::std::min<sal_Int32>((sal_Int32)20,aUID.getLength()));
- memcpy(szPWD, (SDB_ODBC_CHAR*) aPWD.getStr(), ::std::min<sal_Int32>((sal_Int32)20,aPWD.getLength()));
-
-
-
- N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,(SQLPOINTER)(sal_IntPtr)nTimeOut,SQL_IS_INTEGER);
- // Verbindung aufbauen
-
- nSQLRETURN = N3SQLConnect(m_aConnectionHandle,
- szDSN,
- (SQLSMALLINT) ::std::min<sal_Int32>((sal_Int32)2048,aConStr.getLength()),
- szUID,
- (SQLSMALLINT) ::std::min<sal_Int32>((sal_Int32)20,aUID.getLength()),
- szPWD,
- (SQLSMALLINT) ::std::min<sal_Int32>((sal_Int32)20,aPWD.getLength()));
- if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA)
- return nSQLRETURN;
-
- m_bClosed = sal_False;
-
- // autocoomit ist immer default
-
- N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_AUTOCOMMIT,(SQLPOINTER)SQL_AUTOCOMMIT_ON,SQL_IS_INTEGER);
-
- return nSQLRETURN;
-}
-
-//------------------------------------------------------------------------------
-void OAdabasConnection::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- Reference< XTablesSupplier > xTableSupplier(m_xCatalog);
- ::comphelper::disposeComponent(xTableSupplier);
-
- m_xCatalog = WeakReference< XTablesSupplier >();
-
- OConnection_BASE2::disposing();
-}
-//------------------------------------------------------------------------------
-Reference< XTablesSupplier > OAdabasConnection::createCatalog()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- Reference< XTablesSupplier > xTab = m_xCatalog;
- if(!xTab.is())
- {
- xTab = new OAdabasCatalog(m_aConnectionHandle,this);
- m_xCatalog = xTab;
- }
- return xTab;
-}
-// --------------------------------------------------------------------------------
-Reference< XDatabaseMetaData > SAL_CALL OAdabasConnection::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE2::rBHelper.bDisposed);
-
-
- Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
- if(!xMetaData.is())
- {
- xMetaData = new OAdabasDatabaseMetaData(m_aConnectionHandle,this);
- m_xMetaData = xMetaData;
- }
-
- return xMetaData;
-}
-// --------------------------------------------------------------------------------
-Reference< XStatement > SAL_CALL OAdabasConnection::createStatement( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE2::rBHelper.bDisposed);
-
- Reference< XStatement > xReturn = new OAdabasStatement(this);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
- return xReturn;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL OAdabasConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE2::rBHelper.bDisposed);
-
- Reference< XPreparedStatement > xReturn = new OAdabasPreparedStatement(this,sql);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
- return xReturn;
-}
-// -----------------------------------------------------------------------------
-sal_Int64 SAL_CALL OAdabasConnection::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw (::com::sun::star::uno::RuntimeException)
-{
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : OConnection_BASE2::getSomething(rId);
-}
-// -----------------------------------------------------------------------------
-Sequence< sal_Int8 > OAdabasConnection::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-// -----------------------------------------------------------------------------
-::connectivity::odbc::OConnection* OAdabasConnection::cloneConnection()
-{
- return new OAdabasConnection(m_pDriverHandleCopy,m_pDriver);
-}
-// -----------------------------------------------------------------------------
-::rtl::Reference<OSQLColumns> OAdabasConnection::createSelectColumns(const ::rtl::OUString& _rSql)
-{
- ::rtl::Reference<OSQLColumns> aRet;
- OSQLParser aParser(getDriver()->getORB());
- ::rtl::OUString sErrorMessage;
- OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,_rSql);
- if(pNode)
- {
- Reference< XTablesSupplier> xCata = createCatalog();
- OSQLParseTreeIterator aParseIter(this, xCata->getTables(),
- aParser, pNode);
- aParseIter.traverseAll();
- aRet = aParseIter.getSelectColumns();
- }
- return aRet;
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx b/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx
deleted file mode 100644
index d1a9b96e98..0000000000
--- a/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "adabas/BDatabaseMetaData.hxx"
-#include "FDatabaseMetaDataResultSet.hxx"
-
-using namespace connectivity::adabas;
-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;
-
-::rtl::OUString SAL_CALL OAdabasDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue(RTL_CONSTASCII_USTRINGPARAM("sdbc:adabas:"));
- aValue += OAdabasDatabaseMetaData_BASE::getURLImpl();
- return aValue;
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OAdabasDatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-Reference< XResultSet > OAdabasDatabaseMetaData::impl_getTypeInfo_throw( )
-{
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
- Reference< XResultSet > xNewRes = pResult;
- static ::connectivity::ODatabaseMetaDataResultSet::ORows aRows;
- if(aRows.empty())
- {
- aRows.reserve(19);
- Reference< XResultSet > xRes = OAdabasDatabaseMetaData_BASE::impl_getTypeInfo_throw();
-
- if(xRes.is())
- {
- ::connectivity::ODatabaseMetaDataResultSet::ORow aRow(19);
-
- Reference< XRow> xRow(xRes,UNO_QUERY);
- while(xRes->next())
- {
- sal_Int32 nPos = 1;
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (1));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (2));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (3));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (4));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (5));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (6));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (7));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getBoolean (8));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getShort (9));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getBoolean (10));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (11));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getBoolean (12));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (13));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getShort (14));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getShort (15));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (16));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (17));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
- aRow[nPos++] = new ::connectivity::ORowSetValueDecorator((sal_Int16)xRow->getInt(18));
- if(xRow->wasNull())
- aRow[nPos-1]->setNull();
-
- // we have to fix some incorrect entries
- if(!aRow[2]->getValue().isNull())
- {
- switch((sal_Int32)aRow[2]->getValue())
- {
- case DataType::FLOAT:
- case DataType::REAL:
- case DataType::DOUBLE:
- aRow[2]->setValue(DataType::DOUBLE);
- aRow[3]->setValue(sal_Int32(18));
- break;
- case DataType::TIMESTAMP:
- aRow[3]->setValue(sal_Int32(27));
- break;
- default:
- break;
- }
- }
- aRows.push_back(aRow);
- }
- }
- }
- pResult->setRows(aRows);
- return xNewRes;
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BDriver.cxx b/connectivity/source/drivers/adabas/BDriver.cxx
deleted file mode 100644
index f215b17b9d..0000000000
--- a/connectivity/source/drivers/adabas/BDriver.cxx
+++ /dev/null
@@ -1,1870 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#ifdef SYSTEM_ODBC_HEADERS
-#include <sqltypes.h>
-#else
-#include <odbc/sqltypes.h>
-#endif
-
-#include <unotools/tempfile.hxx>
-#include <sal/macros.h>
-#include "adabas/BDriver.hxx"
-#include "adabas/BConnection.hxx"
-#include "odbc/OFunctions.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "odbc/OTools.hxx"
-#include "connectivity/dbexception.hxx"
-#include "TConnection.hxx"
-#include "diagnose_ex.h"
-
-#include <osl/process.h>
-#include <unotools/ucbhelper.hxx>
-#include <unotools/ucbstreamhelper.hxx>
-#include <unotools/localfilehelper.hxx>
-#include "resource/adabas_res.hrc"
-#include "resource/sharedresources.hxx"
-
-
-#include <memory>
-#include <sys/stat.h>
-
-#if defined(UNX)
-const char sNewLine = '\012';
-#else
-const char sNewLine[] = "\015\012"; // \015\012 and not \n
-#endif
-#define ADABAS_DB_11 "11.02.00"
-#define ADABAS_KERNEL_11 "11.02"
-#define ADABAS_DB_12 "12.01.00"
-#define ADABAS_KERNEL_12 "12.01"
-#define CURRENT_DB_VERSION "13.01.00"
-#define CURRENT_KERNEL_VERSION "13.01"
-
-#define OPROCESS_ADABAS (osl_Process_HIDDEN | osl_Process_WAIT | osl_Process_SEARCHPATH)
-#define OPROCESS_ADABAS_DBG (osl_Process_WAIT | osl_Process_SEARCHPATH)
-
-
-using namespace connectivity;
-namespace connectivity
-{
- namespace adabas
- {
- // extern declaration of the function pointer
- extern T3SQLAllocHandle pODBC3SQLAllocHandle;
- extern T3SQLConnect pODBC3SQLConnect;
- extern T3SQLDriverConnect pODBC3SQLDriverConnect;
- extern T3SQLBrowseConnect pODBC3SQLBrowseConnect;
- extern T3SQLDataSources pODBC3SQLDataSources;
- extern T3SQLDrivers pODBC3SQLDrivers;
- extern T3SQLGetInfo pODBC3SQLGetInfo;
- extern T3SQLGetFunctions pODBC3SQLGetFunctions;
- extern T3SQLGetTypeInfo pODBC3SQLGetTypeInfo;
- extern T3SQLSetConnectAttr pODBC3SQLSetConnectAttr;
- extern T3SQLGetConnectAttr pODBC3SQLGetConnectAttr;
- extern T3SQLSetEnvAttr pODBC3SQLSetEnvAttr;
- extern T3SQLGetEnvAttr pODBC3SQLGetEnvAttr;
- extern T3SQLSetStmtAttr pODBC3SQLSetStmtAttr;
- extern T3SQLGetStmtAttr pODBC3SQLGetStmtAttr;
- extern T3SQLPrepare pODBC3SQLPrepare;
- extern T3SQLBindParameter pODBC3SQLBindParameter;
- extern T3SQLSetCursorName pODBC3SQLSetCursorName;
- extern T3SQLExecute pODBC3SQLExecute;
- extern T3SQLExecDirect pODBC3SQLExecDirect;
- extern T3SQLDescribeParam pODBC3SQLDescribeParam;
- extern T3SQLNumParams pODBC3SQLNumParams;
- extern T3SQLParamData pODBC3SQLParamData;
- extern T3SQLPutData pODBC3SQLPutData;
- extern T3SQLRowCount pODBC3SQLRowCount;
- extern T3SQLNumResultCols pODBC3SQLNumResultCols;
- extern T3SQLDescribeCol pODBC3SQLDescribeCol;
- extern T3SQLColAttribute pODBC3SQLColAttribute;
- extern T3SQLBindCol pODBC3SQLBindCol;
- extern T3SQLFetch pODBC3SQLFetch;
- extern T3SQLFetchScroll pODBC3SQLFetchScroll;
- extern T3SQLGetData pODBC3SQLGetData;
- extern T3SQLSetPos pODBC3SQLSetPos;
- extern T3SQLBulkOperations pODBC3SQLBulkOperations;
- extern T3SQLMoreResults pODBC3SQLMoreResults;
- extern T3SQLGetDiagRec pODBC3SQLGetDiagRec;
- extern T3SQLColumnPrivileges pODBC3SQLColumnPrivileges;
- extern T3SQLColumns pODBC3SQLColumns;
- extern T3SQLForeignKeys pODBC3SQLForeignKeys;
- extern T3SQLPrimaryKeys pODBC3SQLPrimaryKeys;
- extern T3SQLProcedureColumns pODBC3SQLProcedureColumns;
- extern T3SQLProcedures pODBC3SQLProcedures;
- extern T3SQLSpecialColumns pODBC3SQLSpecialColumns;
- extern T3SQLStatistics pODBC3SQLStatistics;
- extern T3SQLTablePrivileges pODBC3SQLTablePrivileges;
- extern T3SQLTables pODBC3SQLTables;
- extern T3SQLFreeStmt pODBC3SQLFreeStmt;
- extern T3SQLCloseCursor pODBC3SQLCloseCursor;
- extern T3SQLCancel pODBC3SQLCancel;
- extern T3SQLEndTran pODBC3SQLEndTran;
- extern T3SQLDisconnect pODBC3SQLDisconnect;
- extern T3SQLFreeHandle pODBC3SQLFreeHandle;
- extern T3SQLGetCursorName pODBC3SQLGetCursorName;
- extern T3SQLNativeSql pODBC3SQLNativeSql;
-
-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 utl;
-using namespace osl;
-using namespace ::dbtools;
-
- sal_Bool LoadFunctions(oslModule pODBCso);
- sal_Bool LoadLibrary_ADABAS(::rtl::OUString &_rPath);
- // --------------------------------------------------------------------------------
-void ODriver::fillInfo(const Sequence< PropertyValue >& info, TDatabaseStruct& _rDBInfo)
-{
- const PropertyValue* pIter = info.getConstArray();
- const PropertyValue* pEnd = pIter + info.getLength();
- for(;pIter != pEnd;++pIter)
- {
- if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DatabaseName"))))
- {
- pIter->Value >>= _rDBInfo.sDBName;
- }
- else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlUser"))))
- {
- pIter->Value >>= _rDBInfo.sControlUser;
- }
- else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlPassword"))))
- {
- pIter->Value >>= _rDBInfo.sControlPassword;
- }
- else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataCacheSizeIncrement"))))
- pIter->Value >>= _rDBInfo.nDataIncrement;
- else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShutdownDatabase"))))
- pIter->Value >>= _rDBInfo.bShutDown;
- else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("User"))))
- {
- pIter->Value >>= _rDBInfo.sSysUser;
- }
- else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Password"))))
- {
- pIter->Value >>= _rDBInfo.sSysPassword;
- }
- else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DomainPassword"))))
- {
- pIter->Value >>= _rDBInfo.sDomainPassword;
- }
- else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CacheSize"))))
- {
- pIter->Value >>= _rDBInfo.sCacheSize;
- }
- else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RestoreDatabase"))))
- {
- pIter->Value >>= _rDBInfo.bRestoreDatabase;
- }
- else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Backup"))))
- {
- pIter->Value >>= _rDBInfo.sBackupFile;
- }
- else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataDevSpace"))))
- {
- pIter->Value >>= _rDBInfo.sDataDevName;
- }
- else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYSDEVSPACE"))))
- {
- pIter->Value >>= _rDBInfo.sSysDevSpace;
- }
- else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TRANSACTION_LOG"))))
- {
- pIter->Value >>= _rDBInfo.sTransLogName;
- }
- else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataDevSize"))))
- {
- pIter->Value >>= _rDBInfo.nDataSize;
- }
- else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LogDevSize"))))
- {
- pIter->Value >>= _rDBInfo.nLogSize;
- }
- }
-}
-
-
-// --------------------------------------------------------------------------------
-ODriver::ODriver(const Reference< XMultiServiceFactory >& _rxFactory) : ODBCDriver(_rxFactory)
-{
- osl_incrementInterlockedCount(&m_refCount);
- fillEnvironmentVariables();
- Reference< XComponent > xComponent(m_xORB, UNO_QUERY);
- if (xComponent.is())
- {
- Reference< ::com::sun::star::lang::XEventListener> xEvtL((::cppu::OWeakObject*)this,UNO_QUERY);
- xComponent->addEventListener(xEvtL);
- }
- osl_decrementInterlockedCount(&m_refCount);
-}
-//------------------------------------------------------------------------------
-void ODriver::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- ODriver_BASE::disposing();
- Reference< XComponent > xComponent(m_xORB, UNO_QUERY);
- if (xComponent.is())
- {
- Reference< XEventListener> xEvtL((::cppu::OWeakObject*)this,UNO_QUERY);
- xComponent->removeEventListener(xEvtL);
- }
- m_xORB.clear();
-}
-
-// static ServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString ODriver::getImplementationName_Static( ) throw(RuntimeException)
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sdbcx.adabas.ODriver"));
-}
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > ODriver::getSupportedServiceNames_Static( ) throw (RuntimeException)
-{
- Sequence< ::rtl::OUString > aSNS( 2 );
- aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver"));
- aSNS[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.Driver"));
- return aSNS;
-}
-//------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException)
-{
- return getImplementationName_Static();
-}
-
-//------------------------------------------------------------------
-sal_Bool SAL_CALL ODriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
-{
- const Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-//------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL ODriver::getSupportedServiceNames( ) throw(RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-//------------------------------------------------------------------
-Any SAL_CALL ODriver::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = ::cppu::queryInterface(rType, static_cast<XDataDefinitionSupplier*>(this));
- if ( !aRet.hasValue() )
- aRet = ODriver_BASE::queryInterface(rType);
- return aRet.hasValue() ? aRet : ODriver_BASE2::queryInterface(rType);
-}
-//------------------------------------------------------------------
-Reference< XInterface > SAL_CALL ODriver_CreateInstance(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFac) throw( Exception )
-{
- return *(new ODriver(_rxFac));
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL ODriver::disposing( const EventObject& Source ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if(m_xORB.is() && Reference< XMultiServiceFactory >(Source.Source,UNO_QUERY) == m_xORB)
- {
- TDatabaseMap::iterator aIter = m_aDatabaseMap.begin();
- for(;aIter != m_aDatabaseMap.end();++aIter)
- {
- if(aIter->second.bShutDown)
- {
- ::rtl::OUString sName;
- if(getDBName(aIter->first,sName))
- {
- XUTIL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SHUTDOWN QUICK")),sName,aIter->second.sControlUser,aIter->second.sControlPassword);
- X_STOP(sName);
- }
- }
- }
- m_xORB.clear();
- }
-}
-// --------------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
-{
- if ( ! acceptsURL(url) )
- return NULL;
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if (ODriver_BASE::rBHelper.bDisposed)
- throw DisposedException();
-
- TDatabaseStruct aDBInfo;
- aDBInfo.bShutDown = sal_False;
- fillInfo(info,aDBInfo);
- aDBInfo.sControlUser = aDBInfo.sControlUser.toAsciiUpperCase();
- aDBInfo.sControlPassword = aDBInfo.sControlPassword.toAsciiUpperCase();
- aDBInfo.sSysUser = aDBInfo.sSysUser.toAsciiUpperCase();
- aDBInfo.sSysPassword = aDBInfo.sSysPassword.toAsciiUpperCase();
-
-
- TDatabaseMap::iterator aFind = m_aDatabaseMap.find(url);
- if(aFind == m_aDatabaseMap.end()) // only when not found yet
- m_aDatabaseMap[url] = aDBInfo;
- else
- {
- if(aFind->second.bShutDown != aDBInfo.bShutDown)
- aFind->second.bShutDown &= aDBInfo.bShutDown;
- }
-
- ::rtl::OUString sName;
- if(aDBInfo.sControlPassword.getLength() && aDBInfo.sControlUser.getLength() && getDBName(url,sName))
- {
- // check if we have to add a new data dev space
- checkAndInsertNewDevSpace(sName,aDBInfo);
-
- convertOldVersion(sName,aDBInfo);
- // check if we must restart the database
- checkAndRestart(sName,aDBInfo);
- }
-
-
- if(!m_pDriverHandle)
- {
- ::rtl::OUString aPath;
- if(!EnvironmentHandle(aPath))
- throw SQLException(aPath,*this,::rtl::OUString(),1000,Any());
- }
- OAdabasConnection* pCon = new OAdabasConnection(m_pDriverHandle,this);
- Reference< XConnection > xCon = pCon;
- SQLRETURN nSQLRETURN = pCon->Construct(url,info);
-
- if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA)
- {
- odbc::OTools::ThrowException(pCon,nSQLRETURN,pCon->getConnection(),SQL_HANDLE_DBC,*this);
- }
-
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
-
- return xCon;
-}
-// -----------------------------------------------------------------------------
-sal_Bool ODriver::getDBName(const ::rtl::OUString& _rName,::rtl::OUString& sDBName) const
-{
- sDBName = ::rtl::OUString();
- ::rtl::OUString sName = _rName.copy(12);
- sal_Int32 nPos = sName.indexOf(':');
- if(nPos != -1 && nPos < 1)
- sDBName = sName.copy(1);
- return (nPos != -1 && nPos < 1);
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url )
- throw(SQLException, RuntimeException)
-{
- return (!url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:adabas:")),12));
-}
-// --------------------------------------------------------------------------------
-Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/) throw(SQLException, RuntimeException)
-{
- if ( acceptsURL(url) )
- {
- ::std::vector< DriverPropertyInfo > aDriverInfo;
-
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShutdownDatabase"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Shut down service when closing."))
- ,sal_False
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlUser"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Control user name."))
- ,sal_False
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"))
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlPassword"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Control password."))
- ,sal_False
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataCacheSizeIncrement"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Data increment (MB)."))
- ,sal_False
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet of the database."))
- ,sal_False
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size());
- }
-
- SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- return Sequence< DriverPropertyInfo >();
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODriver::getMajorVersion( ) throw(RuntimeException)
-{
- return 1;
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODriver::getMinorVersion( ) throw(RuntimeException)
-{
- return 0;
-}
-// -----------------------------------------------------------------------------
-// XCreateCatalog
-void SAL_CALL ODriver::createCatalog( const Sequence< PropertyValue >& info ) throw(SQLException, ElementExistException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if (ODriver_BASE::rBHelper.bDisposed)
- throw DisposedException();
-
- try
- {
- TDatabaseStruct aDBInfo;
- fillInfo(info,aDBInfo);
-
- ::rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("DBSERVICE"));
- ::rtl::OUString envData(RTL_CONSTASCII_USTRINGPARAM("0"));
- osl_setEnvironment(envVar.pData, envData.pData);
-
- m_sDbRunDir = m_sDbWorkURL + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/wrk/")) + aDBInfo.sDBName;
- String sTemp;
- LocalFileHelper::ConvertURLToPhysicalName(m_sDbRunDir,sTemp);
- m_sDbRunDir = sTemp;
-
- createNeededDirs(aDBInfo.sDBName);
- if(CreateFiles(aDBInfo))
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(
- STR_NO_DISK_SPACE,
- "$filename$",aDBInfo.sDBName
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- } // if(CreateFiles(aDBInfo))
-
- createDb(aDBInfo);
- }
- catch( SQLException&)
- {
- throw;
- }
- catch(Exception&)
- {
- throw SQLException();
- }
-
-}
-// -----------------------------------------------------------------------------
-// XDropCatalog
-void SAL_CALL ODriver::dropCatalog( const ::rtl::OUString& /*catalogName*/, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, NoSuchElementException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if (ODriver_BASE::rBHelper.bDisposed)
- throw DisposedException();
-
- ::dbtools::throwFeatureNotImplementedException( "!XDropCatalog::dropCatalog", *this );
-}
-//-----------------------------------------------------------------------------
-// ODBC Environment (common for all Connections):
-SQLHANDLE ODriver::EnvironmentHandle(::rtl::OUString &_rPath)
-{
- // Has an Environment already been created (for this Instance)?
- if (!m_pDriverHandle)
- {
- SQLHANDLE h = SQL_NULL_HANDLE;
- // allocate Environment
-
- // load ODBC-DLL now:
- if (! LoadLibrary_ADABAS(_rPath))
- return SQL_NULL_HANDLE;
-
- if (N3SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&h) != SQL_SUCCESS)
- return SQL_NULL_HANDLE;
-
- // Save in global Structure...
- m_pDriverHandle = h;
- SQLRETURN nError = N3SQLSetEnvAttr(h, SQL_ATTR_ODBC_VERSION,(SQLPOINTER) SQL_OV_ODBC3, SQL_IS_INTEGER);
- OSL_UNUSED( nError );
- //N3SQLSetEnvAttr(h, SQL_ATTR_CONNECTION_POOLING,(SQLPOINTER) SQL_CP_ONE_PER_HENV, SQL_IS_INTEGER);
- }
-
- return m_pDriverHandle;
-}
-// --------------------------------------------------------------------------------
-// XDataDefinitionSupplier
-Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByConnection( const Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if (ODriver_BASE::rBHelper.bDisposed)
- throw DisposedException();
-
- Reference< XTablesSupplier > xTab;
- Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(connection,UNO_QUERY);
- if ( xTunnel.is() )
- {
-
- OAdabasConnection* pConnection = NULL;
- OAdabasConnection* pSearchConnection = reinterpret_cast< OAdabasConnection* >( xTunnel->getSomething(OAdabasConnection::getUnoTunnelImplementationId()) );
- for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
- {
- if ( (OAdabasConnection*) Reference< XConnection >::query(i->get().get()).get() == pSearchConnection )
- {
- pConnection = pSearchConnection;
- break;
- }
- }
-
-
- if ( pConnection )
- xTab = pConnection->createCatalog();
- }
- return xTab;
-}
-
-// --------------------------------------------------------------------------------
-Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- if ( ! acceptsURL(url) )
- {
- SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- } // if ( ! acceptsURL(url) )
-
- return getDataDefinitionByConnection(connect(url,info));
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL ODriver::acquire() throw()
-{
- ODriver_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL ODriver::release() throw()
-{
- ODriver_BASE::release();
-}
-ODriver::~ODriver()
-{
-}
-// -----------------------------------------------------------------------------
-oslGenericFunction ODriver::getOdbcFunction(sal_Int32 _nIndex) const
-{
- oslGenericFunction pFunction = NULL;
- switch(_nIndex)
- {
- case ODBC3SQLAllocHandle:
- pFunction = (oslGenericFunction)pODBC3SQLAllocHandle;;
- break;
- case ODBC3SQLConnect:
- pFunction = (oslGenericFunction)pODBC3SQLConnect;
- break;
- case ODBC3SQLDriverConnect:
- pFunction = (oslGenericFunction)pODBC3SQLDriverConnect;
- break;
- case ODBC3SQLBrowseConnect:
- pFunction = (oslGenericFunction)pODBC3SQLBrowseConnect;
- break;
- case ODBC3SQLDataSources:
- pFunction = (oslGenericFunction)pODBC3SQLDataSources;
- break;
- case ODBC3SQLDrivers:
- pFunction = (oslGenericFunction)pODBC3SQLDrivers;
- break;
- case ODBC3SQLGetInfo:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetInfo;
- break;
- case ODBC3SQLGetFunctions:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetFunctions;
- break;
- case ODBC3SQLGetTypeInfo:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetTypeInfo;
- break;
- case ODBC3SQLSetConnectAttr:
-
- pFunction = (oslGenericFunction)pODBC3SQLSetConnectAttr;
- break;
- case ODBC3SQLGetConnectAttr:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetConnectAttr;
- break;
- case ODBC3SQLSetEnvAttr:
-
- pFunction = (oslGenericFunction)pODBC3SQLSetEnvAttr;
- break;
- case ODBC3SQLGetEnvAttr:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetEnvAttr;
- break;
- case ODBC3SQLSetStmtAttr:
-
- pFunction = (oslGenericFunction)pODBC3SQLSetStmtAttr;
- break;
- case ODBC3SQLGetStmtAttr:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetStmtAttr;
- break;
- case ODBC3SQLPrepare:
-
- pFunction = (oslGenericFunction)pODBC3SQLPrepare;
- break;
- case ODBC3SQLBindParameter:
-
- pFunction = (oslGenericFunction)pODBC3SQLBindParameter;
- break;
- case ODBC3SQLSetCursorName:
-
- pFunction = (oslGenericFunction)pODBC3SQLSetCursorName;
- break;
- case ODBC3SQLExecute:
-
- pFunction = (oslGenericFunction)pODBC3SQLExecute;
- break;
- case ODBC3SQLExecDirect:
-
- pFunction = (oslGenericFunction)pODBC3SQLExecDirect;
- break;
- case ODBC3SQLDescribeParam:
-
- pFunction = (oslGenericFunction)pODBC3SQLDescribeParam;
- break;
- case ODBC3SQLNumParams:
-
- pFunction = (oslGenericFunction)pODBC3SQLNumParams;
- break;
- case ODBC3SQLParamData:
-
- pFunction = (oslGenericFunction)pODBC3SQLParamData;
- break;
- case ODBC3SQLPutData:
-
- pFunction = (oslGenericFunction)pODBC3SQLPutData;
- break;
- case ODBC3SQLRowCount:
-
- pFunction = (oslGenericFunction)pODBC3SQLRowCount;
- break;
- case ODBC3SQLNumResultCols:
-
- pFunction = (oslGenericFunction)pODBC3SQLNumResultCols;
- break;
- case ODBC3SQLDescribeCol:
-
- pFunction = (oslGenericFunction)pODBC3SQLDescribeCol;
- break;
- case ODBC3SQLColAttribute:
-
- pFunction = (oslGenericFunction)pODBC3SQLColAttribute;
- break;
- case ODBC3SQLBindCol:
-
- pFunction = (oslGenericFunction)pODBC3SQLBindCol;
- break;
- case ODBC3SQLFetch:
-
- pFunction = (oslGenericFunction)pODBC3SQLFetch;
- break;
- case ODBC3SQLFetchScroll:
-
- pFunction = (oslGenericFunction)pODBC3SQLFetchScroll;
- break;
- case ODBC3SQLGetData:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetData;
- break;
- case ODBC3SQLSetPos:
-
- pFunction = (oslGenericFunction)pODBC3SQLSetPos;
- break;
- case ODBC3SQLBulkOperations:
-
- pFunction = (oslGenericFunction)pODBC3SQLBulkOperations;
- break;
- case ODBC3SQLMoreResults:
-
- pFunction = (oslGenericFunction)pODBC3SQLMoreResults;
- break;
- case ODBC3SQLGetDiagRec:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetDiagRec;
- break;
- case ODBC3SQLColumnPrivileges:
-
- pFunction = (oslGenericFunction)pODBC3SQLColumnPrivileges;
- break;
- case ODBC3SQLColumns:
-
- pFunction = (oslGenericFunction)pODBC3SQLColumns;
- break;
- case ODBC3SQLForeignKeys:
-
- pFunction = (oslGenericFunction)pODBC3SQLForeignKeys;
- break;
- case ODBC3SQLPrimaryKeys:
-
- pFunction = (oslGenericFunction)pODBC3SQLPrimaryKeys;
- break;
- case ODBC3SQLProcedureColumns:
-
- pFunction = (oslGenericFunction)pODBC3SQLProcedureColumns;
- break;
- case ODBC3SQLProcedures:
-
- pFunction = (oslGenericFunction)pODBC3SQLProcedures;
- break;
- case ODBC3SQLSpecialColumns:
-
- pFunction = (oslGenericFunction)pODBC3SQLSpecialColumns;
- break;
- case ODBC3SQLStatistics:
-
- pFunction = (oslGenericFunction)pODBC3SQLStatistics;
- break;
- case ODBC3SQLTablePrivileges:
-
- pFunction = (oslGenericFunction)pODBC3SQLTablePrivileges;
- break;
- case ODBC3SQLTables:
-
- pFunction = (oslGenericFunction)pODBC3SQLTables;
- break;
- case ODBC3SQLFreeStmt:
-
- pFunction = (oslGenericFunction)pODBC3SQLFreeStmt;
- break;
- case ODBC3SQLCloseCursor:
-
- pFunction = (oslGenericFunction)pODBC3SQLCloseCursor;
- break;
- case ODBC3SQLCancel:
-
- pFunction = (oslGenericFunction)pODBC3SQLCancel;
- break;
- case ODBC3SQLEndTran:
-
- pFunction = (oslGenericFunction)pODBC3SQLEndTran;
- break;
- case ODBC3SQLDisconnect:
-
- pFunction = (oslGenericFunction)pODBC3SQLDisconnect;
- break;
- case ODBC3SQLFreeHandle:
-
- pFunction = (oslGenericFunction)pODBC3SQLFreeHandle;
- break;
- case ODBC3SQLGetCursorName:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetCursorName;
- break;
- case ODBC3SQLNativeSql:
-
- pFunction = (oslGenericFunction)pODBC3SQLNativeSql;
- break;
- default:
- OSL_FAIL("Function unknown!");
- }
- return pFunction;
-}
-// -----------------------------------------------------------------------------
-void ODriver::createNeededDirs(const ::rtl::OUString& sDBName)
-{
- ::rtl::OUString sDbWork,sDBConfig,sTemp;
-
- if(m_sDbWork.getLength())
- {
- sDbWork = m_sDbWorkURL;
- if(!UCBContentHelper::IsFolder(m_sDbWorkURL))
- UCBContentHelper::MakeFolder(m_sDbWorkURL);
-
- sDbWork += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
- sDbWork += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("wrk"));
- if(!UCBContentHelper::IsFolder(sDbWork))
- UCBContentHelper::MakeFolder(sDbWork);
-
- sDbWork += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
-
- sTemp = sDbWork;
- sTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("config"));
- if(!UCBContentHelper::IsFolder(sTemp))
- UCBContentHelper::MakeFolder(sTemp);
-
- sTemp = sDbWork;
- sTemp += sDBName;
- if(!UCBContentHelper::IsFolder(sTemp))
- UCBContentHelper::MakeFolder(sTemp);
- }
-
- if(m_sDbConfig.getLength())
- {
- sDBConfig = m_sDbConfigURL;
- if(!UCBContentHelper::IsFolder(sDBConfig))
- UCBContentHelper::MakeFolder(sDBConfig);
-
- sDBConfig += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
- sTemp = sDBConfig;
- sTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("config"));
- if(!UCBContentHelper::IsFolder(sTemp))
- UCBContentHelper::MakeFolder(sTemp);
-
- sTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
- sTemp += sDBName;
- if(UCBContentHelper::Exists(sTemp))
- UCBContentHelper::Kill(sTemp);
-
-#if !(defined(WNT))
- sTemp = sDBConfig;
- sTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("diag"));
- if(!UCBContentHelper::IsFolder(sTemp))
- UCBContentHelper::MakeFolder(sTemp);
-
- sTemp = sDBConfig;
- sTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ipc"));
- if(!UCBContentHelper::IsFolder(sTemp))
- UCBContentHelper::MakeFolder(sTemp);
-
- sTemp = sDBConfig;
- sTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("spool"));
- if(!UCBContentHelper::IsFolder(sTemp))
- UCBContentHelper::MakeFolder(sTemp);
-#endif
- }
-}
-// -----------------------------------------------------------------------------
-void ODriver::clearDatabase(const ::rtl::OUString& sDBName)
-{ // stop the database
- ::rtl::OUString sCommand;
-#if defined(WNT)
- ::rtl::OUString sStop = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("stop"));
- const sal_uInt32 nArgsCount = 2;
- rtl_uString *pArgs[nArgsCount] = { sDBName.pData, sStop.pData };
-#else
- sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("x_clear"));
- const sal_uInt32 nArgsCount = 1;
- rtl_uString* pArgs[nArgsCount] = { sDBName.pData };
-#endif
-
- oslProcess aApp;
-
-#if OSL_DEBUG_LEVEL > 0
- oslProcessError eError =
-#endif
- osl_executeProcess(sCommand.pData, pArgs, nArgsCount,
- OPROCESS_ADABAS, NULL, m_sDbWorkURL.pData,
- NULL, 0, &aApp);
- OSL_ENSURE( eError == osl_Process_E_None, "ODriver::clearDatabase: calling the executable failed!" );
-}
-// -----------------------------------------------------------------------------
-void ODriver::createDb( const TDatabaseStruct& _aInfo)
-{
-
- clearDatabase(_aInfo.sDBName);
-
- X_PARAM(_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword,String::CreateFromAscii("BINIT"));
-
- String sTemp;
- LocalFileHelper::ConvertURLToPhysicalName(_aInfo.sSysDevSpace,sTemp);
-
- PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYSDEVSPACE")),sTemp);
-
- sTemp.Erase();
- LocalFileHelper::ConvertURLToPhysicalName(_aInfo.sTransLogName,sTemp);
- PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TRANSACTION_LOG")),sTemp);
- PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MAXUSERTASKS")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("3")));
- PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MAXDEVSPACES")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("7")));
- PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MAXDATADEVSPACES")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("5")));
- PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MAXDATAPAGES")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("25599")));
- PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MAXBACKUPDEVS")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1")));
- PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MAXSERVERDB")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1")));
- PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATA_CACHE_PAGES")),_aInfo.sCacheSize);
- PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CONV_CACHE_PAGES")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("23")));
- PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PROC_DATA_PAGES")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("40")));
- PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RUNDIRECTORY")),m_sDbRunDir);
- PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("KERNELTRACESIZE")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("100")));
- PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LOG_QUEUE_PAGES")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("10")));
-
-#if !defined(WNT)
- PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OPMSG1")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/dev/null")));
-#endif
-
- X_PARAM(_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BCHECK")));
-
- X_START(_aInfo.sDBName);
-
- // SHOW_STATE()
- // %m_sDbRoot%\bin\xutil -d %_aInfo.sDBName% -u %CONUSR%,%CONPWD% -b %INITCMD%
- ::rtl::OUString aBatch2 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-b "));
-
- // generate the init file for the database
- String sInitFile = getDatabaseInitFile(_aInfo);
-
- LocalFileHelper::ConvertURLToPhysicalName(sInitFile,sTemp);
- aBatch2 += sTemp;
- XUTIL(aBatch2,_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword);
-#if OSL_DEBUG_LEVEL < 2
- if(UCBContentHelper::Exists(sInitFile))
- UCBContentHelper::Kill(sInitFile);
-#endif
-
- // install system tables
- installSystemTables(_aInfo);
- // now we have to make our SYSDBA user "NOT EXCLUSIVE"
- {
- String sExt;
- sExt.AssignAscii(".sql");
-
- String sWorkUrl(m_sDbWorkURL);
- ::utl::TempFile aInitFile(String::CreateFromAscii("Init"),&sExt,&sWorkUrl);
- aInitFile.EnableKillingFile();
- {
- ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(aInitFile.GetURL(),STREAM_WRITE) );
- (*pFileStream) << "ALTER USER \""
- << ::rtl::OString(_aInfo.sSysUser,_aInfo.sSysUser.getLength(),gsl_getSystemTextEncoding())
- << "\" NOT EXCLUSIVE "
- << sNewLine;
- pFileStream->Flush();
- }
- { // just to get sure that the tempfile still lives
- sTemp.Erase();
- LocalFileHelper::ConvertURLToPhysicalName(aInitFile.GetURL(),sTemp);
- LoadBatch(_aInfo.sDBName,_aInfo.sSysUser,_aInfo.sSysPassword,sTemp);
- }
- }
-}
-
-
-//-------------------------------------------------------------------------------------------------
-int ODriver::X_PARAM(const ::rtl::OUString& _DBNAME,
- const ::rtl::OUString& _USR,
- const ::rtl::OUString& _PWD,
- const ::rtl::OUString& _CMD)
-{
- // %XPARAM% -u %CONUSR%,%CONPWD% BINIT
- ::rtl::OUString sCommandFile = generateInitFile();
- {
- ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE));
- pFileStream->Seek(STREAM_SEEK_TO_END);
- (*pFileStream) << "x_param"
-#if defined(WNT)
- << ".exe"
-#endif
- << " -d "
- << ::rtl::OString(_DBNAME,_DBNAME.getLength(),gsl_getSystemTextEncoding())
- << " -u "
- << ::rtl::OString(_USR,_USR.getLength(),gsl_getSystemTextEncoding())
- << ","
- << ::rtl::OString(_PWD,_PWD.getLength(),gsl_getSystemTextEncoding())
- << " "
- << ::rtl::OString(_CMD,_CMD.getLength(),gsl_getSystemTextEncoding())
-#if defined(WNT)
-#if (OSL_DEBUG_LEVEL > 1) || defined(DBG_UTIL)
- << " >> %DBWORK%\\create.log 2>&1"
-#endif
-#else
-#if (OSL_DEBUG_LEVEL > 1) || defined(DBG_UTIL)
- << " >> /tmp/kstart.log"
-#else
- << " > /dev/null"
-#endif
-#endif
- << " "
- << sNewLine
- << sNewLine;
-
- pFileStream->Flush();
- }
-
- oslProcess aApp;
-
-#if OSL_DEBUG_LEVEL > 0
- oslProcessError eError =
-#endif
- osl_executeProcess(sCommandFile.pData, NULL, 0,
- osl_Process_HIDDEN | osl_Process_WAIT,
- NULL, m_sDbWorkURL.pData, NULL, 0, &aApp);
- OSL_ENSURE( eError == osl_Process_E_None, "ODriver::X_PARAM: calling the executable failed!" );
-
-#if OSL_DEBUG_LEVEL < 2
- if(UCBContentHelper::Exists(sCommandFile))
- UCBContentHelper::Kill(sCommandFile);
-#endif
-
- return 0;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 ODriver::CreateFiles(const TDatabaseStruct& _aInfo)
-{
- int nRet = CreateFile(_aInfo.sSysDevSpace,_aInfo.nDataSize/50) ? 0 : -9;
- if(!nRet)
- nRet = CreateFile(_aInfo.sTransLogName,_aInfo.nLogSize) ? 0 : -10;
- if(!nRet)
- nRet = CreateFile(_aInfo.sDataDevName,_aInfo.nDataSize) ? 0 : -11;
-
- return nRet;
-
-}
-// -----------------------------------------------------------------------------
-void ODriver::PutParam(const ::rtl::OUString& sDBName,
- const ::rtl::OUString& rWhat,
- const ::rtl::OUString& rHow)
-{
- const sal_uInt32 nArgsCount = 3;
- rtl_uString* pArgs[nArgsCount] = { sDBName.pData, rWhat.pData, rHow.pData };
-
- ::rtl::OUString sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("putparam"));
-#if defined(WNT)
- sCommand += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".exe"));
-#endif
-
- oslProcess aApp;
-
-
-#if OSL_DEBUG_LEVEL > 0
- oslProcessError eError =
-#endif
- osl_executeProcess(sCommand.pData, pArgs, nArgsCount,
- OPROCESS_ADABAS,
- NULL, m_sDbWorkURL.pData, NULL, 0, &aApp);
-
- OSL_ENSURE( eError == osl_Process_E_None, "ODriver::PutParam: calling the executable failed!" );
-}
-// -----------------------------------------------------------------------------
-sal_Bool ODriver::CreateFile(const ::rtl::OUString &_FileName,
- sal_Int32 _nSize)
-{
-OSL_TRACE("CreateFile %d",_nSize);
- sal_Bool bOK = sal_True;
- try
- {
- ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(_FileName,STREAM_WRITE));
- if( !pFileStream.get())
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(
- STR_NO_DISK_SPACE,
- "$filename$",_FileName
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
- sal_Int32 nNewSize = 0;
- sal_Int32 nCount = _nSize /2;
- for(sal_Int32 i=0; bOK && i < nCount; ++i)
- {
- nNewSize += 8192;//4096;
- bOK = (*pFileStream).SetStreamSize(nNewSize);
- pFileStream->Flush();
- }
-
- bOK = bOK && static_cast<sal_Int32>(pFileStream->Seek(STREAM_SEEK_TO_END)) == nNewSize;
- }
- catch(Exception&)
- {
- OSL_TRACE("Exception");
- }
- if(!bOK)
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(
- STR_NO_DISK_SPACE,
- "$filename$",_FileName
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
-
- return bOK;
- // dd if=/dev/zero bs=4k of=$DEV_NAME count=$2
-}
-// -----------------------------------------------------------------------------
-int ODriver::X_START(const ::rtl::OUString& sDBName)
-{
- ::rtl::OUString sCommand;
-#if defined(WNT)
-
- ::rtl::OUString sArg1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-d"));
- ::rtl::OUString sArg3 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-NoDBService"));
- ::rtl::OUString sArg4 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-NoDBWindow"));
-
- const sal_uInt32 nArgsCount = 4;
- rtl_uString* pArgs[nArgsCount] = { sArg1.pData, sDBName.pData, sArg3.pData, sArg4.pData };
- sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("strt.exe"));
-#else
- const sal_uInt32 nArgsCount = 1;
- rtl_uString* pArgs[nArgsCount] = { sDBName.pData };
- sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("x_start"));
-#endif
-
- oslProcess aApp;
-
- oslProcessError eError = osl_executeProcess(sCommand.pData, pArgs, nArgsCount,
- OPROCESS_ADABAS, NULL, m_sDbWorkURL.pData,
- NULL, 0, &aApp);
-
- if(eError == osl_Process_E_NotFound)
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(
- STR_COMMAND_NOT_FOUND,
- "$databasename$",sDBName,
- "$progname$",sCommand
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
- OSL_ASSERT(eError == osl_Process_E_None);
-
- oslProcessInfo aInfo;
- aInfo.Size = sizeof(oslProcessInfo);
-
- if(osl_getProcessInfo(aApp, osl_Process_EXITCODE, &aInfo) == osl_Process_E_None && aInfo.Code)
- return aInfo.Code;
-
- return 0;
-}
-// -----------------------------------------------------------------------------
-int ODriver::X_STOP(const ::rtl::OUString& sDBName)
-{
- ::rtl::OUString sCommand;
-#if defined(WNT)
-
- ::rtl::OUString sArg1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-d"));
- ::rtl::OUString sArg2 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-NoDBService"));
-
- const sal_uInt32 nArgsCount = 3;
- rtl_uString* pArgs[nArgsCount] = { sArg1.pData, sDBName.pData, sArg2.pData };
- sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("stp.exe"));
-#else
- const sal_uInt32 nArgsCount = 1;
- rtl_uString* pArgs[nArgsCount] = { sDBName.pData };
- sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("x_stop"));
-#endif
-
- oslProcess aApp;
-
- oslProcessError eError = osl_executeProcess(sCommand.pData, pArgs, nArgsCount,
- OPROCESS_ADABAS, NULL, m_sDbWorkURL.pData,
- NULL, 0, &aApp);
-
- OSL_ASSERT(eError == osl_Process_E_None);
- if(eError != osl_Process_E_None)
- return 1;
-
- oslProcessInfo aInfo;
- aInfo.Size = sizeof(oslProcessInfo);
-
- if(osl_getProcessInfo(aApp, osl_Process_EXITCODE, &aInfo) == osl_Process_E_None && aInfo.Code)
- return aInfo.Code;
-
- return 0;
-}
-// -----------------------------------------------------------------------------
-void ODriver::XUTIL(const ::rtl::OUString& _rParam,
- const ::rtl::OUString& _DBNAME,
- const ::rtl::OUString& _USRNAME,
- const ::rtl::OUString& _USRPWD)
-{
- String sWorkUrl(m_sDbWorkURL);
- String sExt = String::CreateFromAscii(".log");
- ::utl::TempFile aCmdFile(String::CreateFromAscii("xutil"),&sExt,&sWorkUrl);
- aCmdFile.EnableKillingFile();
-
- String sPhysicalPath;
- LocalFileHelper::ConvertURLToPhysicalName(aCmdFile.GetURL(),sPhysicalPath);
-
- ::rtl::OUString sCommandFile = generateInitFile();
-
- {
- ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE));
- pFileStream->Seek(STREAM_SEEK_TO_END);
- (*pFileStream) <<
-#if defined(WNT)
- "xutil.exe"
-#else
- "utility"
-#endif
- << " -u "
- << ::rtl::OString(_USRNAME,_USRNAME.getLength(),gsl_getSystemTextEncoding())
- << ","
- << ::rtl::OString(_USRPWD,_USRPWD.getLength(),gsl_getSystemTextEncoding())
- << " -d "
- << ::rtl::OString(_DBNAME,_DBNAME.getLength(),gsl_getSystemTextEncoding())
- << " "
- << ::rtl::OString(_rParam,_rParam.getLength(),gsl_getSystemTextEncoding())
- << " > "
- << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding())
- << " 2>&1"
- << sNewLine;
- pFileStream->Flush();
- }
-
- oslProcess aApp;
-
-
-#if OSL_DEBUG_LEVEL > 0
- oslProcessError eError =
-#endif
- osl_executeProcess(sCommandFile.pData, NULL, 0,
- osl_Process_HIDDEN | osl_Process_WAIT,
- NULL, m_sDbWorkURL.pData, NULL, 0, &aApp);
- OSL_ENSURE( eError == osl_Process_E_None, "ODriver::XUTIL: calling the executable failed!" );
-
-#if OSL_DEBUG_LEVEL < 2
- if(UCBContentHelper::Exists(sCommandFile))
- UCBContentHelper::Kill(sCommandFile);
-#endif
-}
-// -----------------------------------------------------------------------------
-void ODriver::LoadBatch(const ::rtl::OUString& sDBName,
- const ::rtl::OUString& _rUSR,
- const ::rtl::OUString& _rPWD,
- const ::rtl::OUString& _rBatch)
-{
- OSL_ENSURE(_rBatch.getLength(),"No batch file given!");
- String sWorkUrl(m_sDbWorkURL);
- String sExt = String::CreateFromAscii(".log");
- ::utl::TempFile aCmdFile(String::CreateFromAscii("LoadBatch"),&sExt,&sWorkUrl);
-#if OSL_DEBUG_LEVEL < 2
- aCmdFile.EnableKillingFile();
-#endif
-
- String sPhysicalPath;
- LocalFileHelper::ConvertURLToPhysicalName(aCmdFile.GetURL(),sPhysicalPath);
-
- ::rtl::OUString sCommandFile = generateInitFile();
- {
- ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE));
- pFileStream->Seek(STREAM_SEEK_TO_END);
- (*pFileStream) << "xload"
-#if defined(WNT)
- << ".exe"
-#endif
- << " -d "
- << ::rtl::OString(sDBName,sDBName.getLength(),gsl_getSystemTextEncoding())
- << " -u "
- << ::rtl::OString(_rUSR,_rUSR.getLength(),gsl_getSystemTextEncoding())
- << ","
- << ::rtl::OString(_rPWD,_rPWD.getLength(),gsl_getSystemTextEncoding());
-
- if ( !isKernelVersion(CURRENT_DB_VERSION) )
- (*pFileStream) << " -S adabas -b ";
- else
- (*pFileStream) << " -S NATIVE -b ";
-
- (*pFileStream) << ::rtl::OString(_rBatch,_rBatch.getLength(),gsl_getSystemTextEncoding())
- << " > "
- << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding())
- << " 2>&1"
- << sNewLine;
-
- pFileStream->Flush();
- }
-
- oslProcess aApp;
-
-
-#if OSL_DEBUG_LEVEL > 0
- oslProcessError eError =
-#endif
- osl_executeProcess(sCommandFile.pData, NULL, 0,
- osl_Process_HIDDEN | osl_Process_WAIT,
- NULL, m_sDbWorkURL.pData, NULL, 0, &aApp);
- OSL_ENSURE( eError == osl_Process_E_None, "ODriver::LoadBatch: calling the executable failed!" );
-
-#if OSL_DEBUG_LEVEL < 2
- if(UCBContentHelper::Exists(sCommandFile))
- UCBContentHelper::Kill(sCommandFile);
-#endif
-}
-// -----------------------------------------------------------------------------
-void ODriver::fillEnvironmentVariables()
-{
- // read the environment vars
- struct env_data
- {
- const sal_Char* pAsciiEnvName;
- ::rtl::OUString* pValue;
- ::rtl::OUString* pValueURL;
- } EnvData[] = {
- { "DBWORK", &m_sDbWork, &m_sDbWorkURL },
- { "DBCONFIG", &m_sDbConfig, &m_sDbConfigURL },
- { "DBROOT", &m_sDbRoot, &m_sDbRootURL }
- };
-
- for ( size_t i = 0; i < SAL_N_ELEMENTS( EnvData ); ++i )
- {
- ::rtl::OUString sVarName = ::rtl::OUString::createFromAscii( EnvData[i].pAsciiEnvName );
- ::rtl::OUString sEnvValue;
- if(osl_getEnvironment( sVarName.pData, &sEnvValue.pData ) == osl_Process_E_None )
- {
- *EnvData[i].pValue = sEnvValue;
- String sURL;
- LocalFileHelper::ConvertPhysicalNameToURL( *EnvData[i].pValue, sURL );
- *EnvData[i].pValueURL = sURL;
- }
- }
-
- m_sDelimit = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString ODriver::generateInitFile() const
-{
- String sExt;
-#if !defined(WNT)
- sExt = String::CreateFromAscii(".sh");
-#else
- sExt = String::CreateFromAscii(".bat");
-#endif
-
- String sWorkUrl(m_sDbWorkURL);
- ::utl::TempFile aCmdFile(String::CreateFromAscii("Init"),&sExt,&sWorkUrl);
-#if !defined(WNT)
- String sPhysicalPath;
- LocalFileHelper::ConvertURLToPhysicalName(aCmdFile.GetURL(),sPhysicalPath);
- chmod(ByteString(sPhysicalPath,gsl_getSystemTextEncoding()).GetBuffer(),S_IRUSR|S_IWUSR|S_IXUSR);
-#endif
-
-#if !defined(WNT)
- SvStream* pFileStream = aCmdFile.GetStream(STREAM_WRITE);
- (*pFileStream) << "#!/bin/sh"
- << sNewLine
- << "cd \"$DBWORK\""
- << sNewLine
- << sNewLine;
- pFileStream->Flush();
-#endif
-
- return aCmdFile.GetURL();
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString ODriver::getDatabaseInitFile( const TDatabaseStruct& _aDBInfo)
-{
- String sExt;
- sExt.AssignAscii(".ins");
-
-
- String sWorkUrl(m_sDbWorkURL);
- ::utl::TempFile aInitFile(String::CreateFromAscii("Init"),&sExt,&sWorkUrl);
- {
- SvStream* pFileStream = aInitFile.GetStream(STREAM_WRITE);
- (*pFileStream) << "* @(#)init.cmd 6.1.1 1994-11-10\n";
- (*pFileStream) << "init config\n";
- (*pFileStream) << "* default code:\n";
- (*pFileStream) << "ascii\n";
- (*pFileStream) << "* date time format\n";
- (*pFileStream) << "internal\n";
- (*pFileStream) << "* command timeout:\n";
- (*pFileStream) << "900\n";
- (*pFileStream) << "* lock timeout:\n";
- (*pFileStream) << "360\n";
- (*pFileStream) << "* request timeout:\n";
- (*pFileStream) << "180\n";
- (*pFileStream) << "* log mode:\n";
- (*pFileStream) << "demo\n";
- (*pFileStream) << "* log segment size:\n";
- (*pFileStream) << "0\n";
- (*pFileStream) << "* no of archive logs:\n";
- (*pFileStream) << "0\n";
- (*pFileStream) << "* no of data devspaces:\n";
- (*pFileStream) << "1\n";
- (*pFileStream) << "* mirror devspaces:\n";
- (*pFileStream) << "n\n";
- (*pFileStream) << "if $rc <> 0 then stop\n";
- (*pFileStream) << "*--- device description ---\n";
- (*pFileStream) << "* sys devspace name:\n";
- {
- String sTemp;
- LocalFileHelper::ConvertURLToPhysicalName(_aDBInfo.sSysDevSpace,sTemp);
- (*pFileStream) << ::rtl::OString(sTemp.GetBuffer(),sTemp.Len(),gsl_getSystemTextEncoding());
- }
- (*pFileStream) << "\n* log devspace size:\n";
- (*pFileStream) << ::rtl::OString::valueOf(_aDBInfo.nLogSize);
- (*pFileStream) << "\n* log devspace name:\n";
- {
- String sTemp;
- LocalFileHelper::ConvertURLToPhysicalName(_aDBInfo.sTransLogName,sTemp);
- (*pFileStream) << ::rtl::OString(sTemp.GetBuffer(),sTemp.Len(),gsl_getSystemTextEncoding());
- }
- (*pFileStream) << "\n* data devspace size:\n";
- (*pFileStream) << ::rtl::OString::valueOf(_aDBInfo.nDataSize);
- (*pFileStream) << "\n* data devspace name:\n";
- {
- String sTemp;
- LocalFileHelper::ConvertURLToPhysicalName(_aDBInfo.sDataDevName,sTemp);
- (*pFileStream) << ::rtl::OString(sTemp.GetBuffer(),sTemp.Len(),gsl_getSystemTextEncoding());
- }
-
- (*pFileStream) << "\n* END INIT CONFIG\n";
- (*pFileStream) << "if $rc <> 0 then stop\n";
- if(_aDBInfo.bRestoreDatabase)
- {
- (*pFileStream) << "RESTORE DATA QUICK FROM '";
- {
- String sTemp;
- LocalFileHelper::ConvertURLToPhysicalName(_aDBInfo.sBackupFile,sTemp);
- (*pFileStream) << ::rtl::OString(sTemp.GetBuffer(),sTemp.Len(),gsl_getSystemTextEncoding());
- }
- (*pFileStream) << "' BLOCKSIZE 8\n";
- (*pFileStream) << "if $rc <> 0 then stop\n";
- (*pFileStream) << "RESTART\n";
-
- }
- else
- {
- (*pFileStream) << "ACTIVATE SERVERDB SYSDBA \"";
- (*pFileStream) << ::rtl::OString(_aDBInfo.sSysUser,_aDBInfo.sSysUser.getLength(),gsl_getSystemTextEncoding());
- (*pFileStream) << "\" PASSWORD \"";
- (*pFileStream) << ::rtl::OString(_aDBInfo.sSysPassword,_aDBInfo.sSysPassword.getLength(),gsl_getSystemTextEncoding());
- (*pFileStream) << "\"\n";
- }
- (*pFileStream) << "if $rc <> 0 then stop\n";
- (*pFileStream) << "exit\n";
- }
- return aInitFile.GetURL();
-}
-// -----------------------------------------------------------------------------
-void ODriver::X_CONS(const ::rtl::OUString& sDBName,const ::rtl::OString& _ACTION,const ::rtl::OUString& _FILENAME)
-{
- String sPhysicalPath;
- LocalFileHelper::ConvertURLToPhysicalName(_FILENAME,sPhysicalPath);
-
- ::rtl::OUString sCommandFile = generateInitFile();
- {
- ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE));
- pFileStream->Seek(STREAM_SEEK_TO_END);
-
- (*pFileStream) << "x_cons"
-#if defined(WNT)
- << ".exe"
-#endif
- << " "
- << ::rtl::OString(sDBName,sDBName.getLength(),gsl_getSystemTextEncoding())
- << " SHOW "
- << _ACTION
- << " > "
- << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding())
- << sNewLine;
- pFileStream->Flush();
- }
-
- oslProcess aApp;
-
- osl_executeProcess(sCommandFile.pData, NULL, 0,
- osl_Process_HIDDEN | osl_Process_WAIT,
- NULL, m_sDbWorkURL.pData, NULL, 0, &aApp);
-
-#if OSL_DEBUG_LEVEL < 2
- if(UCBContentHelper::Exists(sCommandFile))
- UCBContentHelper::Kill(sCommandFile);
-#endif
-}
-// -----------------------------------------------------------------------------
-void ODriver::checkAndRestart(const ::rtl::OUString& sDBName,const TDatabaseStruct& _rDbInfo)
-{
- String sWorkUrl(m_sDbWorkURL);
- String sExt = String::CreateFromAscii(".st");
- ::utl::TempFile aCmdFile(String::CreateFromAscii("State"),&sExt,&sWorkUrl);
- aCmdFile.EnableKillingFile();
-
- X_CONS(sDBName,"STATE",aCmdFile.GetURL());
- SvStream* pFileStream = aCmdFile.GetStream(STREAM_SHARE_DENYALL);
- if ( pFileStream )
- {
- ByteString sStateLine;
- sal_Bool bRead = sal_True;
- sal_Int32 nStart = 2;
- while(bRead && !pFileStream->IsEof())
- {
- String aLine;
- bRead = pFileStream->ReadLine(sStateLine);
- if(bRead)
- {
- if(sStateLine.Search("WARM") != STRING_NOTFOUND)
- { // nothing to do
- nStart = 0;
- break;
- }
- else if(sStateLine.Search("COLD") != STRING_NOTFOUND)
- {
- nStart = 1;
- break;
- }
- }
- }
- switch(nStart)
- {
- case 2:
- clearDatabase(sDBName);
- X_START(sDBName);
- // don't break here
- case 1:
- XUTIL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RESTART")),sDBName,_rDbInfo.sControlUser,_rDbInfo.sControlPassword);
- case 0:
- break;
- }
- }
-}
-// -----------------------------------------------------------------------------
-sal_Bool ODriver::isVersion(const ::rtl::OUString& sDBName, const char* _pVersion)
-{
- String sWorkUrl(m_sDbWorkURL);
- String sExt = String::CreateFromAscii(".st");
- ::utl::TempFile aCmdFile(String::CreateFromAscii("DevSpaces"),&sExt,&sWorkUrl);
- aCmdFile.EnableKillingFile();
-
- String sPhysicalPath;
- LocalFileHelper::ConvertURLToPhysicalName(aCmdFile.GetURL(),sPhysicalPath);
-
- ::rtl::OUString sCommandFile = generateInitFile();
- {
- ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE));
- pFileStream->Seek(STREAM_SEEK_TO_END);
-
- (*pFileStream) << "getparam"
-#if defined(WNT)
- << ".exe"
-#endif
- << " "
- << ::rtl::OString(sDBName,sDBName.getLength(),gsl_getSystemTextEncoding())
- << " KERNELVERSION > "
- << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding())
- << sNewLine;
- }
-
- oslProcess aApp;
-
- osl_executeProcess(sCommandFile.pData, NULL, 0,
- OPROCESS_ADABAS,
- NULL, m_sDbWorkURL.pData, NULL, 0, &aApp);
-
-#if OSL_DEBUG_LEVEL < 2
- if(UCBContentHelper::Exists(sCommandFile))
- UCBContentHelper::Kill(sCommandFile);
-#endif
- SvStream* pFileStream = aCmdFile.GetStream(STREAM_STD_READWRITE);
- ByteString sStateLine;
- sal_Bool bRead = sal_True;
- sal_Bool bIsVersion = sal_False;
- while ( pFileStream && bRead && !pFileStream->IsEof() )
- {
- bRead = pFileStream->ReadLine(sStateLine);
- if ( bRead )
- {
- bIsVersion = sStateLine.GetToken(1,' ').Equals(_pVersion) != 0;
- break;
- }
- }
- return bIsVersion;
-}
-// -----------------------------------------------------------------------------
-void ODriver::checkAndInsertNewDevSpace(const ::rtl::OUString& sDBName,
- const TDatabaseStruct& _rDBInfo)
-{
- // %DBROOT%\pgm\getparam %2 DATA_CACHE_PAGES > %3
- String sWorkUrl(m_sDbWorkURL);
- String sExt = String::CreateFromAscii(".st");
- ::utl::TempFile aCmdFile(String::CreateFromAscii("DevSpaces"),&sExt,&sWorkUrl);
- aCmdFile.EnableKillingFile();
-
- String sPhysicalPath;
- LocalFileHelper::ConvertURLToPhysicalName(aCmdFile.GetURL(),sPhysicalPath);
-
- ::rtl::OUString sCommandFile = generateInitFile();
- {
- ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE));
- pFileStream->Seek(STREAM_SEEK_TO_END);
-
- (*pFileStream) << "getparam"
-#if defined(WNT)
- << ".exe"
-#endif
- << " "
- << ::rtl::OString(sDBName,sDBName.getLength(),gsl_getSystemTextEncoding())
- << " DATA_CACHE_PAGES > "
- << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding())
- << sNewLine;
- }
-
- oslProcess aApp;
- osl_executeProcess(sCommandFile.pData, NULL, 0,
- OPROCESS_ADABAS,
- NULL, m_sDbWorkURL.pData, NULL, 0, &aApp);
-
-#if OSL_DEBUG_LEVEL < 2
- if(UCBContentHelper::Exists(sCommandFile))
- UCBContentHelper::Kill(sCommandFile);
-#endif
- SvStream* pFileStream = aCmdFile.GetStream(STREAM_STD_READWRITE);
- ByteString sStateLine;
- sal_Bool bRead = sal_True;
- sal_Int32 nDataPages = 0;
- while(pFileStream && bRead && !pFileStream->IsEof())
- {
- bRead = pFileStream->ReadLine(sStateLine);
- if(bRead)
- {
- nDataPages = sStateLine.ToInt32();
- if(nDataPages && nDataPages < 100)
- {
- // the space isn't big enough anymore so we increment it
- PutParam(sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATA_CACHE_PAGES")),::rtl::OUString::valueOf(nDataPages));
- X_PARAM(sDBName,_rDBInfo.sControlUser,_rDBInfo.sControlPassword,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BCHECK")));
- }
- }
- }
-}
-// -----------------------------------------------------------------------------
-sal_Bool ODriver::isKernelVersion(const char* _pVersion)
-{
- ::utl::TempFile aCmdFile(String::CreateFromAscii("KernelVersion"));
- aCmdFile.EnableKillingFile();
-
- String sPhysicalPath;
- LocalFileHelper::ConvertURLToPhysicalName(aCmdFile.GetURL(),sPhysicalPath);
-
- ::rtl::OUString sCommandFile = generateInitFile();
- {
- ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE));
- pFileStream->Seek(STREAM_SEEK_TO_END);
-
- (*pFileStream) << "dbversion"
- << " > "
- << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding())
- << sNewLine;
- }
-
- oslProcess aApp;
- osl_executeProcess(sCommandFile.pData, NULL, 0,
- OPROCESS_ADABAS,
- NULL, m_sDbWorkURL.pData, NULL, 0, &aApp);
-
-#if OSL_DEBUG_LEVEL < 2
- if(UCBContentHelper::Exists(sCommandFile))
- UCBContentHelper::Kill(sCommandFile);
-#endif
- SvStream* pFileStream = aCmdFile.GetStream(STREAM_STD_READWRITE);
- ByteString sStateLine;
- sal_Bool bRead = sal_True;
- sal_Bool bIsVersion = sal_True;
- while ( pFileStream && bRead && !pFileStream->IsEof() )
- {
- bRead = pFileStream->ReadLine(sStateLine);
- if ( bRead )
- {
- // convert a 11.02.00 to a 12.01.30 version
- bIsVersion = sStateLine.GetToken(0).Equals(_pVersion) != 0;
- break;
- }
- }
- return bIsVersion;
-}
-// -----------------------------------------------------------------------------
-void ODriver::installSystemTables( const TDatabaseStruct& _aInfo)
-{
-#if defined(WNT)
- // xutil -d %_DBNAME% -u %_CONTROL_USER%,%_CONTROL_PWD% -b %m_sDbRoot%\env\TERMCHAR.ind
- ::rtl::OUString aBatch = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-b "));
- ::rtl::OUString sTemp2 = m_sDbRootURL + m_sDelimit
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("env"))
- + m_sDelimit
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TERMCHAR.ind"));
- String sTemp;
- sal_Bool bOk = LocalFileHelper::ConvertURLToPhysicalName(sTemp2,sTemp);
- aBatch += sTemp;
-
- XUTIL(aBatch,_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword);
-
- // xutil -d %_DBNAME% -u %_CONTROL_USER%,%_CONTROL_PWD% DIAGNOSE TRIGGER OFF
- XUTIL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DIAGNOSE TRIGGER OFF")),_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword);
- // xload -d %_DBNAME% -u %_SYSDBA_USER%,%_SYSDBA_PWD% -S NATIVE -b %m_sDbRoot%\env\DBS.ins %_DOMAINPWD%
- {
- sTemp2 = m_sDbRootURL
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("env"))
- + m_sDelimit
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DBS.ins"));
- sTemp.Erase();
- bOk = LocalFileHelper::ConvertURLToPhysicalName(sTemp2,sTemp);
- OSL_ENSURE(bOk,"File could be converted into file system path!");
- sTemp.AppendAscii(" ");
- sTemp += String(_aInfo.sDomainPassword);
-
- LoadBatch(_aInfo.sDBName,_aInfo.sSysUser,_aInfo.sSysPassword,sTemp);
- }
- // xload -d %_DBNAME% -u DOMAIN,%_DOMAINPWD% -S NATIVE -b %m_sDbRoot%\env\XDD.ins
- {
- sTemp2 = m_sDbRootURL
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("env"))
- + m_sDelimit
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("XDD.ins"));
- sTemp.Erase();
- bOk = LocalFileHelper::ConvertURLToPhysicalName(sTemp2,sTemp);
- OSL_ENSURE(bOk,"File could be converted into file system path!");
-
- LoadBatch(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOMAIN")),_aInfo.sDomainPassword,sTemp);
- }
- // xload -d %_DBNAME% -u %_SYSDBA_USER%,%_SYSDBA_PWD% -S NATIVE -b %m_sDbRoot%\env\QP.ins
- {
- sTemp2 = m_sDbRootURL
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("env"))
- + m_sDelimit
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("QP.ins"));
- sTemp.Erase();
- bOk = LocalFileHelper::ConvertURLToPhysicalName(sTemp2,sTemp);
- OSL_ENSURE(bOk,"File could be converted into file system path!");
- LoadBatch(_aInfo.sDBName,_aInfo.sSysUser,_aInfo.sSysPassword,sTemp);
- }
- // xload -d %_DBNAME% -u DOMAIN,%_DOMAINPWD% -S NATIVE -b %m_sDbRoot%\env\SPROC.ins
- {
- sTemp2 = m_sDbRootURL
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("env"))
- + m_sDelimit
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SPROC.ins"));
- sTemp.Erase();
- bOk = LocalFileHelper::ConvertURLToPhysicalName(sTemp2,sTemp);
- OSL_ENSURE(bOk,"File could be converted into file system path!");
-
- LoadBatch(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOMAIN")),_aInfo.sDomainPassword,sTemp);
- }
-
- // xutil -d %_DBNAME% -u %_CONTROL_USER%,%_CONTROL_PWD% DIAGNOSE TRIGGER ON
- XUTIL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DIAGNOSE TRIGGER ON")),_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword);
- // xutil -d %_DBNAME% -u %_CONTROL_USER%,%_CONTROL_PWD% SET NOLOG OFF
- XUTIL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SET NOLOG OFF")),_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword);
- // xutil -d %_DBNAME% -u %_CONTROL_USER%,%_CONTROL_PWD% SHUTDOWN QUICK
- XUTIL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SHUTDOWN QUICK")),_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword);
- // xutil -d %_DBNAME% -u %_CONTROL_USER%,%_CONTROL_PWD% RESTART
- XUTIL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RESTART")),_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword);
-
-#else // UNX
- ::rtl::OUString sCommandFile = generateInitFile();
- {
- ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE));
- pFileStream->Seek(STREAM_SEEK_TO_END);
- (*pFileStream) << "x_dbinst"
- << " -d "
- << ::rtl::OString(_aInfo.sDBName,_aInfo.sDBName.getLength(),gsl_getSystemTextEncoding())
- << " -u "
- << ::rtl::OString(_aInfo.sSysUser,_aInfo.sSysUser.getLength(),gsl_getSystemTextEncoding())
- << ","
- << ::rtl::OString(_aInfo.sSysPassword,_aInfo.sSysPassword.getLength(),gsl_getSystemTextEncoding())
- << " -w "
- << ::rtl::OString(_aInfo.sDomainPassword,_aInfo.sDomainPassword.getLength(),gsl_getSystemTextEncoding())
- << " -b ";
-
- if ( isKernelVersion(ADABAS_KERNEL_11) )
- (*pFileStream) << "-i all";
- (*pFileStream)
-#if (OSL_DEBUG_LEVEL > 1) || defined(DBG_UTIL)
- << " >> /tmp/kstart.log"
-#else
- << " > /dev/null"
-#endif
- << sNewLine
- << sNewLine;
- pFileStream->Flush();
- }
- // now execute the command
-
- oslProcess aApp;
- osl_executeProcess(sCommandFile.pData, NULL, 0,
- osl_Process_WAIT | osl_Process_HIDDEN,
- NULL, m_sDbWorkURL.pData, NULL, 0, &aApp);
-#if OSL_DEBUG_LEVEL < 2
- if(UCBContentHelper::Exists(sCommandFile))
- UCBContentHelper::Kill(sCommandFile);
-#endif
-
-#endif //WNT,UNX
-}
-// -----------------------------------------------------------------------------
-void ODriver::convertOldVersion(const ::rtl::OUString& sDBName,const TDatabaseStruct& _rDbInfo)
-{
- // first we have to check if this databse is a old version and we have to update the system tables
- if ( !isVersion(sDBName,CURRENT_DB_VERSION) && isKernelVersion(CURRENT_DB_VERSION) )
- {
- if ( !_rDbInfo.sControlUser.getLength()
- || !_rDbInfo.sControlPassword.getLength())
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(STR_DATABASE_NEEDS_CONVERTING) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
- String sCommandFile = m_sDbWorkURL;
- sCommandFile += String::CreateFromAscii("/xparam.prt");
- if ( UCBContentHelper::Exists(sCommandFile) )
- UCBContentHelper::Kill(sCommandFile);
- X_PARAM(sDBName,_rDbInfo.sControlUser,_rDbInfo.sControlPassword,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BCHECK")));
-
- if ( UCBContentHelper::Exists(sCommandFile) )
- {
- {
- ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READ) );
- ByteString sStateLine;
- sal_Bool bRead = sal_True;
- static ByteString s_ErrorId("-21100");
- while ( pFileStream.get() && bRead && !pFileStream->IsEof() )
- {
- bRead = pFileStream->ReadLine(sStateLine);
- if ( bRead && s_ErrorId == sStateLine.GetToken(0,' ') )
- {
- UCBContentHelper::Kill(sCommandFile);
- ::rtl::OUString sError(::rtl::OUString::createFromAscii(sStateLine.GetBuffer()));
- throw SQLException(sError,*this,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000")),1000,Any());
- }
- }
- }
-
- UCBContentHelper::Kill(sCommandFile);
- }
- }
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace adabas
-}// namespace connectivity
-// -----------------------------------------------------------------------------
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BFunctions.cxx b/connectivity/source/drivers/adabas/BFunctions.cxx
deleted file mode 100644
index fde23e9a59..0000000000
--- a/connectivity/source/drivers/adabas/BFunctions.cxx
+++ /dev/null
@@ -1,256 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-//--------------------------------------------------------------------------
-#include "odbc/OFunctions.hxx"
-#include <osl/process.h>
-
-// Implib-Definitionen fuer ODBC-DLL/shared library:
-
-namespace connectivity
-{
- namespace adabas
- {
- T3SQLAllocHandle pODBC3SQLAllocHandle;
-T3SQLConnect pODBC3SQLConnect;
-T3SQLDriverConnect pODBC3SQLDriverConnect;
-T3SQLBrowseConnect pODBC3SQLBrowseConnect;
-T3SQLDataSources pODBC3SQLDataSources;
-T3SQLDrivers pODBC3SQLDrivers;
-T3SQLGetInfo pODBC3SQLGetInfo;
-T3SQLGetFunctions pODBC3SQLGetFunctions;
-T3SQLGetTypeInfo pODBC3SQLGetTypeInfo;
-T3SQLSetConnectAttr pODBC3SQLSetConnectAttr;
-T3SQLGetConnectAttr pODBC3SQLGetConnectAttr;
-T3SQLSetEnvAttr pODBC3SQLSetEnvAttr;
-T3SQLGetEnvAttr pODBC3SQLGetEnvAttr;
-T3SQLSetStmtAttr pODBC3SQLSetStmtAttr;
-T3SQLGetStmtAttr pODBC3SQLGetStmtAttr;
-T3SQLPrepare pODBC3SQLPrepare;
-T3SQLBindParameter pODBC3SQLBindParameter;
-T3SQLSetCursorName pODBC3SQLSetCursorName;
-T3SQLExecute pODBC3SQLExecute;
-T3SQLExecDirect pODBC3SQLExecDirect;
-T3SQLDescribeParam pODBC3SQLDescribeParam;
-T3SQLNumParams pODBC3SQLNumParams;
-T3SQLParamData pODBC3SQLParamData;
-T3SQLPutData pODBC3SQLPutData;
-T3SQLRowCount pODBC3SQLRowCount;
-T3SQLNumResultCols pODBC3SQLNumResultCols;
-T3SQLDescribeCol pODBC3SQLDescribeCol;
-T3SQLColAttribute pODBC3SQLColAttribute;
-T3SQLBindCol pODBC3SQLBindCol;
-T3SQLFetch pODBC3SQLFetch;
-T3SQLFetchScroll pODBC3SQLFetchScroll;
-T3SQLGetData pODBC3SQLGetData;
-T3SQLSetPos pODBC3SQLSetPos;
-T3SQLBulkOperations pODBC3SQLBulkOperations;
-T3SQLMoreResults pODBC3SQLMoreResults;
-T3SQLGetDiagRec pODBC3SQLGetDiagRec;
-T3SQLColumnPrivileges pODBC3SQLColumnPrivileges;
-T3SQLColumns pODBC3SQLColumns;
-T3SQLForeignKeys pODBC3SQLForeignKeys;
-T3SQLPrimaryKeys pODBC3SQLPrimaryKeys;
-T3SQLProcedureColumns pODBC3SQLProcedureColumns;
-T3SQLProcedures pODBC3SQLProcedures;
-T3SQLSpecialColumns pODBC3SQLSpecialColumns;
-T3SQLStatistics pODBC3SQLStatistics;
-T3SQLTablePrivileges pODBC3SQLTablePrivileges;
-T3SQLTables pODBC3SQLTables;
-T3SQLFreeStmt pODBC3SQLFreeStmt;
-T3SQLCloseCursor pODBC3SQLCloseCursor;
-T3SQLCancel pODBC3SQLCancel;
-T3SQLEndTran pODBC3SQLEndTran;
-T3SQLDisconnect pODBC3SQLDisconnect;
-T3SQLFreeHandle pODBC3SQLFreeHandle;
-T3SQLGetCursorName pODBC3SQLGetCursorName;
-T3SQLNativeSql pODBC3SQLNativeSql;
-
-
-sal_Bool LoadFunctions(oslModule pODBCso);
-// -------------------------------------------------------------------------
-sal_Bool LoadLibrary_ADABAS(::rtl::OUString &_rPath)
-{
- static sal_Bool bLoaded = sal_False;
- static oslModule pODBCso = NULL;
-
- if (bLoaded)
- return sal_True;
-
- rtl_uString* pPath = NULL;
- ::rtl::OUString sTemp(RTL_CONSTASCII_USTRINGPARAM("DBROOT"));
- if ( osl_getEnvironment(sTemp.pData,&pPath) == osl_Process_E_None && pPath )
- {
-
-#if ( defined(SOLARIS) && defined(SPARC)) || defined(LINUX) || defined(MACOSX)
- _rPath = ::rtl::OUString(pPath);
- _rPath += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/lib/"));
-#endif
- rtl_uString_release(pPath);
- }
- else
- {
- _rPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The variable DBROOT is not set."));
- return sal_False;
- }
- const sal_Char* pLibraryAsciiName = NULL;
-
-#if defined(WNT)
- pLibraryAsciiName = "SQLOD32.DLL";
-#elif ( defined(SOLARIS) && defined(SPARC)) || defined(LINUX)
- pLibraryAsciiName = "odbclib.so";
-#elif defined(MACOSX)
- pLibraryAsciiName = "odbclib.dylib";
-#endif
- if ( !pLibraryAsciiName )
- return sal_False;
-
- _rPath += ::rtl::OUString::createFromAscii( pLibraryAsciiName );
- pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
- if( !pODBCso)
- return sal_False;
-
-
- return bLoaded = LoadFunctions(pODBCso);
-}
-// -------------------------------------------------------------------------
-
-sal_Bool LoadFunctions(oslModule pODBCso)
-{
-
- if( ( pODBC3SQLAllocHandle = (T3SQLAllocHandle)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLAllocHandle")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLConnect = (T3SQLConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLConnect")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLDriverConnect = (T3SQLDriverConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDriverConnect")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLBrowseConnect = (T3SQLBrowseConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBrowseConnect")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetInfo = (T3SQLGetInfo)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetInfo")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetTypeInfo = (T3SQLGetTypeInfo)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetTypeInfo")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLSetConnectAttr = (T3SQLSetConnectAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetConnectAttr")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetConnectAttr = (T3SQLGetConnectAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetConnectAttr")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLSetEnvAttr = (T3SQLSetEnvAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetEnvAttr")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetEnvAttr = (T3SQLGetEnvAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetEnvAttr")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLSetStmtAttr = (T3SQLSetStmtAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetStmtAttr")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetStmtAttr = (T3SQLGetStmtAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetStmtAttr")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLPrepare = (T3SQLPrepare)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLPrepare")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLBindParameter = (T3SQLBindParameter)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBindParameter")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLSetCursorName = (T3SQLSetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetCursorName")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLExecute = (T3SQLExecute)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLExecute")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLExecDirect = (T3SQLExecDirect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLExecDirect")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLDescribeParam = (T3SQLDescribeParam)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDescribeParam")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLNumParams = (T3SQLNumParams)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNumParams")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLParamData = (T3SQLParamData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLParamData")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLPutData = (T3SQLPutData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLPutData")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLRowCount = (T3SQLRowCount)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLRowCount")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLNumResultCols = (T3SQLNumResultCols)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNumResultCols")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLDescribeCol = (T3SQLDescribeCol)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDescribeCol")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLColAttribute = (T3SQLColAttribute)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLColAttribute")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLBindCol = (T3SQLBindCol)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBindCol")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLFetch = (T3SQLFetch)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFetch")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLFetchScroll = (T3SQLFetchScroll)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFetchScroll")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetData = (T3SQLGetData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetData")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLSetPos = (T3SQLSetPos)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetPos")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLMoreResults = (T3SQLMoreResults)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLMoreResults")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetDiagRec = (T3SQLGetDiagRec)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetDiagRec")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLColumnPrivileges = (T3SQLColumnPrivileges)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLColumnPrivileges")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLColumns = (T3SQLColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLColumns")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLForeignKeys = (T3SQLForeignKeys)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLForeignKeys")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLPrimaryKeys = (T3SQLPrimaryKeys)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLPrimaryKeys")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLProcedureColumns = (T3SQLProcedureColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLProcedureColumns")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLProcedures = (T3SQLProcedures)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLProcedures")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLSpecialColumns = (T3SQLSpecialColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSpecialColumns")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLStatistics = (T3SQLStatistics)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLStatistics")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLTablePrivileges = (T3SQLTablePrivileges)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLTablePrivileges")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLTables = (T3SQLTables)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLTables")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLFreeStmt = (T3SQLFreeStmt)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFreeStmt")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLCloseCursor = (T3SQLCloseCursor)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLCloseCursor")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLCancel = (T3SQLCancel)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLCancel")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLEndTran = (T3SQLEndTran)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLEndTran")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLDisconnect = (T3SQLDisconnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDisconnect")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLFreeHandle = (T3SQLFreeHandle)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFreeHandle")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetCursorName = (T3SQLGetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetCursorName")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLNativeSql = (T3SQLNativeSql)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNativeSql")).pData )) == NULL )
- return sal_False;
-
- return sal_True;
-}
-// -------------------------------------------------------------------------
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BGroup.cxx b/connectivity/source/drivers/adabas/BGroup.cxx
deleted file mode 100644
index 1421771056..0000000000
--- a/connectivity/source/drivers/adabas/BGroup.cxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "adabas/BGroup.hxx"
-#include "adabas/BUsers.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include "adabas/BConnection.hxx"
-#include <comphelper/types.hxx>
-
-using namespace connectivity::adabas;
-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;
-
-// -------------------------------------------------------------------------
-OAdabasGroup::OAdabasGroup( OAdabasConnection* _pConnection) : connectivity::sdbcx::OGroup(sal_True)
- ,m_pConnection(_pConnection)
-{
- construct();
- TStringVector aVector;
- m_pUsers = new OUsers(*this,m_aMutex,aVector,m_pConnection,this);
-}
-// -------------------------------------------------------------------------
-OAdabasGroup::OAdabasGroup( OAdabasConnection* _pConnection,
- const ::rtl::OUString& _Name
- ) : connectivity::sdbcx::OGroup(_Name,sal_True)
- ,m_pConnection(_pConnection)
-{
- construct();
- refreshUsers();
-}
-// -------------------------------------------------------------------------
-void OAdabasGroup::refreshUsers()
-{
- if(!m_pConnection)
- return;
-
- TStringVector aVector;
- Reference< XStatement > xStmt = m_pConnection->createStatement( );
-
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "SELECT DISTINCT USERNAME FROM DOMAIN.USERS WHERE USERNAME IS NOT NULL AND USERNAME <> ' ' AND USERNAME <> 'CONTROL' AND GROUPNAME = '" ));
- aSql += getName( );
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'"));
-
- Reference< XResultSet > xResult = xStmt->executeQuery(aSql);
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while(xResult->next())
- aVector.push_back(xRow->getString(1));
- ::comphelper::disposeComponent(xResult);
- }
- ::comphelper::disposeComponent(xStmt);
-
- if(m_pUsers)
- m_pUsers->reFill(aVector);
- else
- m_pUsers = new OUsers(*this,m_aMutex,aVector,m_pConnection,this);
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BGroups.cxx b/connectivity/source/drivers/adabas/BGroups.cxx
deleted file mode 100644
index 46256b20d5..0000000000
--- a/connectivity/source/drivers/adabas/BGroups.cxx
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "adabas/BGroups.hxx"
-#include "adabas/BGroup.hxx"
-#include "adabas/BTable.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <comphelper/types.hxx>
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::adabas;
-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;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-// -------------------------------------------------------------------------
-sdbcx::ObjectType OGroups::createObject(const ::rtl::OUString& _rName)
-{
- return new OAdabasGroup(m_pConnection,_rName);
-}
-// -------------------------------------------------------------------------
-void OGroups::impl_refresh() throw(RuntimeException)
-{
- m_pParent->refreshGroups();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OGroups::createDescriptor()
-{
- // OAdabasGroup* pNew =
- return new OAdabasGroup(m_pConnection);
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OGroups::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& /*descriptor*/ )
-{
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE USERGROUP " ));
- ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( );
-
- aSql = aSql + aQuote + _rForName + aQuote;
-
- Reference< XStatement > xStmt = m_pConnection->createStatement( );
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
-
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OGroups::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName)
-{
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP USERGROUP " ));
- ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( );
-
- aSql = aSql + aQuote + _sElementName + aQuote;
-
- Reference< XStatement > xStmt = m_pConnection->createStatement( );
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
-}
-// -------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BIndex.cxx b/connectivity/source/drivers/adabas/BIndex.cxx
deleted file mode 100644
index 00d61dd1c0..0000000000
--- a/connectivity/source/drivers/adabas/BIndex.cxx
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "adabas/BIndex.hxx"
-#include "adabas/BIndexColumns.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include "adabas/BTable.hxx"
-#include <comphelper/types.hxx>
-
-using namespace connectivity::adabas;
-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;
-// -------------------------------------------------------------------------
-OAdabasIndex::OAdabasIndex( OAdabasTable* _pTable,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Catalog,
- sal_Bool _isUnique,
- sal_Bool _isPrimaryKeyIndex,
- sal_Bool _isClustered
- ) : connectivity::sdbcx::OIndex(_Name,
- _Catalog,
- _isUnique,
- _isPrimaryKeyIndex,
- _isClustered,sal_True)
- ,m_pTable(_pTable)
-{
- construct();
- refreshColumns();
-}
-// -------------------------------------------------------------------------
-OAdabasIndex::OAdabasIndex(OAdabasTable* _pTable)
- : connectivity::sdbcx::OIndex(sal_True)
- ,m_pTable(_pTable)
-{
- construct();
-}
-// -----------------------------------------------------------------------------
-
-void OAdabasIndex::refreshColumns()
-{
- if(!m_pTable)
- return;
-
- TStringVector aVector;
- if(!isNew())
- {
- Reference< XResultSet > xResult = m_pTable->getMetaData()->getIndexInfo(Any(),
- m_pTable->getSchema(),m_pTable->getTableName(),sal_False,sal_False);
-
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- ::rtl::OUString aColName;
- while(xResult->next())
- {
- if(xRow->getString(6) == m_Name)
- {
- aColName = xRow->getString(9);
- if(!xRow->wasNull())
- aVector.push_back(aColName);
- }
- }
- ::comphelper::disposeComponent(xResult);
- }
- }
- if(m_pColumns)
- m_pColumns->reFill(aVector);
- else
- m_pColumns = new OIndexColumns(this,m_aMutex,aVector);
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BIndexColumns.cxx b/connectivity/source/drivers/adabas/BIndexColumns.cxx
deleted file mode 100644
index 059ba4fe47..0000000000
--- a/connectivity/source/drivers/adabas/BIndexColumns.cxx
+++ /dev/null
@@ -1,123 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "adabas/BIndexColumns.hxx"
-#include "connectivity/sdbcx/VIndexColumn.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include "adabas/BTable.hxx"
-#include "adabas/BCatalog.hxx"
-#include <comphelper/types.hxx>
-#include <comphelper/property.hxx>
-
-using namespace connectivity::adabas;
-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;
-// -------------------------------------------------------------------------
-ObjectType OIndexColumns::createObject(const ::rtl::OUString& _rName)
-{
-
- Reference< XResultSet > xResult = m_pIndex->getTable()->getConnection()->getMetaData()->getIndexInfo(Any(),
- m_pIndex->getTable()->getSchema(),m_pIndex->getTable()->getTableName(),sal_False,sal_False);
-
- sal_Bool bAsc = sal_True;
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- ::rtl::OUString aD(RTL_CONSTASCII_USTRINGPARAM("D"));
- while(xResult->next())
- {
- if(xRow->getString(9) == _rName)
- bAsc = xRow->getString(10) != aD;
- }
- ::comphelper::disposeComponent(xResult);
- }
-
- xResult = m_pIndex->getTable()->getConnection()->getMetaData()->getColumns(Any(),
- m_pIndex->getTable()->getSchema(),m_pIndex->getTable()->getTableName(),_rName);
-
- ObjectType xRet = NULL;
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while(xResult->next())
- {
- if(xRow->getString(4) == _rName)
- {
- sal_Int32 nType = xRow->getInt(5);
- ::rtl::OUString sTypeName = xRow->getString(6);
- sal_Int32 nPrec = xRow->getInt(7);
- OAdabasCatalog::correctColumnProperties(nPrec,nType,sTypeName);
-
- OIndexColumn* pRet = new OIndexColumn(bAsc,
- _rName,
- sTypeName,
- xRow->getString(13),
- xRow->getInt(11),
- nPrec,
- xRow->getInt(9),
- nType,
- sal_False,sal_False,sal_False,sal_True);
- xRet = pRet;
- break;
- }
- }
- ::comphelper::disposeComponent(xResult);
- }
-
- return xRet;
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OIndexColumns::createDescriptor()
-{
- return new OIndexColumn(sal_True);
-}
-// -----------------------------------------------------------------------------
-void OIndexColumns::impl_refresh() throw(::com::sun::star::uno::RuntimeException)
-{
- m_pIndex->refreshColumns();
-}
-// -----------------------------------------------------------------------------
-ObjectType OIndexColumns::appendObject( const ::rtl::OUString& /*_rForName*/, const Reference< XPropertySet >& descriptor )
-{
- return cloneDescriptor( descriptor );
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BIndexes.cxx b/connectivity/source/drivers/adabas/BIndexes.cxx
deleted file mode 100644
index 62563cbd2b..0000000000
--- a/connectivity/source/drivers/adabas/BIndexes.cxx
+++ /dev/null
@@ -1,194 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "adabas/BIndexes.hxx"
-#include "adabas/BIndex.hxx"
-#include "adabas/BTable.hxx"
-#include "connectivity/sdbcx/VIndex.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/IndexType.hpp>
-#include <comphelper/types.hxx>
-#include <comphelper/types.hxx>
-#include "adabas/BCatalog.hxx"
-#include "connectivity/dbexception.hxx"
-
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::adabas;
-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;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OIndexes::createObject(const ::rtl::OUString& _rName)
-{
- ::rtl::OUString aName,aQualifier;
- sal_Int32 nLen = _rName.indexOf('.');
- if(nLen != -1)
- {
- aQualifier = _rName.copy(0,nLen);
- aName = _rName.copy(nLen+1);
- }
- else
- aName = _rName;
-
-
- Reference< XResultSet > xResult = m_pTable->getMetaData()->getIndexInfo(Any(),
- m_pTable->getSchema(),m_pTable->getTableName(),sal_False,sal_False);
-
- sdbcx::ObjectType xRet = NULL;
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while(xResult->next())
- {
- if(xRow->getString(6) == aName && (!aQualifier.getLength() || xRow->getString(5) == aQualifier ))
- {
- OAdabasIndex* pRet = new OAdabasIndex(m_pTable,aName,aQualifier,!xRow->getBoolean(4),
- aName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYSPRIMARYKEYINDEX")),
- xRow->getShort(7) == IndexType::CLUSTERED);
- xRet = pRet;
- break;
- }
- }
- ::comphelper::disposeComponent(xResult);
- }
-
- return xRet;
-}
-// -------------------------------------------------------------------------
-void OIndexes::impl_refresh() throw(RuntimeException)
-{
- m_pTable->refreshIndexes();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OIndexes::createDescriptor()
-{
- return new OAdabasIndex(m_pTable);
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OIndexes::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- if ( m_pTable->isNew() )
- ::dbtools::throwFunctionSequenceException(static_cast<XTypeProvider*>(this));
-
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE " ));
- ::rtl::OUString aQuote = m_pTable->getMetaData()->getIdentifierQuoteString( );
- const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
-
- if(getBOOL(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE))))
- aSql = aSql + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UNIQUE "));
- aSql = aSql + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INDEX "));
-
-
- if(_rForName.getLength())
- {
- aSql = aSql + aQuote + _rForName + aQuote
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON "))
- + aQuote + m_pTable->getSchema() + aQuote + sDot
- + aQuote + m_pTable->getTableName() + aQuote
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ( "));
-
- Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY);
- Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY);
- Reference< XPropertySet > xColProp;
- sal_Int32 nCount = xColumns->getCount();
- for(sal_Int32 i=0;i<nCount;++i)
- {
- xColumns->getByIndex(i) >>= xColProp;
- aSql = aSql + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote;
- aSql = aSql + (getBOOL(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISASCENDING)))
- ?
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ASC"))
- :
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DESC")))
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- }
- aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")));
- }
- else
- {
- aSql = aSql + aQuote + m_pTable->getSchema() + aQuote + sDot + aQuote + m_pTable->getTableName() + aQuote;
-
- Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY);
- Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY);
- Reference< XPropertySet > xColProp;
- if(xColumns->getCount() != 1)
- throw SQLException();
-
- xColumns->getByIndex(0) >>= xColProp;
-
- aSql = aSql + sDot + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote;
- }
-
- Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( );
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
-
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OIndexes::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName)
-{
- if(!m_pTable->isNew())
- {
- ::rtl::OUString aName,aSchema;
- sal_Int32 nLen = _sElementName.indexOf('.');
- aSchema = _sElementName.copy(0,nLen);
- aName = _sElementName.copy(nLen+1);
-
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP INDEX " ));
- ::rtl::OUString aQuote = m_pTable->getMetaData()->getIdentifierQuoteString( );
- const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
-
- if (aSchema.getLength())
- (((aSql += aQuote) += aSchema) += aQuote) += sDot;
-
- (((aSql += aQuote) += aName) += aQuote) += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON "));
-
- (((aSql += aQuote) += m_pTable->getSchema()) += aQuote) += sDot;
- ((aSql += aQuote) += m_pTable->getTableName()) += aQuote;
-
- Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( );
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BKeys.cxx b/connectivity/source/drivers/adabas/BKeys.cxx
deleted file mode 100644
index d6a6586f10..0000000000
--- a/connectivity/source/drivers/adabas/BKeys.cxx
+++ /dev/null
@@ -1,183 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "adabas/BKeys.hxx"
-#include "adabas/BTable.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <comphelper/types.hxx>
-#include "adabas/BCatalog.hxx"
-#include <comphelper/property.hxx>
-#include <connectivity/TKeys.hxx>
-#include <connectivity/dbtools.hxx>
-
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::adabas;
-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;
-typedef OKeysHelper OCollection_TYPE;
-
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OKeys::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- if ( getTable()->isNew() )
- {
- Reference< XPropertySet > xNewDescriptor( cloneDescriptor( descriptor ) );
- OKeysHelper::cloneDescriptorColumns( descriptor, xNewDescriptor );
- return xNewDescriptor;
- }
-
- sal_Int32 nKeyType = getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)));
-
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "ALTER TABLE " ));
- const ::rtl::OUString aQuote = getTable()->getConnection()->getMetaData()->getIdentifierQuoteString( );
- const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
-
- aSql += composeTableName( getTable()->getConnection()->getMetaData(), getTable(), ::dbtools::eInTableDefinitions, false, false, true );
-
- if(nKeyType == KeyType::PRIMARY)
- {
- aSql = aSql + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ALTER PRIMARY KEY ("));
- }
- else if(nKeyType == KeyType::FOREIGN)
- {
- aSql = aSql + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FOREIGN KEY ("));
- }
- else
- throw SQLException();
-
- Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY);
- Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY);
-
- for(sal_Int32 i=0;i<xColumns->getCount();++i)
- {
- Reference< XPropertySet > xColProp;
- xColumns->getByIndex(i) >>= xColProp;
- aSql = aSql + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- }
- aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")));
-
- sal_Int32 nUpdateRule = 0, nDeleteRule = 0;
- ::rtl::OUString sReferencedName;
-
- if(nKeyType == KeyType::FOREIGN)
- {
- nDeleteRule = getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELETERULE)));
-
- ::rtl::OUString aName,aSchema;
- sReferencedName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REFERENCEDTABLE)));
- sal_Int32 nLen = sReferencedName.indexOf('.');
- aSchema = sReferencedName.copy(0,nLen);
- aName = sReferencedName.copy(nLen+1);
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" REFERENCES "))
- + aQuote + aSchema + aQuote + sDot + aQuote + aName + aQuote;
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ("));
-
- for(sal_Int32 i=0;i<xColumns->getCount();++i)
- {
- Reference< XPropertySet > xColProp;
- xColumns->getByIndex(i) >>= xColProp;
- aSql = aSql + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RELATEDCOLUMN))) + aQuote
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- }
- aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")));
-
- switch(nDeleteRule)
- {
- case KeyRule::CASCADE:
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE CASCADE "));
- break;
- case KeyRule::RESTRICT:
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE RESTRICT "));
- break;
- case KeyRule::SET_NULL:
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE SET NULL "));
- break;
- case KeyRule::SET_DEFAULT:
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE SET DEFAULT "));
- break;
- default:
- ;
- }
- }
-
- Reference< XStatement > xStmt = getTable()->getConnection()->createStatement( );
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- // find the name which the database gave the new key
- ::rtl::OUString sNewName( _rForName );
- if(nKeyType == KeyType::FOREIGN)
- {
- const ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
- ::rtl::OUString aSchema,aTable;
- getTable()->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= aSchema;
- getTable()->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)) >>= aTable;
- Reference< XResultSet > xResult = getTable()->getMetaData()->getImportedKeys( getTable()->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME))
- ,aSchema
- ,aTable);
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while(xResult->next())
- {
- ::rtl::OUString sName = xRow->getString(12);
- if ( !m_pElements->exists(sName) ) // this name wasn't inserted yet so it must be te new one
- {
- descriptor->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sName));
- sNewName = sName;
- break;
- }
- }
- ::comphelper::disposeComponent(xResult);
- }
- }
-
- getTable()->addKey(sNewName,sdbcx::TKeyProperties(new sdbcx::KeyProperties(sReferencedName,nKeyType,nUpdateRule,nDeleteRule)));
- return createObject( sNewName );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString OKeys::getDropForeignKey() const
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DROP FOREIGN KEY "));
-}
-
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BPreparedStatement.cxx b/connectivity/source/drivers/adabas/BPreparedStatement.cxx
deleted file mode 100644
index a25b760c3e..0000000000
--- a/connectivity/source/drivers/adabas/BPreparedStatement.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "adabas/BPreparedStatement.hxx"
-#include "adabas/BResultSet.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <connectivity/dbexception.hxx>
-
-using namespace connectivity;
-using namespace connectivity::adabas;
-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;
-
-OAdabasPreparedStatement::OAdabasPreparedStatement( OAdabasConnection* _pConnection,const ::rtl::OUString& sql)
-: ::connectivity::odbc::OPreparedStatement( _pConnection,sql)
-{
- m_aSelectColumns = _pConnection->createSelectColumns(sql);
-}
-// -----------------------------------------------------------------------------
-OResultSet* OAdabasPreparedStatement::createResulSet()
-{
- return new OAdabasResultSet(m_aStatementHandle,this,m_aSelectColumns);
-}
-// -----------------------------------------------------------------------------
-void OAdabasPreparedStatement::setUsingBookmarks(sal_Bool /*_bUseBookmark*/)
-{
- ::dbtools::throwFeatureNotImplementedException( "bookmarks", *this );
- // adabas doesn't support bookmarks
-}
-// -----------------------------------------------------------------------------
-void OAdabasPreparedStatement::setResultSetConcurrency(sal_Int32 /*_par0*/)
-{
- ::dbtools::throwFeatureNotImplementedException( "PreparedStatement:ResultSetConcurrency", *this );
-}
-// -----------------------------------------------------------------------------
-void OAdabasPreparedStatement::setResultSetType(sal_Int32 /*_par0*/)
-{
- ::dbtools::throwFeatureNotImplementedException( "PreparedStatement:ResultSetType", *this );
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BResultSet.cxx b/connectivity/source/drivers/adabas/BResultSet.cxx
deleted file mode 100644
index 96212030c9..0000000000
--- a/connectivity/source/drivers/adabas/BResultSet.cxx
+++ /dev/null
@@ -1,225 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "adabas/BResultSet.hxx"
-#include "adabas/BResultSetMetaData.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "odbc/OTools.hxx"
-
-using namespace connectivity::adabas;
-using namespace connectivity::odbc;
-using namespace cppu;
-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;
-
-// comment: all this movement methods are needed because adabas doesn't support a SQLGetData call when
-// the cursor was moved with a call of SQLFetchScroll. So when this is fixed by adabas we can remove this damn thing.
-
-
-sal_Bool SAL_CALL OAdabasResultSet::next( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_nLastColumnPos = 0;
- // m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_NEXT,0);
- m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle);
-
- if(m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO)
- ++m_nRowPos;
-
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- return m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OAdabasResultSet::first( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_nLastColumnPos = 0;
- // don't ask why !
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_OFF,SQL_IS_UINTEGER);
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_FIRST,0);
- sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
- if(bRet)
- {
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0);
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_ON,SQL_IS_UINTEGER);
- m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle);
- }
-
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
-
- bRet = ( m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO );
- if ( bRet )
- m_nRowPos = 1;
- return bRet;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OAdabasResultSet::last( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_nLastColumnPos = 0;
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_OFF,SQL_IS_UINTEGER);
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_LAST,0);
- sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
- if(bRet)
- {
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0);
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_ON,SQL_IS_UINTEGER);
- m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle);
- }
-
- m_bEOF = sal_True;
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- // here I know definitely that I stand on the last record
- return m_bLastRecord = (m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OAdabasResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_nLastColumnPos = 0;
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_OFF,SQL_IS_UINTEGER);
-
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_ABSOLUTE,row);
- sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
- if(bRet)
- {
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0);
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_ON,SQL_IS_UINTEGER);
- m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle);
- }
-
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- if(bRet)
- m_nRowPos = row;
- return bRet;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OAdabasResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_nLastColumnPos = 0;
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_OFF,SQL_IS_UINTEGER);
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,row);
- sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
- if(bRet)
- {
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0);
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_ON,SQL_IS_UINTEGER);
- m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle);
- }
-
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- if(bRet)
- m_nRowPos += row;
- return bRet;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OAdabasResultSet::previous( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_nLastColumnPos = 0;
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_OFF,SQL_IS_UINTEGER);
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0);
- sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
- if(bRet)
- {
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0);
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_ON,SQL_IS_UINTEGER);
- m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle);
- }
-
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- if(bRet || m_nCurrentFetchState == SQL_NO_DATA)
- --m_nRowPos;
- return bRet;
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OAdabasResultSet::refreshRow( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- // SQLRETURN nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_REFRESH,SQL_LOCK_NO_CHANGE);
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_OFF,SQL_IS_UINTEGER);
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,0);
- sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
- if(bRet)
- {
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0);
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_ON,SQL_IS_UINTEGER);
- m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle);
- }
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
-}
-// -----------------------------------------------------------------------------
-Reference< XResultSetMetaData > SAL_CALL OAdabasResultSet::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- if(!m_xMetaData.is())
- m_xMetaData = new OAdabasResultSetMetaData(m_pStatement->getOwnConnection(),m_aStatementHandle,m_aSelectColumns);
- return m_xMetaData;
-}
-// -----------------------------------------------------------------------------
-
-
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BResultSetMetaData.cxx b/connectivity/source/drivers/adabas/BResultSetMetaData.cxx
deleted file mode 100644
index fe1eba559a..0000000000
--- a/connectivity/source/drivers/adabas/BResultSetMetaData.cxx
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "adabas/BResultSetMetaData.hxx"
-#include "adabas/BCatalog.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::uno;
-using namespace connectivity::adabas;
-using namespace connectivity;
-
-OAdabasResultSetMetaData::OAdabasResultSetMetaData(odbc::OConnection* _pConnection, SQLHANDLE _pStmt,const ::rtl::Reference<OSQLColumns>& _rSelectColumns )
-: OAdabasResultSetMetaData_BASE(_pConnection,_pStmt)
-,m_aSelectColumns(_rSelectColumns)
-{
-}
-// -------------------------------------------------------------------------
-OAdabasResultSetMetaData::~OAdabasResultSetMetaData()
-{
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OAdabasResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nType = OAdabasResultSetMetaData_BASE::getColumnType( column);
- // special handling for float values which could be doubles
- ::rtl::OUString sTypeName;
- OAdabasCatalog::correctColumnProperties(getPrecision(column),nType,sTypeName);
-
- return nType;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OAdabasResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0;
- sal_Bool bFound = sal_False;
- if ( m_aSelectColumns.is() && column > 0 && column <= (sal_Int32)m_aSelectColumns->get().size() )
- bFound = (m_aSelectColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nValue;
-
- if ( !bFound )
- nValue = getNumColAttrib(column,SQL_DESC_NULLABLE);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OAdabasResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if ( m_aSelectColumns.is() && column > 0 && column <= (sal_Int32)m_aSelectColumns->get().size() )
- {
- sal_Bool bAutoIncrement = sal_False;
- (m_aSelectColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)) >>= bAutoIncrement;
- return bAutoIncrement;
- }
-
- return getNumColAttrib(column,SQL_DESC_AUTO_UNIQUE_VALUE) == SQL_TRUE;
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BStatement.cxx b/connectivity/source/drivers/adabas/BStatement.cxx
deleted file mode 100644
index f4e399cc3c..0000000000
--- a/connectivity/source/drivers/adabas/BStatement.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "adabas/BStatement.hxx"
-#include "adabas/BResultSet.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <connectivity/dbexception.hxx>
-
-
-using namespace connectivity::adabas;
-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;
-
-typedef ::connectivity::odbc::OStatement OAdabasStatement_BASE;
-// -----------------------------------------------------------------------------
-OResultSet* OAdabasStatement::createResulSet()
-{
- return new OAdabasResultSet(m_aStatementHandle,this,m_aSelectColumns);
-}
-// -----------------------------------------------------------------------------
-void OAdabasStatement::setUsingBookmarks(sal_Bool /*_bUseBookmark*/)
-{
- ::dbtools::throwFeatureNotImplementedException( "bookmarks", *this );
- // adabas doesn't support bookmarks
-}
-// -----------------------------------------------------------------------------
-void OAdabasStatement::setResultSetConcurrency(sal_Int32 /*_par0*/)
-{
- ::dbtools::throwFeatureNotImplementedException( "PreparedStatement:ResultSetConcurrency", *this );
-}
-// -----------------------------------------------------------------------------
-void OAdabasStatement::setResultSetType(sal_Int32 /*_par0*/)
-{
- ::dbtools::throwFeatureNotImplementedException( "PreparedStatement:ResultSetType", *this );
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OAdabasStatement::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- m_aSelectColumns = m_pOwnConnection->createSelectColumns(sql);
- return OAdabasStatement_BASE::execute(sql);
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BTable.cxx b/connectivity/source/drivers/adabas/BTable.cxx
deleted file mode 100644
index 3f9ad2edde..0000000000
--- a/connectivity/source/drivers/adabas/BTable.cxx
+++ /dev/null
@@ -1,378 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "adabas/BTable.hxx"
-#include "adabas/BTables.hxx"
-#include "adabas/BIndexes.hxx"
-#include "adabas/BColumns.hxx"
-#include "adabas/BKeys.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <comphelper/sequence.hxx>
-#include <comphelper/extract.hxx>
-#include <comphelper/types.hxx>
-#include "connectivity/dbtools.hxx"
-#include "adabas/BCatalog.hxx"
-
-
-using namespace ::comphelper;
-using namespace connectivity::adabas;
-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;
-
-OAdabasTable::OAdabasTable( sdbcx::OCollection* _pTables,
- OAdabasConnection* _pConnection)
- :OTable_TYPEDEF(_pTables,_pConnection,sal_True)
- ,m_pConnection(_pConnection)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-OAdabasTable::OAdabasTable( sdbcx::OCollection* _pTables,
- OAdabasConnection* _pConnection,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description ,
- const ::rtl::OUString& _SchemaName,
- const ::rtl::OUString& _CatalogName
- ) : OTableHelper( _pTables,
- _pConnection,
- sal_True,
- _Name,
- _Type,
- _Description,
- _SchemaName,
- _CatalogName)
- ,m_pConnection(_pConnection)
-{
- construct();
-}
-// -----------------------------------------------------------------------------
-sdbcx::OCollection* OAdabasTable::createColumns(const TStringVector& _rNames)
-{
- return new OColumns(this,m_aMutex,_rNames);
-}
-// -----------------------------------------------------------------------------
-sdbcx::OCollection* OAdabasTable::createKeys(const TStringVector& _rNames)
-{
- return new OKeys(this,m_aMutex,_rNames);
-}
-// -----------------------------------------------------------------------------
-sdbcx::OCollection* OAdabasTable::createIndexes(const TStringVector& _rNames)
-{
- return new OIndexes(this,m_aMutex,_rNames);
-}
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OAdabasTable::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OAdabasTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : OTable_TYPEDEF::getSomething(rId);
-}
-// -------------------------------------------------------------------------
-// XAlterTable
-void SAL_CALL OAdabasTable::alterColumnByName( const ::rtl::OUString& colName, const Reference< XPropertySet >& descriptor ) throw(SQLException, NoSuchElementException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(
-#ifdef GCC
- ::connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed
-#else
- rBHelper.bDisposed
-#endif
- );
-
- if(m_pColumns && !m_pColumns->hasByName(colName))
- throw NoSuchElementException(colName,*this);
-
-
- if(!isNew())
- {
- beginTransAction();
-
- try
- {
- // first we have to check what should be altered
- Reference<XPropertySet> xProp;
- m_pColumns->getByName(colName) >>= xProp;
- // first check the types
- sal_Int32 nOldType = 0,nNewType = 0,nOldPrec = 0,nNewPrec = 0,nOldScale = 0,nNewScale = 0;
-
- xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nOldType;
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nNewType;
- // and precsions and scale
- xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nOldPrec;
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))>>= nNewPrec;
- xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nOldScale;
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nNewScale;
-
- if(nOldType != nNewType || nOldPrec != nNewPrec || nOldScale != nNewScale)
- alterColumnType(colName,descriptor);
-
- // second: check the "is nullable" value
- sal_Int32 nOldNullable = 0,nNewNullable = 0;
- xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nOldNullable;
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nNewNullable;
- if(nNewNullable != nOldNullable)
- alterNotNullValue(nNewNullable,colName);
-
- // third: check the default values
- ::rtl::OUString sNewDefault,sOldDefault;
- xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)) >>= sOldDefault;
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)) >>= sNewDefault;
-
- if(sOldDefault.getLength())
- {
- if(sNewDefault.getLength() && sOldDefault != sNewDefault)
- alterDefaultValue(sNewDefault,colName);
- else if(!sNewDefault.getLength())
- dropDefaultValue(colName);
- }
- else if(!sOldDefault.getLength() && sNewDefault.getLength())
- addDefaultValue(sNewDefault,colName);
-
- // now we should look if the name of the column changed
- ::rtl::OUString sNewColumnName;
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sNewColumnName;
- if(!sNewColumnName.equalsIgnoreAsciiCase(colName))
- {
- const ::rtl::OUString sQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( );
- const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
-
- ::rtl::OUString sSql( RTL_CONSTASCII_USTRINGPARAM( "RENAME COLUMN " )) ;
- sSql += ::dbtools::quoteName(sQuote,m_SchemaName) + sDot + ::dbtools::quoteName(sQuote,m_Name);
- sSql += sDot + ::dbtools::quoteName(sQuote,colName);
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" TO "));
- sSql += ::dbtools::quoteName(sQuote,sNewColumnName);
-
- Reference< XStatement > xStmt = m_pConnection->createStatement( );
- if(xStmt.is())
- {
- xStmt->execute(sSql);
- ::comphelper::disposeComponent(xStmt);
- }
- }
- m_pColumns->refresh();
- }
- catch(const SQLException&)
- {
- rollbackTransAction();
- throw;
- }
- endTransAction();
- }
- else
- {
- if(m_pColumns)
- {
- m_pColumns->dropByName(colName);
- m_pColumns->appendByDescriptor(descriptor);
- }
- }
-
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OAdabasTable::getName() throw(::com::sun::star::uno::RuntimeException)
-{
- ::rtl::OUString sName = m_SchemaName;
- if(m_SchemaName.getLength())
- {
- const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
- sName += sDot;
- }
- sName += m_Name;
- return sName;
-}
-// -----------------------------------------------------------------------------
-void OAdabasTable::alterColumnType(const ::rtl::OUString& _rColName, const Reference<XPropertySet>& _xDescriptor)
-{
- ::rtl::OUString sSql = getAlterTableColumnPart(_rColName);
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "));
- sSql += OTables::getColumnSqlType(_xDescriptor);
-
- Reference< XStatement > xStmt = m_pConnection->createStatement( );
- if(xStmt.is())
- {
- xStmt->execute(sSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-void OAdabasTable::alterNotNullValue(sal_Int32 _nNewNullable,const ::rtl::OUString& _rColName)
-{
- ::rtl::OUString sSql = getAlterTableColumnPart(_rColName);
-
- if(_nNewNullable == ColumnValue::NO_NULLS)
- {
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" NOT NULL"));
- }
- else
- {
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DEFAULT NULL"));
- }
-
- Reference< XStatement > xStmt = m_pConnection->createStatement();
- if(xStmt.is())
- {
- xStmt->execute(sSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-void OAdabasTable::alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName)
-{
- ::rtl::OUString sSql = getAlterTableColumnPart(_rColName);
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ALTER ")) + _sNewDefault;
-
- Reference< XStatement > xStmt = m_pConnection->createStatement();
- if(xStmt.is())
- {
- xStmt->execute(sSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-void OAdabasTable::dropDefaultValue(const ::rtl::OUString& _rColName)
-{
- ::rtl::OUString sSql = getAlterTableColumnPart(_rColName);
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DROP DEFAULT"));
-
- Reference< XStatement > xStmt = m_pConnection->createStatement();
- if(xStmt.is())
- {
- xStmt->execute(sSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-void OAdabasTable::addDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName)
-{
- ::rtl::OUString sSql = getAlterTableColumnPart(_rColName);
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ADD ")) + _sNewDefault;
-
- Reference< XStatement > xStmt = m_pConnection->createStatement();
- if(xStmt.is())
- {
- xStmt->execute(sSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-void OAdabasTable::beginTransAction()
-{
- try
- {
- Reference< XStatement > xStmt = m_pConnection->createStatement();
- if(xStmt.is())
- {
- xStmt->execute(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SUBTRANS BEGIN")) );
- ::comphelper::disposeComponent(xStmt);
- }
- }
- catch(const Exception&)
- {
- }
-}
-// -----------------------------------------------------------------------------
-void OAdabasTable::endTransAction()
-{
- try
- {
- Reference< XStatement > xStmt = m_pConnection->createStatement();
- if(xStmt.is())
- {
- xStmt->execute(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SUBTRANS END")) );
- ::comphelper::disposeComponent(xStmt);
- }
- }
- catch(const Exception&)
- {
- }
-}
-// -----------------------------------------------------------------------------
-void OAdabasTable::rollbackTransAction()
-{
- try
- {
- Reference< XStatement > xStmt = m_pConnection->createStatement();
- if(xStmt.is())
- {
- xStmt->execute(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SUBTRANS ROLLBACK")) );
- ::comphelper::disposeComponent(xStmt);
- }
- }
- catch(const Exception&)
- {
- }
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OAdabasTable::getAlterTableColumnPart(const ::rtl::OUString& _rsColumnName )
-{
- ::rtl::OUString sSql( RTL_CONSTASCII_USTRINGPARAM( "ALTER TABLE " ));
- const ::rtl::OUString sQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( );
- const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
-
- sSql += ::dbtools::quoteName(sQuote,m_SchemaName) + sDot + ::dbtools::quoteName(sQuote,m_Name)
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" COLUMN "))
- + ::dbtools::quoteName(sQuote,_rsColumnName);
- return sSql;
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BTables.cxx b/connectivity/source/drivers/adabas/BTables.cxx
deleted file mode 100644
index 302e9b4e8f..0000000000
--- a/connectivity/source/drivers/adabas/BTables.cxx
+++ /dev/null
@@ -1,523 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "adabas/BTables.hxx"
-#include "adabas/BViews.hxx"
-#include "adabas/BTable.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include "adabas/BCatalog.hxx"
-#include "adabas/BConnection.hxx"
-#include <comphelper/extract.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/dbexception.hxx"
-#include <cppuhelper/interfacecontainer.h>
-#include <comphelper/types.hxx>
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace ::cppu;
-using namespace connectivity::adabas;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace dbtools;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OTables::createObject(const ::rtl::OUString& _rName)
-{
- ::rtl::OUString aName,aSchema;
- sal_Int32 nLen = _rName.indexOf('.');
- aSchema = _rName.copy(0,nLen);
- aName = _rName.copy(nLen+1);
-
- Sequence< ::rtl::OUString > aTypes(1);
- aTypes[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%"));
-
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),aSchema,aName,aTypes);
-
- sdbcx::ObjectType xRet = NULL;
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- if(xResult->next()) // there can be only one table with this name
- {
- OAdabasTable* pRet = new OAdabasTable(this, static_cast<OAdabasCatalog&>(m_rParent).getConnection(),
- aName,xRow->getString(4),xRow->getString(5),aSchema);
- xRet = pRet;
- }
- ::comphelper::disposeComponent(xResult);
- }
-
- return xRet;
-}
-// -------------------------------------------------------------------------
-void OTables::impl_refresh( ) throw(RuntimeException)
-{
- static_cast<OAdabasCatalog&>(m_rParent).refreshTables();
-}
-// -------------------------------------------------------------------------
-void OTables::disposing(void)
-{
-m_xMetaData.clear();
- OCollection::disposing();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OTables::createDescriptor()
-{
- return new OAdabasTable(this,static_cast<OAdabasCatalog&>(m_rParent).getConnection());
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OTables::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- createTable(descriptor);
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-void OTables::setComments(const Reference< XPropertySet >& descriptor ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE TABLE " ));
- ::rtl::OUString aQuote = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getIdentifierQuoteString( );
- const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
-
- OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection();
- Reference< XStatement > xStmt = pConnection->createStatement( );
- aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("COMMENT ON TABLE "));
- ::rtl::OUString sSchema;
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= sSchema;
- if(sSchema.getLength())
- aSql += ::dbtools::quoteName(aQuote, sSchema) + sDot;
-
- aSql += aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" '"))
- + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION)))
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'"));
- xStmt->execute(aSql);
-
- // columns
- Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY);
- Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY);
- Reference< XPropertySet > xColProp;
-
- aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("COMMENT ON COLUMN "));
- if(sSchema.getLength())
- aSql += ::dbtools::quoteName(aQuote, sSchema) + sDot;
- aSql += aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote + sDot
- + aQuote;
-
- for(sal_Int32 i=0;i<xColumns->getCount();++i)
- {
- ::cppu::extractInterface(xColProp,xColumns->getByIndex(i));
- if(xColProp.is())
- {
- ::rtl::OUString aDescription = getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION)));
- if(aDescription.getLength())
- {
- ::rtl::OUString aCom = aSql + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" '"))
- + aDescription
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'"));
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
- }
- }
- ::comphelper::disposeComponent(xStmt);
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName)
-{
- Reference< XInterface > xObject( getObject( _nPos ) );
- sal_Bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject );
- if (!bIsNew)
- {
- OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection();
- Reference< XStatement > xStmt = pConnection->createStatement( );
-
- ::rtl::OUString aName,aSchema;
- sal_Int32 nLen = _sElementName.indexOf('.');
- aSchema = _sElementName.copy(0,nLen);
- aName = _sElementName.copy(nLen+1);
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP " ));
- const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
-
- Reference<XPropertySet> xProp(xObject,UNO_QUERY);
- sal_Bool bIsView;
- if((bIsView = (xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW"))))) // here we have a view
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW "));
- else
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE "));
-
- aSql += m_xMetaData->getIdentifierQuoteString( ) + aSchema + m_xMetaData->getIdentifierQuoteString( );
- aSql += sDot;
- aSql += m_xMetaData->getIdentifierQuoteString( ) + aName + m_xMetaData->getIdentifierQuoteString( );
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- // if no exception was thrown we must delete it from the views
- if(bIsView)
- {
- OViews* pViews = static_cast<OViews*>(static_cast<OAdabasCatalog&>(m_rParent).getPrivateViews());
- if(pViews && pViews->hasByName(_sElementName))
- pViews->dropByNameImpl(_sElementName);
- }
- }
-}
-// -------------------------------------------------------------------------
-void OTables::createTable( const Reference< XPropertySet >& descriptor )
-{
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE TABLE " ));
- ::rtl::OUString aQuote = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getIdentifierQuoteString( );
- const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
- ::rtl::OUString sSchema;
-
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= sSchema;
- if(sSchema.getLength())
- aSql += ::dbtools::quoteName(aQuote, sSchema) + sDot;
- else
- descriptor->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME),makeAny(static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getUserName().
- toAsciiUpperCase()
- ));
-
- aSql += ::dbtools::quoteName(aQuote, getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))))
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ("));
-
- // columns
- Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY);
- Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY);
- Reference< XPropertySet > xColProp;
-
- Any aTypeName;
- sal_Int32 nCount = xColumns->getCount();
- if(!nCount)
- ::dbtools::throwFunctionSequenceException(static_cast<XTypeProvider*>(this));
-
- for(sal_Int32 i=0;i<nCount;++i)
- {
- if(::cppu::extractInterface(xColProp,xColumns->getByIndex(i)) && xColProp.is())
- {
-
- aSql += aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote;
-
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "));
- aSql += OTables::getColumnSqlType(xColProp);
- aSql += OTables::getColumnSqlNotNullDefault(xColProp);
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- }
- }
-
- // keys
-
- Reference<XKeysSupplier> xKeySup(descriptor,UNO_QUERY);
-
- Reference<XIndexAccess> xKeys = xKeySup->getKeys();
- if(xKeys.is())
- {
- sal_Bool bPKey = sal_False;
- for( sal_Int32 key=0; key<xKeys->getCount(); ++key )
- {
- if(::cppu::extractInterface(xColProp,xKeys->getByIndex(key)) && xColProp.is())
- {
-
- sal_Int32 nKeyType = getINT32(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)));
-
- if(nKeyType == KeyType::PRIMARY)
- {
- if(bPKey)
- throw SQLException();
-
- bPKey = sal_True;
- xColumnSup = Reference<XColumnsSupplier>(xColProp,UNO_QUERY);
- xColumns = Reference<XIndexAccess>(xColumnSup->getColumns(),UNO_QUERY);
- if(!xColumns->getCount())
- throw SQLException();
-
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" PRIMARY KEY ("));
- for( sal_Int32 column=0; column<xColumns->getCount(); ++column )
- {
- if(::cppu::extractInterface(xColProp,xColumns->getByIndex(column)) && xColProp.is())
- aSql += aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- }
-
- aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")));
- }
- else if(nKeyType == KeyType::UNIQUE)
- {
- xColumnSup = Reference<XColumnsSupplier>(xColProp,UNO_QUERY);
- xColumns = Reference<XIndexAccess>(xColumnSup->getColumns(),UNO_QUERY);
- if(!xColumns->getCount())
- throw SQLException();
-
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" UNIQUE ("));
- for( sal_Int32 column=0; column<xColumns->getCount(); ++column )
- {
- if(::cppu::extractInterface(xColProp,xColumns->getByIndex(column)) && xColProp.is())
- aSql += aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- }
-
- aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")));
- }
- else if(nKeyType == KeyType::FOREIGN)
- {
- sal_Int32 nDeleteRule = getINT32(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELETERULE)));
-
- xColumnSup = Reference<XColumnsSupplier>(xColProp,UNO_QUERY);
- xColumns = Reference<XIndexAccess>(xColumnSup->getColumns(),UNO_QUERY);
- if(!xColumns->getCount())
- throw SQLException();
-
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FOREIGN KEY "));
- ::rtl::OUString aName,aSchema,aRefTable = getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REFERENCEDTABLE)));
- sal_Int32 nLen = aRefTable.indexOf('.');
- aSchema = aRefTable.copy(0,nLen);
- aName = aRefTable.copy(nLen+1);
-
- aSql += aQuote + aSchema + aQuote + sDot
- + aQuote + aName + aQuote
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ("));
-
- for ( sal_Int32 column=0; column<xColumns->getCount(); ++column )
- {
- if(::cppu::extractInterface(xColProp,xColumns->getByIndex(column)) && xColProp.is())
- aSql += aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- }
-
- aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")));
-
- switch(nDeleteRule)
- {
- case KeyRule::CASCADE:
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE CASCADE "));
- break;
- case KeyRule::RESTRICT:
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE RESTRICT "));
- break;
- case KeyRule::SET_NULL:
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE SET NULL "));
- break;
- case KeyRule::SET_DEFAULT:
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE SET DEFAULT "));
- break;
- default:
- ;
- }
- }
- }
- }
- }
-
- if(aSql.lastIndexOf(',') == (aSql.getLength()-1))
- aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")));
- else
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"));
-
- OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection();
- Reference< XStatement > xStmt = pConnection->createStatement( );
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
-
- if(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))).getLength())
- setComments(descriptor);
-}
-// -----------------------------------------------------------------------------
-void OTables::appendNew(const ::rtl::OUString& _rsNewTable)
-{
- insertElement(_rsNewTable,NULL);
-
- // notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any());
- OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners);
- while (aListenerLoop.hasMoreElements())
- static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent);
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OTables::getColumnSqlType(const Reference<XPropertySet>& _rxColProp)
-{
- ::rtl::OUString sSql;
- sal_Int32 nDataType = 0;
- _rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nDataType;
- switch(nDataType)
- {
- case DataType::VARBINARY:
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VAR"));
- /* run through*/
- case DataType::BINARY:
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR"));
- break;
- default:
- {
- Any aTypeName = _rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME));
- if(aTypeName.hasValue() && getString(aTypeName).getLength())
- sSql += getString(aTypeName);
- else
- sSql += OTables::getTypeString(_rxColProp) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "));
- }
- }
-
- switch(nDataType)
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- case DataType::FLOAT:
- case DataType::REAL:
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("("))
- + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))))
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"));
- break;
-
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("("))
- + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))))
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","))
- + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))))
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"));
- break;
- case DataType::BINARY:
- case DataType::VARBINARY:
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("("))
- + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))))
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(") BYTE"));
- break;
- }
- return sSql;
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OTables::getColumnSqlNotNullDefault(const Reference<XPropertySet>& _rxColProp)
-{
- OSL_ENSURE(_rxColProp.is(),"OTables::getColumnSqlNotNullDefault: Column is null!");
- ::rtl::OUString sSql;
- ::rtl::OUString aDefault = getString(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)));
- if(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) == ColumnValue::NO_NULLS)
- {
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" NOT NULL"));
- if(aDefault.getLength())
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WITH DEFAULT"));
- }
- else if(aDefault.getLength())
- {
- sSql +=::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DEFAULT '")) + aDefault;
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'"));
- }
- return sSql;
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OTables::getTypeString(const Reference< XPropertySet >& _rxColProp)
-{
- ::rtl::OUString aValue;
- switch(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))))
- {
- case DataType::BIT:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BOOLEAN"));
- break;
- case DataType::TINYINT:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SMALLINT"));
- break;
- case DataType::SMALLINT:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SMALLINT"));
- break;
- case DataType::INTEGER:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INT"));
- break;
- case DataType::FLOAT:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FLOAT"));
- break;
- case DataType::REAL:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REAL"));
- break;
- case DataType::DOUBLE:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOUBLE"));
- break;
- case DataType::NUMERIC:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL"));
- break;
- case DataType::DECIMAL:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL"));
- break;
- case DataType::CHAR:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR"));
- break;
- case DataType::VARCHAR:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"));
- break;
- case DataType::LONGVARCHAR:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONG VARCHAR"));
- break;
- case DataType::DATE:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATE"));
- break;
- case DataType::TIME:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIME"));
- break;
- case DataType::TIMESTAMP:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP"));
- break;
- case DataType::BINARY:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR () BYTE"));
- break;
- case DataType::VARBINARY:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR () BYTE"));
- break;
- case DataType::LONGVARBINARY:
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONG BYTE"));
- break;
- }
- return aValue;
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OTables::getNameForObject(const sdbcx::ObjectType& _xObject)
-{
- OSL_ENSURE(_xObject.is(),"OTables::getNameForObject: Object is NULL!");
- ::rtl::OUString sName,sTemp;
- _xObject->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= sName;
- if( sName.getLength() )
- {
- const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
- sName += sDot;
- }
-
- _xObject->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sTemp;
- sName += sTemp;
-
- return sName;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BUser.cxx b/connectivity/source/drivers/adabas/BUser.cxx
deleted file mode 100644
index 98d61e4f43..0000000000
--- a/connectivity/source/drivers/adabas/BUser.cxx
+++ /dev/null
@@ -1,332 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <sal/macros.h>
-#include "adabas/BUser.hxx"
-#include "adabas/BGroups.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include "adabas/BConnection.hxx"
-#include "connectivity/dbtools.hxx"
-#include "connectivity/dbexception.hxx"
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#include <com/sun/star/sdbcx/PrivilegeObject.hpp>
-#include "resource/adabas_res.hrc"
-
-using namespace connectivity::adabas;
-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;
-// -------------------------------------------------------------------------
-OAdabasUser::OAdabasUser( OAdabasConnection* _pConnection) : connectivity::sdbcx::OUser(sal_True)
- ,m_pConnection(_pConnection)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-OAdabasUser::OAdabasUser( OAdabasConnection* _pConnection,
- const ::rtl::OUString& _Name
- ) : connectivity::sdbcx::OUser(_Name,sal_True)
- ,m_pConnection(_pConnection)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-void OAdabasUser::refreshGroups()
-{
- if(!m_pConnection)
- return;
-
- TStringVector aVector;
- aVector.reserve(7); // we don't know the excatly count of users but this should fit the normal need
- Reference< XStatement > xStmt = m_pConnection->createStatement( );
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "SELECT DISTINCT GROUPNAME FROM DOMAIN.USERS WHERE GROUPNAME IS NOT NULL AND GROUPNAME <> ' ' AND USERNAME = '" ));
- aSql += getName( );
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'"));
-
- Reference< XResultSet > xResult = xStmt->executeQuery(aSql);
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while(xResult->next())
- aVector.push_back(xRow->getString(1));
- ::comphelper::disposeComponent(xResult);
- }
- ::comphelper::disposeComponent(xStmt);
-
- if(m_pGroups)
- m_pGroups->reFill(aVector);
- else
- m_pGroups = new OGroups(*this,m_aMutex,aVector,m_pConnection,this);
-}
-// -------------------------------------------------------------------------
-OUserExtend::OUserExtend( OAdabasConnection* _pConnection) : OAdabasUser(_pConnection)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-typedef connectivity::sdbcx::OUser OUser_TYPEDEF;
-void OUserExtend::construct()
-{
-
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), PROPERTY_ID_PASSWORD,0,&m_Password,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
-}
-// -----------------------------------------------------------------------------
-cppu::IPropertyArrayHelper* OUserExtend::createArrayHelper() const
-{
- Sequence< 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 OAdabasUser::getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(SQLException, RuntimeException)
-{
- if ( objType != PrivilegeObject::TABLE )
- return 0;
-
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
-
- sal_Int32 nRights,nRightsWithGrant;
- getAnyTablePrivileges(objName,nRights,nRightsWithGrant);
- return nRights;
-}
-// -----------------------------------------------------------------------------
-void OAdabasUser::getAnyTablePrivileges(const ::rtl::OUString& objName, sal_Int32& nRights,sal_Int32& nRightsWithGrant) throw(SQLException, RuntimeException)
-{
- nRightsWithGrant = nRights = 0;
- // first we need to create the sql stmt to select the privs
- Reference<XDatabaseMetaData> xMeta = m_pConnection->getMetaData();
- ::rtl::OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(xMeta,objName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
- Reference<XStatement> xStmt = m_pConnection->createStatement();
- ::rtl::OUString sSql( RTL_CONSTASCII_USTRINGPARAM( "SELECT REFTABLENAME,PRIVILEGES FROM DOMAIN.USR_USES_TAB WHERE REFOBJTYPE <> 'SYSTEM' AND DEFUSERNAME = '" ));
- sSql += m_Name;
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("' AND REFTABLENAME = '"));
- sSql += sTable;
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'"));
- if(xStmt.is())
- {
- Reference<XResultSet> xRes = xStmt->executeQuery(sSql);
- if(xRes.is())
- {
- Reference<XRow> xRow(xRes,UNO_QUERY);
- if(xRow.is() && xRes->next())
- {
- ::rtl::OUString sPrivs = xRow->getString(2);
-
- struct _priv_nam
- {
- const sal_Char* pAsciiName;
- sal_Int32 nNumericValue;
- } privileges[] =
- {
- { "INS", Privilege::INSERT },
- { "DEL", Privilege::DELETE },
- { "UPD", Privilege::UPDATE },
- { "ALT", Privilege::ALTER },
- { "SEL", Privilege::SELECT },
- { "REF", Privilege::REFERENCE }
- };
- for ( size_t i = 0; i < SAL_N_ELEMENTS( privileges ); ++i )
- {
- sal_Int32 nIndex = sPrivs.indexOf( ::rtl::OUString::createFromAscii( privileges[i].pAsciiName ) );
- if ( nIndex == -1 )
- continue;
-
- nRights |= privileges[i].nNumericValue;
- if ( sPrivs.copy( nIndex + 2, 1 ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "+" ) ) )
- nRightsWithGrant |= privileges[i].nNumericValue;
- }
- }
- ::comphelper::disposeComponent(xRes);
- }
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OAdabasUser::getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(SQLException, RuntimeException)
-{
- if ( objType != PrivilegeObject::TABLE )
- return 0;
-
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
-
- sal_Int32 nRights,nRightsWithGrant;
- getAnyTablePrivileges(objName,nRights,nRightsWithGrant);
- return nRightsWithGrant;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OAdabasUser::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException)
-{
- if ( objType != PrivilegeObject::TABLE )
- m_pConnection->throwGenericSQLException(STR_PRIVILEGE_NOT_GRANTED,*this);
-
- ::osl::MutexGuard aGuard(m_aMutex);
- ::rtl::OUString sPrivs = getPrivilegeString(objPrivileges);
- if(sPrivs.getLength())
- {
- ::rtl::OUString sGrant(RTL_CONSTASCII_USTRINGPARAM("GRANT "));
- sGrant += sPrivs;
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON "));
- Reference<XDatabaseMetaData> xMeta = m_pConnection->getMetaData();
- sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation);
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" TO "));
- sGrant += m_Name;
-
- Reference<XStatement> xStmt = m_pConnection->createStatement();
- if(xStmt.is())
- xStmt->execute(sGrant);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OAdabasUser::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException)
-{
- if ( objType != PrivilegeObject::TABLE )
- m_pConnection->throwGenericSQLException(STR_PRIVILEGE_NOT_REVOKED,*this);
-
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
- ::rtl::OUString sPrivs = getPrivilegeString(objPrivileges);
- if(sPrivs.getLength())
- {
- ::rtl::OUString sGrant(RTL_CONSTASCII_USTRINGPARAM("REVOKE "));
- sGrant += sPrivs;
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON "));
- Reference<XDatabaseMetaData> xMeta = m_pConnection->getMetaData();
- sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation);
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FROM "));
- sGrant += m_Name;
-
- Reference<XStatement> xStmt = m_pConnection->createStatement();
- if(xStmt.is())
- xStmt->execute(sGrant);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-// XUser
-void SAL_CALL OAdabasUser::changePassword( const ::rtl::OUString& objPassword, const ::rtl::OUString& newPassword ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
- ::rtl::OUString sAlterPwd(RTL_CONSTASCII_USTRINGPARAM("ALTER PASSWORD \""));
- sAlterPwd += objPassword.toAsciiUpperCase();
- sAlterPwd += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" TO \"")) ;
- sAlterPwd += newPassword.toAsciiUpperCase();
- sAlterPwd += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"")) ;
-
- sal_Bool bDisposeConnection = sal_False;
- Reference<XConnection> xConnection = m_pConnection;
- if(m_pConnection->getMetaData()->getUserName() != m_Name)
- {
- OAdabasConnection* pNewConnection = new OAdabasConnection(m_pConnection->getDriverHandle(),m_pConnection->getDriver());
- xConnection = pNewConnection;
- if(pNewConnection)
- {
- Sequence< PropertyValue> aSeq(2);
- aSeq.getArray()[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")) ;
- aSeq.getArray()[0].Value <<= m_Name;
- aSeq.getArray()[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("password")) ;
- aSeq.getArray()[1].Value <<= objPassword;
- pNewConnection->Construct(m_pConnection->getMetaData()->getURL(),aSeq);
- }
- bDisposeConnection = sal_True;
- }
- if(xConnection.is())
- {
- Reference<XStatement> xStmt = xConnection->createStatement();
- if(xStmt.is())
- xStmt->execute(sAlterPwd);
- ::comphelper::disposeComponent(xStmt);
- if(bDisposeConnection)
- ::comphelper::disposeComponent(xConnection);
- }
- else
- ::dbtools::throwFunctionSequenceException(*this);
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OAdabasUser::getPrivilegeString(sal_Int32 nRights) const
-{
- ::rtl::OUString sPrivs;
- if((nRights & Privilege::INSERT) == Privilege::INSERT)
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INSERT"));
-
- if((nRights & Privilege::DELETE) == Privilege::DELETE)
- {
- if(sPrivs.getLength())
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DELETE"));
- }
-
- if((nRights & Privilege::UPDATE) == Privilege::UPDATE)
- {
- if(sPrivs.getLength())
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UPDATE"));
- }
-
- if((nRights & Privilege::ALTER) == Privilege::ALTER)
- {
- if(sPrivs.getLength())
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALTER"));
- }
-
- if((nRights & Privilege::SELECT) == Privilege::SELECT)
- {
- if(sPrivs.getLength())
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT"));
- }
-
- if((nRights & Privilege::REFERENCE) == Privilege::REFERENCE)
- {
- if(sPrivs.getLength())
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REFERENCES"));
- }
-
- return sPrivs;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BUsers.cxx b/connectivity/source/drivers/adabas/BUsers.cxx
deleted file mode 100644
index 995a4f8739..0000000000
--- a/connectivity/source/drivers/adabas/BUsers.cxx
+++ /dev/null
@@ -1,130 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "adabas/BUsers.hxx"
-#include "adabas/BUser.hxx"
-#include "adabas/BTable.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include "connectivity/sdbcx/IRefreshable.hxx"
-#include <comphelper/types.hxx>
-#include "connectivity/dbexception.hxx"
-#include "connectivity/dbtools.hxx"
-#include "resource/adabas_res.hrc"
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::adabas;
-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;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OUsers::createObject(const ::rtl::OUString& _rName)
-{
- return new OAdabasUser(m_pConnection,_rName);
-}
-// -------------------------------------------------------------------------
-void OUsers::impl_refresh() throw(RuntimeException)
-{
- m_pParent->refreshUsers();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OUsers::createDescriptor()
-{
- OUserExtend* pNew = new OUserExtend(m_pConnection);
- return pNew;
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OUsers::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE USER " ));
- ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( );
-
- ::rtl::OUString sUserName( _rForName );
- sUserName = sUserName.toAsciiUpperCase();
- descriptor->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sUserName));
- aSql += ::dbtools::quoteName(aQuote,sUserName)
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" PASSWORD "))
- + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)));
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" RESOURCE NOT EXCLUSIVE"));
-
- Reference< XStatement > xStmt = m_pConnection->createStatement( );
- if(xStmt.is())
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
-
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OUsers::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName)
-{
- {
- // first we have to check if this user is live relevaant for the database
- // which means with out these users the database will miss more than one important system table
- ::rtl::OUString sUsers( RTL_CONSTASCII_USTRINGPARAM( "SELECT USERMODE,USERNAME FROM DOMAIN.USERS WHERE USERNAME = '" ));
- sUsers += _sElementName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'"));
- Reference< XStatement > xStmt = m_pConnection->createStatement();
- if(xStmt.is())
- {
- Reference<XResultSet> xRes = xStmt->executeQuery(sUsers);
- Reference<XRow> xRow(xRes,UNO_QUERY);
- if(xRes.is() && xRow.is() && xRes->next()) // there can only be one user with this name
- {
- static const ::rtl::OUString sDbaUser( RTL_CONSTASCII_USTRINGPARAM( "DBA" ));
- if(xRow->getString(1) == sDbaUser)
- {
- ::comphelper::disposeComponent(xStmt);
- m_pConnection->throwGenericSQLException(STR_USER_NO_DELETE,static_cast< XDrop* >( this ));
- }
- }
- ::comphelper::disposeComponent(xStmt);
- }
- }
-
- {
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP USER " ));
- ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( );
- aSql += ::dbtools::quoteName(aQuote,_sElementName);
-
- Reference< XStatement > xStmt = m_pConnection->createStatement( );
- if(xStmt.is())
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/BViews.cxx b/connectivity/source/drivers/adabas/BViews.cxx
deleted file mode 100644
index f15ff861be..0000000000
--- a/connectivity/source/drivers/adabas/BViews.cxx
+++ /dev/null
@@ -1,197 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "adabas/BViews.hxx"
-#include "adabas/BTables.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include <com/sun/star/sdbcx/CheckOption.hpp>
-#include "adabas/BCatalog.hxx"
-#include "adabas/BConnection.hxx"
-#include <comphelper/extract.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/dbexception.hxx"
-#include <cppuhelper/interfacecontainer.h>
-#include "connectivity/sdbcx/VView.hxx"
-#include <comphelper/types.hxx>
-
-using namespace ::comphelper;
-
-using namespace ::cppu;
-using namespace connectivity;
-using namespace connectivity::adabas;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace dbtools;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OViews::createObject(const ::rtl::OUString& _rName)
-{
- ::rtl::OUString aName,aSchema;
- sal_Int32 nLen = _rName.indexOf('.');
- aSchema = _rName.copy(0,nLen);
- aName = _rName.copy(nLen+1);
-
- ::rtl::OUString sStmt( RTL_CONSTASCII_USTRINGPARAM( "SELECT DISTINCT * FROM DOMAIN.SHOW_VIEW WHERE " ));
- if(aSchema.getLength())
- {
- sStmt += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OWNER = '"));
- sStmt += aSchema;
- sStmt += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("' AND "));
- }
- sStmt += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEWNAME = '"));
- sStmt += aName;
- sStmt += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'"));
- Reference<XConnection> xConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection();
- Reference< XStatement > xStmt = xConnection->createStatement( );
- Reference< XResultSet > xResult = xStmt->executeQuery(sStmt);
-
- sdbcx::ObjectType xRet = NULL;
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- if(xResult->next()) // there can be only one table with this name
- {
- connectivity::sdbcx::OView* pRet = new connectivity::sdbcx::OView(sal_True,
- aName,
- xConnection->getMetaData(),
- CheckOption::NONE,
- xRow->getString(3),
- aSchema);
- xRet = pRet;
- }
- ::comphelper::disposeComponent(xResult);
- }
- ::comphelper::disposeComponent(xStmt);
-
- return xRet;
-}
-// -------------------------------------------------------------------------
-void OViews::impl_refresh( ) throw(RuntimeException)
-{
- static_cast<OAdabasCatalog&>(m_rParent).refreshTables();
-}
-// -------------------------------------------------------------------------
-void OViews::disposing(void)
-{
-m_xMetaData.clear();
- OCollection::disposing();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OViews::createDescriptor()
-{
- Reference<XConnection> xConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection();
- return new connectivity::sdbcx::OView(sal_True,xConnection->getMetaData());
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OViews::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- createView(descriptor);
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OViews::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName)
-{
- if(m_bInDrop)
- return;
-
- Reference< XInterface > xObject( getObject( _nPos ) );
- sal_Bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject );
- if (!bIsNew)
- {
- OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection();
- Reference< XStatement > xStmt = pConnection->createStatement( );
-
- ::rtl::OUString aName,aSchema;
- sal_Int32 nLen = _sElementName.indexOf('.');
- aSchema = _sElementName.copy(0,nLen);
- aName = _sElementName.copy(nLen+1);
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP VIEW" ));
- const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
-
- aSql = aSql + m_xMetaData->getIdentifierQuoteString( ) + aSchema + m_xMetaData->getIdentifierQuoteString( );
- aSql = aSql + sDot;
- aSql = aSql + m_xMetaData->getIdentifierQuoteString( ) + aName + m_xMetaData->getIdentifierQuoteString( );
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-void OViews::dropByNameImpl(const ::rtl::OUString& elementName)
-{
- m_bInDrop = sal_True;
- OCollection_TYPE::dropByName(elementName);
- m_bInDrop = sal_False;
-}
-// -----------------------------------------------------------------------------
-void OViews::createView( const Reference< XPropertySet >& descriptor )
-{
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE VIEW " ));
- ::rtl::OUString aQuote = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getIdentifierQuoteString( );
- const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
- ::rtl::OUString sSchema,sCommand;
-
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= sSchema;
- if(sSchema.getLength())
- aSql += ::dbtools::quoteName(aQuote, sSchema) + sDot;
- else
- descriptor->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME),makeAny(sSchema = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getUserName()));
-
- aSql += ::dbtools::quoteName(aQuote, getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))))
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" AS "));
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND)) >>= sCommand;
- aSql += sCommand;
-
- OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection();
- Reference< XStatement > xStmt = pConnection->createStatement( );
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
-
- // insert the new view also in the tables collection
- OTables* pTables = static_cast<OTables*>(static_cast<OAdabasCatalog&>(m_rParent).getPrivateTables());
- if(pTables)
- {
- ::rtl::OUString sName = sSchema;
- sName += sDot;
- sName += getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)));
- pTables->appendNew(sName);
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/Bservices.cxx b/connectivity/source/drivers/adabas/Bservices.cxx
deleted file mode 100644
index dcb809842c..0000000000
--- a/connectivity/source/drivers/adabas/Bservices.cxx
+++ /dev/null
@@ -1,115 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "adabas/BDriver.hxx"
-#include <cppuhelper/factory.hxx>
-
-using namespace connectivity::adabas;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount* _pT
- );
-
-//---------------------------------------------------------------------------------------
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- sal_Char const* pImplementationName
- )
- : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- inline
- sal_Bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
- }
- catch(...)
- {
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = 0;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- ODriver::getImplementationName_Static(),
- ODriver::getSupportedServiceNames_Static(),
- ODriver_CreateInstance, ::cppu::createSingleFactory)
- ;
-
- if(aReq.xRet.is())
- aReq.xRet->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/adabas/adabas.component b/connectivity/source/drivers/adabas/adabas.component
deleted file mode 100755
index 3c359c3d02..0000000000
--- a/connectivity/source/drivers/adabas/adabas.component
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.sdbcx.adabas.ODriver">
- <service name="com.sun.star.sdbc.Driver"/>
- <service name="com.sun.star.sdbcx.Driver"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/adabas/adabas.mxp.map b/connectivity/source/drivers/adabas/adabas.mxp.map
deleted file mode 100755
index d1251e3725..0000000000
--- a/connectivity/source/drivers/adabas/adabas.mxp.map
+++ /dev/null
@@ -1,146 +0,0 @@
-component_getFactory
-__mh_dylib_header
-___builtin_delete
-___builtin_vec_delete
-___builtin_vec_new
-___check_eh_spec
-___cp_pop_exception
-___cp_push_exception
-___eh_alloc
-___get_eh_context
-___pure_virtual
-___rtti_class
-___rtti_si
-___rtti_user
-___sjthrow
-___start_cp_handler
-___terminate
-_terminate__Fv
-dyld_stub_binding_helper
-rest_world
-save_world
-___eh_rtime_match
-__floatdisf
-___builtin_new
-___rtti_ptr
-___tf9bad_alloc
-__._10bad_typeid
-__._8bad_cast
-___get_eh_info
-___is_pointer__FPv
-___throw_type_match_rtti
-___vt_10bad_typeid
-___vt_8bad_cast
-__keymgr_get_per_thread_data
-__keymgr_set_per_thread_data
-___tf9exception
-___ti9exception
-___vt_9exception
-_what__C9exception
-__._9bad_alloc
-___vt_9bad_alloc
-__._9type_info
-___eq__C9type_infoRCB0
-___tf16__user_type_info
-___tf9type_info
-___ti9type_info
-___vt_9type_info
-_release__Q312connectivity6adabas7ODriver
-_acquire__Q312connectivity6adabas7ODriver
-___Q312connectivity6adabas7ODriver
-_refreshUsers__Q312connectivity6adabas14OAdabasCatalog
-_refreshGroups__Q312connectivity6adabas14OAdabasCatalog
-_refreshViews__Q312connectivity6adabas14OAdabasCatalog
-_refreshTables__Q312connectivity6adabas14OAdabasCatalog
-__._Q312connectivity6adabas12OAdabasGroup
-_refreshUsers__Q312connectivity6adabas12OAdabasGroup
-__._Q312connectivity6adabas11OAdabasUser
-__._Q312connectivity6adabas11OUserExtend
-_construct__Q312connectivity6adabas11OUserExtend
-___Q312connectivity6adabas11OAdabasUserPQ312connectivity6adabas17OAdabasConnection
-__._Q312connectivity6adabas18UStringDescription
-___Q312connectivity6adabas18UStringDescriptionPFv_PCc
-__._Q312connectivity6adabas10OAdabasKey
-_refreshColumns__Q312connectivity6adabas10OAdabasKey
-__._Q312connectivity6adabas12OAdabasIndex
-_refreshColumns__Q312connectivity6adabas12OAdabasIndex
-__._Q312connectivity6adabas12OAdabasTable
-_release__Q312connectivity6adabas12OAdabasTable
-_acquire__Q312connectivity6adabas12OAdabasTable
-_refreshForgeinKeys__Q312connectivity6adabas12OAdabasTableRQ24_STLt6vector2ZQ23rtl8OUStringZQ24_STLt9allocator1ZB2
-_refreshPrimaryKeys__Q312connectivity6adabas12OAdabasTableRQ24_STLt6vector2ZQ23rtl8OUStringZQ24_STLt9allocator1ZB2
-_refreshIndexes__Q312connectivity6adabas12OAdabasTable
-_refreshKeys__Q312connectivity6adabas12OAdabasTable
-_refreshColumns__Q312connectivity6adabas12OAdabasTable
-_setComments__Q312connectivity6adabas7OTablesRCQ53com3sun4star3unot9Reference1ZQ53com3sun4star5beans12XPropertySet
-__._Q312connectivity6adabas23OAdabasDatabaseMetaData
-__._Q312connectivity6adabas24OAdabasPreparedStatement
-__._Q312connectivity6adabas16OAdabasStatement
-__._Q312connectivity6adabas16OAdabasResultSet
-_initBoundParam__Q312connectivity4odbc18OPreparedStatement
-_setStream__Q312connectivity4odbc18OPreparedStatementlRCQ53com3sun4star3unot9Reference1ZQ53com3sun4star2io12XInputStreamln2
-_setBinary__Q312connectivity4odbc18OPreparedStatementllRCQ53com3sun4star3unot8Sequence1ZSc
-_getLengthBuf__Q312connectivity4odbc18OPreparedStatementl
-_allocBindBuf__Q312connectivity4odbc18OPreparedStatementll
-_setChar__Q312connectivity4odbc18OPreparedStatementln2RCQ23rtl8OUString
-_putParamData__Q312connectivity4odbc18OPreparedStatementl
-_FreeParams__Q312connectivity4odbc18OPreparedStatement
-_prepareStatement__Q312connectivity4odbc18OPreparedStatement
-__._Q312connectivity4odbc18UStringDescription
-___Q312connectivity4odbc18UStringDescriptionPFv_PCc
-_disposing__Q312connectivity4odbc15OStatement_Base
-_release__Q312connectivity4odbc15OStatement_Base
-_acquire__Q312connectivity4odbc15OStatement_Base
-__._Q312connectivity4odbc16OStatement_BASE2
-__._Q312connectivity4odbc10OStatement
-_setFetchSize__Q312connectivity4odbc15OStatement_Basel
-_setCursorName__Q312connectivity4odbc15OStatement_BaseRCQ23rtl8OUString
-_setMaxRows__Q312connectivity4odbc15OStatement_Basel
-_setMaxFieldSize__Q312connectivity4odbc15OStatement_Basel
-_setQueryTimeOut__Q312connectivity4odbc15OStatement_Basel
-_isUsingBookmarks__CQ312connectivity4odbc15OStatement_Base
-_getFetchSize__CQ312connectivity4odbc15OStatement_Base
-_getFetchDirection__CQ312connectivity4odbc15OStatement_Base
-_getResultSetType__CQ312connectivity4odbc15OStatement_Base
-_getResultSetConcurrency__CQ312connectivity4odbc15OStatement_Base
-_getCursorName__CQ312connectivity4odbc15OStatement_Base
-_getMaxRows__CQ312connectivity4odbc15OStatement_Base
-_getMaxFieldSize__CQ312connectivity4odbc15OStatement_Base
-_getQueryTimeOut__CQ312connectivity4odbc15OStatement_Base
-_getStmtOption__CQ312connectivity4odbc15OStatement_Bases
-_getRowCount__Q312connectivity4odbc15OStatement_Base
-_lockIfNecessary__Q312connectivity4odbc15OStatement_BaseRCQ23rtl8OUString
-_setWarning__Q312connectivity4odbc15OStatement_BaseRCQ53com3sun4star4sdbc10SQLWarning
-_disposeResultSet__Q312connectivity4odbc15OStatement_Base
-_getCharColAttrib__Q312connectivity4odbc18OResultSetMetaDatall
-_getNumColAttrib__Q312connectivity4odbc18OResultSetMetaDatall
-_getResultSetType__CQ312connectivity4odbc10OResultSet
-_getResultSetConcurrency__CQ312connectivity4odbc10OResultSet
-_getCursorName__CQ312connectivity4odbc10OResultSet
-_isBookmarkable__CQ312connectivity4odbc10OResultSet
-_setFetchSize__Q312connectivity4odbc10OResultSetl
-_setFetchDirection__Q312connectivity4odbc10OResultSetl
-_getFetchSize__CQ312connectivity4odbc10OResultSet
-_getFetchDirection__CQ312connectivity4odbc10OResultSet
-_fillRow__Q312connectivity4odbc10OResultSetl
-_releaseBuffer__Q312connectivity4odbc10OResultSet
-_allocBuffer__Q312connectivity4odbc10OResultSetUc
-_jdbcTypeToOdbc__Q312connectivity4odbc6OToolsl
-_getPropertySetInfo__Q312connectivity4odbc26ODatabaseMetaDataResultSet
-_release__Q312connectivity4odbc26ODatabaseMetaDataResultSet
-_acquire__Q312connectivity4odbc26ODatabaseMetaDataResultSet
-_openSpecialColumns__Q312connectivity4odbc26ODatabaseMetaDataResultSetUcRCQ53com3sun4star3uno3AnyRCQ23rtl8OUStringn1lUc
-_getResultSetType__CQ312connectivity4odbc26ODatabaseMetaDataResultSet
-_getResultSetConcurrency__CQ312connectivity4odbc26ODatabaseMetaDataResultSet
-_getCursorName__CQ312connectivity4odbc26ODatabaseMetaDataResultSet
-_getFetchSize__CQ312connectivity4odbc26ODatabaseMetaDataResultSet
-_getFetchDirection__CQ312connectivity4odbc26ODatabaseMetaDataResultSet
-_getSupportedServiceNames_Static__Q312connectivity4odbc10ODBCDriver
-_getImplementationName_Static__Q312connectivity4odbc10ODBCDriver
-_LoadFunctions__12connectivityP10_oslModuleUc
-_OpenConnection__Q312connectivity4odbc11OConnectionRCQ23rtl8OUStringlUc
-___tf13bad_exception
-___uncatch_exception
-___eh_free
-___tfv
-___dynamic_cast
diff --git a/connectivity/source/drivers/adabas/adabas.xcu b/connectivity/source/drivers/adabas/adabas.xcu
deleted file mode 100644
index fa7defad35..0000000000
--- a/connectivity/source/drivers/adabas/adabas.xcu
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="sdbc:adabas:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbcx.adabas.ODriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Adabas D</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="ShutdownDatabase" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- <node oor:name="DataCacheSizeIncrement" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:int">
- <value>20</value>
- </prop>
- </node>
- <node oor:name="DataCacheSize" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:int">
- <value>20</value>
- </prop>
- </node>
- <node oor:name="ControlUser" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="ControlPassword" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="CharSet" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="AddIndexAppendix" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="AppendTableAliasInSelect" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="DisplayVersionColumns" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseDOSLineEnds" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="BooleanComparisonMode" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FormsCheckRequiredFields" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/adabas/adabas.xml b/connectivity/source/drivers/adabas/adabas.xml
deleted file mode 100755
index a4736d0dfd..0000000000
--- a/connectivity/source/drivers/adabas/adabas.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<!DOCTYPE module-description PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
-<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
- <module-name>adabas</module-name>
- <component-description>
- <author>Ocke Janssen</author>
- <name>com.sun.star.comp.sdbcx.adabas.ODriver</name>
- <description>
- This is the implementation of the sdbc-adabas bridge.
- </description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service>com.sun.star.sdbc.Driver</supported-service>
- </component-description>
- <project-build-dependency>cppuhelper</project-build-dependency>
- <project-build-dependency>cppu</project-build-dependency>
- <project-build-dependency>sal</project-build-dependency>
- <runtime-module-dependency>cppuhelper</runtime-module-dependency>
- <runtime-module-dependency>cppu</runtime-module-dependency>
- <runtime-module-dependency>sal</runtime-module-dependency>
- <runtime-module-dependency>osl</runtime-module-dependency>
- <runtime-module-dependency>dbtools</runtime-module-dependency>
- <runtime-module-dependency>comphelper</runtime-module-dependency>
-</module-description>
diff --git a/connectivity/source/drivers/adabas/exports.dxp b/connectivity/source/drivers/adabas/exports.dxp
deleted file mode 100755
index 7003307892..0000000000
--- a/connectivity/source/drivers/adabas/exports.dxp
+++ /dev/null
@@ -1 +0,0 @@
-component_getFactory
diff --git a/connectivity/source/drivers/adabas/makefile.mk b/connectivity/source/drivers/adabas/makefile.mk
deleted file mode 100755
index bfc6a3dcfa..0000000000
--- a/connectivity/source/drivers/adabas/makefile.mk
+++ /dev/null
@@ -1,114 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=adabas
-
-ENABLE_EXCEPTIONS=TRUE
-VISIBILITY_HIDDEN=TRUE
-
-# --- Settings ----------------------------------
-.IF "$(DBGUTIL_OJ)"!=""
-ENVCFLAGS+=/FR$(SLO)$/
-.ENDIF
-
-.INCLUDE : $(PRJ)$/makefile.pmk
-.INCLUDE : $(PRJ)$/version.mk
-
-.IF "$(SYSTEM_ODBC_HEADERS)" == "YES"
-CFLAGS+=-DSYSTEM_ODBC_HEADERS
-.ENDIF
-
-# --- Files -------------------------------------
-
-SLOFILES=\
- $(SLO)$/BFunctions.obj \
- $(SLO)$/BConnection.obj \
- $(SLO)$/BDriver.obj \
- $(SLO)$/BCatalog.obj \
- $(SLO)$/BGroups.obj \
- $(SLO)$/BGroup.obj \
- $(SLO)$/BUser.obj \
- $(SLO)$/BUsers.obj \
- $(SLO)$/BKeys.obj \
- $(SLO)$/BColumns.obj \
- $(SLO)$/BIndex.obj \
- $(SLO)$/BIndexColumns.obj \
- $(SLO)$/BIndexes.obj \
- $(SLO)$/BTable.obj \
- $(SLO)$/BTables.obj \
- $(SLO)$/BViews.obj \
- $(SLO)$/Bservices.obj \
- $(SLO)$/BDatabaseMetaData.obj \
- $(SLO)$/BPreparedStatement.obj \
- $(SLO)$/BStatement.obj \
- $(SLO)$/BResultSetMetaData.obj \
- $(SLO)$/BResultSet.obj
-
-SHL1VERSIONMAP=$(SOLARENV)/src/component.map
-
-# --- Library -----------------------------------
-
-SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SALLIB) \
- $(SALHELPERLIB) \
- $(DBTOOLSLIB) \
- $(TOOLSLIB) \
- $(ODBCBASELIB) \
- $(UNOTOOLSLIB) \
- $(COMPHELPERLIB)
-
-.IF "$(ODBCBASELIB)" == ""
-SHL1STDLIBS+=$(ODBCBASELIB)
-.ENDIF
-
-SHL1DEPN=
-SHL1IMPLIB= i$(SHL1TARGET)
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
-
-# --- Targets ----------------------------------
-
-
-.INCLUDE : $(PRJ)$/target.pmk
-
-ALLTAR : $(MISC)/adabas.component
-
-$(MISC)/adabas.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- adabas.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt adabas.component
diff --git a/connectivity/source/drivers/ado/ACallableStatement.cxx b/connectivity/source/drivers/ado/ACallableStatement.cxx
deleted file mode 100644
index feb29ec8d9..0000000000
--- a/connectivity/source/drivers/ado/ACallableStatement.cxx
+++ /dev/null
@@ -1,237 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/ACallableStatement.hxx"
-#include <connectivity/dbexception.hxx>
-
-using namespace connectivity::ado;
-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::lang;
-
-IMPLEMENT_SERVICE_INFO(OCallableStatement,"com.sun.star.sdbcx.ACallableStatement","com.sun.star.sdbc.CallableStatement");
-
-#define GET_PARAM() \
- ADOParameter* pParam = NULL; \
- m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam); \
- if(pParam) \
- pParam->get_Value(&m_aValue);
-//**************************************************************
-//************ Class: java.sql.CallableStatement
-//**************************************************************
-OCallableStatement::OCallableStatement( OConnection* _pConnection,const OTypeInfoMap& _TypeInfo,const ::rtl::OUString& sql )
- : OPreparedStatement( _pConnection, _TypeInfo, sql )
-{
- m_Command.put_CommandType(adCmdStoredProc);
-}
-// -------------------------------------------------------------------------
-
-Any SAL_CALL OCallableStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OPreparedStatement::queryInterface(rType);
- return aRet.hasValue() ? aRet : ::cppu::queryInterface(rType,static_cast< XRow*>(this));
-}
-// -------------------------------------------------------------------------
-
-
-sal_Bool SAL_CALL OCallableStatement::wasNull( ) throw(SQLException, RuntimeException)
-{
- return m_aValue.isNull();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- GET_PARAM()
- return m_aValue;
-}
-// -------------------------------------------------------------------------
-sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- GET_PARAM()
- return m_aValue;
-}
-// -------------------------------------------------------------------------
-Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- GET_PARAM()
- return m_aValue;
-}
-// -------------------------------------------------------------------------
-::com::sun::star::util::Date SAL_CALL OCallableStatement::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- GET_PARAM()
- return m_aValue;
-}
-// -------------------------------------------------------------------------
-double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- GET_PARAM()
- return m_aValue;
-}
-// -------------------------------------------------------------------------
-
-float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- GET_PARAM()
- return m_aValue;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- GET_PARAM()
- return m_aValue;
-}
-// -------------------------------------------------------------------------
-
-sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- GET_PARAM()
- return (sal_Int64)m_aValue.getCurrency().int64;
-}
-// -------------------------------------------------------------------------
-
-Any SAL_CALL OCallableStatement::getObject( sal_Int32 /*columnIndex*/, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getObject", *this );
- return Any();
-}
-// -------------------------------------------------------------------------
-
-sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- GET_PARAM()
- return m_aValue;
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- GET_PARAM()
- return m_aValue;
-}
-// -------------------------------------------------------------------------
-
- ::com::sun::star::util::Time SAL_CALL OCallableStatement::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- GET_PARAM()
- return m_aValue;
-}
-// -------------------------------------------------------------------------
-
- ::com::sun::star::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- GET_PARAM()
- return m_aValue;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& /*typeName*/ ) throw(SQLException, RuntimeException)
-{
- ADOParameter* pParam = NULL;
- m_pParameters->get_Item(OLEVariant(sal_Int32(parameterIndex-1)),&pParam);
- if(pParam)
- {
- pParam->put_Type(ADOS::MapJdbc2ADOType(sqlType,m_pConnection->getEngineType()));
- pParam->put_Direction(adParamOutput);
- }
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException)
-{
- ADOParameter* pParam = NULL;
- m_pParameters->get_Item(OLEVariant(sal_Int32(parameterIndex-1)),&pParam);
- if(pParam)
- {
- pParam->put_Type(ADOS::MapJdbc2ADOType(sqlType,m_pConnection->getEngineType()));
- pParam->put_Direction(adParamOutput);
- pParam->put_NumericScale((sal_Int8)scale);
- }
-}
-// -------------------------------------------------------------------------
-
-
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::getBinaryStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getBinaryStream", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getCharacterStream", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Reference< XArray > SAL_CALL OCallableStatement::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getArray", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Reference< XClob > SAL_CALL OCallableStatement::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getClob", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL OCallableStatement::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getBlob", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Reference< XRef > SAL_CALL OCallableStatement::getRef( sal_Int32 /*columnIndex*/) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getRef", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-void SAL_CALL OCallableStatement::acquire() throw()
-{
- OPreparedStatement::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OCallableStatement::release() throw()
-{
- OPreparedStatement::release();
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/ACatalog.cxx b/connectivity/source/drivers/ado/ACatalog.cxx
deleted file mode 100644
index 0f3e70c0f1..0000000000
--- a/connectivity/source/drivers/ado/ACatalog.cxx
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/ACatalog.hxx"
-#include "ado/AConnection.hxx"
-#include "ado/AGroups.hxx"
-#include "ado/AUsers.hxx"
-#include "ado/ATables.hxx"
-#include "ado/AViews.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-
-
-// -------------------------------------------------------------------------
-using namespace connectivity;
-using namespace connectivity::ado;
-// -------------------------------------------------------------------------
-OCatalog::OCatalog(_ADOCatalog* _pCatalog,OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon)
- ,m_pConnection(_pCon)
- ,m_aCatalog(_pCatalog)
-{
-}
-// -----------------------------------------------------------------------------
-OCatalog::~OCatalog()
-{
- if(m_aCatalog.IsValid())
- m_aCatalog.putref_ActiveConnection(NULL);
- m_aCatalog.clear();
-}
-// -----------------------------------------------------------------------------
-void OCatalog::refreshTables()
-{
- TStringVector aVector;
-
- WpADOTables aTables(m_aCatalog.get_Tables());
- if ( aTables.IsValid() )
- {
- aTables.Refresh();
- sal_Int32 nCount = aTables.GetItemCount();
- aVector.reserve(nCount);
- for(sal_Int32 i=0;i< nCount;++i)
- {
- WpADOTable aElement = aTables.GetItem(i);
- if ( aElement.IsValid() )
- {
- ::rtl::OUString sTypeName = aElement.get_Type();
- if ( !sTypeName.equalsIgnoreAsciiCaseAscii("SYSTEM TABLE") && !sTypeName.equalsIgnoreAsciiCaseAscii("ACCESS TABLE") )
- aVector.push_back(aElement.get_Name());
- }
- }
- }
-
- if(m_pTables)
- m_pTables->reFill(aVector);
- else
- m_pTables = new OTables(this,m_aMutex,aVector,aTables,m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers());
-}
-// -------------------------------------------------------------------------
-void OCatalog::refreshViews()
-{
- TStringVector aVector;
-
- WpADOViews aViews = m_aCatalog.get_Views();
- aViews.fillElementNames(aVector);
-
- if(m_pViews)
- m_pViews->reFill(aVector);
- else
- m_pViews = new OViews(this,m_aMutex,aVector,aViews,m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers());
-}
-// -------------------------------------------------------------------------
-void OCatalog::refreshGroups()
-{
- TStringVector aVector;
-
- WpADOGroups aGroups = m_aCatalog.get_Groups();
- aGroups.fillElementNames(aVector);
-
- if(m_pGroups)
- m_pGroups->reFill(aVector);
- else
- m_pGroups = new OGroups(this,m_aMutex,aVector,aGroups,m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers());
-}
-// -------------------------------------------------------------------------
-void OCatalog::refreshUsers()
-{
- TStringVector aVector;
-
- WpADOUsers aUsers = m_aCatalog.get_Users();
- aUsers.fillElementNames(aVector);
-
- if(m_pUsers)
- m_pUsers->reFill(aVector);
- else
- m_pUsers = new OUsers(this,m_aMutex,aVector,aUsers,m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers());
-}
-// -------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx
deleted file mode 100644
index 2a6ae71bed..0000000000
--- a/connectivity/source/drivers/ado/AColumn.cxx
+++ /dev/null
@@ -1,307 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/AColumn.hxx"
-#include "ado/AConnection.hxx"
-#include "ado/Awrapado.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <comphelper/extract.hxx>
-#include <comphelper/types.hxx>
-#include "ado/ACatalog.hxx"
-
-#include <o3tl/compat_functional.hxx>
-
-using namespace ::comphelper;
-
-using namespace connectivity::ado;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-
-void WpADOColumn::Create()
-{
- HRESULT hr = -1;
-
- _ADOColumn* pColumn = NULL;
- hr = CoCreateInstance(ADOS::CLSID_ADOCOLUMN_25,
- NULL,
- CLSCTX_INPROC_SERVER,
- ADOS::IID_ADOCOLUMN_25,
- (void**)&pColumn );
-
-
- if( !FAILED( hr ) )
- {
- operator=( pColumn );
- pColumn->Release( );
- }
-}
-// -------------------------------------------------------------------------
-OAdoColumn::OAdoColumn(sal_Bool _bCase,OConnection* _pConnection,_ADOColumn* _pColumn)
- : connectivity::sdbcx::OColumn(::rtl::OUString(),::rtl::OUString(),::rtl::OUString(),::rtl::OUString(),0,0,0,0,sal_False,sal_False,sal_False,_bCase)
- ,m_pConnection(_pConnection)
-{
- construct();
- OSL_ENSURE(_pColumn,"Column can not be null!");
- m_aColumn = WpADOColumn(_pColumn);
- // m_aColumn.put_ParentCatalog(_pConnection->getAdoCatalog()->getCatalog());
- fillPropertyValues();
-}
-// -------------------------------------------------------------------------
-OAdoColumn::OAdoColumn(sal_Bool _bCase,OConnection* _pConnection)
- : connectivity::sdbcx::OColumn(_bCase)
- ,m_pConnection(_pConnection)
-{
- m_aColumn.Create();
- m_aColumn.put_ParentCatalog(_pConnection->getAdoCatalog()->getCatalog());
- construct();
- fillPropertyValues();
- m_Type = DataType::OTHER;
-}
-
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OAdoColumn::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OAdoColumn::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : OColumn_ADO::getSomething(rId);
-}
-// -------------------------------------------------------------------------
-void OAdoColumn::construct()
-{
- sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
-
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISASCENDING), PROPERTY_ID_ISASCENDING, nAttrib,&m_IsAscending, ::getBooleanCppuType());
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RELATEDCOLUMN), PROPERTY_ID_RELATEDCOLUMN, nAttrib,&m_ReferencedColumn, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
-}
-// -----------------------------------------------------------------------------
-void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception)
-{
- if(m_aColumn.IsValid())
- {
- const sal_Char* pAdoPropertyName = NULL;
-
- switch(nHandle)
- {
- case PROPERTY_ID_ISASCENDING:
- m_aColumn.put_SortOrder(::cppu::any2bool(rValue) ? adSortAscending : adSortDescending);
- break;
- case PROPERTY_ID_RELATEDCOLUMN:
- {
- ::rtl::OUString aVal;
- rValue >>= aVal;
- m_aColumn.put_RelatedColumn(aVal);
- }
- break;
- case PROPERTY_ID_NAME:
- {
- ::rtl::OUString aVal;
- rValue >>= aVal;
- m_aColumn.put_Name(aVal);
- }
- break;
- case PROPERTY_ID_TYPE:
- {
- sal_Int32 nVal=0;
- rValue >>= nVal;
- m_aColumn.put_Type(ADOS::MapJdbc2ADOType(nVal,m_pConnection->getEngineType()));
- }
- break;
- case PROPERTY_ID_TYPENAME:
- // rValue <<= m_pTable->getCatalog()->getConnection()->getTypeInfo()->find();
- break;
- case PROPERTY_ID_PRECISION:
- {
- sal_Int32 nVal=0;
- rValue >>= nVal;
- m_aColumn.put_Precision(nVal);
- }
- break;
- case PROPERTY_ID_SCALE:
- {
- sal_Int32 nVal=0;
- rValue >>= nVal;
- if ( !m_IsCurrency )
- m_aColumn.put_NumericScale((sal_Int8)nVal);
- }
- break;
- case PROPERTY_ID_ISNULLABLE:
- {
- sal_Int32 nVal=0;
- rValue >>= nVal;
- if ( nVal == ColumnValue::NULLABLE )
- m_aColumn.put_Attributes( adColNullable );
- }
- break;
- case PROPERTY_ID_ISROWVERSION:
- break;
-
- case PROPERTY_ID_ISAUTOINCREMENT:
- OTools::putValue( m_aColumn.get_Properties(), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Autoincrement" )), getBOOL( rValue ) );
- break;
-
- case PROPERTY_ID_IM001:
- case PROPERTY_ID_DESCRIPTION:
- pAdoPropertyName = "Description";
- break;
-
- case PROPERTY_ID_DEFAULTVALUE:
- pAdoPropertyName = "Default";
- break;
- }
-
- if ( pAdoPropertyName )
- OTools::putValue( m_aColumn.get_Properties(), ::rtl::OUString::createFromAscii( pAdoPropertyName ), getString( rValue ) );
- }
- OColumn_ADO::setFastPropertyValue_NoBroadcast(nHandle,rValue);
-}
-// -----------------------------------------------------------------------------
-void OAdoColumn::fillPropertyValues()
-{
- if(m_aColumn.IsValid())
- {
- m_IsAscending = m_aColumn.get_SortOrder() == adSortAscending;
- m_ReferencedColumn = m_aColumn.get_RelatedColumn();
- m_Name = m_aColumn.get_Name();
- m_Precision = m_aColumn.get_Precision();
- m_Scale = m_aColumn.get_NumericScale();
- m_IsNullable = ((m_aColumn.get_Attributes() & adColNullable) == adColNullable) ? ColumnValue::NULLABLE : ColumnValue::NO_NULLS;
-
- DataTypeEnum eType = m_aColumn.get_Type();
- m_IsCurrency = (eType == adCurrency);
- if ( m_IsCurrency && !m_Scale)
- m_Scale = 4;
- m_Type = ADOS::MapADOType2Jdbc(eType);
-
- sal_Bool bForceTo = sal_True;
- const OTypeInfoMap* pTypeInfoMap = m_pConnection->getTypeInfo();
- const OExtendedTypeInfo* pTypeInfo = OConnection::getTypeInfoFromType(*m_pConnection->getTypeInfo(),eType,::rtl::OUString(),m_Precision,m_Scale,bForceTo);
- if ( pTypeInfo )
- m_TypeName = pTypeInfo->aSimpleType.aTypeName;
- else if ( eType == adVarBinary && ADOS::isJetEngine(m_pConnection->getEngineType()) )
- {
- ::comphelper::TStringMixEqualFunctor aCase(sal_False);
- OTypeInfoMap::const_iterator aFind = ::std::find_if(pTypeInfoMap->begin(),
- pTypeInfoMap->end(),
- ::o3tl::compose1(
- ::std::bind2nd(aCase, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VarBinary"))),
- ::o3tl::compose1(
- ::std::mem_fun(&OExtendedTypeInfo::getDBName),
- ::o3tl::select2nd<OTypeInfoMap::value_type>())
- )
-
- );
-
- if ( aFind != pTypeInfoMap->end() ) // change column type if necessary
- {
- eType = aFind->first;
- pTypeInfo = aFind->second;
- }
-
- if ( !pTypeInfo )
- {
- pTypeInfo = OConnection::getTypeInfoFromType(*m_pConnection->getTypeInfo(),adBinary,::rtl::OUString(),m_Precision,m_Scale,bForceTo);
- eType = adBinary;
- }
-
- if ( pTypeInfo )
- {
- m_TypeName = pTypeInfo->aSimpleType.aTypeName;
- m_Type = ADOS::MapADOType2Jdbc(eType);
- }
- }
-
-
- // fill some specific props
- {
- WpADOProperties aProps( m_aColumn.get_Properties() );
-
- if ( aProps.IsValid() )
- {
- m_IsAutoIncrement = OTools::getValue( aProps, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Autoincrement")) );
-
- m_Description = OTools::getValue( aProps, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Description")) );
-
- m_DefaultValue = OTools::getValue( aProps, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Default")) );
-
-#if OSL_DEBUG_LEVEL > 0
- sal_Int32 nCount = aProps.GetItemCount();
- for (sal_Int32 i = 0; i<nCount; ++i)
- {
- WpADOProperty aProp = aProps.GetItem(i);
- ::rtl::OUString sName = aProp.GetName();
- ::rtl::OUString sVal = aProp.GetValue();
- }
-#endif
- }
- }
- }
-}
-// -----------------------------------------------------------------------------
-WpADOColumn OAdoColumn::getColumnImpl() const
-{
- return m_aColumn;
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-void SAL_CALL OAdoColumn::acquire() throw()
-{
- OColumn_ADO::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OAdoColumn::release() throw()
-{
- OColumn_ADO::release();
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AColumns.cxx b/connectivity/source/drivers/ado/AColumns.cxx
deleted file mode 100644
index c3187fd196..0000000000
--- a/connectivity/source/drivers/ado/AColumns.cxx
+++ /dev/null
@@ -1,150 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/AColumns.hxx"
-#include "ado/AColumn.hxx"
-#include "ado/AConnection.hxx"
-#include "ado/Awrapado.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <comphelper/property.hxx>
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-#include <algorithm>
-#include "resource/ado_res.hrc"
-
-#include <o3tl/compat_functional.hxx>
-
-using namespace connectivity::ado;
-using namespace connectivity;
-using namespace comphelper;
-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;
-
-sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName)
-{
- return new OAdoColumn(isCaseSensitive(),m_pConnection,m_aCollection.GetItem(_rName));
-}
-
-// -------------------------------------------------------------------------
-void OColumns::impl_refresh() throw(RuntimeException)
-{
- m_aCollection.Refresh();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OColumns::createDescriptor()
-{
- return new OAdoColumn(isCaseSensitive(),m_pConnection);
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OColumns::appendObject( const ::rtl::OUString&, const Reference< XPropertySet >& descriptor )
-{
- OAdoColumn* pColumn = NULL;
- Reference< XPropertySet > xColumn;
- if ( !getImplementation( pColumn, descriptor ) || pColumn == NULL )
- {
- // m_pConnection->throwGenericSQLException( STR_INVALID_COLUMN_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
- pColumn = new OAdoColumn(isCaseSensitive(),m_pConnection);
- xColumn = pColumn;
- ::comphelper::copyProperties(descriptor,xColumn);
- }
-
- WpADOColumn aColumn = pColumn->getColumnImpl();
-
-#if OSL_DEBUG_LEVEL > 0
- sal_Int32 nPrecision;
- sal_Int32 nScale;
- sal_Int32 nType;
- nPrecision = aColumn.get_Precision();
- nScale = aColumn.get_NumericScale();
- nType = ADOS::MapADOType2Jdbc(aColumn.get_Type());
-#endif
-
- ::rtl::OUString sTypeName;
- pColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)) >>= sTypeName;
-
- const OTypeInfoMap* pTypeInfoMap = m_pConnection->getTypeInfo();
- ::comphelper::TStringMixEqualFunctor aCase(sal_False);
- // search for typeinfo where the typename is equal sTypeName
- OTypeInfoMap::const_iterator aFind = ::std::find_if(pTypeInfoMap->begin(),
- pTypeInfoMap->end(),
- ::o3tl::compose1(
- ::std::bind2nd(aCase, sTypeName),
- ::o3tl::compose1(
- ::std::mem_fun(&OExtendedTypeInfo::getDBName),
- ::o3tl::select2nd<OTypeInfoMap::value_type>())
- )
-
- );
-
- if ( aFind != pTypeInfoMap->end() ) // change column type if necessary
- aColumn.put_Type(aFind->first);
-
- if ( SUCCEEDED(((ADOColumns*)m_aCollection)->Append(OLEVariant(aColumn.get_Name()),aColumn.get_Type(),aColumn.get_DefinedSize())) )
- {
- WpADOColumn aAddedColumn = m_aCollection.GetItem(OLEVariant(aColumn.get_Name()));
- if ( aAddedColumn.IsValid() )
- {
- sal_Bool bAutoIncrement = sal_False;
- pColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)) >>= bAutoIncrement;
- if ( bAutoIncrement )
- OTools::putValue( aAddedColumn.get_Properties(), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Autoincrement")), bAutoIncrement );
-
- if ( aFind != pTypeInfoMap->end() && aColumn.get_Type() != aAddedColumn.get_Type() ) // change column type if necessary
- aColumn.put_Type(aFind->first);
- aAddedColumn.put_Precision(aColumn.get_Precision());
- aAddedColumn.put_NumericScale(aColumn.get_NumericScale());
- aAddedColumn.put_Attributes(aColumn.get_Attributes());
- aAddedColumn.put_SortOrder(aColumn.get_SortOrder());
- aAddedColumn.put_RelatedColumn(aColumn.get_RelatedColumn());
- }
- }
- ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
-
- return new OAdoColumn(isCaseSensitive(),m_pConnection,pColumn->getColumnImpl());
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OColumns::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName)
-{
- if(!m_aCollection.Delete(_sElementName))
- ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx
deleted file mode 100644
index 82d28617bd..0000000000
--- a/connectivity/source/drivers/ado/AConnection.cxx
+++ /dev/null
@@ -1,633 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/AConnection.hxx"
-#include "ado/ADatabaseMetaData.hxx"
-#include "ado/ADriver.hxx"
-#include "ado/AStatement.hxx"
-#include "ado/ACallableStatement.hxx"
-#include "ado/APreparedStatement.hxx"
-#include "ado/ACatalog.hxx"
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/TransactionIsolation.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include "connectivity/dbexception.hxx"
-#include <osl/file.hxx>
-#include "resource/ado_res.hrc"
-
-#include <o3tl/compat_functional.hxx>
-
-using namespace dbtools;
-using namespace connectivity::ado;
-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;
-
-//------------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OConnection,"com.sun.star.sdbcx.AConnection","com.sun.star.sdbc.Connection");
-// --------------------------------------------------------------------------------
-OConnection::OConnection(ODriver* _pDriver) throw(SQLException, RuntimeException)
- : OSubComponent<OConnection, OConnection_BASE>((::cppu::OWeakObject*)_pDriver, this),
- m_bClosed(sal_False),
- m_xCatalog(NULL),
- m_pDriver(_pDriver),
- m_pAdoConnection(NULL),
- m_bAutocommit(sal_True),
- m_nEngineType(0),
- m_pCatalog(NULL)
-{
- osl_incrementInterlockedCount( &m_refCount );
-
- IClassFactory2* pIUnknown = NULL;
- IUnknown *pOuter = NULL;
- HRESULT hr;
- hr = CoGetClassObject( ADOS::CLSID_ADOCONNECTION_21,
- CLSCTX_INPROC_SERVER,
- NULL,
- IID_IClassFactory2,
- (void**)&pIUnknown );
-
- if( !FAILED( hr ) )
- {
- ADOConnection *pCon = NULL;
- hr = pIUnknown->CreateInstanceLic( pOuter,
- NULL,
- ADOS::IID_ADOCONNECTION_21,
- ADOS::GetKeyStr(),
- (void**) &pCon);
-
- if( !FAILED( hr ) )
- {
- OSL_ENSURE( pCon, "OConnection::OConnection: invalid ADO object!" );
-
- m_pAdoConnection = new WpADOConnection( pCon );
- // CreateInstanceLic returned an object which was already acquired
- pCon->Release( );
-
- }
-
- // Class Factory is no longer needed
- pIUnknown->Release();
- }
-
- osl_decrementInterlockedCount( &m_refCount );
-}
-//-----------------------------------------------------------------------------
-OConnection::~OConnection()
-{
-}
-//-----------------------------------------------------------------------------
-void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info)
-{
- osl_incrementInterlockedCount( &m_refCount );
-
- setConnectionInfo(info);
-
- sal_Int32 nLen = url.indexOf(':');
- nLen = url.indexOf(':',nLen+1);
- ::rtl::OUString aDSN(url.copy(nLen+1)),aUID,aPWD;
- if ( aDSN.compareToAscii("access:",7) == 0 )
- aDSN = aDSN.copy(7);
-
- sal_Int32 nTimeout = 20;
- sal_Bool bSilent = sal_True;
- const PropertyValue *pIter = info.getConstArray();
- const PropertyValue *pEnd = pIter + info.getLength();
- for(;pIter != pEnd;++pIter)
- {
- if(!pIter->Name.compareToAscii("Timeout"))
- pIter->Value >>= nTimeout;
- else if(!pIter->Name.compareToAscii("Silent"))
- pIter->Value >>= bSilent;
- else if(!pIter->Name.compareToAscii("user"))
- pIter->Value >>= aUID;
- else if(!pIter->Name.compareToAscii("password"))
- pIter->Value >>= aPWD;
- }
- try
- {
- if(m_pAdoConnection)
- {
- if(m_pAdoConnection->Open(aDSN,aUID,aPWD,adConnectUnspecified))
- m_pAdoConnection->PutCommandTimeout(nTimeout);
- else
- ADOS::ThrowException(*m_pAdoConnection,*this);
- if(m_pAdoConnection->get_State() != adStateOpen)
- throwGenericSQLException( STR_NO_CONNECTION,*this );
-
- WpADOProperties aProps = m_pAdoConnection->get_Properties();
- if(aProps.IsValid())
- {
- OTools::putValue(aProps,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Jet OLEDB:ODBC Parsing")),sal_True);
- OLEVariant aVar(OTools::getValue(aProps,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Jet OLEDB:Engine Type"))));
- if(!aVar.isNull() && !aVar.isEmpty())
- m_nEngineType = aVar;
- }
- buildTypeInfo();
- //bErg = TRUE;
- }
- else
- ::dbtools::throwFunctionSequenceException(*this);
-
- }
- catch(const Exception& )
- {
- osl_decrementInterlockedCount( &m_refCount );
- throw;
- }
- osl_decrementInterlockedCount( &m_refCount );
-}
-//-----------------------------------------------------------------------------
-void SAL_CALL OConnection::release() throw()
-{
- relase_ChildImpl();
-}
-// --------------------------------------------------------------------------------
-Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- OStatement* pStmt = new OStatement(this);
- Reference< XStatement > xStmt = pStmt;
- m_aStatements.push_back(WeakReferenceHelper(*pStmt));
- return pStmt;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- OPreparedStatement* pStmt = new OPreparedStatement(this,m_aTypeInfo,sql);
- Reference< XPreparedStatement > xPStmt = pStmt;
- m_aStatements.push_back(WeakReferenceHelper(*pStmt));
- return xPStmt;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- OCallableStatement* pStmt = new OCallableStatement(this,m_aTypeInfo,sql);
- Reference< XPreparedStatement > xPStmt = pStmt;
- m_aStatements.push_back(WeakReferenceHelper(*pStmt));
- return xPStmt;
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConnection::nativeSQL( const ::rtl::OUString& _sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- ::rtl::OUString sql = _sql;
- WpADOProperties aProps = m_pAdoConnection->get_Properties();
- if(aProps.IsValid())
- {
- OTools::putValue(aProps,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Jet OLEDB:ODBC Parsing")),sal_True);
- WpADOCommand aCommand;
- aCommand.Create();
- aCommand.put_ActiveConnection((IDispatch*)*m_pAdoConnection);
- aCommand.put_CommandText(sql);
- sql = aCommand.get_CommandText();
- }
-
- return sql;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- m_bAutocommit = autoCommit;
- if(!autoCommit)
- m_pAdoConnection->BeginTrans();
- else
- m_pAdoConnection->RollbackTrans();
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- return m_bAutocommit;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- m_pAdoConnection->CommitTrans();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- m_pAdoConnection->RollbackTrans();
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- return OConnection_BASE::rBHelper.bDisposed && !m_pAdoConnection->get_State();
-}
-// --------------------------------------------------------------------------------
-Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
- if(!xMetaData.is())
- {
- xMetaData = new ODatabaseMetaData(this);
- m_xMetaData = xMetaData;
- }
-
- return xMetaData;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
-
- m_pAdoConnection->put_Mode(readOnly ? adModeRead : adModeReadWrite);
- ADOS::ThrowException(*m_pAdoConnection,*this);
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- return m_pAdoConnection->get_Mode() == adModeRead;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- m_pAdoConnection->PutDefaultDatabase(catalog);
- ADOS::ThrowException(*m_pAdoConnection,*this);
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConnection::getCatalog( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- return m_pAdoConnection->GetDefaultDatabase();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- IsolationLevelEnum eIso;
- switch(level)
- {
- case TransactionIsolation::NONE:
- eIso = adXactUnspecified;
- break;
- case TransactionIsolation::READ_UNCOMMITTED:
- eIso = adXactReadUncommitted;
- break;
- case TransactionIsolation::READ_COMMITTED:
- eIso = adXactReadCommitted;
- break;
- case TransactionIsolation::REPEATABLE_READ:
- eIso = adXactRepeatableRead;
- break;
- case TransactionIsolation::SERIALIZABLE:
- eIso = adXactSerializable;
- break;
- default:
- OSL_FAIL("OConnection::setTransactionIsolation invalid level");
- return;
- }
- m_pAdoConnection->put_IsolationLevel(eIso);
- ADOS::ThrowException(*m_pAdoConnection,*this);
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- sal_Int32 nRet = 0;
- switch(m_pAdoConnection->get_IsolationLevel())
- {
- case adXactUnspecified:
- nRet = TransactionIsolation::NONE;
- break;
- case adXactReadUncommitted:
- nRet = TransactionIsolation::READ_UNCOMMITTED;
- break;
- case adXactReadCommitted:
- nRet = TransactionIsolation::READ_COMMITTED;
- break;
- case adXactRepeatableRead:
- nRet = TransactionIsolation::REPEATABLE_READ;
- break;
- case adXactSerializable:
- nRet = TransactionIsolation::SERIALIZABLE;
- break;
- default:
- OSL_FAIL("OConnection::setTransactionIsolation invalid level");
- }
- ADOS::ThrowException(*m_pAdoConnection,*this);
- return nRet;
-}
-// --------------------------------------------------------------------------------
-Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getTypeMap( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- return NULL;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setTypeMap", *this );
-}
-// --------------------------------------------------------------------------------
-// XCloseable
-void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- }
- dispose();
-}
-// --------------------------------------------------------------------------------
-// XWarningsSupplier
-Any SAL_CALL OConnection::getWarnings( ) throw(SQLException, RuntimeException)
-{
- return Any();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeException)
-{
-}
-//--------------------------------------------------------------------
-void OConnection::buildTypeInfo() throw( SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ADORecordset *pRecordset = m_pAdoConnection->getTypeInfo();
- if ( pRecordset )
- {
- pRecordset->AddRef();
- VARIANT_BOOL bIsAtBOF;
- pRecordset->get_BOF(&bIsAtBOF);
-
- sal_Bool bOk = sal_True;
- if ( bIsAtBOF == VARIANT_TRUE )
- bOk = SUCCEEDED(pRecordset->MoveNext());
-
- if ( bOk )
- {
- // HACK for access
- static const ::rtl::OUString s_sVarChar(RTL_CONSTASCII_USTRINGPARAM("VarChar"));
- do
- {
- sal_Int32 nPos = 1;
- OExtendedTypeInfo* aInfo = new OExtendedTypeInfo();
- aInfo->aSimpleType.aTypeName = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->eType = (DataTypeEnum)(sal_Int32)ADOS::getField(pRecordset,nPos++).get_Value();
- if ( aInfo->eType == adWChar && aInfo->aSimpleType.aTypeName == s_sVarChar )
- aInfo->eType = adVarWChar;
- aInfo->aSimpleType.nType = (sal_Int16)ADOS::MapADOType2Jdbc(static_cast<DataTypeEnum>(aInfo->eType));
- aInfo->aSimpleType.nPrecision = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.aLiteralPrefix = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.aLiteralSuffix = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.aCreateParams = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.bNullable = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.bCaseSensitive = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.nSearchType = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.bUnsigned = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.bCurrency = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.bAutoIncrement = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.aLocalTypeName = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.nMinimumScale = ADOS::getField(pRecordset,nPos++).get_Value();
- aInfo->aSimpleType.nMaximumScale = ADOS::getField(pRecordset,nPos++).get_Value();
- if ( adCurrency == aInfo->eType && !aInfo->aSimpleType.nMaximumScale)
- {
- aInfo->aSimpleType.nMinimumScale = 4;
- aInfo->aSimpleType.nMaximumScale = 4;
- }
- aInfo->aSimpleType.nNumPrecRadix = ADOS::getField(pRecordset,nPos++).get_Value();
- // Now that we have the type info, save it
- // in the Hashtable if we don't already have an
- // entry for this SQL type.
-
- m_aTypeInfo.insert(OTypeInfoMap::value_type(aInfo->eType,aInfo));
- }
- while ( SUCCEEDED(pRecordset->MoveNext()) );
- }
- pRecordset->Release();
- }
-}
-//------------------------------------------------------------------------------
-void OConnection::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- OConnection_BASE::disposing();
-
- m_bClosed = sal_True;
- m_xMetaData = ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData>();
- m_xCatalog = ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbcx::XTablesSupplier>();
- m_pDriver = NULL;
-
- m_pAdoConnection->Close();
-
- OTypeInfoMap::iterator aIter = m_aTypeInfo.begin();
- for (; aIter != m_aTypeInfo.end(); ++aIter)
- delete aIter->second;
-
- m_aTypeInfo.clear();
-
- delete m_pAdoConnection;
- m_pAdoConnection = NULL;
-
- dispose_ChildImpl();
-}
-// -----------------------------------------------------------------------------
-sal_Int64 SAL_CALL OConnection::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw (::com::sun::star::uno::RuntimeException)
-{
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ?
- reinterpret_cast< sal_Int64 >( this )
- :
- OConnection_BASE::getSomething(rId);
-}
-// -----------------------------------------------------------------------------
-Sequence< sal_Int8 > OConnection::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-// -----------------------------------------------------------------------------
-const OExtendedTypeInfo* OConnection::getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo,
- DataTypeEnum _nType,
- const ::rtl::OUString& _sTypeName,
- sal_Int32 _nPrecision,
- sal_Int32 _nScale,
- sal_Bool& _brForceToType)
-{
- const OExtendedTypeInfo* pTypeInfo = NULL;
- _brForceToType = sal_False;
- // search for type
- ::std::pair<OTypeInfoMap::const_iterator, OTypeInfoMap::const_iterator> aPair = _rTypeInfo.equal_range(_nType);
- OTypeInfoMap::const_iterator aIter = aPair.first;
- if(aIter != _rTypeInfo.end()) // compare with end is correct here
- {
- for(;aIter != aPair.second;++aIter)
- {
- // search the best matching type
- OExtendedTypeInfo* pInfo = aIter->second;
- #ifdef DBG_UTIL
- ::rtl::OUString sDBTypeName = pInfo->aSimpleType.aTypeName;
- sal_Int32 nDBTypePrecision = pInfo->aSimpleType.nPrecision; (void)nDBTypePrecision;
- sal_Int32 nDBTypeScale = pInfo->aSimpleType.nMaximumScale; (void)nDBTypeScale;
- sal_Int32 nAdoType = pInfo->eType; (void)nAdoType;
- #endif
- if ( ( !_sTypeName.getLength()
- || (pInfo->aSimpleType.aTypeName.equalsIgnoreAsciiCase(_sTypeName))
- )
- && (pInfo->aSimpleType.nPrecision >= _nPrecision)
- && (pInfo->aSimpleType.nMaximumScale >= _nScale)
-
- )
- break;
- }
-
- if (aIter == aPair.second)
- {
- for(aIter = aPair.first; aIter != aPair.second; ++aIter)
- {
- // search the best matching type (now comparing the local names)
- if ( (aIter->second->aSimpleType.aLocalTypeName.equalsIgnoreAsciiCase(_sTypeName))
- && (aIter->second->aSimpleType.nPrecision >= _nPrecision)
- && (aIter->second->aSimpleType.nMaximumScale >= _nScale)
- )
- {
-// we can not assert here because we could be in d&d
-/*
- OSL_FAIL(( ::rtl::OString("getTypeInfoFromType: assuming column type ")
- += ::rtl::OString(aIter->second->aTypeName.getStr(), aIter->second->aTypeName.getLength(), gsl_getSystemTextEncoding())
- += ::rtl::OString("\" (expected type name ")
- += ::rtl::OString(_sTypeName.getStr(), _sTypeName.getLength(), gsl_getSystemTextEncoding())
- += ::rtl::OString(" matches the type's local name).")).getStr());
-*/
- break;
- }
- }
- }
-
- if (aIter == aPair.second)
- { // no match for the names, no match for the local names
- // -> drop the precision and the scale restriction, accept any type with the property
- // type id (nType)
-
- // we can not assert here because we could be in d&d
- pTypeInfo = aPair.first->second;
- _brForceToType = sal_True;
- }
- else
- pTypeInfo = aIter->second;
- }
- else if ( _sTypeName.getLength() )
- {
- ::comphelper::TStringMixEqualFunctor aCase(sal_False);
- // search for typeinfo where the typename is equal _sTypeName
- OTypeInfoMap::const_iterator aFind = ::std::find_if(_rTypeInfo.begin(),
- _rTypeInfo.end(),
- ::o3tl::compose1(
- ::std::bind2nd(aCase, _sTypeName),
- ::o3tl::compose1(
- ::std::mem_fun(&OExtendedTypeInfo::getDBName),
- ::o3tl::select2nd<OTypeInfoMap::value_type>())
- )
- );
- if(aFind != _rTypeInfo.end())
- pTypeInfo = aFind->second;
- }
-
-// we can not assert here because we could be in d&d
-// OSL_ENSURE(pTypeInfo, "getTypeInfoFromType: no type info found for this type!");
- return pTypeInfo;
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
deleted file mode 100644
index c714660c97..0000000000
--- a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
+++ /dev/null
@@ -1,1086 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/ADatabaseMetaData.hxx"
-#include "ado/ADatabaseMetaDataResultSet.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/TransactionIsolation.hpp>
-#include "ado/AConnection.hxx"
-#include "ado/adoimp.hxx"
-#include "FDatabaseMetaDataResultSet.hxx"
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-
-using namespace ::comphelper;
-
-using namespace connectivity;
-using namespace connectivity::ado;
-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(OConnection* _pCon)
- : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo())
- ,m_pADOConnection(_pCon->getConnection())
- ,m_pConnection(_pCon)
-{
-}
-// -------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaData::getInt32Property(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- connectivity::ado::WpADOProperties aProps(m_pADOConnection->get_Properties());
- // ADOS::ThrowException(*m_pADOConnection,*this);
- OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
- ADO_PROP(_aProperty);
- sal_Int32 nValue(0);
- if(!aVar.isNull() && !aVar.isEmpty())
- nValue = aVar;
- return nValue;
-}
-
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::getBoolProperty(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- connectivity::ado::WpADOProperties aProps(m_pADOConnection->get_Properties());
- ADOS::ThrowException(*m_pADOConnection,*this);
- OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
- ADO_PROP(_aProperty);
- return (!aVar.isNull() && !aVar.isEmpty() ? aVar.getBool() : sal_False);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString ODatabaseMetaData::getStringProperty(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- connectivity::ado::WpADOProperties aProps(m_pADOConnection->get_Properties());
- ADOS::ThrowException(*m_pADOConnection,*this);
- OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
-
- ADO_PROP(_aProperty);
- ::rtl::OUString aValue;
- if(!aVar.isNull() && !aVar.isEmpty() && aVar.getType() == VT_BSTR)
- aValue = aVar;
-
- return aValue;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( )
-{
- ADORecordset *pRecordset = m_pADOConnection->getTypeInfo();
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
- pResult->setTypeInfoMap(ADOS::isJetEngine(m_pConnection->getEngineType()));
- Reference< XResultSet > xRef = pResult;
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException)
-{
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
-
- ADORecordset *pRecordset = NULL;
- m_pADOConnection->OpenSchema(adSchemaCatalogs,vtEmpty,vtEmpty,&pRecordset);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
- pResult->setCatalogsMap();
- xRef = pResult;
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( )
-{
- return getLiteral(DBLITERAL_CATALOG_SEPARATOR);
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException)
-{
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
-
- ADORecordset *pRecordset = NULL;
- m_pADOConnection->OpenSchema(adSchemaSchemata,vtEmpty,vtEmpty,&pRecordset);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
- pResult->setSchemasMap();
- xRef = pResult;
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
- const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
-{
- ADORecordset *pRecordset = m_pADOConnection->getColumnPrivileges(catalog,schema,table,columnNamePattern);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
- pResult->setColumnPrivilegesMap();
- xRef = pResult;
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
- const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern,
- const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
-{
- ADORecordset *pRecordset = m_pADOConnection->getColumns(catalog,schemaPattern,tableNamePattern,columnNamePattern);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
- pResult->setColumnsMap();
- xRef = pResult;
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
- const Any& catalog, const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException)
-{
- ADORecordset *pRecordset = m_pADOConnection->getTables(catalog,schemaPattern,tableNamePattern,types);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
- pResult->setTablesMap();
- xRef = pResult;
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
- const Any& catalog, const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
-{
- ADORecordset *pRecordset = m_pADOConnection->getProcedureColumns(catalog,schemaPattern,procedureNamePattern,columnNamePattern);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
- pResult->setProcedureColumnsMap();
- xRef = pResult;
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
- const Any& catalog, const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException)
-{
- // Create elements used in the array
- ADORecordset *pRecordset = m_pADOConnection->getProcedures(catalog,schemaPattern,procedureNamePattern);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
- pResult->setProceduresMap();
- xRef = pResult;
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
-{
- return getMaxSize(DBLITERAL_BINARY_LITERAL);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Maximum Row Size")));
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException)
-{
- return getMaxSize(DBLITERAL_CATALOG_NAME);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
-{
- return getMaxSize(DBLITERAL_CHAR_LITERAL);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
-{
- return getMaxSize(DBLITERAL_COLUMN_NAME);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
-{
- return getMaxSize(DBLITERAL_CURSOR_NAME);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Active Sessions")));
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Max Columns in Table")));
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException)
-{
- return getMaxSize(DBLITERAL_TEXT_COMMAND);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException)
-{
- return getMaxSize(DBLITERAL_TABLE_NAME);
-}
-// -------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Maximum Tables in SELECT")));
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
-{
- ADORecordset *pRecordset = m_pADOConnection->getExportedKeys(catalog,schema,table);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
- pResult->setCrossReferenceMap();
- xRef = pResult;
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
-{
- ADORecordset *pRecordset = m_pADOConnection->getImportedKeys(catalog,schema,table);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
- pResult->setCrossReferenceMap();
- xRef = pResult;
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
-{
- ADORecordset *pRecordset = m_pADOConnection->getPrimaryKeys(catalog,schema,table);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
- pResult->setPrimaryKeysMap();
- xRef = pResult;
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
- sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException)
-{
- ADORecordset *pRecordset = m_pADOConnection->getIndexInfo(catalog,schema,table,unique,approximate);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
- pResult->setIndexInfoMap();
- xRef = pResult;
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
- const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException)
-{
- Reference< XResultSet > xRef;
- if(!ADOS::isJetEngine(m_pConnection->getEngineType()))
- { // the jet provider doesn't support this method
- // Create elements used in the array
-
- ADORecordset *pRecordset = m_pADOConnection->getTablePrivileges(catalog,schemaPattern,tableNamePattern);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
- pResult->setTablePrivilegesMap();
- xRef = pResult;
- }
- else
- {
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTablePrivileges);
- xRef = pResult;
- ::connectivity::ODatabaseMetaDataResultSet::ORows aRows;
- ::connectivity::ODatabaseMetaDataResultSet::ORow aRow(8);
- aRows.reserve(8);
-
- aRow[0] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[1] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[2] = new ::connectivity::ORowSetValueDecorator(tableNamePattern);
- aRow[3] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[4] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[5] = new ::connectivity::ORowSetValueDecorator(getUserName());
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getSelectValue();
- aRow[7] = new ::connectivity::ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO")));
-
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getInsertValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDeleteValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getUpdateValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getCreateValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getReadValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getAlterValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDropValue();
- aRows.push_back(aRow);
- pResult->setRows(aRows);
- }
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
- const Any& primaryCatalog, const ::rtl::OUString& primarySchema,
- const ::rtl::OUString& primaryTable, const Any& foreignCatalog,
- const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException)
-{
- ADORecordset *pRecordset = m_pADOConnection->getCrossReference(primaryCatalog,primarySchema,primaryTable,foreignCatalog,foreignSchema,foreignTable);
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- Reference< XResultSet > xRef;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
- pResult->setCrossReferenceMap();
- xRef = pResult;
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException)
-{
- return getBoolProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Maximum Row Size Includes BLOB")));
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Maximum Index Size")));
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULL Concatenation Behavior"))) == DBPROPVAL_CB_NON_NULL;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
-{
- return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Catalog Term")));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
-{
- return getLiteral(DBLITERAL_QUOTE_PREFIX);
-
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- return isCapable(DBLITERAL_CORRELATION_NAME);
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_isCatalogAtStart_throw( )
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Catalog Location"))) == DBPROPVAL_CL_START;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transaction DDL"))) == DBPROPVAL_TC_DDL_IGNORE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transaction DDL"))) == DBPROPVAL_TC_DDL_COMMIT;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transaction DDL"))) == DBPROPVAL_TC_DML;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transaction DDL"))) == DBPROPVAL_TC_ALL;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Prepare Abort Behavior"))) == DBPROPVAL_CB_PRESERVE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Prepare Commit Behavior"))) == DBPROPVAL_CB_PRESERVE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Isolation Retention"))) & DBPROPVAL_TR_COMMIT) == DBPROPVAL_TR_COMMIT;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Isolation Retention"))) & DBPROPVAL_TR_ABORT) == DBPROPVAL_TR_ABORT;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException)
-{
- sal_Bool bValue(sal_False);
-
- sal_Int32 nTxn = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Isolation Levels")));
- if(level == TransactionIsolation::NONE)
- bValue = sal_True;
- else if(level == TransactionIsolation::READ_UNCOMMITTED)
- bValue = (nTxn & DBPROPVAL_TI_READUNCOMMITTED) == DBPROPVAL_TI_READUNCOMMITTED;
- else if(level == TransactionIsolation::READ_COMMITTED)
- bValue = (nTxn & DBPROPVAL_TI_READCOMMITTED) == DBPROPVAL_TI_READCOMMITTED;
- else if(level == TransactionIsolation::REPEATABLE_READ)
- bValue = (nTxn & DBPROPVAL_TI_REPEATABLEREAD) == DBPROPVAL_TI_REPEATABLEREAD;
- else if(level == TransactionIsolation::SERIALIZABLE)
- bValue = (nTxn & DBPROPVAL_TI_SERIALIZABLE) == DBPROPVAL_TI_SERIALIZABLE;
-
- return bValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Schema Usage"))) & DBPROPVAL_SU_DML_STATEMENTS) == DBPROPVAL_SU_DML_STATEMENTS;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nProp = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL Support")));
- return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI92_FULL) == DBPROPVAL_SQL_ANSI92_FULL);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nProp = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL Support")));
- return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI92_ENTRY) == DBPROPVAL_SQL_ANSI92_ENTRY);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nProp = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL Support")));
- return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI89_IEF) == DBPROPVAL_SQL_ANSI89_IEF);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Schema Usage"))) & DBPROPVAL_SU_INDEX_DEFINITION) == DBPROPVAL_SU_INDEX_DEFINITION;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Schema Usage"))) & DBPROPVAL_SU_TABLE_DEFINITION) == DBPROPVAL_SU_TABLE_DEFINITION;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
-{
- if ( ADOS::isJetEngine(m_pConnection->getEngineType()) )
- return sal_True;
- return getBoolProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Outer Join Capabilities")));
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
-{
- return new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
-}
-// -------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( )
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException)
-{
- return getMaxSize(DBLITERAL_PROCEDURE_NAME);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
-{
- return getMaxSize(DBLITERAL_SCHEMA_NAME);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transaction DDL"))) == DBPROPVAL_TC_NONE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- return getBoolProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Read-Only Data Source")));
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULL Concatenation Behavior"))) == DBPROPVAL_CB_NULL;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException)
-{
- return isCapable(DBLITERAL_COLUMN_ALIAS);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- return isCapable(DBLITERAL_CORRELATION_NAME);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException)
-{
- return getBoolProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Rowset Conversions on Command")));
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- return getBoolProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ORDER BY Columns in Select List")));
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GROUP BY Support"))) != DBPROPVAL_GB_NOT_SUPPORTED;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GROUP BY Support"))) != DBPROPVAL_GB_CONTAINS_SELECT;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GROUP BY Support"))) == DBPROPVAL_GB_NO_RELATION;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException)
-{
- return isCapable(DBLITERAL_ESCAPE_PERCENT);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException)
-{
- return getBoolProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ORDER BY Columns in Select List")));
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULL Collation Order"))) & DBPROPVAL_NC_END) == DBPROPVAL_NC_END;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULL Collation Order"))) & DBPROPVAL_NC_START) == DBPROPVAL_NC_START;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULL Collation Order"))) & DBPROPVAL_NC_HIGH) == DBPROPVAL_NC_HIGH;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULL Collation Order"))) & DBPROPVAL_NC_LOW) == DBPROPVAL_NC_LOW;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Schema Usage"))) & DBPROPVAL_SU_PRIVILEGE_DEFINITION) == DBPROPVAL_SU_PRIVILEGE_DEFINITION;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Subquery Support"))) & DBPROPVAL_SQ_CORRELATEDSUBQUERIES) == DBPROPVAL_SQ_CORRELATEDSUBQUERIES;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Subquery Support"))) & DBPROPVAL_SQ_COMPARISON) == DBPROPVAL_SQ_COMPARISON;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Subquery Support"))) & DBPROPVAL_SQ_EXISTS) == DBPROPVAL_SQ_EXISTS;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Subquery Support"))) & DBPROPVAL_SQ_IN) == DBPROPVAL_SQ_IN;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException)
-{
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Subquery Support"))) & DBPROPVAL_SQ_QUANTIFIED) == DBPROPVAL_SQ_QUANTIFIED;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nProp = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL Support")));
- return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI92_INTERMEDIATE) == DBPROPVAL_SQL_ANSI92_INTERMEDIATE);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:ado:"))+ m_pADOConnection->GetConnectionString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException)
-{
- return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("User Name")));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException)
-{
- return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Provider Friendly Name")));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException)
-{
- return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Provider Version")));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException)
-{
- return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DBMS Version")));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException)
-{
- return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DBMS Name")));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException)
-{
- return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Procedure Term")));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
-{
- return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Schema Term")));
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
-{
- return 1;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nRet = TransactionIsolation::NONE;
- switch(m_pADOConnection->get_IsolationLevel())
- {
- case adXactReadCommitted:
- nRet = TransactionIsolation::READ_COMMITTED;
- break;
- case adXactRepeatableRead:
- nRet = TransactionIsolation::REPEATABLE_READ;
- break;
- case adXactSerializable:
- nRet = TransactionIsolation::SERIALIZABLE;
- break;
- case adXactReadUncommitted:
- nRet = TransactionIsolation::READ_UNCOMMITTED;
- break;
- default:
- ;
- }
- return nRet;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException)
-{
- ADORecordset *pRecordset = NULL;
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
- m_pADOConnection->OpenSchema(adSchemaDBInfoKeywords,vtEmpty,vtEmpty,&pRecordset);
- OSL_ENSURE(pRecordset,"getSQLKeywords: no resultset!");
- ADOS::ThrowException(*m_pADOConnection,*this);
- if ( pRecordset )
- {
- WpADORecordset aRecordset(pRecordset);
-
- aRecordset.MoveFirst();
- OLEVariant aValue;
- ::rtl::OUString aRet, aComma(RTL_CONSTASCII_USTRINGPARAM(","));
- while(!aRecordset.IsAtEOF())
- {
- WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(aRecordset.GetFields());
- WpADOField aField(aFields.GetItem(0));
- aField.get_Value(aValue);
- aRet = aRet + aValue + aComma;
- aRecordset.MoveNext();
- }
- aRecordset.Close();
- if ( aRet.getLength() )
- return aRet.copy(0,aRet.lastIndexOf(','));
- }
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException)
-{
- return getLiteral(DBLITERAL_ESCAPE_PERCENT);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue.copy(0,aValue.lastIndexOf(','));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue.copy(0,aValue.lastIndexOf(','));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nProp = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL Support")));
- return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ODBC_EXTENDED) == DBPROPVAL_SQL_ODBC_EXTENDED);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nProp = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL Support")));
- return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ODBC_CORE) == DBPROPVAL_SQL_ODBC_CORE);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nProp = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL Support")));
- return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ODBC_MINIMUM) == DBPROPVAL_SQL_ODBC_MINIMUM);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException)
-{
- if ( ADOS::isJetEngine(m_pConnection->getEngineType()) )
- return sal_True;
- return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Outer Join Capabilities"))) & 0x00000004L) == 0x00000004L;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return supportsFullOuterJoins( );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Max Columns in GROUP BY")));
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Max Columns in ORDER BY")));
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
-{
- return getMaxSize(DBLITERAL_USER_NAME);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 /*setType*/, sal_Int32 /*concurrency*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- return ResultSetType::FORWARD_ONLY != setType;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- return ResultSetType::FORWARD_ONLY != setType;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- return ResultSetType::FORWARD_ONLY != setType;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- return ResultSetType::FORWARD_ONLY != setType;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- return ResultSetType::FORWARD_ONLY != setType;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- return ResultSetType::FORWARD_ONLY != setType;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- return ResultSetType::FORWARD_ONLY != setType;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- return ResultSetType::FORWARD_ONLY != setType;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- return ResultSetType::FORWARD_ONLY != setType;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XDatabaseMetaData::getUDTs", *this );
- return Reference< XResultSet >();
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
deleted file mode 100644
index e6ac9c9030..0000000000
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
+++ /dev/null
@@ -1,610 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/ADatabaseMetaData.hxx"
-#include "ado/ADatabaseMetaDataResultSetMetaData.hxx"
-#include "ado/Awrapado.hxx"
-#include "ado/AGroup.hxx"
-#include "ado/adoimp.hxx"
-#include "ado/AIndex.hxx"
-#include "ado/AKey.hxx"
-#include "ado/ATable.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ProcedureResult.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#ifdef DELETE
-#undef DELETE
-#endif
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#include <com/sun/star/sdbcx/PrivilegeObject.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-
-using namespace connectivity::ado;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::uno;
-
-// -------------------------------------------------------------------------
-void ODatabaseMetaData::fillLiterals()
-{
- ADORecordset *pRecordset = NULL;
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
- m_pADOConnection->OpenSchema(adSchemaDBInfoLiterals,vtEmpty,vtEmpty,&pRecordset);
-
- ADOS::ThrowException(*m_pADOConnection,*this);
-
- OSL_ENSURE(pRecordset,"fillLiterals: no resultset!");
- if ( pRecordset )
- {
- WpADORecordset aRecordset(pRecordset);
-
- aRecordset.MoveFirst();
- OLEVariant aValue;
- LiteralInfo aInfo;
- while(!aRecordset.IsAtEOF())
- {
- WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(aRecordset.GetFields());
- WpADOField aField(aFields.GetItem(1));
- aInfo.pwszLiteralValue = aField.get_Value();
- aField = aFields.GetItem(5);
- aInfo.fSupported = aField.get_Value();
- aField = aFields.GetItem(6);
- aInfo.cchMaxLen = aField.get_Value().getUInt32();
-
- aField = aFields.GetItem(4);
- sal_uInt32 nId = aField.get_Value().getUInt32();
- m_aLiteralInfo[nId] = aInfo;
-
- aRecordset.MoveNext();
- }
- aRecordset.Close();
- }
-}
-// -------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaData::getMaxSize(sal_uInt32 _nId)
-{
- if(!m_aLiteralInfo.size())
- fillLiterals();
-
- sal_Int32 nSize = 0;
- ::std::map<sal_uInt32,LiteralInfo>::const_iterator aIter = m_aLiteralInfo.find(_nId);
- if(aIter != m_aLiteralInfo.end() && (*aIter).second.fSupported)
- nSize = ((*aIter).second.cchMaxLen == (-1)) ? 0 : (*aIter).second.cchMaxLen;
- return nSize;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::isCapable(sal_uInt32 _nId)
-{
- if(!m_aLiteralInfo.size())
- fillLiterals();
- sal_Bool bSupported = sal_False;
- ::std::map<sal_uInt32,LiteralInfo>::const_iterator aIter = m_aLiteralInfo.find(_nId);
- if(aIter != m_aLiteralInfo.end())
- bSupported = (*aIter).second.fSupported;
- return bSupported;
-}
-
-// -------------------------------------------------------------------------
-::rtl::OUString ODatabaseMetaData::getLiteral(sal_uInt32 _nId)
-{
- if(!m_aLiteralInfo.size())
- fillLiterals();
- ::rtl::OUString sStr;
- ::std::map<sal_uInt32,LiteralInfo>::const_iterator aIter = m_aLiteralInfo.find(_nId);
- if(aIter != m_aLiteralInfo.end() && (*aIter).second.fSupported)
- sStr = (*aIter).second.pwszLiteralValue;
- return sStr;
-}
-// -----------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSetMetaData::setColumnPrivilegesMap()
-{
- m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IS_GRANTABLE")),
- ColumnValue::NULLABLE,
- 3,3,0,
- DataType::VARCHAR);
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSetMetaData::setColumnsMap()
-{
- m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE_NAME")),
- ColumnValue::NO_NULLS,
- 0,0,0,
- DataType::VARCHAR);
- m_mColumns[11] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULLABLE")),
- ColumnValue::NO_NULLS,
- 1,1,0,
- DataType::INTEGER);
- m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REMARKS")),
- ColumnValue::NULLABLE,
- 0,0,0,
- DataType::VARCHAR);
- m_mColumns[13] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("COLUMN_DEF")),
- ColumnValue::NULLABLE,
- 0,0,0,
- DataType::VARCHAR);
- m_mColumns[14] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL_DATA_TYPE")),
- ColumnValue::NO_NULLS,
- 1,1,0,
- DataType::INTEGER);
- m_mColumns[15] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL_DATETIME_SUB")),
- ColumnValue::NO_NULLS,
- 1,1,0,
- DataType::INTEGER);
- m_mColumns[16] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR_OCTET_LENGTH")),
- ColumnValue::NO_NULLS,
- 1,1,0,
- DataType::INTEGER);
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSetMetaData::setTablesMap()
-{
- m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REMARKS")),
- ColumnValue::NULLABLE,
- 0,0,0,
- DataType::VARCHAR);
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSetMetaData::setProcedureColumnsMap()
-{
- m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULLABLE")),
- ColumnValue::NO_NULLS,
- 1,1,0,
- DataType::INTEGER);
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSetMetaData::setPrimaryKeysMap()
-{
- m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("KEY_SEQ")),
- ColumnValue::NO_NULLS,
- 1,1,0,
- DataType::INTEGER);
- m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PK_NAME")),
- ColumnValue::NULLABLE,
- 0,0,0,
- DataType::VARCHAR);
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSetMetaData::setIndexInfoMap()
-{
- m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NON_UNIQUE")),
- ColumnValue::NO_NULLS,
- 1,1,0,
- DataType::BIT);
- m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INDEX_QUALIFIER")),
- ColumnValue::NULLABLE,
- 0,0,0,
- DataType::VARCHAR);
- m_mColumns[10] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ASC_OR_DESC")),
- ColumnValue::NULLABLE,
- 0,0,0,
- DataType::VARCHAR);
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSetMetaData::setTablePrivilegesMap()
-{
- m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PRIVILEGE")),
- ColumnValue::NULLABLE,
- 0,0,0,
- DataType::VARCHAR);
- m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IS_GRANTABLE")),
- ColumnValue::NULLABLE,
- 0,0,0,
- DataType::VARCHAR);
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSetMetaData::setCrossReferenceMap()
-{
- m_mColumns[9] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("KEY_SEQ")),
- ColumnValue::NO_NULLS,
- 1,1,0,
- DataType::INTEGER);
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSetMetaData::setTypeInfoMap()
-{
- m_mColumns[3] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PRECISION")),
- ColumnValue::NO_NULLS,
- 1,1,0,
- DataType::INTEGER);
- m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULLABLE")),
- ColumnValue::NO_NULLS,
- 1,1,0,
- DataType::INTEGER);
- m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AUTO_INCREMENT")),
- ColumnValue::NO_NULLS,
- 1,1,0,
- DataType::BIT);
- m_mColumns[16] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL_DATA_TYPE")),
- ColumnValue::NO_NULLS,
- 1,1,0,
- DataType::INTEGER);
- m_mColumns[17] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL_DATETIME_SUB")),
- ColumnValue::NO_NULLS,
- 1,1,0,
- DataType::INTEGER);
- m_mColumns[18] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NUM_PREC_RADIX")),
- ColumnValue::NO_NULLS,
- 1,1,0,
- DataType::INTEGER);
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSetMetaData::setProceduresMap()
-{
- m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REMARKS")),
- ColumnValue::NULLABLE,
- 0,0,0,
- DataType::VARCHAR);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.isSearchable();
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.isAutoIncrement();
- return sal_False;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.getColumnServiceName();
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.getTableName();
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.getCatalogName();
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.getColumnTypeName();
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.isCaseSensitive();
- return sal_True;
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.getSchemaName();
- return ::rtl::OUString();
-}
-// -----------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-ObjectTypeEnum OAdoGroup::MapObjectType(sal_Int32 _ObjType)
-{
- ObjectTypeEnum eNumType= adPermObjTable;
- switch(_ObjType)
- {
- case PrivilegeObject::TABLE:
- break;
- case PrivilegeObject::VIEW:
- eNumType = adPermObjView;
- break;
- case PrivilegeObject::COLUMN:
- eNumType = adPermObjColumn;
- break;
- }
- return eNumType;
-}
-// -------------------------------------------------------------------------
-sal_Int32 OAdoGroup::MapRight(RightsEnum _eNum)
-{
- sal_Int32 nRight = 0;
- if(_eNum & adRightRead)
- nRight |= Privilege::SELECT;
- if(_eNum & adRightInsert)
- nRight |= Privilege::INSERT;
- if(_eNum & adRightUpdate)
- nRight |= Privilege::UPDATE;
- if(_eNum & adRightDelete)
- nRight |= Privilege::DELETE;
- if(_eNum & adRightReadDesign)
- nRight |= Privilege::READ;
- if(_eNum & adRightCreate)
- nRight |= Privilege::CREATE;
- if(_eNum & adRightWriteDesign)
- nRight |= Privilege::ALTER;
- if(_eNum & adRightReference)
- nRight |= Privilege::REFERENCE;
- if(_eNum & adRightDrop)
- nRight |= Privilege::DROP;
-
- return nRight;
-}
-// -------------------------------------------------------------------------
-RightsEnum OAdoGroup::Map2Right(sal_Int32 _eNum)
-{
- sal_Int32 nRight = adRightNone;
- if(_eNum & Privilege::SELECT)
- nRight |= adRightRead;
-
- if(_eNum & Privilege::INSERT)
- nRight |= adRightInsert;
-
- if(_eNum & Privilege::UPDATE)
- nRight |= adRightUpdate;
-
- if(_eNum & Privilege::DELETE)
- nRight |= adRightDelete;
-
- if(_eNum & Privilege::READ)
- nRight |= adRightReadDesign;
-
- if(_eNum & Privilege::CREATE)
- nRight |= adRightCreate;
-
- if(_eNum & Privilege::ALTER)
- nRight |= adRightWriteDesign;
-
- if(_eNum & Privilege::REFERENCE)
- nRight |= adRightReference;
-
- if(_eNum & Privilege::DROP)
- nRight |= adRightDrop;
-
- return (RightsEnum)nRight;
-}
-// -------------------------------------------------------------------------
-void WpADOIndex::Create()
-{
- HRESULT hr = -1;
-
- _ADOIndex* pIndex = NULL;
- hr = CoCreateInstance(ADOS::CLSID_ADOINDEX_25,
- NULL,
- CLSCTX_INPROC_SERVER,
- ADOS::IID_ADOINDEX_25,
- (void**)&pIndex );
-
-
- if( !FAILED( hr ) )
- {
- operator=( pIndex );
- pIndex->Release();
- }
-}
-// -------------------------------------------------------------------------
-void OAdoIndex::fillPropertyValues()
-{
- if(m_aIndex.IsValid())
- {
- m_Name = m_aIndex.get_Name();
- m_IsUnique = m_aIndex.get_Unique();
- m_IsPrimaryKeyIndex = m_aIndex.get_PrimaryKey();
- m_IsClustered = m_aIndex.get_Clustered();
- }
-}
-// -----------------------------------------------------------------------------
-void WpADOKey::Create()
-{
- HRESULT hr = -1;
- _ADOKey* pKey = NULL;
- hr = CoCreateInstance(ADOS::CLSID_ADOKEY_25,
- NULL,
- CLSCTX_INPROC_SERVER,
- ADOS::IID_ADOKEY_25,
- (void**)&pKey );
-
-
- if( !FAILED( hr ) )
- {
- operator=( pKey );
- pKey->Release();
- }
-}
-// -------------------------------------------------------------------------
-void OAdoKey::fillPropertyValues()
-{
- if(m_aKey.IsValid())
- {
- m_aProps->m_Type = MapKeyRule(m_aKey.get_Type());
- m_Name = m_aKey.get_Name();
- m_aProps->m_ReferencedTable = m_aKey.get_RelatedTable();
- m_aProps->m_UpdateRule = MapRule(m_aKey.get_UpdateRule());
- m_aProps->m_DeleteRule = MapRule(m_aKey.get_DeleteRule());
- }
-}
-// -------------------------------------------------------------------------
-sal_Int32 OAdoKey::MapRule(const RuleEnum& _eNum)
-{
- sal_Int32 eNum = KeyRule::NO_ACTION;
- switch(_eNum)
- {
- case adRICascade:
- eNum = KeyRule::CASCADE;
- break;
- case adRISetNull:
- eNum = KeyRule::SET_NULL;
- break;
- case adRINone:
- eNum = KeyRule::NO_ACTION;
- break;
- case adRISetDefault:
- eNum = KeyRule::SET_DEFAULT;
- break;
- }
- return eNum;
-}
-// -------------------------------------------------------------------------
-RuleEnum OAdoKey::Map2Rule(const sal_Int32& _eNum)
-{
- RuleEnum eNum = adRINone;
- switch(_eNum)
- {
- case KeyRule::CASCADE:
- eNum = adRICascade;
- break;
- case KeyRule::SET_NULL:
- eNum = adRISetNull;
- break;
- case KeyRule::NO_ACTION:
- eNum = adRINone;
- break;
- case KeyRule::SET_DEFAULT:
- eNum = adRISetDefault;
- break;
- }
- return eNum;
-}
-// -------------------------------------------------------------------------
-sal_Int32 OAdoKey::MapKeyRule(const KeyTypeEnum& _eNum)
-{
- sal_Int32 nKeyType = KeyType::PRIMARY;
- switch(_eNum)
- {
- case adKeyPrimary:
- nKeyType = KeyType::PRIMARY;
- break;
- case adKeyForeign:
- nKeyType = KeyType::FOREIGN;
- break;
- case adKeyUnique:
- nKeyType = KeyType::UNIQUE;
- break;
- }
- return nKeyType;
-}
-// -------------------------------------------------------------------------
-KeyTypeEnum OAdoKey::Map2KeyRule(const sal_Int32& _eNum)
-{
- KeyTypeEnum eNum( adKeyPrimary );
- switch(_eNum)
- {
- case KeyType::PRIMARY:
- eNum = adKeyPrimary;
- break;
- case KeyType::FOREIGN:
- eNum = adKeyForeign;
- break;
- case KeyType::UNIQUE:
- eNum = adKeyUnique;
- break;
- default:
- OSL_FAIL( "OAdoKey::Map2KeyRule: invalid key type!" );
- }
- return eNum;
-}
-// -----------------------------------------------------------------------------
-void WpADOTable::Create()
-{
- HRESULT hr = -1;
- _ADOTable* pTable = NULL;
- hr = CoCreateInstance(ADOS::CLSID_ADOTABLE_25,
- NULL,
- CLSCTX_INPROC_SERVER,
- ADOS::IID_ADOTABLE_25,
- (void**)&pTable );
-
-
- if( !FAILED( hr ) )
- {
- operator=( pTable );
- pTable->Release();
- }
-}
-// -------------------------------------------------------------------------
-::rtl::OUString WpADOCatalog::GetObjectOwner(const ::rtl::OUString& _rName, ObjectTypeEnum _eNum)
-{
- OLEVariant _rVar;
- _rVar.setNoArg();
- OLEString aBSTR;
- OLEString sStr1(_rName);
- pInterface->GetObjectOwner(sStr1,_eNum,_rVar,&aBSTR);
- return aBSTR;
-}
-// -----------------------------------------------------------------------------
-void OAdoTable::fillPropertyValues()
-{
- if(m_aTable.IsValid())
- {
- m_Name = m_aTable.get_Name();
- m_Type = m_aTable.get_Type();
- {
- WpADOCatalog aCat(m_aTable.get_ParentCatalog());
- if(aCat.IsValid())
- m_CatalogName = aCat.GetObjectOwner(m_aTable.get_Name(),adPermObjTable);
- }
- {
- WpADOProperties aProps = m_aTable.get_Properties();
- if(aProps.IsValid())
- m_Description = OTools::getValue(aProps,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Description")));
- }
- }
-}
-// -----------------------------------------------------------------------------
-void WpADOUser::Create()
-{
- HRESULT hr = -1;
- _ADOUser* pUser = NULL;
- hr = CoCreateInstance(ADOS::CLSID_ADOUSER_25,
- NULL,
- CLSCTX_INPROC_SERVER,
- ADOS::IID_ADOUSER_25,
- (void**)&pUser );
-
-
- if( !FAILED( hr ) )
- {
- operator=( pUser );
- pUser->Release();
- }
-}
-// -------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
deleted file mode 100644
index 845575eaf3..0000000000
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
+++ /dev/null
@@ -1,1219 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <comphelper/sequence.hxx>
-#include "ado/ADatabaseMetaDataResultSet.hxx"
-#include "ado/ADatabaseMetaDataResultSetMetaData.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbc/ProcedureResult.hpp>
-#include <com/sun/star/sdbc/IndexType.hpp>
-#include <comphelper/property.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/seqstream.hxx>
-#include "connectivity/dbexception.hxx"
-
-
-#include <oledb.h>
-
-using namespace dbtools;
-using namespace connectivity::ado;
-using namespace cppu;
-using namespace ::comphelper;
-//------------------------------------------------------------------------------
-using namespace ::com::sun::star::lang;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-
-// -------------------------------------------------------------------------
-ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet(ADORecordset* _pRecordSet)
- :ODatabaseMetaDataResultSet_BASE(m_aMutex)
- ,OPropertySetHelper(ODatabaseMetaDataResultSet_BASE::rBHelper)
- ,m_aStatement(NULL)
- ,m_xMetaData(NULL)
- ,m_pRecordSet(_pRecordSet)
- ,m_bEOF(sal_False)
-{
- osl_incrementInterlockedCount( &m_refCount );
- m_aColMapping.push_back(-1);
- if(_pRecordSet)
- {
- m_pRecordSet->AddRef();
- VARIANT_BOOL bIsAtBOF;
- m_pRecordSet->get_BOF(&bIsAtBOF);
- m_bOnFirstAfterOpen = bIsAtBOF != VARIANT_TRUE;
- }
- else
- m_bOnFirstAfterOpen = sal_False;
- osl_decrementInterlockedCount( &m_refCount );
- // allocBuffer();
-}
-
-// -------------------------------------------------------------------------
-ODatabaseMetaDataResultSet::~ODatabaseMetaDataResultSet()
-{
- if(m_pRecordSet)
- m_pRecordSet->Release();
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::disposing(void)
-{
- OPropertySetHelper::disposing();
-
- ::osl::MutexGuard aGuard(m_aMutex);
- if(m_pRecordSet)
- m_pRecordSet->Close();
- m_aStatement = NULL;
-m_xMetaData.clear();
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL ODatabaseMetaDataResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OPropertySetHelper::queryInterface(rType);
- return aRet.hasValue() ? aRet : ODatabaseMetaDataResultSet_BASE::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL ODatabaseMetaDataResultSet::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),ODatabaseMetaDataResultSet_BASE::getTypes());
-}
-// -----------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::checkRecordSet() throw(SQLException)
-{
- if(!m_pRecordSet)
- throwFunctionSequenceException(*this);
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed );
-
-
- Reference< XResultSetMetaData > xMeta = getMetaData();
- sal_Int32 nLen = xMeta->getColumnCount();
- sal_Int32 i = 1;
- for(;i<=nLen;++i)
- if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
- columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
- break;
- return i;
-}
-#define BLOCK_SIZE 256
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- checkRecordSet();
-
-
- columnIndex = mapColumn(columnIndex);
- WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex);
- if((aField.GetAttributes() & adFldLong) == adFldLong)
- {
- //Copy the data only upto the Actual Size of Field.
- sal_Int32 nSize = aField.GetActualSize();
- Sequence<sal_Int8> aData(nSize);
- long index = 0;
- while(index < nSize)
- {
- m_aValue = aField.GetChunk(BLOCK_SIZE);
- if(m_aValue.isNull())
- break;
- UCHAR chData;
- for(long index2 = 0;index2 < BLOCK_SIZE;++index2)
- {
- HRESULT hr = ::SafeArrayGetElement(m_aValue.parray,&index2,&chData);
- if(SUCCEEDED(hr))
- {
- //Take BYTE by BYTE and advance Memory Location
- aData.getArray()[index++] = chData;
- }
- else
- break;
- }
- }
- return index ? Reference< ::com::sun::star::io::XInputStream >(new SequenceInputStream(aData)) : Reference< ::com::sun::star::io::XInputStream >();
- }
- // else we ask for a bytesequence
- aField.get_Value(m_aValue);
- if(m_aValue.isNull())
- return NULL;
- return new SequenceInputStream(m_aValue);
-}
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getCharacterStream", *this );
- return NULL;
-}
-
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_aValueRange.empty() && columnIndex == 11 && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end() )
- {
- getValue(2);
- if ( static_cast<sal_Int16>(m_aValue) != adCurrency )
- return sal_False;
- }
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-sal_Int8 SAL_CALL ODatabaseMetaDataResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- getValue(columnIndex);
-
- columnIndex = mapColumn(columnIndex);
-
- if(m_aValue.isNull())
- return 0;
- if ( !m_aValueRange.empty() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
- return (sal_Int8)(*m_aValueRangeIter).second[(sal_Int32)m_aValue];
- else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
- return (sal_Int8)(*m_aStrValueRangeIter).second[m_aValue];
-
- return m_aValue;
-}
-// -------------------------------------------------------------------------
-
-Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-::com::sun::star::util::Date SAL_CALL ODatabaseMetaDataResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-double SAL_CALL ODatabaseMetaDataResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-float SAL_CALL ODatabaseMetaDataResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- getValue(columnIndex);
-
- columnIndex = mapColumn(columnIndex);
- if(m_aValue.isNull())
- return 0;
-
- if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
- return (*m_aValueRangeIter).second[(sal_Int32)m_aValue];
- else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
- return (*m_aStrValueRangeIter).second[m_aValue];
-
- return m_aValue;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getRow( ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XResultSet::getRow", *this );
- return 0;
-}
-// -------------------------------------------------------------------------
-
-sal_Int64 SAL_CALL ODatabaseMetaDataResultSet::getLong( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getLong", *this );
- return sal_Int64(0);
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSetMetaData > SAL_CALL ODatabaseMetaDataResultSet::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- checkRecordSet();
-
-
- if(!m_xMetaData.is())
- m_xMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
-
- return m_xMetaData;
-}
-// -------------------------------------------------------------------------
-Reference< XArray > SAL_CALL ODatabaseMetaDataResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getRow", *this );
- return NULL;
-}
-
-// -------------------------------------------------------------------------
-
-Reference< XClob > SAL_CALL ODatabaseMetaDataResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getRow", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL ODatabaseMetaDataResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getRow", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Reference< XRef > SAL_CALL ODatabaseMetaDataResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getRow", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Any SAL_CALL ODatabaseMetaDataResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- checkRecordSet();
-
-
- columnIndex = mapColumn(columnIndex);
- return Any();
-}
-// -------------------------------------------------------------------------
-
-sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- getValue(columnIndex);
-
- columnIndex = mapColumn(columnIndex);
- if(m_aValue.isNull())
- return 0;
-
- if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
- return (sal_Int16)(*m_aValueRangeIter).second[(sal_Int32)m_aValue];
- else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
- return (sal_Int16)(*m_aStrValueRangeIter).second[m_aValue];
-
- return m_aValue;
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL ODatabaseMetaDataResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- getValue(columnIndex);
-
-
- columnIndex = mapColumn(columnIndex);
- if(m_aValue.isNull())
- return ::rtl::OUString();
- if(m_aIntValueRange.size() && (m_aIntValueRangeIter = m_aIntValueRange.find(columnIndex)) != m_aIntValueRange.end())
- return (*m_aIntValueRangeIter).second[m_aValue];
-
- return m_aValue;
-}
-
-// -------------------------------------------------------------------------
-
-
-::com::sun::star::util::Time SAL_CALL ODatabaseMetaDataResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-
-::com::sun::star::util::DateTime SAL_CALL ODatabaseMetaDataResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isAfterLast( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- checkRecordSet();
-
-
- VARIANT_BOOL bIsAtEOF;
- m_pRecordSet->get_EOF(&bIsAtEOF);
- return bIsAtEOF == VARIANT_TRUE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isFirst( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- checkRecordSet();
-
-
- return m_nRowPos == 1;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isLast( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- checkRecordSet();
-
-
- return sal_True;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL ODatabaseMetaDataResultSet::beforeFirst( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- checkRecordSet();
-
-
- if(first())
- previous();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL ODatabaseMetaDataResultSet::afterLast( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- checkRecordSet();
-
-
- if(last())
- next();
- m_bEOF = sal_True;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL ODatabaseMetaDataResultSet::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- }
- dispose();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::first( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
-
- if(!m_pRecordSet)
- return sal_False;
-
- sal_Bool bRet = SUCCEEDED(m_pRecordSet->MoveFirst());
- if ( bRet )
- m_nRowPos = 1;
- return bRet;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::last( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed );
-
-
- return m_pRecordSet && SUCCEEDED(m_pRecordSet->MoveLast()) ? sal_True : sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
-
- if(first())
- {
- OLEVariant aEmpty;
- aEmpty.setNoArg();
- sal_Bool bRet = SUCCEEDED(m_pRecordSet->Move(row,aEmpty));
- if(bRet)
- m_nRowPos = row;
- return bRet;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
-
- if(!m_pRecordSet)
- return sal_False;
-
- OLEVariant aEmpty;
- aEmpty.setNoArg();
- sal_Bool bRet = SUCCEEDED(m_pRecordSet->Move(row,aEmpty));
- if(bRet)
- m_nRowPos += row;
- return bRet;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::previous( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
-
- if(!m_pRecordSet)
- return sal_False;
-
- sal_Bool bRet = SUCCEEDED(m_pRecordSet->MovePrevious());
- if(bRet)
- --m_nRowPos;
- return bRet;
-}
-// -------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL ODatabaseMetaDataResultSet::getStatement( ) throw(SQLException, RuntimeException)
-{
- return m_aStatement.get();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowDeleted( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- checkRecordSet();
-
-
- RecordStatusEnum eRec;
- m_pRecordSet->get_Status((sal_Int32*)&eRec);
- return (eRec & adRecDeleted) == adRecDeleted;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowInserted( ) throw(SQLException, RuntimeException)
-{ ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- checkRecordSet();
-
-
- RecordStatusEnum eRec;
- m_pRecordSet->get_Status((sal_Int32*)&eRec);
- return (eRec & adRecNew) == adRecNew;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowUpdated( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- checkRecordSet();
-
-
- RecordStatusEnum eRec;
- m_pRecordSet->get_Status((sal_Int32*)&eRec);
- return (eRec & adRecModified) == adRecModified;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
-
- if(!m_pRecordSet)
- return sal_True;
-
- VARIANT_BOOL bIsAtBOF;
- m_pRecordSet->get_BOF(&bIsAtBOF);
- return bIsAtBOF == VARIANT_TRUE;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::next( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
-
- if(!m_pRecordSet)
- return sal_False;
-
- if(m_bOnFirstAfterOpen)
- {
- m_bOnFirstAfterOpen = sal_False;
- return sal_True;
- }
- else
- return SUCCEEDED(m_pRecordSet->MoveNext());
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::wasNull( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- checkRecordSet();
-
-
- return m_aValue.isNull();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL ODatabaseMetaDataResultSet::refreshRow( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- checkRecordSet();
-
-
- m_pRecordSet->Resync(adAffectCurrent,adResyncAllValues);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL ODatabaseMetaDataResultSet::cancel( ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- checkRecordSet();
-
-
- m_pRecordSet->Cancel();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL ODatabaseMetaDataResultSet::clearWarnings( ) throw(SQLException, RuntimeException)
-{
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL ODatabaseMetaDataResultSet::getWarnings( ) throw(SQLException, RuntimeException)
-{
- return Any();
-}
-//------------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaDataResultSet::getResultSetConcurrency() const
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return ResultSetConcurrency::READ_ONLY;
-}
-//------------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaDataResultSet::getResultSetType() const
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return ResultSetType::FORWARD_ONLY;
-}
-//------------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaDataResultSet::getFetchDirection() const
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return FetchDirection::FORWARD;
-}
-//------------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaDataResultSet::getFetchSize() const
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- sal_Int32 nValue=-1;
- if(m_pRecordSet)
- m_pRecordSet->get_CacheSize(&nValue);
- return nValue;
-}
-//------------------------------------------------------------------------------
-::rtl::OUString ODatabaseMetaDataResultSet::getCursorName() const
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString();
-}
-
-//------------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setFetchDirection(sal_Int32 /*_par0*/)
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "ResultSet::FetchDirection", *this );
-}
-//------------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setFetchSize(sal_Int32 _par0)
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- if(m_pRecordSet)
- m_pRecordSet->put_CacheSize(_par0);
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* ODatabaseMetaDataResultSet::createArrayHelper( ) const
-{
-
- Sequence< com::sun::star::beans::Property > aProps(5);
- com::sun::star::beans::Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP0(CURSORNAME, ::rtl::OUString);
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32);
- DECL_PROP0(RESULTSETTYPE, sal_Int32);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & ODatabaseMetaDataResultSet::getInfoHelper()
-{
- return *const_cast<ODatabaseMetaDataResultSet*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaDataResultSet::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw ::com::sun::star::lang::IllegalArgumentException();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection());
- case PROPERTY_ID_FETCHSIZE:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize());
- default:
- ;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& /*rValue*/
- )
- throw (Exception)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- throw Exception();
- break;
- default:
- OSL_FAIL("setFastPropertyValue_NoBroadcast: Illegal handle value!");
- }
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::getFastPropertyValue(
- Any& rValue,
- sal_Int32 nHandle
- ) const
-{
- switch(nHandle)
- {
- case PROPERTY_ID_CURSORNAME:
- rValue <<= getCursorName();
- break;
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- rValue <<= getResultSetConcurrency();
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- rValue <<= getResultSetType();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- rValue <<= getFetchDirection();
- break;
- case PROPERTY_ID_FETCHSIZE:
- rValue <<= getFetchSize();
- break;
- }
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setProceduresMap()
-{
-
- for(sal_Int32 i=1;i<4;i++)
- m_aColMapping.push_back(i);
- m_aColMapping.push_back(5);
- m_aColMapping.push_back(7);
- m_aColMapping.push_back(8);
- m_aColMapping.push_back(6);
- m_aColMapping.push_back(4);
-
- TInt2IntMap aMap;
- aMap[DB_PT_UNKNOWN] = ProcedureResult::UNKNOWN;
- aMap[DB_PT_PROCEDURE] = ProcedureResult::NONE;
- aMap[DB_PT_FUNCTION] = ProcedureResult::RETURN;
- m_aValueRange[4] = aMap;
-
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
- pMetaData->setProceduresMap();
- m_xMetaData = pMetaData;
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setCatalogsMap()
-{
- m_aColMapping.push_back(1);
-
- m_xMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setSchemasMap()
-{
- m_aColMapping.push_back(2);
-
- m_xMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setColumnPrivilegesMap()
-{
-
- m_aColMapping.push_back(3);
- m_aColMapping.push_back(4);
- m_aColMapping.push_back(5);
- m_aColMapping.push_back(6);
- m_aColMapping.push_back(2);
- m_aColMapping.push_back(9);
- m_aColMapping.push_back(10);
-
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
- pMetaData->setColumnPrivilegesMap();
- m_xMetaData = pMetaData;
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setColumnsMap()
-{
-
- for(sal_Int32 i=1;i<5;++i)
- m_aColMapping.push_back(i);
-
- m_aColMapping.push_back(12);
- m_aColMapping.push_back(12); // is used as TYPE_NAME
-
- m_aColMapping.push_back(14);
- m_aColMapping.push_back(6);
- m_aColMapping.push_back(17);
- m_aColMapping.push_back(18);
-
- m_aColMapping.push_back(11);
- m_aColMapping.push_back(29);
- m_aColMapping.push_back(9);
- m_aColMapping.push_back(18);
- m_aColMapping.push_back(18);
-
- m_aColMapping.push_back(15);
- m_aColMapping.push_back(7);
- m_aColMapping.push_back(11);
-
- TInt2IntMap aMap;
- aMap[adEmpty] = ADOS::MapADOType2Jdbc(adEmpty);
- aMap[adTinyInt] = ADOS::MapADOType2Jdbc(adTinyInt);
- aMap[adSmallInt] = ADOS::MapADOType2Jdbc(adSmallInt);
- aMap[adInteger] = ADOS::MapADOType2Jdbc(adInteger);
- aMap[adBigInt] = ADOS::MapADOType2Jdbc(adBigInt);
- aMap[adUnsignedTinyInt] = ADOS::MapADOType2Jdbc(adUnsignedTinyInt);
- aMap[adUnsignedSmallInt]= ADOS::MapADOType2Jdbc(adUnsignedSmallInt);
- aMap[adUnsignedInt] = ADOS::MapADOType2Jdbc(adUnsignedInt);
- aMap[adUnsignedBigInt] = ADOS::MapADOType2Jdbc(adUnsignedBigInt);
- aMap[adSingle] = ADOS::MapADOType2Jdbc(adSingle);
- aMap[adDouble] = ADOS::MapADOType2Jdbc(adDouble);
- aMap[adCurrency] = ADOS::MapADOType2Jdbc(adCurrency);
- aMap[adDecimal] = ADOS::MapADOType2Jdbc(adDecimal);
- aMap[adNumeric] = ADOS::MapADOType2Jdbc(adNumeric);
- aMap[adBoolean] = ADOS::MapADOType2Jdbc(adBoolean);
- aMap[adError] = ADOS::MapADOType2Jdbc(adError);
- aMap[adUserDefined] = ADOS::MapADOType2Jdbc(adUserDefined);
- aMap[adVariant] = ADOS::MapADOType2Jdbc(adVariant);
- aMap[adIDispatch] = ADOS::MapADOType2Jdbc(adIDispatch);
- aMap[adIUnknown] = ADOS::MapADOType2Jdbc(adIUnknown);
- aMap[adGUID] = ADOS::MapADOType2Jdbc(adGUID);
- aMap[adDate] = ADOS::MapADOType2Jdbc(adDate);
- aMap[adDBDate] = ADOS::MapADOType2Jdbc(adDBDate);
- aMap[adDBTime] = ADOS::MapADOType2Jdbc(adDBTime);
- aMap[adDBTimeStamp] = ADOS::MapADOType2Jdbc(adDBTimeStamp);
- aMap[adBSTR] = ADOS::MapADOType2Jdbc(adBSTR);
- aMap[adChar] = ADOS::MapADOType2Jdbc(adChar);
- aMap[adVarChar] = ADOS::MapADOType2Jdbc(adVarChar);
- aMap[adLongVarChar] = ADOS::MapADOType2Jdbc(adLongVarChar);
- aMap[adWChar] = ADOS::MapADOType2Jdbc(adWChar);
- aMap[adVarWChar] = ADOS::MapADOType2Jdbc(adVarWChar);
- aMap[adLongVarWChar] = ADOS::MapADOType2Jdbc(adLongVarWChar);
- aMap[adBinary] = ADOS::MapADOType2Jdbc(adBinary);
- aMap[adVarBinary] = ADOS::MapADOType2Jdbc(adVarBinary);
- aMap[adLongVarBinary] = ADOS::MapADOType2Jdbc(adLongVarBinary);
- aMap[adChapter] = ADOS::MapADOType2Jdbc(adChapter);
- aMap[adFileTime] = ADOS::MapADOType2Jdbc(adFileTime);
- aMap[adPropVariant] = ADOS::MapADOType2Jdbc(adPropVariant);
- aMap[adVarNumeric] = ADOS::MapADOType2Jdbc(adVarNumeric);
-
- m_aValueRange[12] = aMap;
-
- ::std::map< sal_Int32,::rtl::OUString> aMap2;
- aMap2[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES"));
- aMap2[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO"));
- m_aIntValueRange[18] = aMap2;
-
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
- pMetaData->setColumnsMap();
- m_xMetaData = pMetaData;
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setTablesMap()
-{
-
- for(sal_Int32 i=1;i<5;i++)
- m_aColMapping.push_back(i);
- m_aColMapping.push_back(6);
-
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
- pMetaData->setTablesMap();
- m_xMetaData = pMetaData;
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setProcedureColumnsMap()
-{
-
- for(sal_Int32 i=1;i<5;i++)
- m_aColMapping.push_back(i);
- m_aColMapping.push_back(6);
- m_aColMapping.push_back(10);
- m_aColMapping.push_back(16);
- m_aColMapping.push_back(13);
- m_aColMapping.push_back(11);
- m_aColMapping.push_back(12);
-
- m_aColMapping.push_back(9);
- m_aColMapping.push_back(14);
-
- TInt2IntMap aMap;
- aMap[DBTYPE_EMPTY] = DataType::SQLNULL;
- aMap[DBTYPE_NULL] = DataType::SQLNULL;
- aMap[DBTYPE_I2] = DataType::SMALLINT;
- aMap[DBTYPE_I4] = DataType::INTEGER;
- aMap[DBTYPE_R4] = DataType::FLOAT;
- aMap[DBTYPE_R8] = DataType::DOUBLE;
- aMap[DBTYPE_CY] = DataType::BIGINT;
- aMap[DBTYPE_DATE] = DataType::DATE;
- aMap[DBTYPE_BSTR] = DataType::VARCHAR;
- aMap[DBTYPE_IDISPATCH] = DataType::OBJECT;
- aMap[DBTYPE_ERROR] = DataType::OTHER;
- aMap[DBTYPE_BOOL] = DataType::BIT;
- aMap[DBTYPE_VARIANT] = DataType::STRUCT;
- aMap[DBTYPE_IUNKNOWN] = DataType::OTHER;
- aMap[DBTYPE_DECIMAL] = DataType::DECIMAL;
- aMap[DBTYPE_UI1] = DataType::TINYINT;
- aMap[DBTYPE_ARRAY] = DataType::ARRAY;
- aMap[DBTYPE_BYREF] = DataType::REF;
- aMap[DBTYPE_I1] = DataType::CHAR;
- aMap[DBTYPE_UI2] = DataType::SMALLINT;
- aMap[DBTYPE_UI4] = DataType::INTEGER;
-
- // aMap[The] = ;
- // aMap[in] = ;
- aMap[DBTYPE_I8] = DataType::BIGINT;
- aMap[DBTYPE_UI8] = DataType::BIGINT;
- aMap[DBTYPE_GUID] = DataType::OTHER;
- aMap[DBTYPE_VECTOR] = DataType::OTHER;
- aMap[DBTYPE_FILETIME] = DataType::OTHER;
- aMap[DBTYPE_RESERVED] = DataType::OTHER;
-
- // aMap[The] = ;
- aMap[DBTYPE_BYTES] = DataType::VARBINARY;
- aMap[DBTYPE_STR] = DataType::LONGVARCHAR;
- aMap[DBTYPE_WSTR] = DataType::LONGVARCHAR;
- aMap[DBTYPE_NUMERIC] = DataType::NUMERIC;
- aMap[DBTYPE_UDT] = DataType::OTHER;
- aMap[DBTYPE_DBDATE] = DataType::DATE;
- aMap[DBTYPE_DBTIME] = DataType::TIME;
- aMap[DBTYPE_DBTIMESTAMP] = DataType::TIMESTAMP;
- aMap[DBTYPE_HCHAPTER] = DataType::OTHER;
- aMap[DBTYPE_PROPVARIANT] = DataType::OTHER;
- aMap[DBTYPE_VARNUMERIC] = DataType::NUMERIC;
-
- m_aValueRange[10] = aMap;
-
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
- pMetaData->setProcedureColumnsMap();
- m_xMetaData = pMetaData;
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setPrimaryKeysMap()
-{
-
- sal_Int32 i=1;
- for(;i<5;i++)
- m_aColMapping.push_back(i);
- m_aColMapping.push_back(7);
- m_aColMapping.push_back(8);
-
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
- pMetaData->setProcedureColumnsMap();
- m_xMetaData = pMetaData;
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setIndexInfoMap()
-{
-
- sal_Int32 i=1;
- for(;i<4;i++)
- m_aColMapping.push_back(i);
- m_aColMapping.push_back(8);
- m_aColMapping.push_back(4);
- m_aColMapping.push_back(6);
- m_aColMapping.push_back(10);
- m_aColMapping.push_back(17);
- m_aColMapping.push_back(18);
- m_aColMapping.push_back(21);
- m_aColMapping.push_back(22);
- m_aColMapping.push_back(23);
- m_aColMapping.push_back(24);
-
- TInt2IntMap aMap;
- aMap[DBPROPVAL_IT_HASH] = IndexType::HASHED;
- aMap[DBPROPVAL_IT_CONTENT] = IndexType::OTHER;
- aMap[DBPROPVAL_IT_OTHER] = IndexType::OTHER;
- aMap[DBPROPVAL_IT_BTREE] = IndexType::OTHER;
-
- m_aValueRange[10] = aMap;
-
- TInt2IntMap aMap2;
- aMap[0] = 1;
- aMap[1] = 0;
- m_aValueRange[8] = aMap2;
-
- ::std::map< sal_Int32,::rtl::OUString> aMap3;
- aMap3[0] = ::rtl::OUString();
- aMap3[DB_COLLATION_ASC] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("A"));
- aMap3[DB_COLLATION_DESC] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("D"));
-
- m_aIntValueRange[21] = aMap3;
-
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
- pMetaData->setIndexInfoMap();
- m_xMetaData = pMetaData;
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setTablePrivilegesMap()
-{
-
- sal_Int32 i=3;
- for(;i<6;i++)
- m_aColMapping.push_back(i);
- m_aColMapping.push_back(1);
- m_aColMapping.push_back(2);
- m_aColMapping.push_back(6);
- m_aColMapping.push_back(7);
-
- ::std::map< sal_Int32,::rtl::OUString> aMap;
- aMap[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES"));
- aMap[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO"));
- m_aIntValueRange[7] = aMap;
-
-
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
- pMetaData->setTablePrivilegesMap();
- m_xMetaData = pMetaData;
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setCrossReferenceMap()
-{
-
- sal_Int32 i=1;
- for(;i<5;i++)
- m_aColMapping.push_back(i);
- for(i=7;i<11;i++)
- m_aColMapping.push_back(i);
-
- m_aColMapping.push_back(13);
- m_aColMapping.push_back(14);
- m_aColMapping.push_back(15);
- m_aColMapping.push_back(17);
- m_aColMapping.push_back(16);
- m_aColMapping.push_back(18);
-
- ::std::map< ::rtl::OUString,sal_Int32> aMap;
- aMap[ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CASCADE"))] = KeyRule::CASCADE;
- aMap[ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RESTRICT"))] = KeyRule::RESTRICT;
- aMap[ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SET NULL"))] = KeyRule::SET_NULL;
- aMap[ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SET DEFAULT"))] = KeyRule::SET_DEFAULT;
- aMap[ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO ACTION"))] = KeyRule::NO_ACTION;
-
- m_aStrValueRange[14] = aMap;
- m_aStrValueRange[15] = aMap;
-
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
- pMetaData->setCrossReferenceMap();
- m_xMetaData = pMetaData;
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setTypeInfoMap(sal_Bool _bJetEngine)
-{
- sal_Int32 i=1;
- for(;i<19;i++)
- m_aColMapping.push_back(i);
-
- ::std::map< ::rtl::OUString,sal_Int32> aMap1;
- aMap1[ ::rtl::OUString()] = 10;
-
- m_aStrValueRange[18] = aMap1;
-
- TInt2IntMap aMap;
- aMap[adEmpty] = ADOS::MapADOType2Jdbc(adEmpty);
- aMap[adTinyInt] = ADOS::MapADOType2Jdbc(adTinyInt);
- aMap[adSmallInt] = ADOS::MapADOType2Jdbc(adSmallInt);
- aMap[adInteger] = ADOS::MapADOType2Jdbc(adInteger);
- aMap[adBigInt] = ADOS::MapADOType2Jdbc(adBigInt);
- aMap[adUnsignedTinyInt] = ADOS::MapADOType2Jdbc(adUnsignedTinyInt);
- aMap[adUnsignedSmallInt]= ADOS::MapADOType2Jdbc(adUnsignedSmallInt);
- aMap[adUnsignedInt] = ADOS::MapADOType2Jdbc(adUnsignedInt);
- aMap[adUnsignedBigInt] = ADOS::MapADOType2Jdbc(adUnsignedBigInt);
- aMap[adSingle] = ADOS::MapADOType2Jdbc(adSingle);
- aMap[adDouble] = ADOS::MapADOType2Jdbc(adDouble);
- aMap[adCurrency] = ADOS::MapADOType2Jdbc(adCurrency);
- aMap[adDecimal] = ADOS::MapADOType2Jdbc(adDecimal);
- aMap[adNumeric] = ADOS::MapADOType2Jdbc(adNumeric);
- aMap[adBoolean] = ADOS::MapADOType2Jdbc(adBoolean);
- aMap[adError] = ADOS::MapADOType2Jdbc(adError);
- aMap[adUserDefined] = ADOS::MapADOType2Jdbc(adUserDefined);
- aMap[adVariant] = ADOS::MapADOType2Jdbc(adVariant);
- aMap[adIDispatch] = ADOS::MapADOType2Jdbc(adIDispatch);
- aMap[adIUnknown] = ADOS::MapADOType2Jdbc(adIUnknown);
- aMap[adGUID] = ADOS::MapADOType2Jdbc(adGUID);
- aMap[adDate] = _bJetEngine ? ADOS::MapADOType2Jdbc(adDBTimeStamp) : ADOS::MapADOType2Jdbc(adDate);
- aMap[adDBDate] = ADOS::MapADOType2Jdbc(adDBDate);
- aMap[adDBTime] = ADOS::MapADOType2Jdbc(adDBTime);
- aMap[adDBTimeStamp] = ADOS::MapADOType2Jdbc(adDBTimeStamp);
- aMap[adBSTR] = ADOS::MapADOType2Jdbc(adBSTR);
- aMap[adChar] = ADOS::MapADOType2Jdbc(adChar);
- aMap[adVarChar] = ADOS::MapADOType2Jdbc(adVarChar);
- aMap[adLongVarChar] = ADOS::MapADOType2Jdbc(adLongVarChar);
- aMap[adWChar] = ADOS::MapADOType2Jdbc(adWChar);
- aMap[adVarWChar] = ADOS::MapADOType2Jdbc(adVarWChar);
- aMap[adLongVarWChar] = ADOS::MapADOType2Jdbc(adLongVarWChar);
- aMap[adBinary] = ADOS::MapADOType2Jdbc(adBinary);
- aMap[adVarBinary] = ADOS::MapADOType2Jdbc(adVarBinary);
- aMap[adLongVarBinary] = ADOS::MapADOType2Jdbc(adLongVarBinary);
- aMap[adChapter] = ADOS::MapADOType2Jdbc(adChapter);
- aMap[adFileTime] = ADOS::MapADOType2Jdbc(adFileTime);
- aMap[adPropVariant] = ADOS::MapADOType2Jdbc(adPropVariant);
- aMap[adVarNumeric] = ADOS::MapADOType2Jdbc(adVarNumeric);
-// aMap[adArray] = ADOS::MapADOType2Jdbc(adArray);
-
- m_aValueRange[2] = aMap;
-
- TInt2IntMap aColumnValueMapping;
- aColumnValueMapping[VARIANT_FALSE] = ColumnValue::NO_NULLS;
- aColumnValueMapping[VARIANT_TRUE] = ColumnValue::NULLABLE;
- m_aValueRange[7] = aColumnValueMapping;
-
- // now adjust the column mapping
- // OJ 24.01.2002 96860
- TInt2IntMap aSerachMapping;
- aSerachMapping[DB_UNSEARCHABLE] = ColumnSearch::NONE;
- aSerachMapping[DB_LIKE_ONLY] = ColumnSearch::CHAR;
- aSerachMapping[DB_ALL_EXCEPT_LIKE] = ColumnSearch::BASIC;
- aSerachMapping[DB_SEARCHABLE] = ColumnSearch::FULL;
-
- m_aValueRange[9] = aSerachMapping;
-
- TInt2IntMap aCurrencyMapping;
- m_aValueRange[11] = aCurrencyMapping;
-
- ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
- pMetaData->setTypeInfoMap();
- m_xMetaData = pMetaData;
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL ODatabaseMetaDataResultSet::acquire() throw()
-{
- ODatabaseMetaDataResultSet_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL ODatabaseMetaDataResultSet::release() throw()
-{
- ODatabaseMetaDataResultSet_BASE::release();
-}
-// -----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL ODatabaseMetaDataResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-OLEVariant ODatabaseMetaDataResultSet::getValue(sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
-
- checkRecordSet();
-
- WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex);
- aField.get_Value(m_aValue);
- return m_aValue;
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx
deleted file mode 100644
index e39ea65ead..0000000000
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx
+++ /dev/null
@@ -1,235 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/ADatabaseMetaDataResultSetMetaData.hxx"
-#include "ado/Awrapado.hxx"
-#include "connectivity/dbexception.hxx"
-
-
-using namespace connectivity;
-using namespace connectivity::ado;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-
-// -------------------------------------------------------------------------
-ODatabaseMetaDataResultSetMetaData::~ODatabaseMetaDataResultSetMetaData()
-{
- if(m_pRecordSet)
- m_pRecordSet->Release();
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nSize = 0;
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- nSize = (*m_mColumnsIter).second.getColumnDisplaySize();
- else if(m_pRecordSet)
- {
- WpADOField aField = ADOS::getField(m_pRecordSet,m_vMapping[column]);
- if(aField.IsValid())
- nSize = aField.GetActualSize();
- }
- return nSize;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nType = 0;
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- nType = (*m_mColumnsIter).second.getColumnType();
- else if(m_pRecordSet)
- {
- WpADOField aField = ADOS::getField(m_pRecordSet,m_vMapping[column]);
- nType = ADOS::MapADOType2Jdbc(aField.GetADOType());
- }
- return nType;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException)
-{
- if(!m_pRecordSet)
- return 0;
- if(m_nColCount != -1)
- return m_nColCount;
-
- if(m_vMapping.size())
- return m_mColumns.size();
-
- ADOFields* pFields = NULL;
- m_pRecordSet->get_Fields(&pFields);
- WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(pFields);
- m_nColCount = aFields.GetItemCount();
- return m_nColCount;
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.getColumnName();
- if(!m_pRecordSet)
- return ::rtl::OUString();
- WpADOField aField = ADOS::getField(m_pRecordSet,m_vMapping[column]);
- if(aField.IsValid())
- return aField.GetName();
-
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.getColumnLabel();
- return getColumnName(column);
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.isCurrency();
- if(!m_pRecordSet)
- return 0;
- WpADOField aField = ADOS::getField(m_pRecordSet,m_vMapping[column]);
- if(aField.IsValid())
- {
- return (aField.GetAttributes() & adFldFixed) == adFldFixed;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.isSigned();
- if(!m_pRecordSet)
- return 0;
- WpADOField aField = ADOS::getField(m_pRecordSet,m_vMapping[column]);
- if(aField.IsValid())
- {
- return (aField.GetAttributes() & adFldNegativeScale) == adFldNegativeScale;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.getPrecision();
- if(!m_pRecordSet)
- return 0;
- WpADOField aField = ADOS::getField(m_pRecordSet,m_vMapping[column]);
- if(aField.IsValid())
- return aField.GetPrecision();
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.getScale();
-
- if(!m_pRecordSet)
- return 0;
-
- WpADOField aField = ADOS::getField(m_pRecordSet,m_vMapping[column]);
- if(aField.IsValid())
- return aField.GetNumericScale();
- return 0;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.isNullable();
-
- if(!m_pRecordSet)
- return 0;
-
- WpADOField aField = ADOS::getField(m_pRecordSet,m_vMapping[column]);
- if(aField.IsValid())
- {
- return (aField.GetAttributes() & adFldIsNullable) == adFldIsNullable;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.isReadOnly();
-
- if(!m_pRecordSet)
- return 0;
-
- WpADOField aField = ADOS::getField(m_pRecordSet,m_vMapping[column]);
- if(aField.IsValid())
- {
- // return (aField.GetStatus() & adFieldReadOnly) == adFieldReadOnly;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.isDefinitelyWritable();
-
- if(!m_pRecordSet)
- return 0;
-
- WpADOField aField = ADOS::getField(m_pRecordSet,m_vMapping[column]);
- if(aField.IsValid())
- {
- return (aField.GetAttributes() & adFldUpdatable) == adFldUpdatable;
- }
- return sal_False;
-;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
- return (*m_mColumnsIter).second.isWritable();
- return isDefinitelyWritable(column);
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx
deleted file mode 100644
index d209629020..0000000000
--- a/connectivity/source/drivers/ado/ADriver.cxx
+++ /dev/null
@@ -1,306 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#define _WIN32_WINNT 0x0501
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/ADriver.hxx"
-#include "ado/AConnection.hxx"
-#include "ado/Awrapadox.hxx"
-#include "ado/ACatalog.hxx"
-#include "ado/Awrapado.hxx"
-#include "ado/adoimp.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "connectivity/dbexception.hxx"
-#include "resource/ado_res.hrc"
-#include <objbase.h>
-
-
-#include "resource/sharedresources.hxx"
-
-using namespace connectivity;
-using namespace connectivity::ado;
-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::lang;
-
-// --------------------------------------------------------------------------------
-// --------------------------------------------------------------------------------
-ODriver::ODriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB)
- : ODriver_BASE(m_aMutex)
- ,m_xORB(_xORB)
-{
- if ( FAILED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)) )
- {
- CoUninitialize();
- int h = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
- (void)h;
- ++h;
- }
-}
-// -------------------------------------------------------------------------
-ODriver::~ODriver()
-{
- CoUninitialize();
- CoInitialize(NULL);
-}
-//------------------------------------------------------------------------------
-void ODriver::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
-
- for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
- {
- Reference< XComponent > xComp(i->get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- }
- m_xConnections.clear();
-
- ODriver_BASE::disposing();
-}
-// static ServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString ODriver::getImplementationName_Static( ) throw(RuntimeException)
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sdbc.ado.ODriver"));
-}
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > ODriver::getSupportedServiceNames_Static( ) throw (RuntimeException)
-{
- Sequence< ::rtl::OUString > aSNS( 2 );
- aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver"));
- aSNS[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.Driver"));
- return aSNS;
-}
-//------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::ado::ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
-{
- return *(new ODriver(_rxFactory));
-}
-
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException)
-{
- return getImplementationName_Static();
-}
-
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL ODriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-
-// --------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL ODriver::getSupportedServiceNames( ) throw(RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-
-// --------------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
-{
- if ( ! acceptsURL(url) )
- return NULL;
-
- OConnection* pCon = new OConnection(this);
- pCon->construct(url,info);
- Reference< XConnection > xCon = pCon;
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
-
- return xCon;
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url )
- throw(SQLException, RuntimeException)
-{
- return (!url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:ado:")),9));
-}
-// -----------------------------------------------------------------------------
-void ODriver::impl_checkURL_throw(const ::rtl::OUString& _sUrl)
-{
- if ( !acceptsURL(_sUrl) )
- {
- SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- } // if ( !acceptsURL(_sUrl) )
-}
-// --------------------------------------------------------------------------------
-Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException)
-{
- impl_checkURL_throw(url);
- if ( acceptsURL(url) )
- {
- ::std::vector< DriverPropertyInfo > aDriverInfo;
-
- Sequence< ::rtl::OUString > aBooleanValues(2);
- aBooleanValues[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) );
- aBooleanValues[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
-
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreDriverPrivileges"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Ignore the privileges from the database driver."))
- ,sal_False
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) )
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EscapeDateTime"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Escape date time format."))
- ,sal_False
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) )
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TypeInfoSettings"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Defines how the type info of the database metadata should be manipulated."))
- ,sal_False
- ,::rtl::OUString( )
- ,Sequence< ::rtl::OUString > ())
- );
- return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size());
- }
- return Sequence< DriverPropertyInfo >();
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODriver::getMajorVersion( ) throw(RuntimeException)
-{
- return 1;
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODriver::getMinorVersion( ) throw(RuntimeException)
-{
- return 0;
-}
-// --------------------------------------------------------------------------------
-// XDataDefinitionSupplier
-Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByConnection( const Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if (ODriver_BASE::rBHelper.bDisposed)
- throw DisposedException();
-
- OConnection* pConnection = NULL;
- Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(connection,UNO_QUERY);
- if(xTunnel.is())
- {
- OConnection* pSearchConnection = reinterpret_cast< OConnection* >( xTunnel->getSomething(OConnection::getUnoTunnelImplementationId()) );
-
- for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
- {
- if ((OConnection*) Reference< XConnection >::query(i->get().get()).get() == pSearchConnection)
- {
- pConnection = pSearchConnection;
- break;
- }
- }
-
- }
-
- Reference< XTablesSupplier > xTab = NULL;
- if(pConnection)
- {
- WpADOCatalog aCatalog;
- aCatalog.Create();
- if(aCatalog.IsValid())
- {
- aCatalog.putref_ActiveConnection(*pConnection->getConnection());
- OCatalog* pCatalog = new OCatalog(aCatalog,pConnection);
- xTab = pCatalog;
- pConnection->setCatalog(xTab);
- pConnection->setCatalog(pCatalog);
- }
- }
- return xTab;
-}
-// --------------------------------------------------------------------------------
-Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- impl_checkURL_throw(url);
- return getDataDefinitionByConnection(connect(url,info));
-}
-
-// -----------------------------------------------------------------------------
-void ADOS::ThrowException(ADOConnection* _pAdoCon,const Reference< XInterface >& _xInterface) throw(SQLException, RuntimeException)
-{
- ADOErrors *pErrors = NULL;
- _pAdoCon->get_Errors(&pErrors);
- if(!pErrors)
- return; // no error found
-
- pErrors->AddRef( );
-
- // read all noted errors and issue them
- sal_Int32 nLen;
- pErrors->get_Count(&nLen);
- if (nLen)
- {
- ::rtl::OUString sError;
- ::rtl::OUString aSQLState;
- SQLException aException;
- aException.ErrorCode = 1000;
- for (sal_Int32 i = nLen-1; i>=0; --i)
- {
- ADOError *pError = NULL;
- pErrors->get_Item(OLEVariant(i),&pError);
- WpADOError aErr(pError);
- OSL_ENSURE(pError,"No error in collection found! BAD!");
- if(pError)
- {
- if(i==nLen-1)
- aException = SQLException(aErr.GetDescription(),_xInterface,aErr.GetSQLState(),aErr.GetNumber(),Any());
- else
- {
- SQLException aTemp = SQLException(aErr.GetDescription(),
- _xInterface,aErr.GetSQLState(),aErr.GetNumber(),makeAny(aException));
- aTemp.NextException <<= aException;
- aException = aTemp;
- }
- }
- }
- pErrors->Clear();
- pErrors->Release();
- throw aException;
- }
- pErrors->Release();
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AGroup.cxx b/connectivity/source/drivers/ado/AGroup.cxx
deleted file mode 100644
index d02204b1ec..0000000000
--- a/connectivity/source/drivers/ado/AGroup.cxx
+++ /dev/null
@@ -1,190 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "ado/AGroup.hxx"
-#include "ado/AUsers.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include "ado/AConnection.hxx"
-#include "TConnection.hxx"
-
-using namespace connectivity::ado;
-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;
-
-// -------------------------------------------------------------------------
-void WpADOGroup::Create()
-{
- HRESULT hr = -1;
- ADOGroup* pGroup = NULL;
- hr = CoCreateInstance(ADOS::CLSID_ADOGROUP_25,
- NULL,
- CLSCTX_INPROC_SERVER,
- ADOS::IID_ADOGROUP_25,
- (void**)&pGroup );
-
-
- if( !FAILED( hr ) )
- {
- operator=( pGroup );
- pGroup->Release();
- }
-}
-// -------------------------------------------------------------------------
-OAdoGroup::OAdoGroup(OCatalog* _pParent,sal_Bool _bCase, ADOGroup* _pGroup) : OGroup_ADO(_bCase),m_pCatalog(_pParent)
-{
- construct();
- if(_pGroup)
- m_aGroup = WpADOGroup(_pGroup);
- else
- m_aGroup.Create();
-
-}
-// -------------------------------------------------------------------------
-OAdoGroup::OAdoGroup(OCatalog* _pParent,sal_Bool _bCase, const ::rtl::OUString& _Name) : OGroup_ADO(_Name,_bCase),m_pCatalog(_pParent)
-{
- construct();
- m_aGroup.Create();
- m_aGroup.put_Name(_Name);
-}
-// -------------------------------------------------------------------------
-void OAdoGroup::refreshUsers()
-{
- TStringVector aVector;
-
- WpADOUsers aUsers = m_aGroup.get_Users();
- aUsers.fillElementNames(aVector);
-
- if(m_pUsers)
- m_pUsers->reFill(aVector);
- else
- m_pUsers = new OUsers(m_pCatalog,m_aMutex,aVector,aUsers,isCaseSensitive());
-}
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OAdoGroup::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OAdoGroup::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : OGroup_ADO::getSomething(rId);
-}
-
-// -------------------------------------------------------------------------
-void OAdoGroup::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception)
-{
- if(m_aGroup.IsValid())
- {
-
- switch(nHandle)
- {
- case PROPERTY_ID_NAME:
- {
- ::rtl::OUString aVal;
- rValue >>= aVal;
- m_aGroup.put_Name(aVal);
- }
- break;
- }
- }
-}
-// -------------------------------------------------------------------------
-void OAdoGroup::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
-{
- if(m_aGroup.IsValid())
- {
- switch(nHandle)
- {
- case PROPERTY_ID_NAME:
- rValue <<= m_aGroup.get_Name();
- break;
- }
- }
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OAdoGroup::getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- return MapRight(m_aGroup.GetPermissions(objName,MapObjectType(objType)));
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OAdoGroup::getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- RightsEnum eNum = m_aGroup.GetPermissions(objName,MapObjectType(objType));
- if(eNum & adRightWithGrant)
- return MapRight(eNum);
- return 0;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OAdoGroup::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- m_aGroup.SetPermissions(objName,MapObjectType(objType),adAccessGrant,Map2Right(objPrivileges));
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OAdoGroup::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- m_aGroup.SetPermissions(objName,MapObjectType(objType),adAccessDeny,Map2Right(objPrivileges));
-}
-
-// -----------------------------------------------------------------------------
-void SAL_CALL OAdoGroup::acquire() throw()
-{
- OGroup_ADO::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OAdoGroup::release() throw()
-{
- OGroup_ADO::release();
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AGroups.cxx b/connectivity/source/drivers/ado/AGroups.cxx
deleted file mode 100644
index 269a315daa..0000000000
--- a/connectivity/source/drivers/ado/AGroups.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/AGroups.hxx"
-#include "ado/AGroup.hxx"
-#include "ado/ATable.hxx"
-#include "ado/AConnection.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include "connectivity/sdbcx/IRefreshable.hxx"
-#include "TConnection.hxx"
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-#include "resource/ado_res.hrc"
-
-using namespace comphelper;
-using namespace connectivity;
-using namespace connectivity::ado;
-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;
-
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-// -------------------------------------------------------------------------
-sdbcx::ObjectType OGroups::createObject(const ::rtl::OUString& _rName)
-{
- return new OAdoGroup(m_pCatalog,isCaseSensitive(),_rName);
-}
-// -------------------------------------------------------------------------
-void OGroups::impl_refresh() throw(RuntimeException)
-{
- m_aCollection.Refresh();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OGroups::createDescriptor()
-{
- return new OAdoGroup(m_pCatalog,isCaseSensitive());
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OGroups::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- OAdoGroup* pGroup = NULL;
- if ( !getImplementation(pGroup,descriptor) || pGroup == NULL )
- m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_GROUP_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
-
- m_aCollection.Append( pGroup->getImpl() );
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OGroups::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName)
-{
- m_aCollection.Delete(_sElementName);
-}
-// -----------------------------------------------------------------------------
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AIndex.cxx b/connectivity/source/drivers/ado/AIndex.cxx
deleted file mode 100644
index 906d03fb23..0000000000
--- a/connectivity/source/drivers/ado/AIndex.cxx
+++ /dev/null
@@ -1,159 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/AIndex.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include "ado/AColumns.hxx"
-#include <comphelper/extract.hxx>
-#include "TConnection.hxx"
-#include <comphelper/types.hxx>
-
-using namespace ::comphelper;
-
-using namespace connectivity::ado;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-
-// -------------------------------------------------------------------------
-OAdoIndex::OAdoIndex(sal_Bool _bCase,OConnection* _pConnection,ADOIndex* _pIndex)
- : OIndex_ADO(::rtl::OUString(),::rtl::OUString(),sal_False,sal_False,sal_False,_bCase)
- ,m_pConnection(_pConnection)
-{
- construct();
- m_aIndex = WpADOIndex(_pIndex);
- fillPropertyValues();
-}
-// -------------------------------------------------------------------------
-OAdoIndex::OAdoIndex(sal_Bool _bCase,OConnection* _pConnection)
- : OIndex_ADO(_bCase)
- ,m_pConnection(_pConnection)
-{
- construct();
- m_aIndex.Create();
-}
-
-// -------------------------------------------------------------------------
-
-void OAdoIndex::refreshColumns()
-{
- TStringVector aVector;
-
- WpADOColumns aColumns;
- if ( m_aIndex.IsValid() )
- {
- aColumns = m_aIndex.get_Columns();
- aColumns.fillElementNames(aVector);
- }
-
- if ( m_pColumns )
- m_pColumns->reFill(aVector);
- else
- m_pColumns = new OColumns(*this,m_aMutex,aVector,aColumns,isCaseSensitive(),m_pConnection);
-}
-
-// -------------------------------------------------------------------------
-Sequence< sal_Int8 > OAdoIndex::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OAdoIndex::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : OIndex_ADO::getSomething(rId);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OAdoIndex::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception)
-{
- if(m_aIndex.IsValid())
- {
- switch(nHandle)
- {
- case PROPERTY_ID_NAME:
- {
- ::rtl::OUString aVal;
- rValue >>= aVal;
- m_aIndex.put_Name(aVal);
- }
- break;
- case PROPERTY_ID_CATALOG:
- {
- ::rtl::OUString aVal;
- rValue >>= aVal;
- m_aIndex.put_Name(aVal);
- }
- break;
- case PROPERTY_ID_ISUNIQUE:
- m_aIndex.put_Unique(getBOOL(rValue));
- break;
- case PROPERTY_ID_ISPRIMARYKEYINDEX:
- m_aIndex.put_PrimaryKey(getBOOL(rValue));
- break;
- case PROPERTY_ID_ISCLUSTERED:
- m_aIndex.put_Clustered(getBOOL(rValue));
- break;
- }
- }
- OIndex_ADO::setFastPropertyValue_NoBroadcast(nHandle,rValue);
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OAdoIndex::acquire() throw()
-{
- OIndex_ADO::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OAdoIndex::release() throw()
-{
- OIndex_ADO::release();
-}
-// -----------------------------------------------------------------------------
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AIndexes.cxx b/connectivity/source/drivers/ado/AIndexes.cxx
deleted file mode 100644
index 7b645e6223..0000000000
--- a/connectivity/source/drivers/ado/AIndexes.cxx
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/AIndexes.hxx"
-#include "ado/AIndex.hxx"
-#include "ado/AConnection.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/IndexType.hpp>
-#include "TConnection.hxx"
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-#include "resource/ado_res.hrc"
-using namespace ::comphelper;
-
-
-using namespace connectivity;
-using namespace connectivity::ado;
-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;
-
-sdbcx::ObjectType OIndexes::createObject(const ::rtl::OUString& _rName)
-{
- return new OAdoIndex(isCaseSensitive(),m_pConnection,m_aCollection.GetItem(_rName));
-}
-// -------------------------------------------------------------------------
-void OIndexes::impl_refresh() throw(RuntimeException)
-{
- m_aCollection.Refresh();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OIndexes::createDescriptor()
-{
- return new OAdoIndex(isCaseSensitive(),m_pConnection);
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OIndexes::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- OAdoIndex* pIndex = NULL;
- if ( !getImplementation(pIndex,descriptor) || pIndex == NULL )
- m_pConnection->throwGenericSQLException( STR_INVALID_INDEX_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
-
- ADOIndexes* pIndexes = m_aCollection;
- if ( FAILED( pIndexes->Append( OLEVariant( _rForName ), OLEVariant( pIndex->getImpl() ) ) ) )
- {
- ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
- m_pConnection->throwGenericSQLException( STR_INVALID_INDEX_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
- }
-
- return new OAdoIndex(isCaseSensitive(),m_pConnection,pIndex->getImpl());
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OIndexes::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName)
-{
- m_aCollection.Delete(_sElementName);
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AKey.cxx b/connectivity/source/drivers/ado/AKey.cxx
deleted file mode 100644
index 6407881fd4..0000000000
--- a/connectivity/source/drivers/ado/AKey.cxx
+++ /dev/null
@@ -1,169 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/AKey.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include "ado/AColumns.hxx"
-#include "ado/AConnection.hxx"
-
-using namespace connectivity::ado;
-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;
-
-// -------------------------------------------------------------------------
-OAdoKey::OAdoKey(sal_Bool _bCase,OConnection* _pConnection, ADOKey* _pKey)
- : OKey_ADO(_bCase)
- ,m_pConnection(_pConnection)
-{
- construct();
- m_aKey = WpADOKey(_pKey);
- fillPropertyValues();
-}
-// -------------------------------------------------------------------------
-OAdoKey::OAdoKey(sal_Bool _bCase,OConnection* _pConnection)
- : OKey_ADO(_bCase)
- ,m_pConnection(_pConnection)
-{
- construct();
- m_aKey.Create();
-}
-// -------------------------------------------------------------------------
-void OAdoKey::refreshColumns()
-{
- TStringVector aVector;
-
- WpADOColumns aColumns;
- if ( m_aKey.IsValid() )
- {
- aColumns = m_aKey.get_Columns();
- aColumns.fillElementNames(aVector);
- }
-
- if(m_pColumns)
- m_pColumns->reFill(aVector);
- else
- m_pColumns = new OColumns(*this,m_aMutex,aVector,aColumns,isCaseSensitive(),m_pConnection);
-}
-// -------------------------------------------------------------------------
-Sequence< sal_Int8 > OAdoKey::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OAdoKey::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : OKey_ADO::getSomething(rId);
-}
-// -------------------------------------------------------------------------
-void OAdoKey::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception)
-{
- if(m_aKey.IsValid())
- {
- switch(nHandle)
- {
- case PROPERTY_ID_NAME:
- {
- ::rtl::OUString aVal;
- rValue >>= aVal;
- m_aKey.put_Name(aVal);
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
- }
- break;
- case PROPERTY_ID_TYPE:
- {
- sal_Int32 nVal=0;
- rValue >>= nVal;
- m_aKey.put_Type(Map2KeyRule(nVal));
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
- }
- break;
- case PROPERTY_ID_REFERENCEDTABLE:
- {
- ::rtl::OUString aVal;
- rValue >>= aVal;
- m_aKey.put_RelatedTable(aVal);
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
- }
- break;
- case PROPERTY_ID_UPDATERULE:
- {
- sal_Int32 nVal=0;
- rValue >>= nVal;
- m_aKey.put_UpdateRule(Map2Rule(nVal));
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
- }
- break;
- case PROPERTY_ID_DELETERULE:
- {
- sal_Int32 nVal=0;
- rValue >>= nVal;
- m_aKey.put_DeleteRule(Map2Rule(nVal));
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
- }
- break;
- }
- }
- OKey_ADO::setFastPropertyValue_NoBroadcast(nHandle,rValue);
-}
-// -------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-void SAL_CALL OAdoKey::acquire() throw()
-{
- OKey_ADO::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OAdoKey::release() throw()
-{
- OKey_ADO::release();
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AKeyColumn.cxx b/connectivity/source/drivers/ado/AKeyColumn.cxx
deleted file mode 100644
index ff0bb3cafd..0000000000
--- a/connectivity/source/drivers/ado/AKeyColumn.cxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "adabas/BKeyColumn.hxx"
-
-using namespace connectivity::adabas;
-namespace starbeans = ::com::sun::star::beans;
-// -------------------------------------------------------------------------
-OKeyColumn::OKeyColumn() : OColumn()
-{
- construct();
-}
-// -------------------------------------------------------------------------
-OKeyColumn::OKeyColumn( const ::rtl::OUString& _ReferencedColumn,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _TypeName,
- const ::rtl::OUString& _DefaultValue,
- sal_Int32 _IsNullable,
- sal_Int32 _Precision,
- sal_Int32 _Scale,
- sal_Int32 _Type,
- sal_Bool _IsAutoIncrement
- ) : OColumn(_Name,
- _TypeName,
- _DefaultValue,
- _IsNullable,
- _Precision,
- _Scale,
- _Type,
- _IsAutoIncrement)
- , m_ReferencedColumn(_ReferencedColumn)
-{
- construct();
-}
-
-// -------------------------------------------------------------------------
-void OKeyColumn::construct()
-{
- sal_Int32 nAttrib = isNew() ? 0 : starbeans::PropertyAttribute::READONLY;
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RELATEDCOLUMN), PROPERTY_ID_RELATEDCOLUMN, nAttrib,&m_ReferencedColumn, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AKeyColumns.cxx b/connectivity/source/drivers/ado/AKeyColumns.cxx
deleted file mode 100644
index f7449bf1a3..0000000000
--- a/connectivity/source/drivers/ado/AKeyColumns.cxx
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "adabas/BKeyColumns.hxx"
-#include "adabas/BKeyColumn.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include "adabas/BTable.hxx"
-
-using namespace connectivity::adabas;
-// -------------------------------------------------------------------------
-sdbcx::ObjectType OKeyColumns::createObject(const ::rtl::OUString& _rName)
-{
-
- Reference< starsdbc::XResultSet >
- xResult = m_pTable->getConnection()->getMetaData()->getImportedKeys(Any(),
- m_pTable->getSchema(),m_pTable->getName());
-
- ::rtl::OUString aRefColumnName;
- if(xResult.is())
- {
- Reference< starsdbc::XRow > xRow(xResult,UNO_QUERY);
- while(xResult->next())
- {
- if(xRow->getString(8) == _rName)
- {
- aRefColumnName = xRow->getString(4);
- break;
- }
- }
- }
-
- xResult = m_pTable->getConnection()->getMetaData()->getColumns(Any(),
- m_pTable->getSchema(),m_pTable->getName(),_rName);
-
- sdbcx::ObjectType xRet = NULL;
- if(xResult.is())
- {
- Reference< starsdbc::XRow > xRow(xResult,UNO_QUERY);
- if(xResult->next())
- {
- if(xRow->getString(4) == _rName)
- {
- OKeyColumn* pRet = new OKeyColumn(aRefColumnName,
- _rName,
- xRow->getString(6),
- xRow->getString(13),
- xRow->getInt(11),
- xRow->getInt(7),
- xRow->getInt(9),
- xRow->getInt(5),
- sal_False);
- xRet = pRet;
- }
- }
- }
-
- return xRet;
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OKeyColumns::createDescriptor()
-{
- OKeyColumn* pNew = new OKeyColumn();
- return pNew;
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AKeys.cxx b/connectivity/source/drivers/ado/AKeys.cxx
deleted file mode 100644
index cfdd4a82d8..0000000000
--- a/connectivity/source/drivers/ado/AKeys.cxx
+++ /dev/null
@@ -1,115 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/AKeys.hxx"
-#include "ado/AKey.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include "ado/AConnection.hxx"
-#include <comphelper/types.hxx>
-#include "ado/Awrapado.hxx"
-#include <comphelper/property.hxx>
-#include <connectivity/dbexception.hxx>
-#include "resource/ado_res.hrc"
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::ado;
-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;
-
-sdbcx::ObjectType OKeys::createObject(const ::rtl::OUString& _rName)
-{
- return new OAdoKey(isCaseSensitive(),m_pConnection,m_aCollection.GetItem(_rName));
-}
-// -------------------------------------------------------------------------
-void OKeys::impl_refresh() throw(RuntimeException)
-{
- m_aCollection.Refresh();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OKeys::createDescriptor()
-{
- return new OAdoKey(isCaseSensitive(),m_pConnection);
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OKeys::appendObject( const ::rtl::OUString&, const Reference< XPropertySet >& descriptor )
-{
- OAdoKey* pKey = NULL;
- if ( !getImplementation( pKey, descriptor ) || pKey == NULL)
- m_pConnection->throwGenericSQLException( STR_INVALID_KEY_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
-
- // To pass as column parameter to Key's Apppend method
- OLEVariant vOptional;
- vOptional.setNoArg();
-
-#if OSL_DEBUG_LEVEL > 0
- KeyTypeEnum eKey =
-#endif
- OAdoKey::Map2KeyRule(getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))));
-#if OSL_DEBUG_LEVEL > 0
- (void)eKey;
-#endif
-
- WpADOKey aKey = pKey->getImpl();
- ::rtl::OUString sName = aKey.get_Name();
- if(!sName.getLength())
- aKey.put_Name(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrimaryKey")) );
-
- ADOKeys* pKeys = m_aCollection;
- if ( FAILED(pKeys->Append(OLEVariant((ADOKey*)aKey),
- adKeyPrimary, // must be every time adKeyPrimary
- vOptional)) )
- {
- ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
- // just make sure that an SQLExceptionis thrown here
- m_pConnection->throwGenericSQLException( STR_INVALID_KEY_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
- }
-
- return new OAdoKey(isCaseSensitive(),m_pConnection,pKey->getImpl());
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OKeys::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName)
-{
- if(!m_aCollection.Delete(OLEVariant(_sElementName)))
- ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/APreparedStatement.cxx b/connectivity/source/drivers/ado/APreparedStatement.cxx
deleted file mode 100644
index eabdef9430..0000000000
--- a/connectivity/source/drivers/ado/APreparedStatement.cxx
+++ /dev/null
@@ -1,566 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "connectivity/sqlparse.hxx"
-#include "ado/APreparedStatement.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include "ado/AResultSetMetaData.hxx"
-#include "ado/AResultSet.hxx"
-#include "ado/ADriver.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include "connectivity/dbexception.hxx"
-#include "connectivity/dbtools.hxx"
-#include "resource/ado_res.hrc"
-
-#include <limits>
-
-#define CHECK_RETURN(x) \
- if(!x) \
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
-
-#ifdef max
-# undef max
-#endif
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-using namespace connectivity::ado;
-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::util;
-
-
-IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.APreparedStatement","com.sun.star.sdbc.PreparedStatement");
-
-OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const OTypeInfoMap& _TypeInfo,const ::rtl::OUString& sql)
- : OStatement_Base( _pConnection )
- ,m_aTypeInfo(_TypeInfo)
-{
- osl_incrementInterlockedCount( &m_refCount );
-
- OSQLParser aParser(_pConnection->getDriver()->getORB());
- ::rtl::OUString sErrorMessage;
- ::rtl::OUString sNewSql;
- OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,sql);
- if(pNode)
- { // special handling for parameters
- /* we recusive replace all occurrences of ? in the statement and replace them with name like "æ¬å" */
- sal_Int32 nParameterCount = 0;
- ::rtl::OUString sDefaultName( RTL_CONSTASCII_USTRINGPARAM( "parame" ));
- replaceParameterNodeName(pNode,sDefaultName,nParameterCount);
- pNode->parseNodeToStr( sNewSql, _pConnection );
- delete pNode;
- }
- else
- sNewSql = sql;
- CHECK_RETURN(m_Command.put_CommandText(sNewSql))
- CHECK_RETURN(m_Command.put_Prepared(VARIANT_TRUE))
- m_pParameters = m_Command.get_Parameters();
- m_pParameters->AddRef();
- m_pParameters->Refresh();
-
- osl_decrementInterlockedCount( &m_refCount );
-}
-
-// -------------------------------------------------------------------------
-OPreparedStatement::~OPreparedStatement()
-{
- if (m_pParameters)
- {
- OSL_FAIL( "OPreparedStatement::~OPreparedStatement: not disposed!" );
- m_pParameters->Release();
- m_pParameters = NULL;
- }
-}
-
-// -------------------------------------------------------------------------
-
-Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OStatement_Base::queryInterface(rType);
- return aRet.hasValue() ? aRet : ::cppu::queryInterface( rType,
- static_cast< XPreparedStatement*>(this),
- static_cast< XParameters*>(this),
- static_cast< XPreparedBatchExecution*>(this),
- static_cast< XResultSetMetaDataSupplier*>(this));
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedStatement > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< XParameters > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< XResultSetMetaDataSupplier > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedBatchExecution > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_Base::getTypes());
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException)
-{
- if(!m_xMetaData.is() && m_RecordSet.IsValid())
- m_xMetaData = new OResultSetMetaData(m_RecordSet);
- return m_xMetaData;
-}
-// -------------------------------------------------------------------------
-void OPreparedStatement::disposing()
-{
-m_xMetaData.clear();
- if (m_pParameters)
- {
- m_pParameters->Release();
- m_pParameters = NULL;
- }
- OStatement_Base::disposing();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException)
-{
-
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- }
- dispose();
-
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- SQLWarning warning;
-
- // Reset warnings
-
- clearWarnings ();
-
- // Reset the statement handle, warning and saved Resultset
-
- // reset();
-
- // Call SQLExecute
-
- try {
- ADORecordset* pSet=NULL;
- CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdUnknown,&pSet))
- m_RecordSet = WpADORecordset(pSet);
- }
- catch (SQLWarning& ex)
- {
-
- // Save pointer to warning and save with ResultSet
- // object once it is created.
-
- warning = ex;
- }
- return m_RecordSet.IsValid();
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- ADORecordset* pSet=NULL;
- CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdUnknown,&pSet))
- if ( VT_ERROR == m_RecordsAffected.getType() )
- {
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
- // to be sure that we get the error really thrown
- throw SQLException();
- }
- m_RecordSet = WpADORecordset(pSet);
- return static_cast<sal_Int32>(m_RecordsAffected);
-}
-
-// -------------------------------------------------------------------------
-void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const DataTypeEnum& _eType,
- const sal_Int32& _nSize,const OLEVariant& _Val) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- sal_Int32 nCount = 0;
- m_pParameters->get_Count(&nCount);
- if(nCount < (parameterIndex-1))
- {
- ::rtl::OUString sDefaultName( RTL_CONSTASCII_USTRINGPARAM( "parame" ));
- sDefaultName += ::rtl::OUString::valueOf(parameterIndex);
- ADOParameter* pParam = m_Command.CreateParameter(sDefaultName,_eType,adParamInput,_nSize,_Val);
- if(pParam)
- {
- m_pParameters->Append(pParam);
-#if OSL_DEBUG_LEVEL > 0
- ADOParameter* pParam = NULL;
- m_pParameters->get_Item(OLEVariant(sal_Int32(parameterIndex-1)),&pParam);
- WpADOParameter aParam(pParam);
- if(pParam)
- {
- DataTypeEnum eType = aParam.GetADOType();
- (void)eType;
- }
-#endif
- }
- }
- else
- {
- ADOParameter* pParam = NULL;
- m_pParameters->get_Item(OLEVariant(sal_Int32(parameterIndex-1)),&pParam);
- WpADOParameter aParam(pParam);
- if(pParam)
- {
-#if OSL_DEBUG_LEVEL > 0
- ::rtl::OUString sParam = aParam.GetName();
-
-#endif // OSL_DEBUG_LEVEL
-
- DataTypeEnum eType = aParam.GetADOType();
- if ( _eType != eType && _eType != adDBTimeStamp )
- {
- aParam.put_Type(_eType);
- eType = _eType;
- aParam.put_Size(_nSize);
- }
-
- if ( adVarBinary == eType && aParam.GetAttributes() == adParamLong )
- {
- aParam.AppendChunk(_Val);
- }
- else
- CHECK_RETURN(aParam.PutValue(_Val));
- }
- }
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
-{
- setParameter( parameterIndex, adLongVarWChar, ::std::numeric_limits< sal_Int32 >::max(), x );
-}
-// -------------------------------------------------------------------------
-
-Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- return (Reference< XConnection >)m_pConnection;
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- // first clear the old things
-m_xMetaData.clear();
- disposeResultSet();
- if(m_RecordSet.IsValid())
- m_RecordSet.Close();
- m_RecordSet.clear();
-
-
- // the create the new onces
- m_RecordSet.Create();
- OLEVariant aCmd;
- aCmd.setIDispatch(m_Command);
- OLEVariant aCon;
- aCon.setNoArg();
- CHECK_RETURN(m_RecordSet.put_CacheSize(m_nFetchSize))
- CHECK_RETURN(m_RecordSet.put_MaxRecords(m_nMaxRows))
- CHECK_RETURN(m_RecordSet.Open(aCmd,aCon,m_eCursorType,m_eLockType,adOpenUnspecified))
- CHECK_RETURN(m_RecordSet.get_CacheSize(m_nFetchSize))
- CHECK_RETURN(m_RecordSet.get_MaxRecords(m_nMaxRows))
- CHECK_RETURN(m_RecordSet.get_CursorType(m_eCursorType))
- CHECK_RETURN(m_RecordSet.get_LockType(m_eLockType))
-
- OResultSet* pSet = new OResultSet(m_RecordSet,this);
- Reference< XResultSet > xRs = pSet;
- pSet->construct();
- pSet->setMetaData(getMetaData());
- m_xResultSet = WeakReference<XResultSet>(xRs);
-
- return xRs;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,adBoolean,sizeof(x),x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,adTinyInt,sizeof(x),x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,adDBDate,sizeof(x),x);
-}
-// -------------------------------------------------------------------------
-
-
-void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,adDBTime,sizeof(x),x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,adDBTimeStamp,sizeof(x),x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,adDouble,sizeof(x),x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,adSingle,sizeof(x),x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,adInteger,sizeof(x),x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,adBigInt,sizeof(x),x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException)
-{
- OLEVariant aVal;
- aVal.setNull();
- setParameter(parameterIndex,adEmpty,0,aVal);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::setClob", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::setBlob", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::setArray", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::setRef", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException)
-{
- switch(sqlType)
- {
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- setString(parameterIndex,::comphelper::getString(x));
- break;
- default:
- ::dbtools::setObjectWithInfo(this,parameterIndex,x,sqlType,scale);
- break;
- }
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& /*typeName*/ ) throw(SQLException, RuntimeException)
-{
- setNull(parameterIndex,sqlType);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException)
-{
- if(!::dbtools::implSetObject(this,parameterIndex,x))
- {
- const ::rtl::OUString sError( m_pConnection->getResources().getResourceStringWithSubstitution(
- STR_UNKNOWN_PARA_TYPE,
- "$position$", ::rtl::OUString::valueOf(parameterIndex)
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
- // setObject (parameterIndex, x, sqlType, 0);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,adSmallInt,sizeof(x),x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,adVarBinary,sizeof(sal_Int8)*x.getLength(),x);
-}
-
-// -------------------------------------------------------------------------
-
-
-void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 /*parameterIndex*/, const Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setCharacterStream", *this );
-}
-
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
-{
- if(x.is())
- {
- Sequence< sal_Int8 > aData;
- x->readBytes(aData,length);
- setBytes(parameterIndex,aData);
- }
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- if(m_pParameters)
- {
- sal_Int32 nCount = 0;
- m_pParameters->get_Count(&nCount);
- OLEVariant aVal;
- aVal.setEmpty();
- for(sal_Int32 i=0;i<nCount;++i)
- {
- ADOParameter* pParam = NULL;
- m_pParameters->get_Item(OLEVariant(i),&pParam);
- WpADOParameter aParam(pParam);
- if(pParam)
- {
- ::rtl::OUString sParam = aParam.GetName();
- CHECK_RETURN(aParam.PutValue(aVal));
- }
- }
- // m_pParameters->Delete(OLEVariant(i));
-
- }
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::clearBatch( ) throw(SQLException, RuntimeException)
-{
- // clearParameters( );
- // m_aBatchList.erase();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::addBatch( ) throw(SQLException, RuntimeException)
-{
-}
-// -------------------------------------------------------------------------
-
-Sequence< sal_Int32 > SAL_CALL OPreparedStatement::executeBatch( ) throw(SQLException, RuntimeException)
-{
- return Sequence< sal_Int32 > ();
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::acquire() throw()
-{
- OStatement_Base::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::release() throw()
-{
- OStatement_Base::release();
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::replaceParameterNodeName(OSQLParseNode* _pNode,
- const ::rtl::OUString& _sDefaultName,
- sal_Int32& _rParameterCount)
-{
- sal_Int32 nCount = _pNode->count();
- for(sal_Int32 i=0;i < nCount;++i)
- {
- OSQLParseNode* pChildNode = _pNode->getChild(i);
- if(SQL_ISRULE(pChildNode,parameter) && pChildNode->count() == 1)
- {
- OSQLParseNode* pNewNode = new OSQLParseNode(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(":")) ,SQL_NODE_PUNCTUATION,0);
- delete pChildNode->replace(pChildNode->getChild(0),pNewNode);
- ::rtl::OUString sParameterName = _sDefaultName;
- sParameterName += ::rtl::OUString::valueOf(++_rParameterCount);
- pChildNode->append(new OSQLParseNode( sParameterName,SQL_NODE_NAME,0));
- }
- else
- replaceParameterNodeName(pChildNode,_sDefaultName,_rParameterCount);
-
- }
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx
deleted file mode 100644
index 676c38e9b8..0000000000
--- a/connectivity/source/drivers/ado/AResultSet.cxx
+++ /dev/null
@@ -1,1175 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/AResultSet.hxx"
-#include "ado/AResultSetMetaData.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbc/IndexType.hpp>
-#include <comphelper/property.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <comphelper/seqstream.hxx>
-#include "connectivity/dbexception.hxx"
-#include "connectivity/dbtools.hxx"
-#include <comphelper/types.hxx>
-
-using namespace ::comphelper;
-
-
-#include <oledb.h>
-
-#define CHECK_RETURN(x) \
- if(!SUCCEEDED(x)) \
- ADOS::ThrowException(*m_pStmt->m_pConnection->getConnection(),*this);
-
-using namespace connectivity::ado;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-
-//------------------------------------------------------------------------------
-// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.AResultSet","com.sun.star.sdbc.ResultSet");
-::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) \
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ado.ResultSet"));
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(2);
- aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet"));
- aSupported[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ResultSet"));
- return aSupported;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-// -------------------------------------------------------------------------
-OResultSet::OResultSet(ADORecordset* _pRecordSet,OStatement_Base* pStmt) : OResultSet_BASE(m_aMutex)
- ,OPropertySetHelper(OResultSet_BASE::rBHelper)
- ,m_xStatement(*pStmt)
- ,m_pStmt(pStmt)
- ,m_nRowPos(0)
- ,m_xMetaData(NULL)
- ,m_pRecordSet(_pRecordSet)
- ,m_bEOF(sal_False)
-{
-}
-// -------------------------------------------------------------------------
-OResultSet::OResultSet(ADORecordset* _pRecordSet) : OResultSet_BASE(m_aMutex)
- ,OPropertySetHelper(OResultSet_BASE::rBHelper)
- ,m_xStatement(NULL)
- ,m_xMetaData(NULL)
- ,m_pRecordSet(_pRecordSet)
- ,m_bEOF(sal_False)
-{
-}
-// -----------------------------------------------------------------------------
-void OResultSet::construct()
-{
- osl_incrementInterlockedCount( &m_refCount );
- if (!m_pRecordSet)
- {
- OSL_FAIL( "OResultSet::construct: no RecordSet!" );
- Reference< XInterface > xInt( *this );
- osl_decrementInterlockedCount( &m_refCount );
- ::dbtools::throwFunctionSequenceException( xInt );
- }
- m_pRecordSet->AddRef();
- VARIANT_BOOL bIsAtBOF;
- CHECK_RETURN(m_pRecordSet->get_BOF(&bIsAtBOF))
- m_bOnFirstAfterOpen = bIsAtBOF != VARIANT_TRUE;
- osl_decrementInterlockedCount( &m_refCount );
-}
-// -------------------------------------------------------------------------
-OResultSet::~OResultSet()
-{
- if(m_pRecordSet)
- m_pRecordSet->Release();
-}
-// -------------------------------------------------------------------------
-void OResultSet::disposing(void)
-{
- OPropertySetHelper::disposing();
-
- ::osl::MutexGuard aGuard(m_aMutex);
- if(m_pRecordSet)
- m_pRecordSet->Close();
-m_xStatement.clear();
-m_xMetaData.clear();
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OPropertySetHelper::queryInterface(rType);
- return aRet.hasValue() ? aRet : OResultSet_BASE::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OResultSet::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
-}
-
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- Reference< XResultSetMetaData > xMeta = getMetaData();
- sal_Int32 nLen = xMeta->getColumnCount();
- sal_Int32 i = 1;
- for(;i<=nLen;++i)
- if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
- columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
- break;
- return i;
-}
-#define BLOCK_SIZE 256
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex);
-
- if((aField.GetAttributes() & adFldLong) == adFldLong)
- {
- //Copy the data only upto the Actual Size of Field.
- sal_Int32 nSize = aField.GetActualSize();
- Sequence<sal_Int8> aData(nSize);
- long index = 0;
- while(index < nSize)
- {
- m_aValue = aField.GetChunk(BLOCK_SIZE);
- if(m_aValue.isNull())
- break;
- UCHAR chData;
- for(long index2 = 0;index2 < BLOCK_SIZE;++index2)
- {
- HRESULT hr = ::SafeArrayGetElement(m_aValue.parray,&index2,&chData);
- if(SUCCEEDED(hr))
- {
- //Take BYTE by BYTE and advance Memory Location
- aData.getArray()[index++] = chData;
- }
- else
- break;
- }
- }
-
- return new ::comphelper::SequenceInputStream(aData);
- }
- // else we ask for a bytesequence
- aField.get_Value(m_aValue);
-
- return m_aValue.isNull() ? NULL : new ::comphelper::SequenceInputStream(m_aValue);
-}
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getCharacterStream", *this );
- return NULL;
-}
-// -----------------------------------------------------------------------------
-OLEVariant OResultSet::getValue(sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex);
- aField.get_Value(m_aValue);
- return m_aValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-::com::sun::star::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- PositionEnum_Param aPos;
- m_pRecordSet->get_AbsolutePosition(&aPos);
- return (aPos > 0) ? aPos : m_nRowPos;
- // return the rowcount from driver if the driver doesn't support this return our count
-}
-// -------------------------------------------------------------------------
-
-sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getLong", *this );
- return sal_Int64(0);
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- if(!m_xMetaData.is())
- m_xMetaData = new OResultSetMetaData(m_pRecordSet);
- return m_xMetaData;
-}
-// -------------------------------------------------------------------------
-Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getArray", *this );
- return NULL;
-}
-
-// -------------------------------------------------------------------------
-
-Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getClob", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getBlob", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRow::getRef", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex).makeAny();
-}
-// -------------------------------------------------------------------------
-
-sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-
-// -------------------------------------------------------------------------
-
-
-::com::sun::star::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-
-::com::sun::star::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- VARIANT_BOOL bIsAtEOF;
- CHECK_RETURN(m_pRecordSet->get_EOF(&bIsAtEOF))
- return bIsAtEOF == VARIANT_TRUE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return m_nRowPos == 1;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return sal_True;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- if(first())
- m_bOnFirstAfterOpen = !previous();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- if(last())
- next();
- m_bEOF = sal_True;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- }
- dispose();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- if(SUCCEEDED(m_pRecordSet->MoveFirst()))
- {
- m_nRowPos = 1;
- m_bOnFirstAfterOpen = sal_False;
- return sal_True;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- sal_Bool bRet = SUCCEEDED(m_pRecordSet->MoveLast());
- if(bRet)
- {
- m_pRecordSet->get_RecordCount(&m_nRowPos);
- m_bOnFirstAfterOpen = sal_False;
- }
- return bRet;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- if(!row) // absolute with zero not allowed
- ::dbtools::throwFunctionSequenceException(*this);
-
- sal_Bool bCheck = sal_True;
- if(row < 0)
- {
- bCheck = SUCCEEDED(m_pRecordSet->MoveLast());
- if ( bCheck )
- {
- while(++row < 0 && bCheck)
- bCheck = SUCCEEDED(m_pRecordSet->MovePrevious());
- }
- }
- else
- {
- first();
- OLEVariant aEmpty;
- aEmpty.setNoArg();
- bCheck = SUCCEEDED(m_pRecordSet->Move(row-1,aEmpty)); // move to row -1 because we stand already on the first
- if(bCheck)
- m_nRowPos = row;
- }
- if(bCheck)
- m_bOnFirstAfterOpen = sal_False;
- return bCheck;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- OLEVariant aEmpty;
- aEmpty.setNoArg();
- sal_Int32 nNewPos = row;
- if ( m_bOnFirstAfterOpen && nNewPos > 0 )
- --nNewPos;
- sal_Bool bRet = SUCCEEDED(m_pRecordSet->Move(row,aEmpty));
- if(bRet)
- {
- m_nRowPos += row;
- m_bOnFirstAfterOpen = sal_False;
- }
- return bRet;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- sal_Bool bRet = SUCCEEDED(m_pRecordSet->MovePrevious());
- if(bRet)
- {
- --m_nRowPos;
- m_bOnFirstAfterOpen = sal_False;
- }
- return bRet;
-}
-// -------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return m_xStatement;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- RecordStatusEnum eRec;
- m_pRecordSet->get_Status((sal_Int32*)&eRec);
- sal_Bool bRet = (eRec & adRecDeleted) == adRecDeleted;
- if(bRet)
- --m_nRowPos;
- return bRet;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException)
-{ ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- RecordStatusEnum eRec;
- m_pRecordSet->get_Status((sal_Int32*)&eRec);
- sal_Bool bRet = (eRec & adRecNew) == adRecNew;
- if(bRet)
- ++m_nRowPos;
- return bRet;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- RecordStatusEnum eRec;
- m_pRecordSet->get_Status((sal_Int32*)&eRec);
- return (eRec & adRecModified) == adRecModified;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- OSL_ENSURE(!m_nRowPos,"OResultSet::isBeforeFirst: Error in setting m_nRowPos!");
- VARIANT_BOOL bIsAtBOF = VARIANT_TRUE;
- if(!m_bOnFirstAfterOpen)
- {
- OSL_ENSURE(!m_nRowPos,"OResultSet::isBeforeFirst: Error in setting m_nRowPos!");
- m_pRecordSet->get_BOF(&bIsAtBOF);
- }
- return bIsAtBOF == VARIANT_TRUE;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- sal_Bool bRet = sal_True;
- if(m_bOnFirstAfterOpen)
- {
- m_bOnFirstAfterOpen = sal_False;
- ++m_nRowPos;
- }
- else
- {
- bRet = SUCCEEDED(m_pRecordSet->MoveNext());
-
- if(bRet)
- {
- VARIANT_BOOL bIsAtEOF;
- CHECK_RETURN(m_pRecordSet->get_EOF(&bIsAtEOF))
- bRet = bIsAtEOF != VARIANT_TRUE;
- ++m_nRowPos;
- }
- else
- ADOS::ThrowException(*m_pStmt->m_pConnection->getConnection(),*this);
- }
-
- return bRet;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return m_aValue.isNull();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::cancel( ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_pRecordSet->Cancel();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException)
-{
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException)
-{
- return Any();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- OLEVariant aEmpty;
- aEmpty.setNoArg();
- m_pRecordSet->AddNew(aEmpty,aEmpty);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- OLEVariant aEmpty;
- aEmpty.setNoArg();
- m_pRecordSet->Update(aEmpty,aEmpty);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::deleteRow( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_pRecordSet->Delete(adAffectCurrent);
- m_pRecordSet->UpdateBatch(adAffectCurrent);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_pRecordSet->CancelUpdate();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException)
-{
- // ::osl::MutexGuard aGuard( m_aMutex );
- //checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- // if ( getResultSetConcurrency() == ResultSetConcurrency::READ_ONLY )
- // throw SQLException();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException)
-{
-}
-// -----------------------------------------------------------------------------
-void OResultSet::updateValue(sal_Int32 columnIndex,const OLEVariant& x)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex);
- aField.PutValue(x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- OLEVariant x;
- x.setNull();
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -----------------------------------------------------------------------
-void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
-{
- if(!x.is())
- ::dbtools::throwFunctionSequenceException(*this);
-
- Sequence<sal_Int8> aSeq;
- x->readBytes(aSeq,length);
- updateBytes(columnIndex,aSeq);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
-{
- if(!x.is())
- ::dbtools::throwFunctionSequenceException(*this);
-
- Sequence<sal_Int8> aSeq;
- x->readBytes(aSeq,length);
- updateBytes(columnIndex,aSeq);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_pRecordSet->Resync(adAffectCurrent,adResyncAllValues);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException)
-{
- if (!::dbtools::implUpdateObject(this, columnIndex, x))
- throw SQLException();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException)
-{
- if (!::dbtools::implUpdateObject(this, columnIndex, x))
- throw SQLException();
-}
-//------------------------------------------------------------------------------
-// XRowLocate
-Any SAL_CALL OResultSet::getBookmark( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- if(m_nRowPos < (sal_Int32)m_aBookmarks.size()) // this bookmark was already fetched
- return makeAny(sal_Int32(m_nRowPos-1));
-
- OLEVariant aVar;
- m_pRecordSet->get_Bookmark(&aVar);
- m_aBookmarks.push_back(aVar);
- return makeAny((sal_Int32)(m_aBookmarks.size()-1));
-
-}
-//------------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- sal_Int32 nPos;
- bookmark >>= nPos;
- OSL_ENSURE(nPos >= 0 && nPos < (sal_Int32)m_aBookmarks.size(),"Invalid Index for vector");
- if(nPos < 0 || nPos >= (sal_Int32)m_aBookmarks.size())
- ::dbtools::throwFunctionSequenceException(*this);
-
- return SUCCEEDED(m_pRecordSet->Move(0,m_aBookmarks[nPos]));
-}
-//------------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- sal_Int32 nPos;
- bookmark >>= nPos;
- nPos += rows;
- OSL_ENSURE(nPos >= 0 && nPos < (sal_Int32)m_aBookmarks.size(),"Invalid Index for vector");
- if(nPos < 0 || nPos >= (sal_Int32)m_aBookmarks.size())
- ::dbtools::throwFunctionSequenceException(*this);
- return SUCCEEDED(m_pRecordSet->Move(rows,m_aBookmarks[nPos]));
-}
-//------------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSet::compareBookmarks( const Any& first, const Any& second ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nPos1;
- first >>= nPos1;
- sal_Int32 nPos2;
- second >>= nPos2;
- if(nPos1 == nPos2) // they should be equal
- return sal_True;
-
- OSL_ENSURE((nPos1 >= 0 && nPos1 < (sal_Int32)m_aBookmarks.size()) || (nPos1 >= 0 && nPos2 < (sal_Int32)m_aBookmarks.size()),"Invalid Index for vector");
-
- CompareEnum eNum;
- m_pRecordSet->CompareBookmarks(m_aBookmarks[nPos1],m_aBookmarks[nPos2],&eNum);
- return ((sal_Int32)eNum) +1;
-}
-//------------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- ADOProperties* pProps = NULL;
- m_pRecordSet->get_Properties(&pProps);
- WpADOProperties aProps;
- aProps.setWithOutAddRef(pProps);
- ADOS::ThrowException(*((OConnection*)m_pStmt->getConnection().get())->getConnection(),*this);
- OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
-
- WpADOProperty aProp(aProps.GetItem(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Bookmarks Ordered"))));
- OLEVariant aVar;
- if(aProp.IsValid())
- aVar = aProp.GetValue();
- else
- ADOS::ThrowException(*((OConnection*)m_pStmt->getConnection().get())->getConnection(),*this);
-
- sal_Bool bValue(sal_False);
- if(!aVar.isNull() && !aVar.isEmpty())
- bValue = aVar;
- return bValue;
-}
-//------------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- sal_Int32 nPos;
- bookmark >>= nPos;
- return nPos;
-}
-//------------------------------------------------------------------------------
-// XDeleteRows
-Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& rows ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- OLEVariant aVar;
- sal_Int32 nPos;
-
- // Create SafeArray Bounds and initialize the array
- SAFEARRAYBOUND rgsabound[1];
- rgsabound[0].lLbound = 0;
- 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)
- {
- *pBegin >>= nPos;
- SafeArrayPutElement(psa,&i,&m_aBookmarks[nPos]);
- }
-
- // Initialize and fill the SafeArray
- OLEVariant vsa;
- vsa.setArray(psa,VT_VARIANT);
-
- m_pRecordSet->put_Filter(vsa);
- m_pRecordSet->Delete(adAffectGroup);
- m_pRecordSet->UpdateBatch(adAffectGroup);
-
- Sequence< sal_Int32 > aSeq(rows.getLength());
- if(first())
- {
- sal_Int32* pSeq = aSeq.getArray();
- sal_Int32 i=0;
- do
- {
- OSL_ENSURE(i<aSeq.getLength(),"Index greater than length of sequence");
- m_pRecordSet->get_Status(&pSeq[i]);
- if(pSeq[i++] == adRecDeleted)
- --m_nRowPos;
- }
- while(next());
- }
- return aSeq;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::getResultSetConcurrency() const
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- sal_Int32 nValue=ResultSetConcurrency::READ_ONLY;
- LockTypeEnum eRet;
- if(!SUCCEEDED(m_pRecordSet->get_LockType(&eRet)))
- {
- switch(eRet)
- {
- case adLockReadOnly:
- nValue = ResultSetConcurrency::READ_ONLY;
- break;
- default:
- nValue = ResultSetConcurrency::UPDATABLE;
- break;
- }
- }
- return nValue;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::getResultSetType() const
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- sal_Int32 nValue=0;
- CursorTypeEnum eRet;
- if(!SUCCEEDED(m_pRecordSet->get_CursorType(&eRet)))
- {
- switch(eRet)
- {
- case adOpenUnspecified:
- case adOpenForwardOnly:
- nValue = ResultSetType::FORWARD_ONLY;
- break;
- case adOpenStatic:
- case adOpenKeyset:
- nValue = ResultSetType::SCROLL_INSENSITIVE;
- break;
- case adOpenDynamic:
- nValue = ResultSetType::SCROLL_SENSITIVE;
- break;
- }
- }
- return nValue;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::getFetchDirection() const
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return FetchDirection::FORWARD;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::getFetchSize() const
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- sal_Int32 nValue=-1;
- m_pRecordSet->get_CacheSize(&nValue);
- return nValue;
-}
-//------------------------------------------------------------------------------
-::rtl::OUString OResultSet::getCursorName() const
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::setFetchDirection(sal_Int32 /*_par0*/)
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "ResultSet::FetchDirection", *this );
-}
-//------------------------------------------------------------------------------
-void OResultSet::setFetchSize(sal_Int32 _par0)
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_pRecordSet->put_CacheSize(_par0);
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
-{
- Sequence< com::sun::star::beans::Property > aProps(5);
- com::sun::star::beans::Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
-
- // DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY);
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & OResultSet::getInfoHelper()
-{
- return *const_cast<OResultSet*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool OResultSet::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw ::com::sun::star::lang::IllegalArgumentException();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection());
- case PROPERTY_ID_FETCHSIZE:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize());
- default:
- ;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-void OResultSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw Exception();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- setFetchDirection(getINT32(rValue));
- break;
- case PROPERTY_ID_FETCHSIZE:
- setFetchSize(getINT32(rValue));
- break;
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void OResultSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
-{
- switch(nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- {
- VARIANT_BOOL bBool;
- m_pRecordSet->Supports(adBookmark,&bBool);
- sal_Bool bRet = bBool == VARIANT_TRUE;
- rValue.setValue(&bRet, ::getCppuBooleanType() );
- }
- break;
- case PROPERTY_ID_CURSORNAME:
- rValue <<= getCursorName();
- break;
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- rValue <<= getResultSetConcurrency();
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- rValue <<= getResultSetType();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- rValue <<= getFetchDirection();
- break;
- case PROPERTY_ID_FETCHSIZE:
- rValue <<= getFetchSize();
- break;
- }
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OResultSet::acquire() throw()
-{
- OResultSet_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OResultSet::release() throw()
-{
- OResultSet_BASE::release();
-}
-// -----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AResultSetMetaData.cxx b/connectivity/source/drivers/ado/AResultSetMetaData.cxx
deleted file mode 100644
index 66def0a9cb..0000000000
--- a/connectivity/source/drivers/ado/AResultSetMetaData.cxx
+++ /dev/null
@@ -1,264 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/AResultSetMetaData.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include "ado/Awrapado.hxx"
-#include "connectivity/dbexception.hxx"
-
-using namespace connectivity;
-using namespace connectivity::ado;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-
-OResultSetMetaData::OResultSetMetaData( ADORecordset* _pRecordSet)
- : m_pRecordSet(_pRecordSet),
- m_nColCount(-1)
-{
- if ( m_pRecordSet )
- m_pRecordSet->AddRef();
-}
-// -------------------------------------------------------------------------
-OResultSetMetaData::~OResultSetMetaData()
-{
- if ( m_pRecordSet )
- m_pRecordSet->Release();
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- WpADOField aField = ADOS::getField(m_pRecordSet,column);
- if(aField.IsValid() && aField.GetActualSize() != -1)
- return aField.GetActualSize();
- return 0;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- WpADOField aField = ADOS::getField(m_pRecordSet,column);
- return ADOS::MapADOType2Jdbc(aField.GetADOType());
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException)
-{
- if(m_nColCount != -1 )
- return m_nColCount;
-
- if ( !m_pRecordSet )
- return 0;
-
- ADOFields* pFields = NULL;
- m_pRecordSet->get_Fields(&pFields);
- WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(pFields);
- m_nColCount = aFields.GetItemCount();
- return m_nColCount;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- sal_Bool bRet = sal_False;
- WpADOField aField = ADOS::getField(m_pRecordSet,column);
- if ( aField.IsValid() )
- {
- WpADOProperties aProps( aField.get_Properties() );
- if ( aProps.IsValid() )
- bRet = OTools::getValue( aProps, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ISCASESENSITIVE")) );
- }
- return bRet;
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- WpADOField aField = ADOS::getField(m_pRecordSet,column);
- if(aField.IsValid())
- return aField.GetName();
-
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString sTableName;
-
- WpADOField aField = ADOS::getField(m_pRecordSet,column);
- if ( aField.IsValid() )
- {
- WpADOProperties aProps( aField.get_Properties() );
- if ( aProps.IsValid() )
- sTableName = OTools::getValue( aProps, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BASETABLENAME")) );
- }
- return sTableName;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return getColumnName(column);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- WpADOField aField = ADOS::getField(m_pRecordSet,column);
- if(aField.IsValid())
- {
- return ((aField.GetAttributes() & adFldFixed) == adFldFixed) && (aField.GetADOType() == adCurrency);
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- sal_Bool bRet = sal_False;
- WpADOField aField = ADOS::getField(m_pRecordSet,column);
- if ( aField.IsValid() )
- {
- WpADOProperties aProps( aField.get_Properties() );
- if ( aProps.IsValid() )
- {
- bRet = OTools::getValue( aProps, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ISAUTOINCREMENT")) );
-#if OSL_DEBUG_LEVEL > 0
- sal_Int32 nCount = aProps.GetItemCount();
- for (sal_Int32 i = 0; i<nCount; ++i)
- {
- WpADOProperty aProp = aProps.GetItem(i);
- ::rtl::OUString sName = aProp.GetName();
- ::rtl::OUString sVal = aProp.GetValue();
- }
-#endif
- }
- }
- return bRet;
-}
-// -------------------------------------------------------------------------
-
-
-sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- WpADOField aField = ADOS::getField(m_pRecordSet,column);
- if(aField.IsValid())
- {
- DataTypeEnum eType = aField.GetADOType();
- return !(eType == adUnsignedBigInt || eType == adUnsignedInt || eType == adUnsignedSmallInt || eType == adUnsignedTinyInt);
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- WpADOField aField = ADOS::getField(m_pRecordSet,column);
- if(aField.IsValid())
- return aField.GetPrecision();
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- WpADOField aField = ADOS::getField(m_pRecordSet,column);
- if(aField.IsValid())
- return aField.GetNumericScale();
- return 0;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- WpADOField aField = ADOS::getField(m_pRecordSet,column);
- if(aField.IsValid())
- {
- return (aField.GetAttributes() & adFldIsNullable) == adFldIsNullable;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- WpADOField aField = ADOS::getField(m_pRecordSet,column);
- if(aField.IsValid())
- {
- // return (aField.GetStatus() & adFieldReadOnly) == adFieldReadOnly;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- WpADOField aField = ADOS::getField(m_pRecordSet,column);
- if(aField.IsValid())
- {
- return (aField.GetAttributes() & adFldUpdatable) == adFldUpdatable;
- }
- return sal_False;
-;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return isDefinitelyWritable(column);
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AStatement.cxx b/connectivity/source/drivers/ado/AStatement.cxx
deleted file mode 100644
index fb7daaedcf..0000000000
--- a/connectivity/source/drivers/ado/AStatement.cxx
+++ /dev/null
@@ -1,844 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/AStatement.hxx"
-#include "ado/AConnection.hxx"
-#include "ado/AResultSet.hxx"
-#include <comphelper/property.hxx>
-#include <comphelper/uno3.hxx>
-#include <osl/thread.h>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-#include "connectivity/dbexception.hxx"
-#include <comphelper/types.hxx>
-
-#undef max
-
-#include <algorithm>
-
-using namespace ::comphelper;
-
-#define CHECK_RETURN(x) \
- if(!x) \
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
-
-
-
-using namespace connectivity::ado;
-
-//------------------------------------------------------------------------------
-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)
- ,OSubComponent<OStatement_Base, OStatement_BASE>((::cppu::OWeakObject*)_pConnection, this)
- ,m_pConnection(_pConnection)
- ,m_nFetchSize(1)
- ,m_nMaxRows(0)
- ,m_eLockType(adLockReadOnly)
- ,m_eCursorType(adOpenForwardOnly)
-{
- osl_incrementInterlockedCount( &m_refCount );
-
- m_Command.Create();
- if(m_Command.IsValid())
- m_Command.putref_ActiveConnection(m_pConnection->getConnection());
- else
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
-
- m_RecordsAffected.setNoArg();
- m_Parameters.setNoArg();
-
- m_pConnection->acquire();
-
- osl_decrementInterlockedCount( &m_refCount );
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::disposeResultSet()
-{
- // free the cursor if alive
- Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- m_xResultSet = Reference< XResultSet>();
-}
-
-//------------------------------------------------------------------------------
-void OStatement_Base::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
-
- disposeResultSet();
-
- if ( m_Command.IsValid() )
- m_Command.putref_ActiveConnection( NULL );
- m_Command.clear();
-
- if ( m_RecordSet.IsValid() )
- m_RecordSet.PutRefDataSource( NULL );
- m_RecordSet.clear();
-
- if (m_pConnection)
- m_pConnection->release();
-
- dispose_ChildImpl();
- OStatement_BASE::disposing();
-}
-//-----------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::release() throw()
-{
- relase_ChildImpl();
-}
-//-----------------------------------------------------------------------------
-Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OStatement_BASE::queryInterface(rType);
- return aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OStatement_Base::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes());
-}
-
-// -------------------------------------------------------------------------
-
-void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- CHECK_RETURN(m_Command.Cancel())
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- }
- dispose();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OStatement::clearBatch( ) throw(SQLException, RuntimeException)
-{
-
-}
-// -------------------------------------------------------------------------
-
-void OStatement_Base::reset() throw (SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- clearWarnings ();
-
- if (m_xResultSet.get().is())
- clearMyResultSet();
-}
-//--------------------------------------------------------------------
-// clearMyResultSet
-// If a ResultSet was created for this Statement, close it
-//--------------------------------------------------------------------
-
-void OStatement_Base::clearMyResultSet () throw (SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- try
- {
- Reference<XCloseable> xCloseable;
- if ( ::comphelper::query_interface( m_xResultSet.get(), xCloseable ) )
- xCloseable->close();
- }
- catch( const DisposedException& ) { }
-
- m_xResultSet = Reference< XResultSet >();
-}
-//--------------------------------------------------------------------
-sal_Int32 OStatement_Base::getRowCount () throw( SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- return m_RecordsAffected;
-}
-//--------------------------------------------------------------------
-// getPrecision
-// Given a SQL type, return the maximum precision for the column.
-// Returns -1 if not known
-//--------------------------------------------------------------------
-
-sal_Int32 OStatement_Base::getPrecision ( sal_Int32 sqlType)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- sal_Int32 prec = -1;
- OTypeInfo aInfo;
- aInfo.nType = (sal_Int16)sqlType;
- if (!m_aTypeInfo.empty())
- {
- ::std::vector<OTypeInfo>::const_iterator aIter = ::std::find(m_aTypeInfo.begin(),m_aTypeInfo.end(),aInfo);
- for(;aIter != m_aTypeInfo.end();++aIter)
- {
- prec = ::std::max(prec,(*aIter).nPrecision);
- }
- }
-
- return prec;
-}
-//--------------------------------------------------------------------
-// setWarning
-// Sets the warning
-//--------------------------------------------------------------------
-
-void OStatement_Base::setWarning (const SQLWarning &ex) throw( SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- m_aLastWarning = ex;
-}
-// -------------------------------------------------------------------------
-void OStatement_Base::assignRecordSet( ADORecordset* _pRS )
-{
- WpADORecordset aOldRS( m_RecordSet );
- m_RecordSet = WpADORecordset( _pRS );
-
- if ( aOldRS.IsValid() )
- aOldRS.PutRefDataSource( NULL );
-
- if ( m_RecordSet.IsValid() )
- m_RecordSet.PutRefDataSource( (IDispatch*)m_Command );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- // Reset the statement handle and warning
-
- reset();
-
- try
- {
- ADORecordset* pSet = NULL;
- CHECK_RETURN(m_Command.put_CommandText(sql))
- CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdText,&pSet))
-
- assignRecordSet( pSet );
- }
- catch (SQLWarning& ex)
- {
-
- // Save pointer to warning and save with ResultSet
- // object once it is created.
-
- m_aLastWarning = ex;
- }
-
- return m_RecordSet.IsValid();
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- reset();
-
- m_xResultSet = WeakReference<XResultSet>(NULL);
-
- WpADORecordset aSet;
- aSet.Create();
- CHECK_RETURN(m_Command.put_CommandText(sql))
- OLEVariant aCmd;
- aCmd.setIDispatch(m_Command);
- OLEVariant aCon;
- aCon.setNoArg();
- CHECK_RETURN(aSet.put_CacheSize(m_nFetchSize))
- CHECK_RETURN(aSet.put_MaxRecords(m_nMaxRows))
- CHECK_RETURN(aSet.Open(aCmd,aCon,m_eCursorType,m_eLockType,adOpenUnspecified))
-
-
- CHECK_RETURN(aSet.get_CacheSize(m_nFetchSize))
- CHECK_RETURN(aSet.get_MaxRecords(m_nMaxRows))
- CHECK_RETURN(aSet.get_CursorType(m_eCursorType))
- CHECK_RETURN(aSet.get_LockType(m_eLockType))
-
- OResultSet* pSet = new OResultSet(aSet,this);
- Reference< XResultSet > xRs = pSet;
- pSet->construct();
-
- m_xResultSet = WeakReference<XResultSet>(xRs);
-
- return xRs;
-}
-// -------------------------------------------------------------------------
-
-Reference< XConnection > SAL_CALL OStatement_Base::getConnection( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- return (Reference< XConnection >)m_pConnection;
-}
-// -------------------------------------------------------------------------
-
-Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this));
- return aRet.hasValue() ? aRet : OStatement_Base::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OStatement::addBatch( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- m_aBatchList.push_back(sql);
-}
-// -------------------------------------------------------------------------
-Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- reset();
-
- ::rtl::OUString aBatchSql;
- sal_Int32 nLen = 0;
- for(::std::list< ::rtl::OUString>::const_iterator i=m_aBatchList.begin();i != m_aBatchList.end();++i,++nLen)
- aBatchSql = aBatchSql + *i + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(";"));
-
-
- if ( m_RecordSet.IsValid() )
- m_RecordSet.PutRefDataSource( NULL );
- m_RecordSet.clear();
- m_RecordSet.Create();
-
- CHECK_RETURN(m_Command.put_CommandText(aBatchSql))
- if ( m_RecordSet.IsValid() )
- m_RecordSet.PutRefDataSource((IDispatch*)m_Command);
-
- CHECK_RETURN(m_RecordSet.UpdateBatch(adAffectAll))
-
- ADORecordset* pSet=NULL;
- Sequence< sal_Int32 > aRet(nLen);
- sal_Int32* pArray = aRet.getArray();
- for(sal_Int32 j=0;j<nLen;++j)
- {
- pSet = NULL;
- OLEVariant aRecordsAffected;
- if(m_RecordSet.NextRecordset(aRecordsAffected,&pSet) && pSet)
- {
- assignRecordSet( pSet );
-
- ADO_LONGPTR nValue;
- if(m_RecordSet.get_RecordCount(nValue))
- pArray[j] = nValue;
- }
- }
- return aRet;
-}
-// -------------------------------------------------------------------------
-
-
-sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- reset();
-
- try {
- ADORecordset* pSet = NULL;
- CHECK_RETURN(m_Command.put_CommandText(sql))
- CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdText|adExecuteNoRecords,&pSet))
- }
- catch (SQLWarning& ex) {
-
- // Save pointer to warning and save with ResultSet
- // object once it is created.
-
- m_aLastWarning = ex;
- }
- if(!m_RecordsAffected.isEmpty() && !m_RecordsAffected.isNull() && m_RecordsAffected.getType() != VT_ERROR)
- return m_RecordsAffected;
-
- return 0;
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- return m_xResultSet;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OStatement_Base::getUpdateCount( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- ADO_LONGPTR nRet;
- if(m_RecordSet.IsValid() && m_RecordSet.get_RecordCount(nRet))
- return nRet;
- return -1;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OStatement_Base::getMoreResults( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- SQLWarning warning;
-
- // clear previous warnings
-
- clearWarnings ();
-
- // Call SQLMoreResults
-
- try
- {
- ADORecordset* pSet=NULL;
- OLEVariant aRecordsAffected;
- if(m_RecordSet.IsValid() && m_RecordSet.NextRecordset(aRecordsAffected,&pSet) && pSet)
- assignRecordSet( pSet );
- }
- catch (SQLWarning &ex)
- {
-
- // Save pointer to warning and save with ResultSet
- // object once it is created.
-
- warning = ex;
- }
- return m_RecordSet.IsValid();
-}
-// -------------------------------------------------------------------------
-
-// -------------------------------------------------------------------------
-Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- return makeAny(m_aLastWarning);
-}
-// -------------------------------------------------------------------------
-
-// -------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- m_aLastWarning = SQLWarning();
-}
-// -------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-sal_Int32 OStatement_Base::getQueryTimeOut() const throw(SQLException, RuntimeException)
-{
- return m_Command.get_CommandTimeout();
-}
-//------------------------------------------------------------------------------
-sal_Int32 OStatement_Base::getMaxRows() const throw(SQLException, RuntimeException)
-{
- ADO_LONGPTR nRet=-1;
- if(!(m_RecordSet.IsValid() && m_RecordSet.get_MaxRecords(nRet)))
- ::dbtools::throwFunctionSequenceException(NULL);
- return nRet;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OStatement_Base::getResultSetConcurrency() const throw(SQLException, RuntimeException)
-{
- return m_eLockType;
- sal_Int32 nValue=0;
- switch(m_eLockType)
- {
- case adLockReadOnly:
- nValue = ResultSetConcurrency::READ_ONLY;
- break;
- default:
- nValue = ResultSetConcurrency::UPDATABLE;
- break;
- }
-
- return nValue;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OStatement_Base::getResultSetType() const throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue=0;
- switch(m_eCursorType)
- {
- case adOpenUnspecified:
- case adOpenForwardOnly:
- nValue = ResultSetType::FORWARD_ONLY;
- break;
- case adOpenStatic:
- case adOpenKeyset:
- nValue = ResultSetType::SCROLL_INSENSITIVE;
- break;
- case adOpenDynamic:
- nValue = ResultSetType::SCROLL_SENSITIVE;
- break;
- }
- return nValue;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OStatement_Base::getFetchDirection() const throw(SQLException, RuntimeException)
-{
- return FetchDirection::FORWARD;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OStatement_Base::getFetchSize() const throw(SQLException, RuntimeException)
-{
- return m_nFetchSize;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OStatement_Base::getMaxFieldSize() const throw(SQLException, RuntimeException)
-{
- return 0;
-}
-//------------------------------------------------------------------------------
-::rtl::OUString OStatement_Base::getCursorName() const throw(SQLException, RuntimeException)
-{
- return m_Command.GetName();
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setQueryTimeOut(sal_Int32 seconds) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- m_Command.put_CommandTimeout(seconds);
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setMaxRows(sal_Int32 _par0) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- m_nMaxRows = _par0;
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setResultSetConcurrency(sal_Int32 _par0) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- switch(_par0)
- {
- case ResultSetConcurrency::READ_ONLY:
- m_eLockType = adLockReadOnly;
- break;
- default:
- m_eLockType = adLockOptimistic;
- break;
- }
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setResultSetType(sal_Int32 _par0) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- switch(_par0)
- {
- case ResultSetType::FORWARD_ONLY:
- m_eCursorType = adOpenForwardOnly;
- break;
- case ResultSetType::SCROLL_INSENSITIVE:
- m_eCursorType = adOpenKeyset;
- break;
- case ResultSetType::SCROLL_SENSITIVE:
- m_eCursorType = adOpenDynamic;
- break;
- }
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setFetchDirection(sal_Int32 /*_par0*/) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedException( "Statement::FetchDirection", *this );
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setFetchSize(sal_Int32 _par0) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- m_nFetchSize = _par0;
- // m_RecordSet.put_CacheSize(_par0);
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setMaxFieldSize(sal_Int32 /*_par0*/) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedException( "Statement::MaxFieldSize", *this );
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setCursorName(const ::rtl::OUString &_par0) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- m_Command.put_Name(_par0);
-}
-
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const
-{
- Sequence< com::sun::star::beans::Property > aProps(10);
- com::sun::star::beans::Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP0(CURSORNAME, ::rtl::OUString);
- DECL_BOOL_PROP0(ESCAPEPROCESSING);
- DECL_PROP0(FETCHDIRECTION,sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP0(MAXFIELDSIZE,sal_Int32);
- DECL_PROP0(MAXROWS, sal_Int32);
- DECL_PROP0(QUERYTIMEOUT,sal_Int32);
- DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32);
- DECL_PROP0(RESULTSETTYPE,sal_Int32);
- DECL_BOOL_PROP0(USEBOOKMARKS);
-
-
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper()
-{
- return *const_cast<OStatement_Base*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool OStatement_Base::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- sal_Bool bModified = sal_False;
-
- sal_Bool bValidAdoRS = m_RecordSet.IsValid();
- // some of the properties below, when set, are remembered in a member, and applied in the next execute
- // For these properties, the record set does not need to be valid to allow setting them.
- // For all others (where the values are forwarded to the ADO RS directly), the recordset must be valid.
-
- try
- {
- switch(nHandle)
- {
- case PROPERTY_ID_MAXROWS:
- bModified = ::comphelper::tryPropertyValue( rConvertedValue, rOldValue, rValue, bValidAdoRS ? getMaxRows() : m_nMaxRows );
- break;
-
- case PROPERTY_ID_RESULTSETTYPE:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetType());
- break;
- case PROPERTY_ID_FETCHSIZE:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize());
- break;
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetConcurrency());
- break;
- case PROPERTY_ID_QUERYTIMEOUT:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getQueryTimeOut());
- break;
- case PROPERTY_ID_MAXFIELDSIZE:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxFieldSize());
- break;
- case PROPERTY_ID_CURSORNAME:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getCursorName());
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection());
- break;
- }
- }
- catch( const Exception& e )
- {
- bModified = sal_True; // will ensure that the property is set
- OSL_FAIL( "OStatement_Base::convertFastPropertyValue: caught something strange!" );
- (void)e;
- }
- return bModified;
-}
-// -------------------------------------------------------------------------
-void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- setQueryTimeOut(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_MAXFIELDSIZE:
- setMaxFieldSize(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_MAXROWS:
- setMaxRows(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_CURSORNAME:
- setCursorName(comphelper::getString(rValue));
- break;
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- setResultSetConcurrency(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- setResultSetType(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- setFetchDirection(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_FETCHSIZE:
- setFetchSize(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_ESCAPEPROCESSING:
- // return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink);
- case PROPERTY_ID_USEBOOKMARKS:
- // return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink);
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
-{
- switch(nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- rValue <<= getQueryTimeOut();
- break;
- case PROPERTY_ID_MAXFIELDSIZE:
- rValue <<= getMaxFieldSize();
- break;
- case PROPERTY_ID_MAXROWS:
- rValue <<= getMaxRows();
- break;
- case PROPERTY_ID_CURSORNAME:
- rValue <<= getCursorName();
- break;
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- rValue <<= getResultSetConcurrency();
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- rValue <<= getResultSetType();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- rValue <<= getFetchDirection();
- break;
- case PROPERTY_ID_FETCHSIZE:
- rValue <<= getFetchSize();
- break;
- case PROPERTY_ID_ESCAPEPROCESSING:
- rValue <<= sal_True;
- break;
- case PROPERTY_ID_USEBOOKMARKS:
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-OStatement::~OStatement()
-{
-}
-IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.AStatement","com.sun.star.sdbc.Statement");
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::acquire() throw()
-{
- OStatement_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement::acquire() throw()
-{
- OStatement_Base::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement::release() throw()
-{
- OStatement_Base::release();
-}
-// -----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/ATable.cxx b/connectivity/source/drivers/ado/ATable.cxx
deleted file mode 100644
index a4fadaa02b..0000000000
--- a/connectivity/source/drivers/ado/ATable.cxx
+++ /dev/null
@@ -1,259 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/ATable.hxx"
-#include "ado/AIndexes.hxx"
-#include "ado/AColumns.hxx"
-#include "ado/AColumn.hxx"
-#include "ado/AKeys.hxx"
-#include "ado/AConnection.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include "ado/Awrapado.hxx"
-#include <comphelper/sequence.hxx>
-#include "TConnection.hxx"
-#include <comphelper/types.hxx>
-
-using namespace ::comphelper;
-
-using namespace connectivity;
-using namespace connectivity::ado;
-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::lang;
-
-// -------------------------------------------------------------------------
-OAdoTable::OAdoTable(sdbcx::OCollection* _pTables,sal_Bool _bCase,OCatalog* _pCatalog,_ADOTable* _pTable)
- : OTable_TYPEDEF(_pTables,_bCase,::rtl::OUString(),::rtl::OUString())
- ,m_pCatalog(_pCatalog)
-{
- construct();
- m_aTable = WpADOTable(_pTable);
- // m_aTable.putref_ParentCatalog(_pCatalog->getCatalog());
- fillPropertyValues();
-
-}
-// -----------------------------------------------------------------------------
-OAdoTable::OAdoTable(sdbcx::OCollection* _pTables,sal_Bool _bCase,OCatalog* _pCatalog)
- : OTable_TYPEDEF(_pTables,_bCase)
- ,m_pCatalog(_pCatalog)
-{
- construct();
- m_aTable.Create();
- m_aTable.putref_ParentCatalog(_pCatalog->getCatalog());
-
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OAdoTable::disposing(void)
-{
- OTable_TYPEDEF::disposing();
- m_aTable.clear();
-}
-// -------------------------------------------------------------------------
-void OAdoTable::refreshColumns()
-{
- TStringVector aVector;
-
- WpADOColumns aColumns;
- if ( m_aTable.IsValid() )
- {
- aColumns = m_aTable.get_Columns();
- aColumns.fillElementNames(aVector);
- }
-
- if(m_pColumns)
- m_pColumns->reFill(aVector);
- else
- m_pColumns = new OColumns(*this,m_aMutex,aVector,aColumns,isCaseSensitive(),m_pCatalog->getConnection());
-}
-// -------------------------------------------------------------------------
-void OAdoTable::refreshKeys()
-{
- TStringVector aVector;
-
- WpADOKeys aKeys;
- if(m_aTable.IsValid())
- {
- aKeys = m_aTable.get_Keys();
- aKeys.fillElementNames(aVector);
- }
-
- if(m_pKeys)
- m_pKeys->reFill(aVector);
- else
- m_pKeys = new OKeys(*this,m_aMutex,aVector,aKeys,isCaseSensitive(),m_pCatalog->getConnection());
-}
-// -------------------------------------------------------------------------
-void OAdoTable::refreshIndexes()
-{
- TStringVector aVector;
-
- WpADOIndexes aIndexes;
- if(m_aTable.IsValid())
- {
- aIndexes = m_aTable.get_Indexes();
- aIndexes.fillElementNames(aVector);
- }
-
- if(m_pIndexes)
- m_pIndexes->reFill(aVector);
- else
- m_pIndexes = new OIndexes(*this,m_aMutex,aVector,aIndexes,isCaseSensitive(),m_pCatalog->getConnection());
-}
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OAdoTable::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OAdoTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : OTable_TYPEDEF::getSomething(rId);
-}
-// -------------------------------------------------------------------------
-// XRename
-void SAL_CALL OAdoTable::rename( const ::rtl::OUString& newName ) throw(SQLException, ElementExistException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OTableDescriptor_BASE_TYPEDEF::rBHelper.bDisposed);
-
- m_aTable.put_Name(newName);
- ADOS::ThrowException(*(m_pCatalog->getConnection()->getConnection()),*this);
-
- OTable_TYPEDEF::rename(newName);
-}
-// -----------------------------------------------------------------------------
-Reference< XDatabaseMetaData> OAdoTable::getMetaData() const
-{
- return m_pCatalog->getConnection()->getMetaData();
-}
-// -------------------------------------------------------------------------
-// XAlterTable
-void SAL_CALL OAdoTable::alterColumnByName( const ::rtl::OUString& colName, const Reference< XPropertySet >& descriptor ) throw(SQLException, NoSuchElementException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OTableDescriptor_BASE_TYPEDEF::rBHelper.bDisposed);
-
- sal_Bool bError = sal_True;
- OAdoColumn* pColumn = NULL;
- if(::comphelper::getImplementation(pColumn,descriptor) && pColumn != NULL)
- {
- WpADOColumns aColumns = m_aTable.get_Columns();
- bError = !aColumns.Delete(colName);
- bError = bError || !aColumns.Append(pColumn->getColumnImpl());
- }
- if(bError)
- ADOS::ThrowException(*(m_pCatalog->getConnection()->getConnection()),*this);
-
- m_pColumns->refresh();
- refreshColumns();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OAdoTable::alterColumnByIndex( sal_Int32 index, const Reference< XPropertySet >& descriptor ) throw(SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OTableDescriptor_BASE_TYPEDEF::rBHelper.bDisposed);
-
- Reference< XPropertySet > xOld;
- m_pColumns->getByIndex(index) >>= xOld;
- if(xOld.is())
- alterColumnByName(getString(xOld->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))),descriptor);
-}
-// -------------------------------------------------------------------------
-void OAdoTable::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception)
-{
- if(m_aTable.IsValid())
- {
- switch(nHandle)
- {
- case PROPERTY_ID_NAME:
- m_aTable.put_Name(getString(rValue));
- break;
-
- case PROPERTY_ID_TYPE:
- OTools::putValue( m_aTable.get_Properties(),
- OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),
- getString(rValue));
- break;
-
- case PROPERTY_ID_DESCRIPTION:
- OTools::putValue( m_aTable.get_Properties(),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Description")),
- getString(rValue));
- break;
-
- case PROPERTY_ID_SCHEMANAME:
- break;
-
- default:
- throw Exception();
- }
- }
- OTable_TYPEDEF::setFastPropertyValue_NoBroadcast(nHandle,rValue);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OAdoTable::acquire() throw()
-{
- OTable_TYPEDEF::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OAdoTable::release() throw()
-{
- OTable_TYPEDEF::release();
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OAdoTable::getName() throw(::com::sun::star::uno::RuntimeException)
-{
- return m_aTable.get_Name();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/ATables.cxx b/connectivity/source/drivers/ado/ATables.cxx
deleted file mode 100644
index c9872c4bc7..0000000000
--- a/connectivity/source/drivers/ado/ATables.cxx
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/ATables.hxx"
-#include "ado/ATable.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include "ado/ACatalog.hxx"
-#include "ado/AConnection.hxx"
-#include "ado/Awrapado.hxx"
-#include "TConnection.hxx"
-#include <comphelper/types.hxx>
-#include <cppuhelper/interfacecontainer.h>
-#include <connectivity/dbexception.hxx>
-#include "resource/ado_res.hrc"
-
-using namespace ::cppu;
-using namespace connectivity;
-using namespace comphelper;
-using namespace connectivity::ado;
-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::lang;
-
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OTables::createObject(const ::rtl::OUString& _rName)
-{
- OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid");
- return new OAdoTable(this,isCaseSensitive(),m_pCatalog,m_aCollection.GetItem(_rName));
-}
-// -------------------------------------------------------------------------
-void OTables::impl_refresh( ) throw(RuntimeException)
-{
- OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid");
- m_aCollection.Refresh();
- m_pCatalog->refreshTables();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OTables::createDescriptor()
-{
- return new OAdoTable(this,isCaseSensitive(),m_pCatalog);
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OTables::appendObject( const ::rtl::OUString&, const Reference< XPropertySet >& descriptor )
-{
- OAdoTable* pTable = NULL;
- if ( !getImplementation( pTable, descriptor ) || pTable == NULL )
- m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_TABLE_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
-
- OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid");
- if(!m_aCollection.Append(pTable->getImpl()))
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this));
- m_aCollection.Refresh();
-
- return new OAdoTable(this,isCaseSensitive(),m_pCatalog,pTable->getImpl());
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OTables::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName)
-{
- OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid");
- if ( !m_aCollection.Delete(_sElementName) )
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this));
-}
-// -----------------------------------------------------------------------------
-void OTables::appendNew(const ::rtl::OUString& _rsNewTable)
-{
- OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid");
- m_aCollection.Refresh();
-
- insertElement(_rsNewTable,NULL);
-
- // notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any());
- OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners);
- while (aListenerLoop.hasMoreElements())
- static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent);
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AUser.cxx b/connectivity/source/drivers/ado/AUser.cxx
deleted file mode 100644
index 350f0362ab..0000000000
--- a/connectivity/source/drivers/ado/AUser.cxx
+++ /dev/null
@@ -1,227 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/AUser.hxx"
-#include "ado/ACatalog.hxx"
-#include "ado/AGroups.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include "ado/AConnection.hxx"
-#include "ado/Awrapado.hxx"
-
-using namespace connectivity::ado;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-
-// -------------------------------------------------------------------------
-OAdoUser::OAdoUser(OCatalog* _pParent,sal_Bool _bCase, ADOUser* _pUser)
- : OUser_TYPEDEF(_bCase)
- ,m_pCatalog(_pParent)
-{
- construct();
-
- if(_pUser)
- m_aUser = WpADOUser(_pUser);
- else
- m_aUser.Create();
-}
-// -------------------------------------------------------------------------
-OAdoUser::OAdoUser(OCatalog* _pParent,sal_Bool _bCase, const ::rtl::OUString& _Name)
- : OUser_TYPEDEF(_Name,_bCase)
- , m_pCatalog(_pParent)
-{
- construct();
- m_aUser.Create();
- m_aUser.put_Name(_Name);
-}
-// -------------------------------------------------------------------------
-void OAdoUser::refreshGroups()
-{
- TStringVector aVector;
- WpADOGroups aGroups(m_aUser.get_Groups());
- aGroups.fillElementNames(aVector);
- if(m_pGroups)
- m_pGroups->reFill(aVector);
- else
- m_pGroups = new OGroups(m_pCatalog,m_aMutex,aVector,aGroups,isCaseSensitive());
-}
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OAdoUser::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OAdoUser::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : OUser_TYPEDEF::getSomething(rId);
-}
-
-// -------------------------------------------------------------------------
-void OAdoUser::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception)
-{
- if(m_aUser.IsValid())
- {
-
- switch(nHandle)
- {
- case PROPERTY_ID_NAME:
- {
- ::rtl::OUString aVal;
- rValue >>= aVal;
- m_aUser.put_Name(aVal);
- }
- break;
- }
- }
-}
-// -------------------------------------------------------------------------
-void OAdoUser::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
-{
- if(m_aUser.IsValid())
- {
- switch(nHandle)
- {
- case PROPERTY_ID_NAME:
- rValue <<= m_aUser.get_Name();
- break;
- }
- }
-}
-// -------------------------------------------------------------------------
-OUserExtend::OUserExtend(OCatalog* _pParent,sal_Bool _bCase, ADOUser* _pUser)
- : OAdoUser(_pParent,_bCase,_pUser)
-{
-}
-// -------------------------------------------------------------------------
-OUserExtend::OUserExtend(OCatalog* _pParent,sal_Bool _bCase, const ::rtl::OUString& _Name)
- : OAdoUser(_pParent,_bCase,_Name)
-{
-}
-
-// -------------------------------------------------------------------------
-void OUserExtend::construct()
-{
- OUser_TYPEDEF::construct();
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), PROPERTY_ID_PASSWORD,0,&m_Password,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
-}
-// -----------------------------------------------------------------------------
-cppu::IPropertyArrayHelper* OUserExtend::createArrayHelper() const
-{
- Sequence< com::sun::star::beans::Property > aProps;
- describeProperties(aProps);
- return new cppu::OPropertyArrayHelper(aProps);
-}
-// -------------------------------------------------------------------------
-cppu::IPropertyArrayHelper & OUserExtend::getInfoHelper()
-{
- return *OUserExtend_PROP::getArrayHelper();
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-void SAL_CALL OAdoUser::acquire() throw()
-{
- OUser_TYPEDEF::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OAdoUser::release() throw()
-{
- OUser_TYPEDEF::release();
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OAdoUser::getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_TYPEDEF::rBHelper.bDisposed);
-
- return ADOS::mapAdoRights2Sdbc(m_aUser.GetPermissions(objName, ADOS::mapObjectType2Ado(objType)));
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OAdoUser::getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_TYPEDEF::rBHelper.bDisposed);
-
- sal_Int32 nRights = 0;
- RightsEnum eRights = m_aUser.GetPermissions(objName, ADOS::mapObjectType2Ado(objType));
- if((eRights & adRightWithGrant) == adRightWithGrant)
- nRights = ADOS::mapAdoRights2Sdbc(eRights);
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this);
- return nRights;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OAdoUser::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_TYPEDEF::rBHelper.bDisposed);
- m_aUser.SetPermissions(objName,ADOS::mapObjectType2Ado(objType),adAccessGrant,RightsEnum(ADOS::mapRights2Ado(objPrivileges)));
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OAdoUser::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_TYPEDEF::rBHelper.bDisposed);
- m_aUser.SetPermissions(objName,ADOS::mapObjectType2Ado(objType),adAccessRevoke,RightsEnum(ADOS::mapRights2Ado(objPrivileges)));
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this);
-}
-// -----------------------------------------------------------------------------
-// XUser
-void SAL_CALL OAdoUser::changePassword( const ::rtl::OUString& objPassword, const ::rtl::OUString& newPassword ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_TYPEDEF::rBHelper.bDisposed);
- m_aUser.ChangePassword(objPassword,newPassword);
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this);
-}
-// -----------------------------------------------------------------------------
-
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AUsers.cxx b/connectivity/source/drivers/ado/AUsers.cxx
deleted file mode 100644
index e1abe6f2c9..0000000000
--- a/connectivity/source/drivers/ado/AUsers.cxx
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/AUsers.hxx"
-#include "ado/AUser.hxx"
-#include "ado/ATable.hxx"
-#include "ado/AConnection.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include "connectivity/sdbcx/IRefreshable.hxx"
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-#include "resource/ado_res.hrc"
-
-using namespace comphelper;
-using namespace connectivity;
-using namespace connectivity::ado;
-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;
-
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OUsers::createObject(const ::rtl::OUString& _rName)
-{
- return new OAdoUser(m_pCatalog,isCaseSensitive(),_rName);
-}
-// -------------------------------------------------------------------------
-void OUsers::impl_refresh() throw(RuntimeException)
-{
- m_aCollection.Refresh();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OUsers::createDescriptor()
-{
- return new OUserExtend(m_pCatalog,isCaseSensitive());
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OUsers::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- OUserExtend* pUser = NULL;
- if ( !getImplementation( pUser, descriptor ) || pUser == NULL )
- m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_USER_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
-
- ADOUsers* pUsers = (ADOUsers*)m_aCollection;
- pUsers->Append(OLEVariant(pUser->getImpl()),OLEString(pUser->getPassword()));
-
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OUsers::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName)
-{
- m_aCollection.Delete(_sElementName);
-}
-// -------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AView.cxx b/connectivity/source/drivers/ado/AView.cxx
deleted file mode 100644
index a5bc0d5491..0000000000
--- a/connectivity/source/drivers/ado/AView.cxx
+++ /dev/null
@@ -1,125 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/AView.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "ado/adoimp.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include "ado/Awrapado.hxx"
-#include <comphelper/sequence.hxx>
-#include <comphelper/types.hxx>
-#include "TConnection.hxx"
-
-// -------------------------------------------------------------------------
-using namespace comphelper;
-using namespace connectivity::ado;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-
-// IMPLEMENT_SERVICE_INFO(OAdoView,"com.sun.star.sdbcx.AView","com.sun.star.sdbcx.View");
-// -------------------------------------------------------------------------
-OAdoView::OAdoView(sal_Bool _bCase,ADOView* _pView) : OView_ADO(_bCase,NULL)
-,m_aView(_pView)
-{
-}
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OAdoView::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OAdoView::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : OView_ADO::getSomething(rId);
-}
-
-// -------------------------------------------------------------------------
-void OAdoView::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
-{
- if(m_aView.IsValid())
- {
- switch(nHandle)
- {
- case PROPERTY_ID_NAME:
- rValue <<= m_aView.get_Name();
- break;
- case PROPERTY_ID_CATALOGNAME:
- break;
- case PROPERTY_ID_SCHEMANAME:
- // rValue <<= m_aView.get_Type();
- break;
- case PROPERTY_ID_COMMAND:
- {
- OLEVariant aVar;
- m_aView.get_Command(aVar);
- if(!aVar.isNull() && !aVar.isEmpty())
- {
- ADOCommand* pCom = (ADOCommand*)aVar.getIDispatch();
- OLEString aBSTR;
- pCom->get_CommandText(&aBSTR);
- rValue <<= (::rtl::OUString) aBSTR;
- }
- }
- break;
- }
- }
- else
- OView_ADO::getFastPropertyValue(rValue,nHandle);
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OAdoView::acquire() throw()
-{
- OView_ADO::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OAdoView::release() throw()
-{
- OView_ADO::release();
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/AViews.cxx b/connectivity/source/drivers/ado/AViews.cxx
deleted file mode 100644
index bf99464dfa..0000000000
--- a/connectivity/source/drivers/ado/AViews.cxx
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/AViews.hxx"
-#include "ado/AView.hxx"
-#include "ado/ATables.hxx"
-#include "ado/ACatalog.hxx"
-#include "ado/AConnection.hxx"
-#include "ado/Awrapado.hxx"
-#include "TConnection.hxx"
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-#include "resource/ado_res.hrc"
-
-using namespace ::comphelper;
-
-using namespace connectivity;
-using namespace connectivity::ado;
-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;
-
-sdbcx::ObjectType OViews::createObject(const ::rtl::OUString& _rName)
-{
- OAdoView* pView = new OAdoView(isCaseSensitive(),m_aCollection.GetItem(_rName));
- pView->setNew(sal_False);
- return pView;
-}
-// -------------------------------------------------------------------------
-void OViews::impl_refresh( ) throw(RuntimeException)
-{
- m_aCollection.Refresh();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OViews::createDescriptor()
-{
- return new OAdoView(isCaseSensitive());
-}
-
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OViews::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- OAdoView* pView = NULL;
- if ( !getImplementation( pView, descriptor ) || pView == NULL )
- m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_VIEW_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
-
- WpADOCommand aCommand;
- aCommand.Create();
- if ( !aCommand.IsValid() )
- m_pCatalog->getConnection()->throwGenericSQLException( STR_VIEW_NO_COMMAND_ERROR,static_cast<XTypeProvider*>(this) );
-
- ::rtl::OUString sName( _rForName );
- aCommand.put_Name(sName);
- aCommand.put_CommandText(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND))));
- ADOViews* pViews = (ADOViews*)m_aCollection;
- if(FAILED(pViews->Append(OLEString(sName),aCommand)))
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this));
-
- OTables* pTables = static_cast<OTables*>(static_cast<OCatalog&>(m_rParent).getPrivateTables());
- if ( pTables )
- pTables->appendNew(sName);
-
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OViews::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName)
-{
- if(!m_aCollection.Delete(_sElementName))
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this));
-}
-// -------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/Aolevariant.cxx b/connectivity/source/drivers/ado/Aolevariant.cxx
deleted file mode 100644
index c22e7e2c90..0000000000
--- a/connectivity/source/drivers/ado/Aolevariant.cxx
+++ /dev/null
@@ -1,794 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/Aolevariant.hxx"
-#include "connectivity/dbconversion.hxx"
-#include <com/sun/star/sdbc/SQLException.hpp>
-#include <com/sun/star/util/Time.hpp>
-#include <com/sun/star/util/Date.hpp>
-#include <com/sun/star/util/DateTime.hpp>
-#include "diagnose_ex.h"
-#include "resource/sharedresources.hxx"
-#include "resource/ado_res.hrc"
-#include "com/sun/star/bridge/oleautomation/Date.hpp"
-#include "com/sun/star/bridge/oleautomation/Currency.hpp"
-#include "com/sun/star/bridge/oleautomation/SCode.hpp"
-#include "com/sun/star/bridge/oleautomation/Decimal.hpp"
-
-using namespace com::sun::star::beans;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::bridge::oleautomation;
-using namespace connectivity::ado;
-using ::rtl::OUString;
-
-OLEString::OLEString()
- :m_sStr(NULL)
-{
-}
-OLEString::OLEString(const BSTR& _sBStr)
- :m_sStr(_sBStr)
-{
-}
-OLEString::OLEString(const ::rtl::OUString& _sBStr)
-{
- m_sStr = ::SysAllocString(reinterpret_cast<LPCOLESTR>(_sBStr.getStr()));
-}
-OLEString::~OLEString()
-{
- if(m_sStr)
- ::SysFreeString(m_sStr);
-}
-OLEString& OLEString::operator=(const ::rtl::OUString& _rSrc)
-{
- if(m_sStr)
- ::SysFreeString(m_sStr);
- m_sStr = ::SysAllocString(reinterpret_cast<LPCOLESTR>(_rSrc.getStr()));
- 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;
-}
-OLEString::operator ::rtl::OUString() const
-{
- return (m_sStr != NULL) ? ::rtl::OUString(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(m_sStr)),::SysStringLen(m_sStr)) : ::rtl::OUString();
-}
-OLEString::operator BSTR() const
-{
- return m_sStr;
-}
-BSTR* OLEString::operator &()
-{
- return &m_sStr;
-}
-sal_Int32 OLEString::length() const
-{
- return (m_sStr != NULL) ? ::SysStringLen(m_sStr) : 0;
-}
-
-OLEVariant::OLEVariant()
-{
- VariantInit(this);
-}
-OLEVariant::OLEVariant(const VARIANT& varSrc)
-{
- ::VariantInit(this);
- HRESULT eRet = ::VariantCopy(this, const_cast<VARIANT*>(&varSrc));
- OSL_ENSURE(eRet == S_OK,"Error while copying an ado variant!");
- OSL_UNUSED(eRet);
-}
-OLEVariant::OLEVariant(const OLEVariant& varSrc)
-{
- ::VariantInit(this);
- HRESULT eRet = ::VariantCopy(this, const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc)));
- OSL_ENSURE(eRet == S_OK,"Error while copying an ado variant!");
- OSL_UNUSED(eRet);
-}
-
-OLEVariant::OLEVariant(sal_Bool x) { VariantInit(this); vt = VT_BOOL; boolVal = (x ? VARIANT_TRUE : VARIANT_FALSE);}
-OLEVariant::OLEVariant(sal_Int8 n) { VariantInit(this); vt = VT_I1; bVal = n;}
-OLEVariant::OLEVariant(sal_Int16 n) { VariantInit(this); vt = VT_I2; intVal = n;}
-OLEVariant::OLEVariant(sal_Int32 n) { VariantInit(this); vt = VT_I4; lVal = n;}
-OLEVariant::OLEVariant(sal_Int64 x) { VariantInit(this); vt = VT_I4; lVal = (LONG)x;}
-
-OLEVariant::OLEVariant(const rtl::OUString& us)
-{
- ::VariantInit(this);
- vt = VT_BSTR;
- bstrVal = SysAllocString(reinterpret_cast<LPCOLESTR>(us.getStr()));
-}
-OLEVariant::~OLEVariant()
-{
- HRESULT eRet = ::VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
-} // clears all the memory that was allocated before
-
-OLEVariant::OLEVariant(const ::com::sun::star::util::Date& x )
-{
- VariantInit(this);
- vt = VT_DATE;
- dblVal = ::dbtools::DBTypeConversion::toDouble(x,::com::sun::star::util::Date(30,12,1899));
-}
-OLEVariant::OLEVariant(const ::com::sun::star::util::Time& x )
-{
- VariantInit(this);
- vt = VT_DATE;
- dblVal = ::dbtools::DBTypeConversion::toDouble(x);
-}
-OLEVariant::OLEVariant(const ::com::sun::star::util::DateTime& x )
-{
- VariantInit(this);
- vt = VT_DATE;
- dblVal = ::dbtools::DBTypeConversion::toDouble(x,::com::sun::star::util::Date(30,12,1899));
-}
-OLEVariant::OLEVariant(const float &x)
-{
- VariantInit(this);
- vt = VT_R4;
- fltVal = x;
-}
-OLEVariant::OLEVariant(const double &x)
-{
- VariantInit(this);
- vt = VT_R8;
- dblVal = x;
-}
-
-
-OLEVariant::OLEVariant(IDispatch* pDispInterface)
-{
- VariantInit(this);
- setIDispatch( pDispInterface );
-}
-
-OLEVariant::OLEVariant(const ::com::sun::star::uno::Sequence< sal_Int8 >& x)
-{
- VariantInit(this);
-
- vt = VT_ARRAY|VT_UI1;
-
- SAFEARRAYBOUND rgsabound[1];
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = x.getLength();
- // parray = SafeArrayCreate(VT_UI1,1,rgsabound);
- 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)
- {
- sal_Int32 nData = *pBegin;
- HRESULT rs = SafeArrayPutElement(parray,&i,&nData);
- OSL_ENSURE(S_OK == rs,"Error while copy byte data");
- OSL_UNUSED(rs);
- }
-}
-//
-OLEVariant& OLEVariant::operator=(const OLEVariant& varSrc)
-{
- HRESULT eRet = ::VariantCopy(this, const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc)));
- OSL_ENSURE(eRet == S_OK,"Error while copying an ado variant!");
- OSL_UNUSED(eRet);
- return *this;
-}
-// Assign a const VARIANT& (::VariantCopy handles everything)
-//
-OLEVariant& OLEVariant::operator=(const tagVARIANT& varSrc)
-{
- HRESULT eRet = ::VariantCopy(this, const_cast<VARIANT*>(&varSrc));
- OSL_ENSURE(eRet == S_OK,"Error while copying an ado variant!");
- OSL_UNUSED(eRet);
-
- return *this;
-}
-
-// Assign a const VARIANT* (::VariantCopy handles everything)
-//
-OLEVariant& OLEVariant::operator=(const VARIANT* pSrc)
-{
- HRESULT eRet = ::VariantCopy(this, const_cast<VARIANT*>(pSrc));
- OSL_ENSURE(eRet == S_OK,"Error while copying an ado variant!");
- OSL_UNUSED(eRet);
-
- return *this;
-}
-
-void OLEVariant::setByte(sal_uInt8 n)
-{
- HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
- vt = VT_UI1;
- bVal = n;
-}
-void OLEVariant::setInt16(sal_Int16 n)
-{
- HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
- vt = VT_I2;
- iVal = n;
-}
-void OLEVariant::setInt32(sal_Int32 n)
-{
- HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
- vt = VT_I4;
- lVal = n;
-}
-void OLEVariant::setFloat(float f)
-{ HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
- vt = VT_R4;
- fltVal = f;
-}
-void OLEVariant::setDouble(double d)
-{
- HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
- vt = VT_R8;
- dblVal = d;
-}
-void OLEVariant::setDate(DATE d)
-{ HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
- vt = VT_DATE;
- date = d;
-}
-void OLEVariant::setChar(unsigned char a)
-{
- HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
- vt = VT_UI1;
- bVal = a;
-}
-void OLEVariant::setCurrency(double aCur)
-{
- HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
- vt = VT_CY;
- set(aCur*10000);
-}
-void OLEVariant::setBool(sal_Bool b)
-{
- HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
- vt = VT_BOOL;
- boolVal = b ? VARIANT_TRUE : VARIANT_FALSE;
-}
-void OLEVariant::setString(const rtl::OUString& us)
-{
- HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
- vt = VT_BSTR;
- bstrVal = ::SysAllocString(reinterpret_cast<LPCOLESTR>(us.getStr()));
-}
-void OLEVariant::setNoArg()
-{
- HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
- vt = VT_ERROR;
- scode = DISP_E_PARAMNOTFOUND;
-}
-
-void OLEVariant::setNull()
-{
- HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
- vt = VT_NULL;
-}
-void OLEVariant::setEmpty()
-{
- HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
- vt = VT_EMPTY;
-}
-
-void OLEVariant::setUI1SAFEARRAYPtr(SAFEARRAY* pSafeAr)
-{
- HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
- vt = VT_ARRAY|VT_UI1; parray = pSafeAr;
-}
-
-void OLEVariant::setArray(SAFEARRAY* pSafeArray, VARTYPE vtType)
-{
- HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
- vt = (VARTYPE)(VT_ARRAY|vtType);
- parray = pSafeArray;
-}
-
-void OLEVariant::setIDispatch(IDispatch* pDispInterface)
-{
- HRESULT eRet = VariantClear(this);
- OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- OSL_UNUSED(eRet);
-
- vt = VT_DISPATCH;
- pdispVal = pDispInterface;
-
- if ( pDispInterface )
- pDispInterface->AddRef();
-}
-
-
-sal_Bool OLEVariant::isNull() const { return (vt == VT_NULL); }
-sal_Bool OLEVariant::isEmpty() const { return (vt == VT_EMPTY); }
-
-VARTYPE OLEVariant::getType() const { return vt; }
-
-OLEVariant::operator ::com::sun::star::util::Date() const
-{
- return isNull() ? ::com::sun::star::util::Date(30,12,1899) : ::dbtools::DBTypeConversion::toDate(getDate(),::com::sun::star::util::Date(30,12,1899));
-}
-OLEVariant::operator ::com::sun::star::util::Time() const
-{
- return isNull() ? ::com::sun::star::util::Time() : ::dbtools::DBTypeConversion::toTime(getDate());
-}
-OLEVariant::operator ::com::sun::star::util::DateTime()const
-{
- return isNull() ? ::com::sun::star::util::DateTime() : ::dbtools::DBTypeConversion::toDateTime(getDate(),::com::sun::star::util::Date(30,12,1899));
-}
-
-VARIANT_BOOL OLEVariant::VariantBool(sal_Bool bEinBoolean)
-{
- return (bEinBoolean ? VARIANT_TRUE : VARIANT_FALSE);
-}
-
-void OLEVariant::CHS()
-{
- cyVal.Lo ^= (sal_uInt32)-1;
- cyVal.Hi ^= -1;
- cyVal.Lo++;
- if( !cyVal.Lo )
- cyVal.Hi++;
-}
-
-void OLEVariant::set(double n)
-{
- if( n >= 0 )
- {
- cyVal.Hi = (sal_Int32)(n / (double)4294967296.0);
- cyVal.Lo = (sal_uInt32)(n - ((double)cyVal.Hi * (double)4294967296.0));
- }
- else {
- cyVal.Hi = (sal_Int32)(-n / (double)4294967296.0);
- cyVal.Lo = (sal_uInt32)(-n - ((double)cyVal.Hi * (double)4294967296.0));
- CHS();
- }
-}
-
-OLEVariant::operator rtl::OUString() const
-{
- if (V_VT(this) == VT_BSTR)
- return reinterpret_cast<const sal_Unicode*>(LPCOLESTR(V_BSTR(this)));
-
- if(isNull())
- return ::rtl::OUString();
-
- OLEVariant varDest;
-
- varDest.ChangeType(VT_BSTR, this);
-
- return reinterpret_cast<const sal_Unicode*>(LPCOLESTR(V_BSTR(&varDest)));
-}
-
-// -----------------------------------------------------------------------------
-void OLEVariant::ChangeType(VARTYPE vartype, const OLEVariant* pSrc)
-{
- //
- // If pDest is NULL, convert type in place
- //
- if (pSrc == NULL)
- pSrc = this;
-
- if ( ( this != pSrc )
- || ( vartype != V_VT( this ) )
- )
- {
- if ( FAILED( ::VariantChangeType( static_cast< VARIANT* >( this ),
- const_cast< VARIANT* >( static_cast< const VARIANT* >( pSrc ) ),
- 0,
- vartype ) ) )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(STR_TYPE_NOT_CONVERT));
- throw ::com::sun::star::sdbc::SQLException(
- sError,
- NULL,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "S1000" )),
- 1000,
- ::com::sun::star::uno::Any()
- );
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-OLEVariant::operator ::com::sun::star::uno::Sequence< sal_Int8 >() const
-{
- ::com::sun::star::uno::Sequence< sal_Int8 > aRet;
- if(V_VT(this) == VT_BSTR)
- {
- OLEString sStr(V_BSTR(this));
- aRet = ::com::sun::star::uno::Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>((const wchar_t*)sStr),sizeof(sal_Unicode)*sStr.length());
- }
- else if(!isNull())
- {
- SAFEARRAY* pArray = getUI1SAFEARRAYPtr();
-
- if(pArray)
- {
- HRESULT hresult1,hresult2;
- long lBound,uBound;
- // Verify that the SafeArray is the proper shape.
- hresult1 = ::SafeArrayGetLBound(pArray, 1, &lBound);
- hresult2 = ::SafeArrayGetUBound(pArray, 1, &uBound);
- if ( SUCCEEDED(hresult1) && SUCCEEDED(hresult2) )
- {
- long nCount = uBound-lBound+1;
- aRet.realloc(nCount);
- sal_Int8* pData = aRet.getArray();
- for(long i=0; SUCCEEDED(hresult1) && lBound <= uBound ;++i,++lBound)
- {
- sal_Int32 nData = 0;
- hresult1 = ::SafeArrayGetElement(pArray,&lBound,&nData);
- if ( SUCCEEDED(hresult1) )
- {
- *pData = static_cast<sal_Int8>(nData);
- ++pData;
- }
- }
- }
- }
- }
-
- return aRet;
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OLEVariant::getString() const
-{
- if(isNull())
- return ::rtl::OUString();
- else
- return *this;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OLEVariant::getBool() const
-{
- if (V_VT(this) == VT_BOOL)
- return V_BOOL(this) == VARIANT_TRUE ? sal_True : sal_False;
- if(isNull())
- return sal_False;
-
- OLEVariant varDest;
-
- varDest.ChangeType(VT_BOOL, this);
-
- return V_BOOL(&varDest) == VARIANT_TRUE ? sal_True : sal_False;
-}
-// -----------------------------------------------------------------------------
-IUnknown* OLEVariant::getIUnknown() const
-{
- if (V_VT(this) == VT_UNKNOWN)
- {
- return V_UNKNOWN(this);
- }
- if(isNull())
- return NULL;
-
- OLEVariant varDest;
-
- varDest.ChangeType(VT_UNKNOWN, this);
-
- V_UNKNOWN(&varDest)->AddRef();
- return V_UNKNOWN(&varDest);
-}
-// -----------------------------------------------------------------------------
-IDispatch* OLEVariant::getIDispatch() const
-{
- if (V_VT(this) == VT_DISPATCH)
- {
- return V_DISPATCH(this);
- }
-
- if(isNull())
- return NULL;
-
- OLEVariant varDest;
-
- varDest.ChangeType(VT_DISPATCH, this);
-
- V_DISPATCH(&varDest)->AddRef();
- return V_DISPATCH(&varDest);
-}
-// -----------------------------------------------------------------------------
-sal_uInt8 OLEVariant::getByte() const
-{
- if (V_VT(this) == VT_UI1)
- return V_UI1(this);
-
- if(isNull())
- return sal_Int8(0);
- OLEVariant varDest;
-
- varDest.ChangeType(VT_UI1, this);
-
- return V_UI1(&varDest);
-}
-// -----------------------------------------------------------------------------
-sal_Int16 OLEVariant::getInt16() const
-{
- if (V_VT(this) == VT_I2)
- return V_I2(this);
-
- if(isNull())
- return sal_Int16(0);
- OLEVariant varDest;
-
- varDest.ChangeType(VT_I2, this);
-
- return V_I2(&varDest);
-}
-// -----------------------------------------------------------------------------
-sal_Int8 OLEVariant::getInt8() const
-{
- if (V_VT(this) == VT_I1)
- return V_I1(this);
-
- if(isNull())
- return sal_Int8(0);
-
- OLEVariant varDest;
-
- varDest.ChangeType(VT_I1, this);
-
- return V_I1(&varDest);
-}
-// -----------------------------------------------------------------------------
-sal_Int32 OLEVariant::getInt32() const
-{
- if (V_VT(this) == VT_I4)
- return V_I4(this);
-
- if(isNull())
- return sal_Int32(0);
-
- OLEVariant varDest;
-
- varDest.ChangeType(VT_I4, this);
-
- return V_I4(&varDest);
-}
-// -----------------------------------------------------------------------------
-sal_uInt32 OLEVariant::getUInt32() const
-{
- if (V_VT(this) == VT_UI4)
- return V_UI4(this);
-
- if(isNull())
- return sal_uInt32(0);
-
- OLEVariant varDest;
-
- varDest.ChangeType(VT_UI4, this);
-
- return V_UI4(&varDest);
-}
-// -----------------------------------------------------------------------------
-float OLEVariant::getFloat() const
-{
- if (V_VT(this) == VT_R4)
- return V_R4(this);
-
- if(isNull())
- return float(0);
- OLEVariant varDest;
-
- varDest.ChangeType(VT_R4, this);
-
- return V_R4(&varDest);
-}
-// -----------------------------------------------------------------------------
-double OLEVariant::getDouble() const
-{
- if (V_VT(this) == VT_R8)
- return V_R8(this);
-
- if(isNull())
- return double(0);
- OLEVariant varDest;
-
- varDest.ChangeType(VT_R8, this);
-
- return V_R8(&varDest);
-}
-// -----------------------------------------------------------------------------
-double OLEVariant::getDate() const
-{
- if (V_VT(this) == VT_DATE)
- return V_DATE(this);
-
- if(isNull())
- return double(0);
- OLEVariant varDest;
-
- varDest.ChangeType(VT_DATE, this);
-
- return V_DATE(&varDest);
-}
-// -----------------------------------------------------------------------------
-CY OLEVariant::getCurrency() const
-{
- if (V_VT(this) == VT_CY)
- return V_CY(this);
-
- if(isNull())
- {
- CY aVar;
- aVar.int64 = sal_Int64(0);
- return aVar;
- }
- OLEVariant varDest;
-
- varDest.ChangeType(VT_CY, this);
-
- return V_CY(&varDest);
-}
-// -----------------------------------------------------------------------------
-SAFEARRAY* OLEVariant::getUI1SAFEARRAYPtr() const
-{
- if (V_VT(this) == (VT_ARRAY|VT_UI1))
- return V_ARRAY(this);
-
- if(isNull())
- return (0);
- OLEVariant varDest;
-
- varDest.ChangeType((VT_ARRAY|VT_UI1), this);
-
- return V_ARRAY(&varDest);
-}
-// -----------------------------------------------------------------------------
-::com::sun::star::uno::Any OLEVariant::makeAny() const
-{
- ::com::sun::star::uno::Any aValue;
- switch (V_VT(this))
- {
- case VT_EMPTY:
- case VT_NULL:
- aValue.setValue(NULL, Type());
- break;
- case VT_I2:
- aValue.setValue( & iVal, getCppuType( (sal_Int16*)0));
- break;
- case VT_I4:
- aValue.setValue( & lVal, getCppuType( (sal_Int32*)0));
- break;
- case VT_R4:
- aValue.setValue( & fltVal, getCppuType( (float*)0));
- break;
- case VT_R8:
- aValue.setValue(& dblVal, getCppuType( (double*)0));
- break;
- case VT_CY:
- {
- Currency cy(cyVal.int64);
- aValue <<= cy;
- break;
- }
- case VT_DATE:
- {
- aValue <<= (::com::sun::star::util::Date)*this;
- break;
- }
- case VT_BSTR:
- {
- OUString b(reinterpret_cast<const sal_Unicode*>(bstrVal));
- aValue.setValue( &b, getCppuType( &b));
- break;
- }
- case VT_BOOL:
- {
- sal_Bool b= boolVal == VARIANT_TRUE;
- aValue.setValue( &b, getCppuType( &b));
- break;
- }
- case VT_I1:
- aValue.setValue( & cVal, getCppuType((sal_Int8*)0));
- break;
- case VT_UI1: // there is no unsigned char in UNO
- aValue.setValue( & bVal, getCppuType( (sal_Int8*)0));
- break;
- case VT_UI2:
- aValue.setValue( & uiVal, getCppuType( (sal_uInt16*)0));
- break;
- case VT_UI4:
- aValue.setValue( & ulVal, getCppuType( (sal_uInt32*)0));
- break;
- case VT_INT:
- aValue.setValue( & intVal, getCppuType( (sal_Int32*)0));
- break;
- case VT_UINT:
- aValue.setValue( & uintVal, getCppuType( (sal_uInt32*)0));
- break;
- case VT_VOID:
- aValue.setValue( NULL, Type());
- break;
- case VT_DECIMAL:
- {
- Decimal dec;
- dec.Scale = decVal.scale;
- dec.Sign = decVal.sign;
- dec.LowValue = decVal.Lo32;
- dec.MiddleValue = decVal.Mid32;
- dec.HighValue = decVal.Hi32;
- aValue <<= dec;
- break;
- }
-
- default:
- break;
- }
- return aValue;
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/Aservices.cxx b/connectivity/source/drivers/ado/Aservices.cxx
deleted file mode 100644
index 210cf52792..0000000000
--- a/connectivity/source/drivers/ado/Aservices.cxx
+++ /dev/null
@@ -1,123 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ado/ADriver.hxx"
-#include <cppuhelper/factory.hxx>
-
-using namespace connectivity::ado;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames ,
- rtl_ModuleCount* _pT
- );
-
-//---------------------------------------------------------------------------------------
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- sal_Char const* pImplementationName
- )
- : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString(RTL_CONSTASCII_USTRINGPARAM(pImplementationName)))
- {
- }
-
- inline
- sal_Bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
- }
- catch(...)
- {
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
- const sal_Char **ppEnvTypeName,
- uno_Environment ** /*ppEnv*/)
-{
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ":affine";
-}
-
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = 0;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- ODriver::getImplementationName_Static(),
- ODriver::getSupportedServiceNames_Static(),
- ODriver_CreateInstance, ::cppu::createSingleFactory)
- ;
-
- if(aReq.xRet.is())
- aReq.xRet->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/Awrapado.cxx b/connectivity/source/drivers/ado/Awrapado.cxx
deleted file mode 100644
index 47886990a6..0000000000
--- a/connectivity/source/drivers/ado/Awrapado.cxx
+++ /dev/null
@@ -1,2205 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <sal/macros.h>
-#include "ado/Awrapado.hxx"
-#include "ado/Awrapadox.hxx"
-#include <comphelper/types.hxx>
-#include <rtl/ustrbuf.hxx>
-#include "diagnose_ex.h"
-
-namespace connectivity
-{
- namespace ado
- {
- sal_Int32 nAdoObjectCounter = 0;
- }
-}
-
-using namespace connectivity::ado;
-
-void WpADOCatalog::Create()
-{
- HRESULT hr = -1;
- _ADOCatalog* pCommand;
- hr = CoCreateInstance(ADOS::CLSID_ADOCATALOG_25,
- NULL,
- CLSCTX_INPROC_SERVER,
- ADOS::IID_ADOCATALOG_25,
- (void**)&pCommand );
-
-
- if( !FAILED( hr ) )
- setWithOutAddRef(pCommand);
-}
-
-
-WpADOProperties WpADOConnection::get_Properties() const
-{
- ADOProperties* pProps=NULL;
- pInterface->get_Properties(&pProps);
- WpADOProperties aProps;
- aProps.setWithOutAddRef(pProps);
- return aProps;
-}
-
-rtl::OUString WpADOConnection::GetConnectionString() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_ConnectionString(&aBSTR);
- return aBSTR;
-}
-
-sal_Bool WpADOConnection::PutConnectionString(const ::rtl::OUString &aCon) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString bstr(aCon);
- sal_Bool bErg = SUCCEEDED(pInterface->put_ConnectionString(bstr));
-
- return bErg;
-}
-
-sal_Int32 WpADOConnection::GetCommandTimeout() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 nRet=0;
- pInterface->get_CommandTimeout(&nRet);
- return nRet;
-}
-
-void WpADOConnection::PutCommandTimeout(sal_Int32 nRet)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_CommandTimeout(nRet);
-}
-
-sal_Int32 WpADOConnection::GetConnectionTimeout() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 nRet=0;
- pInterface->get_ConnectionTimeout(&nRet);
- return nRet;
-}
-
-void WpADOConnection::PutConnectionTimeout(sal_Int32 nRet)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_ConnectionTimeout(nRet);
-}
-
-sal_Bool WpADOConnection::Close( )
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return (SUCCEEDED(pInterface->Close()));
-}
-
-sal_Bool WpADOConnection::Execute(const ::rtl::OUString& _CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString sStr1(_CommandText);
- sal_Bool bErg = SUCCEEDED(pInterface->Execute(sStr1,&RecordsAffected,Options,(_ADORecordset**)ppiRset));
- return bErg;
-}
-
-sal_Bool WpADOConnection::BeginTrans()
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 nIso=0;
- return SUCCEEDED(pInterface->BeginTrans(&nIso));
-}
-
-sal_Bool WpADOConnection::CommitTrans( )
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->CommitTrans());
-}
-
-sal_Bool WpADOConnection::RollbackTrans( )
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->RollbackTrans());
-}
-
-sal_Bool WpADOConnection::Open(const ::rtl::OUString& ConnectionString, const ::rtl::OUString& UserID,const ::rtl::OUString& Password,long Options)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString sStr1(ConnectionString);
- OLEString sStr2(UserID);
- OLEString sStr3(Password);
- sal_Bool bErg = SUCCEEDED(pInterface->Open(sStr1,sStr2,sStr3,Options));
- return bErg;
-}
-
-sal_Bool WpADOConnection::GetErrors(ADOErrors** pErrors)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->get_Errors(pErrors));
-}
-
-::rtl::OUString WpADOConnection::GetDefaultDatabase() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR; pInterface->get_DefaultDatabase(&aBSTR);
- return aBSTR;
-}
-
-sal_Bool WpADOConnection::PutDefaultDatabase(const ::rtl::OUString& _bstr)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString bstr(_bstr);
- sal_Bool bErg = SUCCEEDED(pInterface->put_DefaultDatabase(bstr));
-
- return bErg;
-}
-
-IsolationLevelEnum WpADOConnection::get_IsolationLevel() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- IsolationLevelEnum eNum=adXactUnspecified;
- pInterface->get_IsolationLevel(&eNum);
- return eNum;
-}
-
-sal_Bool WpADOConnection::put_IsolationLevel(const IsolationLevelEnum& eNum)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->put_IsolationLevel(eNum));
-}
-
-sal_Int32 WpADOConnection::get_Attributes() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 nRet=0;
- pInterface->get_Attributes(&nRet);
- return nRet;
-}
-
-sal_Bool WpADOConnection::put_Attributes(sal_Int32 nRet)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->put_Attributes(nRet));
-}
-
-CursorLocationEnum WpADOConnection::get_CursorLocation() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- CursorLocationEnum eNum=adUseNone;
- pInterface->get_CursorLocation(&eNum);
- return eNum;
-}
-
-sal_Bool WpADOConnection::put_CursorLocation(const CursorLocationEnum &eNum)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->put_CursorLocation(eNum));
-}
-
-ConnectModeEnum WpADOConnection::get_Mode() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ConnectModeEnum eNum=adModeUnknown;
- pInterface->get_Mode(&eNum);
- return eNum;
-}
-
-sal_Bool WpADOConnection::put_Mode(const ConnectModeEnum &eNum)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->put_Mode(eNum));
-}
-
-::rtl::OUString WpADOConnection::get_Provider() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR; pInterface->get_Provider(&aBSTR);
- return aBSTR;
-}
-
-sal_Bool WpADOConnection::put_Provider(const ::rtl::OUString& _bstr)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString bstr(_bstr);
- return SUCCEEDED(pInterface->put_Provider(bstr));
-}
-
-sal_Int32 WpADOConnection::get_State() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 nRet=0;
- pInterface->get_State(&nRet);
- return nRet;
-}
-
-sal_Bool WpADOConnection::OpenSchema(SchemaEnum eNum,OLEVariant& Restrictions,OLEVariant& SchemaID,ADORecordset**pprset)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->OpenSchema(eNum,Restrictions,SchemaID,pprset));
-}
-
-::rtl::OUString WpADOConnection::get_Version() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_Version(&aBSTR);
- return aBSTR;
-}
-
-sal_Bool WpADOCommand::putref_ActiveConnection( WpADOConnection *pCon)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- if(pCon)
- return SUCCEEDED(pInterface->putref_ActiveConnection(pCon->pInterface));
- else
- return SUCCEEDED(pInterface->putref_ActiveConnection(NULL));
-}
-
-void WpADOCommand::put_ActiveConnection(/* [in] */ const OLEVariant& vConn)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_ActiveConnection(vConn);
-}
-
-void WpADOCommand::Create()
-{
- IClassFactory2* pInterface2 = NULL;
- IUnknown *pOuter = NULL;
- HRESULT hr;
- hr = CoGetClassObject( ADOS::CLSID_ADOCOMMAND_21,
- CLSCTX_INPROC_SERVER,
- NULL,
- IID_IClassFactory2,
- (void**)&pInterface2 );
-
- if( !FAILED( hr ) )
- {
- ADOCommand* pCommand=NULL;
-
- hr = pInterface2->CreateInstanceLic( pOuter,
- NULL,
- ADOS::IID_ADOCOMMAND_21,
- ADOS::GetKeyStr(),
- (void**) &pCommand);
-
- if( !FAILED( hr ) )
- {
- operator=(pCommand);
- pCommand->Release();
- }
-
- pInterface2->Release();
- }
-}
-
-sal_Int32 WpADOCommand::get_State() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 nRet=0;
- pInterface->get_State(&nRet);
- return nRet;
-}
-
-::rtl::OUString WpADOCommand::get_CommandText() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_CommandText(&aBSTR);
- return aBSTR;
-}
-
-sal_Bool WpADOCommand::put_CommandText(const ::rtl::OUString &aCon)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString bstr(aCon);
- sal_Bool bErg = SUCCEEDED(pInterface->put_CommandText(bstr));
-
- return bErg;
-}
-
-sal_Int32 WpADOCommand::get_CommandTimeout() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 nRet=0;
- pInterface->get_CommandTimeout(&nRet);
- return nRet;
-}
-
-void WpADOCommand::put_CommandTimeout(sal_Int32 nRet)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_CommandTimeout(nRet);
-}
-
-sal_Bool WpADOCommand::get_Prepared() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- VARIANT_BOOL bPrepared = VARIANT_FALSE;
- pInterface->get_Prepared(&bPrepared);
- return bPrepared == VARIANT_TRUE;
-}
-
-sal_Bool WpADOCommand::put_Prepared(VARIANT_BOOL bPrepared) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->put_Prepared(bPrepared));
-}
-
-sal_Bool WpADOCommand::Execute(OLEVariant& RecordsAffected,OLEVariant& Parameters,long Options, ADORecordset** ppiRset)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->Execute(&RecordsAffected,&Parameters,Options,ppiRset));
-}
-
-ADOParameter* WpADOCommand::CreateParameter(const ::rtl::OUString &_bstr,DataTypeEnum Type,ParameterDirectionEnum Direction,long nSize,const OLEVariant &Value)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOParameter* pPara = NULL;
- OLEString bstr(_bstr);
- sal_Bool bErg = SUCCEEDED(pInterface->CreateParameter(bstr,Type,Direction,nSize,Value,&pPara));
-
- return bErg ? pPara : NULL;
-}
-
-ADOParameters* WpADOCommand::get_Parameters() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOParameters* pPara=NULL;
- pInterface->get_Parameters(&pPara);
- return pPara;
-}
-
-sal_Bool WpADOCommand::put_CommandType( /* [in] */ CommandTypeEnum lCmdType)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->put_CommandType(lCmdType));
-}
-
-CommandTypeEnum WpADOCommand::get_CommandType( ) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- CommandTypeEnum eNum=adCmdUnspecified;
- pInterface->get_CommandType(&eNum);
- return eNum;
-}
-
-// returns the name of the field
-::rtl::OUString WpADOCommand::GetName() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_Name(&aBSTR);
- return aBSTR;
-}
-
-sal_Bool WpADOCommand::put_Name(const ::rtl::OUString& _Name)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString bstr(_Name);
- sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
-
- return bErg;
-}
-sal_Bool WpADOCommand::Cancel()
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->Cancel());
-}
-
-::rtl::OUString WpADOError::GetDescription() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_Description(&aBSTR);
- return aBSTR;
-}
-
- ::rtl::OUString WpADOError::GetSource() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_Source(&aBSTR);
- return aBSTR;
-}
-
- sal_Int32 WpADOError::GetNumber() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 nErrNr=0;
- pInterface->get_Number(&nErrNr);
- return nErrNr;
-}
-
- ::rtl::OUString WpADOError::GetSQLState() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_SQLState(&aBSTR);
- return aBSTR;
-}
-
- sal_Int32 WpADOError::GetNativeError() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 nErrNr=0;
- pInterface->get_NativeError(&nErrNr);
- return nErrNr;
-}
-WpADOProperties WpADOField::get_Properties()
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOProperties* pProps = NULL;
- pInterface->get_Properties(&pProps);
- WpADOProperties aProps;
-
- aProps.setWithOutAddRef(pProps);
- return aProps;
-}
-
- sal_Int32 WpADOField::GetActualSize() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADO_LONGPTR nActualSize=0;
- pInterface->get_ActualSize(&nActualSize);
- return nActualSize;
-}
-
- sal_Int32 WpADOField::GetAttributes() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 eADOSFieldAttributes=0;
- pInterface->get_Attributes(&eADOSFieldAttributes);
- return eADOSFieldAttributes;
-}
-
-sal_Int32 WpADOField::GetStatus() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 eADOSFieldAttributes=0;
- // pInterface->get_Status(&eADOSFieldAttributes);
- return eADOSFieldAttributes;
-}
-
-sal_Int32 WpADOField::GetDefinedSize() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADO_LONGPTR nDefinedSize=0;
- pInterface->get_DefinedSize(&nDefinedSize);
- return nDefinedSize;
-}
-
-// returns the name of the field
-::rtl::OUString WpADOField::GetName() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_Name(&aBSTR);
- return aBSTR;
-}
-
- DataTypeEnum WpADOField::GetADOType() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- DataTypeEnum eType=adEmpty;
- pInterface->get_Type(&eType);
- return eType;
-}
-
- void WpADOField::get_Value(OLEVariant& aValVar) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- aValVar.setEmpty();
- sal_Bool bOk = SUCCEEDED(pInterface->get_Value(&aValVar));
- (void)bOk;
-}
-
- OLEVariant WpADOField::get_Value() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEVariant aValVar;
- pInterface->get_Value(&aValVar);
- return aValVar;
-}
-
- sal_Bool WpADOField::PutValue(const OLEVariant& aVariant)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return (SUCCEEDED(pInterface->put_Value(aVariant)));
-}
-
-sal_Int32 WpADOField::GetPrecision() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_uInt8 eType=0;
- pInterface->get_Precision(&eType);
- return eType;
-}
-
- sal_Int32 WpADOField::GetNumericScale() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_uInt8 eType=0;
- pInterface->get_NumericScale(&eType);
- return eType;
-}
-
- sal_Bool WpADOField::AppendChunk(const OLEVariant& _Variant)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return (SUCCEEDED(pInterface->AppendChunk(_Variant)));
-}
-
-OLEVariant WpADOField::GetChunk(long Length) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEVariant aValVar;
- pInterface->GetChunk(Length,&aValVar);
- return aValVar;
-}
-
-void WpADOField::GetChunk(long Length,OLEVariant &aValVar) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->GetChunk(Length,&aValVar);
-}
-
-OLEVariant WpADOField::GetOriginalValue() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEVariant aValVar;
- pInterface->get_OriginalValue(&aValVar);
- return aValVar;
-}
-
-void WpADOField::GetOriginalValue(OLEVariant &aValVar) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->get_OriginalValue(&aValVar);
-}
-
-OLEVariant WpADOField::GetUnderlyingValue() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEVariant aValVar;
- pInterface->get_UnderlyingValue(&aValVar);
- return aValVar;
-}
-
- void WpADOField::GetUnderlyingValue(OLEVariant &aValVar) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->get_UnderlyingValue(&aValVar);
-}
-
- sal_Bool WpADOField::PutPrecision(sal_Int8 _prec)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return (SUCCEEDED(pInterface->put_Precision(_prec)));
-}
-
- sal_Bool WpADOField::PutNumericScale(sal_Int8 _prec)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return (SUCCEEDED(pInterface->put_NumericScale(_prec)));
-}
-
- void WpADOField::PutADOType(DataTypeEnum eType)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_Type(eType);
-}
-
- sal_Bool WpADOField::PutDefinedSize(sal_Int32 _nDefSize)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return (SUCCEEDED(pInterface->put_DefinedSize(_nDefSize)));
-}
-
- sal_Bool WpADOField::PutAttributes(sal_Int32 _nDefSize)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return (SUCCEEDED(pInterface->put_Attributes(_nDefSize)));
-}
-
-OLEVariant WpADOProperty::GetValue() const
-{
- OLEVariant aValVar;
- if(pInterface)
- pInterface->get_Value(&aValVar);
- return aValVar;
-}
-
-void WpADOProperty::GetValue(OLEVariant &aValVar) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- if(pInterface)
- pInterface->get_Value(&aValVar);
-}
-
-sal_Bool WpADOProperty::PutValue(const OLEVariant &aValVar)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return (SUCCEEDED(pInterface->put_Value(aValVar)));
-}
-
- ::rtl::OUString WpADOProperty::GetName() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_Name(&aBSTR);
- return aBSTR;
-}
-
- DataTypeEnum WpADOProperty::GetADOType() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- DataTypeEnum eType=adEmpty;
- pInterface->get_Type(&eType);
- return eType;
-}
-
- sal_Int32 WpADOProperty::GetAttributes() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 eADOSFieldAttributes=0;
- pInterface->get_Attributes(&eADOSFieldAttributes);
- return eADOSFieldAttributes;
-}
-
- sal_Bool WpADOProperty::PutAttributes(sal_Int32 _nDefSize)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return (SUCCEEDED(pInterface->put_Attributes(_nDefSize)));
-}
- void WpADORecordset::Create()
-{
- IClassFactory2* pInterface2 = NULL;
- IUnknown *pOuter = NULL;
- HRESULT hr;
- hr = CoGetClassObject( ADOS::CLSID_ADORECORDSET_21,
- CLSCTX_INPROC_SERVER,
- NULL,
- IID_IClassFactory2,
- (void**)&pInterface2 );
-
- if( !FAILED( hr ) )
- {
- ADORecordset *pRec = NULL;
- hr = pInterface2->CreateInstanceLic( pOuter,
- NULL,
- ADOS::IID_ADORECORDSET_21,
- ADOS::GetKeyStr(),
- (void**) &pRec);
-
- if( !FAILED( hr ) )
- {
- operator=(pRec);
- pRec->Release();
- }
-
- pInterface2->Release();
- }
-}
-
- sal_Bool WpADORecordset::Open(
- /* [optional][in] */ VARIANT Source,
- /* [optional][in] */ VARIANT ActiveConnection,
- /* [defaultvalue][in] */ CursorTypeEnum CursorType,
- /* [defaultvalue][in] */ LockTypeEnum LockType,
- /* [defaultvalue][in] */ sal_Int32 Options)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return (SUCCEEDED(pInterface->Open(Source,ActiveConnection,CursorType,LockType,Options)));
-}
-
-
-LockTypeEnum WpADORecordset::GetLockType()
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- LockTypeEnum eType=adLockUnspecified;
- pInterface->get_LockType(&eType);
- return eType;
-}
-
-void WpADORecordset::Close()
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->Close();
-}
-
- sal_Bool WpADORecordset::Cancel() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return (SUCCEEDED(pInterface->Cancel()));
-}
-
- sal_Int32 WpADORecordset::get_State( )
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 nState = 0;
- pInterface->get_State(&nState);
- return nState;
-}
-
- sal_Bool WpADORecordset::Supports( /* [in] */ CursorOptionEnum CursorOptions)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- VARIANT_BOOL bSupports=VARIANT_FALSE;
- pInterface->Supports(CursorOptions,&bSupports);
- return bSupports == VARIANT_TRUE;
-}
-
-PositionEnum_Param WpADORecordset::get_AbsolutePosition()
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- PositionEnum_Param aTemp=adPosUnknown;
- pInterface->get_AbsolutePosition(&aTemp);
- return aTemp;
-}
-
- void WpADORecordset::GetDataSource(IUnknown** _pInterface) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->get_DataSource(_pInterface);
-}
-
- void WpADORecordset::PutRefDataSource(IUnknown* _pInterface)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->putref_DataSource(_pInterface);
-}
-
- void WpADORecordset::GetBookmark(VARIANT& var)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->get_Bookmark(&var);
-}
-
- OLEVariant WpADORecordset::GetBookmark()
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEVariant var;
- pInterface->get_Bookmark(&var);
- return var;
-}
-
-CompareEnum WpADORecordset::CompareBookmarks(const OLEVariant& left,const OLEVariant& right)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- CompareEnum eNum=adCompareNotComparable;
- pInterface->CompareBookmarks(left,right,&eNum);
- return eNum;
-}
-
- sal_Bool WpADORecordset::SetBookmark(const OLEVariant &pSafeAr)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->put_Bookmark(pSafeAr));
-}
-
-
-WpADOFields WpADORecordset::GetFields() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOFields* pFields=NULL;
- pInterface->get_Fields(&pFields);
- WpADOFields aFields;
- aFields.setWithOutAddRef(pFields);
- return aFields;
-}
-
-
- sal_Bool WpADORecordset::Move(sal_Int32 nRows, VARIANT aBmk) {return pInterface && SUCCEEDED(pInterface->Move(nRows, aBmk));}
- sal_Bool WpADORecordset::MoveNext() {return pInterface && SUCCEEDED(pInterface->MoveNext());}
- sal_Bool WpADORecordset::MovePrevious() {return pInterface && SUCCEEDED(pInterface->MovePrevious());}
- sal_Bool WpADORecordset::MoveFirst() {return pInterface && SUCCEEDED(pInterface->MoveFirst());}
- sal_Bool WpADORecordset::MoveLast() {return pInterface && SUCCEEDED(pInterface->MoveLast());}
-
- sal_Bool WpADORecordset::IsAtBOF() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- VARIANT_BOOL bIsAtBOF=VARIANT_FALSE;
- pInterface->get_BOF(&bIsAtBOF);
- return bIsAtBOF == VARIANT_TRUE;
-}
-
- sal_Bool WpADORecordset::IsAtEOF() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- VARIANT_BOOL bIsAtEOF=VARIANT_FALSE;
- pInterface->get_EOF(&bIsAtEOF);
- return bIsAtEOF == VARIANT_TRUE;
-}
-
- sal_Bool WpADORecordset::Delete(AffectEnum eNum)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->Delete(eNum));
-}
-
- sal_Bool WpADORecordset::AddNew(const OLEVariant &FieldList,const OLEVariant &Values)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->AddNew(FieldList,Values));
-}
-
- sal_Bool WpADORecordset::Update(const OLEVariant &FieldList,const OLEVariant &Values)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->Update(FieldList,Values));
-}
-
- sal_Bool WpADORecordset::CancelUpdate()
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->CancelUpdate());
-}
-
-WpADOProperties WpADORecordset::get_Properties() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOProperties* pProps=NULL;
- pInterface->get_Properties(&pProps);
- WpADOProperties aProps;
- aProps.setWithOutAddRef(pProps);
- return aProps;
-}
-
- sal_Bool WpADORecordset::NextRecordset(OLEVariant& RecordsAffected,ADORecordset** ppiRset)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->NextRecordset(&RecordsAffected,ppiRset));
-}
-
- sal_Bool WpADORecordset::get_RecordCount(ADO_LONGPTR &_nRet) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->get_RecordCount(&_nRet));
-}
-
- sal_Bool WpADORecordset::get_MaxRecords(ADO_LONGPTR &_nRet) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->get_MaxRecords(&_nRet));
-}
-
- sal_Bool WpADORecordset::put_MaxRecords(ADO_LONGPTR _nRet)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->put_MaxRecords(_nRet));
-}
-
- sal_Bool WpADORecordset::get_CursorType(CursorTypeEnum &_nRet) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->get_CursorType(&_nRet));
-}
-
- sal_Bool WpADORecordset::put_CursorType(CursorTypeEnum _nRet)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->put_CursorType(_nRet));
-}
-
- sal_Bool WpADORecordset::get_LockType(LockTypeEnum &_nRet) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->get_LockType(&_nRet));
-}
-
- sal_Bool WpADORecordset::put_LockType(LockTypeEnum _nRet)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->put_LockType(_nRet));
-}
-
- sal_Bool WpADORecordset::get_CacheSize(sal_Int32 &_nRet) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->get_CacheSize(&_nRet));
-}
-
- sal_Bool WpADORecordset::put_CacheSize(sal_Int32 _nRet)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->put_CacheSize(_nRet));
-}
-
- sal_Bool WpADORecordset::UpdateBatch(AffectEnum AffectRecords)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->UpdateBatch(AffectRecords));
-}
-
- ::rtl::OUString WpADOParameter::GetName() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_Name(&aBSTR);
- return aBSTR;
-}
-
- DataTypeEnum WpADOParameter::GetADOType() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- DataTypeEnum eType=adEmpty;
- pInterface->get_Type(&eType);
- return eType;
-}
-
-void WpADOParameter::put_Type(const DataTypeEnum& _eType)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_Type(_eType);
-}
-
- sal_Int32 WpADOParameter::GetAttributes() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 eADOSFieldAttributes=0;
- pInterface->get_Attributes(&eADOSFieldAttributes);
- return eADOSFieldAttributes;
-}
-
- sal_Int32 WpADOParameter::GetPrecision() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_uInt8 eType=0;
- pInterface->get_Precision(&eType);
- return eType;
-}
-
- sal_Int32 WpADOParameter::GetNumericScale() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_uInt8 eType=0;
- pInterface->get_NumericScale(&eType);
- return eType;
-}
-
- ParameterDirectionEnum WpADOParameter::get_Direction() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ParameterDirectionEnum alParmDirection=adParamUnknown;
- pInterface->get_Direction(&alParmDirection);
- return alParmDirection;
-}
-
- void WpADOParameter::GetValue(OLEVariant& aValVar) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->get_Value(&aValVar);
-}
-
- OLEVariant WpADOParameter::GetValue() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEVariant aValVar;
- pInterface->get_Value(&aValVar);
- return aValVar;
-}
-
-sal_Bool WpADOParameter::PutValue(const OLEVariant& aVariant)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return (SUCCEEDED(pInterface->put_Value(aVariant)));
-}
-sal_Bool WpADOParameter::AppendChunk(const OLEVariant& aVariant)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return (SUCCEEDED(pInterface->AppendChunk(aVariant)));
-}
-sal_Bool WpADOParameter::put_Size(const sal_Int32& _nSize)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return (SUCCEEDED(pInterface->put_Size(_nSize)));
-}
-
- ::rtl::OUString WpADOColumn::get_Name() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_Name(&aBSTR);
- return aBSTR;
-}
-
-::rtl::OUString WpADOColumn::get_RelatedColumn() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_RelatedColumn(&aBSTR);
- return aBSTR;
-}
-
-void WpADOColumn::put_Name(const ::rtl::OUString& _rName)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString bstr(_rName);
- sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
- (void)bErg;
-}
-void WpADOColumn::put_RelatedColumn(const ::rtl::OUString& _rName)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString bstr(_rName);
- sal_Bool bErg = SUCCEEDED(pInterface->put_RelatedColumn(bstr));
- (void)bErg;
-}
-
-DataTypeEnum WpADOColumn::get_Type() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- DataTypeEnum eNum = adVarChar;
- pInterface->get_Type(&eNum);
- return eNum;
-}
-
-void WpADOColumn::put_Type(const DataTypeEnum& _eNum)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_Type(_eNum);
-}
-
-sal_Int32 WpADOColumn::get_Precision() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 nPrec=0;
- pInterface->get_Precision(&nPrec);
- return nPrec;
-}
-
-void WpADOColumn::put_Precision(sal_Int32 _nPre)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_Precision(_nPre);
-}
-
-sal_Int32 WpADOColumn::get_DefinedSize() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Int32 nPrec=0;
- pInterface->get_DefinedSize(&nPrec);
- return nPrec;
-}
-sal_uInt8 WpADOColumn::get_NumericScale() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_uInt8 nPrec=0;
- pInterface->get_NumericScale(&nPrec);
- return nPrec;
-}
-
-void WpADOColumn::put_NumericScale(sal_Int8 _nScale)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_NumericScale(_nScale);
-}
-
-SortOrderEnum WpADOColumn::get_SortOrder() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- SortOrderEnum nPrec=adSortAscending;
- pInterface->get_SortOrder(&nPrec);
- return nPrec;
-}
-
-void WpADOColumn::put_SortOrder(SortOrderEnum _nScale)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_SortOrder(_nScale);
-}
-
-ColumnAttributesEnum WpADOColumn::get_Attributes() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ColumnAttributesEnum eNum=adColNullable;
- pInterface->get_Attributes(&eNum);
- return eNum;
-}
-
-sal_Bool WpADOColumn::put_Attributes(const ColumnAttributesEnum& _eNum)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- return SUCCEEDED(pInterface->put_Attributes(_eNum));
-}
-
-WpADOProperties WpADOColumn::get_Properties() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOProperties* pProps = NULL;
- pInterface->get_Properties(&pProps);
- WpADOProperties aProps;
-
- aProps.setWithOutAddRef(pProps);
- return aProps;
-}
-
-::rtl::OUString WpADOKey::get_Name() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_Name(&aBSTR);
- return aBSTR;
-}
-
-void WpADOKey::put_Name(const ::rtl::OUString& _rName)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString bstr(_rName);
- sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
- (void)bErg;
-}
-
-KeyTypeEnum WpADOKey::get_Type() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- KeyTypeEnum eNum=adKeyPrimary;
- pInterface->get_Type(&eNum);
- return eNum;
-}
-
-void WpADOKey::put_Type(const KeyTypeEnum& _eNum)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_Type(_eNum);
-}
-
-::rtl::OUString WpADOKey::get_RelatedTable() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_RelatedTable(&aBSTR);
- return aBSTR;
-}
-
-void WpADOKey::put_RelatedTable(const ::rtl::OUString& _rName)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString bstr(_rName);
- sal_Bool bErg = SUCCEEDED(pInterface->put_RelatedTable(bstr));
- (void)bErg;
-}
-
-RuleEnum WpADOKey::get_DeleteRule() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- RuleEnum eNum = adRINone;
- pInterface->get_DeleteRule(&eNum);
- return eNum;
-}
-
-void WpADOKey::put_DeleteRule(const RuleEnum& _eNum)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_DeleteRule(_eNum);
-}
-
-RuleEnum WpADOKey::get_UpdateRule() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- RuleEnum eNum = adRINone;
- pInterface->get_UpdateRule(&eNum);
- return eNum;
-}
-
-void WpADOKey::put_UpdateRule(const RuleEnum& _eNum)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_UpdateRule(_eNum);
-}
-
-WpADOColumns WpADOKey::get_Columns() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOColumns* pCols = NULL;
- pInterface->get_Columns(&pCols);
- WpADOColumns aCols;
- aCols.setWithOutAddRef(pCols);
- return aCols;
-}
-
-::rtl::OUString WpADOIndex::get_Name() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_Name(&aBSTR);
- return aBSTR;
-}
-
-void WpADOIndex::put_Name(const ::rtl::OUString& _rName)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString bstr(_rName);
- sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
- (void)bErg;
-}
-
-sal_Bool WpADOIndex::get_Clustered() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- VARIANT_BOOL eNum = VARIANT_FALSE;
- pInterface->get_Clustered(&eNum);
- return eNum == VARIANT_TRUE;
-}
-
-void WpADOIndex::put_Clustered(sal_Bool _b)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_Clustered(_b ? VARIANT_TRUE : VARIANT_FALSE);
-}
-
-sal_Bool WpADOIndex::get_Unique() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- VARIANT_BOOL eNum = VARIANT_FALSE;
- pInterface->get_Unique(&eNum);
- return eNum == VARIANT_TRUE;
-}
-
-void WpADOIndex::put_Unique(sal_Bool _b)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_Unique(_b ? VARIANT_TRUE : VARIANT_FALSE);
-}
-
-sal_Bool WpADOIndex::get_PrimaryKey() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- VARIANT_BOOL eNum = VARIANT_FALSE;
- pInterface->get_PrimaryKey(&eNum);
- return eNum == VARIANT_TRUE;
-}
-
-void WpADOIndex::put_PrimaryKey(sal_Bool _b)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->put_PrimaryKey(_b ? VARIANT_TRUE : VARIANT_FALSE);
-}
-
-WpADOColumns WpADOIndex::get_Columns() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOColumns* pCols = NULL;
- pInterface->get_Columns(&pCols);
- WpADOColumns aCols;
- aCols.setWithOutAddRef(pCols);
- return aCols;
-}
-
-void WpADOCatalog::putref_ActiveConnection(IDispatch* pCon)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->putref_ActiveConnection(pCon);
-}
-
-WpADOTables WpADOCatalog::get_Tables()
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOTables* pRet = NULL;
- pInterface->get_Tables(&pRet);
- WpADOTables aRet;
- aRet.setWithOutAddRef(pRet);
- return aRet;
-}
-
-WpADOViews WpADOCatalog::get_Views()
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOViews* pRet = NULL;
- pInterface->get_Views(&pRet);
- WpADOViews aRet;
- aRet.setWithOutAddRef(pRet);
- return aRet;
-}
-
-WpADOGroups WpADOCatalog::get_Groups()
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOGroups* pRet = NULL;
- pInterface->get_Groups(&pRet);
- WpADOGroups aRet;
- aRet.setWithOutAddRef(pRet);
- return aRet;
-}
-
-WpADOUsers WpADOCatalog::get_Users()
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOUsers* pRet = NULL;
- pInterface->get_Users(&pRet);
- WpADOUsers aRet;
- aRet.setWithOutAddRef(pRet);
- return aRet;
-}
-
-ADOProcedures* WpADOCatalog::get_Procedures()
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOProcedures* pRet = NULL;
- pInterface->get_Procedures(&pRet);
- return pRet;
-}
-
-::rtl::OUString WpADOTable::get_Name() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_Name(&aBSTR);
- return aBSTR;
-}
-
-void WpADOTable::put_Name(const ::rtl::OUString& _rName)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString bstr(_rName);
- sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
- (void)bErg;
-}
-
-::rtl::OUString WpADOTable::get_Type() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_Type(&aBSTR);
- return aBSTR;
-}
-
-WpADOColumns WpADOTable::get_Columns() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOColumns* pCols = NULL;
- pInterface->get_Columns(&pCols);
- WpADOColumns aCols;
- aCols.setWithOutAddRef(pCols);
- return aCols;
-}
-
-WpADOIndexes WpADOTable::get_Indexes() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOIndexes* pCols = NULL;
- pInterface->get_Indexes(&pCols);
- WpADOIndexes aRet;
- aRet.setWithOutAddRef(pCols);
- return aRet;
-}
-
-WpADOKeys WpADOTable::get_Keys() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOKeys* pCols = NULL;
- pInterface->get_Keys(&pCols);
- WpADOKeys aRet;
- aRet.setWithOutAddRef(pCols);
- return aRet;
-}
-
-WpADOCatalog WpADOTable::get_ParentCatalog() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOCatalog* pCat = NULL;
- pInterface->get_ParentCatalog(&pCat);
- WpADOCatalog aRet;
- aRet.setWithOutAddRef(pCat);
- return aRet;
-}
-
-WpADOProperties WpADOTable::get_Properties() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- ADOProperties* pProps = NULL;
- pInterface->get_Properties(&pProps);
- WpADOProperties aProps;
- aProps.setWithOutAddRef(pProps);
- return aProps;
-}
-
-::rtl::OUString WpADOView::get_Name() const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- OLEString aBSTR;
- pInterface->get_Name(&aBSTR);
- return aBSTR;
-}
-
-void WpADOView::get_Command(OLEVariant& _rVar) const
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- pInterface->get_Command(&_rVar);
-}
-
-void WpADOView::put_Command(OLEVariant& _rVar)
-{
- pInterface->put_Command(_rVar);
-}
-
-::rtl::OUString WpADOGroup::get_Name() const
-{
- OLEString aBSTR;
- pInterface->get_Name(&aBSTR);
- return aBSTR;
-}
-
-void WpADOGroup::put_Name(const ::rtl::OUString& _rName)
-{
- OLEString bstr(_rName);
- sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
- (void)bErg;
-}
-
-RightsEnum WpADOGroup::GetPermissions(
- /* [in] */ const OLEVariant& Name,
- /* [in] */ ObjectTypeEnum ObjectType)
-{
- RightsEnum Rights=adRightNone;
- OLEVariant ObjectTypeId;
- ObjectTypeId.setNoArg();
- pInterface->GetPermissions(Name,ObjectType,ObjectTypeId,&Rights);
- return Rights;
-}
-
-sal_Bool WpADOGroup::SetPermissions(
- /* [in] */ const OLEVariant& Name,
- /* [in] */ ObjectTypeEnum ObjectType,
- /* [in] */ ActionEnum Action,
- /* [in] */ RightsEnum Rights)
-{
- OLEVariant ObjectTypeId;
- ObjectTypeId.setNoArg();
- return SUCCEEDED(pInterface->SetPermissions(Name,ObjectType,Action,Rights,adInheritNone,ObjectTypeId));
-}
-
-WpADOUsers WpADOGroup::get_Users( )
-{
- ADOUsers* pRet = NULL;
- pInterface->get_Users( &pRet);
- WpADOUsers aRet;
- aRet.setWithOutAddRef(pRet);
- return aRet;
-}
-
-::rtl::OUString WpADOUser::get_Name() const
-{
- OLEString aBSTR;
- pInterface->get_Name(&aBSTR);
- return aBSTR;
-}
-
-void WpADOUser::put_Name(const ::rtl::OUString& _rName)
-{
- OLEString bstr(_rName);
- sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
- (void)bErg;
-}
-
-sal_Bool WpADOUser::ChangePassword(const ::rtl::OUString& _rPwd,const ::rtl::OUString& _rNewPwd)
-{
- OLEString sStr1(_rPwd);
- OLEString sStr2(_rNewPwd);
- sal_Bool bErg = SUCCEEDED(pInterface->ChangePassword(sStr1,sStr2));
- return bErg;
-}
-
-WpADOGroups WpADOUser::get_Groups()
-{
- ADOGroups* pRet = NULL;
- pInterface->get_Groups(&pRet);
- WpADOGroups aRet;
- aRet.setWithOutAddRef(pRet);
- return aRet;
-}
-
-RightsEnum WpADOUser::GetPermissions(
- /* [in] */ const OLEVariant& Name,
- /* [in] */ ObjectTypeEnum ObjectType)
-{
- RightsEnum Rights=adRightNone;
- OLEVariant ObjectTypeId;
- ObjectTypeId.setNoArg();
- pInterface->GetPermissions(Name,ObjectType,ObjectTypeId,&Rights);
- return Rights;
-}
-
-sal_Bool WpADOUser::SetPermissions(
- /* [in] */ const OLEVariant& Name,
- /* [in] */ ObjectTypeEnum ObjectType,
- /* [in] */ ActionEnum Action,
- /* [in] */ RightsEnum Rights)
-{
- OLEVariant ObjectTypeId;
- ObjectTypeId.setNoArg();
- return SUCCEEDED(pInterface->SetPermissions(Name,ObjectType,Action,Rights,adInheritNone,ObjectTypeId));
-}
-
-WpBase::WpBase() : pIUnknown(NULL)
-{
-}
-WpBase::WpBase(IDispatch* pInt)
- :pIUnknown(pInt)
-{
- if (pIUnknown)
- {
- ULONG nCount = pIUnknown->AddRef();
- (void)nCount;
- // OSL_ENSURE(nCount == 1,"Count is greater than 1");
- }
-}
-
-//inline
-WpBase& WpBase::operator=(const WpBase& rhs)
-{
- if (rhs.pIUnknown != pIUnknown)
- {
- if (pIUnknown)
- pIUnknown->Release();
- pIUnknown = rhs.pIUnknown;
- if (pIUnknown)
- pIUnknown->AddRef();
- }
- return *this;
-};
-
-WpBase& WpBase::operator=(IDispatch* rhs)
-{
- if (pIUnknown != rhs)
- {
- if (pIUnknown)
- pIUnknown->Release();
- pIUnknown = rhs;
- if (pIUnknown)
- pIUnknown->AddRef();
- }
- return *this;
-}
-
-WpBase::WpBase(const WpBase& aWrapper)
-{
- operator=(aWrapper);
-}
-
-WpBase::~WpBase()
-{
- if (pIUnknown)
- {
- pIUnknown->Release();
- pIUnknown = NULL;
- }
-}
-
-void WpBase::clear()
-{
- if (pIUnknown)
- {
- pIUnknown->Release();
- pIUnknown = NULL;
- }
-}
-
-
-sal_Bool WpBase::IsValid() const
-{
- return pIUnknown != NULL;
-}
-WpBase::operator IDispatch*()
-{
- return pIUnknown;
-}
-
-ADORecordset* WpADOConnection::getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table )
-{
- // Create elements used in the array
- HRESULT hr = S_OK;
- SAFEARRAYBOUND rgsabound[1];
- SAFEARRAY *psa = NULL;
- OLEVariant varCriteria[6];
-
- // Create SafeArray Bounds and initialize the array
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
- psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
-
- sal_Int32 nPos=0;
- if(catalog.hasValue())
- varCriteria[nPos].setString(::comphelper::getString(catalog));
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
- if(schema.getLength() && schema.toChar() != '%')
- varCriteria[nPos].setString(schema);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
-
- varCriteria[nPos].setString(table);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
-
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
-
- // Initialize and fill the SafeArray
- OLEVariant vsa;
- vsa.setArray(psa,VT_VARIANT);
-
- ADORecordset *pRecordset = NULL;
- OpenSchema(adSchemaForeignKeys,vsa,vtEmpty,&pRecordset);
- return pRecordset;
-}
-// -----------------------------------------------------------------------------
-ADORecordset* WpADOConnection::getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table )
-{
- // Create elements used in the array
- HRESULT hr = S_OK;
- SAFEARRAYBOUND rgsabound[1];
- SAFEARRAY *psa = NULL;
- OLEVariant varCriteria[6];
-
- // Create SafeArray Bounds and initialize the array
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
- psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
-
- sal_Int32 nPos=0;
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
-
- if(catalog.hasValue())
- varCriteria[nPos].setString(::comphelper::getString(catalog));
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
- if(schema.getLength() && schema.toChar() != '%')
- varCriteria[nPos].setString(schema);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
-
- varCriteria[nPos].setString(table);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
-
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
-
- // Initialize and fill the SafeArray
- OLEVariant vsa;
- vsa.setArray(psa,VT_VARIANT);
-
- ADORecordset *pRecordset = NULL;
- OpenSchema(adSchemaForeignKeys,vsa,vtEmpty,&pRecordset);
-
- return pRecordset;
-
-}
-// -----------------------------------------------------------------------------
-ADORecordset* WpADOConnection::getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table )
-{
- // Create elements used in the array
- HRESULT hr = S_OK;
- SAFEARRAYBOUND rgsabound[1];
- SAFEARRAY *psa = NULL;
- OLEVariant varCriteria[3];
-
- // Create SafeArray Bounds and initialize the array
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
- psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
-
- sal_Int32 nPos=0;
- if(catalog.hasValue())
- varCriteria[nPos].setString(::comphelper::getString(catalog));
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
- if(schema.getLength() && schema.toChar() != '%')
- varCriteria[nPos].setString(schema);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
-
- varCriteria[nPos].setString(table);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
-
-
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
-
- // Initialize and fill the SafeArray
- OLEVariant vsa;
- vsa.setArray(psa,VT_VARIANT);
-
- ADORecordset *pRecordset = NULL;
- OpenSchema(adSchemaPrimaryKeys,vsa,vtEmpty,&pRecordset);
-
- return pRecordset;
-}
-// -----------------------------------------------------------------------------
-ADORecordset* WpADOConnection::getIndexInfo(
- const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
- sal_Bool /*unique*/, sal_Bool /*approximate*/ )
-{
- // Create elements used in the array
- HRESULT hr = S_OK;
- SAFEARRAYBOUND rgsabound[1];
- SAFEARRAY *psa = NULL;
- OLEVariant varCriteria[5];
-
- // Create SafeArray Bounds and initialize the array
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
- psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
-
- sal_Int32 nPos=0;
- if(catalog.hasValue())
- varCriteria[nPos].setString(::comphelper::getString(catalog));
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
- if(schema.getLength() && schema.toChar() != '%')
- varCriteria[nPos].setString(schema);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// INDEX_NAME
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TYPE
-
- varCriteria[nPos].setString(table);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
-
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
-
- // Initialize and fill the SafeArray
- OLEVariant vsa;
- vsa.setArray(psa,VT_VARIANT);
-
- ADORecordset *pRecordset = NULL;
- OpenSchema(adSchemaIndexes,vsa,vtEmpty,&pRecordset);
-
- return pRecordset;
-}
-// -----------------------------------------------------------------------------
-ADORecordset* WpADOConnection::getTablePrivileges( const ::com::sun::star::uno::Any& catalog,
- const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& tableNamePattern )
-{
- HRESULT hr = S_OK;
- SAFEARRAYBOUND rgsabound[1];
- SAFEARRAY *psa = NULL;
- OLEVariant varCriteria[5];
-
- // Create SafeArray Bounds and initialize the array
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
- psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
-
- sal_Int32 nPos=0;
- if(catalog.hasValue())
- varCriteria[nPos].setString(::comphelper::getString(catalog));
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
- if(schemaPattern.getLength() && schemaPattern.toChar() != '%')
- varCriteria[nPos].setString(schemaPattern);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
-
- if(tableNamePattern.toChar() != '%')
- varCriteria[nPos].setString(tableNamePattern);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// GRANTOR
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// GRANTEE
-
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
-
- // Initialize and fill the SafeArray
- OLEVariant vsa;
- vsa.setArray(psa,VT_VARIANT);
-
- ADORecordset *pRecordset = NULL;
- OpenSchema(adSchemaTablePrivileges,vsa,vtEmpty,&pRecordset);
-
- return pRecordset;
-}
-// -----------------------------------------------------------------------------
-ADORecordset* WpADOConnection::getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog,
- const ::rtl::OUString& primarySchema,
- const ::rtl::OUString& primaryTable,
- const ::com::sun::star::uno::Any& foreignCatalog,
- const ::rtl::OUString& foreignSchema,
- const ::rtl::OUString& foreignTable)
-{
- // Create elements used in the array
- HRESULT hr = S_OK;
- SAFEARRAYBOUND rgsabound[1];
- SAFEARRAY *psa = NULL;
- OLEVariant varCriteria[6];
-
- // Create SafeArray Bounds and initialize the array
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
- psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
-
- sal_Int32 nPos=0;
- if(primaryCatalog.hasValue())
- varCriteria[nPos].setString(::comphelper::getString(primaryCatalog));
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
- if(primarySchema.getLength() && primarySchema.toChar() != '%')
- varCriteria[nPos].setString(primarySchema);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
-
- varCriteria[nPos].setString(primaryTable);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
-
- if(foreignCatalog.hasValue())
- varCriteria[nPos].setString(::comphelper::getString(foreignCatalog));
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
- if(foreignSchema.getLength() && foreignSchema.toChar() != '%')
- varCriteria[nPos].setString(foreignSchema);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
-
- varCriteria[nPos].setString(foreignTable);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
-
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
-
- // Initialize and fill the SafeArray
- OLEVariant vsa;
- vsa.setArray(psa,VT_VARIANT);
-
- ADORecordset *pRecordset = NULL;
- OpenSchema(adSchemaForeignKeys,vsa,vtEmpty,&pRecordset);
-
- return pRecordset;
-}
-// -----------------------------------------------------------------------------
-ADORecordset* WpADOConnection::getProcedures( const ::com::sun::star::uno::Any& catalog,
- const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& procedureNamePattern )
-{
- HRESULT hr = S_OK;
- SAFEARRAYBOUND rgsabound[1];
- SAFEARRAY *psa = NULL;
- OLEVariant varCriteria[3];
-
- // Create SafeArray Bounds and initialize the array
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
- psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
-
- sal_Int32 nPos=0;
- if(catalog.hasValue())
- varCriteria[nPos].setString(::comphelper::getString(catalog));
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
- if(schemaPattern.getLength() && schemaPattern.toChar() != '%')
- varCriteria[nPos].setString(schemaPattern);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
-
- if(procedureNamePattern.toChar() != '%')
- varCriteria[nPos].setString(procedureNamePattern);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
-
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
-
- // Initialize and fill the SafeArray
- OLEVariant vsa;
- vsa.setArray(psa,VT_VARIANT);
-
- ADORecordset *pRecordset = NULL;
- OpenSchema(adSchemaProcedures,vsa,vtEmpty,&pRecordset);
-
- return pRecordset;
-}
-// -----------------------------------------------------------------------------
-ADORecordset* WpADOConnection::getProcedureColumns( const ::com::sun::star::uno::Any& catalog,
- const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& procedureNamePattern,
- const ::rtl::OUString& columnNamePattern )
-{
- // Create elements used in the array
- HRESULT hr = S_OK;
- SAFEARRAYBOUND rgsabound[1];
- SAFEARRAY *psa = NULL;
- OLEVariant varCriteria[4];
-
- // Create SafeArray Bounds and initialize the array
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
- psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
-
- sal_Int32 nPos=0;
- if(catalog.hasValue())
- varCriteria[nPos].setString(::comphelper::getString(catalog));
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
- if(schemaPattern.getLength() && schemaPattern.toChar() != '%')
- varCriteria[nPos].setString(schemaPattern);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
-
- if(procedureNamePattern.toChar() != '%')
- varCriteria[nPos].setString(procedureNamePattern);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
-
- if(columnNamePattern.toChar() != '%')
- varCriteria[nPos].setString(columnNamePattern);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// COLUMN_NAME
-
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
-
- // Initialize and fill the SafeArray
- OLEVariant vsa;
- vsa.setArray(psa,VT_VARIANT);
-
- ADORecordset *pRecordset = NULL;
- OpenSchema(adSchemaProcedureParameters,vsa,vtEmpty,&pRecordset);
-
- return pRecordset;
-}
-// -----------------------------------------------------------------------------
-ADORecordset* WpADOConnection::getTables( const ::com::sun::star::uno::Any& catalog,
- const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& tableNamePattern,
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types )
-{
- // Create elements used in the array
- HRESULT hr = S_OK;
- OLEVariant varCriteria[4];
-
- sal_Int32 nPos=0;
- ::rtl::OUString sCatalog;
- if ( catalog.hasValue() && (catalog >>= sCatalog) )
- varCriteria[nPos].setString(sCatalog);
-
- ++nPos;
- if(schemaPattern.getLength() && schemaPattern.toChar() != '%')
- varCriteria[nPos].setString(schemaPattern);
-
- ++nPos;
- if(tableNamePattern.toChar() != '%')
- varCriteria[nPos].setString(tableNamePattern);
-
- ++nPos;
- ::rtl::OUStringBuffer aTypes;
- ::rtl::OUString aComma( RTL_CONSTASCII_USTRINGPARAM( "," ));
- const ::rtl::OUString* pIter = types.getConstArray();
- const ::rtl::OUString* pEnd = pIter + types.getLength();
- for( ; pIter != pEnd ; ++pIter)
- {
- if ( aTypes.getLength() )
- aTypes.append(aComma);
- aTypes.append(*pIter);
- }
-
- ::rtl::OUString sTypeNames = aTypes.makeStringAndClear();
- if ( sTypeNames.getLength() )
- varCriteria[nPos].setString(sTypeNames);
-
- // Create SafeArray Bounds and initialize the array
- const sal_Int32 nCrit = SAL_N_ELEMENTS( varCriteria );
- SAFEARRAYBOUND rgsabound[1];
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = nCrit;
- SAFEARRAY *psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
-
- // Set the values for each element of the array
- for( long i = 0 ; i < nCrit && SUCCEEDED( hr );i++)
- {
- hr = SafeArrayPutElement(psa, &i,&varCriteria[i]);
- }
-
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
-
- // Initialize and fill the SafeArray
- OLEVariant vsa;
- vsa.setArray(psa,VT_VARIANT);
-
- ADORecordset *pRecordset = NULL;
- OpenSchema(adSchemaTables,vsa,vtEmpty,&pRecordset);
-
- return pRecordset;
-}
-// -----------------------------------------------------------------------------
-ADORecordset* WpADOConnection::getColumns( const ::com::sun::star::uno::Any& catalog,
- const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& tableNamePattern,
- const ::rtl::OUString& columnNamePattern )
-{
- // Create elements used in the array
- HRESULT hr = S_OK;
- SAFEARRAYBOUND rgsabound[1];
- SAFEARRAY *psa = NULL;
- OLEVariant varCriteria[4];
-
- // Create SafeArray Bounds and initialize the array
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
- psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
-
- sal_Int32 nPos=0;
- if(catalog.hasValue())
- varCriteria[nPos].setString(::comphelper::getString(catalog));
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
- if(schemaPattern.getLength() && schemaPattern.toChar() != '%')
- varCriteria[nPos].setString(schemaPattern);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
-
- if(tableNamePattern.toChar() != '%')
- varCriteria[nPos].setString(tableNamePattern);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
-
- varCriteria[nPos].setString(columnNamePattern);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// COLUMN_NAME
-
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
-
- // Initialize and fill the SafeArray
- OLEVariant vsa;
- vsa.setArray(psa,VT_VARIANT);
-
- ADORecordset *pRecordset = NULL;
- OpenSchema(adSchemaColumns,vsa,vtEmpty,&pRecordset);
-
- return pRecordset;
-}
-// -----------------------------------------------------------------------------
-ADORecordset* WpADOConnection::getColumnPrivileges( const ::com::sun::star::uno::Any& catalog,
- const ::rtl::OUString& schema,
- const ::rtl::OUString& table,
- const ::rtl::OUString& columnNamePattern )
-{
- // Create elements used in the array
- HRESULT hr = S_OK;
- SAFEARRAYBOUND rgsabound[1];
- SAFEARRAY *psa = NULL;
- OLEVariant varCriteria[4];
-
- // Create SafeArray Bounds and initialize the array
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS( varCriteria );
- psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
-
- sal_Int32 nPos=0;
- if(catalog.hasValue())
- varCriteria[nPos].setString(::comphelper::getString(catalog));
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
- if(schema.getLength() && schema.toChar() != '%')
- varCriteria[nPos].setString(schema);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
-
- varCriteria[nPos].setString(table);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
-
- varCriteria[nPos].setString(columnNamePattern);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// COLUMN_NAME
-
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
-
- // Initialize and fill the SafeArray
- OLEVariant vsa;
- vsa.setArray(psa,VT_VARIANT);
-
- ADORecordset *pRecordset = NULL;
- OpenSchema(adSchemaColumnPrivileges,vsa,vtEmpty,&pRecordset);
-
- return pRecordset;
-}
-// -----------------------------------------------------------------------------
-ADORecordset* WpADOConnection::getTypeInfo(DataTypeEnum /*_eType*/)
-{
- // Create elements used in the array
- OLEVariant varCriteria[2];
- const int nCrit = SAL_N_ELEMENTS( varCriteria );
- // Create SafeArray Bounds and initialize the array
- SAFEARRAYBOUND rgsabound[1];
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = nCrit;
- SAFEARRAY *psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
-
- sal_Int32 nPos = 0;
- SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;
- SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;
-
- // Initialize and fill the SafeArray
- OLEVariant vsa;
- vsa.setArray(psa,VT_VARIANT);
-
- OLEVariant aEmpty;
- aEmpty.setNoArg();
-
- ADORecordset *pRec=NULL;
- OpenSchema(adSchemaProviderTypes,vsa,aEmpty,&pRec);
-
- return pRec;
-}
-// -----------------------------------------------------------------------------
-void WpADOColumn::put_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR *ppvObject)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Bool bRet = SUCCEEDED(pInterface->put_ParentCatalog(ppvObject));
- OSL_ENSURE(bRet,"Could not set ParentCatalog!");
- OSL_UNUSED(bRet);
-}
-// -----------------------------------------------------------------------------
-void WpADOTable::putref_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR *ppvObject)
-{
- OSL_ENSURE(pInterface,"Interface is null!");
- sal_Bool bRet = SUCCEEDED(pInterface->putref_ParentCatalog(ppvObject));
- OSL_ENSURE(bRet,"Could not set ParentCatalog!");
- OSL_UNUSED(bRet);
-}
-// -----------------------------------------------------------------------------
-void WpBase::setIDispatch(IDispatch* _pIUnknown)
-{
- pIUnknown = _pIUnknown;
-}
-// -----------------------------------------------------------------------------
-void OTools::putValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition,const OLEVariant &_aValVar)
-{
- OSL_ENSURE(_rProps.IsValid(),"Properties are not valid!");
- WpADOProperty aProp(_rProps.GetItem(_aPosition));
- if ( aProp.IsValid() )
- {
- sal_Bool bRet = aProp.PutValue(_aValVar);
- OSL_ENSURE(bRet,"Could not put value!");
- OSL_UNUSED(bRet);
- }
-}
-// -----------------------------------------------------------------------------
-OLEVariant OTools::getValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition)
-{
- WpADOProperty aProp(_rProps.GetItem(_aPosition));
- return aProp.GetValue();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/ado.component b/connectivity/source/drivers/ado/ado.component
deleted file mode 100755
index 1962a6b710..0000000000
--- a/connectivity/source/drivers/ado/ado.component
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.sdbc.ado.ODriver">
- <service name="com.sun.star.sdbc.Driver"/>
- <service name="com.sun.star.sdbcx.Driver"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/ado/ado.xcu b/connectivity/source/drivers/ado/ado.xcu
deleted file mode 100644
index 3ef8b4c506..0000000000
--- a/connectivity/source/drivers/ado/ado.xcu
+++ /dev/null
@@ -1,269 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="sdbc:ado:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.ado.ODriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">ADO</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="CharSet" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="GeneratedValues" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="AppendTableAliasInSelect" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseBracketedOuterJoinSyntax" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="DisplayVersionColumns" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseCatalogInSelect" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseSchemaInSelect" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseIndexDirectionKeyword" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseDOSLineEnds" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="BooleanComparisonMode" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FormsCheckRequiredFields" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="PrimaryKeySupport" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="RespectDriverResultSetType" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- <node oor:name="SupportsColumnDescription" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=*" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.ado.ODriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Microsoft Access</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="CharSet" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="BooleanComparisonMode" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:int">
- <value>3</value>
- </prop>
- </node>
- <node oor:name="ColumnAliasInOrderBy" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- <node oor:name="TypeInfoSettings" oor:op="replace">
- <prop oor:name="Value" oor:type="oor:string-list">
- <value oor:separator=",">Column(2) = 16,Column(3) = 1</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="AppendTableAliasInSelect" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseBracketedOuterJoinSyntax" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseDOSLineEnds" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="BooleanComparisonMode" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FormsCheckRequiredFields" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="ColumnAliasInOrderBy" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FileSystemBased" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="MediaType" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>application/msaccess</value>
- </prop>
- </node>
- <node oor:name="Extension" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>mdb</value>
- </prop>
- </node>
- <node oor:name="SupportsColumnDescription" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=*" oor:op="replace">
- <prop oor:name="ParentURLPattern">
- <value>sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=*</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Microsoft Access 2007</value>
- </prop>
- <node oor:name="MetaData">
- <node oor:name="Extension" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/ado/ado.xml b/connectivity/source/drivers/ado/ado.xml
deleted file mode 100755
index 2be460df8f..0000000000
--- a/connectivity/source/drivers/ado/ado.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<!DOCTYPE module-description PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
-<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
- <module-name> ado </module-name>
- <component-description>
- <author>Ocke Janssen</author>
- <name>com.sun.star.comp.sdbc.ado.ODriver</name>
- <description>
- This is the implementation of the ado-sdbc bridge.
- </description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service> com.sun.star.sdbc.Driver</supported-service>
- </component-description>
- <project-build-dependency>cppuhelper</project-build-dependency>
- <project-build-dependency>cppu</project-build-dependency>
- <project-build-dependency>sal</project-build-dependency>
- <runtime-module-dependency>cppuhelper</runtime-module-dependency>
- <runtime-module-dependency>cppu</runtime-module-dependency>
- <runtime-module-dependency>sal</runtime-module-dependency>
- <runtime-module-dependency>osl</runtime-module-dependency>
- <runtime-module-dependency>dbtools</runtime-module-dependency>
- <runtime-module-dependency>comphelper</runtime-module-dependency>
-</module-description>
-
-
diff --git a/connectivity/source/drivers/ado/ado_post_sys_include.h b/connectivity/source/drivers/ado/ado_post_sys_include.h
deleted file mode 100755
index 459fa29489..0000000000
--- a/connectivity/source/drivers/ado/ado_post_sys_include.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#undef ADO_REDUCED_WARN_LEVEL
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/ado_pre_sys_include.h b/connectivity/source/drivers/ado/ado_pre_sys_include.h
deleted file mode 100755
index b1ac0e3e51..0000000000
--- a/connectivity/source/drivers/ado/ado_pre_sys_include.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifdef ADO_REDUCED_WARN_LEVEL
- #error "ado_pre_sys_include.h included twice!"
-#endif
-
-#ifdef _MSC_VER
-#pragma warning(push,1)
-#pragma warning(disable:4917)
-#endif
-
-#define ADO_REDUCED_WARN_LEVEL
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/adoimp.cxx b/connectivity/source/drivers/ado/adoimp.cxx
deleted file mode 100644
index b1075a2f0f..0000000000
--- a/connectivity/source/drivers/ado/adoimp.cxx
+++ /dev/null
@@ -1,339 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#include <com/sun/star/sdbcx/PrivilegeObject.hpp>
-#include "connectivity/dbexception.hxx"
-#include "ado/Awrapado.hxx"
-#include "ado/adoimp.hxx"
-#include <osl/diagnose.h>
-#include <com/sun/star/sdbc/DataType.hpp>
-
-
-using namespace connectivity::ado;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::sdbcx;
-
-
-#define MYADOID(l) {l, 0,0x10,0x80,0,0,0xAA,0,0x6D,0x2E,0xA4};
-
-const CLSID ADOS::CLSID_ADOCONNECTION_21 = MYADOID(0x00000514);
-const IID ADOS::IID_ADOCONNECTION_21 = MYADOID(0x00000550);
-
-const CLSID ADOS::CLSID_ADOCOMMAND_21 = MYADOID(0x00000507);
-const IID ADOS::IID_ADOCOMMAND_21 = MYADOID(0x0000054E);
-
-const CLSID ADOS::CLSID_ADORECORDSET_21 = MYADOID(0x00000535);
-const IID ADOS::IID_ADORECORDSET_21 = MYADOID(0x0000054F);
-
-const CLSID ADOS::CLSID_ADOCATALOG_25 = MYADOID(0x00000602);
-const IID ADOS::IID_ADOCATALOG_25 = MYADOID(0x00000603);
-
-const CLSID ADOS::CLSID_ADOINDEX_25 = MYADOID(0x0000061E);
-const IID ADOS::IID_ADOINDEX_25 = MYADOID(0x0000061F);
-
-const CLSID ADOS::CLSID_ADOTABLE_25 = MYADOID(0x00000609);
-const IID ADOS::IID_ADOTABLE_25 = MYADOID(0x00000610);
-
-const CLSID ADOS::CLSID_ADOKEY_25 = MYADOID(0x00000621);
-const IID ADOS::IID_ADOKEY_25 = MYADOID(0x00000622);
-
-const CLSID ADOS::CLSID_ADOCOLUMN_25 = MYADOID(0x0000061B);
-const IID ADOS::IID_ADOCOLUMN_25 = MYADOID(0x0000061C);
-
-const CLSID ADOS::CLSID_ADOGROUP_25 = MYADOID(0x00000615);
-const IID ADOS::IID_ADOGROUP_25 = MYADOID(0x00000616);
-
-const CLSID ADOS::CLSID_ADOUSER_25 = MYADOID(0x00000618);
-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()
-{
- static OLEString sKeyStr(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gxwaezucfyqpwjgqbcmtsncuhwsnyhiohwxz")));
- return sKeyStr;
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 ADOS::MapADOType2Jdbc(DataTypeEnum eType)
-{
- sal_Int32 nType = DataType::VARCHAR;;
- switch (eType)
- {
- case adUnsignedSmallInt:
- case adSmallInt: nType = DataType::SMALLINT; break;
- case adUnsignedInt:
- case adInteger: nType = DataType::INTEGER; break;
- case adUnsignedBigInt:
- case adBigInt: nType = DataType::BIGINT; break;
- case adSingle: nType = DataType::FLOAT; break;
- case adDouble: nType = DataType::DOUBLE; break;
- case adCurrency: nType = DataType::DOUBLE; break;
- case adVarNumeric:
- case adNumeric: nType = DataType::NUMERIC; break;
- case adDecimal: nType = DataType::DECIMAL; break;
- case adDBDate: nType = DataType::DATE; break;
- case adDBTime: nType = DataType::TIME; break;
- case adDate:
- case adDBTimeStamp: nType = DataType::TIMESTAMP; break;
- case adBoolean: nType = DataType::BOOLEAN; break;
-// case adArray: nType = DataType::ARRAY; break;
- case adBinary: nType = DataType::BINARY; break;
- case adGUID: nType = DataType::OBJECT; break;
- case adBSTR:
- case adVarWChar:
- case adWChar:
- case adVarChar: nType = DataType::VARCHAR; break;
- case adLongVarWChar:
- case adLongVarChar: nType = DataType::LONGVARCHAR; break;
- case adVarBinary: nType = DataType::VARBINARY; break;
- case adLongVarBinary: nType = DataType::LONGVARBINARY;break;
- case adChar: nType = DataType::CHAR; break;
- case adUnsignedTinyInt:
- case adTinyInt: nType = DataType::TINYINT; break;
- case adEmpty: nType = DataType::SQLNULL; break;
- case adUserDefined:
- case adPropVariant:
- case adFileTime:
- case adChapter:
- case adIDispatch:
- case adIUnknown:
- case adError:
- case adVariant:
- nType = DataType::OTHER; break;
- default:
- OSL_FAIL("MapADOType2Jdbc: Unknown Type!");
- ;
- }
- return nType;
-}
-// -------------------------------------------------------------------------
-DataTypeEnum ADOS::MapJdbc2ADOType(sal_Int32 _nType,sal_Int32 _nJetEngine)
-{
- switch (_nType)
- {
- case DataType::SMALLINT: return adSmallInt; break;
- case DataType::INTEGER: return adInteger; break;
- case DataType::BIGINT: return adBigInt; break;
- case DataType::FLOAT: return adSingle; break;
- case DataType::DOUBLE: return adDouble; break;
- case DataType::NUMERIC: return adNumeric; break;
- case DataType::DECIMAL: return adDecimal; break;
- case DataType::DATE: return isJetEngine(_nJetEngine) ? adDate : adDBDate; break;
- case DataType::TIME: return adDBTime; break;
- case DataType::TIMESTAMP: return isJetEngine(_nJetEngine) ? adDate : adDBTimeStamp; break;
- case DataType::BOOLEAN:
- case DataType::BIT: return adBoolean; break;
- case DataType::BINARY: return adBinary; break;
- case DataType::VARCHAR: return adVarWChar; break;
- case DataType::CLOB:
- case DataType::LONGVARCHAR: return adLongVarWChar; break;
- case DataType::VARBINARY: return adVarBinary; break;
- case DataType::BLOB:
- case DataType::LONGVARBINARY: return adLongVarBinary; break;
- case DataType::CHAR: return adWChar; break;
- case DataType::TINYINT: return isJetEngine(_nJetEngine) ? adUnsignedTinyInt : adTinyInt;break;
- case DataType::OBJECT: return adGUID; break;
- default:
- OSL_FAIL("MapJdbc2ADOType: Unknown Type!");
- ;
- }
- return adEmpty;
-}
-// -----------------------------------------------------------------------------
-const int JET_ENGINETYPE_UNKNOWN = 0;
-const int JET_ENGINETYPE_JET10 = 1;
-const int JET_ENGINETYPE_JET11 = 2;
-const int JET_ENGINETYPE_JET20 = 3;
-const int JET_ENGINETYPE_JET3X = 4;
-const int JET_ENGINETYPE_JET4X = 5;
-const int JET_ENGINETYPE_DBASE3 = 10;
-const int JET_ENGINETYPE_DBASE4 = 11;
-const int JET_ENGINETYPE_DBASE5 = 12;
-const int JET_ENGINETYPE_EXCEL30 = 20;
-const int JET_ENGINETYPE_EXCEL40 = 21;
-const int JET_ENGINETYPE_EXCEL50 = 22;
-const int JET_ENGINETYPE_EXCEL80 = 23;
-const int JET_ENGINETYPE_EXCEL90 = 24;
-const int JET_ENGINETYPE_EXCHANGE4 = 30;
-const int JET_ENGINETYPE_LOTUSWK1 = 40;
-const int JET_ENGINETYPE_LOTUSWK3 = 41;
-const int JET_ENGINETYPE_LOTUSWK4 = 42;
-const int JET_ENGINETYPE_PARADOX3X = 50;
-const int JET_ENGINETYPE_PARADOX4X = 51;
-const int JET_ENGINETYPE_PARADOX5X = 52;
-const int JET_ENGINETYPE_PARADOX7X = 53;
-const int JET_ENGINETYPE_TEXT1X = 60;
-const int JET_ENGINETYPE_HTML1X = 70;
-
-sal_Bool ADOS::isJetEngine(sal_Int32 _nEngineType)
-{
- sal_Bool bRet = sal_False;
- switch(_nEngineType)
- {
- case JET_ENGINETYPE_UNKNOWN:
- case JET_ENGINETYPE_JET10:
- case JET_ENGINETYPE_JET11:
- case JET_ENGINETYPE_JET20:
- case JET_ENGINETYPE_JET3X:
- case JET_ENGINETYPE_JET4X:
- case JET_ENGINETYPE_DBASE3:
- case JET_ENGINETYPE_DBASE4:
- case JET_ENGINETYPE_DBASE5:
- case JET_ENGINETYPE_EXCEL30:
- case JET_ENGINETYPE_EXCEL40:
- case JET_ENGINETYPE_EXCEL50:
- case JET_ENGINETYPE_EXCEL80:
- case JET_ENGINETYPE_EXCEL90:
- case JET_ENGINETYPE_EXCHANGE4:
- case JET_ENGINETYPE_LOTUSWK1:
- case JET_ENGINETYPE_LOTUSWK3:
- case JET_ENGINETYPE_LOTUSWK4:
- case JET_ENGINETYPE_PARADOX3X:
- case JET_ENGINETYPE_PARADOX4X:
- case JET_ENGINETYPE_PARADOX5X:
- case JET_ENGINETYPE_PARADOX7X:
- case JET_ENGINETYPE_TEXT1X:
- case JET_ENGINETYPE_HTML1X:
- bRet = sal_True;
- break;
- }
- return bRet;
-}
-// -----------------------------------------------------------------------------
-ObjectTypeEnum ADOS::mapObjectType2Ado(sal_Int32 objType)
-{
- ObjectTypeEnum eType = adPermObjTable;
- switch(objType)
- {
- case PrivilegeObject::TABLE:
- eType = adPermObjTable;
- break;
- case PrivilegeObject::VIEW:
- eType = adPermObjView;
- break;
- case PrivilegeObject::COLUMN:
- eType = adPermObjColumn;
- break;
- }
- return eType;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 ADOS::mapAdoType2Object(ObjectTypeEnum objType)
-{
- sal_Int32 nType = PrivilegeObject::TABLE;
- switch(objType)
- {
- case adPermObjTable:
- nType = PrivilegeObject::TABLE;
- break;
- case adPermObjView:
- nType = PrivilegeObject::VIEW;
- break;
- case adPermObjColumn:
- nType = PrivilegeObject::COLUMN;
- break;
- default:
- OSL_FAIL( "ADOS::mapAdoType2Object: privilege type cannot be translated!" );
- break;
- }
- return nType;
-}
-#ifdef DELETE
-#undef DELETE
-#endif
-// -----------------------------------------------------------------------------
-sal_Int32 ADOS::mapAdoRights2Sdbc(RightsEnum eRights)
-{
- sal_Int32 nRights = 0;
- if((eRights & adRightInsert) == adRightInsert)
- nRights |= Privilege::INSERT;
- if((eRights & adRightDelete) == adRightDelete)
- nRights |= ::com::sun::star::sdbcx::Privilege::DELETE;
- if((eRights & adRightUpdate) == adRightUpdate)
- nRights |= Privilege::UPDATE;
- if((eRights & adRightWriteDesign) == adRightWriteDesign)
- nRights |= Privilege::ALTER;
- if((eRights & adRightRead) == adRightRead)
- nRights |= Privilege::SELECT;
- if((eRights & adRightReference) == adRightReference)
- nRights |= Privilege::REFERENCE;
- if((eRights & adRightDrop) == adRightDrop)
- nRights |= Privilege::DROP;
-
- return nRights;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 ADOS::mapRights2Ado(sal_Int32 nRights)
-{
- sal_Int32 eRights = adRightNone;
-
- if((nRights & Privilege::INSERT) == Privilege::INSERT)
- eRights |= adRightInsert;
- if((nRights & Privilege::DELETE) == Privilege::DELETE)
- eRights |= adRightDelete;
- if((nRights & Privilege::UPDATE) == Privilege::UPDATE)
- eRights |= adRightUpdate;
- if((nRights & Privilege::ALTER) == Privilege::ALTER)
- eRights |= adRightWriteDesign;
- if((nRights & Privilege::SELECT) == Privilege::SELECT)
- eRights |= adRightRead;
- if((nRights & Privilege::REFERENCE) == Privilege::REFERENCE)
- eRights |= adRightReference;
- if((nRights & Privilege::DROP) == Privilege::DROP)
- eRights |= adRightDrop;
-
- return eRights;
-}
-// -----------------------------------------------------------------------------
-WpADOField ADOS::getField(ADORecordset* _pRecordSet,sal_Int32 _nColumnIndex) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- if ( !_pRecordSet )
- return WpADOField();
-
- ADOFields* pFields = NULL;
- _pRecordSet->get_Fields(&pFields);
- WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(pFields);
- if(_nColumnIndex <= 0 || _nColumnIndex > aFields.GetItemCount())
- ::dbtools::throwInvalidIndexException(NULL);
- WpADOField aField(aFields.GetItem(_nColumnIndex-1));
- if(!aField.IsValid())
- ::dbtools::throwInvalidIndexException(NULL);
- return aField;
-}
-// -----------------------------------------------------------------------------
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/ado/exports.dxp b/connectivity/source/drivers/ado/exports.dxp
deleted file mode 100755
index f0e1c69934..0000000000
--- a/connectivity/source/drivers/ado/exports.dxp
+++ /dev/null
@@ -1,2 +0,0 @@
-component_getImplementationEnvironment
-component_getFactory
diff --git a/connectivity/source/drivers/ado/makefile.mk b/connectivity/source/drivers/ado/makefile.mk
deleted file mode 100755
index 20cd74f996..0000000000
--- a/connectivity/source/drivers/ado/makefile.mk
+++ /dev/null
@@ -1,124 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=ado
-VISIBILITY_HIDDEN=TRUE
-
-# --- Settings ----------------------------------
-
-.IF "$(DBGUTIL_OJ)"!=""
-ENVCFLAGS+=/FR$(SLO)$/
-.ENDIF
-
-.INCLUDE : $(PRJ)$/version.mk
-.INCLUDE : $(PRJ)$/makefile.pmk
-
-.IF "$(GUI)"=="WNT"
-# --- Files -------------------------------------
-
-.IF "$(COM)" == "GCC"
-CFLAGS+=-fpermissive
-.ENDIF
-
-EXCEPTIONSFILES= \
- $(SLO)$/ADatabaseMetaDataImpl.obj \
- $(SLO)$/Aolevariant.obj \
- $(SLO)$/ADatabaseMetaData.obj \
- $(SLO)$/AColumn.obj \
- $(SLO)$/AColumns.obj \
- $(SLO)$/AIndex.obj \
- $(SLO)$/AIndexes.obj \
- $(SLO)$/AKey.obj \
- $(SLO)$/AKeys.obj \
- $(SLO)$/AUser.obj \
- $(SLO)$/AUsers.obj \
- $(SLO)$/AGroup.obj \
- $(SLO)$/AGroups.obj \
- $(SLO)$/ACatalog.obj \
- $(SLO)$/AView.obj \
- $(SLO)$/AViews.obj \
- $(SLO)$/ATable.obj \
- $(SLO)$/ATables.obj \
- $(SLO)$/ACallableStatement.obj \
- $(SLO)$/ADatabaseMetaDataResultSetMetaData.obj \
- $(SLO)$/ADatabaseMetaDataResultSet.obj \
- $(SLO)$/AResultSet.obj \
- $(SLO)$/AConnection.obj \
- $(SLO)$/AStatement.obj \
- $(SLO)$/APreparedStatement.obj \
- $(SLO)$/AResultSetMetaData.obj \
- $(SLO)$/ADriver.obj \
- $(SLO)$/Aservices.obj \
- $(SLO)$/Awrapado.obj \
- $(SLO)$/adoimp.obj
-
-SLOFILES=\
- $(EXCEPTIONSFILES)
-# --- Library -----------------------------------
-
-SHL1TARGET= $(ADO_TARGET)$(DLLPOSTFIX)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SALLIB) \
- $(SALHELPERLIB) \
- $(OLE32LIB) \
- $(OLEAUT32LIB) \
- $(UUIDLIB) \
- $(DBTOOLSLIB) \
- $(COMPHELPERLIB)
-
-.IF "$(COMPHELPERLIB)" == ""
-SHL1STDLIBS+= icomphelp2.lib
-.ENDIF
-
-SHL1IMPLIB= i$(SHL1TARGET)
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
-
-.ELSE
-dummy:
- @echo "Nothing to build for GUI $(GUI)"
-.ENDIF # "$(GUI)"=="WNT"
-# --- Targets ----------------------------------
-.INCLUDE : $(PRJ)$/target.pmk
-
-
-ALLTAR : $(MISC)/ado.component
-
-$(MISC)/ado.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- ado.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt ado.component
diff --git a/connectivity/source/drivers/calc/CCatalog.cxx b/connectivity/source/drivers/calc/CCatalog.cxx
deleted file mode 100644
index 985a3b21df..0000000000
--- a/connectivity/source/drivers/calc/CCatalog.cxx
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-
-#include "calc/CCatalog.hxx"
-#include "calc/CConnection.hxx"
-#include "calc/CTables.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <rtl/logfile.hxx>
-
-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::calc;
-// -------------------------------------------------------------------------
-OCalcCatalog::OCalcCatalog(OCalcConnection* _pCon) : file::OFileCatalog(_pCon)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcCatalog::OCalcCatalog" );
-}
-// -------------------------------------------------------------------------
-void OCalcCatalog::refreshTables()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcCatalog::refreshTables" );
- TStringVector aVector;
- Sequence< ::rtl::OUString > aTypes;
- OCalcConnection::ODocHolder aDocHodler(((OCalcConnection*)m_pConnection));
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),aTypes);
-
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while(xResult->next())
- aVector.push_back(xRow->getString(3));
- }
- if(m_pTables)
- m_pTables->reFill(aVector);
- else
- m_pTables = new OCalcTables(m_xMetaData,*this,m_aMutex,aVector);
-
- // this avoids that the document will be loaded a 2nd time when one table will be accessed.
- //if ( m_pTables && m_pTables->hasElements() )
- // m_pTables->getByIndex(0);
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/calc/CColumns.cxx b/connectivity/source/drivers/calc/CColumns.cxx
deleted file mode 100644
index e3d7bcaa44..0000000000
--- a/connectivity/source/drivers/calc/CColumns.cxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "calc/CColumns.hxx"
-#include "calc/CTable.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-
-using namespace connectivity::calc;
-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 OCalcColumns::createObject(const ::rtl::OUString& _rName)
-{
- OCalcTable* pTable = (OCalcTable*)m_pTable;
- ::rtl::Reference<OSQLColumns> aCols = pTable->getTableColumns();
-
- OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
- sdbcx::ObjectType xRet;
- if(aIter != aCols->get().end())
- xRet = sdbcx::ObjectType(*aIter,UNO_QUERY);
- return xRet;
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/calc/CConnection.cxx b/connectivity/source/drivers/calc/CConnection.cxx
deleted file mode 100644
index 44f6f89928..0000000000
--- a/connectivity/source/drivers/calc/CConnection.cxx
+++ /dev/null
@@ -1,293 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "calc/CConnection.hxx"
-#include "calc/CDatabaseMetaData.hxx"
-#include "calc/CCatalog.hxx"
-#include "calc/CDriver.hxx"
-#include "resource/calc_res.hrc"
-#include "resource/sharedresources.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <tools/urlobj.hxx>
-#include "calc/CPreparedStatement.hxx"
-#include "calc/CStatement.hxx"
-#include <unotools/pathoptions.hxx>
-#include <connectivity/dbexception.hxx>
-#include <cppuhelper/exc_hlp.hxx>
-#include <rtl/logfile.hxx>
-
-using namespace connectivity::calc;
-using namespace connectivity::file;
-
-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;
-using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::sheet;
-
-// --------------------------------------------------------------------------------
-
-OCalcConnection::OCalcConnection(ODriver* _pDriver) : OConnection(_pDriver),m_nDocCount(0)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::OCalcConnection" );
- // m_aFilenameExtension is not used
-}
-
-OCalcConnection::~OCalcConnection()
-{
-}
-
-void OCalcConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info)
- throw(SQLException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::construct" );
- // open file
-
- sal_Int32 nLen = url.indexOf(':');
- nLen = url.indexOf(':',nLen+1);
- ::rtl::OUString aDSN(url.copy(nLen+1));
-
- m_aFileName = aDSN;
- INetURLObject aURL;
- aURL.SetSmartProtocol(INET_PROT_FILE);
- {
- SvtPathOptions aPathOptions;
- m_aFileName = aPathOptions.SubstituteVariable(m_aFileName);
- }
- aURL.SetSmartURL(m_aFileName);
- if ( aURL.GetProtocol() == INET_PROT_NOT_VALID )
- {
- // don't pass invalid URL to loadComponentFromURL
- throw SQLException();
- }
- m_aFileName = aURL.GetMainURL(INetURLObject::NO_DECODE);
-
- m_sPassword = ::rtl::OUString();
- const char* pPwd = "password";
-
- const PropertyValue *pIter = info.getConstArray();
- const PropertyValue *pEnd = pIter + info.getLength();
- for(;pIter != pEnd;++pIter)
- {
- if(!pIter->Name.compareToAscii(pPwd))
- {
- pIter->Value >>= m_sPassword;
- break;
- }
- } // for(;pIter != pEnd;++pIter)
- ODocHolder aDocHodler(this); // just to test that the doc can be loaded
- acquireDoc();
-}
-// -----------------------------------------------------------------------------
-Reference< XSpreadsheetDocument> OCalcConnection::acquireDoc()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::acquireDoc" );
- if ( m_xDoc.is() )
- {
- osl_incrementInterlockedCount(&m_nDocCount);
- return m_xDoc;
- }
- // open read-only as long as updating isn't implemented
- Sequence<PropertyValue> aArgs(2);
- aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden"));
- aArgs[0].Value <<= (sal_Bool) sal_True;
- aArgs[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
- aArgs[1].Value <<= (sal_Bool) sal_True;
-
- if ( m_sPassword.getLength() )
- {
- const sal_Int32 nPos = aArgs.getLength();
- aArgs.realloc(nPos+1);
- aArgs[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Password"));
- aArgs[nPos].Value <<= m_sPassword;
- }
-
- Reference< XComponentLoader > xDesktop( getDriver()->getFactory()->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), UNO_QUERY );
- if (!xDesktop.is())
- {
- OSL_FAIL("no desktop");
- throw SQLException();
- }
- Reference< XComponent > xComponent;
- Any aLoaderException;
- try
- {
- xComponent = xDesktop->loadComponentFromURL(
- m_aFileName, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")), 0, aArgs );
- }
- catch( const Exception& )
- {
- aLoaderException = ::cppu::getCaughtException();
- }
-
- m_xDoc.set(xComponent, UNO_QUERY );
-
- // if the URL is not a spreadsheet document, throw the exception here
- // instead of at the first access to it
- if ( !m_xDoc.is() )
- {
- Any aErrorDetails;
- if ( aLoaderException.hasValue() )
- {
- 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
- );
- aErrorDetails <<= aDetailException;
- }
-
- const ::rtl::OUString sError( m_aResources.getResourceStringWithSubstitution(
- STR_COULD_NOT_LOAD_FILE,
- "$filename$", m_aFileName
- ) );
- ::dbtools::throwGenericSQLException( sError, *this, aErrorDetails );
- }
- osl_incrementInterlockedCount(&m_nDocCount);
- return m_xDoc;
-}
-// -----------------------------------------------------------------------------
-void OCalcConnection::releaseDoc()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::releaseDoc" );
- if ( osl_decrementInterlockedCount(&m_nDocCount) == 0 )
- ::comphelper::disposeComponent( m_xDoc );
-}
-// -----------------------------------------------------------------------------
-void OCalcConnection::disposing()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::disposing" );
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_nDocCount = 0;
- ::comphelper::disposeComponent( m_xDoc );
-
- OConnection::disposing();
-}
-
-// XServiceInfo
-// --------------------------------------------------------------------------------
-
-IMPLEMENT_SERVICE_INFO(OCalcConnection, "com.sun.star.sdbc.drivers.calc.Connection", "com.sun.star.sdbc.Connection")
-
-// --------------------------------------------------------------------------------
-
-Reference< XDatabaseMetaData > SAL_CALL OCalcConnection::getMetaData( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::getMetaData" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
- if(!xMetaData.is())
- {
- xMetaData = new OCalcDatabaseMetaData(this);
- m_xMetaData = xMetaData;
- }
-
- return xMetaData;
-}
-
-//------------------------------------------------------------------------------
-
-::com::sun::star::uno::Reference< XTablesSupplier > OCalcConnection::createCatalog()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::createCatalog" );
- ::osl::MutexGuard aGuard( m_aMutex );
- Reference< XTablesSupplier > xTab = m_xCatalog;
- if(!xTab.is())
- {
- OCalcCatalog *pCat = new OCalcCatalog(this);
- xTab = pCat;
- m_xCatalog = xTab;
- }
- return xTab;
-}
-
-// --------------------------------------------------------------------------------
-
-Reference< XStatement > SAL_CALL OCalcConnection::createStatement( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::createStatement" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- Reference< XStatement > xReturn = new OCalcStatement(this);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
- return xReturn;
-}
-
-// --------------------------------------------------------------------------------
-
-Reference< XPreparedStatement > SAL_CALL OCalcConnection::prepareStatement( const ::rtl::OUString& sql )
- throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::prepareStatement" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- OCalcPreparedStatement* pStmt = new OCalcPreparedStatement(this);
- Reference< XPreparedStatement > xHoldAlive = pStmt;
- pStmt->construct(sql);
- m_aStatements.push_back(WeakReferenceHelper(*pStmt));
- return pStmt;
-}
-
-// --------------------------------------------------------------------------------
-
-Reference< XPreparedStatement > SAL_CALL OCalcConnection::prepareCall( const ::rtl::OUString& /*sql*/ )
- throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcConnection::prepareCall" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- ::dbtools::throwFeatureNotImplementedException( "XConnection::prepareCall", *this );
- return NULL;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx
deleted file mode 100644
index c25d533d57..0000000000
--- a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx
+++ /dev/null
@@ -1,470 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-
-#include "calc/CDatabaseMetaData.hxx"
-#include "calc/CConnection.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/sheet/XCellRangesQuery.hpp>
-#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-#include <com/sun/star/sheet/XDatabaseRanges.hpp>
-#include <com/sun/star/sheet/XDatabaseRange.hpp>
-#include <tools/urlobj.hxx>
-#include "FDatabaseMetaDataResultSet.hxx"
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <comphelper/types.hxx>
-#include <rtl/logfile.hxx>
-
-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::container;
-using namespace ::com::sun::star::table;
-using namespace ::com::sun::star::sheet;
-
-// -------------------------------------------------------------------------
-
-OCalcDatabaseMetaData::OCalcDatabaseMetaData(OConnection* _pCon) :ODatabaseMetaData(_pCon)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::OCalcDatabaseMetaData" );
-}
-
-// -------------------------------------------------------------------------
-
-OCalcDatabaseMetaData::~OCalcDatabaseMetaData()
-{
-}
-
-// -------------------------------------------------------------------------
-Reference< XResultSet > OCalcDatabaseMetaData::impl_getTypeInfo_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::impl_getTypeInfo_throw" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
- Reference< XResultSet > xRef = pResult;
-
- static ODatabaseMetaDataResultSet::ORows aRows;
- if(aRows.empty())
- {
- ODatabaseMetaDataResultSet::ORow aRow;
-
- aRows.reserve(6);
- aRow.reserve(18);
-
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"))));
- aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR));
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)65535));
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); // ORowSetValue((sal_Int32)ColumnValue::NULLABLE)
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::CHAR));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)10));
-
-
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("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(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("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(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("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(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("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(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")));
- aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
- aRow[3] = ODatabaseMetaDataResultSet::get0Value();
- aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
- aRow[15] = ODatabaseMetaDataResultSet::get0Value();
- aRows.push_back(aRow);
- }
-
- pResult->setRows(aRows);
- return xRef;
-}
-
-// -------------------------------------------------------------------------
-
-Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getColumns(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern,
- const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getColumns" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- Reference< XTablesSupplier > xTables = m_pConnection->createCatalog();
- if(!xTables.is())
- throw SQLException();
-
- Reference< XNameAccess> xNames = xTables->getTables();
- if(!xNames.is())
- throw SQLException();
-
- ODatabaseMetaDataResultSet::ORows aRows;
- ODatabaseMetaDataResultSet::ORow aRow(19);
-
- aRow[10] = new ORowSetValueDecorator((sal_Int32)10);
-
- Sequence< ::rtl::OUString> aTabNames(xNames->getElementNames());
- const ::rtl::OUString* pTabIter = aTabNames.getConstArray();
- const ::rtl::OUString* pTabEnd = pTabIter + aTabNames.getLength();
- for(;pTabIter != pTabEnd;++pTabIter)
- {
- if(match(tableNamePattern,*pTabIter,'\0'))
- {
- const Reference< XColumnsSupplier> xTable(xNames->getByName(*pTabIter),UNO_QUERY_THROW);
- OSL_ENSURE(xTable.is(),"Table not found! Normallya exception had to be thrown here!");
- aRow[3] = new ORowSetValueDecorator(*pTabIter);
-
- const Reference< XNameAccess> xColumns = xTable->getColumns();
- if(!xColumns.is())
- throw SQLException();
-
- const Sequence< ::rtl::OUString> aColNames(xColumns->getElementNames());
-
- const ::rtl::OUString* pColumnIter = aColNames.getConstArray();
- const ::rtl::OUString* pEnd = pColumnIter + aColNames.getLength();
- Reference< XPropertySet> xColumn;
- for(sal_Int32 i=1;pColumnIter != pEnd;++pColumnIter,++i)
- {
- if(match(columnNamePattern,*pColumnIter,'\0'))
- {
- aRow[4] = new ORowSetValueDecorator( *pColumnIter);
-
- xColumns->getByName(*pColumnIter) >>= xColumn;
- OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!");
- aRow[5] = new ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))));
- aRow[6] = new ORowSetValueDecorator(::comphelper::getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))));
- aRow[7] = new ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))));
- // aRow[8] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME));
- aRow[9] = new ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))));
- aRow[11] = new ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))));
- // aRow[12] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME));
- aRow[13] = new ORowSetValueDecorator(::comphelper::getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))));
- // aRow[14] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME));
- // aRow[15] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME));
- switch(sal_Int32(aRow[5]->getValue()))
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- aRow[16] = new ORowSetValueDecorator((sal_Int32)254);
- break;
- case DataType::LONGVARCHAR:
- aRow[16] = new ORowSetValueDecorator((sal_Int32)65535);
- break;
- default:
- aRow[16] = new ORowSetValueDecorator((sal_Int32)0);
- }
- aRow[17] = new ORowSetValueDecorator(i);
- switch(sal_Int32(aRow[11]->getValue()))
- {
- case ColumnValue::NO_NULLS:
- aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO")));
- break;
- case ColumnValue::NULLABLE:
- aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES")));
- break;
- default:
- aRow[18] = new ORowSetValueDecorator(::rtl::OUString());
- }
- aRows.push_back(aRow);
- }
- }
- }
- }
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
- Reference< XResultSet > xRef = pResult;
- pResult->setRows(aRows);
-
- return xRef;
-}
-
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL OCalcDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getURL" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:calc:")) + m_pConnection->getURL();
-}
-
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OCalcDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getMaxBinaryLiteralLength" );
- return STRING_MAXLEN;
-}
-
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OCalcDatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getMaxCharLiteralLength" );
- return STRING_MAXLEN;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OCalcDatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getMaxColumnNameLength" );
- return STRING_MAXLEN;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OCalcDatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getMaxColumnsInIndex" );
- return 1;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OCalcDatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getMaxColumnsInTable" );
- return 256;
-}
-
-// -------------------------------------------------------------------------
-
-sal_Bool lcl_IsEmptyOrHidden( const Reference<XSpreadsheets>& xSheets, const ::rtl::OUString& rName )
-{
- Any aAny = xSheets->getByName( rName );
- Reference<XSpreadsheet> xSheet;
- if ( aAny >>= xSheet )
- {
- // test if sheet is hidden
-
- Reference<XPropertySet> xProp( xSheet, UNO_QUERY );
- if (xProp.is())
- {
- sal_Bool bVisible = sal_Bool();
- Any aVisAny = xProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsVisible")) );
- if ( aVisAny >>= bVisible )
- if (!bVisible)
- return sal_True; // hidden
- }
-
- // use the same data area as in OCalcTable to test for empty table
-
- Reference<XSheetCellCursor> xCursor = xSheet->createCursor();
- Reference<XCellRangeAddressable> xRange( xCursor, UNO_QUERY );
- if ( xRange.is() )
- {
- xCursor->collapseToSize( 1, 1 ); // single (first) cell
- xCursor->collapseToCurrentRegion(); // contiguous data area
-
- CellRangeAddress aRangeAddr = xRange->getRangeAddress();
- if ( aRangeAddr.StartColumn == aRangeAddr.EndColumn &&
- aRangeAddr.StartRow == aRangeAddr.EndRow )
- {
- // single cell -> check content
- Reference<XCell> xCell = xCursor->getCellByPosition( 0, 0 );
- if ( xCell.is() && xCell->getType() == CellContentType_EMPTY )
- return sal_True;
- }
- }
- }
-
- return sal_False;
-}
-
-sal_Bool lcl_IsUnnamed( const Reference<XDatabaseRanges>& xRanges, const ::rtl::OUString& rName )
-{
- sal_Bool bUnnamed = sal_False;
-
- Any aAny = xRanges->getByName( rName );
- Reference<XDatabaseRange> xRange;
- if ( aAny >>= xRange )
- {
- Reference<XPropertySet> xRangeProp( xRange, UNO_QUERY );
- if ( xRangeProp.is() )
- {
- try
- {
- Any aUserAny = xRangeProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsUserDefined")) );
- sal_Bool bUserDefined = sal_Bool();
- if ( aUserAny >>= bUserDefined )
- bUnnamed = !bUserDefined;
- }
- catch ( UnknownPropertyException& )
- {
- // optional property
- }
- }
- }
-
- return bUnnamed;
-}
-
-// -------------------------------------------------------------------------
-
-Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTables(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/,
- const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types )
- throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcDatabaseMetaData::getTables" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
- Reference< XResultSet > xRef = pResult;
-
- // check if ORowSetValue type is given
- // when no types are given then we have to return all tables e.g. TABLE
-
- ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
-
- sal_Bool bTableFound = sal_True;
- sal_Int32 nLength = types.getLength();
- if(nLength)
- {
- bTableFound = sal_False;
-
- const ::rtl::OUString* pIter = types.getConstArray();
- const ::rtl::OUString* pEnd = pIter + nLength;
- for(;pIter != pEnd;++pIter)
- {
- if(*pIter == aTable)
- {
- bTableFound = sal_True;
- break;
- }
- }
- }
- if(!bTableFound)
- return xRef;
-
- // get the sheet names from the document
-
- OCalcConnection::ODocHolder aDocHodler(((OCalcConnection*)m_pConnection));
- Reference<XSpreadsheetDocument> xDoc = aDocHodler.getDoc();
- if ( !xDoc.is() )
- throw SQLException();
- Reference<XSpreadsheets> xSheets = xDoc->getSheets();
- if ( !xSheets.is() )
- throw SQLException();
- Sequence< ::rtl::OUString > aSheetNames = xSheets->getElementNames();
-
- ODatabaseMetaDataResultSet::ORows aRows;
- sal_Int32 nSheetCount = aSheetNames.getLength();
- for (sal_Int32 nSheet=0; nSheet<nSheetCount; nSheet++)
- {
- ::rtl::OUString aName = aSheetNames[nSheet];
- if ( !lcl_IsEmptyOrHidden( xSheets, aName ) && match(tableNamePattern,aName,'\0') )
- {
- ODatabaseMetaDataResultSet::ORow aRow(3);
- aRow.reserve(6);
- aRow.push_back(new ORowSetValueDecorator(aName));
- aRow.push_back(new ORowSetValueDecorator(aTable));
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRows.push_back(aRow);
- }
- }
-
- // also use database ranges
-
- Reference<XPropertySet> xDocProp( xDoc, UNO_QUERY );
- if ( xDocProp.is() )
- {
- Any aRangesAny = xDocProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DatabaseRanges")) );
- Reference<XDatabaseRanges> xRanges;
- if ( aRangesAny >>= xRanges )
- {
- Sequence< ::rtl::OUString > aDBNames = xRanges->getElementNames();
- sal_Int32 nDBCount = aDBNames.getLength();
- for (sal_Int32 nRange=0; nRange<nDBCount; nRange++)
- {
- ::rtl::OUString aName = aDBNames[nRange];
- if ( !lcl_IsUnnamed( xRanges, aName ) && match(tableNamePattern,aName,'\0') )
- {
- ODatabaseMetaDataResultSet::ORow aRow(3);
- aRow.reserve(6);
- aRow.push_back(new ORowSetValueDecorator(aName));
- aRow.push_back(new ORowSetValueDecorator(aTable));
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRows.push_back(aRow);
- }
- }
- }
- }
-
- pResult->setRows(aRows);
-
- return xRef;
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/calc/CDriver.cxx b/connectivity/source/drivers/calc/CDriver.cxx
deleted file mode 100644
index 4317829cf9..0000000000
--- a/connectivity/source/drivers/calc/CDriver.cxx
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "calc/CDriver.hxx"
-#include "calc/CConnection.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "connectivity/dbexception.hxx"
-#include "resource/sharedresources.hxx"
-#include "resource/calc_res.hrc"
-
-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;
-
-
-//------------------------------------------------------------------------------
-// static ServiceInfo
-
-rtl::OUString ODriver::getImplementationName_Static( ) throw(RuntimeException)
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sdbc.calc.ODriver"));
-}
-
-::rtl::OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException)
-{
- return getImplementationName_Static();
-}
-
-// service names from file::OFileDriver
-
-//------------------------------------------------------------------
-
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
- connectivity::calc::ODriver_CreateInstance(const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
-{
- return *(new ODriver(_rxFactory));
-}
-
-Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url,
- const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if (ODriver_BASE::rBHelper.bDisposed)
- throw DisposedException();
-
- if ( ! acceptsURL(url) )
- return NULL;
-
- OCalcConnection* pCon = new OCalcConnection(this);
- pCon->construct(url,info);
- Reference< XConnection > xCon = pCon;
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
-
- return xCon;
-}
-
-sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url )
- throw(SQLException, RuntimeException)
-{
- return url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:calc:")),10) == 0;
-}
-
-Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException)
-{
- if ( !acceptsURL(url) )
- {
- SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- }
- return Sequence< DriverPropertyInfo >();
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/calc/CPreparedStatement.cxx b/connectivity/source/drivers/calc/CPreparedStatement.cxx
deleted file mode 100644
index 13487b5067..0000000000
--- a/connectivity/source/drivers/calc/CPreparedStatement.cxx
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "calc/CPreparedStatement.hxx"
-#include "calc/CResultSet.hxx"
-
-using namespace connectivity::calc;
-using namespace connectivity::file;
-using namespace com::sun::star::uno;
-// -------------------------------------------------------------------------
-OResultSet* OCalcPreparedStatement::createResultSet()
-{
- return new OCalcResultSet(this,m_aSQLIterator);
-}
-// -------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OCalcPreparedStatement,"com.sun.star.sdbc.driver.calc.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/calc/CResultSet.cxx b/connectivity/source/drivers/calc/CResultSet.cxx
deleted file mode 100644
index 4429ec9950..0000000000
--- a/connectivity/source/drivers/calc/CResultSet.cxx
+++ /dev/null
@@ -1,192 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <com/sun/star/sdbcx/CompareBookmark.hpp>
-#include "calc/CResultSet.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <comphelper/sequence.hxx>
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-
-using namespace ::comphelper;
-using namespace connectivity::calc;
-using namespace connectivity::file;
-using namespace ::cppu;
-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;
-
-//------------------------------------------------------------------------------
-OCalcResultSet::OCalcResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator)
- : file::OResultSet(pStmt,_aSQLIterator)
- ,m_bBookmarkable(sal_True)
-{
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE), PROPERTY_ID_ISBOOKMARKABLE, PropertyAttribute::READONLY,&m_bBookmarkable, ::getBooleanCppuType());
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OCalcResultSet::getImplementationName( ) throw ( RuntimeException)
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.calc.ResultSet"));
-}
-// -------------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL OCalcResultSet::getSupportedServiceNames( ) throw( RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(2);
- aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet"));
- aSupported[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ResultSet"));
- return aSupported;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OCalcResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OCalcResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OResultSet::queryInterface(rType);
- return aRet.hasValue() ? aRet : OCalcResultSet_BASE::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
- Sequence< Type > SAL_CALL OCalcResultSet::getTypes( ) throw( RuntimeException)
-{
- return ::comphelper::concatSequences(OResultSet::getTypes(),OCalcResultSet_BASE::getTypes());
-}
-
-// -------------------------------------------------------------------------
-// XRowLocate
-Any SAL_CALL OCalcResultSet::getBookmark( ) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return makeAny((sal_Int32)(m_aRow->get())[0]->getValue());
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OCalcResultSet::moveToBookmark( const Any& bookmark ) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False;
-
- return Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_True);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OCalcResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False;
-
- Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_False);
-
- return relative(rows);
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OCalcResultSet::compareBookmarks( const Any& lhs, const Any& rhs ) throw( SQLException, RuntimeException)
-{
- return (lhs == rhs) ? 0 : 2;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OCalcResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OCalcResultSet::hashBookmark( const Any& bookmark ) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return comphelper::getINT32(bookmark);
-}
-// -------------------------------------------------------------------------
-// XDeleteRows
-Sequence< sal_Int32 > SAL_CALL OCalcResultSet::deleteRows( const Sequence< Any >& /*rows*/ ) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- ::dbtools::throwFeatureNotImplementedException( "XDeleteRows::deleteRows", *this );
- return Sequence< sal_Int32 >();
-}
-// -------------------------------------------------------------------------
-sal_Bool OCalcResultSet::fillIndexValues(const Reference< XColumnsSupplier> &/*_xIndex*/)
-{
- // Calc table has no index
- return sal_False;
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & OCalcResultSet::getInfoHelper()
-{
- return *OCalcResultSet_BASE3::getArrayHelper();
-}
-// -----------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OCalcResultSet::createArrayHelper() const
-{
- Sequence< Property > aProps;
- describeProperties(aProps);
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-// -------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-void SAL_CALL OCalcResultSet::acquire() throw()
-{
- OCalcResultSet_BASE2::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OCalcResultSet::release() throw()
-{
- OCalcResultSet_BASE2::release();
-}
-// -----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OCalcResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/calc/CStatement.cxx b/connectivity/source/drivers/calc/CStatement.cxx
deleted file mode 100644
index 9bdc780c82..0000000000
--- a/connectivity/source/drivers/calc/CStatement.cxx
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "calc/CStatement.hxx"
-#include "calc/CResultSet.hxx"
-
-using namespace connectivity::calc;
-using namespace connectivity::file;
-using namespace com::sun::star::uno;
-// -------------------------------------------------------------------------
-OResultSet* OCalcStatement::createResultSet()
-{
- return new OCalcResultSet(this,m_aSQLIterator);
-}
-// -------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OCalcStatement,"com.sun.star.sdbc.driver.calc.Statement","com.sun.star.sdbc.Statement");
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx
deleted file mode 100644
index 64efd5f09e..0000000000
--- a/connectivity/source/drivers/calc/CTable.cxx
+++ /dev/null
@@ -1,869 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "calc/CTable.hxx"
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-#include <com/sun/star/sheet/XCellRangesQuery.hpp>
-#include <com/sun/star/sheet/XDatabaseRanges.hpp>
-#include <com/sun/star/sheet/XDatabaseRange.hpp>
-#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-#include <com/sun/star/sheet/XUsedAreaCursor.hpp>
-#include <com/sun/star/sheet/CellFlags.hpp>
-#include <com/sun/star/sheet/FormulaResult.hpp>
-#include <com/sun/star/util/NumberFormat.hpp>
-#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#include <com/sun/star/text/XText.hpp>
-#include <svl/converter.hxx>
-#include "calc/CConnection.hxx"
-#include "calc/CColumns.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-#include <rtl/ustrbuf.hxx>
-#include <osl/thread.h>
-#include <tools/config.hxx>
-#include <comphelper/sequence.hxx>
-#include <svl/zforlist.hxx>
-#include <rtl/math.hxx>
-#include <comphelper/extract.hxx>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/dbconversion.hxx>
-#include <comphelper/types.hxx>
-#include <rtl/logfile.hxx>
-
-using namespace connectivity;
-using namespace connectivity::calc;
-using namespace connectivity::file;
-using namespace ::cppu;
-using namespace ::dbtools;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::sheet;
-using namespace ::com::sun::star::table;
-using namespace ::com::sun::star::text;
-using namespace ::com::sun::star::util;
-
-
-void lcl_UpdateArea( const Reference<XCellRange>& xUsedRange, sal_Int32& rEndCol, sal_Int32& rEndRow )
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_UpdateArea" );
- // update rEndCol, rEndRow if any non-empty cell in xUsedRange is right/below
-
- const Reference<XCellRangesQuery> xUsedQuery( xUsedRange, UNO_QUERY );
- if ( xUsedQuery.is() )
- {
- const sal_Int16 nContentFlags =
- 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++ )
- {
- rEndCol = pData[i].EndColumn > rEndCol ? pData[i].EndColumn : rEndCol;
- rEndRow = pData[i].EndRow > rEndRow ? pData[i].EndRow : rEndRow;
- }
- }
-}
-
-void lcl_GetDataArea( const Reference<XSpreadsheet>& xSheet, sal_Int32& rColumnCount, sal_Int32& rRowCount )
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_GetDataArea" );
- Reference<XSheetCellCursor> xCursor = xSheet->createCursor();
- Reference<XCellRangeAddressable> xRange( xCursor, UNO_QUERY );
- if ( !xRange.is() )
- {
- rColumnCount = rRowCount = 0;
- return;
- }
-
- // first find the contiguous cell area starting at A1
-
- xCursor->collapseToSize( 1, 1 ); // single (first) cell
- xCursor->collapseToCurrentRegion(); // contiguous data area
-
- CellRangeAddress aRegionAddr = xRange->getRangeAddress();
- sal_Int32 nEndCol = aRegionAddr.EndColumn;
- sal_Int32 nEndRow = aRegionAddr.EndRow;
-
- Reference<XUsedAreaCursor> xUsed( xCursor, UNO_QUERY );
- if ( xUsed.is() )
- {
- // The used area from XUsedAreaCursor includes visible attributes.
- // If the used area is larger than the contiguous cell area, find non-empty
- // cells in that area.
-
- xUsed->gotoEndOfUsedArea( sal_False );
- CellRangeAddress aUsedAddr = xRange->getRangeAddress();
-
- if ( aUsedAddr.EndColumn > aRegionAddr.EndColumn )
- {
- Reference<XCellRange> xUsedRange = xSheet->getCellRangeByPosition(
- aRegionAddr.EndColumn + 1, 0, aUsedAddr.EndColumn, aUsedAddr.EndRow );
- lcl_UpdateArea( xUsedRange, nEndCol, nEndRow );
- }
-
- if ( aUsedAddr.EndRow > aRegionAddr.EndRow )
- {
- // only up to the last column of aRegionAddr, the other columns are handled above
- Reference<XCellRange> xUsedRange = xSheet->getCellRangeByPosition(
- 0, aRegionAddr.EndRow + 1, aRegionAddr.EndColumn, aUsedAddr.EndRow );
- lcl_UpdateArea( xUsedRange, nEndCol, nEndRow );
- }
- }
-
- rColumnCount = nEndCol + 1; // number of columns
- rRowCount = nEndRow; // first row (headers) is not counted
-}
-
-CellContentType lcl_GetContentOrResultType( const Reference<XCell>& xCell )
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_GetContentOrResultType" );
- CellContentType eCellType = xCell->getType();
- if ( eCellType == CellContentType_FORMULA )
- {
- static const ::rtl::OUString s_sFormulaResultType(RTL_CONSTASCII_USTRINGPARAM("FormulaResultType"));
- Reference<XPropertySet> xProp( xCell, UNO_QUERY );
- try
- {
- xProp->getPropertyValue( s_sFormulaResultType ) >>= eCellType; // type of formula result
- }
- catch (UnknownPropertyException&)
- {
- eCellType = CellContentType_VALUE; // if FormulaResultType property not available
- }
- }
- return eCellType;
-}
-
-Reference<XCell> lcl_GetUsedCell( const Reference<XSpreadsheet>& xSheet, sal_Int32 nDocColumn, sal_Int32 nDocRow )
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_GetUsedCell" );
- Reference<XCell> xCell = xSheet->getCellByPosition( nDocColumn, nDocRow );
- if ( xCell.is() && xCell->getType() == CellContentType_EMPTY )
- {
- // get first non-empty cell
-
- Reference<XCellRangeAddressable> xAddr( xSheet, UNO_QUERY );
- if (xAddr.is())
- {
- CellRangeAddress aTotalRange = xAddr->getRangeAddress();
- sal_Int32 nLastRow = aTotalRange.EndRow;
- Reference<XCellRangesQuery> xQuery( xSheet->getCellRangeByPosition( nDocColumn, nDocRow, nDocColumn, nLastRow ), UNO_QUERY );
- if (xQuery.is())
- {
- // queryIntersection to get a ranges object
- Reference<XSheetCellRanges> xRanges = xQuery->queryIntersection( aTotalRange );
- if (xRanges.is())
- {
- Reference<XEnumerationAccess> xCells = xRanges->getCells();
- if (xCells.is())
- {
- Reference<XEnumeration> xEnum = xCells->createEnumeration();
- if ( xEnum.is() && xEnum->hasMoreElements() )
- {
- // get first non-empty cell from enumeration
- xCell.set(xEnum->nextElement(),UNO_QUERY);
- }
- // otherwise, keep empty cell
- }
- }
- }
- }
- }
- return xCell;
-}
-
-bool lcl_HasTextInColumn( const Reference<XSpreadsheet>& xSheet, sal_Int32 nDocColumn, sal_Int32 nDocRow )
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_HasTextInColumn" );
- // look for any text cell or text result in the column
-
- Reference<XCellRangeAddressable> xAddr( xSheet, UNO_QUERY );
- if (xAddr.is())
- {
- CellRangeAddress aTotalRange = xAddr->getRangeAddress();
- sal_Int32 nLastRow = aTotalRange.EndRow;
- Reference<XCellRangesQuery> xQuery( xSheet->getCellRangeByPosition( nDocColumn, nDocRow, nDocColumn, nLastRow ), UNO_QUERY );
- if (xQuery.is())
- {
- // are there text cells in the column?
- Reference<XSheetCellRanges> xTextContent = xQuery->queryContentCells( CellFlags::STRING );
- if ( xTextContent.is() && xTextContent->hasElements() )
- return true;
-
- // are there formulas with text results in the column?
- Reference<XSheetCellRanges> xTextFormula = xQuery->queryFormulaCells( FormulaResult::STRING );
- if ( xTextFormula.is() && xTextFormula->hasElements() )
- return true;
- }
- }
-
- return false;
-}
-
-void lcl_GetColumnInfo( const Reference<XSpreadsheet>& xSheet, const Reference<XNumberFormats>& xFormats,
- sal_Int32 nDocColumn, sal_Int32 nStartRow, sal_Bool bHasHeaders,
- ::rtl::OUString& rName, sal_Int32& rDataType, sal_Bool& rCurrency )
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_GetColumnInfo" );
- //! avoid duplicate field names
-
- // get column name from first row, if range contains headers
-
- if ( bHasHeaders )
- {
- Reference<XText> xHeaderText( xSheet->getCellByPosition( nDocColumn, nStartRow ), UNO_QUERY );
- if ( xHeaderText.is() )
- rName = xHeaderText->getString();
- }
-
- // get column type from first data row
-
- sal_Int32 nDataRow = nStartRow;
- if ( bHasHeaders )
- ++nDataRow;
- Reference<XCell> xDataCell = lcl_GetUsedCell( xSheet, nDocColumn, nDataRow );
-
- Reference<XPropertySet> xProp( xDataCell, UNO_QUERY );
- if ( xProp.is() )
- {
- rCurrency = sal_False; // set to true for currency below
-
- const CellContentType eCellType = lcl_GetContentOrResultType( xDataCell );
- // #i35178# use "text" type if there is any text cell in the column
- if ( eCellType == CellContentType_TEXT || lcl_HasTextInColumn( xSheet, nDocColumn, nDataRow ) )
- rDataType = DataType::VARCHAR;
- else if ( eCellType == CellContentType_VALUE )
- {
- // get number format to distinguish between different types
-
- sal_Int16 nNumType = NumberFormat::NUMBER;
- try
- {
- static ::rtl::OUString s_NumberFormat(RTL_CONSTASCII_USTRINGPARAM("NumberFormat"));
- sal_Int32 nKey = 0;
-
- if ( xProp->getPropertyValue( s_NumberFormat ) >>= nKey )
- {
- const Reference<XPropertySet> xFormat = xFormats->getByKey( nKey );
- if ( xFormat.is() )
- {
- xFormat->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE) ) >>= nNumType;
- }
- }
- }
- catch ( Exception& )
- {
- }
-
- if ( nNumType & NumberFormat::TEXT )
- rDataType = DataType::VARCHAR;
- else if ( nNumType & NumberFormat::NUMBER )
- rDataType = DataType::DECIMAL;
- else if ( nNumType & NumberFormat::CURRENCY )
- {
- rCurrency = sal_True;
- rDataType = DataType::DECIMAL;
- }
- else if ( ( nNumType & NumberFormat::DATETIME ) == NumberFormat::DATETIME )
- {
- // NumberFormat::DATETIME is DATE | TIME
- rDataType = DataType::TIMESTAMP;
- }
- else if ( nNumType & NumberFormat::DATE )
- rDataType = DataType::DATE;
- else if ( nNumType & NumberFormat::TIME )
- rDataType = DataType::TIME;
- else if ( nNumType & NumberFormat::LOGICAL )
- rDataType = DataType::BIT;
- else
- rDataType = DataType::DECIMAL;
- }
- else
- {
- // whole column empty
- rDataType = DataType::VARCHAR;
- }
- }
-}
-
-// -------------------------------------------------------------------------
-
-void lcl_SetValue( ORowSetValue& rValue, const Reference<XSpreadsheet>& xSheet,
- sal_Int32 nStartCol, sal_Int32 nStartRow, sal_Bool bHasHeaders,
- const ::Date& rNullDate,
- sal_Int32 nDBRow, sal_Int32 nDBColumn, sal_Int32 nType )
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_SetValue" );
- sal_Int32 nDocColumn = nStartCol + nDBColumn - 1; // database counts from 1
- sal_Int32 nDocRow = nStartRow + nDBRow - 1;
- if (bHasHeaders)
- ++nDocRow;
-
- const Reference<XCell> xCell = xSheet->getCellByPosition( nDocColumn, nDocRow );
- if ( xCell.is() )
- {
- CellContentType eCellType = lcl_GetContentOrResultType( xCell );
- switch (nType)
- {
- case DataType::VARCHAR:
- if ( eCellType == CellContentType_EMPTY )
- rValue.setNull();
- else
- {
- // #i25840# still let Calc convert numbers to text
- const Reference<XText> xText( xCell, UNO_QUERY );
- if ( xText.is() )
- rValue = xText->getString();
- }
- break;
- case DataType::DECIMAL:
- if ( eCellType == CellContentType_VALUE )
- rValue = xCell->getValue(); // double
- else
- rValue.setNull();
- break;
- case DataType::BIT:
- if ( eCellType == CellContentType_VALUE )
- rValue = (sal_Bool)( xCell->getValue() != 0.0 );
- else
- rValue.setNull();
- break;
- case DataType::DATE:
- if ( eCellType == CellContentType_VALUE )
- {
- ::Date aDate( rNullDate );
- aDate += (long)::rtl::math::approxFloor( xCell->getValue() );
- ::com::sun::star::util::Date aDateStruct( aDate.GetDay(), aDate.GetMonth(), aDate.GetYear() );
- rValue = aDateStruct;
- }
- else
- rValue.setNull();
- break;
- case DataType::TIME:
- if ( eCellType == CellContentType_VALUE )
- {
- double fCellVal = xCell->getValue();
- double fTime = fCellVal - rtl::math::approxFloor( fCellVal );
- long nIntTime = (long)rtl::math::round( fTime * 8640000.0 );
- if ( nIntTime == 8640000 )
- nIntTime = 0; // 23:59:59.995 and above is 00:00:00.00
- ::com::sun::star::util::Time aTime;
- aTime.HundredthSeconds = (sal_uInt16)( nIntTime % 100 );
- nIntTime /= 100;
- aTime.Seconds = (sal_uInt16)( nIntTime % 60 );
- nIntTime /= 60;
- aTime.Minutes = (sal_uInt16)( nIntTime % 60 );
- nIntTime /= 60;
- OSL_ENSURE( nIntTime < 24, "error in time calculation" );
- aTime.Hours = (sal_uInt16) nIntTime;
- rValue = aTime;
- }
- else
- rValue.setNull();
- break;
- case DataType::TIMESTAMP:
- if ( eCellType == CellContentType_VALUE )
- {
- double fCellVal = xCell->getValue();
- double fDays = ::rtl::math::approxFloor( fCellVal );
- double fTime = fCellVal - fDays;
- long nIntDays = (long)fDays;
- long nIntTime = (long)::rtl::math::round( fTime * 8640000.0 );
- if ( nIntTime == 8640000 )
- {
- nIntTime = 0; // 23:59:59.995 and above is 00:00:00.00
- ++nIntDays; // (next day)
- }
-
- ::com::sun::star::util::DateTime aDateTime;
-
- aDateTime.HundredthSeconds = (sal_uInt16)( nIntTime % 100 );
- nIntTime /= 100;
- aDateTime.Seconds = (sal_uInt16)( nIntTime % 60 );
- nIntTime /= 60;
- aDateTime.Minutes = (sal_uInt16)( nIntTime % 60 );
- nIntTime /= 60;
- OSL_ENSURE( nIntTime < 24, "error in time calculation" );
- aDateTime.Hours = (sal_uInt16) nIntTime;
-
- ::Date aDate( rNullDate );
- aDate += nIntDays;
- aDateTime.Day = aDate.GetDay();
- aDateTime.Month = aDate.GetMonth();
- aDateTime.Year = aDate.GetYear();
-
- rValue = aDateTime;
- }
- else
- rValue.setNull();
- break;
- } // switch (nType)
- }
-
-// rValue.setTypeKind(nType);
-}
-
-// -------------------------------------------------------------------------
-
-::rtl::OUString lcl_GetColumnStr( sal_Int32 nColumn )
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::lcl_GetColumnStr" );
- if ( nColumn < 26 )
- return ::rtl::OUString::valueOf( (sal_Unicode) ( 'A' + nColumn ) );
- else
- {
- ::rtl::OUStringBuffer aBuffer(2);
- aBuffer.setLength( 2 );
- aBuffer.setCharAt( 0, (sal_Unicode) ( 'A' + ( nColumn / 26 ) - 1 ) );
- aBuffer.setCharAt( 1, (sal_Unicode) ( 'A' + ( nColumn % 26 ) ) );
- return aBuffer.makeStringAndClear();
- }
-}
-
-void OCalcTable::fillColumns()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::fillColumns" );
- if ( !m_xSheet.is() )
- throw SQLException();
-
- String aStrFieldName;
- aStrFieldName.AssignAscii("Column");
- ::rtl::OUString aTypeName;
- ::comphelper::UStringMixEqual aCase(m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers());
- const sal_Bool bStoresMixedCaseQuotedIdentifiers = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers();
-
- for (sal_Int32 i = 0; i < m_nDataCols; i++)
- {
- ::rtl::OUString aColumnName;
- sal_Int32 eType = DataType::OTHER;
- sal_Bool bCurrency = sal_False;
-
- lcl_GetColumnInfo( m_xSheet, m_xFormats, m_nStartCol + i, m_nStartRow, m_bHasHeaders,
- aColumnName, eType, bCurrency );
-
- if ( !aColumnName.getLength() )
- aColumnName = lcl_GetColumnStr( i );
-
- sal_Int32 nPrecision = 0; //! ...
- sal_Int32 nDecimals = 0; //! ...
-
- switch ( eType )
- {
- case DataType::VARCHAR:
- {
- static const ::rtl::OUString s_sType(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"));
- aTypeName = s_sType;
- }
- break;
- case DataType::DECIMAL:
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL"));
- break;
- case DataType::BIT:
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BOOL"));
- break;
- case DataType::DATE:
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATE"));
- break;
- case DataType::TIME:
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIME"));
- break;
- case DataType::TIMESTAMP:
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP"));
- break;
- default:
- OSL_FAIL("missing type name");
- aTypeName = ::rtl::OUString();
- }
-
- // check if the column name already exists
- ::rtl::OUString aAlias = aColumnName;
- OSQLColumns::Vector::const_iterator aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase);
- sal_Int32 nExprCnt = 0;
- while(aFind != m_aColumns->get().end())
- {
- (aAlias = aColumnName) += ::rtl::OUString::valueOf((sal_Int32)++nExprCnt);
- aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase);
- }
-
- sdbcx::OColumn* pColumn = new sdbcx::OColumn( aAlias, aTypeName, ::rtl::OUString(),::rtl::OUString(),
- ColumnValue::NULLABLE, nPrecision, nDecimals,
- eType, sal_False, sal_False, bCurrency,
- bStoresMixedCaseQuotedIdentifiers);
- Reference< XPropertySet> xCol = pColumn;
- m_aColumns->get().push_back(xCol);
- m_aTypes.push_back(eType);
- m_aPrecisions.push_back(nPrecision);
- m_aScales.push_back(nDecimals);
- }
-}
-
-// -------------------------------------------------------------------------
-OCalcTable::OCalcTable(sdbcx::OCollection* _pTables,OCalcConnection* _pConnection,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description ,
- const ::rtl::OUString& _SchemaName,
- const ::rtl::OUString& _CatalogName
- ) : OCalcTable_BASE(_pTables,_pConnection,_Name,
- _Type,
- _Description,
- _SchemaName,
- _CatalogName)
- ,m_pConnection(_pConnection)
- ,m_nStartCol(0)
- ,m_nStartRow(0)
- ,m_nDataCols(0)
- ,m_nDataRows(0)
- ,m_bHasHeaders(sal_False)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::OCalcTable" );
-}
-// -----------------------------------------------------------------------------
-void OCalcTable::construct()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::construct" );
- // get sheet object
- Reference< XSpreadsheetDocument> xDoc = m_pConnection->acquireDoc();
- if (xDoc.is())
- {
- Reference<XSpreadsheets> xSheets = xDoc->getSheets();
- if ( xSheets.is() && xSheets->hasByName( m_Name ) )
- {
- m_xSheet.set(xSheets->getByName( m_Name ),UNO_QUERY);
- if ( m_xSheet.is() )
- {
- lcl_GetDataArea( m_xSheet, m_nDataCols, m_nDataRows );
- m_bHasHeaders = sal_True;
- // whole sheet is always assumed to include a header row
- }
- }
- else // no sheet -> try database range
- {
- Reference<XPropertySet> xDocProp( xDoc, UNO_QUERY );
- if ( xDocProp.is() )
- {
- Reference<XDatabaseRanges> xRanges(xDocProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DatabaseRanges")) ),UNO_QUERY);
-
- if ( xRanges.is() && xRanges->hasByName( m_Name ) )
- {
- Reference<XDatabaseRange> xDBRange(xRanges->getByName( m_Name ),UNO_QUERY);
- Reference<XCellRangeReferrer> xRefer( xDBRange, UNO_QUERY );
- if ( xRefer.is() )
- {
- // Header flag is always stored with database range
- // Get flag from FilterDescriptor
-
- sal_Bool bRangeHeader = sal_True;
- Reference<XPropertySet> xFiltProp( xDBRange->getFilterDescriptor(), UNO_QUERY );
- if ( xFiltProp.is() )
- xFiltProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ContainsHeader"))) >>= bRangeHeader;
-
- Reference<XSheetCellRange> xSheetRange( xRefer->getReferredCells(), UNO_QUERY );
- Reference<XCellRangeAddressable> xAddr( xSheetRange, UNO_QUERY );
- if ( xSheetRange.is() && xAddr.is() )
- {
- m_xSheet = xSheetRange->getSpreadsheet();
- CellRangeAddress aRangeAddr = xAddr->getRangeAddress();
- m_nStartCol = aRangeAddr.StartColumn;
- m_nStartRow = aRangeAddr.StartRow;
- m_nDataCols = aRangeAddr.EndColumn - m_nStartCol + 1;
- // m_nDataRows is excluding header row
- m_nDataRows = aRangeAddr.EndRow - m_nStartRow;
- if ( !bRangeHeader )
- {
- // m_nDataRows counts the whole range
- m_nDataRows += 1;
- }
-
- m_bHasHeaders = bRangeHeader;
- }
- }
- }
- }
- }
-
- Reference<XNumberFormatsSupplier> xSupp( xDoc, UNO_QUERY );
- if (xSupp.is())
- m_xFormats = xSupp->getNumberFormats();
-
- Reference<XPropertySet> xProp( xDoc, UNO_QUERY );
- if (xProp.is())
- {
- ::com::sun::star::util::Date aDateStruct;
- if ( xProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NullDate")) ) >>= aDateStruct )
- m_aNullDate = ::Date( aDateStruct.Day, aDateStruct.Month, aDateStruct.Year );
- }
- }
-
- //! default if no null date available?
-
- fillColumns();
-
- refreshColumns();
-}
-// -------------------------------------------------------------------------
-void OCalcTable::refreshColumns()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::refreshColumns" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
- TStringVector aVector;
-
- OSQLColumns::Vector::const_iterator aEnd = m_aColumns->get().end();
- for(OSQLColumns::Vector::const_iterator aIter = m_aColumns->get().begin();aIter != aEnd;++aIter)
- aVector.push_back(Reference< XNamed>(*aIter,UNO_QUERY)->getName());
-
- if(m_pColumns)
- m_pColumns->reFill(aVector);
- else
- m_pColumns = new OCalcColumns(this,m_aMutex,aVector);
-}
-// -------------------------------------------------------------------------
-void OCalcTable::refreshIndexes()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::refreshIndexes" );
- // Calc table has no index
-}
-
-// -------------------------------------------------------------------------
-void SAL_CALL OCalcTable::disposing(void)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::disposing" );
- OFileTable::disposing();
- ::osl::MutexGuard aGuard(m_aMutex);
- m_aColumns = NULL;
- if ( m_pConnection )
- m_pConnection->releaseDoc();
- m_pConnection = NULL;
-
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OCalcTable::getTypes( ) throw(RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::getTypes" );
- Sequence< Type > aTypes = OTable_TYPEDEF::getTypes();
- ::std::vector<Type> aOwnTypes;
- aOwnTypes.reserve(aTypes.getLength());
-
- const Type* pBegin = aTypes.getConstArray();
- const Type* pEnd = pBegin + aTypes.getLength();
- for(;pBegin != pEnd;++pBegin)
- {
- if(!( *pBegin == ::getCppuType((const Reference<XKeysSupplier>*)0) ||
- *pBegin == ::getCppuType((const Reference<XIndexesSupplier>*)0) ||
- *pBegin == ::getCppuType((const Reference<XRename>*)0) ||
- *pBegin == ::getCppuType((const Reference<XAlterTable>*)0) ||
- *pBegin == ::getCppuType((const Reference<XDataDescriptorFactory>*)0)))
- aOwnTypes.push_back(*pBegin);
- }
- aOwnTypes.push_back(::getCppuType( (const Reference< ::com::sun::star::lang::XUnoTunnel > *)0 ));
-
- const Type* pAttrs = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- return Sequence< Type >(pAttrs, aOwnTypes.size());
-}
-
-// -------------------------------------------------------------------------
-Any SAL_CALL OCalcTable::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- if( rType == ::getCppuType((const Reference<XKeysSupplier>*)0) ||
- rType == ::getCppuType((const Reference<XIndexesSupplier>*)0) ||
- rType == ::getCppuType((const Reference<XRename>*)0) ||
- rType == ::getCppuType((const Reference<XAlterTable>*)0) ||
- rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0))
- return Any();
-
- const Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this));
- return aRet.hasValue() ? aRet : OTable_TYPEDEF::queryInterface(rType);
-}
-
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OCalcTable::getUnoTunnelImplementationId()
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::getUnoTunnelImplementationId" );
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OCalcTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::getSomething" );
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : OCalcTable_BASE::getSomething(rId);
-}
-//------------------------------------------------------------------
-sal_Int32 OCalcTable::getCurrentLastPos() const
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::getCurrentLastPos" );
- return m_nDataRows;
-}
-//------------------------------------------------------------------
-sal_Bool OCalcTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::seekRow" );
- // ----------------------------------------------------------
- // Positionierung vorbereiten:
-
- sal_uInt32 nNumberOfRecords = m_nDataRows;
- sal_uInt32 nTempPos = m_nFilePos;
- m_nFilePos = nCurPos;
-
- switch(eCursorPosition)
- {
- case IResultSetHelper::NEXT:
- m_nFilePos++;
- break;
- case IResultSetHelper::PRIOR:
- if (m_nFilePos > 0)
- m_nFilePos--;
- break;
- case IResultSetHelper::FIRST:
- m_nFilePos = 1;
- break;
- case IResultSetHelper::LAST:
- m_nFilePos = nNumberOfRecords;
- break;
- case IResultSetHelper::RELATIVE:
- m_nFilePos = (((sal_Int32)m_nFilePos) + nOffset < 0) ? 0L
- : (sal_uInt32)(((sal_Int32)m_nFilePos) + nOffset);
- break;
- case IResultSetHelper::ABSOLUTE:
- case IResultSetHelper::BOOKMARK:
- m_nFilePos = (sal_uInt32)nOffset;
- break;
- }
-
- if (m_nFilePos > (sal_Int32)nNumberOfRecords)
- m_nFilePos = (sal_Int32)nNumberOfRecords + 1;
-
- if (m_nFilePos == 0 || m_nFilePos == (sal_Int32)nNumberOfRecords + 1)
- goto Error;
- else
- {
- //! read buffer / setup row object etc?
- }
- goto End;
-
-Error:
- switch(eCursorPosition)
- {
- case IResultSetHelper::PRIOR:
- case IResultSetHelper::FIRST:
- m_nFilePos = 0;
- break;
- case IResultSetHelper::LAST:
- case IResultSetHelper::NEXT:
- case IResultSetHelper::ABSOLUTE:
- case IResultSetHelper::RELATIVE:
- if (nOffset > 0)
- m_nFilePos = nNumberOfRecords + 1;
- else if (nOffset < 0)
- m_nFilePos = 0;
- break;
- case IResultSetHelper::BOOKMARK:
- m_nFilePos = nTempPos; // vorherige Position
- }
- // aStatus.Set(SDB_STAT_NO_DATA_FOUND);
- return sal_False;
-
-End:
- nCurPos = m_nFilePos;
- return sal_True;
-}
-//------------------------------------------------------------------
-sal_Bool OCalcTable::fetchRow( OValueRefRow& _rRow, const OSQLColumns & _rCols,
- sal_Bool _bUseTableDefs, sal_Bool bRetrieveData )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::fetchRow" );
- // read the bookmark
-
- sal_Bool bIsCurRecordDeleted = sal_False;
- _rRow->setDeleted(bIsCurRecordDeleted);
- *(_rRow->get())[0] = m_nFilePos;
-
- if (!bRetrieveData)
- return sal_True;
-
- // fields
-
- OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin();
- OSQLColumns::Vector::const_iterator aEnd = _rCols.get().end();
- const OValueRefVector::Vector::size_type nCount = _rRow->get().size();
- for (OValueRefVector::Vector::size_type i = 1; aIter != aEnd && i < nCount;
- ++aIter, i++)
- {
- if ( (_rRow->get())[i]->isBound() )
- {
- sal_Int32 nType = 0;
- if ( _bUseTableDefs )
- nType = m_aTypes[i-1];
- else
- (*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nType;
-
-
- lcl_SetValue( (_rRow->get())[i]->get(), m_xSheet, m_nStartCol, m_nStartRow, m_bHasHeaders,
- m_aNullDate, m_nFilePos, i, nType );
- }
- }
- return sal_True;
-}
-// -------------------------------------------------------------------------
-void OCalcTable::FileClose()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::FileClose" );
- ::osl::MutexGuard aGuard(m_aMutex);
-
- OCalcTable_BASE::FileClose();
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/calc/CTables.cxx b/connectivity/source/drivers/calc/CTables.cxx
deleted file mode 100644
index 2cee66ace7..0000000000
--- a/connectivity/source/drivers/calc/CTables.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "calc/CTables.hxx"
-#include "calc/CTable.hxx"
-#include "file/FCatalog.hxx"
-#include "file/FConnection.hxx"
-#include "calc/CCatalog.hxx"
-#include <comphelper/types.hxx>
-#include <rtl/logfile.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;
-namespace starutil = ::com::sun::star::util;
-
-sdbcx::ObjectType OCalcTables::createObject(const ::rtl::OUString& _rName)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTables::createObject" );
- OCalcTable* pTable = new OCalcTable(this,(OCalcConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(),
- _rName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE")));
- sdbcx::ObjectType xRet = pTable;
- pTable->construct();
- return xRet;
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/calc/CalcDriver.xml b/connectivity/source/drivers/calc/CalcDriver.xml
deleted file mode 100755
index 31a73e8bdd..0000000000
--- a/connectivity/source/drivers/calc/CalcDriver.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE module-description PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
-<module-description>
- <module-name>file</module-name>
- <component-description>
- <author>Niklas Nebel</author>
- <name>com.sun.star.sdbc.driver.calc.ODriver</name>
- <description>This library implements the database driver for spreadsheet (Calc) file formats.
-</description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service>com.sun.star.sdbc.Driver</supported-service>
- <supported-service>com.sun.star.sdbcx.Driver</supported-service>
- <service-dependency> ... </service-dependency>
- </component-description>
- <project-build-dependency>cppuhelper</project-build-dependency>
- <project-build-dependency>cppu</project-build-dependency>
- <project-build-dependency>sal</project-build-dependency>
- <runtime-module-dependency>cppuhelper</runtime-module-dependency>
- <runtime-module-dependency>cppu</runtime-module-dependency>
- <runtime-module-dependency>sal</runtime-module-dependency>
- <runtime-module-dependency>osl</runtime-module-dependency>
- <runtime-module-dependency>svtools-light1</runtime-module-dependency>
- <runtime-module-dependency>svtools</runtime-module-dependency>
- <runtime-module-dependency>ucbhelper</runtime-module-dependency>
- <runtime-module-dependency>dbtools</runtime-module-dependency>
- <runtime-module-dependency>unotools</runtime-module-dependency>
- <runtime-module-dependency>comphelper</runtime-module-dependency>
-</module-description>
diff --git a/connectivity/source/drivers/calc/Cservices.cxx b/connectivity/source/drivers/calc/Cservices.cxx
deleted file mode 100644
index 41ab7f6bae..0000000000
--- a/connectivity/source/drivers/calc/Cservices.cxx
+++ /dev/null
@@ -1,114 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "calc/CDriver.hxx"
-#include <cppuhelper/factory.hxx>
-
-using namespace connectivity::calc;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount* _pT
- );
-
-//---------------------------------------------------------------------------------------
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- sal_Char const* pImplementationName
- )
- : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- inline
- sal_Bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
- }
- catch(...)
- {
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = 0;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- ODriver::getImplementationName_Static(),
- ODriver::getSupportedServiceNames_Static(),
- ODriver_CreateInstance, ::cppu::createSingleFactory)
- ;
-
- if(aReq.xRet.is())
- aReq.xRet->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/calc/calc.component b/connectivity/source/drivers/calc/calc.component
deleted file mode 100755
index be949f70de..0000000000
--- a/connectivity/source/drivers/calc/calc.component
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.sdbc.calc.ODriver">
- <service name="com.sun.star.sdbc.Driver"/>
- <service name="com.sun.star.sdbcx.Driver"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/calc/calc.xcu b/connectivity/source/drivers/calc/calc.xcu
deleted file mode 100644
index ec71ed3caf..0000000000
--- a/connectivity/source/drivers/calc/calc.xcu
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="sdbc:calc:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.calc.ODriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Spreadsheet</value>
- </prop>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FileSystemBased" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="MediaType" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>application/vnd.oasis.opendocument.spreadsheet</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/calc/exports.dxp b/connectivity/source/drivers/calc/exports.dxp
deleted file mode 100755
index 7003307892..0000000000
--- a/connectivity/source/drivers/calc/exports.dxp
+++ /dev/null
@@ -1 +0,0 @@
-component_getFactory
diff --git a/connectivity/source/drivers/calc/makefile.mk b/connectivity/source/drivers/calc/makefile.mk
deleted file mode 100755
index d36438a277..0000000000
--- a/connectivity/source/drivers/calc/makefile.mk
+++ /dev/null
@@ -1,99 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=calc
-
-ENABLE_EXCEPTIONS=TRUE
-VISIBILITY_HIDDEN=TRUE
-
-# --- Settings ----------------------------------
-
-.IF "$(DBGUTIL_OJ)"!=""
-ENVCFLAGS+=/FR$(SLO)$/
-.ENDIF
-
-.INCLUDE : $(PRJ)$/makefile.pmk
-.INCLUDE : $(PRJ)$/version.mk
-
-# --- Files -------------------------------------
-
-SLOFILES=\
- $(SLO)$/CResultSet.obj \
- $(SLO)$/CStatement.obj \
- $(SLO)$/CPreparedStatement.obj \
- $(SLO)$/CDatabaseMetaData.obj \
- $(SLO)$/CCatalog.obj \
- $(SLO)$/CColumns.obj \
- $(SLO)$/CTable.obj \
- $(SLO)$/CTables.obj \
- $(SLO)$/CConnection.obj \
- $(SLO)$/Cservices.obj \
- $(SLO)$/CDriver.obj
-
-SHL1VERSIONMAP=$(SOLARENV)/src/component.map
-
-# --- Library -----------------------------------
-
-SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SVLLIB) \
- $(TOOLSLIB) \
- $(UNOTOOLSLIB) \
- $(SALLIB) \
- $(SALHELPERLIB) \
- $(DBTOOLSLIB) \
- $(DBFILELIB) \
- $(COMPHELPERLIB)
-
-
-SHL1DEPN=
-SHL1IMPLIB= i$(TARGET)
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
-
-# --- Targets ----------------------------------
-
-.INCLUDE : $(PRJ)$/target.pmk
-
-
-
-ALLTAR : $(MISC)/calc.component
-
-$(MISC)/calc.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- calc.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt calc.component
diff --git a/connectivity/source/drivers/dbase/DCatalog.cxx b/connectivity/source/drivers/dbase/DCatalog.cxx
deleted file mode 100644
index 3e5f2b8bde..0000000000
--- a/connectivity/source/drivers/dbase/DCatalog.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-
-#include "dbase/DCatalog.hxx"
-#include "dbase/DConnection.hxx"
-#include "dbase/DTables.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#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::dbase;
-// -------------------------------------------------------------------------
-ODbaseCatalog::ODbaseCatalog(ODbaseConnection* _pCon) : file::OFileCatalog(_pCon)
-{
-}
-// -------------------------------------------------------------------------
-void ODbaseCatalog::refreshTables()
-{
- TStringVector aVector;
- Sequence< ::rtl::OUString > aTypes;
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),aTypes);
-
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while(xResult->next())
- aVector.push_back(xRow->getString(3));
- }
- if(m_pTables)
- m_pTables->reFill(aVector);
- else
- m_pTables = new ODbaseTables(m_xMetaData,*this,m_aMutex,aVector);
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DCode.cxx b/connectivity/source/drivers/dbase/DCode.cxx
deleted file mode 100644
index 9a21d955ae..0000000000
--- a/connectivity/source/drivers/dbase/DCode.cxx
+++ /dev/null
@@ -1,133 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "dbase/DCode.hxx"
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#include "dbase/DIndex.hxx"
-#include "dbase/DIndexIter.hxx"
-
-
-using namespace connectivity::dbase;
-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::lang;
-using namespace ::com::sun::star::container;
-
-TYPEINIT1(OFILEOperandAttr, OOperandAttr);
-// -----------------------------------------------------------------------------
-OOperandAttr* OFILEAnalyzer::createOperandAttr(sal_Int32 _nPos,
- const Reference< XPropertySet>& _xCol,
- const Reference< XNameAccess>& _xIndexes)
-{
- return new OFILEOperandAttr((sal_uInt16)_nPos,_xCol,_xIndexes);
-}
-
-//------------------------------------------------------------------
-OFILEOperandAttr::OFILEOperandAttr(sal_uInt16 _nPos,
- const Reference< XPropertySet>& _xColumn,
- const Reference< XNameAccess>& _xIndexes)
- : OOperandAttr(_nPos,_xColumn)
-{
- if(_xIndexes.is())
- {
- ::rtl::OUString sName;
- Reference<XPropertySetInfo> xColInfo = _xColumn->getPropertySetInfo();
- Reference<XPropertySet> xIndex;
-
- Sequence< ::rtl::OUString> aSeq = _xIndexes->getElementNames();
- const ::rtl::OUString* pBegin = aSeq.getConstArray();
- const ::rtl::OUString* pEnd = pBegin + aSeq.getLength();
- for(;pBegin != pEnd;++pBegin)
- {
- _xIndexes->getByName(*pBegin) >>= xIndex;
- if(xIndex.is())
- {
- Reference<XColumnsSupplier> xColsSup(xIndex,UNO_QUERY);
- Reference<XNameAccess> xNameAccess = xColsSup->getColumns();
- _xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sName;
- if(xNameAccess->hasByName(sName))
- {
- m_xIndex = xIndex;
- break;
- }
- else if(xColInfo->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME)))
- {
- _xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME)) >>= sName;
- if(xNameAccess->hasByName(sName))
- {
- m_xIndex = xIndex;
- break;
- }
- }
- }
- }
- }
-
-}
-// -------------------------------------------------------------------------
-sal_Bool OFILEOperandAttr::isIndexed() const
-{
- return m_xIndex.is();
-}
-//------------------------------------------------------------------
-OEvaluateSet* OFILEOperandAttr::preProcess(OBoolOperator* pOp, OOperand* pRight)
-{
- OEvaluateSet* pEvaluateSet = NULL;
- if (isIndexed())
- {
- Reference<XUnoTunnel> xTunnel(m_xIndex,UNO_QUERY);
- if(xTunnel.is())
- {
- ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) );
- if(pIndex)
- {
- OIndexIterator* pIter = pIndex->createIterator(pOp,pRight);
-
- if (pIter)
- {
- pEvaluateSet = new OEvaluateSet();
- sal_uIntPtr nRec = pIter->First();
- while (nRec != NODE_NOTFOUND)
- {
- (*pEvaluateSet)[nRec] = nRec;
- nRec = pIter->Next();
- }
- }
- delete pIter;
- }
- }
- }
- return pEvaluateSet;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DColumns.cxx b/connectivity/source/drivers/dbase/DColumns.cxx
deleted file mode 100644
index 6f2fb95d5b..0000000000
--- a/connectivity/source/drivers/dbase/DColumns.cxx
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "dbase/DColumns.hxx"
-#include "dbase/DTable.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <comphelper/property.hxx>
-
-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;
-
-typedef file::OColumns ODbaseColumns_BASE;
-sdbcx::ObjectType ODbaseColumns::createObject(const ::rtl::OUString& _rName)
-{
-
- ODbaseTable* pTable = (ODbaseTable*)m_pTable;
-
- ::rtl::Reference<OSQLColumns> aCols = pTable->getTableColumns();
- OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
-
- sdbcx::ObjectType xRet;
- if(aIter != aCols->get().end())
- xRet = sdbcx::ObjectType(*aIter,UNO_QUERY);
- return xRet;
-}
-
-// -------------------------------------------------------------------------
-void ODbaseColumns::impl_refresh() throw(RuntimeException)
-{
- m_pTable->refreshColumns();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > ODbaseColumns::createDescriptor()
-{
- return new sdbcx::OColumn(isCaseSensitive());
-}
-// -----------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType ODbaseColumns::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- if ( m_pTable->isNew() )
- return cloneDescriptor( descriptor );
-
- m_pTable->addColumn( descriptor );
- return createObject( _rForName );
-}
-// -----------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-// XDrop
-void ODbaseColumns::dropObject(sal_Int32 _nPos,const ::rtl::OUString /*_sElementName*/)
-{
- if(!m_pTable->isNew())
- m_pTable->dropColumn(_nPos);
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DConnection.cxx b/connectivity/source/drivers/dbase/DConnection.cxx
deleted file mode 100644
index e2dc2e30b8..0000000000
--- a/connectivity/source/drivers/dbase/DConnection.cxx
+++ /dev/null
@@ -1,133 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "dbase/DConnection.hxx"
-#include "dbase/DDatabaseMetaData.hxx"
-#include "dbase/DCatalog.hxx"
-#include "dbase/DDriver.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <tools/urlobj.hxx>
-#include "dbase/DPreparedStatement.hxx"
-#include "dbase/DStatement.hxx"
-#include <tools/debug.hxx>
-#include <connectivity/dbexception.hxx>
-
-using namespace connectivity::dbase;
-using namespace connectivity::file;
-
-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;
-
-DBG_NAME(ODbaseConnection)
-// --------------------------------------------------------------------------------
-ODbaseConnection::ODbaseConnection(ODriver* _pDriver) : OConnection(_pDriver)
-{
- DBG_CTOR(ODbaseConnection,NULL);
- m_aFilenameExtension = String::CreateFromAscii("dbf");
-}
-//-----------------------------------------------------------------------------
-ODbaseConnection::~ODbaseConnection()
-{
- DBG_DTOR(ODbaseConnection,NULL);
-}
-
-// XServiceInfo
-// --------------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(ODbaseConnection, "com.sun.star.sdbc.drivers.dbase.Connection", "com.sun.star.sdbc.Connection")
-
-// --------------------------------------------------------------------------------
-Reference< XDatabaseMetaData > SAL_CALL ODbaseConnection::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
- if(!xMetaData.is())
- {
- xMetaData = new ODbaseDatabaseMetaData(this);
- m_xMetaData = xMetaData;
- }
-
- return xMetaData;
-}
-//------------------------------------------------------------------------------
-::com::sun::star::uno::Reference< XTablesSupplier > ODbaseConnection::createCatalog()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- Reference< XTablesSupplier > xTab = m_xCatalog;
- if(!xTab.is())
- {
- ODbaseCatalog *pCat = new ODbaseCatalog(this);
- xTab = pCat;
- m_xCatalog = xTab;
- }
- return xTab;
-}
-// --------------------------------------------------------------------------------
-Reference< XStatement > SAL_CALL ODbaseConnection::createStatement( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- Reference< XStatement > xReturn = new ODbaseStatement(this);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
- return xReturn;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL ODbaseConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- ODbasePreparedStatement* pStmt = new ODbasePreparedStatement(this);
- Reference< XPreparedStatement > xHoldAlive = pStmt;
- pStmt->construct(sql);
- m_aStatements.push_back(WeakReferenceHelper(*pStmt));
- return pStmt;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL ODbaseConnection::prepareCall( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::prepareCall", *this );
- return NULL;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
deleted file mode 100644
index 004875c606..0000000000
--- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
+++ /dev/null
@@ -1,415 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-
-#include "dbase/DDatabaseMetaData.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
-#include <tools/urlobj.hxx>
-#include "FDatabaseMetaDataResultSet.hxx"
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include "dbase/DIndex.hxx"
-#include "connectivity/FValue.hxx"
-#include <comphelper/extract.hxx>
-#include <comphelper/types.hxx>
-#include <ucbhelper/content.hxx>
-#include <rtl/logfile.hxx>
-
-using namespace ::comphelper;
-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;
-using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::lang;
-
-ODbaseDatabaseMetaData::ODbaseDatabaseMetaData(::connectivity::file::OConnection* _pCon) :ODatabaseMetaData(_pCon)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::ODbaseDatabaseMetaData" );
-}
-// -------------------------------------------------------------------------
-ODbaseDatabaseMetaData::~ODbaseDatabaseMetaData()
-{
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > ODbaseDatabaseMetaData::impl_getTypeInfo_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::impl_getTypeInfo_throw" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
- Reference< XResultSet > xRef = pResult;
-
- static ODatabaseMetaDataResultSet::ORows aRows;
- if(aRows.empty())
- {
- ODatabaseMetaDataResultSet::ORow aRow;
- aRow.reserve(18);
-
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"))));
- aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR));
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)254));
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("length"))));
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::FULL));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("C"))));
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)10));
-
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONGVARCHAR")));
- aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)2147483647);
- aRow[6] = new ORowSetValueDecorator();
- aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("M")));
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATE")));
- aRow[2] = new ORowSetValueDecorator(DataType::DATE);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)10);
- aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("D")));
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BOOLEAN")));
- aRow[2] = new ORowSetValueDecorator(DataType::BIT);
- aRow[3] = ODatabaseMetaDataResultSet::get1Value();
- aRow[4] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[6] = new ORowSetValueDecorator(::rtl::OUString());
- aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
- aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L")));
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOUBLE")));
- aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)8);
- aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("B")));
- aRows.push_back(aRow);
-
- aRow[11] = new ORowSetValueDecorator(sal_True);
- aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Y")));
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")));
- aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
- aRow[11] = new ORowSetValueDecorator(sal_False);
- aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("T")));
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INTEGER")));
- aRow[2] = new ORowSetValueDecorator(DataType::INTEGER);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)10);
- aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("I")));
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL")));
- aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
- aRow[6] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("length,scale")));
- aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("F")));
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NUMERIC")));
- aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)16);
- aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("N")));
- aRow[15] = new ORowSetValueDecorator((sal_Int32)16);
- aRows.push_back(aRow);
- }
-
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern,
- const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getColumns" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- Reference< XTablesSupplier > xTables = m_pConnection->createCatalog();
- if(!xTables.is())
- throw SQLException();
-
- Reference< XNameAccess> xNames = xTables->getTables();
- if(!xNames.is())
- throw SQLException();
-
- ODatabaseMetaDataResultSet::ORows aRows;
- ODatabaseMetaDataResultSet::ORow aRow(19);
-
- aRow[10] = new ORowSetValueDecorator((sal_Int32)10);
- Sequence< ::rtl::OUString> aTabNames(xNames->getElementNames());
- const ::rtl::OUString* pTabBegin = aTabNames.getConstArray();
- const ::rtl::OUString* pTabEnd = pTabBegin + aTabNames.getLength();
- for(;pTabBegin != pTabEnd;++pTabBegin)
- {
- if(match(tableNamePattern,*pTabBegin,'\0'))
- {
- Reference< XColumnsSupplier> xTable;
- ::cppu::extractInterface(xTable,xNames->getByName(*pTabBegin));
- OSL_ENSURE(xTable.is(),"Table not found! Normallya exception had to be thrown here!");
- aRow[3] = new ORowSetValueDecorator(*pTabBegin);
-
- Reference< XNameAccess> xColumns = xTable->getColumns();
- if(!xColumns.is())
- throw SQLException();
-
- Sequence< ::rtl::OUString> aColNames(xColumns->getElementNames());
-
- const ::rtl::OUString* pBegin = aColNames.getConstArray();
- const ::rtl::OUString* pEnd = pBegin + aColNames.getLength();
- Reference< XPropertySet> xColumn;
- for(sal_Int32 i=1;pBegin != pEnd;++pBegin,++i)
- {
- if(match(columnNamePattern,*pBegin,'\0'))
- {
- aRow[4] = new ORowSetValueDecorator(*pBegin);
-
- ::cppu::extractInterface(xColumn,xColumns->getByName(*pBegin));
- 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))));
- aRow[7] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))));
- aRow[9] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))));
- aRow[11] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))));
- aRow[13] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))));
- switch((sal_Int32)aRow[5]->getValue())
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- aRow[16] = new ORowSetValueDecorator((sal_Int32)254);
- break;
- case DataType::LONGVARCHAR:
- aRow[16] = new ORowSetValueDecorator((sal_Int32)65535);
- break;
- default:
- aRow[16] = new ORowSetValueDecorator((sal_Int32)0);
- }
- aRow[17] = new ORowSetValueDecorator(i);
- switch(sal_Int32(aRow[11]->getValue()))
- {
- case ColumnValue::NO_NULLS:
- aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO")));
- break;
- case ColumnValue::NULLABLE:
- aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES")));
- break;
- default:
- aRow[18] = new ORowSetValueDecorator(::rtl::OUString());
- }
- aRows.push_back(aRow);
- }
- }
- }
- }
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
- Reference< XResultSet > xRef = pResult;
- pResult->setRows(aRows);
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo(
- const Any& /*catalog*/, const ::rtl::OUString& /*schema*/, const ::rtl::OUString& table,
- sal_Bool unique, sal_Bool /*approximate*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getIndexInfo" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
- Reference< XTablesSupplier > xTables = m_pConnection->createCatalog();
- if(!xTables.is())
- throw SQLException();
-
- Reference< XNameAccess> xNames = xTables->getTables();
- if(!xNames.is())
- throw SQLException();
-
- ODatabaseMetaDataResultSet::ORows aRows;
- ODatabaseMetaDataResultSet::ORow aRow(14);
-
- aRow[5] = new ORowSetValueDecorator(::rtl::OUString());
- aRow[10] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("A")));
-
- Reference< XIndexesSupplier> xTable;
- ::cppu::extractInterface(xTable,xNames->getByName(table));
- aRow[3] = new ORowSetValueDecorator(table);
- aRow[7] = new ORowSetValueDecorator((sal_Int32)3);
-
- Reference< XNameAccess> xIndexes = xTable->getIndexes();
- if(!xIndexes.is())
- throw SQLException();
-
- Sequence< ::rtl::OUString> aIdxNames(xIndexes->getElementNames());
-
- const ::rtl::OUString* pBegin = aIdxNames.getConstArray();
- const ::rtl::OUString* pEnd = pBegin + aIdxNames.getLength();
- Reference< XPropertySet> xIndex;
- for(;pBegin != pEnd;++pBegin)
- {
- ::cppu::extractInterface(xIndex,xIndexes->getByName(*pBegin));
- 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);
-
- Reference< XUnoTunnel> xTunnel(xIndex,UNO_QUERY);
- if(xTunnel.is())
- {
- ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) );
- if(pIndex)
- {
- aRow[11] = new ORowSetValueDecorator((sal_Int32)pIndex->getHeader().db_maxkeys);
- aRow[12] = new ORowSetValueDecorator((sal_Int32)pIndex->getHeader().db_pagecount);
- }
- }
-
- Reference<XColumnsSupplier> xColumnsSup(xIndex,UNO_QUERY);
- Reference< XNameAccess> xColumns = xColumnsSup->getColumns();
- Sequence< ::rtl::OUString> aColNames(xColumns->getElementNames());
-
- const ::rtl::OUString* pColBegin = aColNames.getConstArray();
- const ::rtl::OUString* pColEnd = pColBegin + aColNames.getLength();
- Reference< XPropertySet> xColumn;
- for(sal_Int32 j=1;pColBegin != pColEnd;++pColBegin,++j)
- {
- aRow[8] = new ORowSetValueDecorator(j);
- aRow[9] = new ORowSetValueDecorator(*pColBegin);
- aRows.push_back(aRow);
- }
- }
-
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eIndexInfo);
- Reference< XResultSet > xRef = pResult;
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODbaseDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getURL" );
- ::osl::MutexGuard aGuard( m_aMutex );
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:dbase:")) + m_pConnection->getURL();
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getMaxBinaryLiteralLength" );
- return STRING_MAXLEN;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getMaxCharLiteralLength" );
- return 254;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getMaxColumnNameLength" );
- return 10;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getMaxColumnsInIndex" );
- return 1;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getMaxColumnsInTable" );
- return 128;
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL ODbaseDatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::supportsAlterTableWithAddColumn" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODbaseDatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::supportsAlterTableWithDropColumn" );
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL ODbaseDatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::isReadOnly" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
- sal_Bool bReadOnly = sal_False;
- static ::rtl::OUString sReadOnly( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ));
- ::ucbhelper::Content aFile(m_pConnection->getContent(),Reference< XCommandEnvironment >());
- aFile.getPropertyValue(sReadOnly) >>= bReadOnly;
-
- return bReadOnly;
-}
-// -----------------------------------------------------------------------------
-sal_Bool ODbaseDatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw" );
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-sal_Bool ODbaseDatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw" );
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DDriver.cxx b/connectivity/source/drivers/dbase/DDriver.cxx
deleted file mode 100644
index 27b802c53f..0000000000
--- a/connectivity/source/drivers/dbase/DDriver.cxx
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "dbase/DDriver.hxx"
-#include "dbase/DConnection.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "connectivity/dbexception.hxx"
-#include "resource/dbase_res.hrc"
-
-using namespace connectivity::dbase;
-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;
-
-
-// static ServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString ODriver::getImplementationName_Static( ) throw(RuntimeException)
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sdbc.dbase.ODriver"));
-}
-
-//------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException)
-{
- return getImplementationName_Static();
-}
-
-//------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::dbase::ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
-{
- return *(new ODriver(_rxFactory));
-}
-// --------------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if (ODriver_BASE::rBHelper.bDisposed)
- throw DisposedException();
-
- if ( ! acceptsURL(url) )
- return NULL;
-
- ODbaseConnection* pCon = new ODbaseConnection(this);
- pCon->construct(url,info);
- Reference< XConnection > xCon = pCon;
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
-
- return xCon;
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException)
-{
- return !url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:dbase:")),11);
-}
-// -----------------------------------------------------------------------------
-Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException)
-{
- if ( acceptsURL(url) )
- {
- ::std::vector< DriverPropertyInfo > aDriverInfo;
-
- Sequence< ::rtl::OUString > aBoolean(2);
- aBoolean[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"));
- aBoolean[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1"));
-
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet of the database."))
- ,sal_False
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowDeleted"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Display inactive records."))
- ,sal_False
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"))
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EnableSQL92Check"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Use SQL92 naming constraints."))
- ,sal_False
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"))
- ,aBoolean)
- );
- return Sequence< DriverPropertyInfo >(&(aDriverInfo[0]),aDriverInfo.size());
- }
-
- SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- return Sequence< DriverPropertyInfo >();
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx
deleted file mode 100644
index 9dbae67acb..0000000000
--- a/connectivity/source/drivers/dbase/DIndex.cxx
+++ /dev/null
@@ -1,645 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "dbase/DIndex.hxx"
-#include "dbase/DIndexColumns.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "connectivity/sdbcx/VColumn.hxx"
-#include <comphelper/sequence.hxx>
-#include "dbase/DTable.hxx"
-#include "dbase/DIndexIter.hxx"
-#include <tools/config.hxx>
-#include "connectivity/CommonTools.hxx"
-#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbcx/XRowLocate.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <comphelper/extract.hxx>
-#include <unotools/localfilehelper.hxx>
-#include <unotools/ucbhelper.hxx>
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-#include "dbase/DResultSet.hxx"
-#include "diagnose_ex.h"
-#include <comphelper/types.hxx>
-#include "resource/dbase_res.hrc"
-#include <unotools/sharedunocomponent.hxx>
-
-using namespace ::comphelper;
-// -------------------------------------------------------------------------
-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");
-// -------------------------------------------------------------------------
-ODbaseIndex::ODbaseIndex(ODbaseTable* _pTable) : OIndex(sal_True/*_pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers()*/)
- ,m_pFileStream(NULL)
- ,m_nCurNode(NODE_NOTFOUND)
- ,m_pTable(_pTable)
-{
- m_aHeader.db_pagecount = m_aHeader.db_rootpage = m_aHeader.db_keytype = m_aHeader.db_maxkeys = m_aHeader.db_keylen = 0;
- m_aHeader.db_name[0] = '\0';
- construct();
-}
-// -------------------------------------------------------------------------
-ODbaseIndex::ODbaseIndex( ODbaseTable* _pTable,
- const NDXHeader& _rHeader,
- const ::rtl::OUString& _rName)
- :OIndex(_rName,::rtl::OUString(),_rHeader.db_unique,sal_False,sal_False,sal_True)
- ,m_pFileStream(NULL)
- ,m_aHeader(_rHeader)
- ,m_nCurNode(NODE_NOTFOUND)
- ,m_pTable(_pTable)
-{
- construct();
-}
-// -----------------------------------------------------------------------------
-ODbaseIndex::~ODbaseIndex()
-{
- closeImpl();
-}
-// -------------------------------------------------------------------------
-void ODbaseIndex::refreshColumns()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- TStringVector aVector;
- if(!isNew())
- {
- OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
- OSL_ENSURE(m_aHeader.db_name[0] != '\0',"Invalid name for the column!");
- aVector.push_back(::rtl::OUString::createFromAscii(m_aHeader.db_name));
- }
-
- if(m_pColumns)
- m_pColumns->reFill(aVector);
- else
- m_pColumns = new ODbaseIndexColumns(this,m_aMutex,aVector);
-}
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > ODbaseIndex::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 ODbaseIndex::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : ODbaseIndex_BASE::getSomething(rId);
-}
-//------------------------------------------------------------------
-ONDXPagePtr ODbaseIndex::getRoot()
-{
- openIndexFile();
- if (!m_aRoot.Is())
- {
- m_nRootPage = m_aHeader.db_rootpage;
- m_nPageCount = m_aHeader.db_pagecount;
- m_aRoot = CreatePage(m_nRootPage,NULL,sal_True);
- }
- return m_aRoot;
-}
-//------------------------------------------------------------------
-sal_Bool ODbaseIndex::openIndexFile()
-{
- if(!m_pFileStream)
- {
- ::rtl::OUString sFile = getCompletePath();
- if(UCBContentHelper::Exists(sFile))
- {
- m_pFileStream = OFileTable::createStream_simpleError(sFile, STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE);
- if (!m_pFileStream)
- m_pFileStream = OFileTable::createStream_simpleError(sFile,STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYNONE);
- if(m_pFileStream)
- {
- m_pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
- m_pFileStream->SetBufferSize(PAGE_SIZE);
- (*m_pFileStream) >> *this;
- }
- }
- if(!m_pFileStream)
- {
- const ::rtl::OUString sError( m_pTable->getConnection()->getResources().getResourceStringWithSubstitution(
- STR_COULD_NOT_LOAD_FILE,
- "$filename$", sFile
- ) );
- ::dbtools::throwGenericSQLException( sError, *this );
- }
- }
-
- return m_pFileStream != NULL;
-}
-//------------------------------------------------------------------
-OIndexIterator* ODbaseIndex::createIterator(OBoolOperator* pOp,
- const OOperand* pOperand)
-{
- openIndexFile();
- return new OIndexIterator(this, pOp, pOperand);
-}
-//------------------------------------------------------------------
-sal_Bool ODbaseIndex::ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const ORowSetValue& rValue)
-{
- OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
- // Search a specific value in Index
- // If the Index is unique, the key doesn't matter
- try
- {
- if (m_aHeader.db_keytype == 0)
- {
- *rKey = ONDXKey(rValue.getString(), nRec );
- }
- else
- {
- if (rValue.isNull())
- *rKey = ONDXKey(rValue.getDouble(), DataType::DOUBLE, nRec );
- else
- *rKey = ONDXKey(rValue.getDouble(), nRec );
- }
- }
- catch (Exception&)
- {
- OSL_ASSERT(0);
- return sal_False;
- }
- return sal_True;
-}
-
-//------------------------------------------------------------------
-sal_Bool ODbaseIndex::Find(sal_uInt32 nRec, const ORowSetValue& rValue)
-{
- openIndexFile();
- OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
- // Search a specific value in Index
- // If the Index is unique, the key doesn't matter
- ONDXKey aKey;
- return ConvertToKey(&aKey, nRec, rValue) && getRoot()->Find(aKey);
-}
-
-//------------------------------------------------------------------
-sal_Bool ODbaseIndex::Insert(sal_uInt32 nRec, const ORowSetValue& rValue)
-{
- openIndexFile();
- OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
- ONDXKey aKey;
-
- // Does the value already exist
- // Use Find() always to determine the actual leaf
- if (!ConvertToKey(&aKey, nRec, rValue) || (getRoot()->Find(aKey) && isUnique()))
- return sal_False;
-
- ONDXNode aNewNode(aKey);
-
- // insert in the current leaf
- if (!m_aCurLeaf.Is())
- return sal_False;
-
- sal_Bool bResult = m_aCurLeaf->Insert(aNewNode);
- Release(bResult);
-
- return bResult;
-}
-
-//------------------------------------------------------------------
-sal_Bool ODbaseIndex::Update(sal_uInt32 nRec, const ORowSetValue& rOldValue,
- const ORowSetValue& rNewValue)
-{
- openIndexFile();
- OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
- ONDXKey aKey;
- if (!ConvertToKey(&aKey, nRec, rNewValue) || (isUnique() && getRoot()->Find(aKey)))
- return sal_False;
- else
- return Delete(nRec, rOldValue) && Insert(nRec,rNewValue);
-}
-
-//------------------------------------------------------------------
-sal_Bool ODbaseIndex::Delete(sal_uInt32 nRec, const ORowSetValue& rValue)
-{
- openIndexFile();
- OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
- // Does the value already exist
- // Always use Find() to determine the actual leaf
- ONDXKey aKey;
- if (!ConvertToKey(&aKey, nRec, rValue) || !getRoot()->Find(aKey))
- return sal_False;
-
- ONDXNode aNewNode(aKey);
-
- // insert in the current leaf
- if (!m_aCurLeaf.Is())
- return sal_False;
-#if OSL_DEBUG_LEVEL > 1
- m_aRoot->PrintPage();
-#endif
-
- return m_aCurLeaf->Delete(m_nCurNode);
-}
-//------------------------------------------------------------------
-void ODbaseIndex::Collect(ONDXPage* pPage)
-{
- if (pPage)
- m_aCollector.push_back(pPage);
-}
-//------------------------------------------------------------------
-void ODbaseIndex::Release(sal_Bool bSave)
-{
- // Release the Index-recources
- m_bUseCollector = sal_False;
-
- if (m_aCurLeaf.Is())
- {
- m_aCurLeaf->Release(bSave);
- m_aCurLeaf.Clear();
- }
-
- // Release the root
- if (m_aRoot.Is())
- {
- m_aRoot->Release(bSave);
- m_aRoot.Clear();
- }
- // Release all references, before the FileStream will be closed
- for (sal_uIntPtr i = 0; i < m_aCollector.size(); i++)
- m_aCollector[i]->QueryDelete();
-
- m_aCollector.clear();
-
- // Header modified?
- if (bSave && (m_aHeader.db_rootpage != m_nRootPage ||
- m_aHeader.db_pagecount != m_nPageCount))
- {
- m_aHeader.db_rootpage = m_nRootPage;
- m_aHeader.db_pagecount = m_nPageCount;
- (*m_pFileStream) << *this;
- }
- m_nRootPage = m_nPageCount = 0;
- m_nCurNode = NODE_NOTFOUND;
-
- closeImpl();
-}
-// -----------------------------------------------------------------------------
-void ODbaseIndex::closeImpl()
-{
- if(m_pFileStream)
- {
- delete m_pFileStream;
- m_pFileStream = NULL;
- }
-}
-//------------------------------------------------------------------
-ONDXPage* ODbaseIndex::CreatePage(sal_uInt32 nPagePos, ONDXPage* pParent, sal_Bool bLoad)
-{
- OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
-
- ONDXPage* pPage;
- if ( !m_aCollector.empty() )
- {
- pPage = *(m_aCollector.rbegin());
- m_aCollector.pop_back();
- pPage->SetPagePos(nPagePos);
- pPage->SetParent(pParent);
- }
- else
- pPage = new ONDXPage(*this, nPagePos, pParent);
-
- if (bLoad)
- (*m_pFileStream) >> *pPage;
-
- return pPage;
-}
-
-//------------------------------------------------------------------
-SvStream& connectivity::dbase::operator >> (SvStream &rStream, ODbaseIndex& rIndex)
-{
- rStream.Seek(0);
- rStream.Read(&rIndex.m_aHeader,PAGE_SIZE);
-
- rIndex.m_nRootPage = rIndex.m_aHeader.db_rootpage;
- rIndex.m_nPageCount = rIndex.m_aHeader.db_pagecount;
- return rStream;
-}
-//------------------------------------------------------------------
-SvStream& connectivity::dbase::operator << (SvStream &rStream, ODbaseIndex& rIndex)
-{
- rStream.Seek(0);
- OSL_VERIFY_EQUALS( rStream.Write(&rIndex.m_aHeader,PAGE_SIZE), PAGE_SIZE, "Write not successful: Wrong header size for dbase index!");
- return rStream;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString ODbaseIndex::getCompletePath()
-{
- ::rtl::OUString sDir = m_pTable->getConnection()->getURL();
- sDir += OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER);
- sDir += m_Name;
- sDir += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".ndx"));
- return sDir;
-}
-//------------------------------------------------------------------
-void ODbaseIndex::createINFEntry()
-{
- // synchronize inf-file
- String sEntry = m_Name;
- sEntry += String::CreateFromAscii(".ndx");
-
- ::rtl::OUString sCfgFile(m_pTable->getConnection()->getURL());
- sCfgFile += OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER);
- sCfgFile += m_pTable->getName();
- sCfgFile += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".inf"));
-
- String sPhysicalPath;
- LocalFileHelper::ConvertURLToPhysicalName(sCfgFile,sPhysicalPath);
-
- Config aInfFile(sPhysicalPath);
- aInfFile.SetGroup(dBASE_III_GROUP);
-
- sal_uInt16 nSuffix = aInfFile.GetKeyCount();
- rtl::OString aNewEntry,aKeyName;
- sal_Bool bCase = isCaseSensitive();
- while (aNewEntry.isEmpty())
- {
- aNewEntry = rtl::OString(RTL_CONSTASCII_STRINGPARAM("NDX"));
- aNewEntry += rtl::OString::valueOf(static_cast<sal_Int32>(++nSuffix));
- for (sal_uInt16 i = 0; i < aInfFile.GetKeyCount(); i++)
- {
- aKeyName = aInfFile.GetKeyName(i);
- if (bCase ? aKeyName.equals(aNewEntry) : aKeyName.equalsIgnoreAsciiCase(aNewEntry))
- {
- aNewEntry = rtl::OString();
- break;
- }
- }
- }
- aInfFile.WriteKey(aNewEntry,ByteString(sEntry,m_pTable->getConnection()->getTextEncoding()));
-}
-// -------------------------------------------------------------------------
-sal_Bool ODbaseIndex::DropImpl()
-{
- closeImpl();
-
- ::rtl::OUString sPath = getCompletePath();
- if(UCBContentHelper::Exists(sPath))
- {
- if(!UCBContentHelper::Kill(sPath))
- m_pTable->getConnection()->throwGenericSQLException(STR_COULD_NOT_DELETE_INDEX,*m_pTable);
- }
-
- // synchronize inf-file
- ::rtl::OUString sCfgFile(m_pTable->getConnection()->getURL());
- sCfgFile += OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER);
- sCfgFile += m_pTable->getName();
- sCfgFile += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".inf"));
-
- String sPhysicalPath;
- String sNDX(sCfgFile);
- OSL_VERIFY_RES( LocalFileHelper::ConvertURLToPhysicalName(sNDX,sPhysicalPath),"Can not convert Config Filename into Physical Name!");
-
- Config aInfFile(sPhysicalPath);
- aInfFile.SetGroup(dBASE_III_GROUP);
- sal_uInt16 nKeyCnt = aInfFile.GetKeyCount();
- ByteString aKeyName;
- String sEntry = m_Name;
- sEntry += String::CreateFromAscii(".ndx");
-
- // delete entries from the inf file
- for (sal_uInt16 nKey = 0; nKey < nKeyCnt; nKey++)
- {
- // References the Key to an Index-file?
- aKeyName = aInfFile.GetKeyName( nKey );
- if (aKeyName.Copy(0,3) == "NDX")
- {
- if(sEntry == String(aInfFile.ReadKey(aKeyName),m_pTable->getConnection()->getTextEncoding()))
- {
- aInfFile.DeleteKey(aKeyName);
- break;
- }
- }
- }
- return sal_True;
-}
-// -------------------------------------------------------------------------
-void ODbaseIndex::impl_killFileAndthrowError_throw(sal_uInt16 _nErrorId,const ::rtl::OUString& _sFile)
-{
- closeImpl();
- if(UCBContentHelper::Exists(_sFile))
- UCBContentHelper::Kill(_sFile);
- m_pTable->getConnection()->throwGenericSQLException(_nErrorId,*this);
-}
-//------------------------------------------------------------------
-sal_Bool ODbaseIndex::CreateImpl()
-{
- // Create the Index
- const ::rtl::OUString sFile = getCompletePath();
- if(UCBContentHelper::Exists(sFile))
- {
- const ::rtl::OUString sError( m_pTable->getConnection()->getResources().getResourceStringWithSubstitution(
- STR_COULD_NOT_CREATE_INDEX_NAME,
- "$filename$", sFile
- ) );
- ::dbtools::throwGenericSQLException( sError, *this );
- }
- // Index comprises only one column
- if (m_pColumns->getCount() > 1)
- m_pTable->getConnection()->throwGenericSQLException(STR_ONL_ONE_COLUMN_PER_INDEX,*this);
-
- Reference<XFastPropertySet> xCol(m_pColumns->getByIndex(0),UNO_QUERY);
-
- // Is the column already indexed?
- if ( !xCol.is() )
- ::dbtools::throwFunctionSequenceException(*this);
-
- // create the index file
- m_pFileStream = OFileTable::createStream_simpleError(sFile,STREAM_READWRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC);
- if (!m_pFileStream)
- {
- const ::rtl::OUString sError( m_pTable->getConnection()->getResources().getResourceStringWithSubstitution(
- STR_COULD_NOT_LOAD_FILE,
- "$filename$", sFile
- ) );
- ::dbtools::throwGenericSQLException( sError, *this );
- }
-
- m_pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
- m_pFileStream->SetBufferSize(PAGE_SIZE);
-
- // firstly the result must be sorted
- utl::SharedUNOComponent<XStatement> xStmt;
- utl::SharedUNOComponent<XResultSet> xSet;
- String aName;
- try
- {
- xStmt.set( m_pTable->getConnection()->createStatement(), UNO_SET_THROW);
-
- aName = getString(xCol->getFastPropertyValue(PROPERTY_ID_NAME));
-
- const String aQuote(m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString());
- String aStatement;
- aStatement.AssignAscii("SELECT ");
- aStatement += aQuote;
- aStatement += aName;
- aStatement += aQuote;
- aStatement.AppendAscii(" FROM ");
- aStatement += aQuote;
- aStatement += m_pTable->getName().getStr();
- aStatement += aQuote;
- aStatement.AppendAscii(" ORDER BY ");
- aStatement += aQuote;
- aStatement += aName;
- aStatement += aQuote;
-
- xSet.set( xStmt->executeQuery(aStatement),UNO_SET_THROW );
- }
- catch(const Exception& )
- {
- impl_killFileAndthrowError_throw(STR_COULD_NOT_CREATE_INDEX,sFile);
- }
- if (!xSet.is())
- {
- impl_killFileAndthrowError_throw(STR_COULD_NOT_CREATE_INDEX,sFile);
- }
-
- // Set the header info
- memset(&m_aHeader,0,sizeof(m_aHeader));
- sal_Int32 nType = 0;
- ::rtl::Reference<OSQLColumns> aCols = m_pTable->getTableColumns();
- const Reference< XPropertySet > xTableCol(*find(aCols->get().begin(),aCols->get().end(),aName,::comphelper::UStringMixEqual(isCaseSensitive())));
-
- xTableCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nType;
-
- m_aHeader.db_keytype = (nType == DataType::VARCHAR || nType == DataType::CHAR) ? 0 : 1;
- m_aHeader.db_keylen = (m_aHeader.db_keytype) ? 8 : (sal_uInt16)getINT32(xTableCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)));
- m_aHeader.db_keylen = (( m_aHeader.db_keylen - 1) / 4 + 1) * 4;
- m_aHeader.db_maxkeys = (PAGE_SIZE - 4) / (8 + m_aHeader.db_keylen);
- if ( m_aHeader.db_maxkeys < 3 )
- {
- impl_killFileAndthrowError_throw(STR_COULD_NOT_CREATE_INDEX_KEYSIZE,sFile);
- }
-
- m_pFileStream->SetStreamSize(PAGE_SIZE);
-
- ByteString aCol(aName,m_pTable->getConnection()->getTextEncoding());
- strncpy(m_aHeader.db_name,aCol.GetBuffer(),std::min((sal_uInt16)sizeof(m_aHeader.db_name), aCol.Len()));
- m_aHeader.db_unique = m_IsUnique ? 1: 0;
- m_aHeader.db_keyrec = m_aHeader.db_keylen + 8;
-
- // modifications of the header are detected by differences between
- // the HeaderInfo and nRootPage or nPageCount respectively
- m_nRootPage = 1;
- m_nPageCount = 2;
-
- m_aCurLeaf = m_aRoot = CreatePage(m_nRootPage);
- m_aRoot->SetModified(sal_True);
-
- m_bUseCollector = sal_True;
-
- sal_Int32 nRowsLeft = 0;
- Reference<XRow> xRow(xSet,UNO_QUERY);
-
- if(xSet->last())
- {
- Reference< XUnoTunnel> xTunnel(xSet,UNO_QUERY);
- ODbaseResultSet* pDbaseRes = NULL;
- if(xTunnel.is())
- pDbaseRes = reinterpret_cast< ODbaseResultSet* >( xTunnel->getSomething(ODbaseResultSet::getUnoTunnelImplementationId()) );
- OSL_ENSURE(pDbaseRes,"No dbase resultset found? What's going on here!");
- Reference<XRowLocate> xRowLocate(xSet,UNO_QUERY);
- nRowsLeft = xSet->getRow();
-
- xSet->beforeFirst();
- ORowSetValue atmpValue=ORowSetValue();
- ONDXKey aKey(atmpValue, nType, 0);
- ONDXKey aInsertKey(atmpValue, nType, 0);
- // Create the index structure
- while (xSet->next())
- {
- ORowSetValue aValue(m_aHeader.db_keytype ? ORowSetValue(xRow->getDouble(1)) : ORowSetValue(xRow->getString(1)));
- // checking for duplicate entries
- if (m_IsUnique && m_nCurNode != NODE_NOTFOUND)
- {
- aKey.setValue(aValue);
- if (aKey == (*m_aCurLeaf)[m_nCurNode].GetKey())
- {
- impl_killFileAndthrowError_throw(STR_COULD_NOT_CREATE_INDEX_NOT_UNIQUE,sFile);
- }
- }
- aInsertKey.setValue(aValue);
- aInsertKey.setRecord(pDbaseRes->getCurrentFilePos());
-
- ONDXNode aNewNode(aInsertKey);
- if (!m_aCurLeaf->Insert(aNewNode, --nRowsLeft))
- break;
- }
- }
-
- if(nRowsLeft)
- {
- impl_killFileAndthrowError_throw(STR_COULD_NOT_CREATE_INDEX,sFile);
- }
- Release();
- createINFEntry();
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-void SAL_CALL ODbaseIndex::acquire() throw()
-{
- ODbaseIndex_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL ODbaseIndex::release() throw()
-{
- ODbaseIndex_BASE::release();
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DIndexColumns.cxx b/connectivity/source/drivers/dbase/DIndexColumns.cxx
deleted file mode 100644
index b2f22c7e96..0000000000
--- a/connectivity/source/drivers/dbase/DIndexColumns.cxx
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "dbase/DIndexColumns.hxx"
-#include "dbase/DTable.hxx"
-#include "connectivity/sdbcx/VIndexColumn.hxx"
-#include <comphelper/types.hxx>
-#include <comphelper/property.hxx>
-#include <connectivity/dbexception.hxx>
-
-using namespace ::comphelper;
-
-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 ::rtl::OUString& _rName)
-{
- const ODbaseTable* pTable = m_pIndex->getTable();
-
- ::rtl::Reference<OSQLColumns> aCols = pTable->getTableColumns();
- OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
-
- Reference< XPropertySet > xCol;
- if(aIter != aCols->get().end())
- xCol = *aIter;
-
- if(!xCol.is())
- return sdbcx::ObjectType();
-
- sdbcx::ObjectType xRet = new sdbcx::OIndexColumn(sal_True,_rName
- ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))
- ,::rtl::OUString()
- ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)))
- ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))
- ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))
- ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))
- ,sal_False
- ,sal_False
- ,sal_False
- ,pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers());
-
- return xRet;
-}
-
-// -------------------------------------------------------------------------
-void ODbaseIndexColumns::impl_refresh() throw(RuntimeException)
-{
- m_pIndex->refreshColumns();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > ODbaseIndexColumns::createDescriptor()
-{
- return new sdbcx::OIndexColumn(m_pIndex->getTable()->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers());
-}
-// -------------------------------------------------------------------------
-sdbcx::ObjectType ODbaseIndexColumns::appendObject( const ::rtl::OUString& /*_rForName*/, const Reference< XPropertySet >& descriptor )
-{
- return cloneDescriptor( descriptor );
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DIndexIter.cxx b/connectivity/source/drivers/dbase/DIndexIter.cxx
deleted file mode 100644
index ed3020ba12..0000000000
--- a/connectivity/source/drivers/dbase/DIndexIter.cxx
+++ /dev/null
@@ -1,306 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "dbase/DIndexIter.hxx"
-#include <com/sun/star/sdb/SQLFilterOperator.hpp>
-
-using namespace ::com::sun::star::sdb;
-using namespace connectivity;
-using namespace connectivity::dbase;
-using namespace connectivity::file;
-using namespace ::com::sun::star::sdb;
-//==================================================================
-// OIndexIterator
-//==================================================================
-//------------------------------------------------------------------
-OIndexIterator::~OIndexIterator()
-{
- m_pIndex->release();
-}
-
-//------------------------------------------------------------------
-sal_uIntPtr OIndexIterator::First()
-{
- return Find(sal_True);
-}
-
-//------------------------------------------------------------------
-sal_uIntPtr OIndexIterator::Next()
-{
- return Find(sal_False);
-}
-//------------------------------------------------------------------
-sal_uIntPtr OIndexIterator::Find(sal_Bool bFirst)
-{
- sal_uIntPtr nRes = STRING_NOTFOUND;
-
- if (bFirst)
- {
- m_aRoot = m_pIndex->getRoot();
- m_aCurLeaf = NULL;
- }
-
- if (!m_pOperator)
- {
- // Preparation, position on the smallest element
- if (bFirst)
- {
- ONDXPage* pPage = m_aRoot;
- while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_pIndex);
-
- m_aCurLeaf = pPage;
- m_nCurNode = NODE_NOTFOUND;
- }
- ONDXKey* pKey = GetNextKey();
- nRes = pKey ? pKey->GetRecord() : STRING_NOTFOUND;
- }
- else if (m_pOperator->IsA(TYPE(OOp_ISNOTNULL)))
- nRes = GetNotNull(bFirst);
- else if (m_pOperator->IsA(TYPE(OOp_ISNULL)))
- nRes = GetNull(bFirst);
- else if (m_pOperator->IsA(TYPE(OOp_LIKE)))
- nRes = GetLike(bFirst);
- else if (m_pOperator->IsA(TYPE(OOp_COMPARE)))
- nRes = GetCompare(bFirst);
-
- return nRes;
-}
-
-//------------------------------------------------------------------
-ONDXKey* OIndexIterator::GetFirstKey(ONDXPage* pPage, const OOperand& rKey)
-{
- // searches a given key
- // Speciality: At the end of the algorithm
- // the actual page and the position of the node which fulfil the
- // '<='-condition are saved. this is considered for inserts.
- // ONDXIndex* m_pIndex = GetNDXIndex();
- OOp_COMPARE aTempOp(SQLFilterOperator::GREATER);
- sal_uInt16 i = 0;
-
- if (pPage->IsLeaf())
- {
- // in the leaf the actual operation is run, otherwise temp. (>)
- while (i < pPage->Count() && !m_pOperator->operate(&((*pPage)[i]).GetKey(),&rKey))
- i++;
- }
- else
- while (i < pPage->Count() && !aTempOp.operate(&((*pPage)[i]).GetKey(),&rKey))
- i++;
-
-
- ONDXKey* pFoundKey = NULL;
- if (!pPage->IsLeaf())
- {
- // descend further
- ONDXPagePtr aPage = (i==0) ? pPage->GetChild(m_pIndex)
- : ((*pPage)[i-1]).GetChild(m_pIndex, pPage);
- pFoundKey = aPage.Is() ? GetFirstKey(aPage, rKey) : NULL;
- }
- else if (i == pPage->Count())
- {
- pFoundKey = NULL;
- }
- else
- {
- pFoundKey = &(*pPage)[i].GetKey();
- if (!m_pOperator->operate(pFoundKey,&rKey))
- pFoundKey = NULL;
-
- m_aCurLeaf = pPage;
- m_nCurNode = pFoundKey ? i : i - 1;
- }
- return pFoundKey;
-}
-
-//------------------------------------------------------------------
-sal_uIntPtr OIndexIterator::GetCompare(sal_Bool bFirst)
-{
- ONDXKey* pKey = NULL;
- sal_Int32 ePredicateType = PTR_CAST(file::OOp_COMPARE,m_pOperator)->getPredicateType();
-
- if (bFirst)
- {
- // Preparation, position on the smallest element
- ONDXPage* pPage = m_aRoot;
- switch (ePredicateType)
- {
- case SQLFilterOperator::NOT_EQUAL:
- case SQLFilterOperator::LESS:
- case SQLFilterOperator::LESS_EQUAL:
- while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_pIndex);
-
- m_aCurLeaf = pPage;
- m_nCurNode = NODE_NOTFOUND;
- }
-
-
- switch (ePredicateType)
- {
- case SQLFilterOperator::NOT_EQUAL:
- while ( ( ( pKey = GetNextKey() ) != NULL ) && !m_pOperator->operate(pKey,m_pOperand)) ;
- break;
- case SQLFilterOperator::LESS:
- while ( ( ( pKey = GetNextKey() ) != NULL ) && pKey->getValue().isNull()) ;
- break;
- case SQLFilterOperator::LESS_EQUAL:
- while ( ( pKey = GetNextKey() ) != NULL ) ;
- break;
- case SQLFilterOperator::GREATER_EQUAL:
- case SQLFilterOperator::EQUAL:
- pKey = GetFirstKey(m_aRoot,*m_pOperand);
- break;
- case SQLFilterOperator::GREATER:
- pKey = GetFirstKey(m_aRoot,*m_pOperand);
- if ( !pKey )
- while ( ( ( pKey = GetNextKey() ) != NULL ) && !m_pOperator->operate(pKey,m_pOperand)) ;
- }
- }
- else
- {
- switch (ePredicateType)
- {
- case SQLFilterOperator::NOT_EQUAL:
- while ( ( ( pKey = GetNextKey() ) != NULL ) && !m_pOperator->operate(pKey,m_pOperand))
- ;
- break;
- case SQLFilterOperator::LESS:
- case SQLFilterOperator::LESS_EQUAL:
- case SQLFilterOperator::EQUAL:
- if ( ( ( pKey = GetNextKey() ) == NULL ) || !m_pOperator->operate(pKey,m_pOperand))
- {
- pKey = NULL;
- m_aCurLeaf = NULL;
- }
- break;
- case SQLFilterOperator::GREATER_EQUAL:
- case SQLFilterOperator::GREATER:
- pKey = GetNextKey();
- }
- }
-
- return pKey ? pKey->GetRecord() : STRING_NOTFOUND;
-}
-
-//------------------------------------------------------------------
-sal_uIntPtr OIndexIterator::GetLike(sal_Bool bFirst)
-{
- if (bFirst)
- {
- ONDXPage* pPage = m_aRoot;
-
- while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_pIndex);
-
- m_aCurLeaf = pPage;
- m_nCurNode = NODE_NOTFOUND;
- }
-
- ONDXKey* pKey;
- while ( ( ( pKey = GetNextKey() ) != NULL ) && !m_pOperator->operate(pKey,m_pOperand))
- ;
- return pKey ? pKey->GetRecord() : STRING_NOTFOUND;
-}
-
-//------------------------------------------------------------------
-sal_uIntPtr OIndexIterator::GetNull(sal_Bool bFirst)
-{
- if (bFirst)
- {
- ONDXPage* pPage = m_aRoot;
- while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_pIndex);
-
- m_aCurLeaf = pPage;
- m_nCurNode = NODE_NOTFOUND;
- }
-
- ONDXKey* pKey;
- if ( ( ( pKey = GetNextKey() ) == NULL ) || !pKey->getValue().isNull())
- {
- pKey = NULL;
- m_aCurLeaf = NULL;
- }
- return pKey ? pKey->GetRecord() : STRING_NOTFOUND;
-}
-
-//------------------------------------------------------------------
-sal_uIntPtr OIndexIterator::GetNotNull(sal_Bool bFirst)
-{
- ONDXKey* pKey;
- if (bFirst)
- {
- // erst alle NULL werte abklappern
- for (sal_uIntPtr nRec = GetNull(bFirst);
- nRec != STRING_NOTFOUND;
- nRec = GetNull(sal_False))
- ;
- pKey = m_aCurLeaf.Is() ? &(*m_aCurLeaf)[m_nCurNode].GetKey() : NULL;
- }
- else
- pKey = GetNextKey();
-
- return pKey ? pKey->GetRecord() : STRING_NOTFOUND;
-}
-
-//------------------------------------------------------------------
-ONDXKey* OIndexIterator::GetNextKey()
-{
- if (m_aCurLeaf.Is() && ((++m_nCurNode) >= m_aCurLeaf->Count()))
- {
- ONDXPage* pPage = m_aCurLeaf;
- // search next page
- while (pPage)
- {
- ONDXPage* pParentPage = pPage->GetParent();
- if (pParentPage)
- {
- sal_uInt16 nPos = pParentPage->Search(pPage);
- if (nPos != pParentPage->Count() - 1)
- { // page found
- pPage = (*pParentPage)[nPos+1].GetChild(m_pIndex,pParentPage);
- break;
- }
- }
- pPage = pParentPage;
- }
-
- // now go on with leaf
- while (pPage && !pPage->IsLeaf())
- pPage = pPage->GetChild(m_pIndex);
-
- m_aCurLeaf = pPage;
- m_nCurNode = 0;
- }
- return m_aCurLeaf.Is() ? &(*m_aCurLeaf)[m_nCurNode].GetKey() : NULL;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DIndexes.cxx b/connectivity/source/drivers/dbase/DIndexes.cxx
deleted file mode 100644
index b5be60ff22..0000000000
--- a/connectivity/source/drivers/dbase/DIndexes.cxx
+++ /dev/null
@@ -1,136 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "dbase/DIndexes.hxx"
-#include "dbase/DIndex.hxx"
-#include <connectivity/dbexception.hxx>
-#include <unotools/ucbhelper.hxx>
-#include <comphelper/types.hxx>
-#include "resource/dbase_res.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;
-
-namespace starutil = ::com::sun::star::util;
-
-sdbcx::ObjectType ODbaseIndexes::createObject(const ::rtl::OUString& _rName)
-{
- ::rtl::OUString sFile = m_pTable->getConnection()->getURL();
- sFile += OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER);
- sFile += _rName;
- sFile += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".ndx"));
- if ( !UCBContentHelper::Exists(sFile) )
- {
- const ::rtl::OUString sError( m_pTable->getConnection()->getResources().getResourceStringWithSubstitution(
- STR_COULD_NOT_LOAD_FILE,
- "$filename$", sFile
- ) );
- ::dbtools::throwGenericSQLException( sError, *m_pTable );
- }
-
- sdbcx::ObjectType xRet;
- SvStream* pFileStream = ::connectivity::file::OFileTable::createStream_simpleError(sFile,STREAM_READ | STREAM_NOCREATE| STREAM_SHARE_DENYWRITE);
- if(pFileStream)
- {
- pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
- pFileStream->SetBufferSize(PAGE_SIZE);
- ODbaseIndex::NDXHeader aHeader;
-
- pFileStream->Seek(0);
- pFileStream->Read(&aHeader,PAGE_SIZE);
- delete pFileStream;
-
- ODbaseIndex* pIndex = new ODbaseIndex(m_pTable,aHeader,_rName);
- xRet = pIndex;
- pIndex->openIndexFile();
- }
- else
- {
- const ::rtl::OUString sError( m_pTable->getConnection()->getResources().getResourceStringWithSubstitution(
- STR_COULD_NOT_LOAD_FILE,
- "$filename$", sFile
- ) );
- ::dbtools::throwGenericSQLException( sError, *m_pTable );
- }
- return xRet;
-}
-// -------------------------------------------------------------------------
-void ODbaseIndexes::impl_refresh( ) throw(RuntimeException)
-{
- if(m_pTable)
- m_pTable->refreshIndexes();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > ODbaseIndexes::createDescriptor()
-{
- return new ODbaseIndex(m_pTable);
-}
-typedef connectivity::sdbcx::OCollection ODbaseTables_BASE_BASE;
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType ODbaseIndexes::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
- if(xTunnel.is())
- {
- ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) );
- if(!pIndex || !pIndex->CreateImpl())
- throw SQLException();
- }
-
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void ODbaseIndexes::dropObject(sal_Int32 _nPos,const ::rtl::OUString /*_sElementName*/)
-{
- Reference< XUnoTunnel> xTunnel(getObject(_nPos),UNO_QUERY);
- if ( xTunnel.is() )
- {
- ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) );
- if ( pIndex )
- pIndex->DropImpl();
- }
-
-}
-// -------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DNoException.cxx b/connectivity/source/drivers/dbase/DNoException.cxx
deleted file mode 100644
index f1d027211c..0000000000
--- a/connectivity/source/drivers/dbase/DNoException.cxx
+++ /dev/null
@@ -1,623 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "dbase/DTable.hxx"
-#include "dbase/DIndex.hxx"
-#include "dbase/dindexnode.hxx"
-#include <tools/debug.hxx>
-#include "diagnose_ex.h"
-
-#include <sal/types.h>
-#include <algorithm>
-#include <rtl/logfile.hxx>
-
-using namespace connectivity;
-using namespace connectivity::dbase;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::sdbc;
-//------------------------------------------------------------------
-sal_Bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::seekRow" );
- // ----------------------------------------------------------
- // Prepare positioning:
- OSL_ENSURE(m_pFileStream,"ODbaseTable::seekRow: FileStream is NULL!");
-
- sal_uInt32 nNumberOfRecords = (sal_uInt32)m_aHeader.db_anz;
- sal_uInt32 nTempPos = m_nFilePos;
- m_nFilePos = nCurPos;
-
- switch(eCursorPosition)
- {
- case IResultSetHelper::NEXT:
- ++m_nFilePos;
- break;
- case IResultSetHelper::PRIOR:
- if (m_nFilePos > 0)
- --m_nFilePos;
- break;
- case IResultSetHelper::FIRST:
- m_nFilePos = 1;
- break;
- case IResultSetHelper::LAST:
- m_nFilePos = nNumberOfRecords;
- break;
- case IResultSetHelper::RELATIVE:
- m_nFilePos = (((sal_Int32)m_nFilePos) + nOffset < 0) ? 0L
- : (sal_uInt32)(((sal_Int32)m_nFilePos) + nOffset);
- break;
- case IResultSetHelper::ABSOLUTE:
- case IResultSetHelper::BOOKMARK:
- m_nFilePos = (sal_uInt32)nOffset;
- break;
- }
-
- if (m_nFilePos > (sal_Int32)nNumberOfRecords)
- m_nFilePos = (sal_Int32)nNumberOfRecords + 1;
-
- if (m_nFilePos == 0 || m_nFilePos == (sal_Int32)nNumberOfRecords + 1)
- goto Error;
- else
- {
- sal_uInt16 nEntryLen = m_aHeader.db_slng;
-
- OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position");
- sal_Int32 nPos = m_aHeader.db_kopf + (sal_Int32)(m_nFilePos-1) * nEntryLen;
-
- sal_uIntPtr nLen = m_pFileStream->Seek(nPos);
- if (m_pFileStream->GetError() != ERRCODE_NONE)
- goto Error;
-
- nLen = m_pFileStream->Read((char*)m_pBuffer, nEntryLen);
- if (m_pFileStream->GetError() != ERRCODE_NONE)
- goto Error;
- }
- goto End;
-
-Error:
- switch(eCursorPosition)
- {
- case IResultSetHelper::PRIOR:
- case IResultSetHelper::FIRST:
- m_nFilePos = 0;
- break;
- case IResultSetHelper::LAST:
- case IResultSetHelper::NEXT:
- case IResultSetHelper::ABSOLUTE:
- case IResultSetHelper::RELATIVE:
- if (nOffset > 0)
- m_nFilePos = nNumberOfRecords + 1;
- else if (nOffset < 0)
- m_nFilePos = 0;
- break;
- case IResultSetHelper::BOOKMARK:
- m_nFilePos = nTempPos; // last position
- }
- return sal_False;
-
-End:
- nCurPos = m_nFilePos;
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-sal_Bool ODbaseTable::ReadMemo(sal_uIntPtr nBlockNo, ORowSetValue& aVariable)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::ReadMemo" );
- bool bIsText = true;
-
- m_pMemoStream->Seek(nBlockNo * m_aMemoHeader.db_size);
- switch (m_aMemoHeader.db_typ)
- {
- case MemodBaseIII: // dBase III-Memofeld, ends with Ctrl-Z
- {
- const char cEOF = (char) 0x1a;
- ByteString aBStr;
- static char aBuf[514];
- aBuf[512] = 0; // to prevent a random value
- bool bReady = false;
-
- do
- {
- m_pMemoStream->Read(&aBuf,512);
-
- sal_uInt16 i = 0;
- while (aBuf[i] != cEOF && ++i < 512)
- ;
- bReady = aBuf[i] == cEOF;
-
- aBuf[i] = 0;
- aBStr += aBuf;
-
- } while (!bReady && !m_pMemoStream->IsEof() && aBStr.Len() < STRING_MAXLEN);
-
- ::rtl::OUString aStr(aBStr.GetBuffer(), aBStr.Len(),getConnection()->getTextEncoding());
- aVariable = aStr;
-
- } break;
- case MemoFoxPro:
- case MemodBaseIV: // dBase IV-Memofeld with the length specification
- {
- char sHeader[4];
- m_pMemoStream->Read(sHeader,4);
- // Foxpro stores text and binary data
- if (m_aMemoHeader.db_typ == MemoFoxPro)
- {
- if (((sal_uInt8)sHeader[0]) != 0 || ((sal_uInt8)sHeader[1]) != 0 || ((sal_uInt8)sHeader[2]) != 0)
- {
- return sal_False;
- }
-
- bIsText = sHeader[3] != 0;
- }
- else if (((sal_uInt8)sHeader[0]) != 0xFF || ((sal_uInt8)sHeader[1]) != 0xFF || ((sal_uInt8)sHeader[2]) != 0x08)
- {
- return sal_False;
- }
-
- sal_uInt32 nLength;
- (*m_pMemoStream) >> nLength;
-
- if (m_aMemoHeader.db_typ == MemodBaseIV)
- nLength -= 8;
-
- ::rtl::OUString aStr;
- while ( nLength > STRING_MAXLEN )
- {
- ByteString aBStr;
- aBStr.Expand(STRING_MAXLEN);
- m_pMemoStream->Read(aBStr.AllocBuffer(STRING_MAXLEN),STRING_MAXLEN);
- aStr += ::rtl::OUString(aBStr.GetBuffer(),aBStr.Len(), getConnection()->getTextEncoding());
- nLength -= STRING_MAXLEN;
- }
- if ( nLength > 0 )
- {
- ByteString aBStr;
- aBStr.Expand(static_cast<xub_StrLen>(nLength));
- m_pMemoStream->Read(aBStr.AllocBuffer(static_cast<xub_StrLen>(nLength)),nLength);
-
- aStr += ::rtl::OUString(aBStr.GetBuffer(),aBStr.Len(), getConnection()->getTextEncoding());
-
- }
- if ( aStr.getLength() )
- aVariable = aStr;
- }
- }
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-void ODbaseTable::AllocBuffer()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::AllocBuffer" );
- sal_uInt16 nSize = m_aHeader.db_slng;
- OSL_ENSURE(nSize > 0, "Size too small");
-
- if (m_nBufferSize != nSize)
- {
- delete[] m_pBuffer;
- m_pBuffer = NULL;
- }
-
- // If no buffer available: allocate
- if (m_pBuffer == NULL && nSize > 0)
- {
- m_nBufferSize = nSize;
- m_pBuffer = new sal_uInt8[m_nBufferSize+1];
- }
-}
-// -----------------------------------------------------------------------------
-sal_Bool ODbaseTable::WriteBuffer()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::WriteBuffer" );
- OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position");
-
- // Position on the desired record:
- long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng;
- m_pFileStream->Seek(nPos);
- return m_pFileStream->Write((char*) m_pBuffer, m_aHeader.db_slng) > 0;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 ODbaseTable::getCurrentLastPos() const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getCurrentLastPos" );
- return m_aHeader.db_anz;
-}
-// -----------------------------------------------------------------------------
-//==================================================================
-// ONDXNode
-//==================================================================
-
-//------------------------------------------------------------------
-void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXNode::Read" );
- rStream >> aKey.nRecord; // key
-
- if (rIndex.getHeader().db_keytype)
- {
- double aDbl;
- rStream >> aDbl;
- aKey = ONDXKey(aDbl,aKey.nRecord);
- }
- else
- {
- ByteString aBuf;
- sal_uInt16 nLen = rIndex.getHeader().db_keylen;
- char* pStr = aBuf.AllocBuffer(nLen+1);
-
- rStream.Read(pStr,nLen);
- pStr[nLen] = 0;
- aBuf.ReleaseBufferAccess();
- aBuf.EraseTrailingChars();
-
- aKey = ONDXKey(::rtl::OUString(aBuf.GetBuffer(),aBuf.Len(),rIndex.m_pTable->getConnection()->getTextEncoding()) ,aKey.nRecord);
- }
- rStream >> aChild;
-}
-
-union
-{
- double aDbl;
- char aData[128];
-} aNodeData;
-//------------------------------------------------------------------
-void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXNode::Write" );
- const ODbaseIndex& rIndex = rPage.GetIndex();
- if (!rIndex.isUnique() || rPage.IsLeaf())
- rStream << (sal_uInt32)aKey.nRecord; // key
- else
- rStream << (sal_uInt32)0; // key
-
- if (rIndex.getHeader().db_keytype) // double
- {
- if (aKey.getValue().isNull())
- {
- memset(aNodeData.aData,0,rIndex.getHeader().db_keylen);
- rStream.Write((sal_uInt8*)aNodeData.aData,rIndex.getHeader().db_keylen);
- }
- else
- rStream << (double) aKey.getValue();
- }
- else
- {
- memset(aNodeData.aData,0x20,rIndex.getHeader().db_keylen);
- if (!aKey.getValue().isNull())
- {
- ::rtl::OUString sValue = aKey.getValue();
- ByteString aText(sValue.getStr(), rIndex.m_pTable->getConnection()->getTextEncoding());
- strncpy(aNodeData.aData,aText.GetBuffer(),std::min(rIndex.getHeader().db_keylen, aText.Len()));
- }
- rStream.Write((sal_uInt8*)aNodeData.aData,rIndex.getHeader().db_keylen);
- }
- rStream << aChild;
-}
-
-
-//------------------------------------------------------------------
-ONDXPagePtr& ONDXNode::GetChild(ODbaseIndex* pIndex, ONDXPage* pParent)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXNode::GetChild" );
- if (!aChild.Is() && pIndex)
- {
- aChild = pIndex->CreatePage(aChild.GetPagePos(),pParent,aChild.HasPage());
- }
- return aChild;
-}
-
-//==================================================================
-// ONDXKey
-//==================================================================
-//------------------------------------------------------------------
-sal_Bool ONDXKey::IsText(sal_Int32 eType)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXKey::IsText" );
- return eType == DataType::VARCHAR || eType == DataType::CHAR;
-}
-
-//------------------------------------------------------------------
-StringCompare ONDXKey::Compare(const ONDXKey& rKey) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXKey::Compare" );
- StringCompare eResult;
-
- if (getValue().isNull())
- {
- if (rKey.getValue().isNull() || (rKey.IsText(getDBType()) && !rKey.getValue().getString().getLength()))
- eResult = COMPARE_EQUAL;
- else
- eResult = COMPARE_LESS;
- }
- else if (rKey.getValue().isNull())
- {
- if (getValue().isNull() || (IsText(getDBType()) && !getValue().getString().getLength()))
- eResult = COMPARE_EQUAL;
- else
- eResult = COMPARE_GREATER;
- }
- else if (IsText(getDBType()))
- {
- sal_Int32 nRes = getValue().getString().compareTo(rKey.getValue());
- eResult = (nRes > 0) ? COMPARE_GREATER : (nRes == 0) ? COMPARE_EQUAL : COMPARE_LESS;
- }
- else
- {
- double m = getValue(),n = rKey.getValue();
- eResult = (m > n) ? COMPARE_GREATER : (n == m) ? COMPARE_EQUAL : COMPARE_LESS;
- }
-
- // Record comparison, if index !Unique
- if (eResult == COMPARE_EQUAL && nRecord && rKey.nRecord)
- eResult = (nRecord > rKey.nRecord) ? COMPARE_GREATER :
- (nRecord == rKey.nRecord) ? COMPARE_EQUAL : COMPARE_LESS;
-
- return eResult;
-}
-// -----------------------------------------------------------------------------
-void ONDXKey::setValue(const ORowSetValue& _rVal)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXKey::setValue" );
- xValue = _rVal;
-}
-// -----------------------------------------------------------------------------
-const ORowSetValue& ONDXKey::getValue() const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXKey::getValue" );
- return xValue;
-}
-// -----------------------------------------------------------------------------
-SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPagePtr& rPage)
-{
- rStream >> rPage.nPagePos;
- return rStream;
-}
-// -----------------------------------------------------------------------------
-SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPagePtr& rPage)
-{
- rStream << rPage.nPagePos;
- return rStream;
-}
-// -----------------------------------------------------------------------------
-//==================================================================
-// ONDXPagePtr
-//==================================================================
-//------------------------------------------------------------------
-ONDXPagePtr::ONDXPagePtr(const ONDXPagePtr& rRef)
- :ONDXPageRef(rRef)
- ,nPagePos(rRef.nPagePos)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPagePtr::ONDXPagePtr" );
-}
-
-//------------------------------------------------------------------
-ONDXPagePtr::ONDXPagePtr(ONDXPage* pRefPage)
- :ONDXPageRef(pRefPage)
- ,nPagePos(0)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPagePtr::ONDXPagePtr" );
- if (pRefPage)
- nPagePos = pRefPage->GetPagePos();
-}
-//------------------------------------------------------------------
-ONDXPagePtr& ONDXPagePtr::operator=(const ONDXPagePtr& rRef)
-{
- ONDXPageRef::operator=(rRef);
- nPagePos = rRef.nPagePos;
- return *this;
-}
-
-//------------------------------------------------------------------
-ONDXPagePtr& ONDXPagePtr::operator= (ONDXPage* pRef)
-{
- ONDXPageRef::operator=(pRef);
- nPagePos = (pRef) ? pRef->GetPagePos() : 0;
- return *this;
-}
-// -----------------------------------------------------------------------------
-static sal_uInt32 nValue;
-//------------------------------------------------------------------
-SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage)
-{
- rStream.Seek(rPage.GetPagePos() * 512);
- rStream >> nValue >> rPage.aChild;
- rPage.nCount = sal_uInt16(nValue);
-
- for (sal_uInt16 i = 0; i < rPage.nCount; i++)
- rPage[i].Read(rStream, rPage.GetIndex());
- return rStream;
-}
-
-//------------------------------------------------------------------
-SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& rPage)
-{
- // Page does not yet exist
- sal_uIntPtr nSize = (rPage.GetPagePos() + 1) * 512;
- if (nSize > rStream.Seek(STREAM_SEEK_TO_END))
- {
- rStream.SetStreamSize(nSize);
- rStream.Seek(rPage.GetPagePos() * 512);
-
- char aEmptyData[512];
- memset(aEmptyData,0x00,512);
- rStream.Write((sal_uInt8*)aEmptyData,512);
- }
- sal_uIntPtr nCurrentPos = rStream.Seek(rPage.GetPagePos() * 512);
- OSL_UNUSED( nCurrentPos );
-
- nValue = rPage.nCount;
- rStream << nValue << rPage.aChild;
-
- sal_uInt16 i = 0;
- for (; i < rPage.nCount; i++)
- rPage[i].Write(rStream, rPage);
-
- // check if we have to fill the stream with '\0'
- if(i < rPage.rIndex.getHeader().db_maxkeys)
- {
- sal_uIntPtr nTell = rStream.Tell() % 512;
- sal_uInt16 nBufferSize = rStream.GetBufferSize();
- sal_uIntPtr nSize = nBufferSize - nTell;
- if ( nSize <= nBufferSize )
- {
- char* pEmptyData = new char[nSize];
- memset(pEmptyData,0x00,nSize);
- rStream.Write((sal_uInt8*)pEmptyData,nSize);
- rStream.Seek(nTell);
- delete [] pEmptyData;
- }
- }
- return rStream;
-}
-// -----------------------------------------------------------------------------
-#if OSL_DEBUG_LEVEL > 1
-//------------------------------------------------------------------
-void ONDXPage::PrintPage()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::PrintPage" );
- OSL_TRACE("\nSDB: -----------Page: %d Parent: %d Count: %d Child: %d-----",
- nPagePos, HasParent() ? aParent->GetPagePos() : 0 ,nCount, aChild.GetPagePos());
-
- for (sal_uInt16 i = 0; i < nCount; i++)
- {
- ONDXNode rNode = (*this)[i];
- ONDXKey& rKey = rNode.GetKey();
- if (!IsLeaf())
- rNode.GetChild(&rIndex, this);
-
- if (rKey.getValue().isNull())
- {
- OSL_TRACE("SDB: [%d,NULL,%d]",rKey.GetRecord(), rNode.GetChild().GetPagePos());
- }
- else if (rIndex.getHeader().db_keytype)
- {
- OSL_TRACE("SDB: [%d,%f,%d]",rKey.GetRecord(), rKey.getValue().getDouble(),rNode.GetChild().GetPagePos());
- }
- else
- {
- OSL_TRACE("SDB: [%d,%s,%d]",rKey.GetRecord(), (const char* )ByteString(rKey.getValue().getString().getStr(), rIndex.m_pTable->getConnection()->getTextEncoding()).GetBuffer(),rNode.GetChild().GetPagePos());
- }
- }
- OSL_TRACE("SDB: -----------------------------------------------\n");
- if (!IsLeaf())
- {
-#if OSL_DEBUG_LEVEL > 1
- GetChild(&rIndex)->PrintPage();
- for (sal_uInt16 i = 0; i < nCount; i++)
- {
- ONDXNode rNode = (*this)[i];
- rNode.GetChild(&rIndex,this)->PrintPage();
- }
-#endif
- }
- OSL_TRACE("SDB: ===============================================\n");
-}
-#endif
-// -----------------------------------------------------------------------------
-sal_Bool ONDXPage::IsFull() const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::IsFull" );
- return Count() == rIndex.getHeader().db_maxkeys;
-}
-// -----------------------------------------------------------------------------
-//------------------------------------------------------------------
-sal_uInt16 ONDXPage::Search(const ONDXKey& rSearch)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::Search" );
- // binary search afterwards
- sal_uInt16 i = 0xFFFF;
- while (++i < Count())
- if ((*this)[i].GetKey() == rSearch)
- break;
-
- return (i < Count()) ? i : NODE_NOTFOUND;
-}
-
-//------------------------------------------------------------------
-sal_uInt16 ONDXPage::Search(const ONDXPage* pPage)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::Search" );
- sal_uInt16 i = 0xFFFF;
- while (++i < Count())
- if (((*this)[i]).GetChild() == pPage)
- break;
-
- // if not found, then we assume, that the page points to the page (???)
- return (i < Count()) ? i : NODE_NOTFOUND;
-}
-// -----------------------------------------------------------------------------
-// runs recursively
-void ONDXPage::SearchAndReplace(const ONDXKey& rSearch,
- ONDXKey& rReplace)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::SearchAndReplace" );
- OSL_ENSURE(rSearch != rReplace,"Invalid here:rSearch == rReplace");
- if (rSearch != rReplace)
- {
- sal_uInt16 nPos = NODE_NOTFOUND;
- ONDXPage* pPage = this;
-
- while (pPage && (nPos = pPage->Search(rSearch)) == NODE_NOTFOUND)
- pPage = pPage->aParent;
-
- if (pPage)
- {
- (*pPage)[nPos].GetKey() = rReplace;
- pPage->SetModified(sal_True);
- }
- }
-}
-// -----------------------------------------------------------------------------
-ONDXNode& ONDXPage::operator[] (sal_uInt16 nPos)
-{
- DBG_ASSERT(nCount > nPos, "falscher Indexzugriff");
- return ppNodes[nPos];
-}
-
-//------------------------------------------------------------------
-const ONDXNode& ONDXPage::operator[] (sal_uInt16 nPos) const
-{
- DBG_ASSERT(nCount > nPos, "falscher Indexzugriff");
- return ppNodes[nPos];
-}
-// -----------------------------------------------------------------------------
-void ONDXPage::Remove(sal_uInt16 nPos)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::Remove" );
- DBG_ASSERT(nCount > nPos, "falscher Indexzugriff");
-
- for (sal_uInt16 i = nPos; i < (nCount-1); i++)
- (*this)[i] = (*this)[i+1];
-
- nCount--;
- bModified = sal_True;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DPreparedStatement.cxx b/connectivity/source/drivers/dbase/DPreparedStatement.cxx
deleted file mode 100644
index 67f7c36941..0000000000
--- a/connectivity/source/drivers/dbase/DPreparedStatement.cxx
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "dbase/DPreparedStatement.hxx"
-#include "dbase/DResultSet.hxx"
-
-using namespace connectivity::dbase;
-using namespace connectivity::file;
-using namespace com::sun::star::uno;
-// -------------------------------------------------------------------------
-OResultSet* ODbasePreparedStatement::createResultSet()
-{
- return new ODbaseResultSet(this,m_aSQLIterator);
-}
-// -------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(ODbasePreparedStatement,"com.sun.star.sdbc.driver.dbase.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DResultSet.cxx b/connectivity/source/drivers/dbase/DResultSet.cxx
deleted file mode 100644
index d055bdb6b3..0000000000
--- a/connectivity/source/drivers/dbase/DResultSet.cxx
+++ /dev/null
@@ -1,247 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <com/sun/star/sdbcx/CompareBookmark.hpp>
-#include "dbase/DResultSet.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <comphelper/sequence.hxx>
-#include "dbase/DIndex.hxx"
-#include "dbase/DIndexIter.hxx"
-#include "dbase/DCode.hxx"
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-#include "resource/dbase_res.hrc"
-
-using namespace ::comphelper;
-
-using namespace connectivity::dbase;
-using namespace connectivity::file;
-using namespace ::cppu;
-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;
-//------------------------------------------------------------------------------
-ODbaseResultSet::ODbaseResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator)
- : file::OResultSet(pStmt,_aSQLIterator)
- ,m_bBookmarkable(sal_True)
-{
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE), PROPERTY_ID_ISBOOKMARKABLE, PropertyAttribute::READONLY,&m_bBookmarkable, ::getBooleanCppuType());
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODbaseResultSet::getImplementationName( ) throw ( RuntimeException)
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.dbase.ResultSet"));
-}
-// -------------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL ODbaseResultSet::getSupportedServiceNames( ) throw( RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(2);
- aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet"));
- aSupported[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ResultSet"));
- return aSupported;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODbaseResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL ODbaseResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = ODbaseResultSet_BASE::queryInterface(rType);
- return aRet.hasValue() ? aRet : OResultSet::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
- Sequence< Type > SAL_CALL ODbaseResultSet::getTypes( ) throw( RuntimeException)
-{
- return ::comphelper::concatSequences(OResultSet::getTypes(),ODbaseResultSet_BASE::getTypes());
-}
-
-// -------------------------------------------------------------------------
-// XRowLocate
-Any SAL_CALL ODbaseResultSet::getBookmark( ) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- OSL_ENSURE((m_bShowDeleted || !m_aRow->isDeleted()),"getBookmark called for deleted row");
-
- return makeAny((sal_Int32)(m_aRow->get())[0]->getValue());
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODbaseResultSet::moveToBookmark( const Any& bookmark ) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False;
-
- return m_pTable ? Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_True) : sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODbaseResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- if(!m_pTable)
- return sal_False;
-
-
- Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_False);
-
- return relative(rows);
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODbaseResultSet::compareBookmarks( const Any& lhs, const Any& rhs ) throw( SQLException, RuntimeException)
-{
- sal_Int32 nFirst(0),nSecond(0),nResult(0);
- if ( !( lhs >>= nFirst ) || !( rhs >>= nSecond ) )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_INVALID_BOOKMARK);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- } // if ( !( lhs >>= nFirst ) || !( rhs >>= nSecond ) )
-
- // have a look at CompareBookmark
- // we can't use the names there because we already have defines with the same name from the parser
- if(nFirst < nSecond)
- nResult = -1;
- else if(nFirst > nSecond)
- nResult = 1;
- else
- nResult = 0;
-
- return nResult;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODbaseResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODbaseResultSet::hashBookmark( const Any& bookmark ) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return comphelper::getINT32(bookmark);
-}
-// -------------------------------------------------------------------------
-// XDeleteRows
-Sequence< sal_Int32 > SAL_CALL ODbaseResultSet::deleteRows( const Sequence< Any >& /*rows*/ ) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- ::dbtools::throwFeatureNotImplementedException( "XDeleteRows::deleteRows", *this );
- return Sequence< sal_Int32 >();
-}
-// -------------------------------------------------------------------------
-sal_Bool ODbaseResultSet::fillIndexValues(const Reference< XColumnsSupplier> &_xIndex)
-{
- Reference<XUnoTunnel> xTunnel(_xIndex,UNO_QUERY);
- if(xTunnel.is())
- {
- dbase::ODbaseIndex* pIndex = reinterpret_cast< dbase::ODbaseIndex* >( xTunnel->getSomething(dbase::ODbaseIndex::getUnoTunnelImplementationId()) );
- if(pIndex)
- {
- dbase::OIndexIterator* pIter = pIndex->createIterator(NULL,NULL);
-
- if (pIter)
- {
- sal_uInt32 nRec = pIter->First();
- while (nRec != SQL_COLUMN_NOTFOUND)
- {
- if (m_aOrderbyAscending[0])
- m_pFileSet->get().push_back(nRec);
- else
- m_pFileSet->get().insert(m_pFileSet->get().begin(),nRec);
- nRec = pIter->Next();
- }
- m_pFileSet->setFrozen();
- delete pIter;
- return sal_True;
- }
- delete pIter;
- }
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & ODbaseResultSet::getInfoHelper()
-{
- return *ODbaseResultSet_BASE3::getArrayHelper();
-}
-// -----------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* ODbaseResultSet::createArrayHelper() const
-{
- Sequence< Property > aProps;
- describeProperties(aProps);
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL ODbaseResultSet::acquire() throw()
-{
- ODbaseResultSet_BASE2::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL ODbaseResultSet::release() throw()
-{
- ODbaseResultSet_BASE2::release();
-}
-// -----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL ODbaseResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-OSQLAnalyzer* ODbaseResultSet::createAnalyzer()
-{
- return new OFILEAnalyzer(m_pTable->getConnection());
-}
-// -----------------------------------------------------------------------------
-sal_Int32 ODbaseResultSet::getCurrentFilePos() const
-{
- return m_pTable->getFilePos();
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DStatement.cxx b/connectivity/source/drivers/dbase/DStatement.cxx
deleted file mode 100644
index 9e0e5ddfc8..0000000000
--- a/connectivity/source/drivers/dbase/DStatement.cxx
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "dbase/DStatement.hxx"
-#include "dbase/DResultSet.hxx"
-
-using namespace connectivity::dbase;
-using namespace connectivity::file;
-using namespace com::sun::star::uno;
-
-// -------------------------------------------------------------------------
-OResultSet* ODbaseStatement::createResultSet()
-{
- return new ODbaseResultSet(this,m_aSQLIterator);
-}
-// -------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(ODbaseStatement,"com.sun.star.sdbc.driver.dbase.Statement","com.sun.star.sdbc.Statement");
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
deleted file mode 100644
index a71e966b4b..0000000000
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ /dev/null
@@ -1,2798 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "dbase/DTable.hxx"
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/ucb/XContentAccess.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <svl/converter.hxx>
-#include "dbase/DConnection.hxx"
-#include "dbase/DColumns.hxx"
-#include <osl/thread.h>
-#include <tools/config.hxx>
-#include "dbase/DIndex.hxx"
-#include "dbase/DIndexes.hxx"
-#include <comphelper/sequence.hxx>
-#include <svl/zforlist.hxx>
-#include <unotools/syslocale.hxx>
-#include <rtl/math.hxx>
-#include <stdio.h> //sprintf
-#include <ucbhelper/content.hxx>
-#include <comphelper/extract.hxx>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/dbconversion.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <comphelper/property.hxx>
-#include <unotools/tempfile.hxx>
-#include <unotools/ucbhelper.hxx>
-#include <comphelper/types.hxx>
-#include <cppuhelper/exc_hlp.hxx>
-#include "connectivity/PColumn.hxx"
-#include "connectivity/dbtools.hxx"
-#include "connectivity/FValue.hxx"
-#include "connectivity/dbconversion.hxx"
-#include "resource/dbase_res.hrc"
-#include <rtl/logfile.hxx>
-
-#include <algorithm>
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::sdbcx;
-using namespace connectivity::dbase;
-using namespace connectivity::file;
-using namespace ::ucbhelper;
-using namespace ::utl;
-using namespace ::cppu;
-using namespace ::dbtools;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::ucb;
-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::i18n;
-
-// stored as the Field Descriptor terminator
-#define FIELD_DESCRIPTOR_TERMINATOR 0x0D
-#define DBF_EOL 0x1A
-
-namespace
-{
-sal_Int32 lcl_getFileSize(SvStream& _rStream)
-{
- sal_Int32 nFileSize = 0;
- _rStream.Seek(STREAM_SEEK_TO_END);
- _rStream.SeekRel(-1);
- char cEOL;
- _rStream >> cEOL;
- nFileSize = _rStream.Tell();
- if ( cEOL == DBF_EOL )
- nFileSize -= 1;
- return nFileSize;
-}
-/**
- calculates the Julian date
-*/
-void lcl_CalcJulDate(sal_Int32& _nJulianDate,sal_Int32& _nJulianTime,const com::sun::star::util::DateTime _aDateTime)
-{
- com::sun::star::util::DateTime aDateTime = _aDateTime;
- // weird: months fix
- if (aDateTime.Month > 12)
- {
- aDateTime.Month--;
- sal_uInt16 delta = _aDateTime.Month / 12;
- aDateTime.Year += delta;
- aDateTime.Month -= delta * 12;
- aDateTime.Month++;
- }
-
- _nJulianTime = ((aDateTime.Hours*3600000)+(aDateTime.Minutes*60000)+(aDateTime.Seconds*1000)+(aDateTime.HundredthSeconds*10));
- /* conversion factors */
- sal_uInt16 iy0;
- sal_uInt16 im0;
- if ( aDateTime.Month <= 2 )
- {
- iy0 = aDateTime.Year - 1;
- im0 = aDateTime.Month + 12;
- }
- else
- {
- iy0 = aDateTime.Year;
- im0 = aDateTime.Month;
- }
- sal_Int32 ia = iy0 / 100;
- sal_Int32 ib = 2 - ia + (ia >> 2);
- /* calculate julian date */
- if ( aDateTime.Year <= 0 )
- {
- _nJulianDate = (sal_Int32) ((365.25 * iy0) - 0.75)
- + (sal_Int32) (30.6001 * (im0 + 1) )
- + aDateTime.Day + 1720994;
- } // if ( _aDateTime.Year <= 0 )
- else
- {
- _nJulianDate = static_cast<sal_Int32>( ((365.25 * iy0)
- + (sal_Int32) (30.6001 * (im0 + 1))
- + aDateTime.Day + 1720994));
- }
- double JD = _nJulianDate + 0.5;
- _nJulianDate = (sal_Int32)( JD + 0.5);
- const double gyr = aDateTime.Year + (0.01 * aDateTime.Month) + (0.0001 * aDateTime.Day);
- if ( gyr >= 1582.1015 ) /* on or after 15 October 1582 */
- _nJulianDate += ib;
-}
-
-/**
- calculates date time from the Julian Date
-*/
-void lcl_CalDate(sal_Int32 _nJulianDate,sal_Int32 _nJulianTime,com::sun::star::util::DateTime& _rDateTime)
-{
- if ( _nJulianDate )
- {
- sal_Int32 ialp;
- sal_Int32 ka = _nJulianDate;
- if ( _nJulianDate >= 2299161 )
- {
- ialp = (sal_Int32)( ((double) _nJulianDate - 1867216.25 ) / ( 36524.25 ));
- ka = _nJulianDate + 1 + ialp - ( ialp >> 2 );
- }
- sal_Int32 kb = ka + 1524;
- sal_Int32 kc = (sal_Int32) ( ((double) kb - 122.1 ) / 365.25 );
- sal_Int32 kd = (sal_Int32) ((double) kc * 365.25);
- sal_Int32 ke = (sal_Int32) ((double) ( kb - kd ) / 30.6001 );
- _rDateTime.Day = static_cast<sal_uInt16>(kb - kd - ((sal_Int32) ( (double) ke * 30.6001 )));
- if ( ke > 13 )
- _rDateTime.Month = static_cast<sal_uInt16>(ke - 13);
- else
- _rDateTime.Month = static_cast<sal_uInt16>(ke - 1);
- if ( (_rDateTime.Month == 2) && (_rDateTime.Day > 28) )
- _rDateTime.Day = 29;
- if ( (_rDateTime.Month == 2) && (_rDateTime.Day == 29) && (ke == 3) )
- _rDateTime.Year = static_cast<sal_uInt16>(kc - 4716);
- else if ( _rDateTime.Month > 2 )
- _rDateTime.Year = static_cast<sal_uInt16>(kc - 4716);
- else
- _rDateTime.Year = static_cast<sal_uInt16>(kc - 4715);
- }
-
- if ( _nJulianTime )
- {
- double d_s = _nJulianTime / 1000;
- double d_m = d_s / 60;
- double d_h = d_m / 60;
- _rDateTime.Hours = (sal_uInt16) (d_h);
- _rDateTime.Minutes = (sal_uInt16) d_m;
- _rDateTime.Seconds = static_cast<sal_uInt16>(( d_m - (double) _rDateTime.Minutes ) * 60.0);
- }
-}
-
-}
-
-// -------------------------------------------------------------------------
-void ODbaseTable::readHeader()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::readHeader" );
- OSL_ENSURE(m_pFileStream,"No Stream available!");
- if(!m_pFileStream)
- return;
- m_pFileStream->RefreshBuffer(); // Make sure, that the header information actually is read again
- m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
-
- sal_uInt8 nType=0;
- (*m_pFileStream) >> nType;
- if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
- throwInvalidDbaseFormat();
-
- m_pFileStream->Read((char*)(&m_aHeader.db_aedat), 3*sizeof(sal_uInt8));
- if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
- throwInvalidDbaseFormat();
- (*m_pFileStream) >> m_aHeader.db_anz;
- if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
- throwInvalidDbaseFormat();
- (*m_pFileStream) >> m_aHeader.db_kopf;
- if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
- throwInvalidDbaseFormat();
- (*m_pFileStream) >> m_aHeader.db_slng;
- if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
- throwInvalidDbaseFormat();
- m_pFileStream->Read((char*)(&m_aHeader.db_frei), 20*sizeof(sal_uInt8));
- if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
- throwInvalidDbaseFormat();
-
- if ( ( ( m_aHeader.db_kopf - 1 ) / 32 - 1 ) <= 0 ) // number of fields
- {
- // no dbase file
- throwInvalidDbaseFormat();
- }
- else
- {
- // Consistency check of the header:
- m_aHeader.db_typ = (DBFType)nType;
- switch (m_aHeader.db_typ)
- {
- case dBaseIII:
- case dBaseIV:
- case dBaseV:
- case VisualFoxPro:
- case VisualFoxProAuto:
- case dBaseFS:
- case dBaseFSMemo:
- case dBaseIVMemoSQL:
- case dBaseIIIMemo:
- case FoxProMemo:
- m_pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
- if ( m_aHeader.db_frei[17] != 0x00
- && !m_aHeader.db_frei[18] && !m_aHeader.db_frei[19] && getConnection()->isTextEncodingDefaulted() )
- {
- switch(m_aHeader.db_frei[17])
- {
- case 0x01: m_eEncoding = RTL_TEXTENCODING_IBM_437; break; // DOS USA code page 437
- case 0x02: m_eEncoding = RTL_TEXTENCODING_IBM_850; break; // DOS Multilingual code page 850
- case 0x03: m_eEncoding = RTL_TEXTENCODING_MS_1252; break; // Windows ANSI code page 1252
- case 0x04: m_eEncoding = RTL_TEXTENCODING_APPLE_ROMAN; break; // Standard Macintosh
- case 0x64: m_eEncoding = RTL_TEXTENCODING_IBM_852; break; // EE MS-DOS code page 852
- case 0x65: m_eEncoding = RTL_TEXTENCODING_IBM_865; break; // Nordic MS-DOS code page 865
- case 0x66: m_eEncoding = RTL_TEXTENCODING_IBM_866; break; // Russian MS-DOS code page 866
- case 0x67: m_eEncoding = RTL_TEXTENCODING_IBM_861; break; // Icelandic MS-DOS
- //case 0x68: m_eEncoding = ; break; // Kamenicky (Czech) MS-DOS
- //case 0x69: m_eEncoding = ; break; // Mazovia (Polish) MS-DOS
- case 0x6A: m_eEncoding = RTL_TEXTENCODING_IBM_737; break; // Greek MS-DOS (437G)
- case 0x6B: m_eEncoding = RTL_TEXTENCODING_IBM_857; break; // Turkish MS-DOS
- case 0x96: m_eEncoding = RTL_TEXTENCODING_APPLE_CYRILLIC; break; // Russian Macintosh
- case 0x97: m_eEncoding = RTL_TEXTENCODING_APPLE_CENTEURO; break; // Eastern European Macintosh
- case 0x98: m_eEncoding = RTL_TEXTENCODING_APPLE_GREEK; break; // Greek Macintosh
- case 0xC8: m_eEncoding = RTL_TEXTENCODING_MS_1250; break; // Windows EE code page 1250
- case 0xC9: m_eEncoding = RTL_TEXTENCODING_MS_1251; break; // Russian Windows
- case 0xCA: m_eEncoding = RTL_TEXTENCODING_MS_1254; break; // Turkish Windows
- case 0xCB: m_eEncoding = RTL_TEXTENCODING_MS_1253; break; // Greek Windows
- default:
- break;
- }
- }
- break;
- case dBaseIVMemo:
- m_pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
- break;
- default:
- {
- throwInvalidDbaseFormat();
- }
- }
- }
-}
-// -------------------------------------------------------------------------
-void ODbaseTable::fillColumns()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::fillColumns" );
- m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
- m_pFileStream->Seek(32L);
-
- if(!m_aColumns.is())
- m_aColumns = new OSQLColumns();
- else
- m_aColumns->get().clear();
-
- m_aTypes.clear();
- m_aPrecisions.clear();
- m_aScales.clear();
-
- // Number of fields:
- const sal_Int32 nFieldCount = (m_aHeader.db_kopf - 1) / 32 - 1;
- OSL_ENSURE(nFieldCount,"No columns in table!");
-
- m_aColumns->get().reserve(nFieldCount);
- m_aTypes.reserve(nFieldCount);
- m_aPrecisions.reserve(nFieldCount);
- m_aScales.reserve(nFieldCount);
-
- String aStrFieldName;
- aStrFieldName.AssignAscii("Column");
- ::rtl::OUString aTypeName;
- static const ::rtl::OUString sVARCHAR(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"));
- const sal_Bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers();
- const bool bFoxPro = m_aHeader.db_typ == VisualFoxPro || m_aHeader.db_typ == VisualFoxProAuto || m_aHeader.db_typ == FoxProMemo;
-
- sal_Int32 i = 0;
- for (; i < nFieldCount; i++)
- {
- DBFColumn aDBFColumn;
- m_pFileStream->Read((char*)&aDBFColumn, sizeof(aDBFColumn));
- if ( FIELD_DESCRIPTOR_TERMINATOR == aDBFColumn.db_fnm[0] ) // 0x0D stored as the Field Descriptor terminator.
- break;
-
- sal_Bool bIsRowVersion = bFoxPro && ( aDBFColumn.db_frei2[0] & 0x01 ) == 0x01;
- const String aColumnName((const char *)aDBFColumn.db_fnm,m_eEncoding);
-
- m_aRealFieldLengths.push_back(aDBFColumn.db_flng);
- sal_Int32 nPrecision = aDBFColumn.db_flng;
- sal_Int32 eType;
- sal_Bool bIsCurrency = sal_False;
-
- char cType[2];
- cType[0] = aDBFColumn.db_typ;
- cType[1] = 0;
- aTypeName = ::rtl::OUString::createFromAscii(cType);
-OSL_TRACE("column type: %c",aDBFColumn.db_typ);
-
- switch (aDBFColumn.db_typ)
- {
- case 'C':
- eType = DataType::VARCHAR;
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"));
- break;
- case 'F':
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL"));
- case 'N':
- if ( aDBFColumn.db_typ == 'N' )
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NUMERIC"));
- eType = DataType::DECIMAL;
-
- // for numeric fields two characters more are written, than the precision of the column description predescribes,
- // to keep room for the possible sign and the comma. This has to be considered...
- nPrecision = SvDbaseConverter::ConvertPrecisionToOdbc(nPrecision,aDBFColumn.db_dez);
- // This is not true for older versions ....
- break;
- case 'L':
- eType = DataType::BIT;
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BOOLEAN"));
- break;
- case 'Y':
- bIsCurrency = sal_True;
- eType = DataType::DOUBLE;
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOUBLE"));
- break;
- case 'D':
- eType = DataType::DATE;
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATE"));
- break;
- case 'T':
- eType = DataType::TIMESTAMP;
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP"));
- break;
- case 'I':
- eType = DataType::INTEGER;
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INTEGER"));
- break;
- case 'M':
- if ( bFoxPro && ( aDBFColumn.db_frei2[0] & 0x04 ) == 0x04 )
- {
- eType = DataType::LONGVARBINARY;
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONGVARBINARY"));
- }
- else
- {
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONGVARCHAR"));
- eType = DataType::LONGVARCHAR;
- }
- nPrecision = 2147483647;
- break;
- case 'P':
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONGVARBINARY"));
- eType = DataType::LONGVARBINARY;
- nPrecision = 2147483647;
- break;
- case '0':
- case 'B':
- if ( m_aHeader.db_typ == VisualFoxPro || m_aHeader.db_typ == VisualFoxProAuto )
- {
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOUBLE"));
- eType = DataType::DOUBLE;
- }
- else
- {
- aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONGVARBINARY"));
- eType = DataType::LONGVARBINARY;
- nPrecision = 2147483647;
- }
- break;
- default:
- eType = DataType::OTHER;
- }
-
- m_aTypes.push_back(eType);
- m_aPrecisions.push_back(nPrecision);
- m_aScales.push_back(aDBFColumn.db_dez);
-
- Reference< XPropertySet> xCol = new sdbcx::OColumn(aColumnName,
- aTypeName,
- ::rtl::OUString(),
- ::rtl::OUString(),
- ColumnValue::NULLABLE,
- nPrecision,
- aDBFColumn.db_dez,
- eType,
- sal_False,
- bIsRowVersion,
- bIsCurrency,
- bCase);
- m_aColumns->get().push_back(xCol);
- } // for (; i < nFieldCount; i++)
- OSL_ENSURE(i,"No columns in table!");
-}
-// -------------------------------------------------------------------------
-ODbaseTable::ODbaseTable(sdbcx::OCollection* _pTables,ODbaseConnection* _pConnection)
- :ODbaseTable_BASE(_pTables,_pConnection)
- ,m_pMemoStream(NULL)
- ,m_bWriteableMemo(sal_False)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::ODbaseTable" );
- // initialize the header
- m_aHeader.db_typ = dBaseIII;
- m_aHeader.db_anz = 0;
- m_aHeader.db_kopf = 0;
- m_aHeader.db_slng = 0;
- m_eEncoding = getConnection()->getTextEncoding();
-}
-// -------------------------------------------------------------------------
-ODbaseTable::ODbaseTable(sdbcx::OCollection* _pTables,ODbaseConnection* _pConnection,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description ,
- const ::rtl::OUString& _SchemaName,
- const ::rtl::OUString& _CatalogName
- ) : ODbaseTable_BASE(_pTables,_pConnection,_Name,
- _Type,
- _Description,
- _SchemaName,
- _CatalogName)
- ,m_pMemoStream(NULL)
- ,m_bWriteableMemo(sal_False)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::ODbaseTable" );
- m_eEncoding = getConnection()->getTextEncoding();
-}
-
-// -----------------------------------------------------------------------------
-void ODbaseTable::construct()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::construct" );
- // initialize the header
- m_aHeader.db_typ = dBaseIII;
- m_aHeader.db_anz = 0;
- m_aHeader.db_kopf = 0;
- m_aHeader.db_slng = 0;
- m_aMemoHeader.db_size = 0;
-
- String sFileName(getEntry(m_pConnection,m_Name));
-
- INetURLObject aURL;
- aURL.SetURL(sFileName);
-
- OSL_ENSURE( m_pConnection->matchesExtension( aURL.getExtension() ),
- "ODbaseTable::ODbaseTable: invalid extension!");
- // getEntry is expected to ensure the corect file name
-
- m_pFileStream = createStream_simpleError( sFileName, STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE);
- m_bWriteable = ( m_pFileStream != NULL );
-
- if ( !m_pFileStream )
- {
- m_bWriteable = sal_False;
- m_pFileStream = createStream_simpleError( sFileName, STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYNONE);
- }
-
- if(m_pFileStream)
- {
- readHeader();
- if (HasMemoFields())
- {
- // Create Memo-Filename (.DBT):
- // nyi: Ugly for Unix and Mac!
-
- if ( m_aHeader.db_typ == FoxProMemo || VisualFoxPro == m_aHeader.db_typ || VisualFoxProAuto == m_aHeader.db_typ ) // foxpro uses another extension
- aURL.SetExtension(String::CreateFromAscii("fpt"));
- else
- aURL.SetExtension(String::CreateFromAscii("dbt"));
-
- // If the memo file isn't found, the data will be displayed anyhow.
- // However, updates can't be done
- // but the operation is executed
- m_pMemoStream = createStream_simpleError( aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE);
- if ( !m_pMemoStream )
- {
- m_bWriteableMemo = sal_False;
- m_pMemoStream = createStream_simpleError( aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYNONE);
- }
- if (m_pMemoStream)
- ReadMemoHeader();
- }
- fillColumns();
-
- sal_uInt32 nFileSize = lcl_getFileSize(*m_pFileStream);
- m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
- if ( m_aHeader.db_anz == 0 && ((nFileSize-m_aHeader.db_kopf)/m_aHeader.db_slng) > 0) // seems to be empty or someone wrote bullshit into the dbase file
- m_aHeader.db_anz = ((nFileSize-m_aHeader.db_kopf)/m_aHeader.db_slng);
-
- // Buffersize dependent on the file size
- m_pFileStream->SetBufferSize(nFileSize > 1000000 ? 32768 :
- nFileSize > 100000 ? 16384 :
- nFileSize > 10000 ? 4096 : 1024);
-
- if (m_pMemoStream)
- {
- // set the buffer extactly to the length of a record
- m_pMemoStream->Seek(STREAM_SEEK_TO_END);
- nFileSize = m_pMemoStream->Tell();
- m_pMemoStream->Seek(STREAM_SEEK_TO_BEGIN);
-
- // Buffersize dependent on the file size
- m_pMemoStream->SetBufferSize(nFileSize > 1000000 ? 32768 :
- nFileSize > 100000 ? 16384 :
- nFileSize > 10000 ? 4096 :
- m_aMemoHeader.db_size);
- }
-
- AllocBuffer();
- }
-}
-//------------------------------------------------------------------
-sal_Bool ODbaseTable::ReadMemoHeader()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::ReadMemoHeader" );
- m_pMemoStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
- m_pMemoStream->RefreshBuffer(); // make sure that the header information is actually read again
- m_pMemoStream->Seek(0L);
-
- (*m_pMemoStream) >> m_aMemoHeader.db_next;
- switch (m_aHeader.db_typ)
- {
- case dBaseIIIMemo: // dBase III: fixed block size
- case dBaseIVMemo:
- // sometimes dBase3 is attached to dBase4 memo
- m_pMemoStream->Seek(20L);
- (*m_pMemoStream) >> m_aMemoHeader.db_size;
- if (m_aMemoHeader.db_size > 1 && m_aMemoHeader.db_size != 512) // 1 is also for dBase 3
- m_aMemoHeader.db_typ = MemodBaseIV;
- else if (m_aMemoHeader.db_size > 1 && m_aMemoHeader.db_size == 512)
- {
- // There are files using size specification, though they are dBase-files
- char sHeader[4];
- m_pMemoStream->Seek(m_aMemoHeader.db_size);
- m_pMemoStream->Read(sHeader,4);
-
- if ((m_pMemoStream->GetErrorCode() != ERRCODE_NONE) || ((sal_uInt8)sHeader[0]) != 0xFF || ((sal_uInt8)sHeader[1]) != 0xFF || ((sal_uInt8)sHeader[2]) != 0x08)
- m_aMemoHeader.db_typ = MemodBaseIII;
- else
- m_aMemoHeader.db_typ = MemodBaseIV;
- }
- else
- {
- m_aMemoHeader.db_typ = MemodBaseIII;
- m_aMemoHeader.db_size = 512;
- }
- break;
- case VisualFoxPro:
- case VisualFoxProAuto:
- case FoxProMemo:
- m_aMemoHeader.db_typ = MemoFoxPro;
- m_pMemoStream->Seek(6L);
- m_pMemoStream->SetNumberFormatInt(NUMBERFORMAT_INT_BIGENDIAN);
- (*m_pMemoStream) >> m_aMemoHeader.db_size;
- break;
- default:
- OSL_FAIL( "ODbaseTable::ReadMemoHeader: unsupported memo type!" );
- break;
- }
- return sal_True;
-}
-// -------------------------------------------------------------------------
-String ODbaseTable::getEntry(OConnection* _pConnection,const ::rtl::OUString& _sName )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getEntry" );
- ::rtl::OUString sURL;
- try
- {
- Reference< XResultSet > xDir = _pConnection->getDir()->getStaticResultSet();
- Reference< XRow> xRow(xDir,UNO_QUERY);
- ::rtl::OUString sName;
- ::rtl::OUString sExt;
- INetURLObject aURL;
- static const ::rtl::OUString s_sSeparator(RTL_CONSTASCII_USTRINGPARAM("/"));
- xDir->beforeFirst();
- while(xDir->next())
- {
- sName = xRow->getString(1);
- aURL.SetSmartProtocol(INET_PROT_FILE);
- String sUrl = _pConnection->getURL() + s_sSeparator + sName;
- aURL.SetSmartURL( sUrl );
-
- // cut the extension
- sExt = aURL.getExtension();
-
- // name and extension have to coincide
- if ( _pConnection->matchesExtension( sExt ) )
- {
- sName = sName.replaceAt(sName.getLength()-(sExt.getLength()+1),sExt.getLength()+1,::rtl::OUString());
- if ( sName == _sName )
- {
- Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY );
- sURL = xContentAccess->queryContentIdentifierString();
- break;
- }
- }
- }
- xDir->beforeFirst(); // move back to before first record
- }
- catch(const Exception&)
- {
- OSL_ASSERT(0);
- }
- return sURL;
-}
-// -------------------------------------------------------------------------
-void ODbaseTable::refreshColumns()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::refreshColumns" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
- TStringVector aVector;
- aVector.reserve(m_aColumns->get().size());
-
- for(OSQLColumns::Vector::const_iterator aIter = m_aColumns->get().begin();aIter != m_aColumns->get().end();++aIter)
- aVector.push_back(Reference< XNamed>(*aIter,UNO_QUERY)->getName());
-
- if(m_pColumns)
- m_pColumns->reFill(aVector);
- else
- m_pColumns = new ODbaseColumns(this,m_aMutex,aVector);
-}
-// -------------------------------------------------------------------------
-void ODbaseTable::refreshIndexes()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::refreshIndexes" );
- TStringVector aVector;
- if(m_pFileStream && (!m_pIndexes || m_pIndexes->getCount() == 0))
- {
- INetURLObject aURL;
- aURL.SetURL(getEntry(m_pConnection,m_Name));
-
- aURL.setExtension(String::CreateFromAscii("inf"));
- Config aInfFile(aURL.getFSysPath(INetURLObject::FSYS_DETECT));
- aInfFile.SetGroup(dBASE_III_GROUP);
- sal_uInt16 nKeyCnt = aInfFile.GetKeyCount();
- ByteString aKeyName;
- ByteString aIndexName;
-
- for (sal_uInt16 nKey = 0; nKey < nKeyCnt; nKey++)
- {
- // Refences the key an index-file?
- aKeyName = aInfFile.GetKeyName( nKey );
- //...if yes, add the index list of the table
- if (aKeyName.Copy(0,3) == ByteString("NDX") )
- {
- aIndexName = aInfFile.ReadKey(aKeyName);
- aURL.setName(String(aIndexName,m_eEncoding));
- try
- {
- Content aCnt(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
- if (aCnt.isDocument())
- {
- aVector.push_back(aURL.getBase());
- }
- }
- catch(const Exception&) // an exception is thrown when no file exists
- {
- }
- }
- }
- }
- if(m_pIndexes)
- m_pIndexes->reFill(aVector);
- else
- m_pIndexes = new ODbaseIndexes(this,m_aMutex,aVector);
-}
-
-// -------------------------------------------------------------------------
-void SAL_CALL ODbaseTable::disposing(void)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::disposing" );
- OFileTable::disposing();
- ::osl::MutexGuard aGuard(m_aMutex);
- m_aColumns = NULL;
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL ODbaseTable::getTypes( ) throw(RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getTypes" );
- Sequence< Type > aTypes = OTable_TYPEDEF::getTypes();
- ::std::vector<Type> aOwnTypes;
- aOwnTypes.reserve(aTypes.getLength());
-
- const Type* pBegin = aTypes.getConstArray();
- const Type* pEnd = pBegin + aTypes.getLength();
- for(;pBegin != pEnd;++pBegin)
- {
- if(!(*pBegin == ::getCppuType((const Reference<XKeysSupplier>*)0) ||
- *pBegin == ::getCppuType((const Reference<XDataDescriptorFactory>*)0)))
- {
- aOwnTypes.push_back(*pBegin);
- }
- }
- aOwnTypes.push_back(::getCppuType( (const Reference< ::com::sun::star::lang::XUnoTunnel > *)0 ));
- Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- return Sequence< Type >(pTypes, aOwnTypes.size());
-}
-
-// -------------------------------------------------------------------------
-Any SAL_CALL ODbaseTable::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::queryInterface" );
- if( rType == ::getCppuType((const Reference<XKeysSupplier>*)0) ||
- rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0))
- return Any();
-
- Any aRet = OTable_TYPEDEF::queryInterface(rType);
- return aRet.hasValue() ? aRet : ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this));
-}
-
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > ODbaseTable::getUnoTunnelImplementationId()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getUnoTunnelImplementationId" );
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 ODbaseTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getSomething" );
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : ODbaseTable_BASE::getSomething(rId);
-}
-//------------------------------------------------------------------
-sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::fetchRow" );
- // Read the data
- bool bIsCurRecordDeleted = (char)m_pBuffer[0] == '*';
-
- // only read the bookmark
-
- // Mark record as deleted
- _rRow->setDeleted(bIsCurRecordDeleted);
- *(_rRow->get())[0] = m_nFilePos;
-
- if (!bRetrieveData)
- return sal_True;
-
- sal_Size nByteOffset = 1;
- // Fields:
- OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin();
- OSQLColumns::Vector::const_iterator aEnd = _rCols.get().end();
- const sal_Size nCount = _rRow->get().size();
- for (sal_Size i = 1; aIter != aEnd && nByteOffset <= m_nBufferSize && i < nCount;++aIter, i++)
- {
- // Lengths depending on data type:
- sal_Int32 nLen = 0;
- sal_Int32 nType = 0;
- if(_bUseTableDefs)
- {
- nLen = m_aPrecisions[i-1];
- nType = m_aTypes[i-1];
- }
- else
- {
- (*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nLen;
- (*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nType;
- }
- switch(nType)
- {
- case DataType::INTEGER:
- case DataType::DOUBLE:
- case DataType::TIMESTAMP:
- case DataType::DATE:
- case DataType::BIT:
- case DataType::LONGVARCHAR:
- case DataType::LONGVARBINARY:
- nLen = m_aRealFieldLengths[i-1];
- break;
- case DataType::DECIMAL:
- if(_bUseTableDefs)
- nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,m_aScales[i-1]);
- else
- nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,getINT32((*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))));
- break; // the sign and the comma
-
- case DataType::BINARY:
- case DataType::OTHER:
- nByteOffset += nLen;
- continue;
- }
-
- // Is the variable bound?
- if ( !(_rRow->get())[i]->isBound() )
- {
- // No - next field.
- nByteOffset += nLen;
- OSL_ENSURE( nByteOffset <= m_nBufferSize ,"ByteOffset > m_nBufferSize!");
- continue;
- } // if ( !(_rRow->get())[i]->isBound() )
- if ( ( nByteOffset + nLen) > m_nBufferSize )
- break; // length doesn't match buffer size.
-
- char *pData = (char *) (m_pBuffer + nByteOffset);
-
- if (nType == DataType::CHAR || nType == DataType::VARCHAR)
- {
- sal_Int32 nLastPos = -1;
- for (sal_Int32 k = 0; k < nLen; ++k)
- {
- if (pData[k] != ' ')
- // Record last non-empty position.
- nLastPos = k;
- }
- if (nLastPos < 0)
- {
- // Empty string. Skip it.
- (_rRow->get())[i]->setNull();
- }
- else
- {
- // Commit the string. Use intern() to ref-count it.
- *(_rRow->get())[i] = ::rtl::OUString::intern(pData, static_cast<sal_Int32>(nLastPos+1), m_eEncoding);
- }
- } // if (nType == DataType::CHAR || nType == DataType::VARCHAR)
- else if ( DataType::TIMESTAMP == nType )
- {
- sal_Int32 nDate = 0,nTime = 0;
- memcpy(&nDate, pData, 4);
- memcpy(&nTime, pData+ 4, 4);
- if ( !nDate && !nTime )
- {
- (_rRow->get())[i]->setNull();
- }
- else
- {
- ::com::sun::star::util::DateTime aDateTime;
- lcl_CalDate(nDate,nTime,aDateTime);
- *(_rRow->get())[i] = aDateTime;
- }
- }
- else if ( DataType::INTEGER == nType )
- {
- sal_Int32 nValue = 0;
- memcpy(&nValue, pData, nLen);
- *(_rRow->get())[i] = nValue;
- }
- else if ( DataType::DOUBLE == nType )
- {
- double d = 0.0;
- if (getBOOL((*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency is treated separately
- {
- sal_Int64 nValue = 0;
- memcpy(&nValue, pData, nLen);
-
- if ( m_aScales[i-1] )
- d = (double)(nValue / pow(10.0,(int)m_aScales[i-1]));
- else
- d = (double)(nValue);
- }
- else
- {
- memcpy(&d, pData, nLen);
- }
-
- *(_rRow->get())[i] = d;
- }
- else
- {
- sal_Int32 nPos1 = -1, nPos2 = -1;
- // If the string contains Nul-characters, then convert them to blanks!
- for (sal_Int32 k = 0; k < nLen; k++)
- {
- if (pData[k] == '\0')
- pData[k] = ' ';
-
- if (pData[k] != ' ')
- {
- if (nPos1 < 0)
- // first non-empty char position.
- nPos1 = k;
-
- // last non-empty char position.
- nPos2 = k;
- }
- }
-
- if (nPos1 < 0)
- {
- // Empty string. Skip it.
- nByteOffset += nLen;
- (_rRow->get())[i]->setNull(); // no values -> done
- continue;
- }
-
- ::rtl::OUString aStr = ::rtl::OUString::intern(pData+nPos1, nPos2-nPos1+1, m_eEncoding);
-
- switch (nType)
- {
- case DataType::DATE:
- {
- if (aStr.getLength() != nLen)
- {
- (_rRow->get())[i]->setNull();
- break;
- }
- const sal_uInt16 nYear = (sal_uInt16)aStr.copy( 0, 4 ).toInt32();
- const sal_uInt16 nMonth = (sal_uInt16)aStr.copy( 4, 2 ).toInt32();
- const sal_uInt16 nDay = (sal_uInt16)aStr.copy( 6, 2 ).toInt32();
-
- const ::com::sun::star::util::Date aDate(nDay,nMonth,nYear);
- *(_rRow->get())[i] = aDate;
- }
- break;
- case DataType::DECIMAL:
- *(_rRow->get())[i] = ORowSetValue(aStr);
- break;
- case DataType::BIT:
- {
- sal_Bool b;
- switch (* ((const char *)pData))
- {
- case 'T':
- case 'Y':
- case 'J': b = sal_True; break;
- default: b = sal_False; break;
- }
- *(_rRow->get())[i] = b;
- }
- break;
- case DataType::LONGVARBINARY:
- case DataType::BINARY:
- case DataType::LONGVARCHAR:
- {
- const long nBlockNo = aStr.toInt32(); // read blocknumber
- if (nBlockNo > 0 && m_pMemoStream) // Read data from memo-file, only if
- {
- if ( !ReadMemo(nBlockNo, (_rRow->get())[i]->get()) )
- break;
- }
- else
- (_rRow->get())[i]->setNull();
- } break;
- default:
- OSL_FAIL("Falscher Type");
- }
- (_rRow->get())[i]->setTypeKind(nType);
- }
-
- nByteOffset += nLen;
- OSL_ENSURE( nByteOffset <= m_nBufferSize ,"ByteOffset > m_nBufferSize!");
- }
- return sal_True;
-}
-//------------------------------------------------------------------
-// -------------------------------------------------------------------------
-void ODbaseTable::FileClose()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::FileClose" );
- ::osl::MutexGuard aGuard(m_aMutex);
- // if not everything has been written yet
- if (m_pMemoStream && m_pMemoStream->IsWritable())
- m_pMemoStream->Flush();
-
- delete m_pMemoStream;
- m_pMemoStream = NULL;
-
- ODbaseTable_BASE::FileClose();
-}
-// -------------------------------------------------------------------------
-sal_Bool ODbaseTable::CreateImpl()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::CreateImpl" );
- OSL_ENSURE(!m_pFileStream, "SequenceError");
-
- if ( m_pConnection->isCheckEnabled() && ::dbtools::convertName2SQLName(m_Name,::rtl::OUString()) != m_Name )
- {
- const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
- STR_SQL_NAME_ERROR,
- "$name$", m_Name
- ) );
- ::dbtools::throwGenericSQLException( sError, *this );
- }
-
- INetURLObject aURL;
- aURL.SetSmartProtocol(INET_PROT_FILE);
- String aName = getEntry(m_pConnection,m_Name);
- if(!aName.Len())
- {
- ::rtl::OUString aIdent = m_pConnection->getContent()->getIdentifier()->getContentIdentifier();
- if ( aIdent.lastIndexOf('/') != (aIdent.getLength()-1) )
- aIdent += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
- aIdent += m_Name;
- aName = aIdent.getStr();
- }
- aURL.SetURL(aName);
-
- if ( !m_pConnection->matchesExtension( aURL.getExtension() ) )
- aURL.setExtension(m_pConnection->getExtension());
-
- try
- {
- Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
- if (aContent.isDocument())
- {
- // Only if the file exists with length > 0 raise an error
- SvStream* pFileStream = createStream_simpleError( aURL.GetMainURL(INetURLObject::NO_DECODE),STREAM_READ);
-
- if (pFileStream && pFileStream->Seek(STREAM_SEEK_TO_END))
- {
- return sal_False;
- }
- delete pFileStream;
- }
- }
- catch(const Exception&) // an exception is thrown when no file exists
- {
- }
-
- sal_Bool bMemoFile = sal_False;
-
- sal_Bool bOk = CreateFile(aURL, bMemoFile);
-
- FileClose();
-
- if (!bOk)
- {
- try
- {
- Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
- aContent.executeCommand( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),bool2any( sal_True ) );
- }
- catch(const Exception&) // an exception is thrown when no file exists
- {
- }
- return sal_False;
- }
-
- if (bMemoFile)
- {
- String aExt = aURL.getExtension();
- aURL.setExtension(String::CreateFromAscii("dbt")); // extension for memo file
- Content aMemo1Content(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
-
- sal_Bool bMemoAlreadyExists = sal_False;
- try
- {
- bMemoAlreadyExists = aMemo1Content.isDocument();
- }
- catch(const Exception&) // an exception is thrown when no file exists
- {
- }
- if (bMemoAlreadyExists)
- {
- aURL.setExtension(aExt); // kill dbf file
- try
- {
- Content aMemoContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
- aMemoContent.executeCommand( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),bool2any( sal_True ) );
- }
- catch(const Exception&)
- {
-
- const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
- STR_COULD_NOT_DELETE_FILE,
- "$name$", aName
- ) );
- ::dbtools::throwGenericSQLException( sError, *this );
- }
- }
- if (!CreateMemoFile(aURL))
- {
- aURL.setExtension(aExt); // kill dbf file
- Content aMemoContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
- aMemoContent.executeCommand( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),bool2any( sal_True ) );
- return sal_False;
- }
- m_aHeader.db_typ = dBaseIIIMemo;
- }
- else
- m_aHeader.db_typ = dBaseIII;
-
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-void ODbaseTable::throwInvalidColumnType(const sal_uInt16 _nErrorId,const ::rtl::OUString& _sColumnName)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::throwInvalidColumnType" );
- try
- {
- // we have to drop the file because it is corrupted now
- DropImpl();
- }
- catch(const Exception&)
- {
- }
-
- const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
- _nErrorId,
- "$columnname$", _sColumnName
- ) );
- ::dbtools::throwGenericSQLException( sError, *this );
-}
-//------------------------------------------------------------------
-// creates in principle dBase IV file format
-sal_Bool ODbaseTable::CreateFile(const INetURLObject& aFile, sal_Bool& bCreateMemo)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::CreateFile" );
- bCreateMemo = sal_False;
- Date aDate; // current date
-
- m_pFileStream = createStream_simpleError( aFile.GetMainURL(INetURLObject::NO_DECODE),STREAM_READWRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC );
-
- if (!m_pFileStream)
- return sal_False;
-
- sal_uInt8 nDbaseType = dBaseIII;
- Reference<XIndexAccess> xColumns(getColumns(),UNO_QUERY);
- Reference<XPropertySet> xCol;
- const ::rtl::OUString sPropType = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE);
-
- try
- {
- const sal_Int32 nCount = xColumns->getCount();
- for(sal_Int32 i=0;i<nCount;++i)
- {
- xColumns->getByIndex(i) >>= xCol;
- OSL_ENSURE(xCol.is(),"This should be a column!");
-
- switch (getINT32(xCol->getPropertyValue(sPropType)))
- {
- case DataType::DOUBLE:
- case DataType::INTEGER:
- case DataType::TIMESTAMP:
- case DataType::LONGVARBINARY:
- nDbaseType = VisualFoxPro;
- i = nCount; // no more columns need to be checked
- break;
- } // switch (getINT32(xCol->getPropertyValue(sPropType)))
- }
- }
- catch ( const Exception& e )
- {
- (void)e;
-
- try
- {
- // we have to drop the file because it is corrupted now
- DropImpl();
- }
- catch(const Exception&) { }
- throw;
- }
-
- char aBuffer[21]; // write buffer
- memset(aBuffer,0,sizeof(aBuffer));
-
- m_pFileStream->Seek(0L);
- (*m_pFileStream) << (sal_uInt8) nDbaseType; // dBase format
- (*m_pFileStream) << (sal_uInt8) (aDate.GetYear() % 100); // current date
-
-
- (*m_pFileStream) << (sal_uInt8) aDate.GetMonth();
- (*m_pFileStream) << (sal_uInt8) aDate.GetDay();
- (*m_pFileStream) << 0L; // number of data records
- (*m_pFileStream) << (sal_uInt16)((m_pColumns->getCount()+1) * 32 + 1); // header information,
- // pColumns contains always an additional column
- (*m_pFileStream) << (sal_uInt16) 0; // record length will be determined later
- m_pFileStream->Write(aBuffer, 20);
-
- sal_uInt16 nRecLength = 1; // Length 1 for deleted flag
- sal_Int32 nMaxFieldLength = m_pConnection->getMetaData()->getMaxColumnNameLength();
- ::rtl::OUString aName;
- const ::rtl::OUString sPropName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
- const ::rtl::OUString sPropPrec = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION);
- const ::rtl::OUString sPropScale = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE);
-
- try
- {
- const sal_Int32 nCount = xColumns->getCount();
- for(sal_Int32 i=0;i<nCount;++i)
- {
- xColumns->getByIndex(i) >>= xCol;
- OSL_ENSURE(xCol.is(),"This should be a column!");
-
- char cTyp( 'C' );
-
- xCol->getPropertyValue(sPropName) >>= aName;
-
- ::rtl::OString aCol;
- if ( DBTypeConversion::convertUnicodeString( aName, aCol, m_eEncoding ) > nMaxFieldLength)
- {
- throwInvalidColumnType( STR_INVALID_COLUMN_NAME_LENGTH, aName );
- }
-
- (*m_pFileStream) << aCol.getStr();
- m_pFileStream->Write(aBuffer, 11 - aCol.getLength());
-
- sal_Int32 nPrecision = 0;
- xCol->getPropertyValue(sPropPrec) >>= nPrecision;
- sal_Int32 nScale = 0;
- xCol->getPropertyValue(sPropScale) >>= nScale;
-
- bool bBinary = false;
-
- switch (getINT32(xCol->getPropertyValue(sPropType)))
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- cTyp = 'C';
- break;
- case DataType::DOUBLE:
- if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency will be treated separately
- cTyp = 'Y';
- else
- cTyp = 'B';
- break;
- case DataType::INTEGER:
- cTyp = 'I';
- break;
- case DataType::TINYINT:
- case DataType::SMALLINT:
- case DataType::BIGINT:
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- case DataType::REAL:
- cTyp = 'N'; // only dBase 3 format
- break;
- case DataType::TIMESTAMP:
- cTyp = 'T';
- break;
- case DataType::DATE:
- cTyp = 'D';
- break;
- case DataType::BIT:
- cTyp = 'L';
- break;
- case DataType::LONGVARBINARY:
- bBinary = true;
- // run through
- case DataType::LONGVARCHAR:
- cTyp = 'M';
- break;
- default:
- {
- throwInvalidColumnType(STR_INVALID_COLUMN_TYPE, aName);
- }
- }
-
- (*m_pFileStream) << cTyp;
- if ( nDbaseType == VisualFoxPro )
- (*m_pFileStream) << (nRecLength-1);
- else
- m_pFileStream->Write(aBuffer, 4);
-
- switch(cTyp)
- {
- case 'C':
- OSL_ENSURE(nPrecision < 255, "ODbaseTable::Create: Column zu lang!");
- if (nPrecision > 254)
- {
- throwInvalidColumnType(STR_INVALID_COLUMN_PRECISION, aName);
- }
- (*m_pFileStream) << (sal_uInt8) Min((unsigned)nPrecision, 255U); // field length
- nRecLength = nRecLength + (sal_uInt16)::std::min((sal_uInt16)nPrecision, (sal_uInt16)255UL);
- (*m_pFileStream) << (sal_uInt8)0; // decimals
- break;
- case 'F':
- case 'N':
- OSL_ENSURE(nPrecision >= nScale,
- "ODbaseTable::Create: Feldlaenge muss groesser Nachkommastellen sein!");
- if (nPrecision < nScale)
- {
- throwInvalidColumnType(STR_INVALID_PRECISION_SCALE, aName);
- }
- if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency will be treated separately
- {
- (*m_pFileStream) << (sal_uInt8)10; // standard length
- (*m_pFileStream) << (sal_uInt8)4;
- nRecLength += 10;
- }
- else
- {
- sal_Int32 nPrec = SvDbaseConverter::ConvertPrecisionToDbase(nPrecision,nScale);
-
- (*m_pFileStream) << (sal_uInt8)( nPrec);
- (*m_pFileStream) << (sal_uInt8)nScale;
- nRecLength += (sal_uInt16)nPrec;
- }
- break;
- case 'L':
- (*m_pFileStream) << (sal_uInt8)1;
- (*m_pFileStream) << (sal_uInt8)0;
- ++nRecLength;
- break;
- case 'I':
- (*m_pFileStream) << (sal_uInt8)4;
- (*m_pFileStream) << (sal_uInt8)0;
- nRecLength += 4;
- break;
- case 'Y':
- case 'B':
- case 'T':
- case 'D':
- (*m_pFileStream) << (sal_uInt8)8;
- (*m_pFileStream) << (sal_uInt8)0;
- nRecLength += 8;
- break;
- case 'M':
- bCreateMemo = sal_True;
- (*m_pFileStream) << (sal_uInt8)10;
- (*m_pFileStream) << (sal_uInt8)0;
- nRecLength += 10;
- if ( bBinary )
- aBuffer[0] = 0x06;
- break;
- default:
- throwInvalidColumnType(STR_INVALID_COLUMN_TYPE, aName);
- }
- m_pFileStream->Write(aBuffer, 14);
- aBuffer[0] = 0x00;
- }
-
- (*m_pFileStream) << (sal_uInt8)FIELD_DESCRIPTOR_TERMINATOR; // end of header
- (*m_pFileStream) << (char)DBF_EOL;
- m_pFileStream->Seek(10L);
- (*m_pFileStream) << nRecLength; // set record length afterwards
-
- if (bCreateMemo)
- {
- m_pFileStream->Seek(0L);
- if (nDbaseType == VisualFoxPro)
- (*m_pFileStream) << (sal_uInt8) FoxProMemo;
- else
- (*m_pFileStream) << (sal_uInt8) dBaseIIIMemo;
- } // if (bCreateMemo)
- }
- catch ( const Exception& e )
- {
- (void)e;
-
- try
- {
- // we have to drop the file because it is corrupted now
- DropImpl();
- }
- catch(const Exception&) { }
- throw;
- }
- return sal_True;
-}
-
-//------------------------------------------------------------------
-// creates in principle dBase III file format
-sal_Bool ODbaseTable::CreateMemoFile(const INetURLObject& aFile)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::CreateMemoFile" );
- // filehandling macro for table creation
- m_pMemoStream = createStream_simpleError( aFile.GetMainURL(INetURLObject::NO_DECODE),STREAM_READWRITE | STREAM_SHARE_DENYWRITE);
-
- if (!m_pMemoStream)
- return sal_False;
-
- m_pMemoStream->SetStreamSize(512);
-
- m_pMemoStream->Seek(0L);
- (*m_pMemoStream) << long(1); // pointer to the first free block
-
- m_pMemoStream->Flush();
- delete m_pMemoStream;
- m_pMemoStream = NULL;
- return sal_True;
-}
-//------------------------------------------------------------------
-sal_Bool ODbaseTable::Drop_Static(const ::rtl::OUString& _sUrl,sal_Bool _bHasMemoFields,OCollection* _pIndexes )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::Drop_Static" );
- INetURLObject aURL;
- aURL.SetURL(_sUrl);
-
- sal_Bool bDropped = ::utl::UCBContentHelper::Kill(aURL.GetMainURL(INetURLObject::NO_DECODE));
-
- if(bDropped)
- {
- if (_bHasMemoFields)
- { // delete the memo fields
- aURL.setExtension(String::CreateFromAscii("dbt"));
- bDropped = ::utl::UCBContentHelper::Kill(aURL.GetMainURL(INetURLObject::NO_DECODE));
- }
-
- if(bDropped)
- {
- if(_pIndexes)
- {
- try
- {
- sal_Int32 i = _pIndexes->getCount();
- while (i)
- {
- _pIndexes->dropByIndex(--i);
- }
- }
- catch(const SQLException&)
- {
- }
- }
- aURL.setExtension(String::CreateFromAscii("inf"));
-
- // as the inf file does not necessarily exist, we aren't allowed to use UCBContentHelper::Kill
- try
- {
- ::ucbhelper::Content aDeleteContent( aURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment > () );
- aDeleteContent.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), makeAny( sal_Bool( sal_True ) ) );
- }
- catch(const Exception&)
- {
- // silently ignore this ....
- }
- }
- }
- return bDropped;
-}
-// -----------------------------------------------------------------------------
-sal_Bool ODbaseTable::DropImpl()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::DropImpl" );
- FileClose();
-
- if(!m_pIndexes)
- refreshIndexes(); // look for indexes which must be deleted as well
-
- sal_Bool bDropped = Drop_Static(getEntry(m_pConnection,m_Name),HasMemoFields(),m_pIndexes);
- if(!bDropped)
- {// we couldn't drop the table so we have to reopen it
- construct();
- if(m_pColumns)
- m_pColumns->refresh();
- }
- return bDropped;
-}
-
-//------------------------------------------------------------------
-sal_Bool ODbaseTable::InsertRow(OValueRefVector& rRow, sal_Bool bFlush,const Reference<XIndexAccess>& _xCols)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::InsertRow" );
- // fill buffer with blanks
- AllocBuffer();
- memset(m_pBuffer, 0, m_aHeader.db_slng);
- m_pBuffer[0] = ' ';
-
- // Copy new row completely:
- // ... and add at the end as new Record:
- sal_uInt32 nTempPos = m_nFilePos;
-
- m_nFilePos = (sal_uIntPtr)m_aHeader.db_anz + 1;
- sal_Bool bInsertRow = UpdateBuffer( rRow, NULL, _xCols );
- if ( bInsertRow )
- {
- sal_uInt32 nFileSize = 0, nMemoFileSize = 0;
-
- nFileSize = lcl_getFileSize(*m_pFileStream);
-
- if (HasMemoFields() && m_pMemoStream)
- {
- m_pMemoStream->Seek(STREAM_SEEK_TO_END);
- nMemoFileSize = m_pMemoStream->Tell();
- }
-
- if (!WriteBuffer())
- {
- m_pFileStream->SetStreamSize(nFileSize); // restore old size
-
- if (HasMemoFields() && m_pMemoStream)
- m_pMemoStream->SetStreamSize(nMemoFileSize); // restore old size
- m_nFilePos = nTempPos; // restore file position
- }
- else
- {
- (*m_pFileStream) << (char)DBF_EOL; // write EOL
- // raise number of datasets in the header:
- m_pFileStream->Seek( 4L );
- (*m_pFileStream) << (m_aHeader.db_anz + 1);
-
- // if AppendOnly no flush!
- if (bFlush)
- m_pFileStream->Flush();
-
- // raise number if successfully
- m_aHeader.db_anz++;
- *rRow.get()[0] = m_nFilePos; // set bookmark
- m_nFilePos = nTempPos;
- }
- }
- else
- m_nFilePos = nTempPos;
-
- return bInsertRow;
-}
-
-//------------------------------------------------------------------
-sal_Bool ODbaseTable::UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,const Reference<XIndexAccess>& _xCols)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::UpdateRow" );
- // fill buffer with blanks
- AllocBuffer();
-
- // position on desired record:
- long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng;
- m_pFileStream->Seek(nPos);
- m_pFileStream->Read((char*)m_pBuffer, m_aHeader.db_slng);
-
- sal_uInt32 nMemoFileSize( 0 );
- if (HasMemoFields() && m_pMemoStream)
- {
- m_pMemoStream->Seek(STREAM_SEEK_TO_END);
- nMemoFileSize = m_pMemoStream->Tell();
- }
- if (!UpdateBuffer(rRow, pOrgRow,_xCols) || !WriteBuffer())
- {
- if (HasMemoFields() && m_pMemoStream)
- m_pMemoStream->SetStreamSize(nMemoFileSize); // restore old size
- }
- else
- {
- m_pFileStream->Flush();
- }
- return sal_True;
-}
-
-//------------------------------------------------------------------
-sal_Bool ODbaseTable::DeleteRow(const OSQLColumns& _rCols)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::DeleteRow" );
- // Set the Delete-Flag (be it set or not):
- // Position on desired record:
- long nFilePos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng;
- m_pFileStream->Seek(nFilePos);
-
- OValueRefRow aRow = new OValueRefVector(_rCols.get().size());
-
- if (!fetchRow(aRow,_rCols,sal_True,sal_True))
- return sal_False;
-
- Reference<XPropertySet> xCol;
- ::rtl::OUString aColName;
- ::comphelper::UStringMixEqual aCase(isCaseSensitive());
- for (sal_uInt16 i = 0; i < m_pColumns->getCount(); i++)
- {
- Reference<XPropertySet> xIndex = isUniqueByColumnName(i);
- if (xIndex.is())
- {
- ::cppu::extractInterface(xCol,m_pColumns->getByIndex(i));
- OSL_ENSURE(xCol.is(),"ODbaseTable::DeleteRow column is null!");
- if(xCol.is())
- {
- xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName;
-
- Reference<XUnoTunnel> xTunnel(xIndex,UNO_QUERY);
- OSL_ENSURE(xTunnel.is(),"No TunnelImplementation!");
- ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) );
- OSL_ENSURE(pIndex,"ODbaseTable::DeleteRow: No Index returned!");
-
- OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin();
- sal_Int32 nPos = 1;
- for(;aIter != _rCols.get().end();++aIter,++nPos)
- {
- if(aCase(getString((*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME))),aColName))
- break;
- }
- if (aIter == _rCols.get().end())
- continue;
-
- pIndex->Delete(m_nFilePos,*(aRow->get())[nPos]);
- }
- }
- }
-
- m_pFileStream->Seek(nFilePos);
- (*m_pFileStream) << (sal_uInt8)'*'; // mark the row in the table as deleted
- m_pFileStream->Flush();
- return sal_True;
-}
-// -------------------------------------------------------------------------
-Reference<XPropertySet> ODbaseTable::isUniqueByColumnName(sal_Int32 _nColumnPos)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::isUniqueByColumnName" );
- if(!m_pIndexes)
- refreshIndexes();
- if(m_pIndexes->hasElements())
- {
- Reference<XPropertySet> xCol;
- m_pColumns->getByIndex(_nColumnPos) >>= xCol;
- OSL_ENSURE(xCol.is(),"ODbaseTable::isUniqueByColumnName column is null!");
- ::rtl::OUString sColName;
- xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sColName;
-
- Reference<XPropertySet> xIndex;
- for(sal_Int32 i=0;i<m_pIndexes->getCount();++i)
- {
- ::cppu::extractInterface(xIndex,m_pIndexes->getByIndex(i));
- if(xIndex.is() && getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE))))
- {
- Reference<XNameAccess> xCols(Reference<XColumnsSupplier>(xIndex,UNO_QUERY)->getColumns());
- if(xCols->hasByName(sColName))
- return xIndex;
-
- }
- }
- }
- return Reference<XPropertySet>();
-}
-//------------------------------------------------------------------
-double toDouble(const ByteString& rString)
-{
- return ::rtl::math::stringToDouble( rString, '.', ',', NULL, NULL );
-}
-
-//------------------------------------------------------------------
-sal_Bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const Reference<XIndexAccess>& _xCols)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::UpdateBuffer" );
- OSL_ENSURE(m_pBuffer,"Buffer is NULL!");
- if ( !m_pBuffer )
- return sal_False;
- sal_Int32 nByteOffset = 1;
-
- // Update fields:
- Reference<XPropertySet> xCol;
- Reference<XPropertySet> xIndex;
- sal_uInt16 i;
- ::rtl::OUString aColName;
- const sal_Int32 nColumnCount = m_pColumns->getCount();
- ::std::vector< Reference<XPropertySet> > aIndexedCols(nColumnCount);
-
- ::comphelper::UStringMixEqual aCase(isCaseSensitive());
-
- Reference<XIndexAccess> xColumns = m_pColumns;
- // first search a key that exist already in the table
- for (i = 0; i < nColumnCount; ++i)
- {
- sal_Int32 nPos = i;
- if(_xCols != xColumns)
- {
- m_pColumns->getByIndex(i) >>= xCol;
- OSL_ENSURE(xCol.is(),"ODbaseTable::UpdateBuffer column is null!");
- xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName;
-
- for(nPos = 0;nPos<_xCols->getCount();++nPos)
- {
- Reference<XPropertySet> xFindCol;
- ::cppu::extractInterface(xFindCol,_xCols->getByIndex(nPos));
- OSL_ENSURE(xFindCol.is(),"ODbaseTable::UpdateBuffer column is null!");
- if(aCase(getString(xFindCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))),aColName))
- break;
- }
- if (nPos >= _xCols->getCount())
- continue;
- }
-
- ++nPos;
- xIndex = isUniqueByColumnName(i);
- aIndexedCols[i] = xIndex;
- if (xIndex.is())
- {
- // first check if the value is different to the old one and when if it conform to the index
- if(pOrgRow.is() && (rRow.get()[nPos]->getValue().isNull() || rRow.get()[nPos] == (pOrgRow->get())[nPos]))
- continue;
- else
- {
- Reference<XUnoTunnel> xTunnel(xIndex,UNO_QUERY);
- OSL_ENSURE(xTunnel.is(),"No TunnelImplementation!");
- ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) );
- OSL_ENSURE(pIndex,"ODbaseTable::UpdateBuffer: No Index returned!");
-
- if (pIndex->Find(0,*rRow.get()[nPos]))
- {
- // There is no unique value
- if ( !aColName.getLength() )
- {
- m_pColumns->getByIndex(i) >>= xCol;
- OSL_ENSURE(xCol.is(),"ODbaseTable::UpdateBuffer column is null!");
- xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName;
- xCol.clear();
- } // if ( !aColName.getLength() )
- const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
- STR_DUPLICATE_VALUE_IN_COLUMN
- ,"$columnname$", aColName
- ) );
- ::dbtools::throwGenericSQLException( sError, *this );
- }
- }
- }
- }
-
- // when we are here there is no double key in the table
-
- for (i = 0; i < nColumnCount && nByteOffset <= m_nBufferSize ; ++i)
- {
- // Lengths for each data type:
- OSL_ENSURE(i < m_aPrecisions.size(),"Illegal index!");
- sal_Int32 nLen = 0;
- sal_Int32 nType = 0;
- sal_Int32 nScale = 0;
- if ( i < m_aPrecisions.size() )
- {
- nLen = m_aPrecisions[i];
- nType = m_aTypes[i];
- nScale = m_aScales[i];
- }
- else
- {
- m_pColumns->getByIndex(i) >>= xCol;
- if ( xCol.is() )
- {
- xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nLen;
- xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nType;
- xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nScale;
- }
- }
-
- bool bSetZero = false;
- switch (nType)
- {
- case DataType::INTEGER:
- case DataType::DOUBLE:
- case DataType::TIMESTAMP:
- bSetZero = true;
- case DataType::LONGVARBINARY:
- case DataType::DATE:
- case DataType::BIT:
- case DataType::LONGVARCHAR:
- nLen = m_aRealFieldLengths[i];
- break;
- case DataType::DECIMAL:
- nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,nScale);
- break; // The sign and the comma
- default:
- break;
-
- } // switch (nType)
-
- sal_Int32 nPos = i;
- if(_xCols != xColumns)
- {
- m_pColumns->getByIndex(i) >>= xCol;
- OSL_ENSURE(xCol.is(),"ODbaseTable::UpdateBuffer column is null!");
- xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName;
- for(nPos = 0;nPos<_xCols->getCount();++nPos)
- {
- Reference<XPropertySet> xFindCol;
- ::cppu::extractInterface(xFindCol,_xCols->getByIndex(nPos));
- if(aCase(getString(xFindCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))),aColName))
- break;
- }
- if (nPos >= _xCols->getCount())
- {
- nByteOffset += nLen;
- continue;
- }
- }
-
-
-
- ++nPos; // the row values start at 1
- // If the variable is bound at all?
- if ( !rRow.get()[nPos]->isBound() )
- {
- // No - the next field.
- nByteOffset += nLen;
- continue;
- }
- if (aIndexedCols[i].is())
- {
- Reference<XUnoTunnel> xTunnel(aIndexedCols[i],UNO_QUERY);
- OSL_ENSURE(xTunnel.is(),"No TunnelImplementation!");
- ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) );
- OSL_ENSURE(pIndex,"ODbaseTable::UpdateBuffer: No Index returned!");
- // Update !!
- if (pOrgRow.is() && !rRow.get()[nPos]->getValue().isNull() )
- pIndex->Update(m_nFilePos,*(pOrgRow->get())[nPos],*rRow.get()[nPos]);
- else
- pIndex->Insert(m_nFilePos,*rRow.get()[nPos]);
- }
-
- char* pData = (char *)(m_pBuffer + nByteOffset);
- if (rRow.get()[nPos]->getValue().isNull())
- {
- if ( bSetZero )
- memset(pData,0,nLen); // Clear to NULL
- else
- memset(pData,' ',nLen); // Clear to NULL
- nByteOffset += nLen;
- OSL_ENSURE( nByteOffset <= m_nBufferSize ,"ByteOffset > m_nBufferSize!");
- continue;
- }
-
- try
- {
- switch (nType)
- {
- case DataType::TIMESTAMP:
- {
- sal_Int32 nJulianDate = 0, nJulianTime = 0;
- lcl_CalcJulDate(nJulianDate,nJulianTime,rRow.get()[nPos]->getValue());
- // Exactly 8 bytes to copy:
- memcpy(pData,&nJulianDate,4);
- memcpy(pData+4,&nJulianTime,4);
- }
- break;
- case DataType::DATE:
- {
- ::com::sun::star::util::Date aDate;
- if(rRow.get()[nPos]->getValue().getTypeKind() == DataType::DOUBLE)
- aDate = ::dbtools::DBTypeConversion::toDate(rRow.get()[nPos]->getValue().getDouble());
- else
- aDate = rRow.get()[nPos]->getValue();
- char s[9];
- snprintf(s,
- sizeof(s),
- "%04d%02d%02d",
- (int)aDate.Year,
- (int)aDate.Month,
- (int)aDate.Day);
-
- // Exactly 8 bytes to copy:
- strncpy(pData,s,sizeof s - 1);
- } break;
- case DataType::INTEGER:
- {
- sal_Int32 nValue = rRow.get()[nPos]->getValue();
- memcpy(pData,&nValue,nLen);
- }
- break;
- case DataType::DOUBLE:
- {
- const double d = rRow.get()[nPos]->getValue();
- m_pColumns->getByIndex(i) >>= xCol;
-
- if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency is treated separately
- {
- sal_Int64 nValue = 0;
- if ( m_aScales[i] )
- nValue = (sal_Int64)(d * pow(10.0,(int)m_aScales[i]));
- else
- nValue = (sal_Int64)(d);
- memcpy(pData,&nValue,nLen);
- } // if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency is treated separately
- else
- memcpy(pData,&d,nLen);
- }
- break;
- case DataType::DECIMAL:
- {
- memset(pData,' ',nLen); // Clear to NULL
-
- const double n = rRow.get()[nPos]->getValue();
-
- // one, because const_cast GetFormatPrecision on SvNumberFormat is not constant,
- // even though it really could and should be
- const ByteString aDefaultValue( ::rtl::math::doubleToString( n, rtl_math_StringFormat_F, nScale, '.', NULL, 0));
- const sal_Int32 nValueLen = aDefaultValue.Len();
- if ( nValueLen <= nLen )
- {
- // Write value right-justified, padded with blanks to the left.
- memcpy(pData+nLen-nValueLen,aDefaultValue.GetBuffer(),nValueLen);
- // write the resulting double back
- *rRow.get()[nPos] = toDouble(aDefaultValue);
- }
- else
- {
- m_pColumns->getByIndex(i) >>= xCol;
- OSL_ENSURE(xCol.is(),"ODbaseTable::UpdateBuffer column is null!");
- xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName;
- ::std::list< ::std::pair<const sal_Char* , ::rtl::OUString > > aStringToSubstitutes;
- aStringToSubstitutes.push_back(::std::pair<const sal_Char* , ::rtl::OUString >("$columnname$", aColName));
- aStringToSubstitutes.push_back(::std::pair<const sal_Char* , ::rtl::OUString >("$precision$", String::CreateFromInt32(nLen)));
- aStringToSubstitutes.push_back(::std::pair<const sal_Char* , ::rtl::OUString >("$scale$", String::CreateFromInt32(nScale)));
- aStringToSubstitutes.push_back(::std::pair<const sal_Char* , ::rtl::OUString >("$value$", ::rtl::OStringToOUString(aDefaultValue,RTL_TEXTENCODING_UTF8)));
-
- const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
- STR_INVALID_COLUMN_DECIMAL_VALUE
- ,aStringToSubstitutes
- ) );
- ::dbtools::throwGenericSQLException( sError, *this );
- }
- } break;
- case DataType::BIT:
- *pData = rRow.get()[nPos]->getValue().getBool() ? 'T' : 'F';
- break;
- case DataType::LONGVARBINARY:
- case DataType::LONGVARCHAR:
- {
- char cNext = pData[nLen]; // Mark's scratch and replaced by 0
- pData[nLen] = '\0'; // This is because the buffer is always a sign of greater ...
-
- sal_uIntPtr nBlockNo = strtol((const char *)pData,NULL,10); // Block number read
-
- // Next initial character restore again:
- pData[nLen] = cNext;
- if (!m_pMemoStream || !WriteMemo(rRow.get()[nPos]->get(), nBlockNo))
- break;
-
- ByteString aStr;
- ByteString aBlock(rtl::OString::valueOf(static_cast<sal_Int32>(nBlockNo)));
- aStr.Expand(static_cast<sal_uInt16>(nLen - aBlock.Len()), '0' );
- aStr += aBlock;
- // Copy characters:
- memset(pData,' ',nLen); // Clear to NULL
- memcpy(pData, aStr.GetBuffer(), nLen);
- } break;
- default:
- {
- memset(pData,' ',nLen); // Clear to NULL
-
- ::rtl::OUString sStringToWrite( rRow.get()[nPos]->getValue().getString() );
-
- // convert the string, using the connection's encoding
- ::rtl::OString sEncoded;
-
- DBTypeConversion::convertUnicodeStringToLength( sStringToWrite, sEncoded, nLen, m_eEncoding );
- memcpy( pData, sEncoded.getStr(), sEncoded.getLength() );
-
- }
- break;
- }
- }
- catch( const SQLException& )
- {
- throw;
- }
- catch ( const Exception& )
- {
- m_pColumns->getByIndex(i) >>= xCol;
- OSL_ENSURE( xCol.is(), "ODbaseTable::UpdateBuffer column is null!" );
- if ( xCol.is() )
- xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName;
-
- const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
- STR_INVALID_COLUMN_VALUE,
- "$columnname$", aColName
- ) );
- ::dbtools::throwGenericSQLException( sError, *this );
- }
- // And more ...
- nByteOffset += nLen;
- OSL_ENSURE( nByteOffset <= m_nBufferSize ,"ByteOffset > m_nBufferSize!");
- }
- return sal_True;
-}
-
-// -----------------------------------------------------------------------------
-sal_Bool ODbaseTable::WriteMemo(ORowSetValue& aVariable, sal_uIntPtr& rBlockNr)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::WriteMemo" );
- // if the BlockNo 0 is given, the block will be appended at the end
- sal_uIntPtr nSize = 0;
- ::rtl::OString aStr;
- ::com::sun::star::uno::Sequence<sal_Int8> aValue;
- sal_uInt8 nHeader[4];
- const bool bBinary = aVariable.getTypeKind() == DataType::LONGVARBINARY && m_aMemoHeader.db_typ == MemoFoxPro;
- if ( bBinary )
- {
- aValue = aVariable.getSequence();
- nSize = aValue.getLength();
- }
- else
- {
- nSize = DBTypeConversion::convertUnicodeString( aVariable.getString(), aStr, m_eEncoding );
- }
-
- // append or overwrite
- sal_Bool bAppend = rBlockNr == 0;
-
- if (!bAppend)
- {
- switch (m_aMemoHeader.db_typ)
- {
- case MemodBaseIII: // dBase III-Memofield, ends with 2 * Ctrl-Z
- bAppend = nSize > (512 - 2);
- break;
- case MemoFoxPro:
- case MemodBaseIV: // dBase IV-Memofield with length
- {
- char sHeader[4];
- m_pMemoStream->Seek(rBlockNr * m_aMemoHeader.db_size);
- m_pMemoStream->SeekRel(4L);
- m_pMemoStream->Read(sHeader,4);
-
- sal_uIntPtr nOldSize;
- if (m_aMemoHeader.db_typ == MemoFoxPro)
- nOldSize = ((((unsigned char)sHeader[0]) * 256 +
- (unsigned char)sHeader[1]) * 256 +
- (unsigned char)sHeader[2]) * 256 +
- (unsigned char)sHeader[3];
- else
- nOldSize = ((((unsigned char)sHeader[3]) * 256 +
- (unsigned char)sHeader[2]) * 256 +
- (unsigned char)sHeader[1]) * 256 +
- (unsigned char)sHeader[0] - 8;
-
- // fits the new length in the used blocks
- sal_uIntPtr nUsedBlocks = ((nSize + 8) / m_aMemoHeader.db_size) + (((nSize + 8) % m_aMemoHeader.db_size > 0) ? 1 : 0),
- nOldUsedBlocks = ((nOldSize + 8) / m_aMemoHeader.db_size) + (((nOldSize + 8) % m_aMemoHeader.db_size > 0) ? 1 : 0);
- bAppend = nUsedBlocks > nOldUsedBlocks;
- }
- }
- }
-
- if (bAppend)
- {
- sal_uIntPtr nStreamSize = m_pMemoStream->Seek(STREAM_SEEK_TO_END);
- // fill last block
- rBlockNr = (nStreamSize / m_aMemoHeader.db_size) + ((nStreamSize % m_aMemoHeader.db_size) > 0 ? 1 : 0);
-
- m_pMemoStream->SetStreamSize(rBlockNr * m_aMemoHeader.db_size);
- m_pMemoStream->Seek(STREAM_SEEK_TO_END);
- }
- else
- {
- m_pMemoStream->Seek(rBlockNr * m_aMemoHeader.db_size);
- }
-
- switch (m_aMemoHeader.db_typ)
- {
- case MemodBaseIII: // dBase III-Memofield, ends with Ctrl-Z
- {
- const char cEOF = (char) DBF_EOL;
- nSize++;
- m_pMemoStream->Write( aStr.getStr(), aStr.getLength() );
- (*m_pMemoStream) << cEOF << cEOF;
- } break;
- case MemoFoxPro:
- case MemodBaseIV: // dBase IV-Memofeld with length
- {
- if ( MemodBaseIV == m_aMemoHeader.db_typ )
- (*m_pMemoStream) << (sal_uInt8)0xFF
- << (sal_uInt8)0xFF
- << (sal_uInt8)0x08;
- else
- (*m_pMemoStream) << (sal_uInt8)0x00
- << (sal_uInt8)0x00
- << (sal_uInt8)0x00;
-
- sal_uInt32 nWriteSize = nSize;
- if (m_aMemoHeader.db_typ == MemoFoxPro)
- {
- if ( bBinary )
- (*m_pMemoStream) << (sal_uInt8) 0x00; // Picture
- else
- (*m_pMemoStream) << (sal_uInt8) 0x01; // Memo
- for (int i = 4; i > 0; nWriteSize >>= 8)
- nHeader[--i] = (sal_uInt8) (nWriteSize % 256);
- }
- else
- {
- (*m_pMemoStream) << (sal_uInt8) 0x00;
- nWriteSize += 8;
- for (int i = 0; i < 4; nWriteSize >>= 8)
- nHeader[i++] = (sal_uInt8) (nWriteSize % 256);
- }
-
- m_pMemoStream->Write(nHeader,4);
- if ( bBinary )
- m_pMemoStream->Write( aValue.getConstArray(), aValue.getLength() );
- else
- m_pMemoStream->Write( aStr.getStr(), aStr.getLength() );
- m_pMemoStream->Flush();
- }
- }
-
-
- // Write the new block number
- if (bAppend)
- {
- sal_uIntPtr nStreamSize = m_pMemoStream->Seek(STREAM_SEEK_TO_END);
- m_aMemoHeader.db_next = (nStreamSize / m_aMemoHeader.db_size) + ((nStreamSize % m_aMemoHeader.db_size) > 0 ? 1 : 0);
-
- // Write the new block number
- m_pMemoStream->Seek(0L);
- (*m_pMemoStream) << m_aMemoHeader.db_next;
- m_pMemoStream->Flush();
- }
- return sal_True;
-}
-
-// -----------------------------------------------------------------------------
-// XAlterTable
-void SAL_CALL ODbaseTable::alterColumnByName( const ::rtl::OUString& colName, const Reference< XPropertySet >& descriptor ) throw(SQLException, NoSuchElementException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::alterColumnByName" );
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed);
-
-
- Reference<XDataDescriptorFactory> xOldColumn;
- m_pColumns->getByName(colName) >>= xOldColumn;
-
- alterColumn(m_pColumns->findColumn(colName)-1,descriptor,xOldColumn);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL ODbaseTable::alterColumnByIndex( sal_Int32 index, const Reference< XPropertySet >& descriptor ) throw(SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::alterColumnByIndex" );
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed);
-
- if(index < 0 || index >= m_pColumns->getCount())
- throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this);
-
- Reference<XDataDescriptorFactory> xOldColumn;
- m_pColumns->getByIndex(index) >>= xOldColumn;
- alterColumn(index,descriptor,xOldColumn);
-}
-// -----------------------------------------------------------------------------
-void ODbaseTable::alterColumn(sal_Int32 index,
- const Reference< XPropertySet >& descriptor ,
- const Reference< XDataDescriptorFactory >& xOldColumn )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::alterColumn" );
- if(index < 0 || index >= m_pColumns->getCount())
- throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this);
-
- ODbaseTable* pNewTable = NULL;
- try
- {
- OSL_ENSURE(descriptor.is(),"ODbaseTable::alterColumn: descriptor can not be null!");
- // creates a copy of the the original column and copy all properties from descriptor in xCopyColumn
- Reference<XPropertySet> xCopyColumn;
- if(xOldColumn.is())
- xCopyColumn = xOldColumn->createDataDescriptor();
- else
- xCopyColumn = new OColumn(getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers());
-
- ::comphelper::copyProperties(descriptor,xCopyColumn);
-
- // creates a temp file
-
- String sTempName = createTempFile();
-
- pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection));
- Reference<XPropertySet> xHoldTable = pNewTable;
- pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(::rtl::OUString(sTempName)));
- Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY);
- OSL_ENSURE(xAppend.is(),"ODbaseTable::alterColumn: No XAppend interface!");
-
- // copy the structure
- sal_Int32 i=0;
- for(;i < index;++i)
- {
- Reference<XPropertySet> xProp;
- m_pColumns->getByIndex(i) >>= xProp;
- Reference<XDataDescriptorFactory> xColumn(xProp,UNO_QUERY);
- Reference<XPropertySet> xCpy;
- if(xColumn.is())
- xCpy = xColumn->createDataDescriptor();
- else
- xCpy = new OColumn(getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers());
- ::comphelper::copyProperties(xProp,xCpy);
- xAppend->appendByDescriptor(xCpy);
- }
- ++i; // now insert our new column
- xAppend->appendByDescriptor(xCopyColumn);
-
- for(;i < m_pColumns->getCount();++i)
- {
- Reference<XPropertySet> xProp;
- m_pColumns->getByIndex(i) >>= xProp;
- Reference<XDataDescriptorFactory> xColumn(xProp,UNO_QUERY);
- Reference<XPropertySet> xCpy;
- if(xColumn.is())
- xCpy = xColumn->createDataDescriptor();
- else
- xCpy = new OColumn(getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers());
- ::comphelper::copyProperties(xProp,xCpy);
- xAppend->appendByDescriptor(xCpy);
- }
-
- // construct the new table
- if(!pNewTable->CreateImpl())
- {
- const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
- STR_COLUMN_NOT_ALTERABLE,
- "$columnname$", ::comphelper::getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))
- ) );
- ::dbtools::throwGenericSQLException( sError, *this );
- }
-
- pNewTable->construct();
-
- // copy the data
- copyData(pNewTable,0);
-
- // now drop the old one
- if( DropImpl() ) // we don't want to delete the memo columns too
- {
- // rename the new one to the old one
- pNewTable->renameImpl(m_Name);
- // release the temp file
- pNewTable = NULL;
- ::comphelper::disposeComponent(xHoldTable);
- }
- else
- {
- pNewTable = NULL;
- }
- FileClose();
- construct();
- if(m_pColumns)
- m_pColumns->refresh();
-
- }
- catch(const SQLException&)
- {
- throw;
- }
- catch(const Exception&)
- {
- OSL_FAIL("ODbaseTable::alterColumn: Exception occurred!");
- throw;
- }
-}
-// -----------------------------------------------------------------------------
-Reference< XDatabaseMetaData> ODbaseTable::getMetaData() const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getMetaData" );
- return getConnection()->getMetaData();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL ODbaseTable::rename( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::rename" );
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed);
- if(m_pTables && m_pTables->hasByName(newName))
- throw ElementExistException(newName,*this);
-
-
- renameImpl(newName);
-
- ODbaseTable_BASE::rename(newName);
-
- construct();
- if(m_pColumns)
- m_pColumns->refresh();
-}
-namespace
-{
- void renameFile(OConnection* _pConenction,const ::rtl::OUString& oldName,
- const ::rtl::OUString& newName,const String& _sExtension)
- {
- String aName = ODbaseTable::getEntry(_pConenction,oldName);
- if(!aName.Len())
- {
- ::rtl::OUString aIdent = _pConenction->getContent()->getIdentifier()->getContentIdentifier();
- if ( aIdent.lastIndexOf('/') != (aIdent.getLength()-1) )
- aIdent += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
- aIdent += oldName;
- aName = aIdent;
- }
- INetURLObject aURL;
- aURL.SetURL(aName);
-
- aURL.setExtension( _sExtension );
- String sNewName(newName);
- sNewName.AppendAscii(".");
- sNewName += _sExtension;
-
- try
- {
- Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
-
- Sequence< PropertyValue > aProps( 1 );
- aProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title"));
- aProps[0].Handle = -1; // n/a
- aProps[0].Value = makeAny( ::rtl::OUString(sNewName) );
- Sequence< Any > aValues;
- aContent.executeCommand( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("setPropertyValues")),makeAny(aProps) ) >>= aValues;
- if(aValues.getLength() && aValues[0].hasValue())
- throw Exception();
- }
- catch(const Exception&)
- {
- throw ElementExistException(newName,NULL);
- }
- }
-}
-// -------------------------------------------------------------------------
-void SAL_CALL ODbaseTable::renameImpl( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getEntry" );
- ::osl::MutexGuard aGuard(m_aMutex);
-
- FileClose();
-
-
- renameFile(m_pConnection,m_Name,newName,m_pConnection->getExtension());
- if ( HasMemoFields() )
- { // delete the memo fields
- String sExt = String::CreateFromAscii("dbt");
- renameFile(m_pConnection,m_Name,newName,sExt);
- }
-}
-// -----------------------------------------------------------------------------
-void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::addColumn" );
- String sTempName = createTempFile();
-
- ODbaseTable* pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection));
- Reference< XPropertySet > xHold = pNewTable;
- pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(::rtl::OUString(sTempName)));
- {
- Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY);
- sal_Bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers();
- // copy the structure
- for(sal_Int32 i=0;i < m_pColumns->getCount();++i)
- {
- Reference<XPropertySet> xProp;
- m_pColumns->getByIndex(i) >>= xProp;
- Reference<XDataDescriptorFactory> xColumn(xProp,UNO_QUERY);
- Reference<XPropertySet> xCpy;
- if(xColumn.is())
- xCpy = xColumn->createDataDescriptor();
- else
- {
- xCpy = new OColumn(bCase);
- ::comphelper::copyProperties(xProp,xCpy);
- }
-
- xAppend->appendByDescriptor(xCpy);
- }
- Reference<XPropertySet> xCpy = new OColumn(bCase);
- ::comphelper::copyProperties(_xNewColumn,xCpy);
- xAppend->appendByDescriptor(xCpy);
- }
-
- // construct the new table
- if(!pNewTable->CreateImpl())
- {
- const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
- STR_COLUMN_NOT_ADDABLE,
- "$columnname$", ::comphelper::getString(_xNewColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))
- ) );
- ::dbtools::throwGenericSQLException( sError, *this );
- }
-
- sal_Bool bAlreadyDroped = sal_False;
- try
- {
- pNewTable->construct();
- // copy the data
- copyData(pNewTable,pNewTable->m_pColumns->getCount());
- // drop the old table
- if(DropImpl())
- {
- bAlreadyDroped = sal_True;
- pNewTable->renameImpl(m_Name);
- // release the temp file
- }
- xHold = pNewTable = NULL;
-
- FileClose();
- construct();
- if(m_pColumns)
- m_pColumns->refresh();
- }
- catch(const SQLException&)
- {
- // here we know that the old table wasn't droped before
- if(!bAlreadyDroped)
- xHold = pNewTable = NULL;
-
- throw;
- }
-}
-// -----------------------------------------------------------------------------
-void ODbaseTable::dropColumn(sal_Int32 _nPos)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::dropColumn" );
- String sTempName = createTempFile();
-
- ODbaseTable* pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection));
- Reference< XPropertySet > xHold = pNewTable;
- pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(::rtl::OUString(sTempName)));
- {
- Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY);
- sal_Bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers();
- // copy the structure
- for(sal_Int32 i=0;i < m_pColumns->getCount();++i)
- {
- if(_nPos != i)
- {
- Reference<XPropertySet> xProp;
- m_pColumns->getByIndex(i) >>= xProp;
- Reference<XDataDescriptorFactory> xColumn(xProp,UNO_QUERY);
- Reference<XPropertySet> xCpy;
- if(xColumn.is())
- xCpy = xColumn->createDataDescriptor();
- else
- {
- xCpy = new OColumn(bCase);
- ::comphelper::copyProperties(xProp,xCpy);
- }
- xAppend->appendByDescriptor(xCpy);
- }
- }
- }
-
- // construct the new table
- if(!pNewTable->CreateImpl())
- {
- xHold = pNewTable = NULL;
- const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
- STR_COLUMN_NOT_DROP,
- "$position$", ::rtl::OUString::valueOf(_nPos)
- ) );
- ::dbtools::throwGenericSQLException( sError, *this );
- }
- pNewTable->construct();
- // copy the data
- copyData(pNewTable,_nPos);
- // drop the old table
- if(DropImpl())
- pNewTable->renameImpl(m_Name);
- // release the temp file
-
- xHold = pNewTable = NULL;
-
- FileClose();
- construct();
-}
-// -----------------------------------------------------------------------------
-String ODbaseTable::createTempFile()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::createTempFile" );
- ::rtl::OUString aIdent = m_pConnection->getContent()->getIdentifier()->getContentIdentifier();
- if ( aIdent.lastIndexOf('/') != (aIdent.getLength()-1) )
- aIdent += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
- String sTempName(aIdent);
- String sExt;
- sExt.AssignAscii(".");
- sExt += m_pConnection->getExtension();
-
- String sName(m_Name);
- TempFile aTempFile(sName,&sExt,&sTempName);
- if(!aTempFile.IsValid())
- getConnection()->throwGenericSQLException(STR_COULD_NOT_ALTER_TABLE,*this);
-
- INetURLObject aURL;
- aURL.SetSmartProtocol(INET_PROT_FILE);
- aURL.SetURL(aTempFile.GetURL());
-
- String sNewName(aURL.getName());
- sNewName.Erase(sNewName.Len() - sExt.Len());
- return sNewName;
-}
-// -----------------------------------------------------------------------------
-void ODbaseTable::copyData(ODbaseTable* _pNewTable,sal_Int32 _nPos)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::copyData" );
- sal_Int32 nPos = _nPos + 1; // +1 because we always have the bookmark clumn as well
- OValueRefRow aRow = new OValueRefVector(m_pColumns->getCount());
- OValueRefRow aInsertRow;
- if(_nPos)
- {
- aInsertRow = new OValueRefVector(_pNewTable->m_pColumns->getCount());
- ::std::for_each(aInsertRow->get().begin(),aInsertRow->get().end(),TSetRefBound(sal_True));
- }
- else
- aInsertRow = aRow;
-
- // we only have to bind the values which we need to copy into the new table
- ::std::for_each(aRow->get().begin(),aRow->get().end(),TSetRefBound(sal_True));
- if(_nPos && (_nPos < (sal_Int32)aRow->get().size()))
- (aRow->get())[nPos]->setBound(sal_False);
-
-
- sal_Bool bOk = sal_True;
- sal_Int32 nCurPos;
- OValueRefVector::Vector::iterator aIter;
- for(sal_uInt32 nRowPos = 0; nRowPos < m_aHeader.db_anz;++nRowPos)
- {
- bOk = seekRow( IResultSetHelper::BOOKMARK, nRowPos+1, nCurPos );
- if ( bOk )
- {
- bOk = fetchRow( aRow, *m_aColumns, sal_True, sal_True);
- if ( bOk && !aRow->isDeleted() ) // copy only not deleted rows
- {
- // special handling when pos == 0 then we don't have to distinguish between the two rows
- if(_nPos)
- {
- aIter = aRow->get().begin()+1;
- sal_Int32 nCount = 1;
- for(OValueRefVector::Vector::iterator aInsertIter = aInsertRow->get().begin()+1; aIter != aRow->get().end() && aInsertIter != aInsertRow->get().end();++aIter,++nCount)
- {
- if(nPos != nCount)
- {
- (*aInsertIter)->setValue( (*aIter)->getValue() );
- ++aInsertIter;
- }
- }
- }
- bOk = _pNewTable->InsertRow(*aInsertRow,sal_True,_pNewTable->m_pColumns);
- OSL_ENSURE(bOk,"Row could not be inserted!");
- }
- else
- OSL_ENSURE(bOk,"Row could not be fetched!");
- }
- else
- {
- OSL_ASSERT(0);
- }
- } // for(sal_uInt32 nRowPos = 0; nRowPos < m_aHeader.db_anz;++nRowPos)
-}
-// -----------------------------------------------------------------------------
-void ODbaseTable::throwInvalidDbaseFormat()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::throwInvalidDbaseFormat" );
- FileClose();
- // no dbase file
-
- const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
- STR_INVALID_DBASE_FILE,
- "$filename$", getEntry(m_pConnection,m_Name)
- ) );
- ::dbtools::throwGenericSQLException( sError, *this );
-}
-// -----------------------------------------------------------------------------
-void ODbaseTable::refreshHeader()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::refreshHeader" );
- if ( m_aHeader.db_anz == 0 )
- readHeader();
-}
-//------------------------------------------------------------------
-sal_Bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::seekRow" );
- // ----------------------------------------------------------
- // prepare positioning:
- OSL_ENSURE(m_pFileStream,"ODbaseTable::seekRow: FileStream is NULL!");
-
- sal_uInt32 nNumberOfRecords = (sal_uInt32)m_aHeader.db_anz;
- sal_uInt32 nTempPos = m_nFilePos;
- m_nFilePos = nCurPos;
-
- switch(eCursorPosition)
- {
- case IResultSetHelper::NEXT:
- ++m_nFilePos;
- break;
- case IResultSetHelper::PRIOR:
- if (m_nFilePos > 0)
- --m_nFilePos;
- break;
- case IResultSetHelper::FIRST:
- m_nFilePos = 1;
- break;
- case IResultSetHelper::LAST:
- m_nFilePos = nNumberOfRecords;
- break;
- case IResultSetHelper::RELATIVE:
- m_nFilePos = (((sal_Int32)m_nFilePos) + nOffset < 0) ? 0L
- : (sal_uInt32)(((sal_Int32)m_nFilePos) + nOffset);
- break;
- case IResultSetHelper::ABSOLUTE:
- case IResultSetHelper::BOOKMARK:
- m_nFilePos = (sal_uInt32)nOffset;
- break;
- }
-
- if (m_nFilePos > (sal_Int32)nNumberOfRecords)
- m_nFilePos = (sal_Int32)nNumberOfRecords + 1;
-
- if (m_nFilePos == 0 || m_nFilePos == (sal_Int32)nNumberOfRecords + 1)
- goto Error;
- else
- {
- sal_uInt16 nEntryLen = m_aHeader.db_slng;
-
- OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position");
- sal_Int32 nPos = m_aHeader.db_kopf + (sal_Int32)(m_nFilePos-1) * nEntryLen;
-
- m_pFileStream->Seek(nPos);
- if (m_pFileStream->GetError() != ERRCODE_NONE)
- goto Error;
-
- m_pFileStream->Read((char*)m_pBuffer, nEntryLen);
- if (m_pFileStream->GetError() != ERRCODE_NONE)
- goto Error;
- }
- goto End;
-
-Error:
- switch(eCursorPosition)
- {
- case IResultSetHelper::PRIOR:
- case IResultSetHelper::FIRST:
- m_nFilePos = 0;
- break;
- case IResultSetHelper::LAST:
- case IResultSetHelper::NEXT:
- case IResultSetHelper::ABSOLUTE:
- case IResultSetHelper::RELATIVE:
- if (nOffset > 0)
- m_nFilePos = nNumberOfRecords + 1;
- else if (nOffset < 0)
- m_nFilePos = 0;
- break;
- case IResultSetHelper::BOOKMARK:
- m_nFilePos = nTempPos; // last position
- }
- return sal_False;
-
-End:
- nCurPos = m_nFilePos;
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-sal_Bool ODbaseTable::ReadMemo(sal_uIntPtr nBlockNo, ORowSetValue& aVariable)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::ReadMemo" );
- bool bIsText = true;
-
- m_pMemoStream->Seek(nBlockNo * m_aMemoHeader.db_size);
- switch (m_aMemoHeader.db_typ)
- {
- case MemodBaseIII: // dBase III-Memofield, ends with Ctrl-Z
- {
- const char cEOF = (char) DBF_EOL;
- ByteString aBStr;
- static char aBuf[514];
- aBuf[512] = 0; // avoid random value
- sal_Bool bReady = sal_False;
-
- do
- {
- m_pMemoStream->Read(&aBuf,512);
-
- sal_uInt16 i = 0;
- while (aBuf[i] != cEOF && ++i < 512)
- ;
- bReady = aBuf[i] == cEOF;
-
- aBuf[i] = 0;
- aBStr += aBuf;
-
- } while (!bReady && !m_pMemoStream->IsEof() && aBStr.Len() < STRING_MAXLEN);
-
- ::rtl::OUString aStr(aBStr.GetBuffer(), aBStr.Len(),m_eEncoding);
- aVariable = aStr;
-
- } break;
- case MemoFoxPro:
- case MemodBaseIV: // dBase IV-Memofield with length
- {
- char sHeader[4];
- m_pMemoStream->Read(sHeader,4);
- // Foxpro stores text and binary data
- if (m_aMemoHeader.db_typ == MemoFoxPro)
- {
- bIsText = sHeader[3] != 0;
- }
- else if (((sal_uInt8)sHeader[0]) != 0xFF || ((sal_uInt8)sHeader[1]) != 0xFF || ((sal_uInt8)sHeader[2]) != 0x08)
- {
- return sal_False;
- }
-
- sal_uInt32 nLength(0);
- (*m_pMemoStream) >> nLength;
-
- if (m_aMemoHeader.db_typ == MemodBaseIV)
- nLength -= 8;
-
- if ( nLength )
- {
- if ( bIsText )
- {
- ::rtl::OUStringBuffer aStr;
- while ( nLength > STRING_MAXLEN )
- {
- ByteString aBStr;
- aBStr.Expand(STRING_MAXLEN);
- m_pMemoStream->Read(aBStr.AllocBuffer(STRING_MAXLEN),STRING_MAXLEN);
- aStr.append(::rtl::OUString(aBStr.GetBuffer(),aBStr.Len(), m_eEncoding));
- nLength -= STRING_MAXLEN;
- }
- if ( nLength > 0 )
- {
- ByteString aBStr;
- aBStr.Expand(static_cast<xub_StrLen>(nLength));
- m_pMemoStream->Read(aBStr.AllocBuffer(static_cast<xub_StrLen>(nLength)),nLength);
- aStr.append(::rtl::OUString(aBStr.GetBuffer(),aBStr.Len(), m_eEncoding));
- }
- if ( aStr.getLength() )
- aVariable = aStr.makeStringAndClear();
- } // if ( bIsText )
- else
- {
- ::com::sun::star::uno::Sequence< sal_Int8 > aData(nLength);
- m_pMemoStream->Read(aData.getArray(),nLength);
- aVariable = aData;
- }
- } // if ( nLength )
- }
- }
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-void ODbaseTable::AllocBuffer()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::AllocBuffer" );
- sal_uInt16 nSize = m_aHeader.db_slng;
- OSL_ENSURE(nSize > 0, "Size too small");
-
- if (m_nBufferSize != nSize)
- {
- delete m_pBuffer;
- m_pBuffer = NULL;
- }
-
- // if there is no buffer available: allocate:
- if (m_pBuffer == NULL && nSize > 0)
- {
- m_nBufferSize = nSize;
- m_pBuffer = new sal_uInt8[m_nBufferSize+1];
- }
-}
-// -----------------------------------------------------------------------------
-sal_Bool ODbaseTable::WriteBuffer()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::WriteBuffer" );
- OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position");
-
- // postion on desired record:
- long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng;
- m_pFileStream->Seek(nPos);
- return m_pFileStream->Write((char*) m_pBuffer, m_aHeader.db_slng) > 0;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 ODbaseTable::getCurrentLastPos() const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::getCurrentLastPos" );
- return m_aHeader.db_anz;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/DTables.cxx b/connectivity/source/drivers/dbase/DTables.cxx
deleted file mode 100644
index 7c4b452e87..0000000000
--- a/connectivity/source/drivers/dbase/DTables.cxx
+++ /dev/null
@@ -1,146 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "dbase/DTables.hxx"
-#include "dbase/DTable.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include "file/FCatalog.hxx"
-#include "file/FConnection.hxx"
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include "dbase/DCatalog.hxx"
-#include <comphelper/types.hxx>
-#include "resource/dbase_res.hrc"
-#include "connectivity/dbexception.hxx"
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::dbase;
-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;
-namespace starutil = ::com::sun::star::util;
-
-sdbcx::ObjectType ODbaseTables::createObject(const ::rtl::OUString& _rName)
-{
- ::rtl::OUString aName,aSchema;
- ODbaseTable* pRet = new ODbaseTable(this,(ODbaseConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(),
- _rName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE")));
-
- sdbcx::ObjectType xRet = pRet;
- pRet->construct();
- return xRet;
-}
-// -------------------------------------------------------------------------
-void ODbaseTables::impl_refresh( ) throw(RuntimeException)
-{
- static_cast<ODbaseCatalog*>(&m_rParent)->refreshTables();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > ODbaseTables::createDescriptor()
-{
- return new ODbaseTable(this,(ODbaseConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection());
-}
-typedef connectivity::sdbcx::OCollection ODbaseTables_BASE_BASE;
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType ODbaseTables::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
- if(xTunnel.is())
- {
- ODbaseTable* pTable = reinterpret_cast< ODbaseTable* >( xTunnel->getSomething(ODbaseTable::getUnoTunnelImplementationId()) );
- if(pTable)
- {
- pTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(_rForName));
- try
- {
- if(!pTable->CreateImpl())
- throw SQLException();
- }
- catch(SQLException&)
- {
- throw;
- }
- catch(Exception&)
- {
- throw SQLException();
- }
- }
- }
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void ODbaseTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName)
-{
- Reference< XUnoTunnel> xTunnel;
- try
- {
- xTunnel.set(getObject(_nPos),UNO_QUERY);
- }
- catch(const Exception&)
- {
- if(ODbaseTable::Drop_Static(ODbaseTable::getEntry(static_cast<OFileCatalog&>(m_rParent).getConnection(),_sElementName),sal_False,NULL))
- return;
- }
-
- if ( xTunnel.is() )
- {
- ODbaseTable* pTable = reinterpret_cast< ODbaseTable* >( xTunnel->getSomething(ODbaseTable::getUnoTunnelImplementationId()) );
- if(pTable)
- pTable->DropImpl();
- }
- else
- {
- const ::rtl::OUString sError( static_cast<OFileCatalog&>(m_rParent).getConnection()->getResources().getResourceStringWithSubstitution(
- STR_TABLE_NOT_DROP,
- "$tablename$", _sElementName
- ) );
- ::dbtools::throwGenericSQLException( sError, NULL );
- }
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL ODbaseTables::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- typedef sdbcx::OCollection OTables_BASE;
- return OTables_BASE::queryInterface(rType);
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/Dservices.cxx b/connectivity/source/drivers/dbase/Dservices.cxx
deleted file mode 100644
index 7bcc49e87a..0000000000
--- a/connectivity/source/drivers/dbase/Dservices.cxx
+++ /dev/null
@@ -1,114 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "dbase/DDriver.hxx"
-#include <cppuhelper/factory.hxx>
-
-using namespace connectivity::dbase;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount* _pT
- );
-
-//---------------------------------------------------------------------------------------
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- sal_Char const* pImplementationName
- )
- : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- inline
- sal_Bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
- }
- catch(...)
- {
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = 0;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- ODriver::getImplementationName_Static(),
- ODriver::getSupportedServiceNames_Static(),
- ODriver_CreateInstance, ::cppu::createSingleFactory)
- ;
-
- if(aReq.xRet.is())
- aReq.xRet->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/dbase.component b/connectivity/source/drivers/dbase/dbase.component
deleted file mode 100755
index 7f913f0836..0000000000
--- a/connectivity/source/drivers/dbase/dbase.component
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.sdbc.dbase.ODriver">
- <service name="com.sun.star.sdbc.Driver"/>
- <service name="com.sun.star.sdbcx.Driver"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/dbase/dbase.mxp.map b/connectivity/source/drivers/dbase/dbase.mxp.map
deleted file mode 100755
index 57a91423a1..0000000000
--- a/connectivity/source/drivers/dbase/dbase.mxp.map
+++ /dev/null
@@ -1,171 +0,0 @@
-component_getFactory
-__mh_dylib_header
-___builtin_delete
-___builtin_vec_delete
-___builtin_vec_new
-___check_eh_spec
-___cp_pop_exception
-___cp_push_exception
-___eh_alloc
-___get_eh_context
-___pure_virtual
-___rtti_class
-___rtti_si
-___rtti_user
-___sjthrow
-___start_cp_handler
-___terminate
-_terminate__Fv
-dyld_stub_binding_helper
-rest_world
-save_world
-___builtin_new
-___eh_rtime_match
-___tf9bad_alloc
-__._10bad_typeid
-__._8bad_cast
-___get_eh_info
-___is_pointer__FPv
-___throw_type_match_rtti
-___vt_10bad_typeid
-___vt_8bad_cast
-__keymgr_get_per_thread_data
-__keymgr_set_per_thread_data
-___tf9exception
-___ti9exception
-___vt_9exception
-_what__C9exception
-__._9bad_alloc
-___vt_9bad_alloc
-__._9type_info
-___eq__C9type_infoRCB0
-___tf16__user_type_info
-___tf9type_info
-___ti9type_info
-___vt_9type_info
-_getPropertySetInfo__Q312connectivity5dbase15ODbaseResultSet
-_release__Q312connectivity5dbase15ODbaseResultSet
-_acquire__Q312connectivity5dbase15ODbaseResultSet
-__._Q312connectivity5dbase15ODbaseResultSet
-__._Q312connectivity5dbase15ODbaseStatement
-__._Q312connectivity5dbase23ODbasePreparedStatement
-_IsText__Q312connectivity5dbase7ONDXKeyl
-_Write__CQ312connectivity5dbase8ONDXNodeR8SvStreamRCQ312connectivity5dbase8ONDXPage
-_Read__Q312connectivity5dbase8ONDXNodeR8SvStreamRQ312connectivity5dbase11ODbaseIndex
-_Merge__Q312connectivity5dbase8ONDXPageUsGQ312connectivity5dbase11ONDXPagePtr
-_Remove__Q312connectivity5dbase8ONDXPageUs
-_SearchAndReplace__Q312connectivity5dbase8ONDXPageRCQ312connectivity5dbase7ONDXKeyRB1
-_Search__Q312connectivity5dbase8ONDXPageRCQ312connectivity5dbase7ONDXKey
-_FindPos__CQ312connectivity5dbase8ONDXPageRCQ312connectivity5dbase7ONDXKey
-_ReleaseFull__Q312connectivity5dbase8ONDXPageUc
-_Append__Q312connectivity5dbase8ONDXPageRQ312connectivity5dbase8ONDXNode
-_Split__Q312connectivity5dbase8ONDXPageRB0
-_Insert__Q312connectivity5dbase8ONDXPageUsRQ312connectivity5dbase8ONDXNode
-_IsFull__CQ312connectivity5dbase8ONDXPage
-___vc__CQ312connectivity5dbase8ONDXPageUs
-___ls__Q212connectivity5dbaseR8SvStreamRCQ312connectivity5dbase8ONDXPage
-__._Q312connectivity5dbase8ONDXPage
-_GetFirstKey__Q312connectivity5dbase14OIndexIteratorPQ312connectivity5dbase8ONDXPageRCQ312connectivity4file8OOperand
-_GetCompare__Q312connectivity5dbase14OIndexIteratorUc
-_GetLike__Q312connectivity5dbase14OIndexIteratorUc
-_GetNull__Q312connectivity5dbase14OIndexIteratorUc
-_GetNotNull__Q312connectivity5dbase14OIndexIteratorUc
-_GetNextKey__Q312connectivity5dbase14OIndexIterator
-_Find__Q312connectivity5dbase14OIndexIteratorUc
-_refreshTables__Q312connectivity5dbase13ODbaseCatalog
-__._Q312connectivity5dbase18UStringDescription
-___Q312connectivity5dbase18UStringDescriptionPFv_PCc
-__._Q312connectivity5dbase11ODbaseIndex
-_release__Q312connectivity5dbase11ODbaseIndex
-_acquire__Q312connectivity5dbase11ODbaseIndex
-_createINFEntry__Q312connectivity5dbase11ODbaseIndex
-_getEntry__Q312connectivity5dbase11ODbaseIndex
-___ls__Q212connectivity5dbaseR8SvStreamRQ312connectivity5dbase11ODbaseIndex
-_Release__Q312connectivity5dbase11ODbaseIndexUc
-_ConvertToKey__Q312connectivity5dbase11ODbaseIndexPQ312connectivity5dbase7ONDXKeyUlRCQ312connectivity4file12ORowSetValue
-_openIndexFile__Q312connectivity5dbase11ODbaseIndex
-__._Q312connectivity5dbase11ODbaseTable
-_WriteMemo__Q312connectivity5dbase11ODbaseTableRQ312connectivity4file12ORowSetValueRUl
-_isUniqueByColumnName__Q312connectivity5dbase11ODbaseTableRCQ23rtl8OUString
-_WriteBuffer__Q312connectivity5dbase11ODbaseTable
-_UpdateBuffer__Q312connectivity5dbase11ODbaseTableRQ312connectivity4file12OValueVectorGQ23vost4ORef1ZB1RCQ53com3sun4star3unot9Reference1ZQ53com3sun4star9container12XIndexAccess
-_CreateMemoFile__Q312connectivity5dbase11ODbaseTableRC13INetURLObject
-_CreateFile__Q312connectivity5dbase11ODbaseTableRC13INetURLObjectRUc
-_ReadMemo__Q312connectivity5dbase11ODbaseTableUlRQ312connectivity4file12ORowSetValue
-_refreshIndexes__Q312connectivity5dbase11ODbaseTable
-_refreshColumns__Q312connectivity5dbase11ODbaseTable
-_AllocBuffer__Q312connectivity5dbase11ODbaseTable
-_fillColumns__Q312connectivity5dbase11ODbaseTable
-_ReadMemoHeader__Q312connectivity5dbase11ODbaseTable
-_readHeader__Q312connectivity5dbase11ODbaseTable
-_getPropertySetInfo__Q312connectivity4file26ODatabaseMetaDataResultSet
-_release__Q312connectivity4file26ODatabaseMetaDataResultSet
-_acquire__Q312connectivity4file26ODatabaseMetaDataResultSet
-_getPropertySetInfo__Q312connectivity4file10OResultSet
-_release__Q312connectivity4file10OResultSet
-_acquire__Q312connectivity4file10OResultSet
-_scanParameter__Q312connectivity4file10OResultSetPQ212connectivity13OSQLParseNodeRQ24_STLt6vector2ZPB1ZQ24_STLt9allocator1ZPB1
-_AddParameter__Q312connectivity4file10OResultSetPQ212connectivity13OSQLParseNodeRCQ53com3sun4star3unot9Reference1ZQ53com3sun4star5beans12XPropertySet
-_SetAssignValue__Q312connectivity4file10OResultSetRC6Stringn1UcUl
-_ParseAssignValues__Q312connectivity4file10OResultSetRCQ24_STLt6vector2Z6StringZQ24_STLt9allocator1ZB2PQ212connectivity13OSQLParseNodeUs
-_getUnoTunnelImplementationId__Q312connectivity4file10OResultSet
-_setOrderbyColumn__Q312connectivity4file10OResultSetUsPQ212connectivity13OSQLParseNoden1
-_CreateKeySet__Q312connectivity4file14OFILESortIndex
-___Q312connectivity4file14OFILESortIndexPCQ312connectivity4file8OKeyTypePCUclUs
-_anylizeSQL__Q312connectivity4file10OResultSet
-_GetAssignValues__Q312connectivity4file10OResultSet
-_moveAbsolute__Q312connectivity4file10OResultSetlUc
-_ExecuteRow__Q312connectivity4file10OResultSetQ412connectivity4file10OFileTable12FilePositionlUcn2
-_AddKeyValue__Q312connectivity4file14OFILESortIndexPQ312connectivity4file13OFILEKeyValue
-_GetOrderbyKeyValue__Q312connectivity4file10OResultSetGQ23vost4ORef1ZQ312connectivity4file12OValueVector
-_evaluate__Q312connectivity4file10OResultSet
-_SkipDeleted__Q312connectivity4file10OResultSetQ412connectivity4file10OFileTable12FilePositionlUc
-__._Q312connectivity4file14OFILESortIndex
-_construct__Q312connectivity4file10OResultSet
-_isCount__CQ312connectivity4file10OResultSet
-__._Q312connectivity4file18UStringDescription
-___Q312connectivity4file18UStringDescriptionPFv_PCc
-_disposing__Q312connectivity4file15OStatement_Base
-_acquire__Q312connectivity4file15OStatement_Base
-__._Q312connectivity4file16OStatement_BASE2
-__._Q312connectivity4file10OStatement
-_disposeResultSet__Q312connectivity4file15OStatement_Base
-_getImplementationName_Static__Q312connectivity4file11OFileDriver
-_operate__CQ312connectivity4file8OOp_LIKEPCQ312connectivity4file8OOperandn1
-_operate__CQ312connectivity4file10OOp_ISNULLPCQ312connectivity4file8OOperandn1
-_IsOf__Q312connectivity4file12ONumOperatorPFv_Pv
-_StaticType__Q312connectivity4file12ONumOperator
-_IsOf__Q312connectivity4file11OOp_COMPAREPFv_Pv
-_IsOf__Q312connectivity4file11OOp_NOTLIKEPFv_Pv
-_StaticType__Q312connectivity4file11OOp_NOTLIKE
-_IsOf__Q312connectivity4file8OOp_LIKEPFv_Pv
-_IsOf__Q312connectivity4file13OOp_ISNOTNULLPFv_Pv
-_IsOf__Q312connectivity4file10OOp_ISNULLPFv_Pv
-_IsOf__Q312connectivity4file6OOp_ORPFv_Pv
-_StaticType__Q312connectivity4file6OOp_OR
-_IsOf__Q312connectivity4file7OOp_ANDPFv_Pv
-_StaticType__Q312connectivity4file7OOp_AND
-_IsOf__Q312connectivity4file13OBoolOperatorPFv_Pv
-_IsOf__Q312connectivity4file9OOperatorPFv_Pv
-_IsOf__Q312connectivity4file14OOperandResultPFv_Pv
-_IsOf__Q312connectivity4file13OOperandConstPFv_Pv
-_IsOf__Q312connectivity4file13OOperandValuePFv_Pv
-_StaticType__Q312connectivity4file13OOperandValue
-_IsOf__Q312connectivity4file13OOperandParamPFv_Pv
-_IsOf__Q312connectivity4file16OFILEOperandAttrPFv_Pv
-_StaticType__Q312connectivity4file16OFILEOperandAttr
-_IsOf__Q312connectivity4file12OOperandAttrPFv_Pv
-_IsOf__Q312connectivity4file11OOperandRowPFv_Pv
-_StaticType__Q312connectivity4file11OOperandRow
-_IsOf__Q312connectivity4file8OOperandPFv_Pv
-_IsOf__Q312connectivity4file5OCodePFv_Pv
-_StaticType__Q312connectivity4file5OCode
-_execute_Operand__Q312connectivity4file18OPredicateCompilerPQ212connectivity13OSQLParseNode
-_execute_ISNULL__Q312connectivity4file18OPredicateCompilerPQ212connectivity13OSQLParseNode
-_execute_LIKE__Q312connectivity4file18OPredicateCompilerPQ212connectivity13OSQLParseNode
-_execute_COMPARE__Q312connectivity4file18OPredicateCompilerPQ212connectivity13OSQLParseNode
-___tf13bad_exception
-___uncatch_exception
-___eh_free
-___tfv
-___dynamic_cast
diff --git a/connectivity/source/drivers/dbase/dbase.xcu b/connectivity/source/drivers/dbase/dbase.xcu
deleted file mode 100644
index 319b8d79a9..0000000000
--- a/connectivity/source/drivers/dbase/dbase.xcu
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="sdbc:dbase:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.dbase.ODriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">dBASE</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="CharSet" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="ShowDeleted" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- <node oor:name="EnableSQL92Check" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- <node oor:name="AddIndexAppendix" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseDOSLineEnds" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FileSystemBased" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="MediaType" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>application/dbase</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/dbase/dbase.xml b/connectivity/source/drivers/dbase/dbase.xml
deleted file mode 100755
index e378fcd5fd..0000000000
--- a/connectivity/source/drivers/dbase/dbase.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE module-description PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
-<module-description>
- <module-name>file</module-name>
- <component-description>
- <author>Ocke Jannsen</author>
- <name>com.sun.star.comp.sdbc.dbase.ODriver</name>
- <description>This library implements the database driver for dBase file format.
-</description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service>com.sun.star.sdbc.Driver</supported-service>
- <supported-service>com.sun.star.sdbcx.Driver</supported-service>
- <service-dependency> ... </service-dependency>
- </component-description>
- <project-build-dependency>cppuhelper</project-build-dependency>
- <project-build-dependency>cppu</project-build-dependency>
- <project-build-dependency>sal</project-build-dependency>
- <runtime-module-dependency>file</runtime-module-dependency>
- <runtime-module-dependency>cppuhelper</runtime-module-dependency>
- <runtime-module-dependency>cppu</runtime-module-dependency>
- <runtime-module-dependency>sal</runtime-module-dependency>
- <runtime-module-dependency>osl</runtime-module-dependency>
- <runtime-module-dependency>svtools-light1</runtime-module-dependency>
- <runtime-module-dependency>svtools</runtime-module-dependency>
- <runtime-module-dependency>ucbhelper</runtime-module-dependency>
- <runtime-module-dependency>dbtools</runtime-module-dependency>
- <runtime-module-dependency>unotools</runtime-module-dependency>
- <runtime-module-dependency>comphelper</runtime-module-dependency>
-</module-description>
diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx
deleted file mode 100644
index 203086e16e..0000000000
--- a/connectivity/source/drivers/dbase/dindexnode.cxx
+++ /dev/null
@@ -1,1016 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "dbase/dindexnode.hxx"
-#include "connectivity/CommonTools.hxx"
-#include <osl/thread.h>
-#include "dbase/DIndex.hxx"
-#include <tools/debug.hxx>
-#include "diagnose_ex.h"
-
-#include <algorithm>
-
-
-using namespace connectivity;
-using namespace connectivity::dbase;
-using namespace connectivity::file;
-using namespace com::sun::star::sdbc;
-// -----------------------------------------------------------------------------
-ONDXKey::ONDXKey(sal_uInt32 nRec)
- :nRecord(nRec)
-{
-}
-// -----------------------------------------------------------------------------
-ONDXKey::ONDXKey(const ORowSetValue& rVal, sal_Int32 eType, sal_uInt32 nRec)
- : ONDXKey_BASE(eType)
- , nRecord(nRec)
- , xValue(rVal)
-{
-}
-// -----------------------------------------------------------------------------
-ONDXKey::ONDXKey(const rtl::OUString& aStr, sal_uInt32 nRec)
- : ONDXKey_BASE(::com::sun::star::sdbc::DataType::VARCHAR)
- ,nRecord(nRec)
-{
- if (aStr.getLength())
- {
- xValue = aStr;
- xValue.setBound(sal_True);
- }
-}
-// -----------------------------------------------------------------------------
-
-ONDXKey::ONDXKey(double aVal, sal_uInt32 nRec)
- : ONDXKey_BASE(::com::sun::star::sdbc::DataType::DOUBLE)
- ,nRecord(nRec)
- ,xValue(aVal)
-{
-}
-// -----------------------------------------------------------------------------
-
-//==================================================================
-// Index Seite
-//==================================================================
-ONDXPage::ONDXPage(ODbaseIndex& rInd, sal_uInt32 nPos, ONDXPage* pParent)
- :nPagePos(nPos)
- ,bModified(sal_False)
- ,nCount(0)
- ,aParent(pParent)
- ,rIndex(rInd)
- ,ppNodes(NULL)
-{
- sal_uInt16 nT = rIndex.getHeader().db_maxkeys;
- ppNodes = new ONDXNode[nT];
-}
-
-//------------------------------------------------------------------
-ONDXPage::~ONDXPage()
-{
- delete[] ppNodes;
-}
-//------------------------------------------------------------------
-void ONDXPage::QueryDelete()
-{
- // Store in GarbageCollector
- if (IsModified() && rIndex.m_pFileStream)
- (*rIndex.m_pFileStream) << *this;
-
- bModified = sal_False;
- if (rIndex.UseCollector())
- {
- if (aChild.Is())
- aChild->Release(sal_False);
-
- for (sal_uInt16 i = 0; i < rIndex.getHeader().db_maxkeys;i++)
- {
- if (ppNodes[i].GetChild().Is())
- ppNodes[i].GetChild()->Release(sal_False);
-
- ppNodes[i] = ONDXNode();
- }
- RestoreNoDelete();
-
- nCount = 0;
- aParent.Clear();
- rIndex.Collect(this);
- }
- else
- SvRefBase::QueryDelete();
-}
-//------------------------------------------------------------------
-ONDXPagePtr& ONDXPage::GetChild(ODbaseIndex* pIndex)
-{
- if (!aChild.Is() && pIndex)
- {
- aChild = rIndex.CreatePage(aChild.GetPagePos(),this,aChild.HasPage());
- }
- return aChild;
-}
-
-//------------------------------------------------------------------
-sal_uInt16 ONDXPage::FindPos(const ONDXKey& rKey) const
-{
- // searches the position for the given key in a page
- sal_uInt16 i = 0;
- while (i < nCount && rKey > ((*this)[i]).GetKey())
- i++;
-
- return i;
-}
-
-//------------------------------------------------------------------
-sal_Bool ONDXPage::Find(const ONDXKey& rKey)
-{
- // searches the given key
- // Speciality: At the end of the method
- // the actual page and the position of the node, fulfilling the '<=' condition, are saved
- // This is considered at insert.
- sal_uInt16 i = 0;
- while (i < nCount && rKey > ((*this)[i]).GetKey())
- i++;
-
- sal_Bool bResult = sal_False;
-
- if (!IsLeaf())
- {
- // descend further
- ONDXPagePtr aPage = (i==0) ? GetChild(&rIndex) : ((*this)[i-1]).GetChild(&rIndex, this);
- bResult = aPage.Is() && aPage->Find(rKey);
- }
- else if (i == nCount)
- {
- rIndex.m_aCurLeaf = this;
- rIndex.m_nCurNode = i - 1;
- bResult = sal_False;
- }
- else
- {
- bResult = rKey == ((*this)[i]).GetKey();
- rIndex.m_aCurLeaf = this;
- rIndex.m_nCurNode = bResult ? i : i - 1;
- }
- return bResult;
-}
-
-//------------------------------------------------------------------
-sal_Bool ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft)
-{
- // When creating an index there can be multiple nodes added,
- // these are sorted ascending
- sal_Bool bAppend = nRowsLeft > 0;
- if (IsFull())
- {
- sal_Bool bResult = sal_True;
- ONDXNode aSplitNode;
- if (bAppend)
- aSplitNode = rNode;
- else
- {
- // Save the last node
- aSplitNode = (*this)[nCount-1];
- if(rNode.GetKey() <= aSplitNode.GetKey())
- {
-
- // this practically reduces the number of nodes by 1
- if (IsLeaf() && this == &rIndex.m_aCurLeaf)
- {
- // assumes, that the node, for which the condition (<=) holds, is stored in m_nCurNode
- --nCount; // (otherwise we might get Assertions and GPFs - 60593)
- bResult = Insert(rIndex.m_nCurNode + 1, rNode);
- }
- else // Position unbekannt
- {
- sal_uInt16 nPos = NODE_NOTFOUND;
- while (++nPos < nCount && rNode.GetKey() > ((*this)[nPos]).GetKey()) ;
-
- --nCount; // (otherwise we might get Assertions and GPFs - 60593)
- bResult = Insert(nPos, rNode);
- }
-
- // can the new node be inserted
- if (!bResult)
- {
- nCount++;
- aSplitNode = rNode;
- }
- }
- else
- aSplitNode = rNode;
- }
-
- sal_uInt32 nNewPagePos = rIndex.GetPageCount();
- sal_uInt32 nNewPageCount = nNewPagePos + 1;
-
- // insert extracted node into parent node
- if (!HasParent())
- {
- // No parent, then new root
- ONDXPagePtr aNewRoot = rIndex.CreatePage(nNewPagePos + 1);
- aNewRoot->SetChild(this);
-
- rIndex.m_aRoot = aNewRoot;
- rIndex.SetRootPos(nNewPagePos + 1);
- rIndex.SetPageCount(++nNewPageCount);
- }
-
- // create new leaf and divide page
- ONDXPagePtr aNewPage = rIndex.CreatePage(nNewPagePos,aParent);
- rIndex.SetPageCount(nNewPageCount);
-
- // How many nodes are being inserted?
- // Enough, then we can fill the page to the brim
- ONDXNode aInnerNode;
- if (!IsLeaf() || nRowsLeft < (sal_uInt32)(rIndex.GetMaxNodes() / 2))
- aInnerNode = Split(*aNewPage);
- else
- {
- aInnerNode = (*this)[nCount - 1];
-
- // Node points to the new page
- aInnerNode.SetChild(aNewPage);
-
- // Inner nodes have no record number
- if (rIndex.isUnique())
- aInnerNode.GetKey().ResetRecord();
-
- // new page points to the page of the extracted node
- if (!IsLeaf())
- aNewPage->SetChild(aInnerNode.GetChild());
- }
-
- aNewPage->Append(aSplitNode);
- ONDXPagePtr aTempParent = aParent;
- if (IsLeaf())
- {
- rIndex.m_aCurLeaf = aNewPage;
- rIndex.m_nCurNode = rIndex.m_aCurLeaf->Count() - 1;
-
- // free not needed pages, there are no references to those on the page
- // afterwards 'this' can't be valid anymore!!!
- ReleaseFull();
- }
-
- // Insert extracted node
- return aTempParent->Insert(aInnerNode);
- }
- else // Fill the page up
- {
- if (bAppend)
- {
- if (IsLeaf())
- rIndex.m_nCurNode = nCount - 1;
- return Append(rNode);
- }
- else
- {
- sal_uInt16 nNodePos = FindPos(rNode.GetKey());
- if (IsLeaf())
- rIndex.m_nCurNode = nNodePos;
-
- return Insert(nNodePos, rNode);
- }
- }
-}
-
-//------------------------------------------------------------------
-sal_Bool ONDXPage::Insert(sal_uInt16 nPos, ONDXNode& rNode)
-{
- sal_uInt16 nMaxCount = rIndex.getHeader().db_maxkeys;
- if (nPos >= nMaxCount)
- return sal_False;
-
- if (nCount)
- {
- ++nCount;
- // shift right
- for (sal_uInt16 i = std::min((sal_uInt16)(nMaxCount-1), (sal_uInt16)(nCount-1)); nPos < i; --i)
- (*this)[i] = (*this)[i-1];
- }
- else
- if (nCount < nMaxCount)
- nCount++;
-
- // insert at the position
- ONDXNode& rInsertNode = (*this)[nPos];
- rInsertNode = rNode;
- if (rInsertNode.GetChild().Is())
- {
- rInsertNode.GetChild()->SetParent(this);
- rNode.GetChild()->SetParent(this);
- }
-
- bModified = sal_True;
-
- return sal_True;
-}
-
-//------------------------------------------------------------------
-sal_Bool ONDXPage::Append(ONDXNode& rNode)
-{
- DBG_ASSERT(!IsFull(), "kein Append moeglich");
- return Insert(nCount, rNode);
-}
-//------------------------------------------------------------------
-void ONDXPage::Release(sal_Bool bSave)
-{
- // free pages
- if (aChild.Is())
- aChild->Release(bSave);
-
- // free pointer
- aChild.Clear();
-
- for (sal_uInt16 i = 0; i < rIndex.getHeader().db_maxkeys;i++)
- {
- if (ppNodes[i].GetChild())
- ppNodes[i].GetChild()->Release(bSave);
-
- ppNodes[i].GetChild().Clear();
- }
- aParent = NULL;
-}
-//------------------------------------------------------------------
-void ONDXPage::ReleaseFull(sal_Bool bSave)
-{
- ONDXPagePtr aTempParent = aParent;
- Release(bSave);
-
- if (aTempParent.Is())
- {
- // Free pages not needed, there will be no reference anymore to the pages
- // afterwards 'this' can't be valid anymore!!!
- sal_uInt16 nParentPos = aTempParent->Search(this);
- if (nParentPos != NODE_NOTFOUND)
- (*aTempParent)[nParentPos].GetChild().Clear();
- else
- aTempParent->GetChild().Clear();
- }
-}
-//------------------------------------------------------------------
-sal_Bool ONDXPage::Delete(sal_uInt16 nNodePos)
-{
- if (IsLeaf())
- {
- // The last element will not be deleted
- if (nNodePos == (nCount - 1))
- {
- ONDXNode aNode = (*this)[nNodePos];
-
- // parent's KeyValue has to be replaced
- if (HasParent())
- aParent->SearchAndReplace(aNode.GetKey(),
- (*this)[nNodePos-1].GetKey());
- }
- }
-
- // Delete the node
- Remove(nNodePos);
-
- // Underflow
- if (HasParent() && nCount < (rIndex.GetMaxNodes() / 2))
- {
- // determine, which node points to the page
- sal_uInt16 nParentNodePos = aParent->Search(this);
- // last element on parent-page -> merge with secondlast page
- if (nParentNodePos == (aParent->Count() - 1))
- {
- if (!nParentNodePos)
- // merge with left neighbour
- Merge(nParentNodePos,aParent->GetChild(&rIndex));
- else
- Merge(nParentNodePos,(*aParent)[nParentNodePos-1].GetChild(&rIndex,aParent));
- }
- // otherwise merge page with next page
- else
- {
- // merge with right neighbour
- Merge(nParentNodePos + 1,((*aParent)[nParentNodePos + 1].GetChild(&rIndex,aParent)));
- nParentNodePos++;
- }
- if (HasParent() && !(*aParent)[nParentNodePos].HasChild())
- aParent->Delete(nParentNodePos);
- }
- else if (IsRoot())
- // make sure that the position of the root is kept
- rIndex.SetRootPos(nPagePos);
- return sal_True;
-}
-
-
-//------------------------------------------------------------------
-ONDXNode ONDXPage::Split(ONDXPage& rPage)
-{
- DBG_ASSERT(IsFull(), "Falsches Splitting");
- /* devide one page into two
- leaf:
- Page 1 is (n - (n/2))
- Page 2 is (n/2)
- Node n/2 will be duplicated
- inner node:
- Page 1 is (n+1)/2
- Page 2 is (n/2-1)
- Node ((n+1)/2 + 1) : will be taken out
- */
- ONDXNode aResultNode;
- if (IsLeaf())
- {
- for (sal_uInt16 i = (nCount - (nCount / 2)), j = 0 ; i < nCount; i++)
- rPage.Insert(j++,(*this)[i]);
-
- // this node contains a key that already exists in the tree and must be replaced
- ONDXNode aLastNode = (*this)[nCount - 1];
- nCount = nCount - (nCount / 2);
- aResultNode = (*this)[nCount - 1];
-
- if (HasParent())
- aParent->SearchAndReplace(aLastNode.GetKey(),
- aResultNode.GetKey());
- }
- else
- {
- for (sal_uInt16 i = (nCount + 1) / 2 + 1, j = 0 ; i < nCount; i++)
- rPage.Insert(j++,(*this)[i]);
-
- aResultNode = (*this)[(nCount + 1) / 2];
- nCount = (nCount + 1) / 2;
-
- // new page points to page with extraced node
- rPage.SetChild(aResultNode.GetChild());
- }
- // node points to new page
- aResultNode.SetChild(&rPage);
-
- // inner nodes have no record number
- if (rIndex.isUnique())
- aResultNode.GetKey().ResetRecord();
- bModified = sal_True;
- return aResultNode;
-}
-
-//------------------------------------------------------------------
-void ONDXPage::Merge(sal_uInt16 nParentNodePos, ONDXPagePtr xPage)
-{
- DBG_ASSERT(HasParent(), "kein Vater vorhanden");
- DBG_ASSERT(nParentNodePos != NODE_NOTFOUND, "Falscher Indexaufbau");
-
- /* Merge 2 pages */
- ONDXNode aResultNode;
- sal_uInt16 nMaxNodes = rIndex.GetMaxNodes(),
- nMaxNodes_2 = nMaxNodes / 2;
-
- // Determine if page is right or left neighbour
- sal_Bool bRight = ((*xPage)[0].GetKey() > (*this)[0].GetKey()); // sal_True, whenn xPage the right side is
- sal_uInt16 nNewCount = (*xPage).Count() + Count();
-
- if (IsLeaf())
- {
- // Condition for merge
- if (nNewCount < (nMaxNodes_2 * 2))
- {
- sal_uInt16 nLastNode = bRight ? Count() - 1 : xPage->Count() - 1;
- if (bRight)
- {
- DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife");
- // shift all nodes from xPage to the left node (append)
- while (xPage->Count())
- {
- Append((*xPage)[0]);
- xPage->Remove(0);
- }
- }
- else
- {
- DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife");
- // xPage is the left page and THIS the right one
- while (xPage->Count())
- {
- Insert(0,(*xPage)[xPage->Count()-1]);
- xPage->Remove(xPage->Count()-1);
- }
- // replace old position of xPage in parent with this
- if (nParentNodePos)
- (*aParent)[nParentNodePos-1].SetChild(this,aParent);
- else // or set as right node
- aParent->SetChild(this);
- aParent->SetModified(sal_True);
-
- }
-
- // cancel Child-relationship at parent node
- (*aParent)[nParentNodePos].SetChild();
- // replace the Node-value, only if changed page is the left one, otherwise become
- if(aParent->IsRoot() && aParent->Count() == 1)
- {
- (*aParent)[0].SetChild();
- aParent->ReleaseFull();
- aParent = NULL;
- rIndex.SetRootPos(nPagePos);
- rIndex.m_aRoot = this;
- SetModified(sal_True);
- }
- else
- aParent->SearchAndReplace((*this)[nLastNode].GetKey(),(*this)[nCount-1].GetKey());
-
- xPage->SetModified(sal_False);
- xPage->ReleaseFull(); // is not needed anymore
- }
- // balance the elements nNewCount >= (nMaxNodes_2 * 2)
- else
- {
- if (bRight)
- {
- // shift all nodes from xPage to the left node (append)
- ONDXNode aReplaceNode = (*this)[nCount - 1];
- while (nCount < nMaxNodes_2)
- {
- Append((*xPage)[0]);
- xPage->Remove(0);
- }
- // Replace the node values: replace old last value by the last of xPage
- aParent->SearchAndReplace(aReplaceNode.GetKey(),(*this)[nCount-1].GetKey());
- }
- else
- {
- // insert all nodes from this in front of the xPage nodes
- ONDXNode aReplaceNode = (*this)[nCount - 1];
- while (xPage->Count() < nMaxNodes_2)
- {
- xPage->Insert(0,(*this)[nCount-1]);
- Remove(nCount-1);
- }
- // Replace the node value
- aParent->SearchAndReplace(aReplaceNode.GetKey(),(*this)[Count()-1].GetKey());
- }
- }
- }
- else // !IsLeaf()
- {
- // Condition for merge
- if (nNewCount < nMaxNodes_2 * 2)
- {
- if (bRight)
- {
- DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife");
- // Parent node will be integrated; is initialized with Child from xPage
- (*aParent)[nParentNodePos].SetChild(xPage->GetChild(),aParent);
- Append((*aParent)[nParentNodePos]);
- for (sal_uInt16 i = 0 ; i < xPage->Count(); i++)
- Append((*xPage)[i]);
- }
- else
- {
- DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife");
- // Parent-node will be integrated; is initialized with child
- (*aParent)[nParentNodePos].SetChild(GetChild(),aParent); // Parent memorizes my child
- Insert(0,(*aParent)[nParentNodePos]); // insert parent node into myself
- while (xPage->Count())
- {
- Insert(0,(*xPage)[xPage->Count()-1]);
- xPage->Remove(xPage->Count()-1);
- }
- SetChild(xPage->GetChild());
-
- if (nParentNodePos)
- (*aParent)[nParentNodePos-1].SetChild(this,aParent);
- else
- aParent->SetChild(this);
- }
-
- // afterwards parent node will be reset
- (*aParent)[nParentNodePos].SetChild();
- aParent->SetModified(sal_True);
-
- if(aParent->IsRoot() && aParent->Count() == 1)
- {
- (*aParent).SetChild();
- aParent->ReleaseFull();
- aParent = NULL;
- rIndex.SetRootPos(nPagePos);
- rIndex.m_aRoot = this;
- SetModified(sal_True);
- }
- else if(nParentNodePos)
- // replace the node value
- // for Append the range will be enlarged, for Insert the old node from xPage will reference to this
- // thats why the node must be updated here
- aParent->SearchAndReplace((*aParent)[nParentNodePos-1].GetKey(),(*aParent)[nParentNodePos].GetKey());
-
- xPage->SetModified(sal_False);
- xPage->ReleaseFull();
- }
- // balance the elements
- else
- {
- if (bRight)
- {
- while (nCount < nMaxNodes_2)
- {
- (*aParent)[nParentNodePos].SetChild(xPage->GetChild(),aParent);
- Append((*aParent)[nParentNodePos]);
- (*aParent)[nParentNodePos] = (*xPage)[0];
- xPage->Remove(0);
- }
- xPage->SetChild((*aParent)[nParentNodePos].GetChild());
- (*aParent)[nParentNodePos].SetChild(xPage,aParent);
- }
- else
- {
- while (nCount < nMaxNodes_2)
- {
- (*aParent)[nParentNodePos].SetChild(GetChild(),aParent);
- Insert(0,(*aParent)[nParentNodePos]);
- (*aParent)[nParentNodePos] = (*xPage)[xPage->Count()-1];
- xPage->Remove(xPage->Count()-1);
- }
- SetChild((*aParent)[nParentNodePos].GetChild());
- (*aParent)[nParentNodePos].SetChild(this,aParent);
-
- }
- aParent->SetModified(sal_True);
- }
- }
-}
-//==================================================================
-// ONDXNode
-//==================================================================
-
-//------------------------------------------------------------------
-void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex)
-{
- rStream >> aKey.nRecord; // key
-
- if (rIndex.getHeader().db_keytype)
- {
- double aDbl;
- rStream >> aDbl;
- aKey = ONDXKey(aDbl,aKey.nRecord);
- }
- else
- {
- ByteString aBuf;
- sal_uInt16 nLen = rIndex.getHeader().db_keylen;
- char* pStr = aBuf.AllocBuffer(nLen+1);
-
- rStream.Read(pStr,nLen);
- pStr[nLen] = 0;
- aBuf.ReleaseBufferAccess();
- aBuf.EraseTrailingChars();
-
- aKey = ONDXKey(::rtl::OUString(aBuf.GetBuffer(),aBuf.Len(),rIndex.m_pTable->getConnection()->getTextEncoding()) ,aKey.nRecord);
- }
- rStream >> aChild;
-}
-
-union NodeData
-{
- double aDbl;
- char aData[128];
-} aNodeData;
-//------------------------------------------------------------------
-void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const
-{
- const ODbaseIndex& rIndex = rPage.GetIndex();
- if (!rIndex.isUnique() || rPage.IsLeaf())
- rStream << (sal_uInt32)aKey.nRecord; // key
- else
- rStream << (sal_uInt32)0; // key
-
- if (rIndex.getHeader().db_keytype) // double
- {
- if (aKey.getValue().isNull())
- {
- memset(aNodeData.aData,0,rIndex.getHeader().db_keylen);
- rStream.Write((sal_uInt8*)aNodeData.aData,rIndex.getHeader().db_keylen);
- }
- else
- rStream << (double) aKey.getValue();
- }
- else
- {
- memset(aNodeData.aData,0x20,rIndex.getHeader().db_keylen);
- if (!aKey.getValue().isNull())
- {
- ::rtl::OUString sValue = aKey.getValue();
- ByteString aText(sValue.getStr(), rIndex.m_pTable->getConnection()->getTextEncoding());
- strncpy(aNodeData.aData,aText.GetBuffer(),std::min(rIndex.getHeader().db_keylen, aText.Len()));
- }
- rStream.Write((sal_uInt8*)aNodeData.aData,rIndex.getHeader().db_keylen);
- }
- rStream << aChild;
-}
-
-
-//------------------------------------------------------------------
-ONDXPagePtr& ONDXNode::GetChild(ODbaseIndex* pIndex, ONDXPage* pParent)
-{
- if (!aChild.Is() && pIndex)
- {
- aChild = pIndex->CreatePage(aChild.GetPagePos(),pParent,aChild.HasPage());
- }
- return aChild;
-}
-
-//==================================================================
-// ONDXKey
-//==================================================================
-//------------------------------------------------------------------
-sal_Bool ONDXKey::IsText(sal_Int32 eType)
-{
- return eType == DataType::VARCHAR || eType == DataType::CHAR;
-}
-
-//------------------------------------------------------------------
-StringCompare ONDXKey::Compare(const ONDXKey& rKey) const
-{
- StringCompare eResult;
-
- if (getValue().isNull())
- {
- if (rKey.getValue().isNull() || (rKey.IsText(getDBType()) && !rKey.getValue().getString().getLength()))
- eResult = COMPARE_EQUAL;
- else
- eResult = COMPARE_LESS;
- }
- else if (rKey.getValue().isNull())
- {
- if (getValue().isNull() || (IsText(getDBType()) && !getValue().getString().getLength()))
- eResult = COMPARE_EQUAL;
- else
- eResult = COMPARE_GREATER;
- }
- else if (IsText(getDBType()))
- {
- sal_Int32 nRes = getValue().getString().compareTo(rKey.getValue());
- eResult = (nRes > 0) ? COMPARE_GREATER : (nRes == 0) ? COMPARE_EQUAL : COMPARE_LESS;
- }
- else
- {
- double m = getValue(),n = rKey.getValue();
- eResult = (m > n) ? COMPARE_GREATER : (n == m) ? COMPARE_EQUAL : COMPARE_LESS;
- }
-
- // compare record, if index !Unique
- if (eResult == COMPARE_EQUAL && nRecord && rKey.nRecord)
- eResult = (nRecord > rKey.nRecord) ? COMPARE_GREATER :
- (nRecord == rKey.nRecord) ? COMPARE_EQUAL : COMPARE_LESS;
-
- return eResult;
-}
-// -----------------------------------------------------------------------------
-void ONDXKey::setValue(const ORowSetValue& _rVal)
-{
- xValue = _rVal;
-}
-// -----------------------------------------------------------------------------
-const ORowSetValue& ONDXKey::getValue() const
-{
- return xValue;
-}
-// -----------------------------------------------------------------------------
-SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPagePtr& rPage)
-{
- rStream >> rPage.nPagePos;
- return rStream;
-}
-// -----------------------------------------------------------------------------
-SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPagePtr& rPage)
-{
- rStream << rPage.nPagePos;
- return rStream;
-}
-// -----------------------------------------------------------------------------
-//==================================================================
-// ONDXPagePtr
-//==================================================================
-//------------------------------------------------------------------
-ONDXPagePtr::ONDXPagePtr(const ONDXPagePtr& rRef)
- :ONDXPageRef(rRef)
- ,nPagePos(rRef.nPagePos)
-{
-}
-
-//------------------------------------------------------------------
-ONDXPagePtr::ONDXPagePtr(ONDXPage* pRefPage)
- :ONDXPageRef(pRefPage)
- ,nPagePos(0)
-{
- if (pRefPage)
- nPagePos = pRefPage->GetPagePos();
-}
-//------------------------------------------------------------------
-ONDXPagePtr& ONDXPagePtr::operator=(const ONDXPagePtr& rRef)
-{
- ONDXPageRef::operator=(rRef);
- nPagePos = rRef.nPagePos;
- return *this;
-}
-
-//------------------------------------------------------------------
-ONDXPagePtr& ONDXPagePtr::operator= (ONDXPage* pRef)
-{
- ONDXPageRef::operator=(pRef);
- nPagePos = (pRef) ? pRef->GetPagePos() : 0;
- return *this;
-}
-// -----------------------------------------------------------------------------
-static sal_uInt32 nValue;
-//------------------------------------------------------------------
-SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage)
-{
- rStream.Seek(rPage.GetPagePos() * PAGE_SIZE);
- rStream >> nValue >> rPage.aChild;
- rPage.nCount = sal_uInt16(nValue);
-
- for (sal_uInt16 i = 0; i < rPage.nCount; i++)
- rPage[i].Read(rStream, rPage.GetIndex());
- return rStream;
-}
-
-//------------------------------------------------------------------
-SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& rPage)
-{
- // Page doesn't exist yet
- sal_uIntPtr nSize = (rPage.GetPagePos() + 1) * PAGE_SIZE;
- if (nSize > rStream.Seek(STREAM_SEEK_TO_END))
- {
- rStream.SetStreamSize(nSize);
- rStream.Seek(rPage.GetPagePos() * PAGE_SIZE);
-
- char aEmptyData[PAGE_SIZE];
- memset(aEmptyData,0x00,PAGE_SIZE);
- rStream.Write((sal_uInt8*)aEmptyData,PAGE_SIZE);
- }
- sal_uIntPtr nCurrentPos = rStream.Seek(rPage.GetPagePos() * PAGE_SIZE);
- OSL_UNUSED( nCurrentPos );
-
- nValue = rPage.nCount;
- rStream << nValue << rPage.aChild;
-
- sal_uInt16 i = 0;
- for (; i < rPage.nCount; i++)
- rPage[i].Write(rStream, rPage);
-
- // check if we have to fill the stream with '\0'
- if(i < rPage.rIndex.getHeader().db_maxkeys)
- {
- sal_uIntPtr nTell = rStream.Tell() % PAGE_SIZE;
- sal_uInt16 nBufferSize = rStream.GetBufferSize();
- sal_uIntPtr nRemainSize = nBufferSize - nTell;
- if ( nRemainSize <= nBufferSize )
- {
- char* pEmptyData = new char[nRemainSize];
- memset(pEmptyData,0x00,nRemainSize);
- rStream.Write((sal_uInt8*)pEmptyData,nRemainSize);
- rStream.Seek(nTell);
- delete [] pEmptyData;
- }
- }
- return rStream;
-}
-// -----------------------------------------------------------------------------
-#if OSL_DEBUG_LEVEL > 1
-//------------------------------------------------------------------
-void ONDXPage::PrintPage()
-{
- OSL_TRACE("\nSDB: -----------Page: %d Parent: %d Count: %d Child: %d-----",
- nPagePos, HasParent() ? aParent->GetPagePos() : 0 ,nCount, aChild.GetPagePos());
-
- for (sal_uInt16 i = 0; i < nCount; i++)
- {
- ONDXNode rNode = (*this)[i];
- ONDXKey& rKey = rNode.GetKey();
- if (!IsLeaf())
- rNode.GetChild(&rIndex, this);
-
- if (rKey.getValue().isNull())
- {
- OSL_TRACE("SDB: [%d,NULL,%d]",rKey.GetRecord(), rNode.GetChild().GetPagePos());
- }
- else if (rIndex.getHeader().db_keytype)
- {
- OSL_TRACE("SDB: [%d,%f,%d]",rKey.GetRecord(), rKey.getValue().getDouble(),rNode.GetChild().GetPagePos());
- }
- else
- {
- OSL_TRACE("SDB: [%d,%s,%d]",rKey.GetRecord(), (const char* )ByteString(rKey.getValue().getString().getStr(), rIndex.m_pTable->getConnection()->getTextEncoding()).GetBuffer(),rNode.GetChild().GetPagePos());
- }
- }
- OSL_TRACE("SDB: -----------------------------------------------\n");
- if (!IsLeaf())
- {
-#if OSL_DEBUG_LEVEL > 1
- GetChild(&rIndex)->PrintPage();
- for (sal_uInt16 i = 0; i < nCount; i++)
- {
- ONDXNode rNode = (*this)[i];
- rNode.GetChild(&rIndex,this)->PrintPage();
- }
-#endif
- }
- OSL_TRACE("SDB: ===============================================\n");
-}
-#endif
-// -----------------------------------------------------------------------------
-sal_Bool ONDXPage::IsFull() const
-{
- return Count() == rIndex.getHeader().db_maxkeys;
-}
-// -----------------------------------------------------------------------------
-//------------------------------------------------------------------
-sal_uInt16 ONDXPage::Search(const ONDXKey& rSearch)
-{
- // binary search later
- sal_uInt16 i = NODE_NOTFOUND;
- while (++i < Count())
- if ((*this)[i].GetKey() == rSearch)
- break;
-
- return (i < Count()) ? i : NODE_NOTFOUND;
-}
-
-//------------------------------------------------------------------
-sal_uInt16 ONDXPage::Search(const ONDXPage* pPage)
-{
- sal_uInt16 i = NODE_NOTFOUND;
- while (++i < Count())
- if (((*this)[i]).GetChild() == pPage)
- break;
-
- // if not found, then we assume, that the page itself points to the page
- return (i < Count()) ? i : NODE_NOTFOUND;
-}
-// -----------------------------------------------------------------------------
-// runs recursively
-void ONDXPage::SearchAndReplace(const ONDXKey& rSearch,
- ONDXKey& rReplace)
-{
- OSL_ENSURE(rSearch != rReplace,"Invalid here:rSearch == rReplace");
- if (rSearch != rReplace)
- {
- sal_uInt16 nPos = NODE_NOTFOUND;
- ONDXPage* pPage = this;
-
- while (pPage && (nPos = pPage->Search(rSearch)) == NODE_NOTFOUND)
- pPage = pPage->aParent;
-
- if (pPage)
- {
- (*pPage)[nPos].GetKey() = rReplace;
- pPage->SetModified(sal_True);
- }
- }
-}
-// -----------------------------------------------------------------------------
-ONDXNode& ONDXPage::operator[] (sal_uInt16 nPos)
-{
- DBG_ASSERT(nCount > nPos, "falscher Indexzugriff");
- return ppNodes[nPos];
-}
-
-//------------------------------------------------------------------
-const ONDXNode& ONDXPage::operator[] (sal_uInt16 nPos) const
-{
- DBG_ASSERT(nCount > nPos, "falscher Indexzugriff");
- return ppNodes[nPos];
-}
-// -----------------------------------------------------------------------------
-void ONDXPage::Remove(sal_uInt16 nPos)
-{
- DBG_ASSERT(nCount > nPos, "falscher Indexzugriff");
-
- for (sal_uInt16 i = nPos; i < (nCount-1); i++)
- (*this)[i] = (*this)[i+1];
-
- nCount--;
- bModified = sal_True;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/exports.dxp b/connectivity/source/drivers/dbase/exports.dxp
deleted file mode 100755
index 7003307892..0000000000
--- a/connectivity/source/drivers/dbase/exports.dxp
+++ /dev/null
@@ -1 +0,0 @@
-component_getFactory
diff --git a/connectivity/source/drivers/dbase/makefile.mk b/connectivity/source/drivers/dbase/makefile.mk
deleted file mode 100755
index 5c3344b1da..0000000000
--- a/connectivity/source/drivers/dbase/makefile.mk
+++ /dev/null
@@ -1,137 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=dbase
-
-VISIBILITY_HIDDEN=TRUE
-
-# --- Settings ----------------------------------
-.IF "$(DBGUTIL_OJ)"!=""
-ENVCFLAGS+=/FR$(SLO)$/
-.ENDIF
-
-.INCLUDE : $(PRJ)$/makefile.pmk
-.INCLUDE : $(PRJ)$/version.mk
-
-# --- Files -------------------------------------
-
-SLOFILES=\
- $(SLO)$/DCode.obj \
- $(SLO)$/DResultSet.obj \
- $(SLO)$/DStatement.obj \
- $(SLO)$/DPreparedStatement.obj \
- $(SLO)$/dindexnode.obj \
- $(SLO)$/DIndexIter.obj \
- $(SLO)$/DDatabaseMetaData.obj \
- $(SLO)$/DCatalog.obj \
- $(SLO)$/DColumns.obj \
- $(SLO)$/DIndexColumns.obj \
- $(SLO)$/DIndex.obj \
- $(SLO)$/DIndexes.obj \
- $(SLO)$/DTable.obj \
- $(SLO)$/DTables.obj \
- $(SLO)$/DConnection.obj \
- $(SLO)$/Dservices.obj \
- $(SLO)$/DDriver.obj
-
-EXCEPTIONSFILES=\
- $(SLO)$/DCode.obj \
- $(SLO)$/DResultSet.obj \
- $(SLO)$/DStatement.obj \
- $(SLO)$/DPreparedStatement.obj \
- $(SLO)$/dindexnode.obj \
- $(SLO)$/DIndexIter.obj \
- $(SLO)$/DDatabaseMetaData.obj \
- $(SLO)$/DCatalog.obj \
- $(SLO)$/DColumns.obj \
- $(SLO)$/DIndexColumns.obj \
- $(SLO)$/DIndex.obj \
- $(SLO)$/DIndexes.obj \
- $(SLO)$/DTables.obj \
- $(SLO)$/DConnection.obj \
- $(SLO)$/Dservices.obj \
- $(SLO)$/DDriver.obj
-
-# [kh] ppc linux gcc compiler problem
-.IF "$(OS)$(COM)$(CPUNAME)"=="LINUXGCCPOWERPC"
-EXCEPTIONSNOOPTFILES= \
- $(SLO)$/DTable.obj
-.ELSE
-EXCEPTIONSFILES +=\
- $(SLO)$/DTable.obj
-.ENDIF
-
-
-SHL1VERSIONMAP=$(SOLARENV)/src/component.map
-
-# --- Library -----------------------------------
-
-SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SVLLIB) \
- $(TOOLSLIB) \
- $(UCBHELPERLIB) \
- $(SALLIB) \
- $(SALHELPERLIB) \
- $(DBTOOLSLIB) \
- $(DBFILELIB) \
- $(UNOTOOLSLIB) \
- $(COMPHELPERLIB)
-
-.IF "$(DBFILELIB)" == ""
-SHL1STDLIBS+= ifile.lib
-.ENDIF
-
-SHL1DEPN=
-SHL1IMPLIB= i$(DBASE_TARGET)
-
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
-
-
-# --- Targets ----------------------------------
-
-.INCLUDE : $(PRJ)$/target.pmk
-
-
-
-ALLTAR : $(MISC)/dbase.component
-
-$(MISC)/dbase.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- dbase.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt dbase.component
diff --git a/connectivity/source/drivers/evoab/LServices.cxx b/connectivity/source/drivers/evoab/LServices.cxx
deleted file mode 100644
index 00c41fee75..0000000000
--- a/connectivity/source/drivers/evoab/LServices.cxx
+++ /dev/null
@@ -1,114 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "LDriver.hxx"
-#include <cppuhelper/factory.hxx>
-
-using namespace connectivity::evoab;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount* _pT
- );
-
-//---------------------------------------------------------------------------------------
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- sal_Char const* pImplementationName
- )
- : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- inline
- sal_Bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
- }
- catch(...)
- {
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = 0;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- OEvoabDriver::getImplementationName_Static(),
- OEvoabDriver::getSupportedServiceNames_Static(),
- OEvoabDriver_CreateInstance, ::cppu::createSingleFactory)
- ;
-
- if(aReq.xRet.is())
- aReq.xRet->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab/exports.dxp b/connectivity/source/drivers/evoab/exports.dxp
deleted file mode 100755
index 7003307892..0000000000
--- a/connectivity/source/drivers/evoab/exports.dxp
+++ /dev/null
@@ -1 +0,0 @@
-component_getFactory
diff --git a/connectivity/source/drivers/evoab2/EApi.cxx b/connectivity/source/drivers/evoab2/EApi.cxx
deleted file mode 100644
index 1767ec1bcf..0000000000
--- a/connectivity/source/drivers/evoab2/EApi.cxx
+++ /dev/null
@@ -1,138 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <rtl/ustring.hxx>
-#include <osl/module.h>
-#include <stdio.h>
-#define DECLARE_FN_POINTERS 1
-#include "EApi.h"
-static const char *eBookLibNames[] = {
- "libebook-1.2.so.10", // bumped again
- "libebook-1.2.so.9", // evolution-2.8
- "libebook-1.2.so.5", // evolution-2.4 and 2.6+
- "libebook-1.2.so.3", // evolution-2.2
- "libebook.so.8" // evolution-2.0
-};
-
-typedef void (*SymbolFunc) (void);
-
-#define SYM_MAP(a) { #a, (SymbolFunc *)&a }
- static struct {
- const char *sym_name;
- SymbolFunc *ref_value;
- } aApiMap[] = {
- SYM_MAP( e_contact_field_name ),
- SYM_MAP( e_contact_get ),
- SYM_MAP( e_contact_get_type ),
- SYM_MAP( e_contact_field_id ),
- SYM_MAP( e_source_peek_name ),
- SYM_MAP( e_source_get_property ),
- SYM_MAP( e_source_list_peek_groups ),
- SYM_MAP( e_source_group_peek_sources ),
- SYM_MAP( e_book_new ),
- SYM_MAP( e_book_open ),
- SYM_MAP( e_book_get_uri ),
- SYM_MAP( e_book_get_source ),
- SYM_MAP( e_book_get_addressbooks ),
- SYM_MAP( e_book_get_contacts ),
- SYM_MAP( e_book_authenticate_user ),
- SYM_MAP( e_book_query_field_test ),
- SYM_MAP( e_book_query_and ),
- SYM_MAP( e_book_query_or ),
- SYM_MAP( e_book_query_not ),
- SYM_MAP( e_book_query_ref ),
- SYM_MAP( e_book_query_unref ),
- SYM_MAP( e_book_query_from_string ),
- SYM_MAP( e_book_query_to_string ),
- SYM_MAP( e_book_query_field_exists ),
- SYM_MAP( e_source_group_peek_base_uri)
- };
-#undef SYM_MAP
-
-static bool
-tryLink( oslModule &aModule, const char *pName )
-{
- for( guint i = 0; i < G_N_ELEMENTS( aApiMap ); i++ )
- {
- SymbolFunc aMethod;
- aMethod = (SymbolFunc) osl_getFunctionSymbol
- ( aModule, rtl::OUString::createFromAscii ( aApiMap[ i ].sym_name ).pData );
- if( !aMethod )
- {
- fprintf( stderr, "Warning: missing symbol '%s' in '%s'",
- aApiMap[ i ].sym_name, pName );
- return false;
- }
- * aApiMap[ i ].ref_value = aMethod;
- }
- return true;
-}
-
-bool EApiInit()
-{
- oslModule aModule;
-
- for( guint j = 0; j < G_N_ELEMENTS( eBookLibNames ); j++ )
- {
- aModule = osl_loadModule( rtl::OUString::createFromAscii
- ( eBookLibNames[ j ] ).pData,
- SAL_LOADMODULE_DEFAULT );
- if( aModule)
- {
- if ( tryLink( aModule, eBookLibNames[ j ] ) )
- return true;
- osl_unloadModule( aModule );
- }
- }
- fprintf( stderr, "Can find no compliant libebook client libraries\n" );
- return false;
-}
-
-#if 0
-// hjs: SOLARDEF does no longer exist please lookup the required
-// defines in a regular compile line
-/*
- * Test code - enable &
- *
- * Compile with ( after source LinuxIntelEnv.Set.sh )
- gcc $SOLARDEF -I $SOLARVER/$UPD/$INPATH/inc \
- -I. `pkg-config --cflags --libs gobject-2.0` \
- -L $SOLARVER/$UPD/$INPATH/lib -luno_sal -lstdc++ EApi.cxx
- */
-
-int main( int argc, char **argv)
-{
- return EApiInit();
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/EApi.h b/connectivity/source/drivers/evoab2/EApi.h
deleted file mode 100755
index c089fda927..0000000000
--- a/connectivity/source/drivers/evoab2/EApi.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_EVOAB_EVOLUTION_API_HXX_
-#define _CONNECTIVITY_EVOAB_EVOLUTION_API_HXX_
-#include <glib-object.h>
-
-// Initializes the API below, returns false if not available
-bool EApiInit();
-
-G_BEGIN_DECLS
-
-// This header defined all the API methods as
-// function pointers instead of real functions
-// this will all evaporate as it is compiled generating
-// no symbol lookups or relocations, but giving code
-// clarity.
-
-// We attempt to define a minimum API that we use:
-
-// e-contact.h
-#ifdef DECLARE_FN_POINTERS
-#define EAPI_EXTERN
-#else
-#define EAPI_EXTERN extern
-#endif
-
-
-typedef void EContact;
-#define E_CONTACT(a) ((EContact *)(a))
-#define E_TYPE_CONTACT (e_contact_get_type())
-typedef int EContactField;
-
-EAPI_EXTERN const char *(*e_contact_field_name) ( EContactField field_id);
-EAPI_EXTERN gpointer (*e_contact_get) (EContact *contact, EContactField field_id);
-EAPI_EXTERN gconstpointer (*e_contact_get_const) (EContact *contact, EContactField field_id);
-// e-source.h
-typedef void ESource;
-#define E_SOURCE(a) ((ESource *)(a))
-EAPI_EXTERN const char *(*e_source_peek_name) (ESource *source);
-EAPI_EXTERN const gchar *(*e_source_get_property) (ESource *source,
- const gchar *property);
-
-EAPI_EXTERN GType (*e_contact_get_type) (void);
-EAPI_EXTERN EContactField (*e_contact_field_id) (const char *field_name);
-
-// e-source-list.h
-typedef void ESourceList;
-EAPI_EXTERN GSList *(*e_source_list_peek_groups) (ESourceList *list);
-
-// e-source-group.h
-typedef void ESourceGroup;
-#define E_SOURCE_GROUP(a) ((ESourceGroup *)(a))
-
-EAPI_EXTERN GSList *(*e_source_group_peek_sources) (ESourceGroup *group);
-EAPI_EXTERN const char *(*e_source_group_peek_base_uri) (ESourceGroup *group);
-// e-book.h
-typedef enum {
- E_BOOK_QUERY_IS,
- E_BOOK_QUERY_CONTAINS,
- E_BOOK_QUERY_BEGINS_WITH,
- E_BOOK_QUERY_ENDS_WITH,
-} EBookQueryTest;
-
-typedef void EBook;
-typedef void EBookQuery;
-
-EAPI_EXTERN EBook *(*e_book_new) (ESource *source,
- GError **error);
-
-EAPI_EXTERN gboolean (*e_book_open) (EBook *book,
- gboolean only_if_exists,
- GError **error);
-
-EAPI_EXTERN const char *(*e_book_get_uri) (EBook *book);
-EAPI_EXTERN ESource *(*e_book_get_source)(EBook *book);
-
-EAPI_EXTERN gboolean (*e_book_get_addressbooks) (ESourceList **addressbook_sources,
- GError **error);
-
-EAPI_EXTERN gboolean (*e_book_get_contacts) (EBook *book,
- EBookQuery *query,
- GList **contacts,
- GError **error);
-
-EAPI_EXTERN gboolean (*e_book_authenticate_user) (EBook *book,
- const char *user,
- const char *passwd,
- const char *auth_method,
- GError **error);
-
-// e-book-query.h
-EAPI_EXTERN EBookQuery* (*e_book_query_field_exists) (EContactField field);
-EAPI_EXTERN EBookQuery* (*e_book_query_field_test) (EContactField field,
- EBookQueryTest test,
- const char *value);
-EAPI_EXTERN EBookQuery* (*e_book_query_and) (int nqs, EBookQuery **qs, gboolean unref);
-EAPI_EXTERN EBookQuery* (*e_book_query_or) (int nqs, EBookQuery **qs, gboolean unref);
-EAPI_EXTERN EBookQuery* (*e_book_query_not) (EBookQuery *q, gboolean unref);
-EAPI_EXTERN EBookQuery* (*e_book_query_ref) (EBookQuery *q);
-EAPI_EXTERN void (*e_book_query_unref) (EBookQuery *q);
-EAPI_EXTERN char* (*e_book_query_to_string) (EBookQuery *q);
-EAPI_EXTERN EBookQuery* (*e_book_query_from_string) (const char *query_string);
-
-typedef struct {
- char *address_format; /* the two letter country code that
- determines the format/meaning of the
- following fields */
- char *po;
- char *ext;
- char *street;
- char *locality;
- char *region;
- char *code;
- char *country;
-} EContactAddress;
-G_END_DECLS
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NCatalog.cxx b/connectivity/source/drivers/evoab2/NCatalog.cxx
deleted file mode 100644
index d1cc91b842..0000000000
--- a/connectivity/source/drivers/evoab2/NCatalog.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "NCatalog.hxx"
-#include "NConnection.hxx"
-#include "NTables.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include "NDebug.hxx"
-
-
-// -------------------------------------------------------------------------
-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)
- ,m_pConnection(_pCon)
- ,m_xMetaData(m_pConnection->getMetaData())
-{
-}
-void OEvoabCatalog::refreshTables()
-{
- TStringVector aVector;
- Sequence< ::rtl::OUString > aTypes(1);
- aTypes[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),aTypes);
-
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- ::rtl::OUString aName;
-
- while(xResult->next())
- {
- aName = xRow->getString(3);
- aVector.push_back(aName);
- }
- }
- if(m_pTables)
- m_pTables->reFill(aVector);
- else
- m_pTables = new OEvoabTables(m_xMetaData,*this,m_aMutex,aVector);
-}
-// XTablesSupplier
-Reference< XNameAccess > SAL_CALL OEvoabCatalog::getTables( ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- try
- {
- if (!m_pTables) {
- refreshTables();
- }
- }
- catch( const RuntimeException& )
- {
- // allowed to leave this method
- throw;
- }
- catch( const Exception& )
- {
- // allowed
- }
-
- return m_pTables;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NCatalog.hxx b/connectivity/source/drivers/evoab2/NCatalog.hxx
deleted file mode 100644
index b08b4e46a1..0000000000
--- a/connectivity/source/drivers/evoab2/NCatalog.hxx
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_EVOAB_CATALOG_HXX_
-#define _CONNECTIVITY_EVOAB_CATALOG_HXX_
-
-#include "connectivity/sdbcx/VCatalog.hxx"
-
-namespace connectivity
-{
- namespace evoab
- {
- class OEvoabConnection;
- class OEvoabCatalog : public connectivity::sdbcx::OCatalog
- {
- OEvoabConnection *m_pConnection;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
- public:
- OEvoabCatalog(OEvoabConnection *_pCon);
- inline OEvoabConnection* getConnection() const { return m_pConnection; }
- virtual void refreshTables();
- virtual void refreshViews() {}
- virtual void refreshGroups() {}
- virtual void refreshUsers() {}
- // XTablesSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTables(
- ) throw(::com::sun::star::uno::RuntimeException);
- };
- }
-}
-#endif // _CONNECTIVITY_MOZAB_CATALOG_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NColumns.cxx b/connectivity/source/drivers/evoab2/NColumns.cxx
deleted file mode 100644
index 53818b7507..0000000000
--- a/connectivity/source/drivers/evoab2/NColumns.cxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "NColumns.hxx"
-#include "NTable.hxx"
-#include "NTables.hxx"
-#include "NCatalog.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-
-using namespace connectivity::sdbcx;
-using namespace connectivity;
-using namespace ::comphelper;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace connectivity::evoab;
-
-// -------------------------------------------------------------------------
-sdbcx::ObjectType OEvoabColumns::createObject(const ::rtl::OUString& _rName)
-{
- Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(
- Any(),
- m_pTable->getSchema(),
- m_pTable->getTableName(),
- _rName);
-
- sdbcx::ObjectType xRet = NULL;
- if (xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
-
- while (xResult->next())
- {
- if (xRow->getString(4) == _rName)
- {
- OColumn* pRet = new OColumn(
- _rName,
- xRow->getString(6),
- xRow->getString(13),
- xRow->getString(12),
- xRow->getInt(11),
- xRow->getInt(7),
- xRow->getInt(9),
- xRow->getInt(5),
- sal_False,
- sal_False,
- sal_False,
- sal_True);
- xRet = pRet;
- break;
- }
- }
- }
-
- return xRet;
-}
-// -------------------------------------------------------------------------
-void OEvoabColumns::impl_refresh() throw(RuntimeException)
-{
- m_pTable->refreshColumns();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NColumns.hxx b/connectivity/source/drivers/evoab2/NColumns.hxx
deleted file mode 100644
index 34c01e911f..0000000000
--- a/connectivity/source/drivers/evoab2/NColumns.hxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_EVOAB_COLUMNS_HXX_
-#define _CONNECTIVITY_EVOAB_COLUMNS_HXX_
-
-#include "NTable.hxx"
-#include "connectivity/sdbcx/VCollection.hxx"
-
-namespace connectivity
-{
- namespace evoab
- {
- class OEvoabColumns : public sdbcx::OCollection
- {
- protected:
- OEvoabTable* m_pTable;
-
- virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
- virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
-
- public:
- OEvoabColumns( OEvoabTable* _pTable,
- ::osl::Mutex& _rMutex,
- const TStringVector &_rVector
- ) : sdbcx::OCollection(*_pTable,sal_True,_rMutex,_rVector),
- m_pTable(_pTable)
- { }
- };
- }
-}
-
-#endif // _CONNECTIVITY_EVOAB_COLUMNS_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NConnection.cxx b/connectivity/source/drivers/evoab2/NConnection.cxx
deleted file mode 100644
index f056f61719..0000000000
--- a/connectivity/source/drivers/evoab2/NConnection.cxx
+++ /dev/null
@@ -1,293 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "NConnection.hxx"
-#include "NDatabaseMetaData.hxx"
-#include "NCatalog.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/TransactionIsolation.hpp>
-#include <tools/urlobj.hxx>
-#include "NPreparedStatement.hxx"
-#include "NStatement.hxx"
-#include <comphelper/extract.hxx>
-#include <connectivity/dbexception.hxx>
-#include <comphelper/processfactory.hxx>
-#include <tools/debug.hxx>
-#include "NDebug.hxx"
-#include <comphelper/sequence.hxx>
-
-using namespace connectivity::evoab;
-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::lang;
-
-::rtl::OUString implGetExceptionMsg( Exception& e, const ::rtl::OUString& aExceptionType_ )
-{
- ::rtl::OUString aExceptionType = aExceptionType_;
- if( aExceptionType.getLength() == 0 )
- aExceptionType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown")) ;
-
- ::rtl::OUString aTypeLine( RTL_CONSTASCII_USTRINGPARAM("\nType: " ) );
- aTypeLine += aExceptionType;
-
- ::rtl::OUString aMessageLine( RTL_CONSTASCII_USTRINGPARAM("\nMessage: " ) );
- aMessageLine += ::rtl::OUString( e.Message );
-
- ::rtl::OUString aMsg(aTypeLine);
- aMsg += aMessageLine;
- return aMsg;
-}
-
- // Exception type unknown
-::rtl::OUString implGetExceptionMsg( Exception& e )
-{
- ::rtl::OUString aMsg = implGetExceptionMsg( e, ::rtl::OUString() );
- return aMsg;
-}
-
-// --------------------------------------------------------------------------------
-OEvoabConnection::OEvoabConnection( OEvoabDriver& _rDriver )
- :OSubComponent<OEvoabConnection, OConnection_BASE>( (::cppu::OWeakObject*)(&_rDriver), this )
- ,m_rDriver(_rDriver)
- ,m_xCatalog(NULL)
-{
-}
-//-----------------------------------------------------------------------------
-OEvoabConnection::~OEvoabConnection()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if(!isClosed()) {
- acquire();
- close();
- }
-}
-
-//-----------------------------------------------------------------------------
-void SAL_CALL OEvoabConnection::release() throw()
-{
- relase_ChildImpl();
-}
-
-// XServiceInfo
-// --------------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OEvoabConnection, "com.sun.star.sdbc.drivers.evoab.Connection", "com.sun.star.sdbc.Connection")
-
-//-----------------------------------------------------------------------------
-void OEvoabConnection::construct(const ::rtl::OUString& url, const Sequence< PropertyValue >& info) throw(SQLException)
-{
- osl_incrementInterlockedCount( &m_refCount );
- EVO_TRACE_STRING("OEvoabConnection::construct()::url = %s\n", url );
-
- ::rtl::OUString sPassword;
- const char* pPwd = "password";
-
- const PropertyValue *pIter = info.getConstArray();
- const PropertyValue *pEnd = pIter + info.getLength();
- for(;pIter != pEnd;++pIter)
- {
- if(!pIter->Name.compareToAscii(pPwd))
- {
- pIter->Value >>= sPassword;
- break;
- }
- }
-
- if (url.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdbc:address:evolution:groupwise")))
- setSDBCAddressType(SDBCAddress::EVO_GWISE);
- else if (url.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdbc:address:evolution:ldap")))
- setSDBCAddressType(SDBCAddress::EVO_LDAP);
- else
- setSDBCAddressType(SDBCAddress::EVO_LOCAL);
- setURL(url);
- setPassword(::rtl::OUStringToOString(sPassword,RTL_TEXTENCODING_UTF8));
- osl_decrementInterlockedCount( &m_refCount );
-}
-
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabConnection::nativeSQL( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException)
-{
- // when you need to transform SQL92 to you driver specific you can do it here
- return _sSql;
-}
-// --------------------------------------------------------------------------------
-Reference< XDatabaseMetaData > SAL_CALL OEvoabConnection::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
- if(!xMetaData.is())
- {
- xMetaData = new OEvoabDatabaseMetaData(this);
- m_xMetaData = xMetaData;
- }
-
- return xMetaData;
-}
-//------------------------------------------------------------------------------
-::com::sun::star::uno::Reference< XTablesSupplier > OEvoabConnection::createCatalog()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- Reference< XTablesSupplier > xTab = m_xCatalog;
- if(!xTab.is())
- {
- OEvoabCatalog *pCat = new OEvoabCatalog(this);
- xTab = pCat;
- m_xCatalog = xTab;
- }
- return xTab;
-}
-// --------------------------------------------------------------------------------
-Reference< XStatement > SAL_CALL OEvoabConnection::createStatement( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- OStatement* pStmt = new OStatement(this);
-
- Reference< XStatement > xStmt = pStmt;
- m_aStatements.push_back(WeakReferenceHelper(*pStmt));
- return xStmt;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL OEvoabConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- OEvoabPreparedStatement* pStmt = new OEvoabPreparedStatement( this );
- Reference< XPreparedStatement > xStmt = pStmt;
- pStmt->construct( sql );
-
- m_aStatements.push_back(WeakReferenceHelper(*pStmt));
- return xStmt;
-}
-
-Reference< XPreparedStatement > SAL_CALL OEvoabConnection::prepareCall( const ::rtl::OUString& /*sql*/ ) throw( SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::prepareCall", *this );
- return NULL;
-}
-sal_Bool SAL_CALL OEvoabConnection::isClosed( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- return OConnection_BASE::rBHelper.bDisposed;
-}
-
-// --------------------------------------------------------------------------------
-// XCloseable
-void SAL_CALL OEvoabConnection::close( ) throw(SQLException, RuntimeException)
-{
- { // we just dispose us
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- }
- dispose();
-}
-
-// --------------------------------------------------------------------------------
-// XWarningsSupplier
-Any SAL_CALL OEvoabConnection::getWarnings( ) throw(SQLException, RuntimeException)
-{
- return m_aWarnings.getWarnings();
-}
-void SAL_CALL OEvoabConnection::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- m_aWarnings.clearWarnings();
-}
-//------------------------------------------------------------------------------
-
-void OEvoabConnection::disposing()
-{
- // we noticed that we should be destroyed in near future so we have to dispose our statements
- ::osl::MutexGuard aGuard(m_aMutex);
- OConnection_BASE::disposing();
- dispose_ChildImpl();
-}
-
-// -------------------------------- stubbed methods ------------------------------------------------
-void SAL_CALL OEvoabConnection::setAutoCommit( sal_Bool /*autoCommit*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setAutoCommit", *this );
-}
-sal_Bool SAL_CALL OEvoabConnection::getAutoCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-void SAL_CALL OEvoabConnection::commit( ) throw(SQLException, RuntimeException)
-{
-}
-void SAL_CALL OEvoabConnection::rollback( ) throw(SQLException, RuntimeException)
-{
-}
-void SAL_CALL OEvoabConnection::setReadOnly( sal_Bool /*readOnly*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setReadOnly", *this );
-}
-sal_Bool SAL_CALL OEvoabConnection::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-void SAL_CALL OEvoabConnection::setCatalog( const ::rtl::OUString& /*catalog*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setCatalog", *this );
-}
-
-::rtl::OUString SAL_CALL OEvoabConnection::getCatalog( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-void SAL_CALL OEvoabConnection::setTransactionIsolation( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setTransactionIsolation", *this );
-}
-
-sal_Int32 SAL_CALL OEvoabConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- return TransactionIsolation::NONE;
-}
-
-Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OEvoabConnection::getTypeMap( ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::getTypeMap", *this );
- return NULL;
-}
-void SAL_CALL OEvoabConnection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setTypeMap", *this );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NConnection.hxx b/connectivity/source/drivers/evoab2/NConnection.hxx
deleted file mode 100644
index 2b25b76013..0000000000
--- a/connectivity/source/drivers/evoab2/NConnection.hxx
+++ /dev/null
@@ -1,126 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_EVOAB_CONNECTION_HXX_
-#define _CONNECTIVITY_EVOAB_CONNECTION_HXX_
-
-#include "NDriver.hxx"
-#include <com/sun/star/sdbc/SQLWarning.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include "OSubComponent.hxx"
-#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#include "connectivity/CommonTools.hxx"
-#include "connectivity/warningscontainer.hxx"
-#include "TConnection.hxx"
-#include <cppuhelper/weakref.hxx>
-#include <osl/module.h>
-#include "EApi.h"
-
-namespace connectivity
-{
- namespace evoab
- {
-
- namespace SDBCAddress {
- typedef enum {
- Unknown = 0,
- EVO_LOCAL = 1,
- EVO_LDAP = 2,
- EVO_GWISE = 3
- } sdbc_address_type;
- }
-
- typedef connectivity::OMetaConnection OConnection_BASE; // implements basics and text encoding
-
- class OEvoabConnection :public OConnection_BASE
- ,public connectivity::OSubComponent<OEvoabConnection, OConnection_BASE>
- {
- friend class connectivity::OSubComponent<OEvoabConnection, OConnection_BASE>;
-
- private:
- const OEvoabDriver& m_rDriver;
- SDBCAddress::sdbc_address_type m_eSDBCAddressType;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier >
- m_xCatalog;
- ::rtl::OString m_aPassword;
- ::dbtools::WarningsContainer m_aWarnings;
-
- virtual ~OEvoabConnection();
-
- public:
- OEvoabConnection( OEvoabDriver& _rDriver );
- virtual void construct(const ::rtl::OUString& _rUrl,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo ) throw( ::com::sun::star::sdbc::SQLException);
-
- inline rtl::OString getPassword() { return m_aPassword; }
- inline void setPassword( rtl::OString aStr ) { m_aPassword = aStr; }
- // own methods
- inline const OEvoabDriver& getDriver() const { return m_rDriver; }
-
- SDBCAddress::sdbc_address_type getSDBCAddressType() const { return m_eSDBCAddressType;}
- void setSDBCAddressType(SDBCAddress::sdbc_address_type _eSDBCAddressType) {m_eSDBCAddressType = _eSDBCAddressType;}
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
- // XInterface
- virtual void SAL_CALL release() throw();
-
- // XServiceInfo
- DECLARE_SERVICE_INFO();
-
- // XConnection
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog();
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XWarningsSupplier
- virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-#endif // _CONNECTIVITY_EVOAB_CONNECTION_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
deleted file mode 100644
index 5af4a68551..0000000000
--- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
+++ /dev/null
@@ -1,1196 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "NDatabaseMetaData.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/TransactionIsolation.hpp>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/FValue.hxx>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/ColumnSearch.hpp>
-
-#include <vector>
-#include <string.h>
-#include "EApi.h"
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-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 connectivity
-{
- namespace evoab
- {
- static sal_Int32 const s_nCOLUMN_SIZE = 256;
- static sal_Int32 const s_nDECIMAL_DIGITS = 0;
- static sal_Int32 const s_nNULLABLE = 1;
- static sal_Int32 const s_nCHAR_OCTET_LENGTH = 65535;
-
- static ColumnProperty **pFields=NULL;
- static guint nFields = 0;
-
- static const char *pBlackList[] =
- {
- "id",
- "list-show-addresses",
- "address-label-home",
- "address-label-work",
- "address-label-other"
- };
-
- const SplitEvoColumns* get_evo_addr()
- {
- static const SplitEvoColumns evo_addr[] = {
- {"addr-line1",DEFAULT_ADDR_LINE1},{"addr-line2",DEFAULT_ADDR_LINE2},{"city",DEFAULT_CITY},{"state",DEFAULT_STATE},{"country",DEFAULT_COUNTRY},{"zip",DEFAULT_ZIP},
- {"work-addr-line1",WORK_ADDR_LINE1},{"work-addr-line2",WORK_ADDR_LINE2},{"work-city",WORK_CITY},{"work-state",WORK_STATE},{"work-country",WORK_COUNTRY},{"work-zip",WORK_ZIP},
- {"home-addr-line1",HOME_ADDR_LINE1},{"home-addr-line2",HOME_ADDR_LINE2},{"home-addr-City",HOME_CITY},{"home-state",HOME_STATE},{"home-country",HOME_COUNTRY},{"home-zip",HOME_ZIP},
- {"other-addr-line1",OTHER_ADDR_LINE1},{"other-addr-line2",OTHER_ADDR_LINE2},{"other-addr-city",OTHER_CITY},{"other-addr-state",OTHER_STATE},{"other-addr-country",OTHER_COUNTRY},{"other-addr-zip",OTHER_ZIP}
- };
- return evo_addr;
- }
-
- static void
- splitColumn (ColumnProperty **pToBeFields)
- {
- const SplitEvoColumns* evo_addr( get_evo_addr() );
- for (int i = 0; i < OTHER_ZIP; i++)
- {
- pToBeFields[nFields] = g_new0(ColumnProperty,1);
- pToBeFields[nFields]->bIsSplittedValue = true;
- pToBeFields[nFields]->pField = g_param_spec_ref(g_param_spec_string (evo_addr[i].pColumnName,evo_addr[i].pColumnName,"",NULL,G_PARAM_WRITABLE));
- nFields++;
- }
- }
-
- static void
- initFields()
- {
- if( !pFields )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !pFields )
- {
- guint nProps;
- ColumnProperty **pToBeFields;
- GParamSpec **pProps;
- nFields = 0;
- pProps = g_object_class_list_properties
- ( (GObjectClass *) g_type_class_ref( E_TYPE_CONTACT ),
- &nProps );
- pToBeFields = g_new0(ColumnProperty *, (nProps + OTHER_ZIP)/* new column(s)*/ );
- for ( guint i = 0; i < nProps; i++ )
- {
- switch (pProps[i]->value_type)
- {
- case G_TYPE_STRING:
- case G_TYPE_BOOLEAN:
- {
- bool bAdd = true;
- const char *pName = g_param_spec_get_name( pProps[i] );
- for (unsigned int j = 0; j < G_N_ELEMENTS( pBlackList ); j++ )
- {
- if( !strcmp( pBlackList[j], pName ) )
- {
- bAdd = false;
- break;
- }
- }
- if( bAdd )
- {
- pToBeFields[nFields]= g_new0(ColumnProperty,1);
- pToBeFields[nFields]->bIsSplittedValue=false;
- pToBeFields[ nFields++ ]->pField = g_param_spec_ref( pProps[i] );
- }
- break;
- }
- default:
- break;
- }
- }
-
- splitColumn(pToBeFields);
- pFields = pToBeFields;
- }
- }
- }
-
-
- guint
- getFieldCount()
- {
- initFields();
- return nFields;
- }
-
- const ColumnProperty *
- getField(guint n)
- {
- initFields();
- if( n < nFields )
- return pFields[n];
- else
- return NULL;
- }
-
- GType
- getGFieldType( guint nCol )
- {
- initFields();
-
- sal_Int32 nType = G_TYPE_STRING;
- if ( nCol < nFields )
- return ((GParamSpec *)pFields[nCol]->pField)->value_type;
- return nType;
- }
-
- sal_Int32
- getFieldType( guint nCol )
- {
- sal_Int32 nType = getGFieldType( nCol );
- return nType == G_TYPE_STRING ? DataType::VARCHAR : DataType::BIT;
- }
-
- guint findEvoabField(const rtl::OUString& aColName)
- {
- guint nRet = (guint)-1;
- sal_Bool bFound = sal_False;
- initFields();
- for (guint i=0;(i < nFields) && !bFound;i++)
- {
- rtl::OUString aName = getFieldName(i);
- if (aName == aColName)
- {
- nRet = i;
- bFound = sal_True;
- }
- }
- return nRet;
- }
-
- rtl::OUString
- getFieldTypeName( guint nCol )
- {
- switch( getFieldType( nCol ) )
- {
- case DataType::BIT:
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BIT"));
- case DataType::VARCHAR:
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"));
- default:
- break;
- }
- return ::rtl::OUString();
- }
-
- rtl::OUString
- getFieldName( guint nCol )
- {
- const GParamSpec *pSpec = getField( nCol )->pField;
- rtl::OUString aName;
- initFields();
-
- if( pSpec )
- aName = rtl::OStringToOUString( g_param_spec_get_name( ( GParamSpec * )pSpec ),
- RTL_TEXTENCODING_UTF8 );
- aName = aName.replace( '-', '_' );
- return aName;
- }
-
- void
- free_column_resources()
- {
- for (int i=nFields-1;i > 0;i--)
- {
- if (pFields && pFields[i] )
- {
- if (pFields[i]->pField)
- g_param_spec_unref(pFields[i]->pField);
- g_free(pFields[i]);
- }
- }
- if(pFields)
- {
- g_free(pFields);
- pFields=NULL;
- }
-
- }
-
-
- }
-}
-
-
-OEvoabDatabaseMetaData::OEvoabDatabaseMetaData(OEvoabConnection* _pCon)
- : ::connectivity::ODatabaseMetaDataBase(_pCon, _pCon->getConnectionInfo())
- ,m_pConnection(_pCon)
-{
- OSL_ENSURE(m_pConnection,"OEvoabDatabaseMetaData::OEvoabDatabaseMetaData: No connection set!");
-}
-OEvoabDatabaseMetaData::~OEvoabDatabaseMetaData()
-{
-}
-
-// -------------------------------------------------------------------------
-ODatabaseMetaDataResultSet::ORows& OEvoabDatabaseMetaData::getColumnRows( const ::rtl::OUString& columnNamePattern )
-{
- static ODatabaseMetaDataResultSet::ORows aRows;
- ODatabaseMetaDataResultSet::ORow aRow(19);
- aRows.clear();
-
- // ****************************************************
- // Some entries in a row never change, so set them now
- // ****************************************************
-
- // Catalog
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")));
- // Schema
- aRow[2] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")));
- // COLUMN_SIZE
- aRow[7] = new ORowSetValueDecorator(s_nCOLUMN_SIZE);
- // BUFFER_LENGTH, not used
- aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
- // DECIMAL_DIGITS.
- aRow[9] = new ORowSetValueDecorator(s_nDECIMAL_DIGITS);
- // NUM_PREC_RADIX
- aRow[10] = new ORowSetValueDecorator((sal_Int32)10);
- // NULLABLE
- aRow[11] = new ORowSetValueDecorator(s_nNULLABLE);
- // REMARKS
- aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue();
- // COULUMN_DEF, not used
- aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
- // SQL_DATA_TYPE, not used
- aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue();
- // SQL_DATETIME_SUB, not used
- aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue();
- // CHAR_OCTET_LENGTH, refer to [5]
- aRow[16] = new ORowSetValueDecorator(s_nCHAR_OCTET_LENGTH);
- // IS_NULLABLE
- aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES")));
-
-
- aRow[3] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE")));
- ::osl::MutexGuard aGuard( m_aMutex );
-
- initFields();
- for (sal_Int32 i = 0; i < (sal_Int32) nFields; i++)
- {
- if( match( columnNamePattern, getFieldName( i ), '\0' ) )
- {
- aRow[5] = new ORowSetValueDecorator( static_cast<sal_Int16>( getFieldType( i ) ) );
- aRow[6] = new ORowSetValueDecorator( getFieldTypeName( i ) );
-
- OSL_TRACE( "ColumnName = '%s'", g_param_spec_get_name( pFields[i]->pField ) );
- // COLUMN_NAME
- aRow[4] = new ORowSetValueDecorator( getFieldName( i ) );
- // ORDINAL_POSITION
- aRow[17] = new ORowSetValueDecorator( i );
- aRows.push_back( aRow );
- }
- }
-
- return aRows ;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString OEvoabDatabaseMetaData::impl_getCatalogSeparator_throw( )
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 OEvoabDatabaseMetaData::impl_getMaxStatements_throw( )
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 OEvoabDatabaseMetaData::impl_getMaxTablesInSelect_throw( )
-{
- // We only support a single table
- return 1;
-}
-// -------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool OEvoabDatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool OEvoabDatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool OEvoabDatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aVal;
- return aVal;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString OEvoabDatabaseMetaData::impl_getIdentifierQuoteString_throw( )
-{
- // normally this is "
- ::rtl::OUString aVal(RTL_CONSTASCII_USTRINGPARAM("\""));
- return aVal;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aVal;
- return aVal;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool OEvoabDatabaseMetaData::impl_isCatalogAtStart_throw( )
-{
- sal_Bool bValue = sal_False;
- return bValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool OEvoabDatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException)
-{
- return sal_True; // should be supported at least
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool OEvoabDatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool OEvoabDatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool OEvoabDatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException)
-{
- // We allow you to select from any table.
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- // For now definately read-only, no support for update/delete
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException)
-{
- // todo add Support for this.
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool OEvoabDatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
-{
- // Any case may be used
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- return m_pConnection->getURL();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)1);
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)0);
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
-{
- return 1;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- return TransactionIsolation::NONE;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsResultSetType( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsResultSetConcurrency( sal_Int32 /*setType*/, sal_Int32 /*concurrency*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::ownUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::ownDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::ownInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::othersUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::othersDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::othersInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-// here follow all methods which return a resultset
-// the first methods is an example implementation how to use this resultset
-// of course you could implement it on your and you should do this because
-// the general way is more memory expensive
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
-{
- /* Dont need to change as evoab driver supports only table */
-
- // there exists no possibility to get table types so we have to check
- static ::rtl::OUString sTableTypes[] =
- {
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE")),
- // Currently we only support a 'TABLE' nothing more complex
- };
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
- Reference< XResultSet > xRef = pResult;
-
- // here we fill the rows which should be visible when ask for data from the resultset returned here
- sal_Int32 nSize = sizeof(sTableTypes) / sizeof(::rtl::OUString);
- ODatabaseMetaDataResultSet::ORows aRows;
- for(sal_Int32 i=0;i < nSize;++i)
- {
- ODatabaseMetaDataResultSet::ORow aRow;
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(sTableTypes[i]));
-
- // bound row
- aRows.push_back(aRow);
- }
- // here we set the rows at the resultset
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( )
-{
- /*
- * Return the proper type information required by evo driver
- */
-
- ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo);
-
- Reference< XResultSet > xResultSet = pResultSet;
- static ODatabaseMetaDataResultSet::ORows aRows;
-
- if(aRows.empty())
- {
- ODatabaseMetaDataResultSet::ORow aRow;
- aRow.reserve(19);
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"))));
- aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR));
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)s_nCHAR_OCTET_LENGTH));
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- // aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::FULL));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)10));
-
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")));
- aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)65535);
- aRows.push_back(aRow);
- }
- pResultSet->setRows(aRows);
- return xResultSet;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getColumns(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*tableNamePattern*/,
- const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
-{
- // this returns an empty resultset where the column-names are already set
- // in special the metadata of the resultset already returns the right columns
- ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumns );
- Reference< XResultSet > xResultSet = pResultSet;
- pResultSet->setRows( getColumnRows( columnNamePattern ) );
- return xResultSet;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/,
- const ::rtl::OUString& /*tableNamePattern*/, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes);
- Reference< XResultSet > xRef = pResult;
-
- // check if any type is given
- // when no types are given then we have to return all tables e.g. TABLE
-
- const ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
-
- sal_Bool bTableFound = sal_True;
- sal_Int32 nLength = types.getLength();
- if(nLength)
- {
- bTableFound = sal_False;
-
- const ::rtl::OUString* pBegin = types.getConstArray();
- const ::rtl::OUString* pEnd = pBegin + nLength;
- for(;pBegin != pEnd;++pBegin)
- {
- if(*pBegin == aTable)
- {
- bTableFound = sal_True;
- break;
- }
- }
- }
- if(!bTableFound)
- return xRef;
-
- ODatabaseMetaDataResultSet::ORows aRows;
-
- ESourceList *pSourceList;
- if( !e_book_get_addressbooks (&pSourceList, NULL) )
- pSourceList = NULL;
-
- GSList *g;
- for( g = e_source_list_peek_groups( pSourceList ); g; g = g->next)
- {
- GSList *s;
- const char *p = e_source_group_peek_base_uri(E_SOURCE_GROUP(g->data));
-
- switch (m_pConnection->getSDBCAddressType()) {
- case SDBCAddress::EVO_GWISE:
- if ( !strncmp( "groupwise://", p, 11 ))
- break;
- else
- continue;
- case SDBCAddress::EVO_LOCAL:
- if ( !strncmp( "file://", p, 6 ) ||
- !strncmp( "local://", p, 6 ) )
- break;
- else
- continue;
- case SDBCAddress::EVO_LDAP:
- if ( !strncmp( "ldap://", p, 6 ))
- break;
- else
- continue;
- case SDBCAddress::Unknown:
- break;
- }
- for (s = e_source_group_peek_sources (E_SOURCE_GROUP (g->data)); s; s = s->next)
- {
- ESource *pSource = E_SOURCE (s->data);
-
- rtl::OUString aName = rtl::OStringToOUString( e_source_peek_name( pSource ),
- RTL_TEXTENCODING_UTF8 );
-
- ODatabaseMetaDataResultSet::ORow aRow(3);
- aRow.reserve(6);
- aRow.push_back(new ORowSetValueDecorator(aName));
- aRow.push_back(new ORowSetValueDecorator(aTable));
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRows.push_back(aRow);
- }
- }
-
- pResult->setRows(aRows);
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getUDTs( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XDatabaseMetaDaza::getUDTs", *this );
- return NULL;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx
deleted file mode 100644
index a0fe1788e2..0000000000
--- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx
+++ /dev/null
@@ -1,237 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_EVOAB_DATABASEMETADATA_HXX_
-#define _CONNECTIVITY_EVOAB_DATABASEMETADATA_HXX_
-
-#include "NDebug.hxx"
-#include "NConnection.hxx"
-#include "TDatabaseMetaDataBase.hxx"
-#include "FDatabaseMetaDataResultSet.hxx"
-
-
-namespace connectivity
-{
- namespace evoab
- {
- class EvoContacts;
-
-
- //**************************************************************
- //************ Class: OEvoabDatabaseMetaData
- //**************************************************************
- typedef struct{
- gboolean bIsSplittedValue;
- GParamSpec *pField;
- }ColumnProperty;
-
- typedef enum {
- DEFAULT_ADDR_LINE1=1,DEFAULT_ADDR_LINE2,DEFAULT_CITY,DEFAULT_STATE,DEFAULT_COUNTRY,DEFAULT_ZIP,
- WORK_ADDR_LINE1,WORK_ADDR_LINE2,WORK_CITY,WORK_STATE,WORK_COUNTRY,WORK_ZIP,
- HOME_ADDR_LINE1,HOME_ADDR_LINE2,HOME_CITY,HOME_STATE,HOME_COUNTRY,HOME_ZIP,
- OTHER_ADDR_LINE1,OTHER_ADDR_LINE2,OTHER_CITY,OTHER_STATE,OTHER_COUNTRY,OTHER_ZIP
- }ColumnNumber;
-
- typedef struct {
- const gchar *pColumnName;
- ColumnNumber value;
- }SplitEvoColumns;
-
- const SplitEvoColumns* get_evo_addr();
-
- const ColumnProperty *getField(guint n);
- guint getFieldCount() ;
- GType getGFieldType(guint nCol) ;
- sal_Int32 getFieldType(guint nCol) ;
- rtl::OUString getFieldTypeName(guint nCol) ;
- rtl::OUString getFieldName(guint nCol) ;
- guint findEvoabField(const rtl::OUString& aColName);
-
- void free_column_resources();
-
- class OEvoabDatabaseMetaData : public ODatabaseMetaDataBase
- {
- OEvoabConnection* m_pConnection;
-
- ODatabaseMetaDataResultSet::ORows& getColumnRows( const ::rtl::OUString& columnNamePattern );
-
- protected:
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw();
- // cached database information
- virtual ::rtl::OUString impl_getIdentifierQuoteString_throw( );
- virtual sal_Bool impl_isCatalogAtStart_throw( );
- virtual ::rtl::OUString impl_getCatalogSeparator_throw( );
- virtual sal_Bool impl_supportsCatalogsInTableDefinitions_throw( );
- virtual sal_Bool impl_supportsSchemasInTableDefinitions_throw( ) ;
- virtual sal_Bool impl_supportsCatalogsInDataManipulation_throw( );
- virtual sal_Bool impl_supportsSchemasInDataManipulation_throw( ) ;
- virtual sal_Bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) ;
- virtual sal_Bool impl_supportsAlterTableWithAddColumn_throw( );
- virtual sal_Bool impl_supportsAlterTableWithDropColumn_throw( );
- virtual sal_Int32 impl_getMaxStatements_throw( );
- virtual sal_Int32 impl_getMaxTablesInSelect_throw( );
- virtual sal_Bool impl_storesMixedCaseQuotedIdentifiers_throw( );
-
- virtual ~OEvoabDatabaseMetaData();
- public:
- inline OEvoabConnection* getOwnConnection() const { return m_pConnection; }
-
- OEvoabDatabaseMetaData(OEvoabConnection* _pCon);
-
- // as I mentioned before this interface is really BIG
- // XDatabaseMetaData
- virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getUserName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDriverName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL usesLocalFiles( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsUnion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsUnionAll( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxConnections( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // _CONNECTIVITY_EVOAB_DATABASEMETADATA_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NDebug.cxx b/connectivity/source/drivers/evoab2/NDebug.cxx
deleted file mode 100644
index 92e360425b..0000000000
--- a/connectivity/source/drivers/evoab2/NDebug.cxx
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "NDebug.hxx"
-#include <osl/diagnose.h>
-#ifdef DEBUG
-void evo_traceStringMessage( const sal_Char *pFormat,
- const ::rtl::OUString& rString )
-{
- rtl::OString aStr;
- aStr = ::rtl::OUStringToOString (rString, RTL_TEXTENCODING_UTF8);
- OSL_TRACE(pFormat, (const sal_Char *) aStr );
-}
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NDebug.hxx b/connectivity/source/drivers/evoab2/NDebug.hxx
deleted file mode 100644
index 77f7269c82..0000000000
--- a/connectivity/source/drivers/evoab2/NDebug.hxx
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX
-#define CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX
-
-#include <stdio.h>
-#include <rtl/ustring.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-
-#ifdef DEBUG
- void evo_traceStringMessage( const sal_Char* pFormat, const ::rtl::OUString& rString );
-# define EVO_TRACE_STRING( pFormat, rString ) evo_traceStringMessage( pFormat, rString )
-#else
-# define EVO_TRACE_STRING( pFormat, rString ) ((void)0)
-#endif
-
-#endif // CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NDriver.cxx b/connectivity/source/drivers/evoab2/NDriver.cxx
deleted file mode 100644
index ddb8d78b54..0000000000
--- a/connectivity/source/drivers/evoab2/NDriver.cxx
+++ /dev/null
@@ -1,192 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "NDriver.hxx"
-#include "NConnection.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "connectivity/dbexception.hxx"
-#include <osl/file.hxx>
-#include "osl/security.hxx"
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/ucb/XContentAccess.hpp>
-#include <com/sun/star/ucb/XCommandEnvironment.hpp>
-#include <ucbhelper/content.hxx>
-#include <tools/debug.hxx>
-#include "NDebug.hxx"
-#include <signal.h>
-#include "resource/common_res.hrc"
-#include "resource/sharedresources.hxx"
-
-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< XMultiServiceFactory >& _rxFactory) :
- ODriver_BASE( m_aMutex ), m_xFactory( _rxFactory )
-{
-}
-// -----------------------------------------------------------------------------
-OEvoabDriver::~OEvoabDriver()
-{
-}
-// -----------------------------------------------------------------------------
-void OEvoabDriver::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- // when driver will be destroied so all our connections have to be destroied as well
- for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
- {
- Reference< XComponent > xComp(i->get(), UNO_QUERY);
- if (xComp.is())
- {
- try
- {
- xComp->dispose();
- }
- catch (const com::sun::star::lang::DisposedException&)
- {
- xComp.clear();
- }
- }
- }
- m_xConnections.clear();
- connectivity::OWeakRefArray().swap(m_xConnections); // this really clears
-
- ODriver_BASE::disposing();
-}
-
-// static ServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString OEvoabDriver::getImplementationName_Static( ) throw(RuntimeException)
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(EVOAB_DRIVER_IMPL_NAME));
- // this name is referenced in the configuration and in the evoab.xml
- // Please take care when changing it.
-}
-
-//------------------------------------------------------------------
-Sequence< ::rtl::OUString > OEvoabDriver::getSupportedServiceNames_Static( ) throw (RuntimeException)
-{
- // which service is supported
- // for more information @see com.sun.star.sdbc.Driver
- Sequence< ::rtl::OUString > aSNS( 1 );
- aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver"));
- return aSNS;
-}
-//------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabDriver::getImplementationName( ) throw(RuntimeException)
-{
- return getImplementationName_Static();
-}
-//------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-//------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL OEvoabDriver::getSupportedServiceNames( ) throw(RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-
-//------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::evoab::OEvoabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
-{
- return *(new OEvoabDriver(_rxFactory));
-}
-// --------------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL OEvoabDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if (ODriver_BASE::rBHelper.bDisposed)
- throw DisposedException();
-
- if ( ! acceptsURL(url) )
- return NULL;
-
- OEvoabConnection* pCon = new OEvoabConnection( *this );
- pCon->construct(url,info);
- Reference< XConnection > xCon = pCon;
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
-
- return xCon;
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabDriver::acceptsURL( const ::rtl::OUString& url )
- throw(SQLException, RuntimeException)
-{
- return acceptsURL_Stat(url);
-}
-
-// --------------------------------------------------------------------------------
-Sequence< DriverPropertyInfo > SAL_CALL OEvoabDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException)
-{
- if ( ! acceptsURL(url) )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- } // if ( ! acceptsURL(url) )
-
- // if you have somthing special to say return it here :-)
- return Sequence< DriverPropertyInfo >();
-}
-
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDriver::getMajorVersion( ) throw(RuntimeException)
-{
- return 1;
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabDriver::getMinorVersion( ) throw(RuntimeException)
-{
- return 0;
-}
-// --------------------------------------------------------------------------------
-sal_Bool OEvoabDriver::acceptsURL_Stat( const ::rtl::OUString& url )
-{
- return (url.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdbc:address:evolution:local")) || url.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdbc:address:evolution:groupwise"))||url.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdbc:address:evolution:ldap")))&& EApiInit();
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NDriver.hxx b/connectivity/source/drivers/evoab2/NDriver.hxx
deleted file mode 100644
index c8917bffa6..0000000000
--- a/connectivity/source/drivers/evoab2/NDriver.hxx
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_EVOAB_DRIVER_HXX_
-#define _CONNECTIVITY_EVOAB_DRIVER_HXX_
-
-#include <com/sun/star/sdbc/XDriver.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/compbase2.hxx>
-#include "connectivity/CommonTools.hxx"
-#include <osl/module.h>
-
-#define EVOAB_EVOLUTION_SCHEMA "evolution"
-/*In Future, when seperate schema is required for ldap, groupwise*/
-#define EVOAB_LDAP_SCHEMA "ldap"
-#define EVOAB_GWISE_SCHEMA "groupwise"
-
-#define EVOAB_DRIVER_IMPL_NAME "com.sun.star.comp.sdbc.evoab.OEvoabDriver"
-
-namespace connectivity
-{
- namespace evoab
- {
-
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL OEvoabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception );
-
-
- typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver,
- ::com::sun::star::lang::XServiceInfo > ODriver_BASE;
-
-
- class OEvoabDriver : public ODriver_BASE
- {
-
- protected:
- ::osl::Mutex m_aMutex;
- connectivity::OWeakRefArray m_xConnections;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
-
- public:
- OEvoabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
- virtual ~OEvoabDriver();
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
-
- // XInterface
- static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-
-
- // XDriver
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException);
-
- public:
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- & getMSFactory(void) const { return m_xFactory; }
-
- // static methods
- static sal_Bool acceptsURL_Stat( const ::rtl::OUString& url );
- };
- }
-
-}
-#endif //_CONNECTIVITY_EVOAB_DRIVER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NPreparedStatement.cxx b/connectivity/source/drivers/evoab2/NPreparedStatement.cxx
deleted file mode 100644
index 1aadfbf031..0000000000
--- a/connectivity/source/drivers/evoab2/NPreparedStatement.cxx
+++ /dev/null
@@ -1,338 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <stdio.h>
-#include <osl/diagnose.h>
-#include "NPreparedStatement.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "propertyids.hxx"
-#include <connectivity/dbexception.hxx>
-#include <connectivity/dbtools.hxx>
-#include <tools/diagnose_ex.h>
-
-#include "resource/common_res.hrc"
-
-using namespace connectivity::evoab;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::container;
-using namespace com::sun::star::io;
-using namespace com::sun::star::util;
-
-IMPLEMENT_SERVICE_INFO(OEvoabPreparedStatement,"com.sun.star.sdbcx.evoab.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
-
-
-OEvoabPreparedStatement::OEvoabPreparedStatement( OEvoabConnection* _pConnection )
- :OCommonStatement(_pConnection)
- ,m_sSqlStatement()
- ,m_xMetaData()
-{
-}
-
-// -----------------------------------------------------------------------------
-void OEvoabPreparedStatement::construct( const ::rtl::OUString& _sql )
-{
- m_sSqlStatement = _sql;
-
- m_aQueryData = impl_getEBookQuery_throw( m_sSqlStatement );
- ENSURE_OR_THROW( m_aQueryData.getQuery(), "no EBookQuery" );
- ENSURE_OR_THROW( m_aQueryData.xSelectColumns.is(), "no SelectColumn" );
-
- // create our meta data
- OEvoabResultSetMetaData* pMeta = new OEvoabResultSetMetaData( m_aQueryData.sTable );
- m_xMetaData = pMeta;
- pMeta->setEvoabFields( m_aQueryData.xSelectColumns );
-}
-
-// -----------------------------------------------------------------------------
-OEvoabPreparedStatement::~OEvoabPreparedStatement()
-{
-}
-
-// -----------------------------------------------------------------------------
-void SAL_CALL OEvoabPreparedStatement::acquire() throw()
-{
- OCommonStatement::acquire();
-}
-
-// -----------------------------------------------------------------------------
-void SAL_CALL OEvoabPreparedStatement::release() throw()
-{
- OCommonStatement::release();
-}
-
-// -----------------------------------------------------------------------------
-Any SAL_CALL OEvoabPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OCommonStatement::queryInterface(rType);
- if(!aRet.hasValue())
- aRet = OPreparedStatement_BASE::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OEvoabPreparedStatement::getTypes( ) throw(RuntimeException)
-{
- return ::comphelper::concatSequences(OPreparedStatement_BASE::getTypes(),OCommonStatement::getTypes());
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSetMetaData > SAL_CALL OEvoabPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
-
- // the meta data should have been created at construction time
- ENSURE_OR_THROW( m_xMetaData.is(), "internal error: no meta data" );
- return m_xMetaData;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::close( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
-
- free_column_resources();
- // Reset last warning message
- try {
- clearWarnings ();
- OCommonStatement::close();
- }
- catch (SQLException &) {
- // If we get an error, ignore
- }
-
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OEvoabPreparedStatement::execute( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
-
- Reference< XResultSet> xRS = impl_executeQuery_throw( m_aQueryData );
- return xRS.is();
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OEvoabPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this );
- return 0;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setString( sal_Int32 /*parameterIndex*/, const ::rtl::OUString& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setString", *this );
-}
-// -------------------------------------------------------------------------
-
-Reference< XConnection > SAL_CALL OEvoabPreparedStatement::getConnection( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
-
- return impl_getConnection();
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSet > SAL_CALL OEvoabPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
-
- return impl_executeQuery_throw( m_aQueryData );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setBoolean( sal_Int32 /*parameterIndex*/, sal_Bool /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setBoolean", *this );
-
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OEvoabPreparedStatement::setByte( sal_Int32 /*parameterIndex*/, sal_Int8 /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setByte", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setDate( sal_Int32 /*parameterIndex*/, const Date& /*aData*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setDate", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setTime( sal_Int32 /*parameterIndex*/, const Time& /*aVal*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setTime", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setTimestamp( sal_Int32 /*parameterIndex*/, const DateTime& /*aVal*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setTimestamp", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setDouble( sal_Int32 /*parameterIndex*/, double /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setDouble", *this );
-}
-
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setFloat( sal_Int32 /*parameterIndex*/, float /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setFloat", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setInt( sal_Int32 /*parameterIndex*/, sal_Int32 /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setInt", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setLong( sal_Int32 /*parameterIndex*/, sal_Int64 /*aVal*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setLong", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setNull( sal_Int32 /*parameterIndex*/, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setNull", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setClob", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setBlob", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setArray", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setRef", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setObjectWithInfo( sal_Int32 /*parameterIndex*/, const Any& /*x*/, sal_Int32 /*sqlType*/, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setObjectWithInfo", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setObjectNull( sal_Int32 /*parameterIndex*/, sal_Int32 /*sqlType*/, const ::rtl::OUString& /*typeName*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setObjectNull", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException)
-{
- if(!::dbtools::implSetObject(this,parameterIndex,x))
- {
- const ::rtl::OUString sError( getOwnConnection()->getResources().getResourceStringWithSubstitution(
- STR_UNKNOWN_PARA_TYPE,
- "$position$", ::rtl::OUString::valueOf(parameterIndex)
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setShort( sal_Int32 /*parameterIndex*/, sal_Int16 /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setShort", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setBytes( sal_Int32 /*parameterIndex*/, const Sequence< sal_Int8 >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setBytes", *this );
-}
-// -------------------------------------------------------------------------
-
-
-void SAL_CALL OEvoabPreparedStatement::setCharacterStream( sal_Int32 /*parameterIndex*/, const Reference< XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setCharacterStream", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::setBinaryStream( sal_Int32 /*parameterIndex*/, const Reference< XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setBinaryStream", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OEvoabPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException)
-{
-}
-// -----------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL OEvoabPreparedStatement::getResultSet( ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabPreparedStatement::getUpdateCount( ) throw(SQLException, RuntimeException)
-{
- return 0;
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabPreparedStatement::getMoreResults( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NPreparedStatement.hxx b/connectivity/source/drivers/evoab2/NPreparedStatement.hxx
deleted file mode 100644
index af0e56729f..0000000000
--- a/connectivity/source/drivers/evoab2/NPreparedStatement.hxx
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_EVOAB_PREPAREDSTATEMENT_HXX_
-#define _CONNECTIVITY_EVOAB_PREPAREDSTATEMENT_HXX_
-
-#include "NStatement.hxx"
-#include "NConnection.hxx"
-#include "NDatabaseMetaData.hxx"
-#include "NResultSet.hxx"
-#include <com/sun/star/sdbc/XPreparedStatement.hpp>
-#include <com/sun/star/sdbc/XParameters.hpp>
-#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
-#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-
-namespace connectivity
-{
- namespace evoab
- {
-
- class OBoundParam;
- typedef ::cppu::ImplHelper5< ::com::sun::star::sdbc::XPreparedStatement,
- ::com::sun::star::sdbc::XParameters,
- ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
- ::com::sun::star::sdbc::XMultipleResults,
- ::com::sun::star::lang::XServiceInfo> OPreparedStatement_BASE;
-
- class OEvoabPreparedStatement :public OCommonStatement
- ,public OPreparedStatement_BASE
- {
- protected:
- struct Parameter
- {
- ::com::sun::star::uno::Any aValue;
- sal_Int32 nDataType;
-
- Parameter(const ::com::sun::star::uno::Any& rValue,
- sal_Int32 rDataType) : aValue(rValue),nDataType(rDataType)
- {
- }
-
- };
-
- ::std::vector< Parameter> m_aParameters;
- //====================================================================
- // Data attributes
- //====================================================================
-
- // our SQL statement
- ::rtl::OUString m_sSqlStatement;
- // the EBookQuery we're working with
- QueryData m_aQueryData;
- // our meta data
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData;
-
- protected:
- virtual ~OEvoabPreparedStatement();
-
- public:
- OEvoabPreparedStatement( OEvoabConnection* _pConnection );
-
- void construct( const ::rtl::OUString& _sql );
-
- protected:
- DECLARE_SERVICE_INFO();
- //XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
- //XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XPreparedStatement
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XParameters
- virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XResultSetMetaDataSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XMultipleResults
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-#endif // CONNECTIVITY_SPREPAREDSTATEMENT_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx
deleted file mode 100644
index ce0713537c..0000000000
--- a/connectivity/source/drivers/evoab2/NResultSet.cxx
+++ /dev/null
@@ -1,1024 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "NDatabaseMetaData.hxx"
-#include "NConnection.hxx"
-#include "NResultSet.hxx"
-#include "propertyids.hxx"
-#include "resource/evoab2_res.hrc"
-#include "TSortIndex.hxx"
-#include <algorithm>
-
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdb/ErrorCondition.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-
-#include <comphelper/componentcontext.hxx>
-#include <comphelper/extract.hxx>
-#include <comphelper/property.hxx>
-#include <comphelper/sequence.hxx>
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/sqlerror.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <rtl/string.hxx>
-#include <tools/diagnose_ex.h>
-#include <unotools/syslocale.hxx>
-#include <unotools/intlwrapper.hxx>
-
-#include <cstring>
-#include <vector>
-
-namespace connectivity { namespace evoab {
-
-using namespace ::comphelper;
-using namespace com::sun::star;
-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;
-
-//------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabResultSet::getImplementationName( ) throw ( RuntimeException) \
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.evoab.ResultSet"));
-}
-// -------------------------------------------------------------------------
- Sequence< ::rtl::OUString > SAL_CALL OEvoabResultSet::getSupportedServiceNames( ) throw( RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(1);
- aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet"));
- return aSupported;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-
-// -------------------------------------------------------------------------
-OEvoabResultSet::OEvoabResultSet( OCommonStatement* pStmt, OEvoabConnection *pConnection )
- :OResultSet_BASE(m_aMutex)
- ,::comphelper::OPropertyContainer( OResultSet_BASE::rBHelper )
- ,m_pStatement(pStmt)
- ,m_pConnection(pConnection)
- ,m_xMetaData(NULL)
- ,m_bWasNull(sal_True)
- ,m_nFetchSize(0)
- ,m_nResultSetType(ResultSetType::SCROLL_INSENSITIVE)
- ,m_nFetchDirection(FetchDirection::FORWARD)
- ,m_nResultSetConcurrency(ResultSetConcurrency::READ_ONLY)
- ,m_pContacts(NULL)
- ,m_nIndex(-1)
- ,m_nLength(0)
-{
- #define REGISTER_PROP( id, member ) \
- registerProperty( \
- OMetaConnection::getPropMap().getNameByIndex( id ), \
- id, \
- PropertyAttribute::READONLY, \
- &member, \
- ::getCppuType( &member ) \
- );
-
- REGISTER_PROP( PROPERTY_ID_FETCHSIZE, m_nFetchSize );
- REGISTER_PROP( PROPERTY_ID_RESULTSETTYPE, m_nResultSetType );
- REGISTER_PROP( PROPERTY_ID_FETCHDIRECTION, m_nFetchDirection );
- REGISTER_PROP( PROPERTY_ID_RESULTSETCONCURRENCY, m_nResultSetConcurrency );
-}
-
-// -------------------------------------------------------------------------
-OEvoabResultSet::~OEvoabResultSet()
-{
-}
-
-// -------------------------------------------------------------------------
-
-static ESource *
-findSource( const char *name )
-{
- ESourceList *pSourceList = NULL;
-
- g_return_val_if_fail (name != NULL, NULL);
-
- if (!e_book_get_addressbooks (&pSourceList, NULL))
- pSourceList = NULL;
-
- for ( GSList *g = e_source_list_peek_groups (pSourceList); g; g = g->next)
- {
- for (GSList *s = e_source_group_peek_sources (E_SOURCE_GROUP (g->data)); s; s = s->next)
- {
- ESource *pSource = E_SOURCE (s->data);
- if (!strcmp (e_source_peek_name (pSource), name))
- return pSource;
- }
- }
- return NULL;
-}
-
-static EBook *
-openBook( const char *abname )
-{
- ESource *pSource = findSource (abname);
- EBook *pBook = NULL;
- if (pSource)
- pBook = e_book_new (pSource, NULL);
-
- if (pBook && !e_book_open (pBook, TRUE, NULL))
- {
- g_object_unref (G_OBJECT (pBook));
- pBook = NULL;
- }
-
- return pBook;
-}
-
-static bool isLDAP( EBook *pBook )
-{
- return pBook && !strncmp( "ldap://", e_book_get_uri( pBook ), 6 );
-}
-
-static bool isLocal( EBook *pBook )
-{
- return pBook && ( !strncmp( "file://", e_book_get_uri( pBook ), 6 ) ||
- !strncmp( "local:", e_book_get_uri( pBook ), 6 ) );
-}
-
-static bool isAuthRequired( EBook *pBook )
-{
- return e_source_get_property( e_book_get_source( pBook ),
- "auth" ) != NULL;
-}
-
-static rtl::OString getUserName( EBook *pBook )
-{
- rtl::OString aName;
- if( isLDAP( pBook ) )
- aName = e_source_get_property( e_book_get_source( pBook ), "binddn" );
- else
- aName = e_source_get_property( e_book_get_source( pBook ), "user" );
- return aName;
-}
-
-static ::rtl::OUString
-valueToOUString( GValue& _rValue )
-{
- const char *pStr = g_value_get_string( &_rValue );
- rtl::OString aStr( pStr ? pStr : "" );
- ::rtl::OUString sResult( ::rtl::OStringToOUString( aStr, RTL_TEXTENCODING_UTF8 ) );
- g_value_unset( &_rValue );
- return sResult;
-}
-
-static bool
-valueToBool( GValue& _rValue )
-{
- bool bResult = g_value_get_boolean( &_rValue );
- g_value_unset( &_rValue );
- return bResult;
-}
-
-static bool
-executeQuery (EBook* pBook, EBookQuery* pQuery, GList **ppList,
- rtl::OString &rPassword, GError **pError)
-{
- ESource *pSource = e_book_get_source( pBook );
- bool bSuccess = false;
- bool bAuthSuccess = true;
-
- *ppList = NULL;
-
- if( isAuthRequired( pBook ) )
- {
- rtl::OString aUser( getUserName( pBook ) );
- const char *pAuth = e_source_get_property( pSource, "auth" );
- bAuthSuccess = e_book_authenticate_user( pBook, aUser.getStr(), rPassword.getStr(), pAuth, pError );
- }
-
- if (bAuthSuccess)
- bSuccess = e_book_get_contacts( pBook, pQuery, ppList, pError );
-
- return bSuccess;
-}
-
-static int
-whichAddress(int value)
-{
- int fieldEnum;
- switch (value)
- {
- case HOME_ADDR_LINE1:
- case HOME_ADDR_LINE2:
- case HOME_CITY:
- case HOME_STATE:
- case HOME_COUNTRY:
- case HOME_ZIP:
- fieldEnum = e_contact_field_id("address_home");
- break;
-
- case WORK_ADDR_LINE1:
- case WORK_ADDR_LINE2:
- case WORK_CITY:
- case WORK_STATE:
- case WORK_COUNTRY:
- case WORK_ZIP:
- fieldEnum = e_contact_field_id("address_work");
- break;
-
- case OTHER_ADDR_LINE1:
- case OTHER_ADDR_LINE2:
- case OTHER_CITY:
- case OTHER_STATE:
- case OTHER_COUNTRY:
- case OTHER_ZIP:
- fieldEnum = e_contact_field_id("address_other");
- break;
-
- default: fieldEnum = e_contact_field_id("address_home");
- }
- return fieldEnum;
-}
-
-/*
-* This function decides the default column values based on the first field of EContactAddress.
-* The search order is Work->Home->other(defaults).
-*/
-static EContactAddress *
-getDefaultContactAddress( EContact *pContact,int *value )
-{
- EContactAddress *ec = (EContactAddress *)e_contact_get(pContact,whichAddress(WORK_ADDR_LINE1));
- if ( ec && (strlen(ec->street)>0) )
- {
- *value= *value +WORK_ADDR_LINE1 -1;
- return ec;
- }
- else
- {
- ec = (EContactAddress *)e_contact_get(pContact,whichAddress(HOME_ADDR_LINE1));
- if ( ec && (strlen(ec->street)>0) )
- {
- *value=*value+HOME_ADDR_LINE1-1;
- return ec;
- }
- }
-
- *value=*value+OTHER_ADDR_LINE1-1;
- return (EContactAddress *)e_contact_get(pContact,whichAddress(OTHER_ADDR_LINE1));
-}
-
-static EContactAddress*
-getContactAddress( EContact *pContact, int * address_enum )
-{
- EContactAddress *ec = NULL;
- switch (*address_enum) {
-
- case DEFAULT_ADDR_LINE1:
- case DEFAULT_ADDR_LINE2:
- case DEFAULT_CITY:
- case DEFAULT_STATE:
- case DEFAULT_COUNTRY:
- case DEFAULT_ZIP:
- ec = getDefaultContactAddress(pContact,address_enum);break;
- default:
- ec = (EContactAddress *)e_contact_get(pContact,whichAddress(*address_enum));
- }
- return ec;
-}
-
-static bool
-handleSplitAddress( EContact *pContact,GValue *pStackValue, int value )
-{
- EContactAddress *ec = getContactAddress(pContact,&value) ;
-
- if (ec==NULL)
- return true;
-
- switch (value) {
- case WORK_ADDR_LINE1:
- g_value_set_string(pStackValue,ec->street ); break;
- case WORK_ADDR_LINE2:
- g_value_set_string(pStackValue,ec->po ); break;
- case WORK_CITY:
- g_value_set_string(pStackValue,ec->locality ); break;
- case WORK_STATE:
- g_value_set_string(pStackValue,ec->region ); break;
- case WORK_COUNTRY:
- g_value_set_string(pStackValue,ec->country ); break;
- case WORK_ZIP:
- g_value_set_string(pStackValue,ec->code ); break;
-
- case HOME_ADDR_LINE1:
- g_value_set_string(pStackValue,ec->street ); break;
- case HOME_ADDR_LINE2:
- g_value_set_string(pStackValue,ec->po ); break;
- case HOME_CITY:
- g_value_set_string(pStackValue,ec->locality ); break;
- case HOME_STATE:
- g_value_set_string(pStackValue,ec->region ); break;
- case HOME_COUNTRY:
- g_value_set_string(pStackValue,ec->country ); break;
- case HOME_ZIP:
- g_value_set_string(pStackValue,ec->code ); break;
-
- case OTHER_ADDR_LINE1:
- g_value_set_string(pStackValue,ec->street ); break;
- case OTHER_ADDR_LINE2:
- g_value_set_string(pStackValue,ec->po ); break;
- case OTHER_CITY:
- g_value_set_string(pStackValue,ec->locality ); break;
- case OTHER_STATE:
- g_value_set_string(pStackValue,ec->region ); break;
- case OTHER_COUNTRY:
- g_value_set_string(pStackValue,ec->country ); break;
- case OTHER_ZIP:
- g_value_set_string(pStackValue,ec->code ); break;
-
- }
-
- return false;
-}
-static bool
-getValue( EContact* pContact, sal_Int32 nColumnNum, GType nType, GValue* pStackValue, bool& _out_rWasNull )
-{
- const ColumnProperty * pSpecs = evoab::getField( nColumnNum );
- if ( !pSpecs )
- return false;
-
- GParamSpec* pSpec = pSpecs->pField;
- gboolean bIsSplittedColumn = pSpecs->bIsSplittedValue;
-
- _out_rWasNull = true;
- if ( !pSpec || !pContact)
- return false;
-
- if ( G_PARAM_SPEC_VALUE_TYPE (pSpec) != nType )
- {
-
- OSL_TRACE( "Wrong type (0x%x) (0x%x) '%s'",
- (int)G_PARAM_SPEC_VALUE_TYPE (pSpec), (int) nType,
- pSpec->name ? pSpec->name : "<noname>");
- return false;
- }
-
- g_value_init( pStackValue, nType );
- if ( bIsSplittedColumn )
- {
- const SplitEvoColumns* evo_addr( get_evo_addr() );
- for (int i=0;i<OTHER_ZIP;i++)
- {
- if (0 == strcmp (g_param_spec_get_name ((GParamSpec *)pSpec), evo_addr[i].pColumnName))
- {
- _out_rWasNull = handleSplitAddress( pContact, pStackValue, evo_addr[i].value );
- return true;
- }
- }
- }
- else
- {
- g_object_get_property( G_OBJECT (pContact),
- g_param_spec_get_name ((GParamSpec *) pSpec),
- pStackValue );
- if ( G_VALUE_TYPE( pStackValue ) != nType )
- {
- OSL_TRACE( "Fetched type mismatch" );
- g_value_unset( pStackValue );
- return false;
- }
- }
- _out_rWasNull = false;
- return true;
-}
-
-namespace
-{
- struct ComparisonData
- {
- const SortDescriptor& rSortOrder;
- IntlWrapper aIntlWrapper;
-
- ComparisonData( const SortDescriptor& _rSortOrder, const Reference< XMultiServiceFactory >& _rxFactory )
- :rSortOrder( _rSortOrder )
- ,aIntlWrapper( _rxFactory, SvtSysLocale().GetLocaleData().getLocale() )
- {
- }
- };
-}
-
-extern "C"
-int CompareContacts( gconstpointer _lhs, gconstpointer _rhs, gpointer _userData )
-{
- EContact* lhs = static_cast< EContact* >( const_cast< gpointer >( _lhs ) );
- EContact* rhs = static_cast< EContact* >( const_cast< gpointer >( _rhs ) );
-
- GValue aLhsValue = { 0, { { 0 } } };
- GValue aRhsValue = { 0, { { 0 } } };
- bool bLhsNull = true;
- bool bRhsNull = true;
-
- ::rtl::OUString sLhs, sRhs;
- bool bLhs(false), bRhs(false);
-
- const ComparisonData& rCompData = *static_cast< const ComparisonData* >( _userData );
- for ( SortDescriptor::const_iterator sortCol = rCompData.rSortOrder.begin();
- sortCol != rCompData.rSortOrder.end();
- ++sortCol
- )
- {
- sal_Int32 nField = sortCol->nField;
- GType eFieldType = evoab::getGFieldType( nField );
-
- bool success = getValue( lhs, nField, eFieldType, &aLhsValue, bLhsNull )
- && getValue( rhs, nField, eFieldType, &aRhsValue, bRhsNull );
- OSL_ENSURE( success, "CompareContacts: could not retrieve both values!" );
- if ( !success )
- return 0;
-
- if ( bLhsNull && !bRhsNull )
- return -1;
- if ( !bLhsNull && bRhsNull )
- return 1;
- if ( bLhsNull && bRhsNull )
- continue;
-
- if ( eFieldType == G_TYPE_STRING )
- {
- sLhs = valueToOUString( aLhsValue );
- sRhs = valueToOUString( aRhsValue );
- sal_Int32 nCompResult = rCompData.aIntlWrapper.getCaseCollator()->compareString( sLhs, sRhs );
- if ( nCompResult != 0 )
- return nCompResult;
- continue;
- }
-
- bLhs = valueToBool( aLhsValue );
- bRhs = valueToBool( aRhsValue );
- if ( bLhs && !bRhs )
- return -1;
- if ( !bLhs && bRhs )
- return 1;
- continue;
- }
-
- return 0;
-}
-
-static GList*
-sortContacts( GList* _pContactList, const ComparisonData& _rCompData )
-{
- OSL_ENSURE( !_rCompData.rSortOrder.empty(), "sortContacts: no need to call this without any sort order!" );
- ENSURE_OR_THROW( _rCompData.aIntlWrapper.getCaseCollator(), "no collator for comparing strings" );
-
- return g_list_sort_with_data( _pContactList, &CompareContacts, const_cast< gpointer >( static_cast< gconstpointer >( &_rCompData ) ) );
-}
-
-// -------------------------------------------------------------------------
-void OEvoabResultSet::construct( const QueryData& _rData )
-{
- ENSURE_OR_THROW( _rData.getQuery(), "internal error: no EBookQuery" );
-
- EBook *pBook = openBook(::rtl::OUStringToOString(_rData.sTable, RTL_TEXTENCODING_UTF8).getStr());
- if ( !pBook )
- m_pConnection->throwGenericSQLException( STR_CANNOT_OPEN_BOOK, *this );
-
- g_list_free(m_pContacts);
- m_pContacts = NULL;
- bool bExecuteQuery = true;
- switch ( _rData.eFilterType )
- {
- case eFilterNone:
- if ( !isLocal( pBook ) )
- {
- SQLError aErrorFactory( m_pConnection->getDriver().getMSFactory() );
- SQLException aAsException = aErrorFactory.getSQLException( ErrorCondition::DATA_CANNOT_SELECT_UNFILTERED, *this );
- m_aWarnings.appendWarning( SQLWarning(
- aAsException.Message,
- aAsException.Context,
- aAsException.SQLState,
- aAsException.ErrorCode,
- aAsException.NextException
- ) );
- bExecuteQuery = false;
- }
- break;
- case eFilterAlwaysFalse:
- bExecuteQuery = false;
- break;
- case eFilterOther:
- bExecuteQuery = true;
- break;
- }
- if ( bExecuteQuery )
- {
- rtl::OString aPassword = m_pConnection->getPassword();
- executeQuery( pBook, _rData.getQuery(), &m_pContacts, aPassword, NULL );
- m_pConnection->setPassword( aPassword );
-
- if ( m_pContacts && !_rData.aSortOrder.empty() )
- {
- ComparisonData aCompData( _rData.aSortOrder, getConnection()->getDriver().getMSFactory() );
- m_pContacts = sortContacts( m_pContacts, aCompData );
- }
- }
- m_nLength = g_list_length( m_pContacts );
- OSL_TRACE( "Query return %d records", m_nLength );
- m_nIndex = -1;
-
- // create our meta data (need the EBookQuery for this)
- OEvoabResultSetMetaData* pMeta = new OEvoabResultSetMetaData( _rData.sTable );
- m_xMetaData = pMeta;
-
- pMeta->setEvoabFields( _rData.xSelectColumns );
-}
-
-// -------------------------------------------------------------------------
-void OEvoabResultSet::disposing(void)
-{
- ::comphelper::OPropertyContainer::disposing();
-
- ::osl::MutexGuard aGuard(m_aMutex);
- g_list_free(m_pContacts);
- m_pContacts = NULL;
- m_pStatement = NULL;
-m_xMetaData.clear();
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OEvoabResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = ::comphelper::OPropertyContainer::queryInterface(rType);
- if(!aRet.hasValue())
- aRet = OResultSet_BASE::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OEvoabResultSet::getTypes( ) throw( RuntimeException)
-{
- return ::comphelper::concatSequences(
- OResultSet_BASE::getTypes(),
- ::comphelper::OPropertyContainer::getTypes()
- );
-}
-
-// -------------------------------------------------------------------------
-// XRow Interface
-
-/**
- * getString:
- * @nColumnNum: The column index from the table.
- *
- * If the equivalent NResultSetMetaData.cxx marks the columntype of
- * nColumnNum as DataType::VARCHAR this accessor is used.
- */
-::rtl::OUString SAL_CALL OEvoabResultSet::getString( sal_Int32 nColumnNum ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- rtl::OUString aResult;
- if ( m_xMetaData.is())
- {
- OEvoabResultSetMetaData *pMeta = (OEvoabResultSetMetaData *) m_xMetaData.get();
- sal_Int32 nFieldNumber = pMeta->fieldAtColumn(nColumnNum);
- GValue aValue = { 0, { { 0 } } };
- if ( getValue( getCur(), nFieldNumber, G_TYPE_STRING, &aValue, m_bWasNull ) )
- aResult = valueToOUString( aValue );
- }
- return aResult;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSet::getBoolean( sal_Int32 nColumnNum ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- sal_Bool bResult = sal_False;
-
- if ( m_xMetaData.is())
- {
- OEvoabResultSetMetaData *pMeta = (OEvoabResultSetMetaData *) m_xMetaData.get();
- sal_Int32 nFieldNumber = pMeta->fieldAtColumn(nColumnNum);
- GValue aValue = { 0, { { 0 } } };
- if ( getValue( getCur(), nFieldNumber, G_TYPE_BOOLEAN, &aValue, m_bWasNull ) )
- bResult = valueToBool( aValue );
- }
- return bResult ? sal_True : sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int64 SAL_CALL OEvoabResultSet::getLong( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getLong", *this );
- return sal_Int64();
-}
-// -------------------------------------------------------------------------
-Reference< XArray > SAL_CALL OEvoabResultSet::getArray( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getArray", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XClob > SAL_CALL OEvoabResultSet::getClob( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getClob", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL OEvoabResultSet::getBlob( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getBlob", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XRef > SAL_CALL OEvoabResultSet::getRef( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getRef", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OEvoabResultSet::getObject( sal_Int32 /*nColumnNum*/, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getObject", *this );
- return Any();
-}
-// -------------------------------------------------------------------------
-sal_Int16 SAL_CALL OEvoabResultSet::getShort( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getShort", *this );
- return 0;
-}
-// -------------------------------------------------------------------------
-::com::sun::star::util::Time SAL_CALL OEvoabResultSet::getTime( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getTime", *this );
- return ::com::sun::star::util::Time();
-}
-// -------------------------------------------------------------------------
-util::DateTime SAL_CALL OEvoabResultSet::getTimestamp( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getTimestamp", *this );
- return ::com::sun::star::util::DateTime();
-}
-// -------------------------------------------------------------------------
-Reference< XInputStream > SAL_CALL OEvoabResultSet::getBinaryStream( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getBinaryStream", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XInputStream > SAL_CALL OEvoabResultSet::getCharacterStream( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getCharacterStream", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-sal_Int8 SAL_CALL OEvoabResultSet::getByte( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getByte", *this );
- return 0;
-}
-// -------------------------------------------------------------------------
-Sequence< sal_Int8 > SAL_CALL OEvoabResultSet::getBytes( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getBytes", *this );
- return Sequence< sal_Int8 >();
-}
-// -------------------------------------------------------------------------
-::com::sun::star::util::Date SAL_CALL OEvoabResultSet::getDate( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getDate", *this );
- return ::com::sun::star::util::Date();
-}
-// -------------------------------------------------------------------------
-double SAL_CALL OEvoabResultSet::getDouble( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getDouble", *this );
- return 0;
-}
-// -------------------------------------------------------------------------
-float SAL_CALL OEvoabResultSet::getFloat( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getFloat", *this );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabResultSet::getInt( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getInt", *this );
- return 0;
-}
-// XRow Interface Ends
-// -------------------------------------------------------------------------
-
-// XResultSetMetaDataSupplier Interface
-Reference< XResultSetMetaData > SAL_CALL OEvoabResultSet::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- // the meta data should have been created at construction time
- ENSURE_OR_THROW( m_xMetaData.is(), "internal error: no meta data" );
- return m_xMetaData;
-}
-// XResultSetMetaDataSupplier Interface Ends
-// -------------------------------------------------------------------------
-
-// XResultSet Interface
-sal_Bool SAL_CALL OEvoabResultSet::next( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- if (m_nIndex+1 < m_nLength) {
- ++m_nIndex ;
- return true;
- }
- else
- return false;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSet::wasNull( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return m_bWasNull;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return m_nIndex < 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabResultSet::getRow( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return m_nIndex;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSet::isAfterLast( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return m_nIndex >= m_nLength;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSet::isFirst( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return m_nIndex == 0;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSet::isLast( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return m_nIndex == m_nLength - 1;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OEvoabResultSet::beforeFirst( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- m_nIndex = -1;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OEvoabResultSet::afterLast( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- m_nIndex = m_nLength;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OEvoabResultSet::first( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- m_nIndex = 0;
- return true;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OEvoabResultSet::last( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- m_nIndex = m_nLength - 1;
- return true;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- if (row < m_nLength) {
- m_nIndex = row;
- return true;
- }
- else
- return false;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- if ((m_nIndex+row) < m_nLength) {
- m_nIndex += row;
- return true;
- }
- else
- return false;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSet::previous( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- if(m_nIndex > 0) {
- m_nIndex--;
- return true;
- }
- else
- return false;
-}
-// -------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL OEvoabResultSet::getStatement( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-::com::sun::star::uno::WeakReferenceHelper aStatement((OWeakObject*)m_pStatement);
- return aStatement.get();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OEvoabResultSet::rowDeleted( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSet::rowInserted( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSet::rowUpdated( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OEvoabResultSet::refreshRow( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-}
-//XResult Interface ends
-// -------------------------------------------------------------------------
-// XCancellable
-
-void SAL_CALL OEvoabResultSet::cancel( ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- OSL_TRACE("In/Out: OEvoabResultSet::cancel" );
-
-}
-
-//XCloseable
-void SAL_CALL OEvoabResultSet::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- }
- OSL_TRACE("In/Out: OEvoabResultSet::close" );
- dispose();
-}
-
-// XWarningsSupplier
-// -------------------------------------------------------------------------
-void SAL_CALL OEvoabResultSet::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OEvoabResultSet::clearWarnings" );
- m_aWarnings.clearWarnings();
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OEvoabResultSet::getWarnings( ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OEvoabResultSet::getWarnings" );
- return m_aWarnings.getWarnings();
-}
-// -------------------------------------------------------------------------
-//XColumnLocate Interface
-sal_Int32 SAL_CALL OEvoabResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- // find the first column with the name columnName
- Reference< XResultSetMetaData > xMeta = getMetaData();
- sal_Int32 nLen = xMeta->getColumnCount();
- sal_Int32 i = 1;
- for(;i<=nLen;++i)
- if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
- columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
- break;
- return i;
-}
-// -------------------------------------------------------------------------
-//XColumnLocate interface ends
-
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OEvoabResultSet::createArrayHelper( ) const
-{
- Sequence< Property > aProps;
- describeProperties( aProps );
- return new ::cppu::OPropertyArrayHelper( aProps );
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & OEvoabResultSet::getInfoHelper()
-{
- return *const_cast<OEvoabResultSet*>(this)->getArrayHelper();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OEvoabResultSet::acquire() throw()
-{
- OResultSet_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OEvoabResultSet::release() throw()
-{
- OResultSet_BASE::release();
-}
-// -----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
-OEvoabResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-
-} } // connectivity::evoab
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NResultSet.hxx b/connectivity/source/drivers/evoab2/NResultSet.hxx
deleted file mode 100644
index 0ffe5a7e5b..0000000000
--- a/connectivity/source/drivers/evoab2/NResultSet.hxx
+++ /dev/null
@@ -1,186 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_EVOAB_RESULTSET_HXX_
-#define _CONNECTIVITY_EVOAB_RESULTSET_HXX_
-
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
-#include <com/sun/star/sdbc/XCloseable.hpp>
-#include <com/sun/star/sdbc/XColumnLocate.hpp>
-#include <com/sun/star/util/XCancellable.hpp>
-#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
-#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
-#include <com/sun/star/sdbc/XRowUpdate.hpp>
-#include <com/sun/star/sdbcx/XRowLocate.hpp>
-#include <com/sun/star/sdbcx/XDeleteRows.hpp>
-#include <cppuhelper/compbase8.hxx>
-#include <comphelper/proparrhlp.hxx>
-#include <comphelper/propertycontainer.hxx>
-#include "connectivity/CommonTools.hxx"
-#include "connectivity/FValue.hxx"
-#include "connectivity/warningscontainer.hxx"
-#include "NStatement.hxx"
-#include "OSubComponent.hxx"
-#include "NResultSetMetaData.hxx"
-
-namespace connectivity
-{
- namespace evoab
- {
- typedef ::cppu::WeakComponentImplHelper8 < ::com::sun::star::sdbc::XResultSet
- , ::com::sun::star::sdbc::XRow
- , ::com::sun::star::sdbc::XResultSetMetaDataSupplier
- , ::com::sun::star::util::XCancellable
- , ::com::sun::star::sdbc::XWarningsSupplier
- , ::com::sun::star::sdbc::XCloseable
- , ::com::sun::star::sdbc::XColumnLocate
- , ::com::sun::star::lang::XServiceInfo
- > OResultSet_BASE;
-
-
- class OEvoabResultSet :public comphelper::OBaseMutex
- ,public OResultSet_BASE
- ,public ::comphelper::OPropertyContainer
- ,public ::comphelper::OPropertyArrayUsageHelper<OEvoabResultSet>
- {
-
- protected:
-
- OCommonStatement* m_pStatement;
- OEvoabConnection* m_pConnection;
- ::com::sun::star::uno::WeakReferenceHelper m_aStatement;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData;
- ::dbtools::WarningsContainer m_aWarnings;
-
- bool m_bWasNull;
- // <properties>
- sal_Int32 m_nFetchSize;
- sal_Int32 m_nResultSetType;
- sal_Int32 m_nFetchDirection;
- sal_Int32 m_nResultSetConcurrency;
- // </properties>
-
- // Data & iteration
- GList *m_pContacts;
- sal_Int32 m_nIndex;
- sal_Int32 m_nLength;
- EContact *getCur()
- {
- gpointer pData = g_list_nth_data (m_pContacts, m_nIndex);
- return pData ? E_CONTACT (pData) : NULL;
- }
-
- // OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
- // OPropertySetHelper
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
-
- // you can't delete objects of this type
- virtual ~OEvoabResultSet();
- public:
- DECLARE_SERVICE_INFO();
-
- OEvoabResultSet( OCommonStatement *pStmt, OEvoabConnection *pConnection );
- void construct( const QueryData& _rData );
-
- OEvoabConnection * getConnection() { return m_pConnection; }
-
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *()
- {
- return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(OResultSet_BASE*)this);
- }
-
- // ::cppu::OComponentHelper
- virtual void SAL_CALL disposing(void);
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
- //XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
- // XResultSet
- virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XRow
- virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XCancellable
- virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException);
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XResultSetMetaDataSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XWarningsSupplier
- virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XColumnLocate
- virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-#endif // CONNECTIVITY_SRESULTSET_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx
deleted file mode 100644
index 335b44418c..0000000000
--- a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx
+++ /dev/null
@@ -1,197 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "NResultSetMetaData.hxx"
-#include "NDatabaseMetaData.hxx"
-#include "connectivity/dbexception.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include "NDebug.hxx"
-#include "resource/evoab2_res.hrc"
-
-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 ::rtl::OUString& _aTableName)
- : m_aTableName(_aTableName),
- m_aEvoabFields()
-{
-
-}
-// -------------------------------------------------------------------------
-OEvoabResultSetMetaData::~OEvoabResultSetMetaData()
-{
-}
-// -------------------------------------------------------------------------
-void OEvoabResultSetMetaData::setEvoabFields(const ::rtl::Reference<connectivity::OSQLColumns> &xColumns) throw(SQLException)
-{
- OSQLColumns::Vector::const_iterator aIter;
- static const ::rtl::OUString aName(RTL_CONSTASCII_USTRINGPARAM("Name"));
-
- for (aIter = xColumns->get().begin(); aIter != xColumns->get().end(); ++aIter)
- {
- ::rtl::OUString aFieldName;
-
- (*aIter)->getPropertyValue(aName) >>= aFieldName;
- guint nFieldNumber = findEvoabField(aFieldName);
- if (nFieldNumber == (guint)-1)
- {
- connectivity::SharedResources aResource;
- const ::rtl::OUString sError( aResource.getResourceStringWithSubstitution(
- STR_INVALID_COLUMNNAME,
- "$columnname$", aFieldName
- ) );
- ::dbtools::throwGenericSQLException( sError, *this );
- }
- m_aEvoabFields.push_back(nFieldNumber);
- }
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabResultSetMetaData::getColumnDisplaySize( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- return 50;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabResultSetMetaData::getColumnType( sal_Int32 nColumnNum ) throw(SQLException, RuntimeException)
-{
- sal_uInt32 nField = m_aEvoabFields[nColumnNum - 1];
- return evoab::getFieldType (nField);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException)
-{
- return m_aEvoabFields.size();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSetMetaData::isCaseSensitive( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabResultSetMetaData::getSchemaName( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabResultSetMetaData::getColumnName( sal_Int32 nColumnNum ) throw(SQLException, RuntimeException)
-{
- sal_uInt32 nField = m_aEvoabFields[nColumnNum - 1];
- return evoab::getFieldName( nField );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabResultSetMetaData::getColumnTypeName( sal_Int32 nColumnNum ) throw(SQLException, RuntimeException)
-{
- sal_uInt32 nField = m_aEvoabFields[nColumnNum - 1];
- return evoab::getFieldTypeName( nField );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabResultSetMetaData::getColumnLabel( sal_Int32 nColumnNum ) throw(SQLException, RuntimeException)
-{
- sal_uInt32 nField = m_aEvoabFields[nColumnNum - 1];
- const ColumnProperty *pSpecs = getField(nField);
- GParamSpec *pSpec = pSpecs->pField;
- rtl::OUString aLabel;
-
- if( pSpec )
- aLabel = rtl::OStringToOUString( g_param_spec_get_nick( (GParamSpec *) pSpec ),
- RTL_TEXTENCODING_UTF8 );
- return aLabel;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabResultSetMetaData::getColumnServiceName( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabResultSetMetaData::getTableName( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- return m_aTableName;//::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OEvoabResultSetMetaData::getCatalogName( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OEvoabResultSetMetaData::isCurrency( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSetMetaData::isAutoIncrement( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSetMetaData::isSigned( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabResultSetMetaData::getPrecision( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- return 0;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabResultSetMetaData::getScale( sal_Int32 /*nColumnNum*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabResultSetMetaData::isNullable( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSetMetaData::isSearchable( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSetMetaData::isReadOnly( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSetMetaData::isDefinitelyWritable( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabResultSetMetaData::isWritable( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NResultSetMetaData.hxx b/connectivity/source/drivers/evoab2/NResultSetMetaData.hxx
deleted file mode 100644
index 6906549dec..0000000000
--- a/connectivity/source/drivers/evoab2/NResultSetMetaData.hxx
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_EVOAB_RESULTSETMETADATA_HXX_
-#define _CONNECTIVITY_EVOAB_RESULTSETMETADATA_HXX_
-
-#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include "NConnection.hxx"
-#include <rtl/ref.hxx>
-#include <com/sun/star/connection/XConnection.hpp>
-namespace connectivity
-{
- namespace evoab
- {
- //**************************************************************
- //************ Class: ResultSetMetaData
- //**************************************************************
- typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE;
-
- class OEvoabResultSetMetaData : public OResultSetMetaData_BASE
- {
- ::rtl::OUString m_aTableName;
- ::std::vector<sal_Int32> m_aEvoabFields;
-
- protected:
- virtual ~OEvoabResultSetMetaData();
- public:
- OEvoabResultSetMetaData(const ::rtl::OUString& _aTableName);
- void setEvoabFields(const ::rtl::Reference<connectivity::OSQLColumns> &xColumns) throw(::com::sun::star::sdbc::SQLException);
- inline sal_uInt32 fieldAtColumn(sal_Int32 columnIndex) const
- { return m_aEvoabFields[columnIndex - 1]; }
- inline sal_Int32 getFieldSize() const
- {return m_aEvoabFields.size();}
- /// Avoid ambigous cast error from the compiler.
- inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw()
- { return this; }
-
- virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // CONNECTIVITY_SRESULSETMETADATA_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NServices.cxx b/connectivity/source/drivers/evoab2/NServices.cxx
deleted file mode 100644
index 9dda360afc..0000000000
--- a/connectivity/source/drivers/evoab2/NServices.cxx
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "NDriver.hxx"
-#include <cppuhelper/factory.hxx>
-#include <osl/diagnose.h>
-
-using namespace connectivity::evoab;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount* _pT
- );
-
-//---------------------------------------------------------------------------------------
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- sal_Char const* pImplementationName
- )
- : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- inline
- sal_Bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
- }
- catch(const ::com::sun::star::uno::Exception&)
- {
- OSL_FAIL("Service Creation Exception");
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = 0;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- OEvoabDriver::getImplementationName_Static(),
- OEvoabDriver::getSupportedServiceNames_Static(),
- OEvoabDriver_CreateInstance, ::cppu::createSingleFactory)
- ;
-
- if(aReq.xRet.is())
- aReq.xRet->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NStatement.cxx b/connectivity/source/drivers/evoab2/NStatement.cxx
deleted file mode 100644
index 30cec213e0..0000000000
--- a/connectivity/source/drivers/evoab2/NStatement.cxx
+++ /dev/null
@@ -1,685 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <stdio.h>
-#include <osl/diagnose.h>
-#include <osl/thread.h>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include "propertyids.hxx"
-#include "NStatement.hxx"
-#include "NConnection.hxx"
-#include "NDatabaseMetaData.hxx"
-#include "NResultSet.hxx"
-#include "NDebug.hxx"
-#include "resource/evoab2_res.hrc"
-#include <resource/common_res.hrc>
-#include <connectivity/dbexception.hxx>
-#include <tools/diagnose_ex.h>
-
-namespace connectivity { namespace 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::sdbcx;
-using namespace com::sun::star::container;
-using namespace com::sun::star::io;
-using namespace com::sun::star::util;
-//------------------------------------------------------------------------------
-OCommonStatement::OCommonStatement(OEvoabConnection* _pConnection)
- : OCommonStatement_IBase(m_aMutex)
- , ::comphelper::OPropertyContainer(OCommonStatement_IBase::rBHelper)
- , OStatement_CBase( (::cppu::OWeakObject*)_pConnection, this )
- , m_xResultSet(NULL)
- , m_pResultSet(NULL)
- , m_pConnection(_pConnection)
- , m_aParser(_pConnection->getDriver().getMSFactory())
- , m_aSQLIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL )
- , m_pParseTree(NULL)
- , m_nMaxFieldSize(0)
- , m_nMaxRows(0)
- , m_nQueryTimeOut(0)
- , m_nFetchSize(0)
- , m_nResultSetType(ResultSetType::FORWARD_ONLY)
- , m_nFetchDirection(FetchDirection::FORWARD)
- , m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
- , m_bEscapeProcessing(sal_True)
- , rBHelper(OCommonStatement_IBase::rBHelper)
-{
- m_pConnection->acquire();
-
-#define REGISTER_PROP( id, member ) \
- registerProperty( \
- OMetaConnection::getPropMap().getNameByIndex( id ), \
- id, \
- 0, \
- &member, \
- ::getCppuType( &member ) \
- );
-
- REGISTER_PROP( PROPERTY_ID_CURSORNAME, m_aCursorName );
- REGISTER_PROP( PROPERTY_ID_MAXFIELDSIZE, m_nMaxFieldSize );
- REGISTER_PROP( PROPERTY_ID_MAXROWS, m_nMaxRows );
- REGISTER_PROP( PROPERTY_ID_QUERYTIMEOUT, m_nQueryTimeOut );
- REGISTER_PROP( PROPERTY_ID_FETCHSIZE, m_nFetchSize );
- REGISTER_PROP( PROPERTY_ID_RESULTSETTYPE, m_nResultSetType );
- REGISTER_PROP( PROPERTY_ID_FETCHDIRECTION, m_nFetchDirection );
- REGISTER_PROP( PROPERTY_ID_ESCAPEPROCESSING, m_bEscapeProcessing );
- REGISTER_PROP( PROPERTY_ID_RESULTSETCONCURRENCY, m_nResultSetConcurrency );
-}
-// -----------------------------------------------------------------------------
-OCommonStatement::~OCommonStatement()
-{
-}
-//------------------------------------------------------------------------------
-void OCommonStatement::disposeResultSet()
-{
- // free the cursor if alive
- Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- m_xResultSet = Reference< XResultSet>();
-}
-//------------------------------------------------------------------------------
-void OCommonStatement::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- disposeResultSet();
-
- if (m_pConnection)
- m_pConnection->release();
- m_pConnection = NULL;
-
- dispose_ChildImpl();
- OCommonStatement_IBase::disposing();
-}
-//-----------------------------------------------------------------------------
-Any SAL_CALL OCommonStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OCommonStatement_IBase::queryInterface(rType);
- if(!aRet.hasValue())
- aRet = ::comphelper::OPropertyContainer::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OCommonStatement::getTypes( ) throw(RuntimeException)
-{
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
- ::getCppuType( (const Reference< XFastPropertySet > *)0 ),
- ::getCppuType( (const Reference< XPropertySet > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OCommonStatement_IBase::getTypes());
-}
-// -------------------------------------------------------------------------
-
-//void SAL_CALL OCommonStatement::cancel( ) throw(RuntimeException)
-//{
-//::osl::MutexGuard aGuard( m_aMutex );
-//checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
-//// cancel the current sql statement
-//}
-
-// -------------------------------------------------------------------------
-void SAL_CALL OCommonStatement::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
-
- }
- dispose();
-}
-// -------------------------------------------------------------------------
-
-void OCommonStatement::reset() throw (SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
-
-
- clearWarnings ();
-
- if (m_xResultSet.get().is())
- clearMyResultSet();
-}
-
-void OCommonStatement::clearMyResultSet () throw (SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
-
- try
- {
- Reference<XCloseable> xCloseable;
- if ( ::comphelper::query_interface( m_xResultSet.get(), xCloseable ) )
- xCloseable->close();
- }
- catch( const DisposedException& ) { }
-
- m_xResultSet = Reference< XResultSet >();
-}
-
-EBookQuery *
-OCommonStatement::createTrue()
-{ // Not the world's most efficient unconditional true but ...
- return e_book_query_from_string("(exists \"full_name\")");
-}
-
-EBookQuery *
-OCommonStatement::createTest( const ::rtl::OUString &aColumnName,
- EBookQueryTest eTest,
- const ::rtl::OUString &aMatch )
-{
- ::rtl::OString sMatch = rtl::OUStringToOString( aMatch, RTL_TEXTENCODING_UTF8 );
- ::rtl::OString sColumnName = rtl::OUStringToOString( aColumnName, RTL_TEXTENCODING_UTF8 );
-
- return e_book_query_field_test( e_contact_field_id( sColumnName.getStr() ),
- eTest, sMatch.getStr() );
-}
-
-// -------------------------------------------------------------------------
-
-::rtl::OUString OCommonStatement::impl_getColumnRefColumnName_throw( const OSQLParseNode& _rColumnRef )
-{
- ENSURE_OR_THROW( SQL_ISRULE( &_rColumnRef, column_ref ), "internal error: only column_refs supported as LHS" );
-
- ::rtl::OUString sColumnName;
- switch ( _rColumnRef.count() )
- {
- case 3: // SQL_TOKEN_NAME '.' column_val
- {
- const OSQLParseNode* pPunct = _rColumnRef.getChild( 1 );
- const OSQLParseNode* pColVal = _rColumnRef.getChild( 2 );
- if ( SQL_ISPUNCTUATION( pPunct, "." )
- && ( pColVal->count() == 1 )
- )
- {
- sColumnName = pColVal->getChild( 0 )->getTokenValue();
- }
- }
- break;
-
- case 1: // column
- {
- sColumnName = _rColumnRef.getChild( 0 )->getTokenValue();
- }
- break;
- }
-
- if ( !sColumnName.getLength() )
- m_pConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
-
- return sColumnName;
-}
-
-// -------------------------------------------------------------------------
-void OCommonStatement::orderByAnalysis( const OSQLParseNode* _pOrderByClause, SortDescriptor& _out_rSort )
-{
- ENSURE_OR_THROW( _pOrderByClause, "NULL node" );
- ENSURE_OR_THROW( SQL_ISRULE( _pOrderByClause, opt_order_by_clause ), "wrong node type" );
-
- _out_rSort.clear();
-
- const OSQLParseNode* pOrderList = _pOrderByClause->getByRule( OSQLParseNode::ordering_spec_commalist );
- ENSURE_OR_THROW( pOrderList, "unexpected parse tree structure" );
-
- for ( sal_uInt32 i=0; i<pOrderList->count(); ++i )
- {
- const OSQLParseNode* pOrderBy = pOrderList->getChild(i);
- if ( !pOrderBy || !SQL_ISRULE( pOrderBy, ordering_spec ) )
- continue;
- const OSQLParseNode* pColumnRef = pOrderBy->count() == 2 ? pOrderBy->getChild(0) : NULL;
- const OSQLParseNode* pAscDesc = pOrderBy->count() == 2 ? pOrderBy->getChild(1) : NULL;
- ENSURE_OR_THROW(
- ( pColumnRef != NULL )
- && ( pAscDesc != NULL )
- && SQL_ISRULE( pAscDesc, opt_asc_desc )
- && ( pAscDesc->count() < 2 ),
- "ordering_spec structure error" );
-
- // column name -> column field
- if ( !SQL_ISRULE( pColumnRef, column_ref ) )
- m_pConnection->throwGenericSQLException( STR_SORT_BY_COL_ONLY, *this );
- const ::rtl::OUString sColumnName( impl_getColumnRefColumnName_throw( *pColumnRef ) );
- guint nField = evoab::findEvoabField( sColumnName );
- // ascending/descending?
- bool bAscending = true;
- if ( ( pAscDesc->count() == 1 )
- && SQL_ISTOKEN( pAscDesc->getChild( 0 ), DESC )
- )
- bAscending = false;
-
- _out_rSort.push_back( FieldSort( nField, bAscending ) );
- }
-}
-
-// -------------------------------------------------------------------------
-EBookQuery *OCommonStatement::whereAnalysis( const OSQLParseNode* parseTree )
-{
- EBookQuery *pResult = NULL;
-
- ENSURE_OR_THROW( parseTree, "invalid parse tree" );
-
- // Nested brackets
- if( parseTree->count() == 3 &&
- SQL_ISPUNCTUATION( parseTree->getChild( 0 ), "(" ) &&
- SQL_ISPUNCTUATION( parseTree->getChild( 2 ), ")" ) )
- {
- pResult = whereAnalysis( parseTree->getChild( 1 ) );
- }
-
- // SQL AND, OR
- else if( ( SQL_ISRULE( parseTree, search_condition ) ||
- SQL_ISRULE( parseTree, boolean_term ) ) &&
- parseTree->count() == 3 )
- {
- ENSURE_OR_THROW( SQL_ISTOKEN( parseTree->getChild( 1 ), OR )
- || SQL_ISTOKEN( parseTree->getChild( 1 ), AND ),
- "unexpected search_condition structure" );
-
- EBookQuery *pArgs[2];
- pArgs[0] = whereAnalysis( parseTree->getChild( 0 ) );
- pArgs[1] = whereAnalysis( parseTree->getChild( 2 ) );
-
- if( SQL_ISTOKEN( parseTree->getChild( 1 ), OR ) )
- pResult = e_book_query_or( 2, pArgs, TRUE );
- else
- pResult = e_book_query_and( 2, pArgs, TRUE );
- }
- // SQL =, !=
- else if( SQL_ISRULE( parseTree, comparison_predicate ) )
- {
- OSQLParseNode *pPrec = parseTree->getChild( 1 );
-
- ENSURE_OR_THROW( parseTree->count() == 3, "unexpected comparison_predicate structure" );
-
- OSQLParseNode* pLHS = parseTree->getChild( 0 );
- OSQLParseNode* pRHS = parseTree->getChild( 2 );
-
- if ( ( !( SQL_ISRULE( pLHS, column_ref ) ) // on the LHS, we accept a column or a constant int value
- && ( pLHS->getNodeType() != SQL_NODE_INTNUM )
- )
- || ( ( pRHS->getNodeType() != SQL_NODE_STRING ) // on the RHS, certain literals are acceptable
- && ( pRHS->getNodeType() != SQL_NODE_INTNUM )
- && ( pRHS->getNodeType() != SQL_NODE_APPROXNUM )
- && !( SQL_ISTOKEN( pRHS, TRUE ) )
- && !( SQL_ISTOKEN( pRHS, FALSE ) )
- )
- || ( ( pLHS->getNodeType() == SQL_NODE_INTNUM ) // an int on LHS requires an int on RHS
- && ( pRHS->getNodeType() != SQL_NODE_INTNUM )
- )
- )
- {
- m_pConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
- }
-
- if ( ( pPrec->getNodeType() != SQL_NODE_EQUAL )
- && ( pPrec->getNodeType() != SQL_NODE_NOTEQUAL )
- )
- {
- m_pConnection->throwGenericSQLException( STR_OPERATOR_TOO_COMPLEX, *this );
- }
-
- // recognize the special "0 = 1" condition
- if ( ( pLHS->getNodeType() == SQL_NODE_INTNUM )
- && ( pRHS->getNodeType() == SQL_NODE_INTNUM )
- && ( pPrec->getNodeType() == SQL_NODE_EQUAL )
- )
- {
- const sal_Int32 nLHS = pLHS->getTokenValue().toInt64();
- const sal_Int32 nRHS = pRHS->getTokenValue().toInt64();
- return ( nLHS == nRHS ) ? createTrue() : NULL;
- }
-
- ::rtl::OUString aColumnName( impl_getColumnRefColumnName_throw( *pLHS ) );
-
- ::rtl::OUString aMatchString;
- if ( pRHS->isToken() )
- aMatchString = pRHS->getTokenValue();
- else
- aMatchString = pRHS->getChild( 0 )->getTokenValue();
-
- pResult = createTest( aColumnName, E_BOOK_QUERY_IS, aMatchString );
-
- if ( pResult && ( pPrec->getNodeType() == SQL_NODE_NOTEQUAL ) )
- pResult = e_book_query_not( pResult, TRUE );
- }
- // SQL like
- else if( SQL_ISRULE( parseTree, like_predicate ) )
- {
- ENSURE_OR_THROW( parseTree->count() == 2, "unexpected like_predicate structure" );
- const OSQLParseNode* pPart2 = parseTree->getChild(1);
-
- if( ! SQL_ISRULE( parseTree->getChild( 0 ), column_ref) )
- m_pConnection->throwGenericSQLException(STR_QUERY_INVALID_LIKE_COLUMN,*this);
-
- ::rtl::OUString aColumnName( impl_getColumnRefColumnName_throw( *parseTree->getChild( 0 ) ) );
-
- OSQLParseNode *pAtom = pPart2->getChild( pPart2->count() - 2 ); // Match String
- bool bNotLike = pPart2->getChild(0)->isToken();
-
- if( !( pAtom->getNodeType() == SQL_NODE_STRING ||
- pAtom->getNodeType() == SQL_NODE_NAME ||
- SQL_ISRULE( pAtom,parameter ) ||
- ( pAtom->getChild( 0 ) && pAtom->getChild( 0 )->getNodeType() == SQL_NODE_NAME ) ||
- ( pAtom->getChild( 0 ) && pAtom->getChild( 0 )->getNodeType() == SQL_NODE_STRING ) ) )
- {
- OSL_TRACE( "analyseSQL : pAtom->count() = %d\n", pAtom->count() );
- m_pConnection->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,*this);
- }
-
- const sal_Unicode WILDCARD = '%';
-
- rtl::OUString aMatchString;
- aMatchString = pAtom->getTokenValue();
-
- // Determine where '%' character is...
- if( aMatchString.equals( ::rtl::OUString::valueOf( WILDCARD ) ) )
- {
- // String containing only a '%' and nothing else matches everything
- pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")) );
- }
- else if( aMatchString.indexOf( WILDCARD ) == -1 )
- { // Simple string , eg. "to match" "contains in evo"
- EVO_TRACE_STRING( "Plain contains '%s'", aMatchString );
- pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, aMatchString );
- if( pResult && bNotLike )
- pResult = e_book_query_not( pResult, TRUE );
- }
- else if( bNotLike )
- {
- // We currently can't handle a 'NOT LIKE' when there are '%'
- m_pConnection->throwGenericSQLException(STR_QUERY_NOT_LIKE_TOO_COMPLEX,*this);
- }
- else if( (aMatchString.indexOf ( WILDCARD ) == aMatchString.lastIndexOf ( WILDCARD ) ) )
- { // One occurrence of '%' matches...
- if ( aMatchString.indexOf ( WILDCARD ) == 0 )
- pResult = createTest( aColumnName, E_BOOK_QUERY_ENDS_WITH, aMatchString.copy( 1 ) );
- else if ( aMatchString.indexOf ( WILDCARD ) == aMatchString.getLength() - 1 )
- pResult = createTest( aColumnName, E_BOOK_QUERY_BEGINS_WITH, aMatchString.copy( 0, aMatchString.getLength() - 1 ) );
- else
- m_pConnection->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD,*this);
-
- if( pResult && bNotLike )
- pResult = e_book_query_not( pResult, TRUE );
- }
- else if( aMatchString.getLength() >= 3 &&
- aMatchString.indexOf ( WILDCARD ) == 0 &&
- aMatchString.indexOf ( WILDCARD, 1) == aMatchString.getLength() - 1 ) {
- // one '%' at the start and another at the end
- pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, aMatchString.copy (1, aMatchString.getLength() - 2) );
- }
- else
- m_pConnection->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD_MANY,*this);
- }
-
- return pResult;
-}
-
-rtl::OUString OCommonStatement::getTableName()
-{
- ::rtl::OUString aTableName;
-
- if( m_pParseTree && m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT )
- {
- Any aCatalog;
- ::rtl::OUString aSchema, aComposedName;
- const OSQLParseNode *pSelectStmnt = m_aSQLIterator.getParseTree();
- const OSQLParseNode *pAllTableNames = pSelectStmnt->getChild( 3 )->getChild( 0 )->getChild( 1 );
-
- if( m_aSQLIterator.isTableNode( pAllTableNames->getChild( 0 ) ) )
- OSQLParseNode::getTableComponents( pAllTableNames->getChild( 0 ),
- aCatalog,aSchema, aTableName,NULL );
-
- else if( SQL_ISRULE( pAllTableNames->getChild( 0 ), table_ref ) )
- {
- OSQLParseNode *pNodeForTableName = pAllTableNames->getChild( 0 )->getChild( 0 );
- if( m_aSQLIterator.isTableNode( pNodeForTableName ) )
- {
- aTableName = OSQLParseNode::getTableRange(pAllTableNames->getChild( 0 ));
- if( !aTableName.getLength() )
- OSQLParseNode::getTableComponents( pNodeForTableName, aCatalog, aSchema, aTableName,NULL);
- }
- else
- OSL_FAIL( "odd table layout" );
- }
- else
- OSL_FAIL( "unusual table layout" );
- }
- return aTableName;
-}
-
-void OCommonStatement::parseSql( const rtl::OUString& sql, QueryData& _out_rQueryData )
-{
- EVO_TRACE_STRING( "parsing %s", sql );
-
- _out_rQueryData.eFilterType = eFilterOther;
-
- ::rtl::OUString aErr;
- m_pParseTree = m_aParser.parseTree( aErr, sql );
- m_aSQLIterator.setParseTree( m_pParseTree );
- m_aSQLIterator.traverseAll();
-
- _out_rQueryData.sTable = getTableName();
-
- // to be sorted?
- const OSQLParseNode* pOrderByClause = m_aSQLIterator.getOrderTree();
- if ( pOrderByClause )
- {
- #if OSL_DEBUG_LEVEL > 0
- ::rtl::OUString sTreeDebug;
- pOrderByClause->showParseTree( sTreeDebug );
- EVO_TRACE_STRING( "found order-by tree:\n%s", sTreeDebug );
- #endif
- orderByAnalysis( pOrderByClause, _out_rQueryData.aSortOrder );
- }
-
- const OSQLParseNode* pWhereClause = m_aSQLIterator.getWhereTree();
- if ( pWhereClause && SQL_ISRULE( pWhereClause, where_clause ) )
- {
- #if OSL_DEBUG_LEVEL > 0
- ::rtl::OUString sTreeDebug;
- pWhereClause->showParseTree( sTreeDebug );
- EVO_TRACE_STRING( "found where tree:\n%s", sTreeDebug );
- #endif
- EBookQuery* pQuery = whereAnalysis( pWhereClause->getChild( 1 ) );
- if ( !pQuery )
- {
- _out_rQueryData.eFilterType = eFilterAlwaysFalse;
- pQuery = createTrue();
- }
- _out_rQueryData.setQuery( pQuery );
- }
- else
- {
- _out_rQueryData.eFilterType = eFilterNone;
- _out_rQueryData.setQuery( createTrue() );
- }
-}
-
-// -------------------------------------------------------------------------
-
-Reference< XConnection > SAL_CALL OStatement::getConnection( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
-
- // just return our connection here
- return impl_getConnection();
-}
-
-// -------------------------------------------------------------------------
-Any SAL_CALL OCommonStatement::getWarnings( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
-
-
- return makeAny(SQLWarning());
-}
-
-// -------------------------------------------------------------------------
-void SAL_CALL OCommonStatement::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
-
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OCommonStatement::createArrayHelper( ) const
-{
- Sequence< Property > aProps;
- describeProperties( aProps );
- return new ::cppu::OPropertyArrayHelper( aProps );
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & OCommonStatement::getInfoHelper()
-{
- return *const_cast< OCommonStatement* >( this )->getArrayHelper();
-}
-
-// -----------------------------------------------------------------------------
-void SAL_CALL OCommonStatement::acquire() throw()
-{
- OCommonStatement_IBase::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OCommonStatement::release() throw()
-{
- relase_ChildImpl();
-}
-
-// -------------------------------------------------------------------------
-QueryData OCommonStatement::impl_getEBookQuery_throw( const ::rtl::OUString& _rSql )
-{
- QueryData aData;
- parseSql( _rSql, aData );
-
-#ifdef DEBUG
- char *pSexpr = aData.getQuery() ? e_book_query_to_string( aData.getQuery() ) : g_strdup( "<map failed>" );
- g_message( "Parsed SQL to sexpr '%s'\n", pSexpr );
- g_free( pSexpr );
-#endif
-
- if ( !aData.getQuery() )
- m_pConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
-
- // a postcondition of this method is that we properly determined the SELECT columns
- aData.xSelectColumns = m_aSQLIterator.getSelectColumns();
- if ( !aData.xSelectColumns.is() )
- m_pConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
-
- return aData;
-}
-
-// -------------------------------------------------------------------------
-Reference< XResultSet > OCommonStatement::impl_executeQuery_throw( const QueryData& _rQueryData )
-{
- // create result set
- OEvoabResultSet* pResult = new OEvoabResultSet( this, m_pConnection );
- Reference< XResultSet > xRS = pResult;
- pResult->construct( _rQueryData );
-
- // done
- m_xResultSet = xRS;
- return xRS;
-}
-
-// -------------------------------------------------------------------------
-Reference< XResultSet > OCommonStatement::impl_executeQuery_throw( const ::rtl::OUString& _rSql )
-{
- EVO_TRACE_STRING( "OCommonStatement::impl_executeQuery_throw(%s)\n", _rSql );
-
-#ifdef DEBUG
- g_message( "Parse SQL '%s'\n",
- (const sal_Char *)OUStringToOString( _rSql, RTL_TEXTENCODING_UTF8 ) );
-#endif
-
- return impl_executeQuery_throw( impl_getEBookQuery_throw( _rSql ) );
-}
-
-// -----------------------------------------------------------------------------
-Reference< XPropertySetInfo > SAL_CALL OCommonStatement::getPropertySetInfo( ) throw(RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() );
-}
-
-// =============================================================================
-// = OStatement
-// =============================================================================
-// -----------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO( OStatement, "com.sun.star.comp.sdbcx.evoab.OStatement", "com.sun.star.sdbc.Statement" );
-
-// -----------------------------------------------------------------------------
-IMPLEMENT_FORWARD_XINTERFACE2( OStatement, OCommonStatement, OStatement_IBase )
-
-// -----------------------------------------------------------------------------
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( OStatement, OCommonStatement, OStatement_IBase )
-
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OStatement::execute( const ::rtl::OUString& _sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
-
- Reference< XResultSet > xRS = impl_executeQuery_throw( _sql );
- return xRS.is();
-}
-
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL OStatement::executeQuery( const ::rtl::OUString& _sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
-
- return impl_executeQuery_throw( _sql );
-}
-
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OStatement::executeUpdate( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this );
- return 0;
-}
-
-} } // namespace ::connectivity::evoab
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NStatement.hxx b/connectivity/source/drivers/evoab2/NStatement.hxx
deleted file mode 100644
index b5adfeb0a7..0000000000
--- a/connectivity/source/drivers/evoab2/NStatement.hxx
+++ /dev/null
@@ -1,291 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_EVOAB_STATEMENT_HXX_
-#define _CONNECTIVITY_EVOAB_STATEMENT_HXX_
-
-#include <com/sun/star/sdbc/XStatement.hpp>
-#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
-#include <com/sun/star/sdbc/XMultipleResults.hpp>
-#include <com/sun/star/sdbc/XCloseable.hpp>
-#include <com/sun/star/sdbc/SQLWarning.hpp>
-#include <comphelper/proparrhlp.hxx>
-#include <cppuhelper/compbase2.hxx>
-#include <comphelper/uno3.hxx>
-#include "connectivity/CommonTools.hxx"
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <comphelper/broadcasthelper.hxx>
-#include "connectivity/sqliterator.hxx"
-#include "connectivity/sqlparse.hxx"
-#include <connectivity/FValue.hxx>
-#include "OSubComponent.hxx"
-#include <com/sun/star/util/XCancellable.hpp>
-#include <cppuhelper/compbase5.hxx>
-#include <comphelper/propertycontainer.hxx>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-
-#include "EApi.h"
-
-#include <list>
-
-namespace connectivity
-{
- namespace evoab
- {
- class OEvoabResultSet;
- class OEvoabConnection;
- typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::sdbc::XWarningsSupplier
- , ::com::sun::star::sdbc::XCloseable
- > OCommonStatement_IBase;
-
- struct FieldSort
- {
- sal_Int32 nField;
- bool bAscending;
-
- FieldSort() : nField(0), bAscending( true ) { }
- FieldSort( const sal_Int32 _nField, const bool _bAscending ) : nField( _nField ), bAscending( _bAscending ) { }
- };
- typedef ::std::vector< FieldSort > SortDescriptor;
-
- enum QueryFilterType
- {
- eFilterAlwaysFalse,
- eFilterNone,
- eFilterOther
- };
-
- struct QueryData
- {
- private:
- EBookQuery* pQuery;
-
- public:
- ::rtl::OUString sTable;
- QueryFilterType eFilterType;
- ::rtl::Reference< ::connectivity::OSQLColumns > xSelectColumns;
- SortDescriptor aSortOrder;
-
- QueryData()
- :pQuery( NULL )
- ,sTable()
- ,eFilterType( eFilterOther )
- ,xSelectColumns()
- ,aSortOrder()
- {
- }
-
- QueryData( const QueryData& _rhs )
- :pQuery( NULL )
- ,sTable()
- ,eFilterType( eFilterType )
- ,xSelectColumns()
- ,aSortOrder()
- {
- *this = _rhs;
- }
-
- QueryData& operator=( const QueryData& _rhs )
- {
- if ( this == &_rhs )
- return *this;
-
- setQuery( _rhs.pQuery );
- sTable = _rhs.sTable;
- eFilterType = _rhs.eFilterType;
- xSelectColumns = _rhs.xSelectColumns;
- aSortOrder = _rhs.aSortOrder;
-
- return *this;
- }
-
- ~QueryData()
- {
- setQuery( NULL );
- }
-
- EBookQuery* getQuery() const { return pQuery; }
-
- void setQuery( EBookQuery* _pQuery )
- {
- if ( pQuery )
- e_book_query_unref( pQuery );
- pQuery = _pQuery;
- if ( pQuery )
- e_book_query_ref( pQuery );
- }
- };
-
- //**************************************************************
- //************ Class: OCommonStatement
- // is a base class for the normal statement and for the prepared statement
- //**************************************************************
- class OCommonStatement;
- typedef OSubComponent< OCommonStatement, OCommonStatement_IBase > OStatement_CBase;
-
- class OCommonStatement :public comphelper::OBaseMutex
- ,public OCommonStatement_IBase
- ,public ::comphelper::OPropertyContainer
- ,public ::comphelper::OPropertyArrayUsageHelper< OCommonStatement >
- ,public OStatement_CBase
- {
- friend class OSubComponent< OCommonStatement, OCommonStatement_IBase >;
-
- private:
- ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created
- OEvoabResultSet *m_pResultSet;
- OEvoabConnection *m_pConnection;
- connectivity::OSQLParser m_aParser;
- connectivity::OSQLParseTreeIterator m_aSQLIterator;
- connectivity::OSQLParseNode *m_pParseTree;
-
- // <properties>
- ::rtl::OUString m_aCursorName;
- sal_Int32 m_nMaxFieldSize;
- sal_Int32 m_nMaxRows;
- sal_Int32 m_nQueryTimeOut;
- sal_Int32 m_nFetchSize;
- sal_Int32 m_nResultSetType;
- sal_Int32 m_nFetchDirection;
- sal_Int32 m_nResultSetConcurrency;
- sal_Bool m_bEscapeProcessing;
- // </properties>
-
- ::cppu::OBroadcastHelper& rBHelper;
-
- protected:
-
- void disposeResultSet();
-
- // OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
- // OPropertySetHelper
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
-
- virtual ~OCommonStatement();
-
- protected:
- void reset () throw( ::com::sun::star::sdbc::SQLException);
- void clearMyResultSet () throw( ::com::sun::star::sdbc::SQLException);
- void parseSql( const ::rtl::OUString& sql, QueryData& _out_rQueryData );
- EBookQuery *whereAnalysis( const OSQLParseNode* parseTree );
- void orderByAnalysis( const OSQLParseNode* _pOrderByClause, SortDescriptor& _out_rSort );
- rtl::OUString getTableName();
- EBookQuery *createTrue();
- EBookQuery *createTest( const ::rtl::OUString &aColumnName,
- EBookQueryTest eTest,
- const ::rtl::OUString &aMatch );
-
- public:
-
- // other methods
- OEvoabConnection* getOwnConnection() const { return m_pConnection;}
-
- using OCommonStatement_IBase::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
-
- protected:
- OCommonStatement( OEvoabConnection* _pConnection );
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
- // XInterface
- virtual void SAL_CALL release() throw();
- virtual void SAL_CALL acquire() throw();
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- //XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XWarningsSupplier
- virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- protected:
- /** will return the EBookQuery representing the stamement's WHERE condition, or throw
-
- Also, all statement dependent members (such as the parser/iterator) will be inited afterwards.
- */
- QueryData
- impl_getEBookQuery_throw( const ::rtl::OUString& _rSql );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
- impl_executeQuery_throw( const ::rtl::OUString& _rSql );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
- impl_executeQuery_throw( const QueryData& _rData );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
- impl_getConnection() { return ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >( (::com::sun::star::sdbc::XConnection*)m_pConnection ); }
-
- ::rtl::OUString
- impl_getColumnRefColumnName_throw( const ::connectivity::OSQLParseNode& _rColumnRef );
- };
-
- typedef ::cppu::ImplHelper2 < ::com::sun::star::lang::XServiceInfo
- , ::com::sun::star::sdbc::XStatement
- > OStatement_IBase;
- class OStatement :public OCommonStatement
- ,public OStatement_IBase
- {
- protected:
- virtual ~OStatement(){}
-
- public:
- OStatement( OEvoabConnection* _pConnection)
- :OCommonStatement( _pConnection)
- {
- }
-
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
-
- // XTypeProvider
- DECLARE_XTYPEPROVIDER()
-
- // XServiceInfo
- DECLARE_SERVICE_INFO();
-
- // XStatement
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- };
- }
-}
-#endif // CONNECTIVITY_SSTATEMENT_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NTable.cxx b/connectivity/source/drivers/evoab2/NTable.cxx
deleted file mode 100644
index 30807ab4f5..0000000000
--- a/connectivity/source/drivers/evoab2/NTable.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "NTable.hxx"
-#include "NTables.hxx"
-#include "NColumns.hxx"
-#include "NCatalog.hxx"
-
-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,
- OEvoabConnection* _pConnection,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description ,
- const ::rtl::OUString& _SchemaName,
- const ::rtl::OUString& _CatalogName
- ) : OEvoabTable_TYPEDEF(_pTables,sal_True,
- _Name,
- _Type,
- _Description,
- _SchemaName,
- _CatalogName),
- m_pConnection(_pConnection)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-void OEvoabTable::refreshColumns()
-{
- TStringVector aVector;
-
- if (!isNew())
- {
- Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(
- Any(),
- m_SchemaName,
- m_Name,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")));
-
- if (xResult.is())
- {
- Reference< XRow > xRow(xResult, UNO_QUERY);
- while (xResult->next())
- aVector.push_back(xRow->getString(4));
- }
- }
- if (m_pColumns)
- m_pColumns->reFill(aVector);
- else
- m_pColumns = new OEvoabColumns(this,m_aMutex,aVector);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NTable.hxx b/connectivity/source/drivers/evoab2/NTable.hxx
deleted file mode 100644
index 169191d630..0000000000
--- a/connectivity/source/drivers/evoab2/NTable.hxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_EVOAB_TABLE_HXX_
-#define _CONNECTIVITY_EVOAB_TABLE_HXX_
-
-#include "NConnection.hxx"
-#include "connectivity/sdbcx/VTable.hxx"
-
-namespace connectivity
-{
- namespace evoab
- {
- typedef connectivity::sdbcx::OTable OEvoabTable_TYPEDEF;
-
- ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp);
-
- class OEvoabTable : public OEvoabTable_TYPEDEF
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
- OEvoabConnection* m_pConnection;
-
- public:
- OEvoabTable( sdbcx::OCollection* _pTables,
- OEvoabConnection* _pConnection,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description = ::rtl::OUString(),
- const ::rtl::OUString& _SchemaName = ::rtl::OUString(),
- const ::rtl::OUString& _CatalogName = ::rtl::OUString()
- );
-
- OEvoabConnection* getConnection() { return m_pConnection;}
-
- virtual void refreshColumns();
-
- ::rtl::OUString getTableName() const { return m_Name; }
- ::rtl::OUString getSchema() const { return m_SchemaName; }
- };
- }
-}
-
-#endif // _CONNECTIVITY_EVOAB_TABLE_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NTables.cxx b/connectivity/source/drivers/evoab2/NTables.cxx
deleted file mode 100644
index a883d823a8..0000000000
--- a/connectivity/source/drivers/evoab2/NTables.cxx
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "NTables.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include <connectivity/sdbcx/VTable.hxx>
-#include "NCatalog.hxx"
-#include "NConnection.hxx"
-#include <comphelper/extract.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/dbexception.hxx"
-#include <cppuhelper/interfacecontainer.h>
-#include <comphelper/types.hxx>
-#include "NDebug.hxx"
-#include "NTable.hxx"
-using namespace ::comphelper;
-
-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;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-ObjectType OEvoabTables::createObject(const ::rtl::OUString& aName)
-{
- ::rtl::OUString aSchema( RTL_CONSTASCII_USTRINGPARAM( "%" ));
-
- Sequence< ::rtl::OUString > aTypes(1);
- aTypes[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
- ::rtl::OUString sEmpty;
-
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),aSchema,aName,aTypes);
-
- ObjectType xRet = NULL;
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- if(xResult->next()) // there can be only one table with this name
- {
- OEvoabTable* pRet = new OEvoabTable(
- this,
- (OEvoabConnection *)static_cast<OEvoabCatalog&>(m_rParent).getConnection(),
- aName,
- xRow->getString(4),
- xRow->getString(5),
- sEmpty);
- xRet = pRet;
- }
- }
-
- ::comphelper::disposeComponent(xResult);
-
- return xRet;
-}
-// -------------------------------------------------------------------------
-void OEvoabTables::impl_refresh( ) throw(RuntimeException)
-{
- static_cast<OEvoabCatalog&>(m_rParent).refreshTables();
-}
-// -------------------------------------------------------------------------
-void OEvoabTables::disposing(void)
-{
-m_xMetaData.clear();
- OCollection::disposing();
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/NTables.hxx b/connectivity/source/drivers/evoab2/NTables.hxx
deleted file mode 100644
index 001454a18d..0000000000
--- a/connectivity/source/drivers/evoab2/NTables.hxx
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _CONNECTIVITY_EVOAB_TABLES_HXX_
-#define _CONNECTIVITY_EVOAB_TABLES_HXX_
-
-#include "connectivity/sdbcx/VCollection.hxx"
-#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-namespace connectivity
-{
- namespace evoab
- {
- class OEvoabTables : public sdbcx::OCollection
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
- protected:
- virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
- virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
- public:
- OEvoabTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,
- ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
- const TStringVector &_rVector) :
- sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector),
- m_xMetaData(_rMetaData)
- {}
- virtual void SAL_CALL disposing(void);
- };
- }
-}
-#endif // _CONNECTIVITY_EVOAB_TABLES_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/evoab2/evoab.component b/connectivity/source/drivers/evoab2/evoab.component
deleted file mode 100755
index a99719388d..0000000000
--- a/connectivity/source/drivers/evoab2/evoab.component
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.sdbc.evoab.OEvoabDriver">
- <service name="com.sun.star.sdbc.Driver"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/evoab2/evoab.xml b/connectivity/source/drivers/evoab2/evoab.xml
deleted file mode 100755
index fbf309cbf0..0000000000
--- a/connectivity/source/drivers/evoab2/evoab.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE module-description PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
-<module-description>
- <module-name>evoab</module-name>
- <component-description>
- <author>Jayant Madavi</author>
- <name>com.sun.star.comp.sdbc.evoab.OEvoabDriver</name>
- <description>This library implements the database driver for evolution address book formats.
-</description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service>com.sun.star.sdbc.Driver</supported-service>
- <service-dependency> ... </service-dependency>
- </component-description>
- <project-build-dependency>cppuhelper</project-build-dependency>
- <project-build-dependency>cppu</project-build-dependency>
- <project-build-dependency>sal</project-build-dependency>
- <runtime-module-dependency>cppuhelper</runtime-module-dependency>
- <runtime-module-dependency>cppu</runtime-module-dependency>
- <runtime-module-dependency>sal</runtime-module-dependency>
- <runtime-module-dependency>osl</runtime-module-dependency>
- <runtime-module-dependency>svtools-light1</runtime-module-dependency>
- <runtime-module-dependency>svtools</runtime-module-dependency>
- <runtime-module-dependency>ucbhelper</runtime-module-dependency>
- <runtime-module-dependency>unotools</runtime-module-dependency>
- <runtime-module-dependency>comphelper</runtime-module-dependency>
-</module-description>
diff --git a/connectivity/source/drivers/evoab2/evoab2.xcu b/connectivity/source/drivers/evoab2/evoab2.xcu
deleted file mode 100644
index bda1fb8648..0000000000
--- a/connectivity/source/drivers/evoab2/evoab2.xcu
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="sdbc:address:evolution:local" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.evoab.OEvoabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Evolution Local</value>
- </prop>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:address:evolution:ldap" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.evoab.OEvoabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Evolution LDAP</value>
- </prop>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:address:evolution:groupwise" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.evoab.OEvoabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Groupwise</value>
- </prop>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/evoab2/makefile.mk b/connectivity/source/drivers/evoab2/makefile.mk
deleted file mode 100755
index 6f61762a0c..0000000000
--- a/connectivity/source/drivers/evoab2/makefile.mk
+++ /dev/null
@@ -1,121 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=evoab2
-ENABLE_EXCEPTIONS=TRUE
-VISIBILITY_HIDDEN=TRUE
-
-.IF "$(ENABLE_EVOAB2)"!="TRUE"
-dummy:
- @echo "Evolution 2.x Addressbook build disabled"
-.ELSE
-
-# --- Settings ----------------------------------
-
-.INCLUDE : $(PRJ)$/makefile.pmk
-.INCLUDE : $(PRJ)$/version.mk
-
-PKGCONFIG_MODULES=gtk+-2.0
-.INCLUDE : pkg_config.mk
-
-CFLAGS+=$(GOBJECT_CFLAGS)
-
-# --- Files -------------------------------------
-
-SLOFILES=\
- $(SLO)$/NDriver.obj \
- $(SLO)$/NTable.obj \
- $(SLO)$/NColumns.obj \
- $(SLO)$/NTables.obj \
- $(SLO)$/NCatalog.obj \
- $(SLO)$/NConnection.obj \
- $(SLO)$/NDatabaseMetaData.obj \
- $(SLO)$/NStatement.obj \
- $(SLO)$/NPreparedStatement.obj \
- $(SLO)$/NServices.obj \
- $(SLO)$/NResultSet.obj \
- $(SLO)$/NResultSetMetaData.obj \
- $(SLO)$/EApi.obj \
- $(SLO)$/NDebug.obj
-
-SHL1VERSIONMAP=$(SOLARENV)/src/component.map
-
-
-# --- Library -----------------------------------
-
-SHL1TARGET= $(EVOAB_TARGET)$(DLLPOSTFIX)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SVLLIB) \
- $(TOOLSLIB) \
- $(UNOTOOLSLIB) \
- $(UCBHELPERLIB) \
- $(SALLIB) \
- $(SALHELPERLIB) \
- $(DBTOOLSLIB) \
- $(DBFILELIB) \
- $(COMPHELPERLIB)
-
-.IF "$(DBFILELIB)" == ""
-SHL1STDLIBS+= ifile.lib
-.ENDIF
-SHL1STDLIBS+=$(GOBJECT_LIBS)
-
-
-SHL1STDLIBS+=$(PKGCONFIG_LIBS:s/ -lpangoxft-1.0//)
-# hack for faked SO environment
-.IF "$(PKGCONFIG_ROOT)"!=""
-SHL1SONAME+=-z nodefs
-SHL1NOCHECK=TRUE
-.ENDIF # "$(PKGCONFIG_ROOT)"!=""
-
-
-SHL1DEPN=
-SHL1IMPLIB= i$(TARGET)
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-
-.ENDIF
-
-# --- Targets ----------------------------------
-
-.INCLUDE : $(PRJ)$/target.pmk
-
-ALLTAR : $(MISC)/evoab.component
-
-$(MISC)/evoab.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- evoab.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt evoab.component
diff --git a/connectivity/source/drivers/file/FCatalog.cxx b/connectivity/source/drivers/file/FCatalog.cxx
deleted file mode 100644
index ad4430cb88..0000000000
--- a/connectivity/source/drivers/file/FCatalog.cxx
+++ /dev/null
@@ -1,123 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "file/FCatalog.hxx"
-#include "file/FConnection.hxx"
-#include "file/FTables.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <rtl/logfile.hxx>
-
-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;
-// -------------------------------------------------------------------------
-OFileCatalog::OFileCatalog(OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon)
- ,m_pConnection(_pCon)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileCatalog::OFileCatalog" );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OFileCatalog::disposing()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileCatalog::disposing" );
- ::osl::MutexGuard aGuard(m_aMutex);
-
- typedef connectivity::sdbcx::OCatalog OFileCatalog_BASE;
-m_xMetaData.clear();
- OFileCatalog_BASE::disposing();
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OFileCatalog::buildName(const Reference< XRow >& _xRow)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileCatalog::buildName" );
- return _xRow->getString(3);
-}
-// -------------------------------------------------------------------------
-void OFileCatalog::refreshTables()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileCatalog::refreshTables" );
- TStringVector aVector;
- Sequence< ::rtl::OUString > aTypes;
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),aTypes);
- fillNames(xResult,aVector);
-
- if(m_pTables)
- m_pTables->reFill(aVector);
- else
- m_pTables = new OTables(m_xMetaData,*this,m_aMutex,aVector);
-}
-
-// -------------------------------------------------------------------------
-Any SAL_CALL OFileCatalog::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileCatalog::queryInterface" );
- if( rType == ::getCppuType((const Reference<XGroupsSupplier>*)0) ||
- rType == ::getCppuType((const Reference<XUsersSupplier>*)0) ||
- rType == ::getCppuType((const Reference<XViewsSupplier>*)0))
- return Any();
-
-
- typedef sdbcx::OCatalog OFileCatalog_BASE;
- return OFileCatalog_BASE::queryInterface(rType);
-}
-// -----------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OFileCatalog::getTypes( ) throw(RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileCatalog::getTypes" );
- typedef sdbcx::OCatalog OFileCatalog_BASE;
-
- Sequence< Type > aTypes = OFileCatalog_BASE::getTypes();
- ::std::vector<Type> aOwnTypes;
- aOwnTypes.reserve(aTypes.getLength());
- const Type* pBegin = aTypes.getConstArray();
- const Type* pEnd = pBegin + aTypes.getLength();
- for(;pBegin != pEnd;++pBegin)
- {
- if(!(*pBegin == ::getCppuType((const Reference<XGroupsSupplier>*)0) ||
- *pBegin == ::getCppuType((const Reference<XUsersSupplier>*)0) ||
- *pBegin == ::getCppuType((const Reference<XViewsSupplier>*)0)))
- {
- aOwnTypes.push_back(*pBegin);
- }
- }
- const Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- return Sequence< Type >(pTypes, aOwnTypes.size());
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/FColumns.cxx b/connectivity/source/drivers/file/FColumns.cxx
deleted file mode 100644
index ae1d119011..0000000000
--- a/connectivity/source/drivers/file/FColumns.cxx
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "file/FColumns.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include "file/FTable.hxx"
-#include <comphelper/property.hxx>
-
-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;
-
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName)
-{
-
- Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(Any(),
- m_pTable->getSchema(),m_pTable->getName(),_rName);
-
- sdbcx::ObjectType xRet = NULL;
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while(xResult->next())
- {
- if(xRow->getString(4) == _rName)
- {
- sdbcx::OColumn* pRet = new sdbcx::OColumn(_rName,
- xRow->getString(6),
- xRow->getString(13),
- xRow->getString(12),
- xRow->getInt(11),
- xRow->getInt(7),
- xRow->getInt(9),
- xRow->getInt(5),
- sal_False,
- sal_False,
- sal_False,
- m_pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers());
- xRet = pRet;
- break;
- }
- }
- }
-
- return xRet;
-}
-// -----------------------------------------------------------------------------
-void OColumns::impl_refresh() throw(RuntimeException)
-{
- m_pTable->refreshColumns();
-}
-// -----------------------------------------------------------------------------
-
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx
deleted file mode 100644
index a24de50729..0000000000
--- a/connectivity/source/drivers/file/FConnection.cxx
+++ /dev/null
@@ -1,463 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include "file/FConnection.hxx"
-#include "file/FDatabaseMetaData.hxx"
-#include "file/FDriver.hxx"
-#include "file/FStatement.hxx"
-#include "file/FPreparedStatement.hxx"
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/ucb/XContent.hpp>
-#include <com/sun/star/ucb/XContentIdentifier.hpp>
-#include <tools/urlobj.hxx>
-#include "file/FCatalog.hxx"
-#include <unotools/pathoptions.hxx>
-#include <ucbhelper/content.hxx>
-#include <connectivity/dbcharset.hxx>
-#include <connectivity/dbexception.hxx>
-#include <osl/thread.h>
-#include <osl/nlsupport.h>
-#include "resource/file_res.hrc"
-
-using namespace connectivity::file;
-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;
-using namespace com::sun::star::sdbcx;
-using namespace com::sun::star::container;
-using namespace com::sun::star::ucb;
-using namespace ::ucbhelper;
-using rtl::OUString;
-typedef connectivity::OMetaConnection OConnection_BASE;
-// --------------------------------------------------------------------------------
-OConnection::OConnection(OFileDriver* _pDriver)
- : OSubComponent<OConnection, OConnection_BASE>((::cppu::OWeakObject*)_pDriver, this)
- ,m_pDriver(_pDriver)
- ,m_bClosed(sal_False)
- ,m_bShowDeleted(sal_False)
- ,m_bCaseSensitiveExtension( sal_True )
- ,m_bCheckSQL92(sal_False)
- ,m_bDefaultTextEncoding(false)
-{
- m_nTextEncoding = RTL_TEXTENCODING_DONTKNOW;
-}
-//-----------------------------------------------------------------------------
-OConnection::~OConnection()
-{
- if(!isClosed( ))
- close();
-}
-//-----------------------------------------------------------------------------
-void SAL_CALL OConnection::release() throw()
-{
- relase_ChildImpl();
-}
-
-//-----------------------------------------------------------------------------
-sal_Bool OConnection::matchesExtension( const String& _rExt ) const
-{
- if ( isCaseSensitveExtension() )
- return ( getExtension() == _rExt );
-
- String sMyExtension( getExtension() );
- sMyExtension.ToLowerAscii();
- String sExt( _rExt );
- sExt.ToLowerAscii();
-
- return sMyExtension == sExt;
-}
-
-//-----------------------------------------------------------------------------
-void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException)
-{
- osl_incrementInterlockedCount( &m_refCount );
-
- ::rtl::OUString aExt;
- const PropertyValue *pIter = info.getConstArray();
- const PropertyValue *pEnd = pIter + info.getLength();
- for(;pIter != pEnd;++pIter)
- {
- if(0 == pIter->Name.compareToAscii("Extension"))
- OSL_VERIFY( pIter->Value >>= aExt );
- else if(0 == pIter->Name.compareToAscii("CharSet"))
- {
- ::rtl::OUString sIanaName;
- OSL_VERIFY( pIter->Value >>= sIanaName );
-
- ::dbtools::OCharsetMap aLookupIanaName;
- ::dbtools::OCharsetMap::const_iterator aLookup = aLookupIanaName.find(sIanaName, ::dbtools::OCharsetMap::IANA());
- if (aLookup != aLookupIanaName.end())
- m_nTextEncoding = (*aLookup).getEncoding();
- else
- m_nTextEncoding = RTL_TEXTENCODING_DONTKNOW;
- }
- else if (0 == pIter->Name.compareToAscii("ShowDeleted"))
- {
- OSL_VERIFY( pIter->Value >>= m_bShowDeleted );
- }
- else if (0 == pIter->Name.compareToAscii("EnableSQL92Check"))
- {
- pIter->Value >>= m_bCheckSQL92;
- }
- } // for(;pIter != pEnd;++pIter)
-
- {
- sal_Int32 nLen = url.indexOf(':');
- nLen = url.indexOf(':',nLen+1);
- ::rtl::OUString aDSN(url.copy(nLen+1)),aUID,aPWD;
-
- String aFileName = aDSN;
- INetURLObject aURL;
- aURL.SetSmartProtocol(INET_PROT_FILE);
- {
- SvtPathOptions aPathOptions;
- aFileName = aPathOptions.SubstituteVariable(aFileName);
- }
-
- aURL.SetSmartURL(aFileName);
-
- setURL(aURL.GetMainURL(INetURLObject::NO_DECODE));
- }
-
- if ( m_nTextEncoding == RTL_TEXTENCODING_DONTKNOW )
- {
- //m_nTextEncoding = osl_getTextEncodingFromLocale(NULL);
- m_nTextEncoding = osl_getThreadTextEncoding();
- m_bDefaultTextEncoding = true;
- }
-
- if ( aExt.getLength() )
- m_aFilenameExtension = aExt;
-
- try
- {
- ::ucbhelper::Content aFile;
- try
- {
- aFile = ::ucbhelper::Content(getURL(),Reference< XCommandEnvironment >());
- }
- catch(ContentCreationException& e)
- {
- throwUrlNotValid(getURL(),e.Message);
- }
-
- // set fields to fetch
- Sequence< OUString > aProps(1);
- OUString* pProps = aProps.getArray();
- pProps[ 0 ] = OUString(RTL_CONSTASCII_USTRINGPARAM("Title"));
-
- try
- {
- if (aFile.isFolder())
- {
- m_xDir = aFile.createDynamicCursor(aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
- m_xContent = aFile.get();
- }
- else if (aFile.isDocument())
- {
- Reference<XContent> xParent(Reference<XChild>(aFile.get(),UNO_QUERY)->getParent(),UNO_QUERY);
- Reference<XContentIdentifier> xIdent = xParent->getIdentifier();
- m_xContent = xParent;
-
- ::ucbhelper::Content aParent(xIdent->getContentIdentifier(),Reference< XCommandEnvironment >());
- m_xDir = aParent.createDynamicCursor(aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
- }
- else
- {
- OSL_FAIL("OConnection::construct: ::ucbhelper::Content isn't a folde nor a document! How that?!");
- throw SQLException();
- }
- }
- catch(Exception& e) // a execption is thrown when no file exists
- {
- throwUrlNotValid(getURL(),e.Message);
- }
- if(!m_xDir.is() || !m_xContent.is())
- throwUrlNotValid(getURL(),::rtl::OUString());
-
- if (m_aFilenameExtension.Search('*') != STRING_NOTFOUND || m_aFilenameExtension.Search('?') != STRING_NOTFOUND)
- throw SQLException();
- }
- catch(const Exception&)
- {
- osl_decrementInterlockedCount( &m_refCount );
- throw;
- }
-
- osl_decrementInterlockedCount( &m_refCount );
-}
-// XServiceInfo
-// --------------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.file.Connection", "com.sun.star.sdbc.Connection")
-
-// --------------------------------------------------------------------------------
-Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- Reference< XStatement > xReturn = new OStatement(this);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
- return xReturn;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- OPreparedStatement* pStmt = new OPreparedStatement(this);
- Reference< XPreparedStatement > xHoldAlive = pStmt;
- pStmt->construct(sql);
- m_aStatements.push_back(WeakReferenceHelper(*pStmt));
- return pStmt;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
-{
- throwFeatureNotImplementedException( "XConnection::prepareCall", *this );
- return NULL;
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConnection::nativeSQL( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- return sql;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- m_bAutoCommit = autoCommit;
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- return m_bAutoCommit;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException)
-{
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException)
-{
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- return OConnection_BASE::rBHelper.bDisposed;
-}
-// --------------------------------------------------------------------------------
-Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
- if(!xMetaData.is())
- {
- xMetaData = new ODatabaseMetaData(this);
- m_xMetaData = xMetaData;
- }
-
- return xMetaData;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- m_bReadOnly = readOnly;
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- return m_bReadOnly;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& /*catalog*/ ) throw(SQLException, RuntimeException)
-{
- throwFeatureNotImplementedException( "XConnection::setCatalog", *this );
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConnection::getCatalog( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException)
-{
- throwFeatureNotImplementedException( "XConnection::setTransactionIsolation", *this );
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- return 0;
-}
-// --------------------------------------------------------------------------------
-Reference< XNameAccess > SAL_CALL OConnection::getTypeMap( ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setTypeMap( const Reference< XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
-}
-// --------------------------------------------------------------------------------
-// XCloseable
-void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- }
- dispose();
-}
-// --------------------------------------------------------------------------------
-// XWarningsSupplier
-Any SAL_CALL OConnection::getWarnings( ) throw(SQLException, RuntimeException)
-{
- return Any();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeException)
-{
-}
-//------------------------------------------------------------------------------
-void OConnection::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- OConnection_BASE::disposing();
-
- m_bClosed = sal_True;
-m_xDir.clear();
-m_xContent.clear();
- m_xCatalog = WeakReference< XTablesSupplier>();
-
- dispose_ChildImpl();
-}
-//------------------------------------------------------------------------------
-Reference< XTablesSupplier > OConnection::createCatalog()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- Reference< XTablesSupplier > xTab = m_xCatalog;
- if(!xTab.is())
- {
- xTab = new OFileCatalog(this);
- m_xCatalog = xTab;
- }
- return xTab;
-}
-// -----------------------------------------------------------------------------
-Reference< XDynamicResultSet > OConnection::getDir() const
-{
- Reference<XDynamicResultSet> xContent;
- Sequence< ::rtl::OUString > aProps(1);
- ::rtl::OUString* pProps = aProps.getArray();
- pProps[ 0 ] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title"));
- try
- {
- Reference<XContentIdentifier> xIdent = getContent()->getIdentifier();
- ::ucbhelper::Content aParent(xIdent->getContentIdentifier(),Reference< XCommandEnvironment >());
- xContent = aParent.createDynamicCursor(aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
- }
- catch(Exception&)
- {
- }
- return xContent;
-}
-// -----------------------------------------------------------------------------
-sal_Int64 SAL_CALL OConnection::getSomething( const Sequence< sal_Int8 >& rId ) throw (RuntimeException)
-{
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : (sal_Int64)0;
-}
-// -----------------------------------------------------------------------------
-Sequence< sal_Int8 > OConnection::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-// -----------------------------------------------------------------------------
-void OConnection::throwUrlNotValid(const ::rtl::OUString & _rsUrl,const ::rtl::OUString & _rsMessage)
-{
- SQLException aError;
- aError.Message = getResources().getResourceStringWithSubstitution(
- STR_NO_VALID_FILE_URL,
- "$URL$", _rsUrl
- );
-
- aError.SQLState = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000"));
- aError.ErrorCode = 0;
- aError.Context = static_cast< XConnection* >(this);
- if (_rsMessage.getLength())
- aError.NextException <<= SQLException(_rsMessage, aError.Context, ::rtl::OUString(), 0, Any());
-
- throw aError;
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
deleted file mode 100644
index 737e32d930..0000000000
--- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx
+++ /dev/null
@@ -1,1225 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "file/FDatabaseMetaData.hxx"
-#include "FDatabaseMetaDataResultSet.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/ucb/SearchRecursion.hpp>
-#include <com/sun/star/ucb/SearchCommandArgument.hpp>
-#include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp>
-#include <com/sun/star/ucb/XContentProvider.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <tools/urlobj.hxx>
-#include "file/FDriver.hxx"
-#include "file/FTable.hxx"
-#include <comphelper/extract.hxx>
-#include <ucbhelper/content.hxx>
-#include <ucbhelper/contentbroker.hxx>
-#include <tools/debug.hxx>
-#include <rtl/logfile.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;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::container;
-
-DBG_NAME( file_ODatabaseMetaData )
-ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon) : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo())
- ,m_pConnection(_pCon)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::ODatabaseMetaData" );
- DBG_CTOR( file_ODatabaseMetaData, NULL );
-}
-// -------------------------------------------------------------------------
-ODatabaseMetaData::~ODatabaseMetaData()
-{
- DBG_DTOR( file_ODatabaseMetaData, NULL );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_getTypeInfo_throw" );
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTypeInfo );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_getCatalogSeparator_throw" );
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*tableNamePattern*/,
- const ::rtl::OUString& /*columnNamePattern*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getColumns" );
- OSL_FAIL("Should be overloaded!");
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumns );
-}
-
-// -------------------------------------------------------------------------
-namespace
-{
- sal_Int16 isCaseSensitiveParentFolder( const String& _rFolderOrDoc, const String& _rDocName )
- {
- sal_Int16 nIsCS = 1;
- try
- {
- // first get the real content for the URL
- INetURLObject aContentURL( _rFolderOrDoc );
- ::ucbhelper::Content aContent1;
- {
- ::ucbhelper::Content aFolderOrDoc( _rFolderOrDoc, Reference< XCommandEnvironment >() );
- if ( aFolderOrDoc.isDocument() )
- aContent1 = aFolderOrDoc;
- else
- {
- aContentURL = INetURLObject( _rFolderOrDoc, INetURLObject::WAS_ENCODED );
- aContentURL.Append( _rDocName );
- aContent1 = ::ucbhelper::Content( aContentURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() );
- }
- }
-
- // get two extensions which differ by case only
- String sExtension1 = aContentURL.getExtension();
- String sExtension2( sExtension1 );
- sExtension2.ToLowerAscii();
- if ( sExtension2 == sExtension1 )
- // the extension was already in lower case
- sExtension2.ToUpperAscii();
-
- // the complete URL for the second extension
- INetURLObject aURL2( aContentURL );
- if ( sExtension2.Len() )
- aURL2.SetExtension( sExtension2 );
- if ( aURL2.GetMainURL(INetURLObject::NO_DECODE) == aContentURL.GetMainURL(INetURLObject::NO_DECODE) )
- return -1;
-
- // the second context
- sal_Bool bCanAccess = sal_False;
- ::ucbhelper::Content aContent2;
- try
- {
- aContent2 = ::ucbhelper::Content( aURL2.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() );
- bCanAccess = aContent2.isDocument();
- }
- catch( const Exception& )
- {
- }
-
- if ( bCanAccess )
- {
- // here we have two contents whose URLs differ by case only.
- // Now let's check if both really refer to the same object ....
- Reference< XContent > xContent1 = aContent1.get();
- Reference< XContent > xContent2 = aContent2.get();
- OSL_ENSURE( xContent1.is() && xContent2.is(), "isCaseSensitiveParentFolder: invalid content interfaces!" );
- if ( xContent1.is() && xContent2.is() )
- {
- Reference< XContentIdentifier > xID1 = xContent1->getIdentifier();
- Reference< XContentIdentifier > xID2 = xContent2->getIdentifier();
- OSL_ENSURE( xID1.is() && xID2.is(), "isCaseSensitiveParentFolder: invalid ID interfaces!" );
- if ( xID1.is() && xID2.is() )
- {
- // get a generic content provider
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
- Reference< XContentProvider > xProvider;
- if ( pBroker )
- xProvider = pBroker->getContentProviderInterface();
- OSL_ENSURE( xProvider.is(), "isCaseSensitiveParentFolder: invalid content broker!" );
- if ( xProvider.is() )
- {
- if ( 0 == xProvider->compareContentIds( xID1, xID2 ) )
- // finally, we know that the folder is not case-sensitive ....
- nIsCS = 0;
- }
- }
- }
- }
- }
- catch( const Exception& )
- {
- OSL_FAIL( "isCaseSensitiveParentFolder: caught an unexpected exception!" );
- }
-
- return nIsCS;
- }
-}
-
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/,
- const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getTables" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTables );
- Reference< XResultSet > xRef = pResult;
-
- // check if any type is given
- // when no types are given then we have to return all tables e.g. TABLE
-
- static const ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
-
- sal_Bool bTableFound = sal_True;
- sal_Int32 nLength = types.getLength();
- if(nLength)
- {
- bTableFound = sal_False;
-
- const ::rtl::OUString* pBegin = types.getConstArray();
- const ::rtl::OUString* pEnd = pBegin + nLength;
- for(;pBegin != pEnd;++pBegin)
- {
- if(*pBegin == aTable)
- {
- bTableFound = sal_True;
- break;
- }
- }
- }
- if(!bTableFound)
- return xRef;
-
- Reference<XDynamicResultSet> xContent = m_pConnection->getDir();
- Reference < XSortedDynamicResultSetFactory > xSRSFac(
- m_pConnection->getDriver()->getFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SortedDynamicResultSetFactory")) ), UNO_QUERY );
-
- Sequence< NumberedSortingInfo > aSortInfo( 1 );
- NumberedSortingInfo* pInfo = aSortInfo.getArray();
- pInfo[ 0 ].ColumnIndex = 1;
- pInfo[ 0 ].Ascending = sal_True;
-
- Reference < XAnyCompareFactory > xFactory;
- Reference< XDynamicResultSet > xDynamicResultSet;
- xDynamicResultSet = xSRSFac->createSortedDynamicResultSet( xContent, aSortInfo, xFactory );
- Reference<XResultSet> xResultSet = xDynamicResultSet->getStaticResultSet();
-
- Reference<XRow> xRow(xResultSet,UNO_QUERY);
-
- String aFilenameExtension = m_pConnection->getExtension();
- String sThisContentExtension;
- ODatabaseMetaDataResultSet::ORows aRows;
- // scan the directory for tables
- ::rtl::OUString aName;
- INetURLObject aURL;
- xResultSet->beforeFirst();
-
- sal_Bool bKnowCaseSensivity = sal_False;
- sal_Bool bCaseSensitiveDir = sal_True;
- sal_Bool bCheckEnabled = m_pConnection->isCheckEnabled();
-
- while(xResultSet->next())
- {
- aName = xRow->getString(1);
- aURL.SetSmartProtocol(INET_PROT_FILE);
- String sUrl = m_pConnection->getURL() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + aName;
- aURL.SetSmartURL( sUrl );
- sThisContentExtension = aURL.getExtension();
-
- ODatabaseMetaDataResultSet::ORow aRow(3);
- aRow.reserve(6);
- sal_Bool bNewRow = sal_False;
-
- if ( !bKnowCaseSensivity )
- {
- bKnowCaseSensivity = sal_True;
- sal_Int16 nCase = isCaseSensitiveParentFolder( m_pConnection->getURL(), aURL.getName() );
- switch( nCase )
- {
- case 1:
- bCaseSensitiveDir = sal_True;
- break;
- case -1:
- bKnowCaseSensivity = sal_False;
- /** run through */
- case 0:
- bCaseSensitiveDir = sal_False;
- }
- if ( bKnowCaseSensivity )
- {
- m_pConnection->setCaseSensitiveExtension( bCaseSensitiveDir, OConnection::GrantAccess() );
- if ( !bCaseSensitiveDir )
- aFilenameExtension.ToLowerAscii();
- }
- }
-
- if (aFilenameExtension.Len())
- {
- if ( !bCaseSensitiveDir )
- sThisContentExtension.ToLowerAscii();
-
- if ( sThisContentExtension == aFilenameExtension )
- {
- aName = aName.replaceAt(aName.getLength()-(aFilenameExtension.Len()+1),aFilenameExtension.Len()+1,::rtl::OUString());
- sal_Unicode nChar = aName.toChar();
- if ( match(tableNamePattern,aName,'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) )
- {
- aRow.push_back(new ORowSetValueDecorator(aName));
- bNewRow = sal_True;
- }
- }
- }
- else // no extension, filter myself
- {
- sal_Bool bErg = sal_False;
- do
- {
- if (!aURL.getExtension().getLength())
- {
- sal_Unicode nChar = aURL.getBase().getStr()[0];
- if(match(tableNamePattern,aURL.getBase(),'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) )
- {
- aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(aURL.getBase())));
- bNewRow = sal_True;
- }
- break;
- }
- else if ( ( bErg = xResultSet->next() ) != sal_False )
- {
- aName = xRow->getString(1);
- aURL.SetSmartURL(aName);
- }
- } while (bErg);
- }
- if(bNewRow)
- {
- aRow.push_back(new ORowSetValueDecorator(aTable));
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
-
- aRows.push_back(aRow);
- }
- }
-
- pResult->setRows(aRows);
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxBinaryLiteralLength" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxRowSize" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxCatalogNameLength" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxCharLiteralLength" );
- return STRING_MAXLEN;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxColumnNameLength" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxColumnsInIndex" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxCursorNameLength" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxConnections" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxColumnsInTable" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_getMaxStatements_throw" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxTableNameLength" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_getMaxTablesInSelect_throw" );
- return 1;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getTablePrivileges" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
- Reference< XResultSet > xRef = pResult;
- ODatabaseMetaDataResultSet::ORows aRows;
-
-
- Reference< XTablesSupplier > xTabSup = m_pConnection->createCatalog();
- if( xTabSup.is())
- {
- Reference< XNameAccess> xNames = xTabSup->getTables();
- Sequence< ::rtl::OUString > aNames = xNames->getElementNames();
- const ::rtl::OUString* pBegin = aNames.getConstArray();
- const ::rtl::OUString* pEnd = pBegin + aNames.getLength();
- for(;pBegin != pEnd;++pBegin)
- {
- if(match(tableNamePattern,*pBegin,'\0'))
- {
- static ODatabaseMetaDataResultSet::ORow aRow(8);
-
- aRow[2] = new ORowSetValueDecorator(*pBegin);
- aRow[6] = ODatabaseMetaDataResultSet::getSelectValue();
- aRow[7] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO")));
- aRows.push_back(aRow);
-
- Reference< XPropertySet> xTable;
- ::cppu::extractInterface(xTable,xNames->getByName(*pBegin));
- if(xTable.is())
- {
- Reference<XUnoTunnel> xTunnel(xTable,UNO_QUERY);
- if(xTunnel.is())
- {
- OFileTable* pTable = reinterpret_cast< OFileTable* >( xTunnel->getSomething(OFileTable::getUnoTunnelImplementationId()) );
- if(pTable)
- {
- if(!pTable->isReadOnly())
- {
- aRow[6] = ODatabaseMetaDataResultSet::getInsertValue();
- aRows.push_back(aRow);
- if(!m_pConnection->showDeleted())
- {
- aRow[6] = ODatabaseMetaDataResultSet::getDeleteValue();
- aRows.push_back(aRow);
- }
- aRow[6] = ODatabaseMetaDataResultSet::getUpdateValue();
- aRows.push_back(aRow);
- aRow[6] = ODatabaseMetaDataResultSet::getCreateValue();
- aRows.push_back(aRow);
- aRow[6] = ODatabaseMetaDataResultSet::getReadValue();
- aRows.push_back(aRow);
- aRow[6] = ODatabaseMetaDataResultSet::getAlterValue();
- aRows.push_back(aRow);
- aRow[6] = ODatabaseMetaDataResultSet::getDropValue();
- aRows.push_back(aRow);
- }
- }
- }
- }
- }
- }
- }
-
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::doesMaxRowSizeIncludeBlobs" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::storesLowerCaseQuotedIdentifiers" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::storesLowerCaseIdentifiers" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::storesMixedCaseIdentifiers" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::storesUpperCaseQuotedIdentifiers" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::storesUpperCaseIdentifiers" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxIndexLength" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsNonNullableColumns" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getCatalogTerm" );
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_getIdentifierQuoteString_throw" );
- static const ::rtl::OUString sQuote(RTL_CONSTASCII_USTRINGPARAM("\""));
- return sQuote;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getExtraNameCharacters" );
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsDifferentTableCorrelationNames" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_isCatalogAtStart_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_isCatalogAtStart_throw" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::dataDefinitionIgnoredInTransactions" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::dataDefinitionCausesTransactionCommit" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsDataManipulationTransactionsOnly" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsPositionedDelete" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsPositionedUpdate" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsOpenStatementsAcrossRollback" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsOpenStatementsAcrossCommit" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsOpenCursorsAcrossCommit" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsOpenCursorsAcrossRollback" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsTransactionIsolationLevel" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsANSI92FullSQL" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsANSI92EntryLevelSQL" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsIntegrityEnhancementFacility" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSchemasInIndexDefinitions" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsCatalogsInIndexDefinitions" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsOuterJoins" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getTableTypes" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTableTypes );
- Reference< XResultSet > xRef = pResult;
- static ODatabaseMetaDataResultSet::ORows aRows;
- if(aRows.empty())
- {
- ODatabaseMetaDataResultSet::ORow aRow;
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE"))));
- aRows.push_back(aRow);
- }
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxStatementLength" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxProcedureNameLength" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxSchemaNameLength" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsTransactions" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::allProceduresAreCallable" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsStoredProcedures" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSelectForUpdate" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::allTablesAreSelectable" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::isReadOnly" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::usesLocalFiles" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::usesLocalFilePerTable" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsTypeConversion" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::nullPlusNonNullIsNull" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsColumnAliasing" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsTableCorrelationNames" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsConvert" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsExpressionsInOrderBy" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsGroupBy" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsGroupByBeyondSelect" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsGroupByUnrelated" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsMultipleTransactions" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsMultipleResultSets" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsLikeEscapeClause" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsOrderByUnrelated" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsUnion" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsUnionAll" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsMixedCaseIdentifiers" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::nullsAreSortedAtEnd" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::nullsAreSortedAtStart" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::nullsAreSortedHigh" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::nullsAreSortedLow" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSchemasInProcedureCalls" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsCatalogsInProcedureCalls" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsCorrelatedSubqueries" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSubqueriesInComparisons" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSubqueriesInExists" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSubqueriesInIns" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsSubqueriesInQuantifieds" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsANSI92IntermediateSQL" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getURL" );
- static const ::rtl::OUString aValue( RTL_CONSTASCII_USTRINGPARAM( "sdbc:file:" ));
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getUserName" );
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getDriverName" );
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getDriverVersion" );
- return ::rtl::OUString::valueOf((sal_Int32)1);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getDatabaseProductVersion" );
- return ::rtl::OUString::valueOf((sal_Int32)0);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getDatabaseProductName" );
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getProcedureTerm" );
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getSchemaTerm" );
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getDriverMajorVersion" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getDefaultTransactionIsolation" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getDriverMinorVersion" );
- return 0;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getSQLKeywords" );
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getSearchStringEscape" );
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getStringFunctions" );
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UCASE,LCASE,ASCII,LENGTH,OCTET_LENGTH,CHAR_LENGTH,CHARACTER_LENGTH,CHAR,CONCAT,LOCATE,SUBSTRING,LTRIM,RTRIM,SPACE,REPLACE,REPEAT,INSERT,LEFT,RIGHT"));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getTimeDateFunctions" );
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DAYOFWEEK,DAYOFMONTH,DAYOFYEAR,MONTH,DAYNAME,MONTHNAME,QUARTER,WEEK,YEAR,HOUR,MINUTE,SECOND,CURDATE,CURTIME,NOW"));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getSystemFunctions" );
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getNumericFunctions" );
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ABS,SIGN,MOD,FLOOR,CEILING,ROUND,EXP,LN,LOG,LOG10,POWER,SQRT,PI,COS,SIN,TAN,ACOS,ASIN,ATAN,ATAN2,DEGREES,RADIANS"));
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsExtendedSQLGrammar" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsCoreSQLGrammar" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsMinimumSQLGrammar" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsFullOuterJoins" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsLimitedOuterJoins" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxColumnsInGroupBy" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxColumnsInOrderBy" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxColumnsInSelect" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getMaxUserNameLength" );
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsResultSetType" );
- switch(setType)
- {
- case ResultSetType::FORWARD_ONLY:
- return sal_True;
- case ResultSetType::SCROLL_INSENSITIVE:
- case ResultSetType::SCROLL_SENSITIVE:
- break;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 /*concurrency*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsResultSetConcurrency" );
- switch(setType)
- {
- case ResultSetType::FORWARD_ONLY:
- return sal_True;
- case ResultSetType::SCROLL_INSENSITIVE:
- case ResultSetType::SCROLL_SENSITIVE:
- break;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::ownUpdatesAreVisible" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::ownDeletesAreVisible" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::ownInsertsAreVisible" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::othersUpdatesAreVisible" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::othersDeletesAreVisible" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::othersInsertsAreVisible" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::updatesAreDetected" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::deletesAreDetected" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::insertsAreDetected" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::supportsBatchUpdates" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getUDTs" );
- return NULL;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/FDateFunctions.cxx b/connectivity/source/drivers/file/FDateFunctions.cxx
deleted file mode 100644
index ac2b26d41c..0000000000
--- a/connectivity/source/drivers/file/FDateFunctions.cxx
+++ /dev/null
@@ -1,292 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "file/FDateFunctions.hxx"
-#include <tools/date.hxx>
-#include <tools/time.hxx>
-#include <tools/datetime.hxx>
-
-using namespace connectivity;
-using namespace connectivity::file;
-//------------------------------------------------------------------
-ORowSetValue OOp_DayOfWeek::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- sal_Int32 nRet = 0;
- ::com::sun::star::util::Date aD = lhs;
- Date aDate(aD.Day,aD.Month,aD.Year);
- DayOfWeek eDayOfWeek = aDate.GetDayOfWeek();
- switch(eDayOfWeek)
- {
- case MONDAY:
- nRet = 2;
- break;
- case TUESDAY:
- nRet = 3;
- break;
- case WEDNESDAY:
- nRet = 4;
- break;
- case THURSDAY:
- nRet = 5;
- break;
- case FRIDAY:
- nRet = 6;
- break;
- case SATURDAY:
- nRet = 7;
- break;
- case SUNDAY:
- nRet = 1;
- break;
- default:
- OSL_FAIL("Error in enum values for date");
- }
- return nRet;
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_DayOfMonth::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- ::com::sun::star::util::Date aD = lhs;
- return static_cast<sal_Int16>(aD.Day);
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_DayOfYear::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- ::com::sun::star::util::Date aD = lhs;
- Date aDate(aD.Day,aD.Month,aD.Year);
- return static_cast<sal_Int16>(aDate.GetDayOfYear());
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Month::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- ::com::sun::star::util::Date aD = lhs;
- return static_cast<sal_Int16>(aD.Month);
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_DayName::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- ::rtl::OUString sRet;
- ::com::sun::star::util::Date aD = lhs;
- Date aDate(aD.Day,aD.Month,aD.Year);
- DayOfWeek eDayOfWeek = aDate.GetDayOfWeek();
- switch(eDayOfWeek)
- {
- case MONDAY:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Monday"));
- break;
- case TUESDAY:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Tuesday"));
- break;
- case WEDNESDAY:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Wednesday"));
- break;
- case THURSDAY:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Thursday"));
- break;
- case FRIDAY:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Friday"));
- break;
- case SATURDAY:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Saturday"));
- break;
- case SUNDAY:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Sunday"));
- break;
- default:
- OSL_FAIL("Error in enum values for date");
- }
- return sRet;
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_MonthName::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- ::rtl::OUString sRet;
- ::com::sun::star::util::Date aD = lhs;
- switch(aD.Month)
- {
- case 1:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("January"));
- break;
- case 2:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("February"));
- break;
- case 3:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("March"));
- break;
- case 4:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("April"));
- break;
- case 5:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("May"));
- break;
- case 6:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("June"));
- break;
- case 7:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("July"));
- break;
- case 8:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("August"));
- break;
- case 9:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("September"));
- break;
- case 10:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("October"));
- break;
- case 11:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("November"));
- break;
- case 12:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("December"));
- break;
- }
- return sRet;
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Quarter::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- sal_Int32 nRet = 1;
- ::com::sun::star::util::Date aD = lhs;
- Date aDate(aD.Day,aD.Month,aD.Year);
- if ( aD.Month >= 4 && aD.Month < 7 )
- nRet = 2;
- else if ( aD.Month >= 7 && aD.Month < 10 )
- nRet = 3;
- else if ( aD.Month >= 10 && aD.Month <= 12 )
- nRet = 4;
- return nRet;
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Week::operate(const ::std::vector<ORowSetValue>& lhs) const
-{
- if ( lhs.empty() || lhs.size() > 2 )
- return ORowSetValue();
-
- size_t nSize = lhs.size();
-
- ::com::sun::star::util::Date aD = lhs[nSize-1];
- Date aDate(aD.Day,aD.Month,aD.Year);
-
- sal_Int16 nStartDay = SUNDAY;
- if ( nSize == 2 && !lhs[0].isNull() )
- nStartDay = lhs[0];
-
- return static_cast<sal_Int16>(aDate.GetWeekOfYear(static_cast<DayOfWeek>(nStartDay)));
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_Year::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- ::com::sun::star::util::Date aD = lhs;
- return static_cast<sal_Int16>(aD.Year);
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Hour::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- ::com::sun::star::util::Time aT = lhs;
- return static_cast<sal_Int16>(aT.Hours);
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Minute::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- ::com::sun::star::util::Time aT = lhs;
- return static_cast<sal_Int16>(aT.Minutes);
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Second::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- ::com::sun::star::util::Time aT = lhs;
- return static_cast<sal_Int16>(aT.Seconds);
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_CurDate::operate(const ::std::vector<ORowSetValue>& lhs) const
-{
- if ( !lhs.empty() )
- return ORowSetValue();
-
- Date aCurDate;
- return ::com::sun::star::util::Date(aCurDate.GetDay(),aCurDate.GetMonth(),aCurDate.GetYear());
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_CurTime::operate(const ::std::vector<ORowSetValue>& lhs) const
-{
- if ( !lhs.empty() )
- return ORowSetValue();
-
- Time aCurTime;
- return ::com::sun::star::util::Time(aCurTime.Get100Sec(),aCurTime.GetSec(),aCurTime.GetMin(),aCurTime.GetHour());
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Now::operate(const ::std::vector<ORowSetValue>& lhs) const
-{
- if ( !lhs.empty() )
- return ORowSetValue();
-
- DateTime aCurTime;
- return ::com::sun::star::util::DateTime(aCurTime.Get100Sec(),aCurTime.GetSec(),aCurTime.GetMin(),aCurTime.GetHour(),
- aCurTime.GetDay(),aCurTime.GetMonth(),aCurTime.GetYear());
-}
-//------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx
deleted file mode 100644
index 363c29cef5..0000000000
--- a/connectivity/source/drivers/file/FDriver.cxx
+++ /dev/null
@@ -1,287 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "file/FDriver.hxx"
-#include "file/FConnection.hxx"
-#include "file/fcode.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <comphelper/types.hxx>
-#include "connectivity/dbexception.hxx"
-#include "resource/common_res.hrc"
-#include "resource/sharedresources.hxx"
-#include <rtl/logfile.hxx>
-
-
-using namespace connectivity::file;
-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;
-// --------------------------------------------------------------------------------
-OFileDriver::OFileDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory)
- : ODriver_BASE(m_aMutex)
- ,m_xFactory(_rxFactory)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::OFileDriver" );
-}
-// --------------------------------------------------------------------------------
-void OFileDriver::disposing()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::disposing" );
- ::osl::MutexGuard aGuard(m_aMutex);
-
-
- for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
- {
- Reference< XComponent > xComp(i->get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- }
- m_xConnections.clear();
-
- ODriver_BASE::disposing();
-}
-
-// static ServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString OFileDriver::getImplementationName_Static( ) throw(RuntimeException)
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.driver.file.Driver"));
-}
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > OFileDriver::getSupportedServiceNames_Static( ) throw (RuntimeException)
-{
- Sequence< ::rtl::OUString > aSNS( 2 );
- aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver"));
- aSNS[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.Driver"));
- return aSNS;
-}
-
-//------------------------------------------------------------------
-::rtl::OUString SAL_CALL OFileDriver::getImplementationName( ) throw(RuntimeException)
-{
- return getImplementationName_Static();
-}
-
-//------------------------------------------------------------------
-sal_Bool SAL_CALL OFileDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-
-//------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL OFileDriver::getSupportedServiceNames( ) throw(RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-
-// --------------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL OFileDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::connect" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODriver_BASE::rBHelper.bDisposed);
-
- OConnection* pCon = new OConnection(this);
- Reference< XConnection > xCon = pCon;
- pCon->construct(url,info);
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
-
- return xCon;
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OFileDriver::acceptsURL( const ::rtl::OUString& url )
- throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::acceptsURL" );
- return (!url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:file:")),10));
-}
-// --------------------------------------------------------------------------------
-Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::getPropertyInfo" );
- if ( acceptsURL(url) )
- {
- ::std::vector< DriverPropertyInfo > aDriverInfo;
-
- Sequence< ::rtl::OUString > aBoolean(2);
- aBoolean[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"));
- aBoolean[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1"));
-
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet of the database."))
- ,sal_False
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Extension"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Extension of the file format."))
- ,sal_False
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".*"))
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowDeleted"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Display inactive records."))
- ,sal_False
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"))
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EnableSQL92Check"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Use SQL92 naming constraints."))
- ,sal_False
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"))
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseRelativePath"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Handle the connection url as relative path."))
- ,sal_False
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"))
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The URL of the database document which is used to create an absolute path."))
- ,sal_False
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- return Sequence< DriverPropertyInfo >(&(aDriverInfo[0]),aDriverInfo.size());
- } // if ( acceptsURL(url) )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- } // if ( ! acceptsURL(url) )
- return Sequence< DriverPropertyInfo >();
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL OFileDriver::getMajorVersion( ) throw(RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::getMajorVersion" );
- return 1;
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL OFileDriver::getMinorVersion( ) throw(RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::getMinorVersion" );
- return 0;
-}
-// --------------------------------------------------------------------------------
-// --------------------------------------------------------------------------------
-// XDataDefinitionSupplier
-Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByConnection( const Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::getDataDefinitionByConnection" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODriver_BASE::rBHelper.bDisposed);
-
- Reference< XTablesSupplier > xTab = NULL;
- Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(connection,UNO_QUERY);
- if(xTunnel.is())
- {
- OConnection* pSearchConnection = reinterpret_cast< OConnection* >( xTunnel->getSomething(OConnection::getUnoTunnelImplementationId()) );
- OConnection* pConnection = NULL;
- for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
- {
- if ((OConnection*) Reference< XConnection >::query(i->get().get()).get() == pSearchConnection)
- {
- pConnection = pSearchConnection;
- break;
- }
- }
-
- if(pConnection)
- xTab = pConnection->createCatalog();
- }
- return xTab;
-}
-
-// --------------------------------------------------------------------------------
-Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::getDataDefinitionByURL" );
- if ( ! acceptsURL(url) )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- }
- return getDataDefinitionByConnection(connect(url,info));
-}
-// -----------------------------------------------------------------------------
-void OOperandParam::describe(const Reference< XPropertySet>& rColumn, ::rtl::Reference<connectivity::OSQLColumns> rParameterColumns)
-{
- // den alten namen beibehalten
-
- OSL_ENSURE(getRowPos() < rParameterColumns->get().size(),"Invalid index for orderkey values!");
-
- Reference< XPropertySet> xColumn = (rParameterColumns->get())[getRowPos()];
-
- try
- {
- xColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME),rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)));
- xColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE),rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)));
- xColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION),rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)));
- xColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)));
- xColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE),rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)));
- xColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE),rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)));
- xColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT),rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)));
- }
- catch(const Exception&)
- {
- }
-
- m_eDBType = ::comphelper::getINT32(rColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)));
-}
-// -----------------------------------------------------------------------------
-OOperandAttr::OOperandAttr(sal_uInt16 _nPos,const Reference< XPropertySet>& _xColumn)
- : OOperandRow(_nPos,::comphelper::getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))))
- , m_xColumn(_xColumn)
-{
-}
-// -----------------------------------------------------------------------------
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/FNoException.cxx b/connectivity/source/drivers/file/FNoException.cxx
deleted file mode 100644
index 93e7cb4b2a..0000000000
--- a/connectivity/source/drivers/file/FNoException.cxx
+++ /dev/null
@@ -1,126 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "file/FCatalog.hxx"
-#include "file/fcomp.hxx"
-#include "file/fanalyzer.hxx"
-#include "file/FResultSet.hxx"
-#include "file/FPreparedStatement.hxx"
-#include <connectivity/FValue.hxx>
-#include <tools/debug.hxx>
-#include "TKeyValue.hxx"
-#include <rtl/logfile.hxx>
-
-using namespace connectivity;
-using namespace connectivity::file;
-// -----------------------------------------------------------------------------
-void OFileCatalog::refreshViews()
-{}
-void OFileCatalog::refreshGroups()
-{}
-void OFileCatalog::refreshUsers()
-{
-}
-// -----------------------------------------------------------------------------
-OPredicateInterpreter::~OPredicateInterpreter()
-{
- while(!m_aStack.empty())
- {
- delete m_aStack.top();
- m_aStack.pop();
- }
- // m_aStack.clear();
-}
-// -----------------------------------------------------------------------------
-void OPredicateCompiler::Clean()
-{
- for(OCodeList::reverse_iterator aIter = m_aCodeList.rbegin(); aIter != m_aCodeList.rend();++aIter)
- {
- delete *aIter;
- }
- m_aCodeList.clear();
-}
-// -----------------------------------------------------------------------------
-void OSQLAnalyzer::clean()
-{
- m_aCompiler->Clean();
-}
-// -----------------------------------------------------------------------------
-void OSQLAnalyzer::bindParameterRow(OValueRefRow& _pRow)
-{
- OCodeList& rCodeList = m_aCompiler->m_aCodeList;
- for(OCodeList::iterator aIter = rCodeList.begin(); aIter != rCodeList.end();++aIter)
- {
- OOperandParam* pParam = PTR_CAST(OOperandParam,(*aIter));
- if ( pParam )
- pParam->bindValue(_pRow);
- }
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::scanParameter" );
- DBG_ASSERT(pParseNode != NULL,"OResultSet: interner Fehler: ungueltiger ParseNode");
-
- // found parameter Name-Rule?
- if (SQL_ISRULE(pParseNode,parameter))
- {
- DBG_ASSERT(pParseNode->count() >= 1,"OResultSet: Parse Tree fehlerhaft");
- DBG_ASSERT(pParseNode->getChild(0)->getNodeType() == SQL_NODE_PUNCTUATION,"OResultSet: Parse Tree fehlerhaft");
-
- _rParaNodes.push_back(pParseNode);
- // Further descend not nessesary
- return;
- }
-
- // Further descend in Parse Tree
- for (sal_uInt32 i = 0; i < pParseNode->count(); i++)
- scanParameter(pParseNode->getChild(i),_rParaNodes);
-}
-// -----------------------------------------------------------------------------
-OKeyValue* OResultSet::GetOrderbyKeyValue(OValueRefRow& _rRow)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::GetOrderbyKeyValue" );
- sal_uInt32 nBookmarkValue = Abs((sal_Int32)(_rRow->get())[0]->getValue());
-
- OKeyValue* pKeyValue = OKeyValue::createKeyValue((sal_uInt32)nBookmarkValue);
-
- ::std::vector<sal_Int32>::iterator aIter = m_aOrderbyColumnNumber.begin();
- for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter)
- {
- OSL_ENSURE(*aIter < static_cast<sal_Int32>(_rRow->get().size()),"Invalid index for orderkey values!");
- pKeyValue->pushKey(new ORowSetValueDecorator((_rRow->get())[*aIter]->getValue()));
- }
-
- return pKeyValue;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/FNumericFunctions.cxx b/connectivity/source/drivers/file/FNumericFunctions.cxx
deleted file mode 100644
index 7800eb6b68..0000000000
--- a/connectivity/source/drivers/file/FNumericFunctions.cxx
+++ /dev/null
@@ -1,252 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <cmath>
-#include "file/FNumericFunctions.hxx"
-#include <rtl/math.hxx>
-
-using namespace connectivity;
-using namespace connectivity::file;
-//------------------------------------------------------------------
-ORowSetValue OOp_Abs::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- double nVal(lhs);
- if ( nVal < 0 )
- nVal *= -1.0;
- return fabs(nVal);
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Sign::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- sal_Int32 nRet = 0;
- double nVal(lhs);
- if ( nVal < 0 )
- nRet = -1;
- else if ( nVal > 0 )
- nRet = 1;
-
- return nRet;
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Mod::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const
-{
- if ( lhs.isNull() || rhs.isNull() )
- return ORowSetValue();
-
- return fmod((double)lhs,(double)rhs);
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Floor::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- return floor((double)lhs);
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_Ceiling::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- double nVal(lhs);
- return ceil(nVal);
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_Round::operate(const ::std::vector<ORowSetValue>& lhs) const
-{
- if ( lhs.empty() || lhs.size() > 2 )
- return ORowSetValue();
-
- size_t nSize = lhs.size();
- double nVal = lhs[nSize-1];
-
- sal_Int32 nDec = 0;
- if ( nSize == 2 && !lhs[0].isNull() )
- nDec = lhs[0];
- return ::rtl::math::round(nVal,nDec);
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_Exp::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- double nVal(lhs);
- return exp(nVal);
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_Ln::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() || static_cast<double>(lhs) < 0.0 )
- return lhs;
-
- double nVal(lhs);
- nVal = log(nVal);
- if ( rtl::math::isNan(nVal) )
- return ORowSetValue();
- return nVal;
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_Log::operate(const ::std::vector<ORowSetValue>& lhs) const
-{
- if ( lhs.empty() || lhs.size() > 2 )
- return ORowSetValue();
- size_t nSize = lhs.size();
- double nVal = log( (double)lhs[nSize-1] );
-
-
- if ( nSize == 2 && !lhs[0].isNull() )
- nVal /= log((double)lhs[0]);
-
- if ( rtl::math::isNan(nVal) )
- return ORowSetValue();
- return nVal;
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_Log10::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() || static_cast<double>(lhs) < 0.0 )
- return lhs;
-
- double nVal = log((double)lhs);
- if ( rtl::math::isNan(nVal) )
- return ORowSetValue();
- nVal /= log(10.0);
- return nVal;
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_Pow::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const
-{
- if ( lhs.isNull() || rhs.isNull() )
- return lhs;
-
- return pow((double)lhs,(double)rhs);
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Sqrt::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- double nVal = sqrt((double)lhs);
- if ( rtl::math::isNan(nVal) )
- return ORowSetValue();
- return nVal;
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_Pi::operate(const ::std::vector<ORowSetValue>& /*lhs*/) const
-{
- return 3.141592653589793116;
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_Cos::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- return cos((double)lhs);
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_Sin::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- return sin((double)lhs);
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_Tan::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- return tan((double)lhs);
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_ACos::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- return acos((double)lhs);
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_ASin::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- return asin((double)lhs);
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_ATan::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- return atan((double)lhs);
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_ATan2::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const
-{
- if ( lhs.isNull() || rhs.isNull() )
- return lhs;
-
- return atan2((double)lhs,(double)rhs);
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_Degrees::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- double nLhs = lhs;
- return nLhs*180*(1.0/3.141592653589793116);
-}
-// -----------------------------------------------------------------------------
-ORowSetValue OOp_Radians::operate(const ORowSetValue& lhs) const
-{
- if ( lhs.isNull() )
- return lhs;
-
- double nLhs = lhs;
- return nLhs*3.141592653589793116*(1.0/180.0);
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx
deleted file mode 100644
index 9b797fb483..0000000000
--- a/connectivity/source/drivers/file/FPreparedStatement.cxx
+++ /dev/null
@@ -1,635 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <stdio.h>
-#include "connectivity/sdbcx/VColumn.hxx"
-#include <osl/diagnose.h>
-#include "file/FPreparedStatement.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include "file/FResultSetMetaData.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "connectivity/dbconversion.hxx"
-#include "connectivity/dbexception.hxx"
-#include "connectivity/dbtools.hxx"
-#include "connectivity/PColumn.hxx"
-#include "diagnose_ex.h"
-#include <comphelper/types.hxx>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <tools/debug.hxx>
-#include "resource/file_res.hrc"
-#include <rtl/logfile.hxx>
-
-using namespace connectivity;
-using namespace comphelper;
-using namespace ::dbtools;
-using namespace connectivity::file;
-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::util;
-
-IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbc.driver.file.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
-
-DBG_NAME( file_OPreparedStatement )
-// -------------------------------------------------------------------------
-OPreparedStatement::OPreparedStatement( OConnection* _pConnection)
- : OStatement_BASE2( _pConnection )
- ,m_pResultSet(NULL)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::OPreparedStatement" );
- DBG_CTOR( file_OPreparedStatement, NULL );
-}
-
-// -------------------------------------------------------------------------
-OPreparedStatement::~OPreparedStatement()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::~OPreparedStatement" );
- DBG_DTOR( file_OPreparedStatement, NULL );
-}
-
-// -------------------------------------------------------------------------
-void OPreparedStatement::disposing()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::disposing" );
- ::osl::MutexGuard aGuard(m_aMutex);
-
- clearMyResultSet();
- OStatement_BASE2::disposing();
-
- if(m_pResultSet)
- {
- m_pResultSet->release();
- m_pResultSet = NULL;
- }
-
- m_xParamColumns = NULL;
- m_xMetaData.clear();
- if(m_aParameterRow.is())
- {
- m_aParameterRow->get().clear();
- m_aParameterRow = NULL;
- }
-
-
-}
-// -------------------------------------------------------------------------
-void OPreparedStatement::construct(const ::rtl::OUString& sql) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::construct" );
- OStatement_Base::construct(sql);
-
- m_aParameterRow = new OValueRefVector();
- m_aParameterRow->get().push_back(new ORowSetValueDecorator(sal_Int32(0)) );
-
- Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
-
- if ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT )
- m_xParamColumns = m_aSQLIterator.getParameters();
- else
- {
- m_xParamColumns = new OSQLColumns();
- // describe all parameters need for the resultset
- describeParameter();
- }
-
- OValueRefRow aTemp;
- OResultSet::setBoundedColumns(m_aEvaluateRow,aTemp,m_xParamColumns,xNames,sal_False,m_xDBMetaData,m_aColMapping);
-
- m_pResultSet = createResultSet();
- m_pResultSet->acquire();
- m_xResultSet = Reference<XResultSet>(m_pResultSet);
- initializeResultSet(m_pResultSet);
-}
-// -------------------------------------------------------------------------
-
-Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::queryInterface" );
- Any aRet = OStatement_BASE2::queryInterface(rType);
- return aRet.hasValue() ? aRet : ::cppu::queryInterface( rType,
- static_cast< XPreparedStatement*>(this),
- static_cast< XParameters*>(this),
- static_cast< XResultSetMetaDataSupplier*>(this));
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::getTypes" );
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedStatement > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< XParameters > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< XResultSetMetaDataSupplier > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_BASE2::getTypes());
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::getMetaData" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- if(!m_xMetaData.is())
- m_xMetaData = new OResultSetMetaData(m_aSQLIterator.getSelectColumns(),m_aSQLIterator.getTables().begin()->first,m_pTable);
- return m_xMetaData;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::close" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- clearMyResultSet();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::execute" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- initResultSet();
-
- return m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::executeUpdate" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- initResultSet();
-
- return m_pResultSet ? m_pResultSet->getRowCountResult() : sal_Int32(0);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setString" );
- setParameter(parameterIndex,x);
-}
-// -------------------------------------------------------------------------
-
-Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::getConnection" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- return (Reference< XConnection >)m_pConnection;
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::executeQuery" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- return initResultSet();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setBoolean" );
- setParameter(parameterIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setByte" );
- setParameter(parameterIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& aData ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setDate" );
- setParameter(parameterIndex,DBTypeConversion::toDouble(aData));
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& aVal ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setTime" );
- setParameter(parameterIndex,DBTypeConversion::toDouble(aVal));
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& aVal ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setTimestamp" );
- setParameter(parameterIndex,DBTypeConversion::toDouble(aVal));
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setDouble" );
- setParameter(parameterIndex,x);
-}
-
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setFloat" );
- setParameter(parameterIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setInt" );
- setParameter(parameterIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setLong( sal_Int32 /*parameterIndex*/, sal_Int64 /*aVal*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setLong" );
- throwFeatureNotImplementedException( "XParameters::setLong", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setNull" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkAndResizeParameters(parameterIndex);
-
- if ( m_aAssignValues.is() )
- (m_aAssignValues->get())[m_aParameterIndexes[parameterIndex]]->setNull();
- else
- (m_aParameterRow->get())[parameterIndex]->setNull();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setClob" );
- throwFeatureNotImplementedException( "XParameters::setClob", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setBlob" );
- throwFeatureNotImplementedException( "XParameters::setBlob", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setArray" );
- throwFeatureNotImplementedException( "XParameters::setArray", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setRef" );
- throwFeatureNotImplementedException( "XParameters::setRef", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setObjectWithInfo" );
- switch(sqlType)
- {
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- setString(parameterIndex,::comphelper::getString(x));
- break;
- default:
- ::dbtools::setObjectWithInfo(this,parameterIndex,x,sqlType,scale);
- break;
- }
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& /*typeName*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setObjectNull" );
- setNull(parameterIndex,sqlType);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setObject" );
- if(!::dbtools::implSetObject(this,parameterIndex,x))
- {
- const ::rtl::OUString sError( m_pConnection->getResources().getResourceStringWithSubstitution(
- STR_UNKNOWN_PARA_TYPE,
- "$position$", ::rtl::OUString::valueOf(parameterIndex)
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
- // setObject (parameterIndex, x, sqlType, 0);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setShort" );
- setParameter(parameterIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setBytes" );
- setParameter(parameterIndex,x);
-}
-// -------------------------------------------------------------------------
-
-
-void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setCharacterStream" );
- setBinaryStream(parameterIndex,x,length );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setBinaryStream" );
- if(!x.is())
- ::dbtools::throwFunctionSequenceException(*this);
-
- Sequence<sal_Int8> aSeq;
- x->readBytes(aSeq,length);
- setParameter(parameterIndex,aSeq);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::clearParameters" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- m_aParameterRow->get().clear();
- m_aParameterRow->get().push_back(new ORowSetValueDecorator(sal_Int32(0)) );
-}
-// -------------------------------------------------------------------------
-OResultSet* OPreparedStatement::createResultSet()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::createResultSet" );
- return new OResultSet(this,m_aSQLIterator);
-}
-// -----------------------------------------------------------------------------
-Reference<XResultSet> OPreparedStatement::initResultSet()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::initResultSet" );
- m_pResultSet->clear();
- Reference<XResultSet> xRs(m_pResultSet);
-
- // check if we got enough paramters
- if ( (m_aParameterRow.is() && ( m_aParameterRow->get().size() -1 ) < m_xParamColumns->get().size()) ||
- (m_xParamColumns.is() && !m_aParameterRow.is() && !m_aParameterRow->get().empty()) )
- m_pConnection->throwGenericSQLException(STR_INVALID_PARA_COUNT,*this);
-
- m_pResultSet->OpenImpl();
- m_pResultSet->setMetaData(getMetaData());
-
- return xRs;
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::acquire() throw()
-{
- OStatement_BASE2::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::release() throw()
-{
- OStatement_BASE2::release();
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::checkAndResizeParameters(sal_Int32 parameterIndex)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::checkAndResizeParameters" );
- ::connectivity::checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- if ( m_aAssignValues.is() && (parameterIndex < 1 || parameterIndex >= static_cast<sal_Int32>(m_aParameterIndexes.size())) )
- throwInvalidIndexException(*this);
- else if ( static_cast<sal_Int32>((m_aParameterRow->get()).size()) <= parameterIndex )
- {
- sal_Int32 i = m_aParameterRow->get().size();
- (m_aParameterRow->get()).resize(parameterIndex+1);
- for ( ;i <= parameterIndex+1; ++i )
- {
- if ( !(m_aParameterRow->get())[i].is() )
- (m_aParameterRow->get())[i] = new ORowSetValueDecorator;
- }
- }
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const ORowSetValue& x)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::setParameter" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkAndResizeParameters(parameterIndex);
-
- if(m_aAssignValues.is())
- *(m_aAssignValues->get())[m_aParameterIndexes[parameterIndex]] = x;
- else
- *((m_aParameterRow->get())[parameterIndex]) = x;
-}
-// -----------------------------------------------------------------------------
-sal_uInt32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Reference<XPropertySet>& _xCol)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::AddParameter" );
- OSL_UNUSED( pParameter );
- OSL_ENSURE(SQL_ISRULE(pParameter,parameter),"OResultSet::AddParameter: Argument ist kein Parameter");
- OSL_ENSURE(pParameter->count() > 0,"OResultSet: Fehler im Parse Tree");
-#if OSL_DEBUG_LEVEL > 0
- OSQLParseNode * pMark = pParameter->getChild(0);
- OSL_UNUSED( pMark );
-#endif
-
- ::rtl::OUString sParameterName;
- // set up Parameter-Column:
- sal_Int32 eType = DataType::VARCHAR;
- sal_uInt32 nPrecision = 255;
- sal_Int32 nScale = 0;
- sal_Int32 nNullable = ColumnValue::NULLABLE;
-
- if (_xCol.is())
- {
- // Use type, precision, scale ... from the given column,
- // because this Column will get a value assigned or
- // with this Column the value will be compared.
- _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= eType;
- _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nPrecision;
- _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nScale;
- _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nNullable;
- _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sParameterName;
- }
-
- Reference<XPropertySet> xParaColumn = new connectivity::parse::OParseColumn(sParameterName
- ,::rtl::OUString()
- ,::rtl::OUString()
- ,::rtl::OUString()
- ,nNullable
- ,nPrecision
- ,nScale
- ,eType
- ,sal_False
- ,sal_False
- ,m_aSQLIterator.isCaseSensitive());
- m_xParamColumns->get().push_back(xParaColumn);
- return m_xParamColumns->get().size();
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::describeColumn(OSQLParseNode* _pParameter,OSQLParseNode* _pNode,const OSQLTable& _xTable)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::describeColumn" );
- Reference<XPropertySet> xProp;
- if(SQL_ISRULE(_pNode,column_ref))
- {
- ::rtl::OUString sColumnName,sTableRange;
- m_aSQLIterator.getColumnRange(_pNode,sColumnName,sTableRange);
- if ( sColumnName.getLength() )
- {
- Reference<XNameAccess> xNameAccess = _xTable->getColumns();
- if(xNameAccess->hasByName(sColumnName))
- xNameAccess->getByName(sColumnName) >>= xProp;
- AddParameter(_pParameter,xProp);
- }
- }
- // else
- // AddParameter(_pParameter,xProp);
-}
-// -------------------------------------------------------------------------
-void OPreparedStatement::describeParameter()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::describeParameter" );
- ::std::vector< OSQLParseNode*> aParseNodes;
- scanParameter(m_pParseTree,aParseNodes);
- if ( !aParseNodes.empty() )
- {
- // m_xParamColumns = new OSQLColumns();
- const OSQLTables& xTabs = m_aSQLIterator.getTables();
- if( !xTabs.empty() )
- {
- OSQLTable xTable = xTabs.begin()->second;
- ::std::vector< OSQLParseNode*>::const_iterator aIter = aParseNodes.begin();
- for (;aIter != aParseNodes.end();++aIter )
- {
- describeColumn(*aIter,(*aIter)->getParent()->getChild(0),xTable);
- }
- }
- }
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::initializeResultSet(OResultSet* _pResult)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::initializeResultSet" );
- OStatement_Base::initializeResultSet(_pResult);
-
- m_pResultSet->setParameterColumns(m_xParamColumns);
- m_pResultSet->setParameterRow(m_aParameterRow);
-
- // Substitute parameter (AssignValues and criteria):
- if (!m_xParamColumns->get().empty())
- {
- // begin with AssignValues
- sal_uInt16 nParaCount=0; // gives the current number of previously set Parameters
-
- // search for parameters to be substituted:
- size_t nCount = m_aAssignValues.is() ? m_aAssignValues->get().size() : 1; // 1 is important for the Criteria
- for (size_t j = 1; j < nCount; j++)
- {
- sal_uInt32 nParameter = (*m_aAssignValues).getParameterIndex(j);
- if (nParameter == SQL_NO_PARAMETER)
- continue; // this AssignValue is no Parameter
-
- ++nParaCount; // now the Parameter is valid
- // Replace Parameter. If the Parameter isn't available, set value to NULL
- // (*m_aAssignValues)[j] = (*m_aParameterRow)[(UINT16)nParameter];
- }
-
- if (m_aParameterRow.is() && (m_xParamColumns->get().size()+1) != m_aParameterRow->get().size() )
- {
- sal_Int32 i = m_aParameterRow->get().size();
- sal_Int32 nParamColumns = m_xParamColumns->get().size()+1;
- m_aParameterRow->get().resize(nParamColumns);
- for ( ;i < nParamColumns; ++i )
- {
- if ( !(m_aParameterRow->get())[i].is() )
- (m_aParameterRow->get())[i] = new ORowSetValueDecorator;
- }
- //m_aParameterRow->resize(m_xParamColumns->size()+1);
- }
- if (m_aParameterRow.is() && nParaCount < m_aParameterRow->get().size() )
- {
-
- m_pSQLAnalyzer->bindParameterRow(m_aParameterRow);
- }
- }
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::parseParamterElem(const String& _sColumnName,OSQLParseNode* pRow_Value_Constructor_Elem)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::parseParamterElem" );
- Reference<XPropertySet> xCol;
- m_xColNames->getByName(_sColumnName) >>= xCol;
- sal_Int32 nParameter = -1;
- if(m_xParamColumns.is())
- {
- OSQLColumns::Vector::const_iterator aIter = find(m_xParamColumns->get().begin(),m_xParamColumns->get().end(),_sColumnName,::comphelper::UStringMixEqual(m_pTable->isCaseSensitive()));
- if(aIter != m_xParamColumns->get().end())
- nParameter = m_xParamColumns->get().size() - (m_xParamColumns->get().end() - aIter) + 1;// +1 because the rows start at 1
- }
- if(nParameter == -1)
- nParameter = AddParameter(pRow_Value_Constructor_Elem,xCol);
- // Save number of parameter in the variable:
- SetAssignValue(_sColumnName, String(), sal_True, nParameter);
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
deleted file mode 100644
index c6fda6944a..0000000000
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ /dev/null
@@ -1,1872 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#ifdef GCC
-#include <iostream>
-#endif
-#include "connectivity/sdbcx/VColumn.hxx"
-#include "file/FResultSet.hxx"
-#include "file/FResultSetMetaData.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <comphelper/property.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/container/XIndexAccess.hpp>
-#include <comphelper/sequence.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include "connectivity/dbconversion.hxx"
-#include "connectivity/dbtools.hxx"
-#include <cppuhelper/propshlp.hxx>
-#include <iterator>
-#include <tools/debug.hxx>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
-
-#include <algorithm>
-#include <comphelper/extract.hxx>
-#include "connectivity/dbexception.hxx"
-#include <comphelper/types.hxx>
-#include "resource/file_res.hrc"
-#include "resource/sharedresources.hxx"
-#include <rtl/logfile.hxx>
-
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::file;
-using namespace ::cppu;
-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;
-using namespace com::sun::star::sdbcx;
-using namespace com::sun::star::container;
-
-// Maximal number of Rows, that can be processed being sorted with ORDER BY:
-#define MAX_KEYSET_SIZE 0x40000 // 256K
-
-namespace
-{
- void lcl_throwError(sal_uInt16 _nErrorId,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xContext)
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(_nErrorId);
- ::dbtools::throwGenericSQLException(sMessage ,_xContext);
- }
-}
-//------------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.drivers.file.ResultSet","com.sun.star.sdbc.ResultSet");
-DBG_NAME( file_OResultSet )
-// -------------------------------------------------------------------------
-OResultSet::OResultSet(OStatement_Base* pStmt,OSQLParseTreeIterator& _aSQLIterator) : OResultSet_BASE(m_aMutex)
- ,::comphelper::OPropertyContainer(OResultSet_BASE::rBHelper)
- ,m_aAssignValues(NULL)
- ,m_pEvaluationKeySet(NULL)
- ,m_aSkipDeletedSet(this)
- ,m_pFileSet(NULL)
- ,m_pSortIndex(NULL)
- ,m_pTable(NULL)
- ,m_pParseTree(pStmt->getParseTree())
- ,m_pSQLAnalyzer(NULL)
- ,m_aSQLIterator(_aSQLIterator)
- ,m_nFetchSize(0)
- ,m_nResultSetType(ResultSetType::SCROLL_INSENSITIVE)
- ,m_nFetchDirection(FetchDirection::FORWARD)
- ,m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
- ,m_xStatement(*pStmt)
- ,m_xMetaData(NULL)
- ,m_xDBMetaData(pStmt->getOwnConnection()->getMetaData())
- ,m_nTextEncoding(pStmt->getOwnConnection()->getTextEncoding())
- ,m_nRowPos(-1)
- ,m_nFilePos(0)
- ,m_nLastVisitedPos(-1)
- ,m_nRowCountResult(-1)
- ,m_nCurrentPosition(0)
- ,m_nColumnCount(0)
- ,m_bWasNull(sal_False)
- ,m_bEOF(sal_False)
- ,m_bLastRecord(sal_False)
- ,m_bInserted(sal_False)
- ,m_bRowUpdated(sal_False)
- ,m_bRowInserted(sal_False)
- ,m_bRowDeleted(sal_False)
- ,m_bShowDeleted(pStmt->getOwnConnection()->showDeleted())
- ,m_bIsCount(sal_False)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::OResultSet" );
- DBG_CTOR( file_OResultSet, NULL );
- osl_incrementInterlockedCount( &m_refCount );
- m_bIsCount = (m_pParseTree &&
- m_pParseTree->count() > 2 &&
- SQL_ISRULE(m_pParseTree->getChild(2),scalar_exp_commalist) &&
- SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0),derived_column) &&
- SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0)->getChild(0),general_set_fct) &&
- m_pParseTree->getChild(2)->getChild(0)->getChild(0)->count() == 4
- );
-
- m_nResultSetConcurrency = isCount() ? ResultSetConcurrency::READ_ONLY : ResultSetConcurrency::UPDATABLE;
- construct();
- m_aSkipDeletedSet.SetDeletedVisible(m_bShowDeleted);
- osl_decrementInterlockedCount( &m_refCount );
-}
-
-// -------------------------------------------------------------------------
-OResultSet::~OResultSet()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::~OResultSet" );
- osl_incrementInterlockedCount( &m_refCount );
- disposing();
- DBG_DTOR( file_OResultSet, NULL );
-}
-// -------------------------------------------------------------------------
-void OResultSet::construct()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::construct" );
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE), PROPERTY_ID_FETCHSIZE, 0,&m_nFetchSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL)));
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE), PROPERTY_ID_RESULTSETTYPE, PropertyAttribute::READONLY,&m_nResultSetType, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL)));
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION), PROPERTY_ID_FETCHDIRECTION, 0,&m_nFetchDirection, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL)));
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY), PROPERTY_ID_RESULTSETCONCURRENCY,PropertyAttribute::READONLY,&m_nResultSetConcurrency, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL)));
-}
-// -------------------------------------------------------------------------
-void OResultSet::disposing(void)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::disposing" );
- OPropertySetHelper::disposing();
-
- ::osl::MutexGuard aGuard(m_aMutex);
- m_xStatement.clear();
- m_xMetaData.clear();
- m_pParseTree = NULL;
- m_xColNames.clear();
- m_xColumns = NULL;
- m_xParamColumns = NULL;
- m_xColsIdx.clear();
-
- Reference<XComponent> xComp = m_pTable;
- if ( xComp.is() )
- xComp->removeEventListener(this);
- if(m_pTable)
- {
- m_pTable->release();
- m_pTable = NULL;
- }
- clear();
-}
-// -----------------------------------------------------------------------------
-void OResultSet::clear()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::clear" );
- m_pFileSet = NULL;
- DELETEZ(m_pSortIndex);
-
- if(m_aInsertRow.is())
- m_aInsertRow->get().clear();
-
- m_aSkipDeletedSet.clear();
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::queryInterface" );
- Any aRet = OPropertySetHelper::queryInterface(rType);
- return aRet.hasValue() ? aRet : OResultSet_BASE::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OResultSet::getTypes( ) throw(RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getTypes" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
- OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 ),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::findColumn" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- Reference< XResultSetMetaData > xMeta = getMetaData();
- sal_Int32 nLen = xMeta->getColumnCount();
- sal_Int32 i = 1;
- for(;i<=nLen;++i)
- if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
- columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
- break;
- return i;
-}
-// -----------------------------------------------------------------------------
-const ORowSetValue& OResultSet::getValue(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getValue" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- checkIndex(columnIndex );
-
-
- m_bWasNull = (m_aSelectRow->get())[columnIndex]->getValue().isNull();
- return *(m_aSelectRow->get())[columnIndex];
-}
-// -----------------------------------------------------------------------------
-void OResultSet::checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::checkIndex" );
- if ( columnIndex <= 0
- || columnIndex >= m_nColumnCount )
- ::dbtools::throwInvalidIndexException(*this);
-}
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBinaryStream" );
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getCharacterStream" );
- return NULL;
-}
-
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBoolean" );
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getByte" );
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBytes" );
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-::com::sun::star::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getDate" );
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getDouble" );
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getFloat" );
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getInt" );
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getRow" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- OSL_ENSURE((m_bShowDeleted || !m_aRow->isDeleted()),"getRow called for deleted row");
-
- return m_aSkipDeletedSet.getMappedPosition((m_aRow->get())[0]->getValue());
-}
-// -------------------------------------------------------------------------
-
-sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getLong" );
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getMetaData" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- if(!m_xMetaData.is())
- m_xMetaData = new OResultSetMetaData(m_xColumns,m_aSQLIterator.getTables().begin()->first,m_pTable);
- return m_xMetaData;
-}
-// -------------------------------------------------------------------------
-Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getArray" );
- return NULL;
-}
-
-// -------------------------------------------------------------------------
-
-Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getClob" );
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBlob" );
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getRef" );
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getObject" );
- return getValue(columnIndex).makeAny();
-}
-// -------------------------------------------------------------------------
-
-sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getShort" );
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getString" );
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-::com::sun::star::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getTime" );
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-::com::sun::star::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getTimestamp" );
- return getValue(columnIndex);
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isAfterLast" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return m_nRowPos == sal_Int32(m_pFileSet->get().size());
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isFirst" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return m_nRowPos == 0;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isLast" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return m_nRowPos == sal_Int32(m_pFileSet->get().size() - 1);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::beforeFirst" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- if(first())
- previous();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::afterLast" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- if(last())
- next();
- m_bEOF = sal_True;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::close" );
- dispose();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::first" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::FIRST,1,sal_True) : sal_False;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::last" );
- // here I know definitely that I stand on the last record
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::LAST,1,sal_True) : sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::absolute" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::ABSOLUTE,row,sal_True) : sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::relative" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::RELATIVE,row,sal_True) : sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::previous" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::PRIOR,0,sal_True) : sal_False;
-}
-// -------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getStatement" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return m_xStatement;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::rowDeleted" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return m_bRowDeleted;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException)
-{ ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return m_bRowInserted;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::rowInserted" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return m_bRowUpdated;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isBeforeFirst" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return m_nRowPos == -1;
-}
-// -------------------------------------------------------------------------
-sal_Bool OResultSet::evaluate()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::evaluate" );
- OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::evaluate: Analyzer isn't set!");
- sal_Bool bRet = sal_True;
- while(!m_pSQLAnalyzer->evaluateRestriction())
- {
- if(m_pEvaluationKeySet)
- {
- if(m_aEvaluateIter == m_pEvaluationKeySet->end())
- return sal_False;
- bRet = m_pTable->seekRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),m_nRowPos);
- ++m_aEvaluateIter;
- }
- else
- bRet = m_pTable->seekRow(IResultSetHelper::NEXT,1,m_nRowPos);
- if(bRet)
- {
- if(m_pEvaluationKeySet)
- {
- bRet = m_pTable->fetchRow(m_aEvaluateRow,*(m_pTable->getTableColumns()),sal_True,sal_True);
- evaluate();
-
- }
- else
- bRet = m_pTable->fetchRow(m_aRow,*m_xColumns,sal_False,sal_True);
- }
- }
-
- return bRet;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::next" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::NEXT,1,sal_True) : sal_False;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::wasNull" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return m_bWasNull;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::cancel( ) throw(RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::cancel" );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::clearWarnings" );
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getWarnings" );
- return Any();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::insertRow" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- if(!m_bInserted || !m_pTable)
- throwFunctionSequenceException(*this);
-
- // we know that we append new rows at the end
- // so we have to know where the end is
- m_aSkipDeletedSet.skipDeleted(IResultSetHelper::LAST,1,sal_False);
- m_bRowInserted = m_pTable->InsertRow(*m_aInsertRow, sal_True, m_xColsIdx);
- if(m_bRowInserted && m_pFileSet.is())
- {
- sal_Int32 nPos = (m_aInsertRow->get())[0]->getValue();
- m_pFileSet->get().push_back(nPos);
- *(m_aInsertRow->get())[0] = sal_Int32(m_pFileSet->get().size());
- clearInsertRow();
-
- m_aSkipDeletedSet.insertNewPosition((m_aRow->get())[0]->getValue());
- }
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateRow" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- if(!m_pTable || m_pTable->isReadOnly())
- lcl_throwError(STR_TABLE_READONLY,*this);
-
- m_bRowUpdated = m_pTable->UpdateRow(*m_aInsertRow, m_aRow,m_xColsIdx);
- *(m_aInsertRow->get())[0] = (sal_Int32)(m_aRow->get())[0]->getValue();
-
- clearInsertRow();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::deleteRow() throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::deleteRow" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- if(!m_pTable || m_pTable->isReadOnly())
- lcl_throwError(STR_TABLE_READONLY,*this);
- if (m_bShowDeleted)
- lcl_throwError(STR_DELETE_ROW,*this);
- if(m_aRow->isDeleted())
- lcl_throwError(STR_ROW_ALREADY_DELETED,*this);
-
- sal_Int32 nPos = (sal_Int32)(m_aRow->get())[0]->getValue();
- m_bRowDeleted = m_pTable->DeleteRow(*m_xColumns);
- if(m_bRowDeleted && m_pFileSet.is())
- {
- m_aRow->setDeleted(sal_True);
- // don't touch the m_pFileSet member here
- m_aSkipDeletedSet.deletePosition(nPos);
- }
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::cancelRowUpdates" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_bInserted = sal_False;
- m_bRowUpdated = sal_False;
- m_bRowInserted = sal_False;
- m_bRowDeleted = sal_False;
-
- if(m_aInsertRow.is())
- {
- OValueRefVector::Vector::iterator aIter = m_aInsertRow->get().begin()+1;
- for(;aIter != m_aInsertRow->get().end();++aIter)
- {
- (*aIter)->setBound(sal_False);
- (*aIter)->setNull();
- }
- }
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::moveToInsertRow" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- if(!m_pTable || m_pTable->isReadOnly())
- lcl_throwError(STR_TABLE_READONLY,*this);
-
- m_bInserted = sal_True;
-
- OValueRefVector::Vector::iterator aIter = m_aInsertRow->get().begin()+1;
- for(;aIter != m_aInsertRow->get().end();++aIter)
- {
- (*aIter)->setBound(sal_False);
- (*aIter)->setNull();
- }
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::moveToCurrentRow" );
-}
-// -------------------------------------------------------------------------
-void OResultSet::updateValue(sal_Int32 columnIndex ,const ORowSetValue& x) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateValue" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- checkIndex(columnIndex );
- columnIndex = mapColumn(columnIndex);
-
- (m_aInsertRow->get())[columnIndex]->setBound(sal_True);
- *(m_aInsertRow->get())[columnIndex] = x;
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateNull" );
- ORowSetValue aEmpty;
- updateValue(columnIndex,aEmpty);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateBoolean" );
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateByte" );
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateShort" );
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateInt" );
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateLong( sal_Int32 /*columnIndex*/, sal_Int64 /*x*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateLong" );
- ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateLong", *this );
-}
-// -----------------------------------------------------------------------
-void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateFloat" );
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateDouble" );
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateString" );
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateBytes" );
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateDate" );
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateTime" );
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateTimestamp" );
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateBinaryStream" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- if(!x.is())
- ::dbtools::throwFunctionSequenceException(*this);
-
- Sequence<sal_Int8> aSeq;
- x->readBytes(aSeq,length);
- updateValue(columnIndex,aSeq);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateCharacterStream" );
- updateBinaryStream(columnIndex,x,length);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::refreshRow" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateObject" );
- if (!::dbtools::implUpdateObject(this, columnIndex, x))
- throw SQLException();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateNumericObject" );
- if (!::dbtools::implUpdateObject(this, columnIndex, x))
- throw SQLException();
-}
-// -------------------------------------------------------------------------
-IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::createArrayHelper" );
- Sequence< Property > aProps;
- describeProperties(aProps);
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-// -------------------------------------------------------------------------
-IPropertyArrayHelper & OResultSet::getInfoHelper()
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getInfoHelper" );
- return *const_cast<OResultSet*>(this)->getArrayHelper();
-}
-
-//------------------------------------------------------------------
-sal_Bool OResultSet::ExecuteRow(IResultSetHelper::Movement eFirstCursorPosition,
- sal_Int32 nFirstOffset,
- sal_Bool bEvaluate,
- sal_Bool bRetrieveData)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::ExecuteRow" );
- OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::ExecuteRow: Analyzer isn't set!");
-
- // For further Fetch-Operations this information may possibly be changed ...
- IResultSetHelper::Movement eCursorPosition = eFirstCursorPosition;
- sal_Int32 nOffset = nFirstOffset;
-
- const OSQLColumns & rTableCols = *(m_pTable->getTableColumns());
- sal_Bool bHasRestriction = m_pSQLAnalyzer->hasRestriction();
-again:
-
- // protect from reading over the end when someboby is inserting while we are reading
- // this method works only for dBase at the moment !!!!
- if (eCursorPosition == IResultSetHelper::NEXT && m_nFilePos == m_nLastVisitedPos)
- {
- return sal_False;
- }
-
- if (!m_pTable || !m_pTable->seekRow(eCursorPosition, nOffset, m_nFilePos))
- {
- return sal_False;
- }
-
- if (!bEvaluate) // If no evaluation runs, then just fill the results-row
- {
- m_pTable->fetchRow(m_aRow,rTableCols, sal_True,bRetrieveData);
- }
- else
- {
- m_pTable->fetchRow(m_aEvaluateRow, rTableCols, sal_True,bRetrieveData || bHasRestriction);
-
- if ( ( !m_bShowDeleted
- && m_aEvaluateRow->isDeleted()
- )
- || ( bHasRestriction
- && !m_pSQLAnalyzer->evaluateRestriction()
- )
- )
- { // Evaluate the next record
- // delete current row in Keyset
- if (m_pEvaluationKeySet)
- {
- ++m_aEvaluateIter;
- if (m_pEvaluationKeySet->end() != m_aEvaluateIter)
- nOffset = (*m_aEvaluateIter);
- else
- {
- return sal_False;
- }
- }
- else if (m_pFileSet.is())
- {
- OSL_ENSURE(eCursorPosition == IResultSetHelper::NEXT, "Falsche CursorPosition!");
- eCursorPosition = IResultSetHelper::NEXT;
- nOffset = 1;
- }
- else if (eCursorPosition == IResultSetHelper::FIRST ||
- eCursorPosition == IResultSetHelper::NEXT ||
- eCursorPosition == IResultSetHelper::ABSOLUTE)
- {
- eCursorPosition = IResultSetHelper::NEXT;
- nOffset = 1;
- }
- else if (eCursorPosition == IResultSetHelper::LAST ||
- eCursorPosition == IResultSetHelper::PRIOR)
- {
- eCursorPosition = IResultSetHelper::PRIOR;
- nOffset = 1;
- }
- else if (eCursorPosition == IResultSetHelper::RELATIVE)
- {
- eCursorPosition = (nOffset >= 0) ? IResultSetHelper::NEXT : IResultSetHelper::PRIOR;
- }
- else
- {
- return sal_False;
- }
- // Try again ...
- goto again;
- }
- }
-
- // Evaluate may only be set,
- // if the Keyset will be constructed further
- if ( ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT )
- && !isCount()
- && bEvaluate
- )
- {
- if (m_pSortIndex)
- {
- OKeyValue* pKeyValue = GetOrderbyKeyValue( m_aSelectRow );
- m_pSortIndex->AddKeyValue(pKeyValue);
- }
- else if (m_pFileSet.is())
- {
- sal_uInt32 nBookmarkValue = Abs((sal_Int32)(m_aEvaluateRow->get())[0]->getValue());
- m_pFileSet->get().push_back(nBookmarkValue);
- }
- }
- else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_UPDATE)
- {
- sal_Bool bOK = sal_True;
- if (bEvaluate)
- {
- // read the actual result-row
- bOK = m_pTable->fetchRow(m_aEvaluateRow, *(m_pTable->getTableColumns()), sal_True,sal_True);
- }
-
- if (bOK)
- {
- // just give the values to be changed:
- if(!m_pTable->UpdateRow(*m_aAssignValues,m_aEvaluateRow, m_xColsIdx))
- return sal_False;
- }
- }
- else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_DELETE)
- {
- sal_Bool bOK = sal_True;
- if (bEvaluate)
- {
- bOK = m_pTable->fetchRow(m_aEvaluateRow, *(m_pTable->getTableColumns()), sal_True,sal_True);
- }
- if (bOK)
- {
- if(!m_pTable->DeleteRow(*m_xColumns))
- return sal_False;
- }
- }
- return sal_True;
-}
-
-//-------------------------------------------------------------------
-sal_Bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Bool bRetrieveData)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::Move" );
-
-//IgnoreDeletedRows:
-//
- sal_Int32 nTempPos = m_nRowPos;
-
- if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT &&
- !isCount())
- {
- if (!m_pFileSet.is()) //no Index available
- {
- // Normal FETCH
- ExecuteRow(eCursorPosition,nOffset,sal_False,bRetrieveData);
-
- // now set the bookmark for outside this is the logical pos and not the file pos
- *(*m_aRow->get().begin()) = sal_Int32(m_nRowPos + 1);
- }
- else
- {
- switch(eCursorPosition)
- {
- case IResultSetHelper::NEXT:
- ++m_nRowPos;
- break;
- case IResultSetHelper::PRIOR:
- if (m_nRowPos >= 0)
- --m_nRowPos;
- break;
- case IResultSetHelper::FIRST:
- m_nRowPos = 0;
- break;
- case IResultSetHelper::LAST:
- m_nRowPos = m_pFileSet->get().size() - 1;
- break;
- case IResultSetHelper::RELATIVE:
- m_nRowPos += nOffset;
- break;
- case IResultSetHelper::ABSOLUTE:
- case IResultSetHelper::BOOKMARK:
- if ( m_nRowPos == (nOffset -1) )
- return sal_True;
- m_nRowPos = nOffset -1;
- break;
- }
-
- // OffRange?
- // 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 >= (sal_Int32)m_pFileSet->get().size() )) // && m_pFileSet->IsFrozen()
- {
- goto Error;
- }
- else
- {
- if (m_nRowPos < (sal_Int32)m_pFileSet->get().size())
- {
- // Fetch via Index
- ExecuteRow(IResultSetHelper::BOOKMARK,(m_pFileSet->get())[m_nRowPos],sal_False,bRetrieveData);
-
- // now set the bookmark for outside
- *(*m_aRow->get().begin()) = sal_Int32(m_nRowPos + 1);
- if ( (bRetrieveData || m_pSQLAnalyzer->hasRestriction()) && m_pSQLAnalyzer->hasFunctions() )
- {
- m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping);
- }
- }
- else // Index must be further constructed
- {
- // set first on the last known row
- if (!m_pFileSet->get().empty())
- {
- m_aFileSetIter = m_pFileSet->get().end()-1;
- m_pTable->seekRow(IResultSetHelper::BOOKMARK, *m_aFileSetIter, m_nFilePos);
- }
- sal_Bool bOK = sal_True;
- // Determine the number of further Fetches
- while (bOK && m_nRowPos >= (sal_Int32)m_pFileSet->get().size())
- {
- if (m_pEvaluationKeySet)
- {
- if (m_nRowPos >= (sal_Int32)m_pEvaluationKeySet->size())
- return sal_False;
- else if (m_nRowPos == 0)
- {
- m_aEvaluateIter = m_pEvaluationKeySet->begin();
- bOK = ExecuteRow(IResultSetHelper::BOOKMARK,*m_aEvaluateIter,sal_True, bRetrieveData);
- }
- else
- {
- ++m_aEvaluateIter;
- bOK = ExecuteRow(IResultSetHelper::BOOKMARK,*m_aEvaluateIter,sal_True, bRetrieveData);
- }
- }
- else
- bOK = ExecuteRow(IResultSetHelper::NEXT,1,sal_True, sal_False);//bRetrieveData);
- }
-
- if (bOK)
- {
- // read the results again
- m_pTable->fetchRow(m_aRow, *(m_pTable->getTableColumns()), sal_True,bRetrieveData);
-
- // now set the bookmark for outside
- *(*m_aRow->get().begin()) = sal_Int32(m_nRowPos + 1);
-
- if ( (bRetrieveData || m_pSQLAnalyzer->hasRestriction()) && m_pSQLAnalyzer->hasFunctions() )
- {
- m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping);
- }
- }
- else if (!m_pFileSet->isFrozen()) // no valid record found
- {
- m_pFileSet->setFrozen();
- m_pEvaluationKeySet = NULL;
- goto Error;
- }
- }
- }
- }
- }
- else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT && isCount())
- {
- // Fetch the COUNT(*)
- switch (eCursorPosition)
- {
- case IResultSetHelper::NEXT:
- ++m_nRowPos;
- break;
- case IResultSetHelper::PRIOR:
- --m_nRowPos;
- break;
- case IResultSetHelper::FIRST:
- m_nRowPos = 0;
- break;
- case IResultSetHelper::LAST:
- m_nRowPos = 0;
- break;
- case IResultSetHelper::RELATIVE:
- m_nRowPos += nOffset;
- break;
- case IResultSetHelper::ABSOLUTE:
- case IResultSetHelper::BOOKMARK:
- m_nRowPos = nOffset - 1;
- break;
- }
-
- if ( m_nRowPos < 0 )
- goto Error;
- else if (m_nRowPos == 0)
- {
- // put COUNT(*) in result-row
- // (must be the first and only variable in the row)
- if (m_aRow->get().size() >= 2)
- {
- *(m_aRow->get())[1] = m_nRowCountResult;
- *(m_aRow->get())[0] = sal_Int32(1);
- (m_aRow->get())[1]->setBound(sal_True);
- (m_aSelectRow->get())[1] = (m_aRow->get())[1];
- }
- }
- else
- {
- m_bEOF = sal_True;
- m_nRowPos = 1;
- return sal_False;
- }
- }
- else
- // Fetch only possible at SELECT!
- return sal_False;
-
- return sal_True;
-
-Error:
- // is the Cursor positioned before the first row
- // then the position will be maintained
- if (nTempPos == -1)
- m_nRowPos = nTempPos;
- else
- {
- switch(eCursorPosition)
- {
- case IResultSetHelper::PRIOR:
- case IResultSetHelper::FIRST:
- m_nRowPos = -1;
- break;
- case IResultSetHelper::LAST:
- case IResultSetHelper::NEXT:
- case IResultSetHelper::ABSOLUTE:
- case IResultSetHelper::RELATIVE:
- if (nOffset > 0)
- m_nRowPos = m_pFileSet.is() ? (sal_Int32)m_pFileSet->get().size() : -1;
- else if (nOffset < 0)
- m_nRowPos = -1;
- break;
- case IResultSetHelper::BOOKMARK:
- m_nRowPos = nTempPos; // last Position
- }
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-void OResultSet::sortRows()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::sortRows" );
- if (!m_pSQLAnalyzer->hasRestriction() && m_aOrderbyColumnNumber.size() == 1)
- {
- // is just one field given for sorting
- // and this field is indexed, then the Index will be used
- Reference<XIndexesSupplier> xIndexSup;
- m_pTable->queryInterface(::getCppuType((const Reference<XIndexesSupplier>*)0)) >>= xIndexSup;
-
- Reference<XIndexAccess> xIndexes;
- if(xIndexSup.is())
- {
- xIndexes.set(xIndexSup->getIndexes(),UNO_QUERY);
- Reference<XPropertySet> xColProp;
- if(m_aOrderbyColumnNumber[0] < xIndexes->getCount())
- {
- xColProp.set(xIndexes->getByIndex(m_aOrderbyColumnNumber[0]),UNO_QUERY);
- // iterate through the indexes to find the matching column
- const sal_Int32 nCount = xIndexes->getCount();
- for(sal_Int32 i=0; i < nCount;++i)
- {
- Reference<XColumnsSupplier> xIndex(xIndexes->getByIndex(i),UNO_QUERY);
- Reference<XNameAccess> xIndexCols = xIndex->getColumns();
- if(xIndexCols->hasByName(comphelper::getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))))
- {
- m_pFileSet = new OKeySet();
-
- if(fillIndexValues(xIndex))
- return;
- }
- }
- }
- }
- }
-
- OSortIndex::TKeyTypeVector eKeyType(m_aOrderbyColumnNumber.size());
- ::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin();
- for (::std::vector<sal_Int16>::size_type i=0;aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i)
- {
- OSL_ENSURE((sal_Int32)m_aSelectRow->get().size() > *aOrderByIter,"Invalid Index");
- switch ((*(m_aSelectRow->get().begin()+*aOrderByIter))->getValue().getTypeKind())
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- case DataType::LONGVARCHAR:
- eKeyType[i] = SQL_ORDERBYKEY_STRING;
- break;
-
- case DataType::OTHER:
- case DataType::TINYINT:
- case DataType::SMALLINT:
- case DataType::INTEGER:
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- case DataType::REAL:
- case DataType::DOUBLE:
- case DataType::DATE:
- case DataType::TIME:
- case DataType::TIMESTAMP:
- case DataType::BIT:
- eKeyType[i] = SQL_ORDERBYKEY_DOUBLE;
- break;
-
- // Other types aren't implemented (so they are always FALSE)
- default:
- eKeyType[i] = SQL_ORDERBYKEY_NONE;
- OSL_FAIL("OFILECursor::Execute: Datentyp nicht implementiert");
- break;
- }
- (m_aSelectRow->get())[*aOrderByIter]->setBound(sal_True);
- }
-
- m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending);
-
- if (m_pEvaluationKeySet)
- {
- m_aEvaluateIter = m_pEvaluationKeySet->begin();
-
- while (m_aEvaluateIter != m_pEvaluationKeySet->end())
- {
- ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),sal_True);
- ++m_aEvaluateIter;
- }
- }
- else
- {
- while ( ExecuteRow( IResultSetHelper::NEXT, 1, sal_False, sal_True ) )
- {
- m_aSelectRow->get()[0]->setValue( m_aRow->get()[0]->getValue() );
- if ( m_pSQLAnalyzer->hasFunctions() )
- m_pSQLAnalyzer->setSelectionEvaluationResult( m_aSelectRow, m_aColMapping );
- const sal_Int32 nBookmark = (*m_aRow->get().begin())->getValue();
- ExecuteRow( IResultSetHelper::BOOKMARK, nBookmark, sal_True, sal_False );
- }
- }
-
- // create sorted Keyset
- m_pEvaluationKeySet = NULL;
- m_pFileSet = NULL;
- m_pFileSet = m_pSortIndex->CreateKeySet();
- DELETEZ(m_pSortIndex);
- // now access to a sorted set is possible via Index
-}
-
-
-// -------------------------------------------------------------------------
-sal_Bool OResultSet::OpenImpl()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::OpenImpl" );
- OSL_ENSURE(m_pSQLAnalyzer,"No analyzer set with setSqlAnalyzer!");
- if(!m_pTable)
- {
- const OSQLTables& xTabs = m_aSQLIterator.getTables();
- if ((xTabs.begin() == xTabs.end()) || !xTabs.begin()->second.is())
- lcl_throwError(STR_QUERY_TOO_COMPLEX,*this);
-
- if ( xTabs.size() > 1 || m_aSQLIterator.hasErrors() )
- lcl_throwError(STR_QUERY_MORE_TABLES,*this);
-
- OSQLTable xTable = xTabs.begin()->second;
- m_xColumns = m_aSQLIterator.getSelectColumns();
-
- m_xColNames = xTable->getColumns();
- m_xColsIdx.set(m_xColNames,UNO_QUERY);
- doTableSpecials(xTable);
- Reference<XComponent> xComp(xTable,UNO_QUERY);
- if(xComp.is())
- xComp->addEventListener(this);
- }
-
- m_pTable->refreshHeader();
-
- sal_Int32 nColumnCount = m_xColsIdx->getCount();
-
- initializeRow(m_aRow,nColumnCount);
- initializeRow(m_aEvaluateRow,nColumnCount);
- initializeRow(m_aInsertRow,nColumnCount);
-
-
- m_nResultSetConcurrency = (m_pTable->isReadOnly() || isCount()) ? ResultSetConcurrency::READ_ONLY : ResultSetConcurrency::UPDATABLE;
-
- // create new Index:
- m_pFileSet = NULL;
-
- // position at the beginning
- m_nRowPos = -1;
- m_nFilePos = 0;
- m_nRowCountResult = -1;
-
- m_nLastVisitedPos = m_pTable->getCurrentLastPos();
-
- switch(m_aSQLIterator.getStatementType())
- {
- case SQL_STATEMENT_SELECT:
- {
- if(isCount())
- {
- if(m_xColumns->get().size() > 1)
- lcl_throwError(STR_QUERY_COMPLEX_COUNT,*this);
-
- m_nRowCountResult = 0;
- // for now simply iterate over all rows and
- // do all actions (or just count)
- {
- sal_Bool bOK = sal_True;
- if (m_pEvaluationKeySet)
- {
- m_aEvaluateIter = m_pEvaluationKeySet->begin();
- bOK = m_aEvaluateIter == m_pEvaluationKeySet->end();
-
- }
- while (bOK)
- {
- if (m_pEvaluationKeySet)
- ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),sal_True);
- else
- bOK = ExecuteRow(IResultSetHelper::NEXT,1,sal_True);
-
- if (bOK)
- {
- m_nRowCountResult++;
- if(m_pEvaluationKeySet)
- {
- ++m_aEvaluateIter;
- bOK = m_aEvaluateIter == m_pEvaluationKeySet->end();
- }
- }
- }
-
- // save result of COUNT(*) in m_nRowCountResult.
- // nRowCount (number of Rows in the result) = 1 for this request!
- m_pEvaluationKeySet = NULL;
- }
- }
- else
- {
- sal_Bool bDistinct = sal_False;
- sal_Bool bWasSorted = sal_False;
- OSQLParseNode *pDistinct = m_pParseTree->getChild(1);
- ::std::vector<sal_Int32> aOrderbyColumnNumberSave;
- ::std::vector<TAscendingOrder> aOrderbyAscendingSave;
-
- if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT )
- {
- // Sort on all columns, saving original order for later
- if(IsSorted())
- {
- aOrderbyColumnNumberSave = m_aOrderbyColumnNumber;
- m_aOrderbyColumnNumber.clear();
- aOrderbyAscendingSave.assign(m_aOrderbyAscending.begin(), m_aOrderbyAscending.end());
- bWasSorted = sal_True;
- }
-
- // the first column is the bookmark column
- ::std::vector<sal_Int32>::iterator aColStart = (m_aColMapping.begin()+1);
- ::std::copy(aColStart, m_aColMapping.end(),::std::back_inserter(m_aOrderbyColumnNumber));
- m_aOrderbyAscending.assign(m_aColMapping.size()-1, SQL_ASC);
- bDistinct = sal_True;
- }
-
- if (IsSorted())
- sortRows();
-
- if (!m_pFileSet.is())
- {
- m_pFileSet = new OKeySet();
-
- if (!m_pSQLAnalyzer->hasRestriction())
- // now the Keyset can be filled!
- // But be careful: It is assumed, that the FilePositions will be stored as sequence 1..n
- {
- if ( m_nLastVisitedPos > 0)
- m_pFileSet->get().reserve( m_nLastVisitedPos );
- for (sal_Int32 i = 0; i < m_nLastVisitedPos; i++)
- m_pFileSet->get().push_back(i + 1);
- }
- }
- OSL_ENSURE(m_pFileSet.is(),"Kein KeySet vorhanden! :-(");
-
- if(bDistinct && m_pFileSet.is())
- {
- OValueRow aSearchRow = new OValueVector(m_aRow->get().size());
- OValueRefVector::Vector::iterator aRowIter = m_aRow->get().begin();
- OValueVector::Vector::iterator aSearchIter = aSearchRow->get().begin();
- for ( ++aRowIter,++aSearchIter; // the first column is the bookmark column
- aRowIter != m_aRow->get().end();
- ++aRowIter,++aSearchIter)
- aSearchIter->setBound((*aRowIter)->isBound());
-
- size_t nMaxRow = m_pFileSet->get().size();
-
- if (nMaxRow)
- {
- #if OSL_DEBUG_LEVEL > 1
- sal_Int32 nFound=0;
- #endif
- sal_Int32 nPos;
- sal_Int32 nKey;
-
- for( size_t j = nMaxRow-1; j > 0; --j)
- {
- nPos = (m_pFileSet->get())[j];
- ExecuteRow(IResultSetHelper::BOOKMARK,nPos,sal_False);
- m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping);
- { // copy row values
- OValueRefVector::Vector::iterator copyFrom = m_aSelectRow->get().begin();
- OValueVector::Vector::iterator copyTo = aSearchRow->get().begin();
- for ( ++copyFrom,++copyTo; // the first column is the bookmark column
- copyFrom != m_aSelectRow->get().end();
- ++copyFrom,++copyTo)
- *copyTo = *(*copyFrom);
- }
-
- // compare with next row
- nKey = (m_pFileSet->get())[j-1];
- ExecuteRow(IResultSetHelper::BOOKMARK,nKey,sal_False);
- m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping);
- OValueRefVector::Vector::iterator loopInRow = m_aSelectRow->get().begin();
- OValueVector::Vector::iterator existentInSearchRow = aSearchRow->get().begin();
- for ( ++loopInRow,++existentInSearchRow; // the first column is the bookmark column
- loopInRow != m_aSelectRow->get().end();
- ++loopInRow,++existentInSearchRow)
- {
- if ( (*loopInRow)->isBound() && !( *(*loopInRow) == *existentInSearchRow) )
- break;
- }
-
- if(loopInRow == m_aSelectRow->get().end())
- (m_pFileSet->get())[j] = 0; // Rows match -- Mark for deletion by setting key to 0
- #if OSL_DEBUG_LEVEL > 1
- else
- nFound++;
- #endif
- }
-
- m_pFileSet->get().erase(::std::remove_if(m_pFileSet->get().begin(),m_pFileSet->get().end(),
- ::std::bind2nd(::std::equal_to<sal_Int32>(),0))
- ,m_pFileSet->get().end());
-
- if (bWasSorted)
- {
- // Re-sort on original requested order
- m_aOrderbyColumnNumber = aOrderbyColumnNumberSave;
- m_aOrderbyAscending.assign(aOrderbyAscendingSave.begin(), aOrderbyAscendingSave.end());
-
- TIntVector aEvaluationKeySet(m_pFileSet->get());
- m_pEvaluationKeySet = &aEvaluationKeySet;
- sortRows();
- }
- else
- {
- m_aOrderbyColumnNumber.clear();
- m_aOrderbyAscending.clear();
- ::std::sort(m_pFileSet->get().begin(),m_pFileSet->get().end());
- }
- }
- }
- }
- } break;
-
- case SQL_STATEMENT_UPDATE:
- case SQL_STATEMENT_DELETE:
- // during processing count the number of processed Rows
- m_nRowCountResult = 0;
- // for now simply iterate over all rows and
- // run the actions (or simply count):
- {
-
- sal_Bool bOK = sal_True;
- if (m_pEvaluationKeySet)
- {
- m_aEvaluateIter = m_pEvaluationKeySet->begin();
- bOK = m_aEvaluateIter == m_pEvaluationKeySet->end();
-
- }
- while (bOK)
- {
- if (m_pEvaluationKeySet)
- ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),sal_True);
- else
- bOK = ExecuteRow(IResultSetHelper::NEXT,1,sal_True);
-
- if (bOK)
- {
- m_nRowCountResult++;
- if(m_pEvaluationKeySet)
- {
- ++m_aEvaluateIter;
- bOK = m_aEvaluateIter == m_pEvaluationKeySet->end();
- }
- }
- }
-
- // save result of COUNT(*) in nRowCountResult.
- // nRowCount (number of rows in the result-set) = 1 for this request!
- m_pEvaluationKeySet = NULL;
- }
- break;
- case SQL_STATEMENT_INSERT:
- m_nRowCountResult = 0;
-
- OSL_ENSURE(m_aAssignValues.is(),"No assign values set!");
- if(!m_pTable->InsertRow(*m_aAssignValues, sal_True,m_xColsIdx))
- {
- m_nFilePos = 0;
- return sal_False;
- }
-
- m_nRowCountResult = 1;
- break;
- default:
- OSL_FAIL( "OResultSet::OpenImpl: unsupported statement type!" );
- break;
- }
-
- // reset FilePos
- m_nFilePos = 0;
-
- return sal_True;
-}
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OResultSet::getUnoTunnelImplementationId()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getUnoTunnelImplementationId" );
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OResultSet::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getSomething" );
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : 0;
-}
-// -----------------------------------------------------------------------------
-void OResultSet::setBoundedColumns(const OValueRefRow& _rRow,
- const OValueRefRow& _rSelectRow,
- const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,
- const Reference<XIndexAccess>& _xNames,
- sal_Bool _bSetColumnMapping,
- const Reference<XDatabaseMetaData>& _xMetaData,
- ::std::vector<sal_Int32>& _rColMapping)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::setBoundedColumns" );
- ::comphelper::UStringMixEqual aCase(_xMetaData->supportsMixedCaseQuotedIdentifiers());
-
- Reference<XPropertySet> xTableColumn;
- ::rtl::OUString sTableColumnName, sSelectColumnRealName;
-
- const ::rtl::OUString sName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
- const ::rtl::OUString sRealName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME);
- const ::rtl::OUString sType = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE);
-
- typedef ::std::map<OSQLColumns::Vector::iterator,sal_Bool> IterMap;
- IterMap aSelectIters;
- OValueRefVector::Vector::iterator aRowIter = _rRow->get().begin()+1;
- for (sal_Int32 i=0; // the first column is the bookmark column
- aRowIter != _rRow->get().end();
- ++i, ++aRowIter
- )
- {
- (*aRowIter)->setBound(sal_False);
- try
- {
- // get the table column and it's name
- _xNames->getByIndex(i) >>= xTableColumn;
- OSL_ENSURE(xTableColumn.is(), "OResultSet::setBoundedColumns: invalid table column!");
- if (xTableColumn.is())
- xTableColumn->getPropertyValue(sName) >>= sTableColumnName;
- else
- sTableColumnName = ::rtl::OUString();
-
- // look if we have such a select column
- // TODO: would like to have a O(log n) search here ...
- for ( OSQLColumns::Vector::iterator aIter = _rxColumns->get().begin();
- aIter != _rxColumns->get().end();
- ++aIter
- )
- {
- if((*aIter)->getPropertySetInfo()->hasPropertyByName(sRealName))
- (*aIter)->getPropertyValue(sRealName) >>= sSelectColumnRealName;
- else
- (*aIter)->getPropertyValue(sName) >>= sSelectColumnRealName;
-
- if ( aCase(sTableColumnName, sSelectColumnRealName) && !(*aRowIter)->isBound() && aSelectIters.end() == aSelectIters.find(aIter) )
- {
- aSelectIters.insert(IterMap::value_type(aIter,sal_True));
- if(_bSetColumnMapping)
- {
- sal_Int32 nSelectColumnPos = aIter - _rxColumns->get().begin() + 1;
- // the getXXX methods are 1-based ...
- sal_Int32 nTableColumnPos = i + 1;
- // get first table column is the bookmark column ...
- _rColMapping[nSelectColumnPos] = nTableColumnPos;
- (_rSelectRow->get())[nSelectColumnPos] = *aRowIter;
- }
-
- (*aRowIter)->setBound(sal_True);
- sal_Int32 nType = DataType::OTHER;
- if (xTableColumn.is())
- xTableColumn->getPropertyValue(sType) >>= nType;
- (*aRowIter)->setTypeKind(nType);
-
- break;
- }
- }
- }
- catch (Exception&)
- {
- OSL_FAIL("OResultSet::setBoundedColumns: caught an Exception!");
- }
- }
- // in this case we got more select columns as columns exist in the table
- if ( _bSetColumnMapping && aSelectIters.size() != _rColMapping.size() )
- {
- Reference<XNameAccess> xNameAccess(_xNames,UNO_QUERY);
- Sequence< ::rtl::OUString > aSelectColumns = xNameAccess->getElementNames();
-
- for ( OSQLColumns::Vector::iterator aIter = _rxColumns->get().begin();
- aIter != _rxColumns->get().end();
- ++aIter
- )
- {
- if ( aSelectIters.end() == aSelectIters.find(aIter) )
- {
- if ( (*aIter)->getPropertySetInfo()->hasPropertyByName(sRealName) )
- (*aIter)->getPropertyValue(sRealName) >>= sSelectColumnRealName;
- else
- (*aIter)->getPropertyValue(sName) >>= sSelectColumnRealName;
-
- if ( xNameAccess->hasByName( sSelectColumnRealName ) )
- {
- aSelectIters.insert(IterMap::value_type(aIter,sal_True));
- sal_Int32 nSelectColumnPos = aIter - _rxColumns->get().begin() + 1;
- const ::rtl::OUString* pBegin = aSelectColumns.getConstArray();
- const ::rtl::OUString* pEnd = pBegin + aSelectColumns.getLength();
- for(sal_Int32 i=0;pBegin != pEnd;++pBegin,++i)
- {
- if ( aCase(*pBegin, sSelectColumnRealName) )
- {
- // the getXXX methods are 1-based ...
- sal_Int32 nTableColumnPos = i + 1;
- // get first table column is the bookmark column ...
- _rColMapping[nSelectColumnPos] = nTableColumnPos;
- (_rSelectRow->get())[nSelectColumnPos] = (_rRow->get())[nTableColumnPos];
- break;
- }
- }
- }
- }
- }
- }
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OResultSet::acquire() throw()
-{
- OResultSet_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OResultSet::release() throw()
-{
- OResultSet_BASE::release();
-}
-// -----------------------------------------------------------------------------
-Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo( ) throw(RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getPropertySetInfo" );
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-void OResultSet::doTableSpecials(const OSQLTable& _xTable)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::doTableSpecials" );
- Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(_xTable,UNO_QUERY);
- if(xTunnel.is())
- {
- m_pTable = reinterpret_cast< OFileTable* >( xTunnel->getSomething(OFileTable::getUnoTunnelImplementationId()) );
- if(m_pTable)
- m_pTable->acquire();
- }
-}
-// -----------------------------------------------------------------------------
-void OResultSet::clearInsertRow()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::clearInsertRow" );
- m_aRow->setDeleted(sal_False); // set to false here because this is the new row
- OValueRefVector::Vector::iterator aIter = m_aInsertRow->get().begin();
- const OValueRefVector::Vector::iterator aEnd = m_aInsertRow->get().end();
- for(sal_Int32 nPos = 0;aIter != aEnd;++aIter,++nPos)
- {
- ORowSetValueDecoratorRef& rValue = (*aIter);
- if ( rValue->isBound() )
- {
- (m_aRow->get())[nPos]->setValue( (*aIter)->getValue() );
- }
- rValue->setBound(nPos == 0);
- rValue->setModified(sal_False);
- rValue->setNull();
- }
-}
-// -----------------------------------------------------------------------------
-void OResultSet::initializeRow(OValueRefRow& _rRow,sal_Int32 _nColumnCount)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::initializeRow" );
- if(!_rRow.is())
- {
- _rRow = new OValueRefVector(_nColumnCount);
- (_rRow->get())[0]->setBound(sal_True);
- ::std::for_each(_rRow->get().begin()+1,_rRow->get().end(),TSetRefBound(sal_False));
- }
-}
-// -----------------------------------------------------------------------------
-sal_Bool OResultSet::fillIndexValues(const Reference< XColumnsSupplier> &/*_xIndex*/)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::fillIndexValues" );
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::move" );
- return Move(_eCursorPosition,_nOffset,_bRetrieveData);
-}
-// -----------------------------------------------------------------------------
-sal_Int32 OResultSet::getDriverPos() const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getDriverPos" );
- return (m_aRow->get())[0]->getValue();
-}
-// -----------------------------------------------------------------------------
-sal_Bool OResultSet::deletedVisible() const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::deletedVisible" );
- return m_bShowDeleted;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OResultSet::isRowDeleted() const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isRowDeleted" );
- return m_aRow->isDeleted();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OResultSet::disposing( const EventObject& Source ) throw (RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::disposing" );
- Reference<XPropertySet> xProp = m_pTable;
- if(m_pTable && Source.Source == xProp)
- {
- m_pTable->release();
- m_pTable = NULL;
- }
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/FResultSetMetaData.cxx b/connectivity/source/drivers/file/FResultSetMetaData.cxx
deleted file mode 100644
index fc45a15afb..0000000000
--- a/connectivity/source/drivers/file/FResultSetMetaData.cxx
+++ /dev/null
@@ -1,221 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "file/FResultSetMetaData.hxx"
-#include "file/FTable.hxx"
-#include <comphelper/extract.hxx>
-#include "connectivity/dbexception.hxx"
-#include <comphelper/types.hxx>
-#include <rtl/logfile.hxx>
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace dbtools;
-using namespace connectivity::file;
-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;
-
-// -------------------------------------------------------------------------
-OResultSetMetaData::OResultSetMetaData(const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,const ::rtl::OUString& _aTableName,OFileTable* _pTable)
- :m_aTableName(_aTableName)
- ,m_xColumns(_rxColumns)
- ,m_pTable(_pTable)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::OResultSetMetaData" );
-}
-
-// -------------------------------------------------------------------------
-OResultSetMetaData::~OResultSetMetaData()
-{
- m_xColumns = NULL;
-}
-// -----------------------------------------------------------------------------
-void OResultSetMetaData::checkColumnIndex(sal_Int32 column) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::checkColumnIndex" );
- if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->get().size())
- throwInvalidIndexException(*this);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnDisplaySize" );
- return getPrecision(column);
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnType" );
- checkColumnIndex(column);
- return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)));
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnCount" );
- return (m_xColumns->get()).size();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isCaseSensitive" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getSchemaName" );
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnName" );
- checkColumnIndex(column);
-
- Any aName((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)));
- return aName.hasValue() ? getString(aName) : getString((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getTableName" );
- return m_aTableName;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getCatalogName" );
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnTypeName" );
- checkColumnIndex(column);
- return getString((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnLabel" );
- return getColumnName(column);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnServiceName" );
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isCurrency" );
- checkColumnIndex(column);
- return getBOOL((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)));
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 /*setCatalogcolumn*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isAutoIncrement" );
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isSigned" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getPrecision" );
- checkColumnIndex(column);
- return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)));
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::getScale" );
- checkColumnIndex(column);
- return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)));
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isNullable" );
- checkColumnIndex(column);
- return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)));
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isSearchable" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isReadOnly" );
- checkColumnIndex(column);
- return m_pTable->isReadOnly() || (
- (m_xColumns->get())[column-1]->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)) &&
- ::cppu::any2bool((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION))));
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isDefinitelyWritable" );
- return !isReadOnly(column);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSetMetaData::isWritable" );
- return !isReadOnly(column);
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx
deleted file mode 100644
index 78232769c2..0000000000
--- a/connectivity/source/drivers/file/FStatement.cxx
+++ /dev/null
@@ -1,828 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <osl/diagnose.h>
-#include "file/FStatement.hxx"
-#include "file/FConnection.hxx"
-#include "file/FDriver.hxx"
-#include "file/FResultSet.hxx"
-#include <comphelper/property.hxx>
-#include <comphelper/uno3.hxx>
-#include <osl/thread.h>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <comphelper/sequence.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include "connectivity/dbexception.hxx"
-#include "resource/file_res.hrc"
-#include <algorithm>
-#include <tools/debug.hxx>
-#include <rtl/logfile.hxx>
-
-#define THROW_SQL(x) \
- OTools::ThrowException(x,m_aStatementHandle,SQL_HANDLE_STMT,*this)
-
-namespace connectivity
-{
- namespace file
- {
-
-//------------------------------------------------------------------------------
-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;
-using namespace com::sun::star::sdbcx;
-using namespace com::sun::star::container;
-DBG_NAME( file_OStatement_Base )
-
-//------------------------------------------------------------------------------
-OStatement_Base::OStatement_Base(OConnection* _pConnection )
- :OStatement_BASE(m_aMutex)
- ,::comphelper::OPropertyContainer(OStatement_BASE::rBHelper)
- ,m_xDBMetaData(_pConnection->getMetaData())
- ,m_aParser(_pConnection->getDriver()->getFactory())
- ,m_aSQLIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL )
- ,m_pConnection(_pConnection)
- ,m_pParseTree(NULL)
- ,m_pSQLAnalyzer(NULL)
- ,m_pEvaluationKeySet(NULL)
- ,m_pTable(NULL)
- ,m_nMaxFieldSize(0)
- ,m_nMaxRows(0)
- ,m_nQueryTimeOut(0)
- ,m_nFetchSize(0)
- ,m_nResultSetType(ResultSetType::FORWARD_ONLY)
- ,m_nFetchDirection(FetchDirection::FORWARD)
- ,m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
- ,m_bEscapeProcessing(sal_True)
- ,rBHelper(OStatement_BASE::rBHelper)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::OStatement_Base" );
- DBG_CTOR( file_OStatement_Base, NULL );
-
- m_pConnection->acquire();
-
- sal_Int32 nAttrib = 0;
-
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME), PROPERTY_ID_CURSORNAME, nAttrib,&m_aCursorName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE), PROPERTY_ID_MAXFIELDSIZE, nAttrib,&m_nMaxFieldSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL)));
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS), PROPERTY_ID_MAXROWS, nAttrib,&m_nMaxRows, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL)));
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT), PROPERTY_ID_QUERYTIMEOUT, nAttrib,&m_nQueryTimeOut, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL)));
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE), PROPERTY_ID_FETCHSIZE, nAttrib,&m_nFetchSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL)));
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE), PROPERTY_ID_RESULTSETTYPE, nAttrib,&m_nResultSetType, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL)));
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION), PROPERTY_ID_FETCHDIRECTION, nAttrib,&m_nFetchDirection, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL)));
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING),PROPERTY_ID_ESCAPEPROCESSING, nAttrib,&m_bEscapeProcessing,::getCppuBooleanType());
-
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY), PROPERTY_ID_RESULTSETCONCURRENCY, nAttrib,&m_nResultSetConcurrency, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL)));
-}
-// -----------------------------------------------------------------------------
-OStatement_Base::~OStatement_Base()
-{
- osl_incrementInterlockedCount( &m_refCount );
- disposing();
- delete m_pSQLAnalyzer;
-
- DBG_DTOR( file_OStatement_Base, NULL );
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::disposeResultSet()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::disposeResultSet" );
- // free the cursor if alive
- Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- m_xResultSet = Reference< XResultSet>();
-}
-//------------------------------------------------------------------------------
-void OStatement_BASE2::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- disposeResultSet();
-
- if(m_pSQLAnalyzer)
- m_pSQLAnalyzer->dispose();
-
- if(m_aRow.is())
- {
- m_aRow->get().clear();
- m_aRow = NULL;
- }
-
- m_aSQLIterator.dispose();
-
- if(m_pTable)
- {
- m_pTable->release();
- m_pTable = NULL;
- }
-
- if (m_pConnection)
- {
- m_pConnection->release();
- m_pConnection = NULL;
- }
-
- dispose_ChildImpl();
-
- if ( m_pParseTree )
- {
- delete m_pParseTree;
- m_pParseTree = NULL;
- }
-
- OStatement_Base::disposing();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::acquire() throw()
-{
- OStatement_BASE::acquire();
-}
-//-----------------------------------------------------------------------------
-void SAL_CALL OStatement_BASE2::release() throw()
-{
- relase_ChildImpl();
-}
-//-----------------------------------------------------------------------------
-Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::queryInterface" );
- const Any aRet = OStatement_BASE::queryInterface(rType);
- return aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::getTypes" );
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes());
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::cancel" );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::close" );
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- }
- dispose();
-}
-// -------------------------------------------------------------------------
-
-void OStatement_Base::reset() throw (SQLException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::reset" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- clearWarnings ();
-
- if (m_xResultSet.get().is())
- clearMyResultSet();
-}
-//--------------------------------------------------------------------
-// clearMyResultSet
-// If a ResultSet was created for this Statement, close it
-//--------------------------------------------------------------------
-
-void OStatement_Base::clearMyResultSet () throw (SQLException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::clearMyResultSet " );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- try
- {
- Reference<XCloseable> xCloseable;
- if ( ::comphelper::query_interface( m_xResultSet.get(), xCloseable ) )
- xCloseable->close();
- }
- catch( const DisposedException& ) { }
-
- m_xResultSet = Reference< XResultSet>();
-}
-//--------------------------------------------------------------------
-// setWarning
-// Sets the warning
-//--------------------------------------------------------------------
-
-void OStatement_Base::setWarning (const SQLWarning &ex) throw( SQLException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::setWarning " );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- m_aLastWarning = ex;
-}
-
-// -------------------------------------------------------------------------
-Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::getWarnings" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- return makeAny(m_aLastWarning);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::clearWarnings" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- m_aLastWarning = SQLWarning();
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::createArrayHelper" );
- Sequence< Property > aProps;
- describeProperties(aProps);
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper()
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::getInfoHelper" );
- return *const_cast<OStatement_Base*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-OResultSet* OStatement::createResultSet()
-{
- return new OResultSet(this,m_aSQLIterator);
-}
-// -------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbc.driver.file.Statement","com.sun.star.sdbc.Statement");
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement::acquire() throw()
-{
- OStatement_BASE2::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement::release() throw()
-{
- OStatement_BASE2::release();
-}
-// -----------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OStatement::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- executeQuery(sql);
-
- return m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT;
-}
-
-// -------------------------------------------------------------------------
-
-Reference< XResultSet > SAL_CALL OStatement::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- construct(sql);
- Reference< XResultSet > xRS;
- OResultSet* pResult = createResultSet();
- xRS = pResult;
- initializeResultSet(pResult);
- m_xResultSet = Reference<XResultSet>(pResult);
-
- pResult->OpenImpl();
-
- return xRS;
-}
-// -------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL OStatement::getConnection( ) throw(SQLException, RuntimeException)
-{
- return (Reference< XConnection >)m_pConnection;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OStatement::executeUpdate( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- construct(sql);
- OResultSet* pResult = createResultSet();
- Reference< XResultSet > xRS = pResult;
- initializeResultSet(pResult);
- pResult->OpenImpl();
-
- return pResult->getRowCountResult();
-}
-
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::disposing(void)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::disposing" );
- if(m_aEvaluateRow.is())
- {
- m_aEvaluateRow->get().clear();
- m_aEvaluateRow = NULL;
- }
- delete m_pEvaluationKeySet;
- OStatement_BASE::disposing();
-}
-// -----------------------------------------------------------------------------
-Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::getPropertySetInfo" );
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OStatement_XStatement::queryInterface( rType);
- return aRet.hasValue() ? aRet : OStatement_BASE2::queryInterface( rType);
-}
-// -----------------------------------------------------------------------------
-OSQLAnalyzer* OStatement_Base::createAnalyzer()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::createAnalyzer" );
- return new OSQLAnalyzer(m_pConnection);
-}
-// -----------------------------------------------------------------------------
-void OStatement_Base::anylizeSQL()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::anylizeSQL" );
- OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::anylizeSQL: Analyzer isn't set!");
- // start analysing the statement
- m_pSQLAnalyzer->setOrigColumns(m_xColNames);
- m_pSQLAnalyzer->start(m_pParseTree);
-
- const OSQLParseNode* pOrderbyClause = m_aSQLIterator.getOrderTree();
- if(pOrderbyClause)
- {
- OSQLParseNode * pOrderingSpecCommalist = pOrderbyClause->getChild(2);
- OSL_ENSURE(SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OResultSet: Fehler im Parse Tree");
-
- for (sal_uInt32 m = 0; m < pOrderingSpecCommalist->count(); m++)
- {
- OSQLParseNode * pOrderingSpec = pOrderingSpecCommalist->getChild(m);
- OSL_ENSURE(SQL_ISRULE(pOrderingSpec,ordering_spec),"OResultSet: Fehler im Parse Tree");
- OSL_ENSURE(pOrderingSpec->count() == 2,"OResultSet: Fehler im Parse Tree");
-
- OSQLParseNode * pColumnRef = pOrderingSpec->getChild(0);
- if(!SQL_ISRULE(pColumnRef,column_ref))
- {
- throw SQLException();
- }
- OSQLParseNode * pAscendingDescending = pOrderingSpec->getChild(1);
- setOrderbyColumn(pColumnRef,pAscendingDescending);
- }
- }
-}
-//------------------------------------------------------------------
-void OStatement_Base::setOrderbyColumn( OSQLParseNode* pColumnRef,
- OSQLParseNode* pAscendingDescending)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::setOrderbyColumn" );
- ::rtl::OUString aColumnName;
- if (pColumnRef->count() == 1)
- aColumnName = pColumnRef->getChild(0)->getTokenValue();
- else if (pColumnRef->count() == 3)
- {
- pColumnRef->getChild(2)->parseNodeToStr( aColumnName, getOwnConnection(), NULL, sal_False, sal_False );
- }
- else
- {
- throw SQLException();
- }
-
- Reference<XColumnLocate> xColLocate(m_xColNames,UNO_QUERY);
- if(!xColLocate.is())
- return;
- // Everything tested and we have the name of the Column.
- // What number is the Column?
- ::rtl::Reference<OSQLColumns> aSelectColumns = m_aSQLIterator.getSelectColumns();
- ::comphelper::UStringMixEqual aCase;
- OSQLColumns::Vector::const_iterator aFind = ::connectivity::find(aSelectColumns->get().begin(),aSelectColumns->get().end(),aColumnName,aCase);
- if ( aFind == aSelectColumns->get().end() )
- throw SQLException();
- m_aOrderbyColumnNumber.push_back((aFind - aSelectColumns->get().begin()) + 1);
-
- // Ascending or Descending?
- m_aOrderbyAscending.push_back((SQL_ISTOKEN(pAscendingDescending,DESC)) ? SQL_DESC : SQL_ASC);
-}
-
-// -----------------------------------------------------------------------------
-void OStatement_Base::construct(const ::rtl::OUString& sql) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::construct" );
- ::rtl::OUString aErr;
- m_pParseTree = m_aParser.parseTree(aErr,sql);
- if(m_pParseTree)
- {
- m_aSQLIterator.setParseTree(m_pParseTree);
- m_aSQLIterator.traverseAll();
- const OSQLTables& xTabs = m_aSQLIterator.getTables();
-
- // sanity checks
- if ( xTabs.empty() )
- // no tables -> nothing to operate on -> error
- m_pConnection->throwGenericSQLException(STR_QUERY_NO_TABLE,*this);
-
- if ( xTabs.size() > 1 || m_aSQLIterator.hasErrors() )
- // more than one table -> can't operate on them -> error
- m_pConnection->throwGenericSQLException(STR_QUERY_MORE_TABLES,*this);
-
- if ( (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT) && m_aSQLIterator.getSelectColumns()->get().empty() )
- // SELECT statement without columns -> error
- m_pConnection->throwGenericSQLException(STR_QUERY_NO_COLUMN,*this);
-
- switch(m_aSQLIterator.getStatementType())
- {
- case SQL_STATEMENT_CREATE_TABLE:
- case SQL_STATEMENT_ODBC_CALL:
- case SQL_STATEMENT_UNKNOWN:
- m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this);
- break;
- default:
- break;
- }
-
- // at this moment we support only one table per select statement
- Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(xTabs.begin()->second,UNO_QUERY);
- if(xTunnel.is())
- {
- if(m_pTable)
- m_pTable->release();
- m_pTable = reinterpret_cast<OFileTable*>(xTunnel->getSomething(OFileTable::getUnoTunnelImplementationId()));
- if(m_pTable)
- m_pTable->acquire();
- }
- OSL_ENSURE(m_pTable,"No table!");
- if ( m_pTable )
- m_xColNames = m_pTable->getColumns();
- Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
- // set the binding of the resultrow
- m_aRow = new OValueRefVector(xNames->getCount());
- (m_aRow->get())[0]->setBound(sal_True);
- ::std::for_each(m_aRow->get().begin()+1,m_aRow->get().end(),TSetRefBound(sal_False));
-
- // set the binding of the resultrow
- m_aEvaluateRow = new OValueRefVector(xNames->getCount());
-
- (m_aEvaluateRow->get())[0]->setBound(sal_True);
- ::std::for_each(m_aEvaluateRow->get().begin()+1,m_aEvaluateRow->get().end(),TSetRefBound(sal_False));
-
- // set the select row
- m_aSelectRow = new OValueRefVector(m_aSQLIterator.getSelectColumns()->get().size());
- ::std::for_each(m_aSelectRow->get().begin(),m_aSelectRow->get().end(),TSetRefBound(sal_True));
-
- // create the column mapping
- createColumnMapping();
-
- m_pSQLAnalyzer = createAnalyzer();
-
- Reference<XIndexesSupplier> xIndexSup(xTunnel,UNO_QUERY);
- if(xIndexSup.is())
- m_pSQLAnalyzer->setIndexes(xIndexSup->getIndexes());
-
- anylizeSQL();
- }
- else
- throw SQLException(aErr,*this,::rtl::OUString(),0,Any());
-}
-// -----------------------------------------------------------------------------
-void OStatement_Base::createColumnMapping()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "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->get().size() + 1);
- for (sal_Int32 i=0; i<(sal_Int32)m_aColMapping.size(); ++i)
- m_aColMapping[i] = i;
-
- Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
- // now check which columns are bound
- OResultSet::setBoundedColumns(m_aRow,m_aSelectRow,xColumns,xNames,sal_True,m_xDBMetaData,m_aColMapping);
-}
-// -----------------------------------------------------------------------------
-void OStatement_Base::initializeResultSet(OResultSet* _pResult)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::initializeResultSet" );
- GetAssignValues();
-
- _pResult->setSqlAnalyzer(m_pSQLAnalyzer);
- _pResult->setOrderByColumns(m_aOrderbyColumnNumber);
- _pResult->setOrderByAscending(m_aOrderbyAscending);
- _pResult->setBindingRow(m_aRow);
- _pResult->setColumnMapping(m_aColMapping);
- _pResult->setEvaluationRow(m_aEvaluateRow);
- _pResult->setAssignValues(m_aAssignValues);
- _pResult->setSelectRow(m_aSelectRow);
-
- m_pSQLAnalyzer->bindSelectRow(m_aRow);
- m_pEvaluationKeySet = m_pSQLAnalyzer->bindEvaluationRow(m_aEvaluateRow); // Set values in the code of the Compiler
- _pResult->setEvaluationKeySet(m_pEvaluationKeySet);
-}
-// -----------------------------------------------------------------------------
-void OStatement_Base::GetAssignValues()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::GetAssignValues" );
- if (m_pParseTree == NULL)
- {
- ::dbtools::throwFunctionSequenceException(*this);
- return;
- }
-
- if (SQL_ISRULE(m_pParseTree,select_statement))
- // no values have to be set for SELECT
- return;
- else if (SQL_ISRULE(m_pParseTree,insert_statement))
- {
- // Create Row for the values to be set (Reference trough new)
- if(m_aAssignValues.is())
- m_aAssignValues->get().clear();
- sal_Int32 nCount = Reference<XIndexAccess>(m_xColNames,UNO_QUERY)->getCount();
- m_aAssignValues = new OAssignValues(nCount);
- // unbound all
- ::std::for_each(m_aAssignValues->get().begin()+1,m_aAssignValues->get().end(),TSetRefBound(sal_False));
-
- m_aParameterIndexes.resize(nCount+1,SQL_NO_PARAMETER);
-
- // List of Column-Names, that exist in the column_commalist (seperated by ;):
- ::std::vector<String> aColumnNameList;
-
- OSL_ENSURE(m_pParseTree->count() >= 4,"OResultSet: Fehler im Parse Tree");
-
- OSQLParseNode * pOptColumnCommalist = m_pParseTree->getChild(3);
- OSL_ENSURE(pOptColumnCommalist != NULL,"OResultSet: Fehler im Parse Tree");
- OSL_ENSURE(SQL_ISRULE(pOptColumnCommalist,opt_column_commalist),"OResultSet: Fehler im Parse Tree");
- if (pOptColumnCommalist->count() == 0)
- {
- const Sequence< ::rtl::OUString>& aNames = m_xColNames->getElementNames();
- const ::rtl::OUString* pBegin = aNames.getConstArray();
- const ::rtl::OUString* pEnd = pBegin + aNames.getLength();
- for (; pBegin != pEnd; ++pBegin)
- aColumnNameList.push_back(*pBegin);
- }
- else
- {
- OSL_ENSURE(pOptColumnCommalist->count() == 3,"OResultSet: Fehler im Parse Tree");
-
- OSQLParseNode * pColumnCommalist = pOptColumnCommalist->getChild(1);
- OSL_ENSURE(pColumnCommalist != NULL,"OResultSet: Fehler im Parse Tree");
- OSL_ENSURE(SQL_ISRULE(pColumnCommalist,column_commalist),"OResultSet: Fehler im Parse Tree");
- OSL_ENSURE(pColumnCommalist->count() > 0,"OResultSet: Fehler im Parse Tree");
-
- // All Columns in the column_commalist ...
- for (sal_uInt32 i = 0; i < pColumnCommalist->count(); i++)
- {
- OSQLParseNode * pCol = pColumnCommalist->getChild(i);
- OSL_ENSURE(pCol != NULL,"OResultSet: Fehler im Parse Tree");
- aColumnNameList.push_back(pCol->getTokenValue());
- }
- }
- if ( aColumnNameList.empty() )
- throwFunctionSequenceException(*this);
-
- // Values ...
- OSQLParseNode * pValuesOrQuerySpec = m_pParseTree->getChild(4);
- OSL_ENSURE(pValuesOrQuerySpec != NULL,"OResultSet: pValuesOrQuerySpec darf nicht NULL sein!");
- OSL_ENSURE(SQL_ISRULE(pValuesOrQuerySpec,values_or_query_spec),"OResultSet: ! SQL_ISRULE(pValuesOrQuerySpec,values_or_query_spec)");
- OSL_ENSURE(pValuesOrQuerySpec->count() > 0,"OResultSet: pValuesOrQuerySpec->count() <= 0");
-
- // just "VALUES" is allowed ...
- if (! SQL_ISTOKEN(pValuesOrQuerySpec->getChild(0),VALUES))
- throwFunctionSequenceException(*this);
-
- OSL_ENSURE(pValuesOrQuerySpec->count() == 4,"OResultSet: pValuesOrQuerySpec->count() != 4");
-
- // List of values
- OSQLParseNode * pInsertAtomCommalist = pValuesOrQuerySpec->getChild(2);
- OSL_ENSURE(pInsertAtomCommalist != NULL,"OResultSet: pInsertAtomCommalist darf nicht NULL sein!");
- OSL_ENSURE(pInsertAtomCommalist->count() > 0,"OResultSet: pInsertAtomCommalist <= 0");
-
- String aColumnName;
- OSQLParseNode * pRow_Value_Const;
- xub_StrLen nIndex=0;
- for (sal_uInt32 i = 0; i < pInsertAtomCommalist->count(); i++)
- {
- pRow_Value_Const = pInsertAtomCommalist->getChild(i); // row_value_constructor
- OSL_ENSURE(pRow_Value_Const != NULL,"OResultSet: pRow_Value_Const darf nicht NULL sein!");
- if(SQL_ISRULE(pRow_Value_Const,parameter))
- {
- ParseAssignValues(aColumnNameList,pRow_Value_Const,nIndex++); // only one Columnname allowed per loop
- }
- else if(pRow_Value_Const->isToken())
- ParseAssignValues(aColumnNameList,pRow_Value_Const,static_cast<xub_StrLen>(i));
- else
- {
- if(pRow_Value_Const->count() == aColumnNameList.size())
- {
- for (sal_uInt32 j = 0; j < pRow_Value_Const->count(); ++j)
- ParseAssignValues(aColumnNameList,pRow_Value_Const->getChild(j),nIndex++);
- }
- else
- throwFunctionSequenceException(*this);
- }
- }
- }
- else if (SQL_ISRULE(m_pParseTree,update_statement_searched))
- {
- if(m_aAssignValues.is())
- m_aAssignValues->get().clear();
- sal_Int32 nCount = Reference<XIndexAccess>(m_xColNames,UNO_QUERY)->getCount();
- m_aAssignValues = new OAssignValues(nCount);
- // unbound all
- ::std::for_each(m_aAssignValues->get().begin()+1,m_aAssignValues->get().end(),TSetRefBound(sal_False));
-
- m_aParameterIndexes.resize(nCount+1,SQL_NO_PARAMETER);
-
- OSL_ENSURE(m_pParseTree->count() >= 4,"OResultSet: Fehler im Parse Tree");
-
- OSQLParseNode * pAssignmentCommalist = m_pParseTree->getChild(3);
- OSL_ENSURE(pAssignmentCommalist != NULL,"OResultSet: pAssignmentCommalist == NULL");
- OSL_ENSURE(SQL_ISRULE(pAssignmentCommalist,assignment_commalist),"OResultSet: Fehler im Parse Tree");
- OSL_ENSURE(pAssignmentCommalist->count() > 0,"OResultSet: pAssignmentCommalist->count() <= 0");
-
- // work on all assignments (commalist) ...
- ::std::vector< String> aList(1);
- for (sal_uInt32 i = 0; i < pAssignmentCommalist->count(); i++)
- {
- OSQLParseNode * pAssignment = pAssignmentCommalist->getChild(i);
- OSL_ENSURE(pAssignment != NULL,"OResultSet: pAssignment == NULL");
- OSL_ENSURE(SQL_ISRULE(pAssignment,assignment),"OResultSet: Fehler im Parse Tree");
- OSL_ENSURE(pAssignment->count() == 3,"OResultSet: pAssignment->count() != 3");
-
- OSQLParseNode * pCol = pAssignment->getChild(0);
- OSL_ENSURE(pCol != NULL,"OResultSet: pCol == NULL");
-
- OSQLParseNode * pComp = pAssignment->getChild(1);
- OSL_ENSURE(pComp != NULL,"OResultSet: pComp == NULL");
- OSL_ENSURE(pComp->getNodeType() == SQL_NODE_EQUAL,"OResultSet: pComp->getNodeType() != SQL_NODE_COMPARISON");
- if (pComp->getTokenValue().toChar() != '=')
- {
- throwFunctionSequenceException(*this);
- }
-
- OSQLParseNode * pVal = pAssignment->getChild(2);
- OSL_ENSURE(pVal != NULL,"OResultSet: pVal == NULL");
- aList[0] = pCol->getTokenValue();
- ParseAssignValues(aList,pVal,0);
- }
-
- }
-}
-// -------------------------------------------------------------------------
-void OStatement_Base::ParseAssignValues(const ::std::vector< String>& aColumnNameList,OSQLParseNode* pRow_Value_Constructor_Elem,xub_StrLen nIndex)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::ParseAssignValues" );
- OSL_ENSURE(nIndex <= aColumnNameList.size(),"SdbFileCursor::ParseAssignValues: nIndex > aColumnNameList.GetTokenCount()");
- String aColumnName(aColumnNameList[nIndex]);
- OSL_ENSURE(aColumnName.Len() > 0,"OResultSet: Column-Name nicht gefunden");
- OSL_ENSURE(pRow_Value_Constructor_Elem != NULL,"OResultSet: pRow_Value_Constructor_Elem darf nicht NULL sein!");
-
- if (pRow_Value_Constructor_Elem->getNodeType() == SQL_NODE_STRING ||
- pRow_Value_Constructor_Elem->getNodeType() == SQL_NODE_INTNUM ||
- pRow_Value_Constructor_Elem->getNodeType() == SQL_NODE_APPROXNUM)
- {
- // set value:
- SetAssignValue(aColumnName, pRow_Value_Constructor_Elem->getTokenValue());
- }
- else if (SQL_ISTOKEN(pRow_Value_Constructor_Elem,NULL))
- {
- // set NULL
- SetAssignValue(aColumnName, String(), sal_True);
- }
- else if (SQL_ISRULE(pRow_Value_Constructor_Elem,parameter))
- parseParamterElem(aColumnName,pRow_Value_Constructor_Elem);
- else
- {
- throwFunctionSequenceException(*this);
- }
-}
-//------------------------------------------------------------------
-void OStatement_Base::SetAssignValue(const String& aColumnName,
- const String& aValue,
- sal_Bool bSetNull,
- sal_uInt32 nParameter)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::SetAssignValue" );
- Reference<XPropertySet> xCol;
- m_xColNames->getByName(aColumnName) >>= xCol;
- sal_Int32 nId = Reference<XColumnLocate>(m_xColNames,UNO_QUERY)->findColumn(aColumnName);
- // does this column actually exist in the file?
-
- if (!xCol.is())
- {
- // This Column doesn't exist!
- throwFunctionSequenceException(*this);
- }
-
-
- // Everything tested and we have the names of the Column.
- // Now allocate one Value, set the value and tie the value to the Row.
- if (bSetNull)
- (m_aAssignValues->get())[nId]->setNull();
- else
- {
- switch (::comphelper::getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))))
- {
- // put criteria depending on the Type as String or double in the variable
- case DataType::CHAR:
- case DataType::VARCHAR:
- case DataType::LONGVARCHAR:
- *(m_aAssignValues->get())[nId] = ORowSetValue(aValue);
- //Characterset is already converted, since the entire statement was converted
- break;
-
- case DataType::BIT:
- {
- if (aValue.EqualsIgnoreCaseAscii("TRUE") || aValue.GetChar(0) == '1')
- *(m_aAssignValues->get())[nId] = sal_True;
- else if (aValue.EqualsIgnoreCaseAscii("FALSE") || aValue.GetChar(0) == '0')
- *(m_aAssignValues->get())[nId] = sal_False;
- else
- {
- throwFunctionSequenceException(*this);
- }
- }
- break;
- case DataType::TINYINT:
- case DataType::SMALLINT:
- case DataType::INTEGER:
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- case DataType::REAL:
- case DataType::DOUBLE:
- case DataType::DATE:
- case DataType::TIME:
- case DataType::TIMESTAMP:
- {
- *(m_aAssignValues->get())[nId] = ORowSetValue(aValue);
- } break;
- default:
- throwFunctionSequenceException(*this);
- }
- }
-
- // save Parameter-No. (as User Data)
- // SQL_NO_PARAMETER = no Parameter.
- m_aAssignValues->setParameterIndex(nId,nParameter);
- if(nParameter != SQL_NO_PARAMETER)
- m_aParameterIndexes[nParameter] = nId;
-}
-// -----------------------------------------------------------------------------
-void OStatement_Base::parseParamterElem(const String& /*_sColumnName*/,OSQLParseNode* /*pRow_Value_Constructor_Elem*/)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::parseParamterElem" );
- // do nothing here
-}
-// =============================================================================
- } // namespace file
-// =============================================================================
-}// namespace connectivity
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx
deleted file mode 100644
index 490d9c7bef..0000000000
--- a/connectivity/source/drivers/file/FStringFunctions.cxx
+++ /dev/null
@@ -1,269 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "file/FStringFunctions.hxx"
-#include <rtl/ustrbuf.hxx>
-#include <rtl/logfile.hxx>
-
-using namespace connectivity;
-using namespace connectivity::file;
-//------------------------------------------------------------------
-ORowSetValue OOp_Upper::operate(const ORowSetValue& lhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Upper::operate" );
- if ( lhs.isNull() )
- return lhs;
-
- return lhs.getString().toAsciiUpperCase();
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Lower::operate(const ORowSetValue& lhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Lower::operate" );
- if ( lhs.isNull() )
- return lhs;
-
- return lhs.getString().toAsciiLowerCase();
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Ascii::operate(const ORowSetValue& lhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Ascii::operate" );
- if ( lhs.isNull() )
- return lhs;
- ::rtl::OString sStr(::rtl::OUStringToOString(lhs,RTL_TEXTENCODING_ASCII_US));
- sal_Int32 nAscii = sStr.toChar();
- return nAscii;
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_CharLength::operate(const ORowSetValue& lhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_CharLength::operate" );
- if ( lhs.isNull() )
- return lhs;
-
- return lhs.getString().getLength();
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Char::operate(const ::std::vector<ORowSetValue>& lhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Char::operate" );
- if ( lhs.empty() )
- return ORowSetValue();
-
- ::rtl::OUString sRet;
- ::std::vector<ORowSetValue>::const_reverse_iterator aIter = lhs.rbegin();
- ::std::vector<ORowSetValue>::const_reverse_iterator aEnd = lhs.rend();
- for (; aIter != aEnd; ++aIter)
- {
- if ( !aIter->isNull() )
- {
- sal_Char c = static_cast<sal_Char>(static_cast<sal_Int32>(*aIter));
-
- sRet += ::rtl::OUString(&c,1,RTL_TEXTENCODING_ASCII_US);
- }
- }
-
- return sRet;
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Concat::operate(const ::std::vector<ORowSetValue>& lhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Concat::operate" );
- if ( lhs.empty() )
- return ORowSetValue();
-
- ::rtl::OUStringBuffer sRet;
- ::std::vector<ORowSetValue>::const_reverse_iterator aIter = lhs.rbegin();
- ::std::vector<ORowSetValue>::const_reverse_iterator aEnd = lhs.rend();
- for (; aIter != aEnd; ++aIter)
- {
- if ( aIter->isNull() )
- return ORowSetValue();
-
- sRet.append(aIter->operator ::rtl::OUString());
- }
-
- return sRet.makeStringAndClear();
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Locate::operate(const ::std::vector<ORowSetValue>& lhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Locate::operate" );
- ::std::vector<ORowSetValue>::const_iterator aIter = lhs.begin();
- ::std::vector<ORowSetValue>::const_iterator aEnd = lhs.end();
- for (; aIter != aEnd; ++aIter)
- {
- if ( aIter->isNull() )
- return ORowSetValue();
- }
- if ( lhs.size() == 2 )
- return ::rtl::OUString::valueOf(lhs[0].getString().indexOf(lhs[1].getString())+1);
-
- else if ( lhs.size() != 3 )
- return ORowSetValue();
-
- return lhs[1].getString().indexOf(lhs[2].getString(),lhs[0]) + 1;
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_SubString::operate(const ::std::vector<ORowSetValue>& lhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_SubString::operate" );
- ::std::vector<ORowSetValue>::const_iterator aIter = lhs.begin();
- ::std::vector<ORowSetValue>::const_iterator aEnd = lhs.end();
- for (; aIter != aEnd; ++aIter)
- {
- if ( aIter->isNull() )
- return ORowSetValue();
- }
- if ( lhs.size() == 2 && static_cast<sal_Int32>(lhs[0]) >= sal_Int32(0) )
- return lhs[1].getString().copy(static_cast<sal_Int32>(lhs[0])-1);
-
- else if ( lhs.size() != 3 || static_cast<sal_Int32>(lhs[1]) < sal_Int32(0))
- return ORowSetValue();
-
- return lhs[2].getString().copy(static_cast<sal_Int32>(lhs[1])-1,lhs[0]);
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_LTrim::operate(const ORowSetValue& lhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_LTrim::operate" );
- if ( lhs.isNull() )
- return lhs;
-
- ::rtl::OUString sRet = lhs;
- ::rtl::OUString sNew = sRet.trim();
- return sRet.copy(sRet.indexOf(sNew));
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_RTrim::operate(const ORowSetValue& lhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_RTrim::operate" );
- if ( lhs.isNull() )
- return lhs;
-
- ::rtl::OUString sRet = lhs;
- ::rtl::OUString sNew = sRet.trim();
- return sRet.copy(0,sRet.lastIndexOf(sNew.getStr()[sNew.getLength()-1])+1);
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Space::operate(const ORowSetValue& lhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Space::operate" );
- if ( lhs.isNull() )
- return lhs;
-
- const sal_Char c = ' ';
- ::rtl::OUStringBuffer sRet;
- sal_Int32 nCount = lhs;
- for (sal_Int32 i=0; i < nCount; ++i)
- {
- sRet.appendAscii(&c,1);
- }
- return sRet.makeStringAndClear();
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Replace::operate(const ::std::vector<ORowSetValue>& lhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Replace::operate" );
- if ( lhs.size() != 3 )
- return ORowSetValue();
-
- ::rtl::OUString sStr = lhs[2];
- ::rtl::OUString sFrom = lhs[1];
- ::rtl::OUString sTo = lhs[0];
- sal_Int32 nIndexOf = sStr.indexOf(sFrom);
- while( nIndexOf != -1 )
- {
- sStr = sStr.replaceAt(nIndexOf,sFrom.getLength(),sTo);
- nIndexOf = sStr.indexOf(sFrom,nIndexOf + sTo.getLength());
- }
-
- return sStr;
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Repeat::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Repeat::operate" );
- if ( lhs.isNull() || rhs.isNull() )
- return lhs;
-
- ::rtl::OUString sRet;
- sal_Int32 nCount = rhs;
- for (sal_Int32 i=0; i < nCount; ++i)
- {
- sRet += lhs;
- }
- return sRet;
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Insert::operate(const ::std::vector<ORowSetValue>& lhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Insert::operate" );
- if ( lhs.size() != 4 )
- return ORowSetValue();
-
- ::rtl::OUString sStr = lhs[3];
-
- sal_Int32 nStart = static_cast<sal_Int32>(lhs[2]);
- if ( nStart < 1 )
- nStart = 1;
- return sStr.replaceAt(nStart-1,static_cast<sal_Int32>(lhs[1]),lhs[0]);
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Left::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Left::operate" );
- if ( lhs.isNull() || rhs.isNull() )
- return lhs;
-
- ::rtl::OUString sRet = lhs;
- sal_Int32 nCount = rhs;
- if ( nCount < 0 )
- return ORowSetValue();
- return sRet.copy(0,nCount);
-}
-//------------------------------------------------------------------
-ORowSetValue OOp_Right::operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_Right::operate" );
- if ( lhs.isNull() || rhs.isNull() )
- return lhs;
-
- sal_Int32 nCount = rhs;
- ::rtl::OUString sRet = lhs;
- if ( nCount < 0 || nCount >= sRet.getLength() )
- return ORowSetValue();
-
- return sRet.copy(sRet.getLength()-nCount,nCount);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/FTable.cxx b/connectivity/source/drivers/file/FTable.cxx
deleted file mode 100644
index 892a57ca35..0000000000
--- a/connectivity/source/drivers/file/FTable.cxx
+++ /dev/null
@@ -1,259 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <stdio.h>
-#include "file/FTable.hxx"
-#include "file/FColumns.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <unotools/ucbstreamhelper.hxx>
-#include <tools/debug.hxx>
-#include <rtl/logfile.hxx>
-
-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;
-
-DBG_NAME( file_OFileTable )
-OFileTable::OFileTable(sdbcx::OCollection* _pTables,OConnection* _pConnection)
-: OTable_TYPEDEF(_pTables,_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers())
- ,m_pConnection(_pConnection)
- ,m_pFileStream(NULL)
- ,m_nFilePos(0)
- ,m_pBuffer(NULL)
- ,m_nBufferSize(0)
- ,m_bWriteable(sal_False)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::OFileTable" );
- DBG_CTOR( file_OFileTable, NULL );
- construct();
- TStringVector aVector;
- // m_pColumns = new OColumns(this,m_aMutex,aVector);
- m_aColumns = new OSQLColumns();
-}
-// -------------------------------------------------------------------------
-OFileTable::OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description ,
- const ::rtl::OUString& _SchemaName,
- const ::rtl::OUString& _CatalogName
- ) : OTable_TYPEDEF(_pTables,_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers(),
- _Name,
- _Type,
- _Description,
- _SchemaName,
- _CatalogName)
- ,m_pConnection(_pConnection)
- ,m_pFileStream(NULL)
- ,m_nFilePos(0)
- ,m_pBuffer(NULL)
- ,m_nBufferSize(0)
- ,m_bWriteable(sal_False)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::OFileTable" );
- DBG_CTOR( file_OFileTable, NULL );
- m_aColumns = new OSQLColumns();
- construct();
- // refreshColumns();
-}
-// -------------------------------------------------------------------------
-OFileTable::~OFileTable( )
-{
- DBG_DTOR( file_OFileTable, NULL );
-}
-// -------------------------------------------------------------------------
-void OFileTable::refreshColumns()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::refreshColumns" );
- TStringVector aVector;
- Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(Any(),
- m_SchemaName,m_Name,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")));
-
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while(xResult->next())
- aVector.push_back(xRow->getString(4));
- }
-
- if(m_pColumns)
- m_pColumns->reFill(aVector);
- else
- m_pColumns = new OColumns(this,m_aMutex,aVector);
-}
-// -------------------------------------------------------------------------
-void OFileTable::refreshKeys()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::refreshKeys" );
-}
-// -------------------------------------------------------------------------
-void OFileTable::refreshIndexes()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::refreshIndexes" );
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OFileTable::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::queryInterface" );
- if( rType == ::getCppuType((const Reference<XKeysSupplier>*)0) ||
- rType == ::getCppuType((const Reference<XRename>*)0) ||
- rType == ::getCppuType((const Reference<XAlterTable>*)0) ||
- rType == ::getCppuType((const Reference<XIndexesSupplier>*)0) ||
- rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0))
- return Any();
-
- return OTable_TYPEDEF::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OFileTable::disposing(void)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::disposing" );
- OTable::disposing();
-
- ::osl::MutexGuard aGuard(m_aMutex);
-
- FileClose();
-}
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OFileTable::getUnoTunnelImplementationId()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::getUnoTunnelImplementationId" );
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OFileTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::getSomething" );
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : OTable_TYPEDEF::getSomething(rId);
-}
-// -----------------------------------------------------------------------------
-void OFileTable::FileClose()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::FileClose" );
- ::osl::MutexGuard aGuard(m_aMutex);
-
- if (m_pFileStream && m_pFileStream->IsWritable())
- m_pFileStream->Flush();
-
- delete m_pFileStream;
- m_pFileStream = NULL;
-
- if (m_pBuffer)
- {
- delete[] m_pBuffer;
- m_pBuffer = NULL;
- }
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OFileTable::acquire() throw()
-{
- OTable_TYPEDEF::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OFileTable::release() throw()
-{
- OTable_TYPEDEF::release();
-}
-// -----------------------------------------------------------------------------
-sal_Bool OFileTable::InsertRow(OValueRefVector& /*rRow*/, sal_Bool /*bFlush*/,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& /*_xCols*/)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::InsertRow" );
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OFileTable::DeleteRow(const OSQLColumns& /*_rCols*/)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::DeleteRow" );
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OFileTable::UpdateRow(OValueRefVector& /*rRow*/, OValueRefRow& /*pOrgRow*/,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& /*_xCols*/)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::UpdateRow" );
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-void OFileTable::addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& /*descriptor*/)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::addColumn" );
- OSL_FAIL( "OFileTable::addColumn: not implemented!" );
-}
-// -----------------------------------------------------------------------------
-void OFileTable::dropColumn(sal_Int32 /*_nPos*/)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::dropColumn" );
- OSL_FAIL( "OFileTable::addColumn: not implemented!" );
-}
-
-// -----------------------------------------------------------------------------
-SvStream* OFileTable::createStream_simpleError( const String& _rFileName, StreamMode _eOpenMode)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::createStream_simpleError" );
- utl::UcbLockBytesHandler* p_null_dummy=NULL;
- SvStream* pReturn = ::utl::UcbStreamHelper::CreateStream( _rFileName, _eOpenMode, (_eOpenMode & STREAM_NOCREATE) == STREAM_NOCREATE ,p_null_dummy);
- if (pReturn && (ERRCODE_NONE != pReturn->GetErrorCode()))
- {
- delete pReturn;
- pReturn = NULL;
- }
- return pReturn;
-}
-
-// -----------------------------------------------------------------------------
-void OFileTable::refreshHeader()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::refreshHeader" );
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/FTables.cxx b/connectivity/source/drivers/file/FTables.cxx
deleted file mode 100644
index c56cf59a66..0000000000
--- a/connectivity/source/drivers/file/FTables.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "file/FTables.hxx"
-#include "file/FTable.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include "file/FCatalog.hxx"
-#include "file/FConnection.hxx"
-
-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;
-
-namespace starutil = ::com::sun::star::util;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OTables::createObject(const ::rtl::OUString& /*_rName*/)
-{
- return sdbcx::ObjectType();
-}
-// -------------------------------------------------------------------------
-void OTables::impl_refresh( ) throw(RuntimeException)
-{
- static_cast<OFileCatalog&>(m_rParent).refreshTables();
-}
-// -------------------------------------------------------------------------
-void OTables::disposing(void)
-{
-m_xMetaData.clear();
- OCollection::disposing();
-}
-//------------------------------------------------------------------
-Any SAL_CALL OTables::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- if( rType == ::getCppuType((const Reference<XColumnLocate>*)0) ||
- rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0) ||
- rType == ::getCppuType((const Reference<XAppend>*)0) ||
- rType == ::getCppuType((const Reference<XDrop>*)0))
- return Any();
-
- typedef sdbcx::OCollection OTables_BASE;
- return OTables_BASE::queryInterface(rType);
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/fanalyzer.cxx b/connectivity/source/drivers/file/fanalyzer.cxx
deleted file mode 100644
index cbff002d24..0000000000
--- a/connectivity/source/drivers/file/fanalyzer.cxx
+++ /dev/null
@@ -1,343 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "file/fanalyzer.hxx"
-#include "connectivity/sqlparse.hxx"
-#include <osl/diagnose.h>
-#include <tools/debug.hxx>
-#include <comphelper/extract.hxx>
-#include "connectivity/sqlnode.hxx"
-#include "connectivity/dbexception.hxx"
-#include "file/FConnection.hxx"
-#include "resource/file_res.hrc"
-
-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;
-
-DBG_NAME( file_OSQLAnalyzer )
-//------------------------------------------------------------------
-OSQLAnalyzer::OSQLAnalyzer(OConnection* _pConnection)
- :m_pConnection(_pConnection)
- ,m_bHasSelectionCode(sal_False)
- ,m_bSelectionFirstTime(sal_True)
-{
- DBG_CTOR( file_OSQLAnalyzer, NULL );
- m_aCompiler = new OPredicateCompiler(this);
- m_aInterpreter = new OPredicateInterpreter(m_aCompiler);
-}
-
-// -----------------------------------------------------------------------------
-OSQLAnalyzer::~OSQLAnalyzer()
-{
- DBG_DTOR( file_OSQLAnalyzer, NULL );
-}
-
-// -----------------------------------------------------------------------------
-void OSQLAnalyzer::setIndexes(const Reference< XNameAccess>& _xIndexes)
-{
- m_aCompiler->m_xIndexes = _xIndexes;
-}
-//------------------------------------------------------------------
-void OSQLAnalyzer::start(OSQLParseNode* pSQLParseNode)
-{
- if (SQL_ISRULE(pSQLParseNode,select_statement))
- {
- DBG_ASSERT(pSQLParseNode->count() >= 4,"OFILECursor: Fehler im Parse Tree");
-
- // check that we don't use anything other than count(*) as function
- OSQLParseNode* pSelection = pSQLParseNode->getChild(2);
- if ( SQL_ISRULE(pSelection,scalar_exp_commalist) )
- {
- for (sal_uInt32 i = 0; i < pSelection->count(); i++)
- {
- OSQLParseNode *pColumnRef = pSelection->getChild(i)->getChild(0);
- if ( ( SQL_ISRULE(pColumnRef,set_fct_spec) && pColumnRef->count() == 4 )
- || SQL_ISRULE(pColumnRef,char_value_fct)
- || SQL_ISRULE(pColumnRef,char_substring_fct)
- || SQL_ISRULE(pColumnRef,position_exp)
- || SQL_ISRULE(pColumnRef,fold)
- || SQL_ISRULE(pColumnRef,length_exp)
- || SQL_ISRULE(pColumnRef,num_value_exp)
- || SQL_ISRULE(pColumnRef,term)
- || SQL_ISRULE(pColumnRef,factor)
- || SQL_ISRULE(pColumnRef,set_fct_spec) )
- {
- ::rtl::Reference<OPredicateCompiler> pCompiler = new OPredicateCompiler(this);
- pCompiler->setOrigColumns(m_aCompiler->getOrigColumns());
- ::rtl::Reference<OPredicateInterpreter> pInterpreter = new OPredicateInterpreter(pCompiler);
- pCompiler->execute( pColumnRef );
- m_aSelectionEvaluations.push_back( TPredicates(pCompiler,pInterpreter) );
- }
- else if ( ( SQL_ISRULE(pColumnRef,general_set_fct) && pColumnRef->count() != 4 ) )
- {
- m_pConnection->throwGenericSQLException(STR_QUERY_COMPLEX_COUNT,NULL);
- }
- else
- {
- if ( SQL_ISPUNCTUATION( pColumnRef, "*" )
- || ( SQL_ISRULE( pColumnRef, column_ref )
- && ( pColumnRef->count() == 3 )
- && ( pColumnRef->getChild(0)->getNodeType() == SQL_NODE_NAME )
- && SQL_ISPUNCTUATION( pColumnRef->getChild(1), "." )
- && SQL_ISRULE( pColumnRef->getChild(2), column_val )
- && SQL_ISPUNCTUATION( pColumnRef->getChild(2)->getChild(0), "*" )
- )
- )
- {
- // push one element for each column of our table
- const Reference< XNameAccess > xColumnNames( m_aCompiler->getOrigColumns() );
- const Sequence< ::rtl::OUString > aColumnNames( xColumnNames->getElementNames() );
- for ( sal_Int32 j=0; j<aColumnNames.getLength(); ++j )
- m_aSelectionEvaluations.push_back( TPredicates() );
- }
- else
- m_aSelectionEvaluations.push_back( TPredicates() );
- }
- }
- }
- }
-
- m_aCompiler->start(pSQLParseNode);
-}
-
-//------------------------------------------------------------------
-void OSQLAnalyzer::bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow,OEvaluateSetList& _rEvaluateSetList)
-{
- // count criteria
- // if only one criterion, and the corresponding field is indexed
- // then the index will be used
- OEvaluateSet* pEvaluateSet = NULL;
-
- for (OCodeList::iterator aIter = rCodeList.begin(); aIter != rCodeList.end(); ++aIter)
- {
- OOperandAttr* pAttr = PTR_CAST(OOperandAttr,(*aIter));
- if (pAttr)
- {
- if (pAttr->isIndexed() && !m_aCompiler->hasORCondition())
- {
- OCode* pCode1 = *(aIter + 1);
- OCode* pCode2 = *(aIter + 2);
-
- if (PTR_CAST(OOperand,pCode1))
- pEvaluateSet = pAttr->preProcess(PTR_CAST(OBoolOperator,pCode2), PTR_CAST(OOperand,pCode1));
- else
- pEvaluateSet = pAttr->preProcess(PTR_CAST(OBoolOperator,pCode1));
- }
-
- if (pEvaluateSet)
- {
- _rEvaluateSetList.push_back(pEvaluateSet);
- pEvaluateSet = NULL;
- }
- pAttr->bindValue(_pRow);
- }
- }
-}
-//------------------------------------------------------------------
-void OSQLAnalyzer::bindSelectRow(const OValueRefRow& _pRow)
-{
- // first the select part
- OEvaluateSetList aEvaluateSetList;
- for ( ::std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter)
- {
- if ( aIter->first.is() )
- bindRow( aIter->first->m_aCodeList,_pRow,aEvaluateSetList);
- }
-}
-//------------------------------------------------------------------
-::std::vector<sal_Int32>* OSQLAnalyzer::bindEvaluationRow(OValueRefRow& _pRow)
-{
- OEvaluateSetList aEvaluateSetList;
- bindRow( m_aCompiler->m_aCodeList,_pRow,aEvaluateSetList);
-
- ::std::vector<sal_Int32>* pKeySet = NULL;
- OEvaluateSet* pEvaluateSet = NULL;
-
- // create Keyset with smallest list
- if(!aEvaluateSetList.empty())
- {
- // which list has the smallest count?
- OEvaluateSetList::iterator i = aEvaluateSetList.begin();
- pEvaluateSet = *(i);
- for(++i; i != aEvaluateSetList.end();++i)
- {
- OEvaluateSet* pEvaluateSetComp = (*i);
- for(OEvaluateSet::reverse_iterator j = pEvaluateSet->rbegin(); j != pEvaluateSet->rend(); ++j)
- {
- if (pEvaluateSetComp->find(j->second) != pEvaluateSetComp->end())
- pEvaluateSet->erase(j->second);
- }
- }
- pKeySet = new ::std::vector<sal_Int32>(pEvaluateSet->size());
- sal_Int32 k=0;
- for(OEvaluateSet::iterator j = pEvaluateSet->begin(); j != pEvaluateSet->end(); ++j,++k)
- {
- (*pKeySet)[k] = j->second;
- }
-
- // delete all
- for(i = aEvaluateSetList.begin(); i != aEvaluateSetList.end();++i)
- delete (*i);
- }
-
- return pKeySet;
-}
-
-//------------------------------------------------------------------
-void OSQLAnalyzer::describeParam(::rtl::Reference<OSQLColumns> rParameterColumns)
-{
- OCodeList& rCodeList = m_aCompiler->m_aCodeList;
- OCodeStack aCodeStack;
-
- if (!rCodeList.size())
- return; // no predicate
- if (!rParameterColumns->get().size())
- return; // no parameters
-
- // Create columns, that have a more precise description for the included
- ::rtl::Reference<OSQLColumns> aNewParamColumns = new OSQLColumns(*rParameterColumns);
-
-
- // Create a Test-row, is needed to describe the parameters
- OValueRefRow aParameterRow = new OValueRefVector(rParameterColumns->get().size());
- bindParameterRow(aParameterRow);
-
- OValueRefRow aTestRow = new OValueRefVector(Reference< XIndexAccess>(m_aCompiler->getOrigColumns(),UNO_QUERY)->getCount());
- delete bindEvaluationRow(aTestRow); // Bind the attributes to the values
-
- for(OCodeList::iterator aIter = rCodeList.begin(); aIter != rCodeList.end(); ++aIter)
- {
- OOperand* pOperand = PTR_CAST(OOperand,(*aIter));
- OOperator* pOperator = PTR_CAST(OOperator,(*aIter));
- if (pOperand)
- aCodeStack.push(pOperand);
- else
- {
- if (pOperator->getRequestedOperands() == 2) // with two Operands it is possible
- { // to specify one parameter better
- OOperandParam *pParam = PTR_CAST(OOperandParam,aCodeStack.top());
- if (pParam) // adjust the Parameter-types, if the left Operand is an attribute
- {
- OOperandAttr *pLeft = PTR_CAST(OOperandAttr,*(rCodeList.end() - 2));
- if (pLeft)
- {
- Reference< XPropertySet> xCol;
- Reference< XIndexAccess>(m_aCompiler->getOrigColumns(),UNO_QUERY)->getByIndex(pLeft->getRowPos()) >>= xCol;
- OSL_ENSURE(xCol.is(), "Ungueltige Struktur");
- pParam->describe(xCol, aNewParamColumns);
- }
- }
- }
- pOperator->Exec(aCodeStack);
- }
- }
- OOperand* pOperand = aCodeStack.top();
- aCodeStack.pop();
-
- OSL_ENSURE(aCodeStack.size() == 0, "StackFehler");
- OSL_ENSURE(pOperand, "StackFehler");
- if (IS_TYPE(OOperandResult,pOperand))
- delete pOperand;
- else
- OSL_FAIL("Illegal here!");
-
- rParameterColumns = aNewParamColumns;
-}
-
-// -----------------------------------------------------------------------------
-OOperandAttr* OSQLAnalyzer::createOperandAttr(sal_Int32 _nPos,
- const Reference< XPropertySet>& _xCol,
- const Reference< XNameAccess>& /*_xIndexes*/)
-{
- return new OOperandAttr(static_cast<sal_uInt16>(_nPos),_xCol);
-}
-// -----------------------------------------------------------------------------
-sal_Bool OSQLAnalyzer::hasRestriction() const
-{
- return m_aCompiler->hasCode();
-}
-// -----------------------------------------------------------------------------
-sal_Bool OSQLAnalyzer::hasFunctions() const
-{
- if ( m_bSelectionFirstTime )
- {
- m_bSelectionFirstTime = sal_False;
- for ( ::std::vector< TPredicates >::const_iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end() && !m_bHasSelectionCode ;++aIter)
- {
- if ( aIter->first.is() )
- m_bHasSelectionCode = aIter->first->hasCode();
- }
- }
- return m_bHasSelectionCode;;
-}
-// -----------------------------------------------------------------------------
-void OSQLAnalyzer::setSelectionEvaluationResult(OValueRefRow& _pRow,const ::std::vector<sal_Int32>& _rColumnMapping)
-{
- sal_Int32 nPos = 1;
- for ( ::std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter,++nPos)
- {
- if ( aIter->second.is() )
- {
- // the first column (index 0) is for convenience only. The first real select column is no 1.
- sal_Int32 map = nPos;
- if ( nPos < static_cast< sal_Int32 >( _rColumnMapping.size() ) )
- map = _rColumnMapping[nPos];
- if ( map > 0 )
- aIter->second->startSelection( (_pRow->get())[map] );
- }
- }
-}
-// -----------------------------------------------------------------------------
-void OSQLAnalyzer::dispose()
-{
- m_aCompiler->dispose();
- for ( ::std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter)
- {
- if ( aIter->first.is() )
- aIter->first->dispose();
- }
-}
-// -----------------------------------------------------------------------------
-void OSQLAnalyzer::setOrigColumns(const OFileColumns& rCols)
-{
- m_aCompiler->setOrigColumns(rCols);
- for ( ::std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter)
- {
- if ( aIter->first.is() )
- aIter->first->setOrigColumns(rCols);
- }
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx
deleted file mode 100644
index ad8662c7d0..0000000000
--- a/connectivity/source/drivers/file/fcode.cxx
+++ /dev/null
@@ -1,514 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "file/fcode.hxx"
-#include <osl/diagnose.h>
-#include "connectivity/sqlparse.hxx"
-#include <i18npool/mslangid.hxx>
-#include <tools/debug.hxx>
-#include <tools/string.hxx>
-#include "TConnection.hxx"
-#include <com/sun/star/sdb/SQLFilterOperator.hpp>
-#include <comphelper/types.hxx>
-#include <com/sun/star/sdb/SQLFilterOperator.hpp>
-#include <rtl/logfile.hxx>
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::file;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdb;
-
-TYPEINIT0(OCode);
-TYPEINIT1(OOperand, OCode);
-TYPEINIT1(OOperandRow, OOperand);
-TYPEINIT1(OOperandAttr, OOperandRow);
-TYPEINIT1(OOperandParam, OOperandRow);
-TYPEINIT1(OOperandValue, OOperand);
-TYPEINIT1(OOperandConst, OOperandValue);
-TYPEINIT1(OOperandResult, OOperandValue);
-TYPEINIT1(OStopOperand, OOperandValue);
-
-TYPEINIT1(OOperator, OCode);
-TYPEINIT1(OBoolOperator,OOperator);
-TYPEINIT1(OOp_NOT, OBoolOperator);
-TYPEINIT1(OOp_AND, OBoolOperator);
-TYPEINIT1(OOp_OR, OBoolOperator);
-TYPEINIT1(OOp_ISNULL, OBoolOperator);
-TYPEINIT1(OOp_ISNOTNULL, OOp_ISNULL);
-TYPEINIT1(OOp_LIKE, OBoolOperator);
-TYPEINIT1(OOp_NOTLIKE, OOp_LIKE);
-TYPEINIT1(OOp_COMPARE, OBoolOperator);
-TYPEINIT1(ONumOperator, OOperator);
-TYPEINIT1(ONthOperator, OOperator);
-TYPEINIT1(OBinaryOperator, OOperator);
-TYPEINIT1(OUnaryOperator, OOperator);
-
-//------------------------------------------------------------------
-DBG_NAME(OCode )
-OCode::OCode()
-{
- DBG_CTOR(OCode ,NULL);
-}
-// -----------------------------------------------------------------------------
-OCode::~OCode()
-{
- DBG_DTOR(OCode,NULL);
-}
-
-//------------------------------------------------------------------
-OEvaluateSet* OOperand::preProcess(OBoolOperator* /*pOp*/, OOperand* /*pRight*/)
-{
- return NULL;
-}
-// -----------------------------------------------------------------------------
-OOperandRow::OOperandRow(sal_uInt16 _nPos, sal_Int32 _rType)
- : OOperand(_rType)
- , m_nRowPos(_nPos)
-{}
-//------------------------------------------------------------------
-void OOperandRow::bindValue(const OValueRefRow& _pRow)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandRow::OOperandRow" );
- OSL_ENSURE(_pRow.is(),"NO EMPTY row allowed!");
- m_pRow = _pRow;
- OSL_ENSURE(m_pRow.is() && m_nRowPos < m_pRow->get().size(),"Invalid RowPos is >= vector.size()");
- (m_pRow->get())[m_nRowPos]->setBound(sal_True);
-}
-// -----------------------------------------------------------------------------
-void OOperandRow::setValue(const ORowSetValue& _rVal)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandRow::setValue" );
- OSL_ENSURE(m_pRow.is() && m_nRowPos < m_pRow->get().size(),"Invalid RowPos is >= vector.size()");
- (*(m_pRow->get())[m_nRowPos]) = _rVal;
-}
-//------------------------------------------------------------------
-const ORowSetValue& OOperandRow::getValue() const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandRow::getValue" );
- OSL_ENSURE(m_pRow.is() && m_nRowPos < m_pRow->get().size(),"Invalid RowPos is >= vector.size()");
- return (m_pRow->get())[m_nRowPos]->getValue();
-}
-
-// -----------------------------------------------------------------------------
-void OOperandValue::setValue(const ORowSetValue& _rVal)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandValue::setValue" );
- m_aValue = _rVal;
-}
-// -------------------------------------------------------------------------
-sal_Bool OOperandAttr::isIndexed() const
-{
- return sal_False;
-}
-//------------------------------------------------------------------
-OOperandParam::OOperandParam(OSQLParseNode* pNode, sal_Int32 _nPos)
- : OOperandRow(static_cast<sal_uInt16>(_nPos), DataType::VARCHAR) // Standard-Type
-{
- OSL_ENSURE(SQL_ISRULE(pNode,parameter),"Argument ist kein Parameter");
- OSL_ENSURE(pNode->count() > 0,"Fehler im Parse Tree");
- OSQLParseNode *pMark = pNode->getChild(0);
-
- String aParameterName;
- if (SQL_ISPUNCTUATION(pMark,"?"))
- aParameterName = '?';
- else if (SQL_ISPUNCTUATION(pMark,":"))
- aParameterName = pNode->getChild(1)->getTokenValue();
- else
- {
- OSL_FAIL("Fehler im Parse Tree");
- }
-
- // set up Parameter-Column with default type, can be specified more precisely later using Describe-Parameter
-
- // save Identity (not escpecially necessary here, just for the sake of symmetry)
-
- // todo
- // OColumn* pColumn = new OFILEColumn(aParameterName,eDBType,255,0,SQL_FLAGS_NULLALLOWED);
- // rParamColumns->AddColumn(pColumn);
-
- // the value will be set just before the evaluation
-}
-
-
-//------------------------------------------------------------------
-const ORowSetValue& OOperandValue::getValue() const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandValue::getValue" );
- return m_aValue;
-}
-
-//------------------------------------------------------------------
-OOperandConst::OOperandConst(const OSQLParseNode& rColumnRef, const rtl::OUString& aStrValue)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandConst::OOperandConst" );
- switch (rColumnRef.getNodeType())
- {
- case SQL_NODE_STRING:
- m_aValue = aStrValue;
- m_eDBType = DataType::VARCHAR;
- m_aValue.setBound(sal_True);
- return;
- case SQL_NODE_INTNUM:
- case SQL_NODE_APPROXNUM:
- {
- m_aValue = aStrValue.toDouble();
- m_eDBType = DataType::DOUBLE;
- m_aValue.setBound(sal_True);
- return;
- }
- default:
- break;
- }
-
- if (SQL_ISTOKEN(&rColumnRef,TRUE))
- {
- m_aValue = 1.0;
- m_eDBType = DataType::BIT;
- }
- else if (SQL_ISTOKEN(&rColumnRef,FALSE))
- {
- m_aValue = 0.0;
- m_eDBType = DataType::BIT;
- }
- else
- {
- OSL_FAIL("Parse Error");
- }
- m_aValue.setBound(sal_True);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Implementation of the operators
-
-//------------------------------------------------------------------
-sal_uInt16 OOperator::getRequestedOperands() const {return 2;}
-
-//------------------------------------------------------------------
-sal_Bool OBoolOperator::operate(const OOperand*, const OOperand*) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OBoolOperator::operate" );
- return sal_False;
-}
-
-
-//------------------------------------------------------------------
-void OBoolOperator::Exec(OCodeStack& rCodeStack)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OBoolOperator::Exec" );
- OOperand *pRight = rCodeStack.top();
- rCodeStack.pop();
- OOperand *pLeft = rCodeStack.top();
- rCodeStack.pop();
-
- rCodeStack.push(new OOperandResultBOOL(operate(pLeft, pRight)));
- if (IS_TYPE(OOperandResult,pLeft))
- delete pLeft;
- if (IS_TYPE(OOperandResult,pRight))
- delete pRight;
-}
-//------------------------------------------------------------------
-sal_Bool OOp_NOT::operate(const OOperand* pLeft, const OOperand* ) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_AND::operate" );
- return !pLeft->isValid();
-}
-//------------------------------------------------------------------
-void OOp_NOT::Exec(OCodeStack& rCodeStack)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::Exec" );
- OOperand* pOperand = rCodeStack.top();
- rCodeStack.pop();
-
- rCodeStack.push(new OOperandResultBOOL(operate(pOperand)));
- if (IS_TYPE(OOperandResult,pOperand))
- delete pOperand;
-}
-//------------------------------------------------------------------
-sal_uInt16 OOp_NOT::getRequestedOperands() const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_NOT::getRequestedOperands" );
- return 1;
-}
-
-//------------------------------------------------------------------
-sal_Bool OOp_AND::operate(const OOperand* pLeft, const OOperand* pRight) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_AND::operate" );
- return pLeft->isValid() && pRight->isValid();
-}
-
-//------------------------------------------------------------------
-sal_Bool OOp_OR::operate(const OOperand* pLeft, const OOperand* pRight) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_OR::operate" );
- return pLeft->isValid() || pRight->isValid();
-}
-
-//------------------------------------------------------------------
-sal_uInt16 OOp_ISNULL::getRequestedOperands() const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::getRequestedOperands" );
- return 1;
-}
-
-//------------------------------------------------------------------
-void OOp_ISNULL::Exec(OCodeStack& rCodeStack)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::Exec" );
- OOperand* pOperand = rCodeStack.top();
- rCodeStack.pop();
-
- rCodeStack.push(new OOperandResultBOOL(operate(pOperand)));
- if (IS_TYPE(OOperandResult,pOperand))
- delete pOperand;
-}
-
-//------------------------------------------------------------------
-sal_Bool OOp_ISNULL::operate(const OOperand* pOperand, const OOperand*) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::operate" );
- return pOperand->getValue().isNull();
-}
-
-//------------------------------------------------------------------
-sal_Bool OOp_ISNOTNULL::operate(const OOperand* pOperand, const OOperand*) const
-{
- return !OOp_ISNULL::operate(pOperand);
-}
-
-//------------------------------------------------------------------
-sal_Bool OOp_LIKE::operate(const OOperand* pLeft, const OOperand* pRight) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::operate" );
- sal_Bool bMatch;
- ORowSetValue aLH(pLeft->getValue());
- ORowSetValue aRH(pRight->getValue());
-
- if (aLH.isNull() || aRH.isNull())
- bMatch = sal_False;
- else
- {
- bMatch = match(aRH.getString(), aLH.getString(), cEscape);
- }
- return bMatch;
-}
-
-//------------------------------------------------------------------
-sal_Bool OOp_NOTLIKE::operate(const OOperand* pLeft, const OOperand* pRight) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_NOTLIKE::operate" );
- return !OOp_LIKE::operate(pLeft, pRight);
-}
-
-//------------------------------------------------------------------
-sal_Bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_COMPARE::operate" );
- ORowSetValue aLH(pLeft->getValue());
- ORowSetValue aRH(pRight->getValue());
-
- if (aLH.isNull() || aRH.isNull()) // if (!aLH.getValue() || !aRH.getValue())
- return sal_False;
-
- sal_Bool bResult = sal_False;
- sal_Int32 eDBType = pLeft->getDBType();
-
- // Comparison (depending on Data-type):
- switch (eDBType)
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- case DataType::LONGVARCHAR:
- {
- rtl::OUString sLH = aLH, sRH = aRH;
- sal_Int32 nRes = rtl_ustr_compareIgnoreAsciiCase_WithLength
- (
- sLH.pData->buffer,
- sLH.pData->length,
- sRH.pData->buffer,
- sRH.pData->length );
- switch(aPredicateType)
- {
- case SQLFilterOperator::EQUAL: bResult = (nRes == 0); break;
- case SQLFilterOperator::NOT_EQUAL: bResult = (nRes != 0); break;
- case SQLFilterOperator::LESS: bResult = (nRes < 0); break;
- case SQLFilterOperator::LESS_EQUAL: bResult = (nRes <= 0); break;
- case SQLFilterOperator::GREATER: bResult = (nRes > 0); break;
- case SQLFilterOperator::GREATER_EQUAL: bResult = (nRes >= 0); break;
- default: bResult = sal_False;
- }
- } break;
- case DataType::TINYINT:
- case DataType::SMALLINT:
- case DataType::INTEGER:
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- case DataType::REAL:
- case DataType::DOUBLE:
- case DataType::BIT:
- case DataType::TIMESTAMP:
- case DataType::DATE:
- case DataType::TIME:
- {
- double n = aLH ,m = aRH;
-
- switch (aPredicateType)
- {
- case SQLFilterOperator::EQUAL: bResult = (n == m); break;
- case SQLFilterOperator::LIKE: bResult = (n == m); break;
- case SQLFilterOperator::NOT_EQUAL: bResult = (n != m); break;
- case SQLFilterOperator::NOT_LIKE: bResult = (n != m); break;
- case SQLFilterOperator::LESS: bResult = (n < m); break;
- case SQLFilterOperator::LESS_EQUAL: bResult = (n <= m); break;
- case SQLFilterOperator::GREATER: bResult = (n > m); break;
- case SQLFilterOperator::GREATER_EQUAL: bResult = (n >= m); break;
- default: bResult = sal_False;
- }
- } break;
- default:
- bResult = aLH == aRH;
- }
- return bResult;
-}
-
-//------------------------------------------------------------------
-void ONumOperator::Exec(OCodeStack& rCodeStack)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ONumOperator::Exec" );
-
- OOperand *pRight = rCodeStack.top();
- rCodeStack.pop();
- OOperand *pLeft = rCodeStack.top();
- rCodeStack.pop();
-
- rCodeStack.push(new OOperandResultNUM(operate(pLeft->getValue(), pRight->getValue())));
- if (IS_TYPE(OOperandResult,pLeft))
- delete pLeft;
- if (IS_TYPE(OOperandResult,pRight))
- delete pRight;
-}
-//------------------------------------------------------------------
-double OOp_ADD::operate(const double& fLeft,const double& fRight) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ADD::operate" );
- return fLeft + fRight;
-}
-
-//------------------------------------------------------------------
-double OOp_SUB::operate(const double& fLeft,const double& fRight) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_SUB::operate" );
- return fLeft - fRight;
-}
-
-//------------------------------------------------------------------
-double OOp_MUL::operate(const double& fLeft,const double& fRight) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_MUL::operate" );
- return fLeft * fRight;
-}
-
-//------------------------------------------------------------------
-double OOp_DIV::operate(const double& fLeft,const double& fRight) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_DIV::operate" );
- return fLeft / fRight;
-}
-// -----------------------------------------------------------------------------
-OEvaluateSet* OOperandAttr::preProcess(OBoolOperator* /*pOp*/, OOperand* /*pRight*/)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandAttr::preProcess" );
- return NULL;
-}
-//------------------------------------------------------------------
-void ONthOperator::Exec(OCodeStack& rCodeStack)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ONthOperator::Exec" );
- ::std::vector<ORowSetValue> aValues;
- ::std::vector<OOperand*> aOperands;
- OOperand* pOperand;
- do
- {
- OSL_ENSURE(!rCodeStack.empty(),"Stack must be none empty!");
- pOperand = rCodeStack.top();
- rCodeStack.pop();
- if ( !IS_TYPE(OStopOperand,pOperand) )
- aValues.push_back( pOperand->getValue() );
- aOperands.push_back( pOperand );
- }
- while ( !IS_TYPE(OStopOperand,pOperand) );
-
- rCodeStack.push(new OOperandResult(operate(aValues)));
-
- ::std::vector<OOperand*>::iterator aIter = aOperands.begin();
- ::std::vector<OOperand*>::iterator aEnd = aOperands.end();
- for (; aIter != aEnd; ++aIter)
- {
- if (IS_TYPE(OOperandResult,*aIter))
- delete *aIter;
- }
-}
-//------------------------------------------------------------------
-void OBinaryOperator::Exec(OCodeStack& rCodeStack)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OBinaryOperator::Exec" );
- OOperand *pRight = rCodeStack.top();
- rCodeStack.pop();
- OOperand *pLeft = rCodeStack.top();
- rCodeStack.pop();
-
- if ( !rCodeStack.empty() && IS_TYPE(OStopOperand,rCodeStack.top()) )
- rCodeStack.pop();
-
- rCodeStack.push(new OOperandResult(operate(pLeft->getValue(),pRight->getValue())));
- if (IS_TYPE(OOperandResult,pRight))
- delete pRight;
- if (IS_TYPE(OOperandResult,pLeft))
- delete pLeft;
-}
-//------------------------------------------------------------------
-void OUnaryOperator::Exec(OCodeStack& rCodeStack)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OUnaryOperator::Exec" );
- OSL_ENSURE(!rCodeStack.empty(),"Stack is empty!");
- OOperand* pOperand = rCodeStack.top();
- rCodeStack.pop();
-
- rCodeStack.push(new OOperandResult(operate(pOperand->getValue())));
- if (IS_TYPE(OOperandResult,pOperand))
- delete pOperand;
-}
-// -----------------------------------------------------------------------------
-sal_uInt16 OUnaryOperator::getRequestedOperands() const {return 1;}
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx
deleted file mode 100644
index fd7ce73c93..0000000000
--- a/connectivity/source/drivers/file/fcomp.cxx
+++ /dev/null
@@ -1,925 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "file/fcomp.hxx"
-#include <tools/debug.hxx>
-#include "TConnection.hxx"
-#include "connectivity/sqlparse.hxx"
-#include "file/fanalyzer.hxx"
-#include <com/sun/star/sdbc/XColumnLocate.hpp>
-#include <com/sun/star/util/DateTime.hpp>
-#include <com/sun/star/util/Date.hpp>
-#include <com/sun/star/util/Time.hpp>
-#include "connectivity/dbexception.hxx"
-#include "connectivity/dbconversion.hxx"
-#include <com/sun/star/sdb/SQLFilterOperator.hpp>
-#include "resource/file_res.hrc"
-#include "file/FStringFunctions.hxx"
-#include "file/FDateFunctions.hxx"
-#include "file/FNumericFunctions.hxx"
-#include "file/FConnection.hxx"
-#include <com/sun/star/sdb/SQLFilterOperator.hpp>
-
-using namespace connectivity;
-using namespace connectivity::file;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::sdb;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
-
-DBG_NAME(OPredicateCompiler)
-//------------------------------------------------------------------
-OPredicateCompiler::OPredicateCompiler(OSQLAnalyzer* pAnalyzer)//,OCursor& rCurs)
- : m_pAnalyzer(pAnalyzer)
- , m_nParamCounter(0)
- , m_bORCondition(sal_False)
-{
- DBG_CTOR(OPredicateCompiler,NULL);
-}
-
-//------------------------------------------------------------------
-OPredicateCompiler::~OPredicateCompiler()
-{
- Clean();
- DBG_DTOR(OPredicateCompiler,NULL);
-}
-// -----------------------------------------------------------------------------
-void OPredicateCompiler::dispose()
-{
- Clean();
- m_orgColumns = NULL;
-m_xIndexes.clear();
-}
-
-void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode)
-{
- if (!pSQLParseNode)
- return;
-
- m_nParamCounter = 0;
- // analyse Parse Tree (depending on Statement-type)
- // and set pointer on WHERE-clause:
- OSQLParseNode * pWhereClause = NULL;
- OSQLParseNode * pOrderbyClause = NULL;
-
- if (SQL_ISRULE(pSQLParseNode,select_statement))
- {
- DBG_ASSERT(pSQLParseNode->count() >= 4,"OFILECursor: Fehler im Parse Tree");
-
- OSQLParseNode * pTableExp = pSQLParseNode->getChild(3);
- DBG_ASSERT(pTableExp != NULL,"Fehler im Parse Tree");
- DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp)," Fehler im Parse Tree");
- DBG_ASSERT(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"Fehler im Parse Tree");
-
- // check that we don't use anything other than count(*) as function
- OSQLParseNode* pSelection = pSQLParseNode->getChild(2);
- if ( SQL_ISRULE(pSelection,scalar_exp_commalist) )
- {
- for (sal_uInt32 i = 0; i < pSelection->count(); i++)
- {
- OSQLParseNode *pColumnRef = pSelection->getChild(i)->getChild(0);
- if ( SQL_ISRULE(pColumnRef,general_set_fct) && pColumnRef->count() != 4 )
- {
- m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_COMPLEX_COUNT,NULL);
- }
- }
- }
-
-
- pWhereClause = pTableExp->getChild(1);
- pOrderbyClause = pTableExp->getChild(ORDER_BY_CHILD_POS);
- (void)pOrderbyClause;
- }
- else if (SQL_ISRULE(pSQLParseNode,update_statement_searched))
- {
- DBG_ASSERT(pSQLParseNode->count() == 5,"OFILECursor: Fehler im Parse Tree");
- pWhereClause = pSQLParseNode->getChild(4);
- }
- else if (SQL_ISRULE(pSQLParseNode,delete_statement_searched))
- {
- DBG_ASSERT(pSQLParseNode->count() == 4,"Fehler im Parse Tree");
- pWhereClause = pSQLParseNode->getChild(3);
- }
- else
- // Other Statement. no selection-criteria
- return;
-
- if (SQL_ISRULE(pWhereClause,where_clause))
- {
- // a where-clause is not allowed to be empty:
- DBG_ASSERT(pWhereClause->count() == 2,"OFILECursor: Fehler im Parse Tree");
-
- OSQLParseNode * pComparisonPredicate = pWhereClause->getChild(1);
- DBG_ASSERT(pComparisonPredicate != NULL,"OFILECursor: Fehler im Parse Tree");
-
- execute( pComparisonPredicate );
- }
- else
- {
- // The where-clause is optionally in the majority of cases, i.e. it might be an "optional-where-clause".
- DBG_ASSERT(SQL_ISRULE(pWhereClause,opt_where_clause),"OPredicateCompiler: Fehler im Parse Tree");
- }
-}
-
-//------------------------------------------------------------------
-OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode)
-{
- OOperand* pOperand = NULL;
- if (pPredicateNode->count() == 3 && // Expression is bracketed
- SQL_ISPUNCTUATION(pPredicateNode->getChild(0),"(") &&
- SQL_ISPUNCTUATION(pPredicateNode->getChild(2),")"))
- {
- execute(pPredicateNode->getChild(1));
- }
- else if ((SQL_ISRULE(pPredicateNode,search_condition) || (SQL_ISRULE(pPredicateNode,boolean_term)))
- && // AND/OR-linkage:
- pPredicateNode->count() == 3)
- {
- execute(pPredicateNode->getChild(0)); // process the left branch
- execute(pPredicateNode->getChild(2)); // process the right branch
-
- if (SQL_ISTOKEN(pPredicateNode->getChild(1),OR)) // OR-Operator
- {
- m_aCodeList.push_back(new OOp_OR());
- m_bORCondition = sal_True;
- }
- else if (SQL_ISTOKEN(pPredicateNode->getChild(1),AND)) // AND-Operator
- m_aCodeList.push_back(new OOp_AND());
- else
- {
- OSL_FAIL("OPredicateCompiler: Fehler im Parse Tree");
- }
- }
- else if (SQL_ISRULE(pPredicateNode,boolean_factor))
- {
- execute(pPredicateNode->getChild(1));
- m_aCodeList.push_back(new OOp_NOT());
- }
- else if (SQL_ISRULE(pPredicateNode,comparison_predicate))
- {
- execute_COMPARE(pPredicateNode);
- }
- else if (SQL_ISRULE(pPredicateNode,like_predicate))
- {
- execute_LIKE(pPredicateNode);
- }
- else if (SQL_ISRULE(pPredicateNode,between_predicate))
- {
- execute_BETWEEN(pPredicateNode);
- }
- else if (SQL_ISRULE(pPredicateNode,test_for_null))
- {
- execute_ISNULL(pPredicateNode);
- }
- else if(SQL_ISRULE(pPredicateNode,num_value_exp))
- {
- execute(pPredicateNode->getChild(0)); // process the left branch
- execute(pPredicateNode->getChild(2)); // process the right branch
- if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"+"))
- {
- m_aCodeList.push_back(new OOp_ADD());
- }
- else if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"-"))
- m_aCodeList.push_back(new OOp_SUB());
- else
- {
- OSL_FAIL("OPredicateCompiler: Fehler im Parse Tree num_value_exp");
- }
- }
- else if(SQL_ISRULE(pPredicateNode,term))
- {
- execute(pPredicateNode->getChild(0)); // process the left branch
- execute(pPredicateNode->getChild(2)); // process the right branch
- if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"*"))
- {
- m_aCodeList.push_back(new OOp_MUL());
- }
- else if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"/"))
- m_aCodeList.push_back(new OOp_DIV());
- else
- {
- OSL_FAIL("OPredicateCompiler: Fehler im Parse Tree num_value_exp");
- }
- }
- else
- pOperand = execute_Operand(pPredicateNode); // now only simple operands will be processed
-
- return pOperand;
-}
-
-//------------------------------------------------------------------
-OOperand* OPredicateCompiler::execute_COMPARE(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
-{
- DBG_ASSERT(pPredicateNode->count() == 3,"OFILECursor: Fehler im Parse Tree");
-
- if ( !(SQL_ISRULE(pPredicateNode->getChild(0),column_ref) ||
- pPredicateNode->getChild(2)->getNodeType() == SQL_NODE_STRING ||
- pPredicateNode->getChild(2)->getNodeType() == SQL_NODE_INTNUM ||
- pPredicateNode->getChild(2)->getNodeType() == SQL_NODE_APPROXNUM ||
- SQL_ISTOKEN(pPredicateNode->getChild(2),TRUE) ||
- SQL_ISTOKEN(pPredicateNode->getChild(2),FALSE) ||
- SQL_ISRULE(pPredicateNode->getChild(2),parameter) ||
- // odbc date
- SQL_ISRULE(pPredicateNode->getChild(2),set_fct_spec) ||
- SQL_ISRULE(pPredicateNode->getChild(2),position_exp) ||
- SQL_ISRULE(pPredicateNode->getChild(2),char_substring_fct) ||
- // upper, lower etc.
- SQL_ISRULE(pPredicateNode->getChild(2),fold)) )
- {
- m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,NULL);
- return NULL;
- }
-
- sal_Int32 ePredicateType( SQLFilterOperator::EQUAL );
- OSQLParseNode *pPrec = pPredicateNode->getChild(1);
-
- if (pPrec->getNodeType() == SQL_NODE_EQUAL)
- ePredicateType = SQLFilterOperator::EQUAL;
- else if (pPrec->getNodeType() == SQL_NODE_NOTEQUAL)
- ePredicateType = SQLFilterOperator::NOT_EQUAL;
- else if (pPrec->getNodeType() == SQL_NODE_LESS)
- ePredicateType = SQLFilterOperator::LESS;
- else if (pPrec->getNodeType() == SQL_NODE_LESSEQ)
- ePredicateType = SQLFilterOperator::LESS_EQUAL;
- else if (pPrec->getNodeType() == SQL_NODE_GREATEQ)
- ePredicateType = SQLFilterOperator::GREATER_EQUAL;
- else if (pPrec->getNodeType() == SQL_NODE_GREAT)
- ePredicateType = SQLFilterOperator::GREATER;
- else
- OSL_FAIL( "OPredicateCompiler::execute_COMPARE: unexpected node type!" );
-
- execute(pPredicateNode->getChild(0));
- execute(pPredicateNode->getChild(2));
- m_aCodeList.push_back( new OOp_COMPARE(ePredicateType) );
-
- return NULL;
-}
-
-//------------------------------------------------------------------
-OOperand* OPredicateCompiler::execute_LIKE(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
-{
- DBG_ASSERT(pPredicateNode->count() == 2,"OFILECursor: Fehler im Parse Tree");
- const OSQLParseNode* pPart2 = pPredicateNode->getChild(1);
-
- sal_Unicode cEscape = L'\0';
- const bool bNotLike = pPart2->getChild(0)->isToken();
-
- OSQLParseNode* pAtom = pPart2->getChild(pPart2->count()-2);
- OSQLParseNode* pOptEscape = pPart2->getChild(pPart2->count()-1);
-
- if (!(pAtom->getNodeType() == SQL_NODE_STRING ||
- SQL_ISRULE(pAtom,parameter) ||
- // odbc date
- SQL_ISRULE(pAtom,set_fct_spec) ||
- SQL_ISRULE(pAtom,position_exp) ||
- SQL_ISRULE(pAtom,char_substring_fct) ||
- // upper, lower etc.
- SQL_ISRULE(pAtom,fold)) )
- {
- m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,NULL);
- return NULL;
- }
-
- if (pOptEscape->count() != 0)
- {
- if (pOptEscape->count() != 2)
- {
- m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,NULL);
- }
- OSQLParseNode *pEscNode = pOptEscape->getChild(1);
- if (pEscNode->getNodeType() != SQL_NODE_STRING)
- {
- m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,NULL);
- }
- else
- cEscape = pEscNode->getTokenValue().toChar();
- }
-
- execute(pPredicateNode->getChild(0));
- execute(pAtom);
-
- OBoolOperator* pOperator = bNotLike
- ? new OOp_NOTLIKE(cEscape)
- : new OOp_LIKE(cEscape);
- m_aCodeList.push_back(pOperator);
-
- return NULL;
-}
-//------------------------------------------------------------------
-OOperand* OPredicateCompiler::execute_BETWEEN(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
-{
- DBG_ASSERT(pPredicateNode->count() == 2,"OFILECursor: Fehler im Parse Tree");
-
- OSQLParseNode* pColumn = pPredicateNode->getChild(0);
- const OSQLParseNode* pPart2 = pPredicateNode->getChild(1);
- OSQLParseNode* p1stValue = pPart2->getChild(2);
- OSQLParseNode* p2ndtValue = pPart2->getChild(4);
-
- if (
- !(p1stValue->getNodeType() == SQL_NODE_STRING || SQL_ISRULE(p1stValue,parameter))
- && !(p2ndtValue->getNodeType() == SQL_NODE_STRING || SQL_ISRULE(p2ndtValue,parameter))
- )
- {
- m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_INVALID_BETWEEN,NULL);
- }
-
- sal_Bool bNot = SQL_ISTOKEN(pPart2->getChild(0),NOT);
-
- OOperand* pColumnOp = execute(pColumn);
- OOperand* pOb1 = execute(p1stValue);
- OBoolOperator* pOperator = new OOp_COMPARE(bNot ? SQLFilterOperator::LESS_EQUAL : SQLFilterOperator::GREATER);
- m_aCodeList.push_back(pOperator);
-
- execute(pColumn);
- OOperand* pOb2 = execute(p2ndtValue);
- pOperator = new OOp_COMPARE(bNot ? SQLFilterOperator::GREATER_EQUAL : SQLFilterOperator::LESS);
- m_aCodeList.push_back(pOperator);
-
- if ( pColumnOp && pOb1 && pOb2 )
- {
- switch(pColumnOp->getDBType())
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- case DataType::LONGVARCHAR:
- pOb1->setValue(pOb1->getValue().getString());
- pOb2->setValue(pOb2->getValue().getString());
- break;
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- pOb1->setValue((double)pOb1->getValue());
- pOb2->setValue((double)pOb2->getValue());
- break;
- case DataType::FLOAT:
- pOb1->setValue((float)pOb1->getValue());
- pOb2->setValue((float)pOb2->getValue());
- break;
- case DataType::DOUBLE:
- case DataType::REAL:
- pOb1->setValue((double)pOb1->getValue());
- pOb2->setValue((double)pOb2->getValue());
- break;
- case DataType::DATE:
- pOb1->setValue((Date)pOb1->getValue());
- pOb2->setValue((Date)pOb2->getValue());
- break;
- case DataType::TIME:
- pOb1->setValue((Time)pOb1->getValue());
- pOb2->setValue((Time)pOb2->getValue());
- break;
- case DataType::TIMESTAMP:
- pOb1->setValue((DateTime)pOb1->getValue());
- pOb2->setValue((DateTime)pOb2->getValue());
- break;
- }
- }
-
-
-
- OBoolOperator* pBoolOp = NULL;
- if ( bNot )
- pBoolOp = new OOp_OR();
- else
- pBoolOp = new OOp_AND();
- m_aCodeList.push_back(pBoolOp);
-
- return NULL;
-}
-//------------------------------------------------------------------
-OOperand* OPredicateCompiler::execute_ISNULL(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
-{
- DBG_ASSERT(pPredicateNode->count() == 2,"OFILECursor: Fehler im Parse Tree");
- const OSQLParseNode* pPart2 = pPredicateNode->getChild(1);
- DBG_ASSERT(SQL_ISTOKEN(pPart2->getChild(0),IS),"OFILECursor: Fehler im Parse Tree");
-
- sal_Int32 ePredicateType;
- if (SQL_ISTOKEN(pPart2->getChild(1),NOT))
- ePredicateType = SQLFilterOperator::NOT_SQLNULL;
- else
- ePredicateType = SQLFilterOperator::SQLNULL;
-
- execute(pPredicateNode->getChild(0));
- OBoolOperator* pOperator = (ePredicateType == SQLFilterOperator::SQLNULL) ?
- new OOp_ISNULL() : new OOp_ISNOTNULL();
- m_aCodeList.push_back(pOperator);
-
- return NULL;
-}
-//------------------------------------------------------------------
-OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
-{
- OOperand* pOperand = NULL;
-
- if (SQL_ISRULE(pPredicateNode,column_ref))
- {
- ::rtl::OUString aColumnName;
- if (pPredicateNode->count() == 1)
- {
- aColumnName = pPredicateNode->getChild(0)->getTokenValue();
- }
- else if (pPredicateNode->count() == 3)
- {
- ::rtl::OUString aTableName = pPredicateNode->getChild(0)->getTokenValue();
- if(SQL_ISRULE(pPredicateNode->getChild(2),column_val))
- aColumnName = pPredicateNode->getChild(2)->getChild(0)->getTokenValue();
- else
- aColumnName = pPredicateNode->getChild(2)->getTokenValue();
- }
-
- if(!m_orgColumns->hasByName(aColumnName))
- {
- const ::rtl::OUString sError( m_pAnalyzer->getConnection()->getResources().getResourceStringWithSubstitution(
- STR_INVALID_COLUMNNAME,
- "$columnname$", aColumnName
- ) );
- ::dbtools::throwGenericSQLException( sError, NULL );
- }
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCol;
- try
- {
- if (m_orgColumns->getByName(aColumnName) >>= xCol)
- {
- pOperand = m_pAnalyzer->createOperandAttr(Reference< XColumnLocate>(m_orgColumns,UNO_QUERY)->findColumn(aColumnName),xCol,m_xIndexes);
- }
- else
- {// Column doesn't exist in the Result-set
- const ::rtl::OUString sError( m_pAnalyzer->getConnection()->getResources().getResourceStringWithSubstitution(
- STR_INVALID_COLUMNNAME,
- "$columnname$", aColumnName
- ) );
- ::dbtools::throwGenericSQLException( sError, NULL );
- }
- }
- catch(Exception &)
- {
- OSL_FAIL("OPredicateCompiler::execute_Operand Exception");
- }
- }
- else if (SQL_ISRULE(pPredicateNode,parameter))
- {
- pOperand = new OOperandParam(pPredicateNode, ++m_nParamCounter);
- }
- else if (pPredicateNode->getNodeType() == SQL_NODE_STRING ||
- pPredicateNode->getNodeType() == SQL_NODE_INTNUM ||
- pPredicateNode->getNodeType() == SQL_NODE_APPROXNUM ||
- pPredicateNode->getNodeType() == SQL_NODE_NAME ||
- SQL_ISTOKEN(pPredicateNode,TRUE) ||
- SQL_ISTOKEN(pPredicateNode,FALSE) ||
- SQL_ISRULE(pPredicateNode,parameter))
- {
- pOperand = new OOperandConst(*pPredicateNode, pPredicateNode->getTokenValue());
- }
- else if((pPredicateNode->count() == 2) &&
- (SQL_ISPUNCTUATION(pPredicateNode->getChild(0),"+") || SQL_ISPUNCTUATION(pPredicateNode->getChild(0),"-")) &&
- pPredicateNode->getChild(1)->getNodeType() == SQL_NODE_INTNUM)
- { // if -1 or +1 is there
- ::rtl::OUString aValue(pPredicateNode->getChild(0)->getTokenValue());
- aValue += pPredicateNode->getChild(1)->getTokenValue();
- pOperand = new OOperandConst(*pPredicateNode->getChild(1), aValue);
- }
- else if( SQL_ISRULE(pPredicateNode,set_fct_spec) && SQL_ISPUNCTUATION(pPredicateNode->getChild(0),"{") )
- {
- const OSQLParseNode* pODBCNode = pPredicateNode->getChild(1);
- const OSQLParseNode* pODBCNodeChild = pODBCNode->getChild(0);
-
- // Odbc Date or time
- if (pODBCNodeChild->getNodeType() == SQL_NODE_KEYWORD && (
- SQL_ISTOKEN(pODBCNodeChild,D) ||
- SQL_ISTOKEN(pODBCNodeChild,T) ||
- SQL_ISTOKEN(pODBCNodeChild,TS) ))
- {
- ::rtl::OUString sDateTime = pODBCNode->getChild(1)->getTokenValue();
- pOperand = new OOperandConst(*pODBCNode->getChild(1), sDateTime);
- if(SQL_ISTOKEN(pODBCNodeChild,D))
- {
- pOperand->setValue(::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(sDateTime)));
- }
- else if(SQL_ISTOKEN(pODBCNodeChild,T))
- {
- pOperand->setValue(::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(sDateTime)));
- }
- else if(SQL_ISTOKEN(pODBCNodeChild,TS))
- {
- pOperand->setValue(::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDateTime(sDateTime)));
- }
- }
- else
- m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,NULL);
-
- }
- else if( SQL_ISRULE(pPredicateNode,fold) )
- {
- execute_Fold(pPredicateNode);
- }
- else if( SQL_ISRULE(pPredicateNode,set_fct_spec)
- || SQL_ISRULE(pPredicateNode,position_exp)
- || SQL_ISRULE(pPredicateNode,char_substring_fct)
- )
- {
- executeFunction(pPredicateNode);
- }
- else if( SQL_ISRULE(pPredicateNode,length_exp) )
- {
- executeFunction(pPredicateNode->getChild(0));
- }
- else
- {
- m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,NULL);
- }
- if (pOperand)
- m_aCodeList.push_back(pOperand);
- return pOperand;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////
-sal_Bool OPredicateInterpreter::evaluate(OCodeList& rCodeList)
-{
- static sal_Bool bResult;
-
- OCodeList::iterator aIter = rCodeList.begin();
- if (!(*aIter))
- return sal_True; // no Predicate
-
- for(;aIter != rCodeList.end();++aIter)
- {
- OOperand* pOperand = PTR_CAST(OOperand,(*aIter));
- if (pOperand)
- m_aStack.push(pOperand);
- else
- ((OOperator *)(*aIter))->Exec(m_aStack);
- }
-
- OOperand* pOperand = m_aStack.top();
- m_aStack.pop();
-
- DBG_ASSERT(m_aStack.size() == 0, "StackFehler");
- DBG_ASSERT(pOperand, "StackFehler");
-
- bResult = pOperand->isValid();
- if (IS_TYPE(OOperandResult,pOperand))
- delete pOperand;
- return bResult;
-}
-// -----------------------------------------------------------------------------
-void OPredicateInterpreter::evaluateSelection(OCodeList& rCodeList,ORowSetValueDecoratorRef& _rVal)
-{
- OCodeList::iterator aIter = rCodeList.begin();
- if (!(*aIter))
- return ; // no Predicate
-
- for(;aIter != rCodeList.end();++aIter)
- {
- OOperand* pOperand = PTR_CAST(OOperand,(*aIter));
- if (pOperand)
- m_aStack.push(pOperand);
- else
- ((OOperator *)(*aIter))->Exec(m_aStack);
- }
-
- OOperand* pOperand = m_aStack.top();
- m_aStack.pop();
-
- DBG_ASSERT(m_aStack.size() == 0, "StackFehler");
- DBG_ASSERT(pOperand, "StackFehler");
-
- (*_rVal) = pOperand->getValue();
- if (IS_TYPE(OOperandResult,pOperand))
- delete pOperand;
-}
-// -----------------------------------------------------------------------------
-OOperand* OPredicateCompiler::execute_Fold(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
-{
- DBG_ASSERT(pPredicateNode->count() >= 4,"OFILECursor: Fehler im Parse Tree");
-
- sal_Bool bUpper = SQL_ISTOKEN(pPredicateNode->getChild(0),UPPER);
-
- execute(pPredicateNode->getChild(2));
- OOperator* pOperator = NULL;
- if ( bUpper )
- pOperator = new OOp_Upper();
- else
- pOperator = new OOp_Lower();
-
- m_aCodeList.push_back(pOperator);
- return NULL;
-}
-// -----------------------------------------------------------------------------
-OOperand* OPredicateCompiler::executeFunction(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
-{
- OOperator* pOperator = NULL;
-
- OSL_ENSURE(pPredicateNode->getChild(0)->isToken(),"The first one must be the name of the function!");
- sal_Int32 nTokenId = pPredicateNode->getChild(0)->getTokenID();
- switch ( nTokenId )
- {
- case SQL_TOKEN_CHAR_LENGTH:
- case SQL_TOKEN_LENGTH:
- case SQL_TOKEN_OCTET_LENGTH:
- case SQL_TOKEN_ASCII:
- case SQL_TOKEN_LCASE:
- case SQL_TOKEN_LTRIM:
- case SQL_TOKEN_RTRIM:
- case SQL_TOKEN_SPACE:
- case SQL_TOKEN_UCASE:
- case SQL_TOKEN_ABS:
- case SQL_TOKEN_ACOS:
- case SQL_TOKEN_ASIN:
- case SQL_TOKEN_ATAN:
- case SQL_TOKEN_CEILING:
- case SQL_TOKEN_COS:
- case SQL_TOKEN_DEGREES:
- case SQL_TOKEN_EXP:
- case SQL_TOKEN_FLOOR:
- case SQL_TOKEN_LOG10:
- case SQL_TOKEN_LN:
- case SQL_TOKEN_RADIANS:
- case SQL_TOKEN_SIGN:
- case SQL_TOKEN_SIN:
- case SQL_TOKEN_SQRT:
- case SQL_TOKEN_TAN:
- case SQL_TOKEN_DAYNAME:
- case SQL_TOKEN_DAYOFMONTH:
- case SQL_TOKEN_DAYOFWEEK:
- case SQL_TOKEN_DAYOFYEAR:
- case SQL_TOKEN_HOUR:
- case SQL_TOKEN_MINUTE:
- case SQL_TOKEN_MONTH:
- case SQL_TOKEN_MONTHNAME:
- case SQL_TOKEN_QUARTER:
- case SQL_TOKEN_SECOND:
- case SQL_TOKEN_YEAR:
-
- execute(pPredicateNode->getChild(2));
-
- switch( nTokenId )
- {
- case SQL_TOKEN_CHAR_LENGTH:
- case SQL_TOKEN_LENGTH:
- case SQL_TOKEN_OCTET_LENGTH:
- pOperator = new OOp_CharLength();
- break;
- case SQL_TOKEN_ASCII:
- pOperator = new OOp_Ascii();
- break;
- case SQL_TOKEN_LCASE:
- pOperator = new OOp_Lower();
- break;
-
- case SQL_TOKEN_LTRIM:
- pOperator = new OOp_LTrim();
- break;
- case SQL_TOKEN_RTRIM:
- pOperator = new OOp_RTrim();
- break;
- case SQL_TOKEN_SPACE:
- pOperator = new OOp_Space();
- break;
- case SQL_TOKEN_UCASE:
- pOperator = new OOp_Upper();
- break;
- case SQL_TOKEN_ABS:
- pOperator = new OOp_Abs();
- break;
- case SQL_TOKEN_ACOS:
- pOperator = new OOp_ACos();
- break;
- case SQL_TOKEN_ASIN:
- pOperator = new OOp_ASin();
- break;
- case SQL_TOKEN_ATAN:
- pOperator = new OOp_ATan();
- break;
- case SQL_TOKEN_CEILING:
- pOperator = new OOp_Ceiling();
- break;
- case SQL_TOKEN_COS:
- pOperator = new OOp_Cos();
- break;
- case SQL_TOKEN_DEGREES:
- pOperator = new OOp_Degrees();
- break;
- case SQL_TOKEN_EXP:
- pOperator = new OOp_Exp();
- break;
- case SQL_TOKEN_FLOOR:
- pOperator = new OOp_Floor();
- break;
- case SQL_TOKEN_LOG10:
- pOperator = new OOp_Log10();
- break;
- case SQL_TOKEN_LN:
- pOperator = new OOp_Ln();
- break;
- case SQL_TOKEN_RADIANS:
- pOperator = new OOp_Radians();
- break;
- case SQL_TOKEN_SIGN:
- pOperator = new OOp_Sign();
- break;
- case SQL_TOKEN_SIN:
- pOperator = new OOp_Sin();
- break;
- case SQL_TOKEN_SQRT:
- pOperator = new OOp_Sqrt();
- break;
- case SQL_TOKEN_TAN:
- pOperator = new OOp_Tan();
- break;
- case SQL_TOKEN_DAYOFWEEK:
- pOperator = new OOp_DayOfWeek();
- break;
- case SQL_TOKEN_DAYOFMONTH:
- pOperator = new OOp_DayOfMonth();
- break;
- case SQL_TOKEN_DAYOFYEAR:
- pOperator = new OOp_DayOfYear();
- break;
- case SQL_TOKEN_MONTH:
- pOperator = new OOp_Month();
- break;
- case SQL_TOKEN_DAYNAME:
- pOperator = new OOp_DayName();
- break;
- case SQL_TOKEN_MONTHNAME:
- pOperator = new OOp_MonthName();
- break;
- case SQL_TOKEN_QUARTER:
- pOperator = new OOp_Quarter();
- break;
- case SQL_TOKEN_YEAR:
- pOperator = new OOp_Year();
- break;
- case SQL_TOKEN_HOUR:
- pOperator = new OOp_Hour();
- break;
- case SQL_TOKEN_MINUTE:
- pOperator = new OOp_Minute();
- break;
- case SQL_TOKEN_SECOND:
- pOperator = new OOp_Second();
- break;
- default:
- OSL_FAIL("Error in switch!");
- }
- break;
- case SQL_TOKEN_CHAR:
- case SQL_TOKEN_CONCAT:
- case SQL_TOKEN_INSERT:
- case SQL_TOKEN_LEFT:
- case SQL_TOKEN_LOCATE:
- case SQL_TOKEN_LOCATE_2:
- case SQL_TOKEN_REPEAT:
- case SQL_TOKEN_REPLACE:
- case SQL_TOKEN_RIGHT:
- case SQL_TOKEN_MOD:
- case SQL_TOKEN_ROUND:
- case SQL_TOKEN_LOGF:
- case SQL_TOKEN_LOG:
- case SQL_TOKEN_POWER:
- case SQL_TOKEN_ATAN2:
- case SQL_TOKEN_PI:
- case SQL_TOKEN_CURDATE:
- case SQL_TOKEN_CURTIME:
- case SQL_TOKEN_NOW:
- case SQL_TOKEN_WEEK:
- {
- m_aCodeList.push_back(new OStopOperand);
- OSQLParseNode* pList = pPredicateNode->getChild(2);
- for (sal_uInt32 i=0; i < pList->count(); ++i)
- execute(pList->getChild(i));
-
- switch( nTokenId )
- {
- case SQL_TOKEN_CHAR:
- pOperator = new OOp_Char();
- break;
- case SQL_TOKEN_CONCAT:
- pOperator = new OOp_Concat();
- break;
- case SQL_TOKEN_INSERT:
- pOperator = new OOp_Insert();
- break;
- case SQL_TOKEN_LEFT:
- pOperator = new OOp_Left();
- break;
- case SQL_TOKEN_LOCATE:
- case SQL_TOKEN_LOCATE_2:
- pOperator = new OOp_Locate();
- break;
- case SQL_TOKEN_REPEAT:
- pOperator = new OOp_Repeat();
- break;
- case SQL_TOKEN_REPLACE:
- pOperator = new OOp_Replace();
- break;
- case SQL_TOKEN_RIGHT:
- pOperator = new OOp_Right();
- break;
- case SQL_TOKEN_MOD:
- pOperator = new OOp_Mod();
- break;
- case SQL_TOKEN_ROUND:
- pOperator = new OOp_Round();
- break;
- case SQL_TOKEN_LOGF:
- case SQL_TOKEN_LOG:
- pOperator = new OOp_Log();
- break;
- case SQL_TOKEN_POWER:
- pOperator = new OOp_Pow();
- break;
- case SQL_TOKEN_ATAN2:
- pOperator = new OOp_ATan2();
- break;
- case SQL_TOKEN_PI:
- pOperator = new OOp_Pi();
- break;
- case SQL_TOKEN_CURDATE:
- pOperator = new OOp_CurDate();
- break;
- case SQL_TOKEN_CURTIME:
- pOperator = new OOp_CurTime();
- break;
- case SQL_TOKEN_NOW:
- pOperator = new OOp_Now();
- break;
- case SQL_TOKEN_WEEK:
- pOperator = new OOp_Week();
- break;
- default:
- OSL_FAIL("Error in switch!");
- }
- }
- break;
-
- case SQL_TOKEN_SUBSTRING:
- m_aCodeList.push_back(new OStopOperand);
- if ( pPredicateNode->count() == 4 ) //char_substring_fct
- {
- OSQLParseNode* pList = pPredicateNode->getChild(2);
- for (sal_uInt32 i=0; i < pList->count(); ++i)
- execute(pList->getChild(i));
- }
- else
- {
- execute(pPredicateNode->getChild(2));
- execute(pPredicateNode->getChild(4));
- execute(pPredicateNode->getChild(5)->getChild(1));
- }
- pOperator = new OOp_SubString();
- break;
-
- case SQL_TOKEN_POSITION:
- m_aCodeList.push_back(new OStopOperand);
- if ( pPredicateNode->count() == 4 ) //position_exp
- {
- OSQLParseNode* pList = pPredicateNode->getChild(2);
- for (sal_uInt32 i=0; i < pList->count(); ++i)
- execute(pList->getChild(i));
- }
- else
- {
- execute(pPredicateNode->getChild(2));
- execute(pPredicateNode->getChild(4));
- }
- pOperator = new OOp_Locate();
- break;
- default:
- m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_FUNCTION_NOT_SUPPORTED,NULL);
- }
-
- m_aCodeList.push_back(pOperator);
- return NULL;
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/file/file.xml b/connectivity/source/drivers/file/file.xml
deleted file mode 100755
index b3b681c305..0000000000
--- a/connectivity/source/drivers/file/file.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE module-description PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
-<module-description>
- <module-name>file</module-name>
- <component-description>
- <author>Ocke Jannsen</author>
- <name>com.sun.star.sdbc.driver.file.Driver</name>
- <description>This library implements basic functionallity for file-base drivers.
-</description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service>com.sun.star.sdbc.Driver</supported-service>
- <supported-service>com.sun.star.sdbcx.Driver</supported-service>
- <service-dependency> ... </service-dependency>
- </component-description>
- <project-build-dependency>cppuhelper</project-build-dependency>
- <project-build-dependency>cppu</project-build-dependency>
- <project-build-dependency>sal</project-build-dependency>
- <runtime-module-dependency>cppuhelper</runtime-module-dependency>
- <runtime-module-dependency>cppu</runtime-module-dependency>
- <runtime-module-dependency>sal</runtime-module-dependency>
- <runtime-module-dependency>osl</runtime-module-dependency>
- <runtime-module-dependency>svtools-light1</runtime-module-dependency>
- <runtime-module-dependency>svtools</runtime-module-dependency>
- <runtime-module-dependency>ucbhelper</runtime-module-dependency>
- <runtime-module-dependency>dbtools</runtime-module-dependency>
- <runtime-module-dependency>unotools</runtime-module-dependency>
- <runtime-module-dependency>comphelper</runtime-module-dependency>
-</module-description>
diff --git a/connectivity/source/drivers/file/makefile.mk b/connectivity/source/drivers/file/makefile.mk
deleted file mode 100755
index 41f061de80..0000000000
--- a/connectivity/source/drivers/file/makefile.mk
+++ /dev/null
@@ -1,108 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=file
-
-USE_DEFFILE=TRUE
-VISIBILITY_HIDDEN=TRUE
-
-# --- Settings ----------------------------------
-.IF "$(DBGUTIL_OJ)"!=""
-ENVCFLAGS+=/FR$(SLO)$/
-.ENDIF
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/version.mk
-
-CDEFS += -DOOO_DLLIMPLEMENTATION_FILE
-
-# --- Files -------------------------------------
-EXCEPTIONSFILES=\
- $(SLO)$/FCatalog.obj \
- $(SLO)$/FColumns.obj \
- $(SLO)$/FConnection.obj \
- $(SLO)$/FDatabaseMetaData.obj \
- $(SLO)$/FDateFunctions.obj \
- $(SLO)$/FDriver.obj \
- $(SLO)$/FNoException.obj \
- $(SLO)$/FNumericFunctions.obj \
- $(SLO)$/FPreparedStatement.obj \
- $(SLO)$/FResultSet.obj \
- $(SLO)$/FResultSetMetaData.obj \
- $(SLO)$/FStatement.obj \
- $(SLO)$/FStringFunctions.obj \
- $(SLO)$/FTable.obj \
- $(SLO)$/FTables.obj \
- $(SLO)$/fanalyzer.obj \
- $(SLO)$/fcode.obj \
- $(SLO)$/fcomp.obj
-
-SLOFILES=\
- $(EXCEPTIONSFILES) \
- $(SLO)$/quotedstring.obj
-
-
-# --- Library -----------------------------------
-SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SVLLIB) \
- $(TOOLSLIB) \
- $(UCBHELPERLIB) \
- $(SALLIB) \
- $(SALHELPERLIB) \
- $(DBTOOLSLIB) \
- $(UNOTOOLSLIB) \
- $(COMPHELPERLIB)
-
-SHL1DEPN=
-SHL1IMPLIB= i$(TARGET)
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt \
- $(SLB)$/$(TARGET).lib
-DEFLIB1NAME=$(TARGET)
-
-# --- Targets ----------------------------------
-
-.INCLUDE : target.mk
-
-
-# --- filter file ------------------------------
-
-$(MISC)$/$(SHL1TARGET).flt: makefile.mk
- @echo ------------------------------
- @echo _TI >$@
- @echo _real >>$@
-
diff --git a/connectivity/source/drivers/file/quotedstring.cxx b/connectivity/source/drivers/file/quotedstring.cxx
deleted file mode 100644
index c71afa3d41..0000000000
--- a/connectivity/source/drivers/file/quotedstring.cxx
+++ /dev/null
@@ -1,166 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "file/quotedstring.hxx"
-#include <rtl/logfile.hxx>
-
-namespace connectivity
-{
- //==================================================================
- //= QuotedTokenizedString
- //==================================================================
- //------------------------------------------------------------------
- xub_StrLen QuotedTokenizedString::GetTokenCount( sal_Unicode cTok, sal_Unicode cStrDel ) const
- {
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "QuotedTokenizedString::GetTokenCount" );
- const xub_StrLen nLen = m_sString.Len();
- if ( !nLen )
- return 0;
-
- xub_StrLen nTokCount = 1;
- sal_Bool bStart = sal_True; // Are we on the first character in the Token?
- sal_Bool bInString = sal_False; // Are we WITHIN a (cStrDel delimited) String?
-
- // Search for String-end after the first not matching character
- for( xub_StrLen i = 0; i < nLen; ++i )
- {
- const sal_Unicode cChar = m_sString.GetChar(i);
- if (bStart)
- {
- bStart = sal_False;
- // First character a String-Delimiter?
- if ( cChar == cStrDel )
- {
- bInString = sal_True; // then we are now WITHIN the string!
- continue; // skip this character!
- }
- }
-
- if (bInString)
- {
- // when now the String-Delimiter-character occurs ...
- if ( cChar == cStrDel )
- {
- if ((i+1 < nLen) && (m_sString.GetChar(i+1) == cStrDel))
- {
- // double String-Delimter-character:
- ++i; // no string-end, skip next character.
- }
- else
- {
- // String-End
- bInString = sal_False;
- }
- }
- } // if (bInString)
- else
- {
- // does the Token-character match, then raise TokCount
- if ( cChar == cTok )
- {
- ++nTokCount;
- bStart = sal_True;
- }
- }
- }
- //OSL_TRACE("QuotedTokenizedString::nTokCount = %d\n", ((OUtoCStr(::rtl::OUString(nTokCount))) ? (OUtoCStr(::rtl::OUString(nTokCount))):("NULL")) );
-
- return nTokCount;
- }
-
- //------------------------------------------------------------------
- void QuotedTokenizedString::GetTokenSpecial( String& _rStr,xub_StrLen& nStartPos, sal_Unicode cTok, sal_Unicode cStrDel ) const
- {
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "QuotedTokenizedString::GetTokenCount" );
- _rStr.Erase();
- const xub_StrLen nLen = m_sString.Len();
- if ( nLen )
- {
- sal_Bool bInString = (nStartPos < nLen) && (m_sString.GetChar(nStartPos) == cStrDel); // are we WITHIN a (cStrDel delimited) String?
-
- // First character a String-Delimiter?
- if (bInString )
- ++nStartPos; // skip this character!
- if ( nStartPos >= nLen )
- return;
-
- sal_Unicode* pData = _rStr.AllocBuffer( nLen - nStartPos + 1 );
- const sal_Unicode* pStart = pData;
- // Search until end of string for the first not matching character
- for( xub_StrLen i = nStartPos; i < nLen; ++i )
- {
- const sal_Unicode cChar = m_sString.GetChar(i);
- if (bInString)
- {
- // when now the String-Delimiter-character occurs ...
- if ( cChar == cStrDel )
- {
- if ((i+1 < nLen) && (m_sString.GetChar(i+1) == cStrDel))
- {
- // double String Delimiter-character
- // no end of string, skip next character.
- ++i;
- *pData++ = m_sString.GetChar(i); // character belongs to Result-String
- }
- else
- {
- //end of String
- bInString = sal_False;
- *pData = 0;
- }
- }
- else
- {
- *pData++ = cChar; // character belongs to Result-String
- }
-
- }
- else
- {
- // does the Token-sign match, then raise nTok
- if ( cChar == cTok )
- {
- // premature break of loop possible, because we found what we were looking for
- nStartPos = i+1;
- break;
- }
- else
- {
- *pData++ = cChar; // character belongs to Result-String
- }
- }
- } // for( xub_StrLen i = nStartPos; i < nLen; ++i )
- *pData = 0;
- _rStr.ReleaseBufferAccess(xub_StrLen(pData - pStart));
- }
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/ECatalog.cxx b/connectivity/source/drivers/flat/ECatalog.cxx
deleted file mode 100644
index f82eb7de00..0000000000
--- a/connectivity/source/drivers/flat/ECatalog.cxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-
-#include "flat/ECatalog.hxx"
-
-#include "flat/EConnection.hxx"
-#include "flat/ETables.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#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::flat;
-// -------------------------------------------------------------------------
-OFlatCatalog::OFlatCatalog(OFlatConnection* _pCon) : file::OFileCatalog(_pCon)
-{
-}
-// -------------------------------------------------------------------------
-void OFlatCatalog::refreshTables()
-{
- TStringVector aVector;
- Sequence< ::rtl::OUString > aTypes;
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),aTypes);
-
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while(xResult->next())
- aVector.push_back(xRow->getString(3));
- }
- if(m_pTables)
- m_pTables->reFill(aVector);
- else
- m_pTables = new OFlatTables(m_xMetaData,*this,m_aMutex,aVector);
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/EColumns.cxx b/connectivity/source/drivers/flat/EColumns.cxx
deleted file mode 100644
index 7fdbeca25c..0000000000
--- a/connectivity/source/drivers/flat/EColumns.cxx
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "flat/EColumns.hxx"
-#include "flat/ETable.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-
-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 ::rtl::OUString& _rName)
-{
-
- OFlatTable* pTable = (OFlatTable*)m_pTable;
- ::rtl::Reference<OSQLColumns> aCols = pTable->getTableColumns();
- OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
- sdbcx::ObjectType xRet;
- if(aIter != aCols->get().end())
- xRet = sdbcx::ObjectType(*aIter,UNO_QUERY);
- return xRet;
-}
-// -------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/EConnection.cxx b/connectivity/source/drivers/flat/EConnection.cxx
deleted file mode 100644
index fa1abf048a..0000000000
--- a/connectivity/source/drivers/flat/EConnection.cxx
+++ /dev/null
@@ -1,185 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "flat/EConnection.hxx"
-#include "flat/EDatabaseMetaData.hxx"
-#include "flat/ECatalog.hxx"
-#include "flat/EDriver.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <tools/urlobj.hxx>
-#include "flat/EPreparedStatement.hxx"
-#include "flat/EStatement.hxx"
-#include <comphelper/extract.hxx>
-#include <connectivity/dbexception.hxx>
-
-using namespace connectivity::flat;
-using namespace connectivity::file;
-
-typedef connectivity::file::OConnection OConnection_B;
-
-//------------------------------------------------------------------------------
-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)
- ,m_nMaxRowsToScan(50)
- ,m_bHeaderLine(sal_True)
- ,m_cFieldDelimiter(';')
- ,m_cStringDelimiter('"')
- ,m_cDecimalDelimiter(',')
- ,m_cThousandDelimiter('.')
-{
-}
-//-----------------------------------------------------------------------------
-OFlatConnection::~OFlatConnection()
-{
-}
-
-// XServiceInfo
-// --------------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OFlatConnection, "com.sun.star.sdbc.drivers.flat.Connection", "com.sun.star.sdbc.Connection")
-
-//-----------------------------------------------------------------------------
-void OFlatConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException)
-{
- osl_incrementInterlockedCount( &m_refCount );
-
- ::rtl::OUString aExt;
- const PropertyValue *pBegin = info.getConstArray();
- const PropertyValue *pEnd = pBegin + info.getLength();
- for(;pBegin != pEnd;++pBegin)
- {
- if(!pBegin->Name.compareToAscii("HeaderLine"))
- OSL_VERIFY( pBegin->Value >>= m_bHeaderLine );
- else if(!pBegin->Name.compareToAscii("FieldDelimiter"))
- {
- ::rtl::OUString aVal;
- OSL_VERIFY( pBegin->Value >>= aVal );
- m_cFieldDelimiter = aVal.toChar();
- }
- else if(!pBegin->Name.compareToAscii("StringDelimiter"))
- {
- ::rtl::OUString aVal;
- OSL_VERIFY( pBegin->Value >>= aVal );
- m_cStringDelimiter = aVal.toChar();
- }
- else if(!pBegin->Name.compareToAscii("DecimalDelimiter"))
- {
- ::rtl::OUString aVal;
- OSL_VERIFY( pBegin->Value >>= aVal );
- m_cDecimalDelimiter = aVal.toChar();
- }
- else if(!pBegin->Name.compareToAscii("ThousandDelimiter"))
- {
- ::rtl::OUString aVal;
- OSL_VERIFY( pBegin->Value >>= aVal );
- m_cThousandDelimiter = aVal.toChar();
- }
- else if ( !pBegin->Name.compareToAscii("MaxRowScan") )
- {
- pBegin->Value >>= m_nMaxRowsToScan;
- }
- }
-
- osl_decrementInterlockedCount( &m_refCount );
- OConnection::construct(url,info);
- m_bShowDeleted = sal_True; // we do not supported rows for this type
-}
-// --------------------------------------------------------------------------------
-Reference< XDatabaseMetaData > SAL_CALL OFlatConnection::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_B::rBHelper.bDisposed);
-
-
- Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
- if(!xMetaData.is())
- {
- xMetaData = new OFlatDatabaseMetaData(this);
- m_xMetaData = xMetaData;
- }
-
- return xMetaData;
-}
-//------------------------------------------------------------------------------
-::com::sun::star::uno::Reference< XTablesSupplier > OFlatConnection::createCatalog()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- Reference< XTablesSupplier > xTab = m_xCatalog;
- if(!xTab.is())
- {
- OFlatCatalog *pCat = new OFlatCatalog(this);
- xTab = pCat;
- m_xCatalog = xTab;
- }
- return xTab;
-}
-// --------------------------------------------------------------------------------
-Reference< XStatement > SAL_CALL OFlatConnection::createStatement( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_B::rBHelper.bDisposed);
-
- OFlatStatement* pStmt = new OFlatStatement(this);
-
- Reference< XStatement > xStmt = pStmt;
- m_aStatements.push_back(WeakReferenceHelper(*pStmt));
- return xStmt;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL OFlatConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_B::rBHelper.bDisposed);
-
-
- OFlatPreparedStatement* pStmt = new OFlatPreparedStatement(this);
- Reference< XPreparedStatement > xStmt = pStmt;
- pStmt->construct(sql);
-
- m_aStatements.push_back(WeakReferenceHelper(*pStmt));
- return xStmt;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL OFlatConnection::prepareCall( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_B::rBHelper.bDisposed);
-
- ::dbtools::throwFeatureNotImplementedException( "XConnection::prepareCall", *this );
- return NULL;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx
deleted file mode 100644
index 85d65153d4..0000000000
--- a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx
+++ /dev/null
@@ -1,268 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-
-#include "flat/EDatabaseMetaData.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/beans/XFastPropertySet.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
-#include <tools/urlobj.hxx>
-#include "FDatabaseMetaDataResultSet.hxx"
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <comphelper/extract.hxx>
-#include <comphelper/types.hxx>
-#include <rtl/logfile.hxx>
-
-using namespace ::comphelper;
-
-using namespace connectivity;
-using namespace connectivity::flat;
-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;
-
-
-
-OFlatDatabaseMetaData::OFlatDatabaseMetaData(::connectivity::file::OConnection* _pCon) :ODatabaseMetaData(_pCon)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatDatabaseMetaData::OFlatDatabaseMetaData" );
-}
-// -------------------------------------------------------------------------
-OFlatDatabaseMetaData::~OFlatDatabaseMetaData()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatDatabaseMetaData::~OFlatDatabaseMetaData" );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > OFlatDatabaseMetaData::impl_getTypeInfo_throw( )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatDatabaseMetaData::impl_getTypeInfo_throw" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
- Reference< XResultSet > xRef = pResult;
-
- static ODatabaseMetaDataResultSet::ORows aRows;
- if(aRows.empty())
- {
- ODatabaseMetaDataResultSet::ORow aRow;
-
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR"))));
- aRow.push_back(new ORowSetValueDecorator(DataType::CHAR));
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)254));
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::CHAR));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)10));
-
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")));
- aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR);
- aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRows.push_back(aRow);
-
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONGVARCHAR")));
- aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)65535);
- aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATE")));
- aRow[2] = new ORowSetValueDecorator(DataType::DATE);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)10);
- aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIME")));
- aRow[2] = new ORowSetValueDecorator(DataType::TIME);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)8);
- aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")));
- aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)19);
- aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BOOL")));
- aRow[2] = new ORowSetValueDecorator(DataType::BIT);
- aRow[3] = ODatabaseMetaDataResultSet::get1Value();
- aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL")));
- aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
- aRow[15] = new ORowSetValueDecorator((sal_Int32)15);
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOUBLE")));
- aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
- aRow[15] = ODatabaseMetaDataResultSet::get0Value();
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NUMERIC")));
- aRow[2] = new ORowSetValueDecorator(DataType::NUMERIC);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
- aRow[15] = new ORowSetValueDecorator((sal_Int32)20);
- aRows.push_back(aRow);
- }
-
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern,
- const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatDatabaseMetaData::getColumns" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
- Reference< XTablesSupplier > xTables = m_pConnection->createCatalog();
- if(!xTables.is())
- throw SQLException();
-
- Reference< XNameAccess> xNames = xTables->getTables();
- if(!xNames.is())
- throw SQLException();
-
- ODatabaseMetaDataResultSet::ORows aRows;
- ODatabaseMetaDataResultSet::ORow aRow(19);
- aRow[10] = new ORowSetValueDecorator((sal_Int32)10);
- Sequence< ::rtl::OUString> aTabNames(xNames->getElementNames());
- const ::rtl::OUString* pTabBegin = aTabNames.getConstArray();
- const ::rtl::OUString* pTabEnd = pTabBegin + aTabNames.getLength();
- for(;pTabBegin != pTabEnd;++pTabBegin)
- {
- if(match(tableNamePattern,*pTabBegin,'\0'))
- {
- Reference< XColumnsSupplier> xTable;
- ::cppu::extractInterface(xTable,xNames->getByName(*pTabBegin));
- aRow[3] = new ORowSetValueDecorator(*pTabBegin);
-
- Reference< XNameAccess> xColumns = xTable->getColumns();
- if(!xColumns.is())
- throw SQLException();
-
- Sequence< ::rtl::OUString> aColNames(xColumns->getElementNames());
-
- const ::rtl::OUString* pBegin = aColNames.getConstArray();
- const ::rtl::OUString* pEnd = pBegin + aColNames.getLength();
- Reference< XPropertySet> xColumn;
- for(sal_Int32 i=1;pBegin != pEnd;++pBegin,++i)
- {
- if(match(columnNamePattern,*pBegin,'\0'))
- {
- aRow[4] = new ORowSetValueDecorator(*pBegin);
-
- ::cppu::extractInterface(xColumn,xColumns->getByName(*pBegin));
- 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))));
- aRow[7] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))));
- aRow[9] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))));
- aRow[11] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))));
- aRow[13] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))));
-
- switch((sal_Int32)aRow[5]->getValue())
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- aRow[16] = new ORowSetValueDecorator((sal_Int32)254);
- break;
- case DataType::LONGVARCHAR:
- aRow[16] = new ORowSetValueDecorator((sal_Int32)65535);
- break;
- default:
- aRow[16] = new ORowSetValueDecorator((sal_Int32)0);
- }
- aRow[17] = new ORowSetValueDecorator(i);
- switch(sal_Int32(aRow[11]->getValue()))
- {
- case ColumnValue::NO_NULLS:
- aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO")));
- break;
- case ColumnValue::NULLABLE:
- aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES")));
- break;
- default:
- aRow[18] = new ORowSetValueDecorator(::rtl::OUString());
- }
- aRows.push_back(aRow);
- }
- }
- }
- }
-
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
- Reference< XResultSet > xRef = pResult;
- pResult->setRows(aRows);
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OFlatDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatDatabaseMetaData::getURL" );
- ::osl::MutexGuard aGuard( m_aMutex );
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:flat:")) + m_pConnection->getURL();
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/EDriver.cxx b/connectivity/source/drivers/flat/EDriver.cxx
deleted file mode 100644
index 48560bfb46..0000000000
--- a/connectivity/source/drivers/flat/EDriver.cxx
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "flat/EDriver.hxx"
-#include "flat/EConnection.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "connectivity/dbexception.hxx"
-#include <comphelper/sequence.hxx>
-#include "resource/common_res.hrc"
-#include "resource/sharedresources.hxx"
-
-
-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;
-
-
-// static ServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString ODriver::getImplementationName_Static( ) throw(RuntimeException)
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sdbc.flat.ODriver"));
-}
-
-//------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException)
-{
- return getImplementationName_Static();
-}
-
-//------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::flat::ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
-{
- return *(new ODriver(_rxFactory));
-}
-// --------------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if (ODriver_BASE::rBHelper.bDisposed)
- throw DisposedException();
-
- if ( ! acceptsURL(url) )
- return NULL;
-
- OFlatConnection* pCon = new OFlatConnection(this);
- pCon->construct(url,info);
- Reference< XConnection > xCon = pCon;
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
-
- return xCon;
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url )
- throw(SQLException, RuntimeException)
-{
- return url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:flat:")),10) == 0;
-}
-// -----------------------------------------------------------------------------
-Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
-{
- if ( acceptsURL(url) )
- {
- ::std::vector< DriverPropertyInfo > aDriverInfo;
-
- Sequence< ::rtl::OUString > aBoolean(2);
- aBoolean[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"));
- aBoolean[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1"));
-
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldDelimiter"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Field separator."))
- ,sal_False
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderLine"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text contains headers."))
- ,sal_False
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"))
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StringDelimiter"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text separator."))
- ,sal_False
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"))
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalDelimiter"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Decimal separator."))
- ,sal_False
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"))
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ThousandDelimiter"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Thousands separator."))
- ,sal_False
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"))
- ,aBoolean)
- );
- return ::comphelper::concatSequences(OFileDriver::getPropertyInfo(url,info ),
- Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size()));
- }
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- return Sequence< DriverPropertyInfo >();
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/EPreparedStatement.cxx b/connectivity/source/drivers/flat/EPreparedStatement.cxx
deleted file mode 100644
index 601aadbb7b..0000000000
--- a/connectivity/source/drivers/flat/EPreparedStatement.cxx
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "flat/EPreparedStatement.hxx"
-#include "flat/EResultSet.hxx"
-
-using namespace connectivity::flat;
-using namespace connectivity::file;
-using namespace ::com::sun::star::uno;
-// -------------------------------------------------------------------------
-OResultSet* OFlatPreparedStatement::createResultSet()
-{
- return new OFlatResultSet(this,m_aSQLIterator);
-}
-// -------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OFlatPreparedStatement,"com.sun.star.sdbc.driver.flat.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/EResultSet.cxx b/connectivity/source/drivers/flat/EResultSet.cxx
deleted file mode 100644
index 94d47c3002..0000000000
--- a/connectivity/source/drivers/flat/EResultSet.cxx
+++ /dev/null
@@ -1,190 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <com/sun/star/sdbcx/CompareBookmark.hpp>
-#include <com/sun/star/sdbcx/XDeleteRows.hpp>
-#include "flat/EResultSet.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <comphelper/sequence.hxx>
-#include <comphelper/types.hxx>
-
-using namespace ::comphelper;
-
-using namespace connectivity::flat;
-using namespace connectivity::file;
-using namespace ::cppu;
-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;
-
-//------------------------------------------------------------------------------
-OFlatResultSet::OFlatResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator)
- : file::OResultSet(pStmt,_aSQLIterator)
- ,m_bBookmarkable(sal_True)
-{
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE), PROPERTY_ID_ISBOOKMARKABLE, PropertyAttribute::READONLY,&m_bBookmarkable, ::getBooleanCppuType());
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OFlatResultSet::getImplementationName( ) throw ( RuntimeException)
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.flat.ResultSet"));
-}
-// -------------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL OFlatResultSet::getSupportedServiceNames( ) throw( RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(2);
- aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet"));
- aSupported[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ResultSet"));
- return aSupported;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OFlatResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OFlatResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- if(rType == ::getCppuType((const Reference<XDeleteRows>*)0) || rType == ::getCppuType((const Reference<XResultSetUpdate>*)0)
- || rType == ::getCppuType((const Reference<XRowUpdate>*)0))
- return Any();
-
- const Any aRet = OResultSet::queryInterface(rType);
- return aRet.hasValue() ? aRet : OFlatResultSet_BASE::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OFlatResultSet::getTypes( ) throw( RuntimeException)
-{
- Sequence< Type > aTypes = OResultSet::getTypes();
- ::std::vector<Type> aOwnTypes;
- aOwnTypes.reserve(aTypes.getLength());
- const Type* pBegin = aTypes.getConstArray();
- const Type* pEnd = pBegin + aTypes.getLength();
- for(;pBegin != pEnd;++pBegin)
- {
- if(!(*pBegin == ::getCppuType((const Reference<XDeleteRows>*)0) ||
- *pBegin == ::getCppuType((const Reference<XResultSetUpdate>*)0) ||
- *pBegin == ::getCppuType((const Reference<XRowUpdate>*)0)))
- {
- aOwnTypes.push_back(*pBegin);
- }
- }
- Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- Sequence< Type > aRet(pTypes, aOwnTypes.size());
- return ::comphelper::concatSequences(aRet,OFlatResultSet_BASE::getTypes());
-}
-
-// -------------------------------------------------------------------------
-// XRowLocate
-Any SAL_CALL OFlatResultSet::getBookmark( ) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return makeAny((sal_Int32)(m_aRow->get())[0]->getValue());
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OFlatResultSet::moveToBookmark( const Any& bookmark ) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False;
-
- return Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_True);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OFlatResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False;
-
- Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_False);
-
- return relative(rows);
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OFlatResultSet::compareBookmarks( const Any& lhs, const Any& rhs ) throw( SQLException, RuntimeException)
-{
- return (lhs == rhs) ? 0 : 2;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OFlatResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OFlatResultSet::hashBookmark( const Any& bookmark ) throw( SQLException, RuntimeException)
-{
- return comphelper::getINT32(bookmark);
-}
-// -------------------------------------------------------------------------
-IPropertyArrayHelper* OFlatResultSet::createArrayHelper( ) const
-{
- Sequence< Property > aProps;
- describeProperties(aProps);
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-// -------------------------------------------------------------------------
-IPropertyArrayHelper & OFlatResultSet::getInfoHelper()
-{
- return *OFlatResultSet_BASE3::getArrayHelper();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OFlatResultSet::acquire() throw()
-{
- OFlatResultSet_BASE2::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OFlatResultSet::release() throw()
-{
- OFlatResultSet_BASE2::release();
-}
-// -----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OFlatResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/EStatement.cxx b/connectivity/source/drivers/flat/EStatement.cxx
deleted file mode 100644
index 6dd16a00b6..0000000000
--- a/connectivity/source/drivers/flat/EStatement.cxx
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "flat/EStatement.hxx"
-#include "flat/EResultSet.hxx"
-
-using namespace connectivity::flat;
-using namespace connectivity::file;
-using namespace com::sun::star::uno;
-// -------------------------------------------------------------------------
-OResultSet* OFlatStatement::createResultSet()
-{
- return new OFlatResultSet(this,m_aSQLIterator);
-}
-// -------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OFlatStatement,"com.sun.star.sdbc.driver.flat.Statement","com.sun.star.sdbc.Statement");
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
deleted file mode 100644
index 886e639923..0000000000
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ /dev/null
@@ -1,926 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <ctype.h>
-#include "flat/ETable.hxx"
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/ucb/XContentAccess.hpp>
-#include <svl/converter.hxx>
-#include "flat/EConnection.hxx"
-#include "flat/EColumns.hxx"
-#include <osl/thread.h>
-#include <tools/config.hxx>
-#include <comphelper/sequence.hxx>
-#include <svl/zforlist.hxx>
-#include <rtl/math.hxx>
-#include <stdio.h> //sprintf
-#include <comphelper/extract.hxx>
-#include <comphelper/numbers.hxx>
-#include "flat/EDriver.hxx"
-#include <com/sun/star/util/NumberFormat.hpp>
-#include <unotools/configmgr.hxx>
-#include <i18npool/mslangid.hxx>
-#include "connectivity/dbconversion.hxx"
-#include <comphelper/types.hxx>
-#include "file/quotedstring.hxx"
-#include <unotools/syslocale.hxx>
-#include <rtl/logfile.hxx>
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::flat;
-using namespace connectivity::file;
-using namespace ::cppu;
-using namespace utl;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::ucb;
-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;
-
-// -------------------------------------------------------------------------
-void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::fillColumns" );
- sal_Bool bRead = sal_True;
-
- QuotedTokenizedString aHeaderLine;
- OFlatConnection* pConnection = (OFlatConnection*)m_pConnection;
- const rtl_TextEncoding nEncoding = m_pConnection->getTextEncoding();
- const sal_Bool bHasHeaderLine = pConnection->isHeaderLine();
- if ( bHasHeaderLine )
- {
- while(bRead && !aHeaderLine.Len())
- {
- bRead = m_pFileStream->ReadByteStringLine(aHeaderLine,nEncoding);
- }
- m_nStartRowFilePos = m_pFileStream->Tell();
- }
-
- // read first row
- QuotedTokenizedString aFirstLine;
- bRead = m_pFileStream->ReadByteStringLine(aFirstLine,nEncoding);
-
- if ( !bHasHeaderLine || !aHeaderLine.Len())
- {
- while(bRead && !aFirstLine.Len())
- {
- bRead = m_pFileStream->ReadByteStringLine(aFirstLine,nEncoding);
- }
- // use first row as headerline because we need the number of columns
- aHeaderLine = aFirstLine;
- }
- // column count
- const xub_StrLen nFieldCount = aHeaderLine.GetTokenCount(m_cFieldDelimiter,m_cStringDelimiter);
-
- if(!m_aColumns.is())
- m_aColumns = new OSQLColumns();
- else
- m_aColumns->get().clear();
-
- m_aTypes.clear();
- m_aPrecisions.clear();
- m_aScales.clear();
- // reserve some space
- m_aColumns->get().reserve(nFieldCount+1);
- m_aTypes.assign(nFieldCount+1,DataType::SQLNULL);
- m_aPrecisions.assign(nFieldCount+1,-1);
- m_aScales.assign(nFieldCount+1,-1);
-
- const sal_Bool bCase = m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers();
- CharClass aCharClass(pConnection->getDriver()->getFactory(),_aLocale);
- // read description
- const sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter();
- const sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter();
- String aColumnName;
- ::rtl::OUString aTypeName;
- ::comphelper::UStringMixEqual aCase(bCase);
- ::std::vector<String> aColumnNames,m_aTypeNames;
- m_aTypeNames.resize(nFieldCount);
- const sal_Int32 nMaxRowsToScan = pConnection->getMaxRowsToScan();
- sal_Int32 nRowCount = 0;
- do
- {
- xub_StrLen nStartPosHeaderLine = 0; // use for eficient way to get the tokens
- xub_StrLen nStartPosFirstLine = 0; // use for eficient way to get the tokens
- xub_StrLen nStartPosFirstLine2 = 0;
- for (xub_StrLen i = 0; i < nFieldCount; i++)
- {
- if ( nRowCount == 0)
- {
- if ( bHasHeaderLine )
- {
- aHeaderLine.GetTokenSpecial(aColumnName,nStartPosHeaderLine,m_cFieldDelimiter,m_cStringDelimiter);
- if ( !aColumnName.Len() )
- {
- aColumnName = 'C';
- aColumnName += String::CreateFromInt32(i+1);
- }
- }
- else
- {
- // no column name so ...
- aColumnName = 'C';
- aColumnName += String::CreateFromInt32(i+1);
- }
- aColumnNames.push_back(aColumnName);
- }
- impl_fillColumnInfo_nothrow(aFirstLine,nStartPosFirstLine,nStartPosFirstLine2,m_aTypes[i],m_aPrecisions[i],m_aScales[i],m_aTypeNames[i],cDecimalDelimiter,cThousandDelimiter,aCharClass);
- }
- ++nRowCount;
- }
- while(nRowCount < nMaxRowsToScan && m_pFileStream->ReadByteStringLine(aFirstLine,nEncoding) && !m_pFileStream->IsEof());
-
- for (xub_StrLen i = 0; i < nFieldCount; i++)
- {
- // check if the columname already exists
- String aAlias(aColumnNames[i]);
- OSQLColumns::Vector::const_iterator aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase);
- sal_Int32 nExprCnt = 0;
- while(aFind != m_aColumns->get().end())
- {
- (aAlias = aColumnNames[i]) += String::CreateFromInt32(++nExprCnt);
- aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase);
- }
-
- sdbcx::OColumn* pColumn = new sdbcx::OColumn(aAlias,m_aTypeNames[i],::rtl::OUString(),::rtl::OUString(),
- ColumnValue::NULLABLE,
- m_aPrecisions[i],
- m_aScales[i],
- m_aTypes[i],
- sal_False,
- sal_False,
- sal_False,
- bCase);
- Reference< XPropertySet> xCol = pColumn;
- m_aColumns->get().push_back(xCol);
- }
- m_pFileStream->Seek(m_nStartRowFilePos);
-}
-void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString& aFirstLine,xub_StrLen& nStartPosFirstLine,xub_StrLen& nStartPosFirstLine2
- ,sal_Int32& io_nType,sal_Int32& io_nPrecisions,sal_Int32& io_nScales,String& o_sTypeName
- ,const sal_Unicode cDecimalDelimiter,const sal_Unicode cThousandDelimiter,const CharClass& aCharClass)
-{
- if ( io_nType != DataType::VARCHAR )
- {
- sal_Bool bNumeric = io_nType == DataType::SQLNULL || io_nType == DataType::DOUBLE || io_nType == DataType::DECIMAL || io_nType == DataType::INTEGER;
- sal_uLong nIndex = 0;
-
- if ( bNumeric )
- {
- // first without fielddelimiter
- String aField;
- aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine,m_cFieldDelimiter,'\0');
- if (aField.Len() == 0 ||
- (m_cStringDelimiter && m_cStringDelimiter == aField.GetChar(0)))
- {
- bNumeric = sal_False;
- if ( m_cStringDelimiter != '\0' )
- aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter);
- else
- nStartPosFirstLine2 = nStartPosFirstLine;
- }
- else
- {
- String aField2;
- if ( m_cStringDelimiter != '\0' )
- aFirstLine.GetTokenSpecial(aField2,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter);
- else
- aField2 = aField;
-
- if (aField2.Len() == 0)
- {
- bNumeric = sal_False;
- }
- else
- {
- bNumeric = sal_True;
- xub_StrLen nDot = 0;
- xub_StrLen nDecimalDelCount = 0;
- xub_StrLen nSpaceCount = 0;
- for (xub_StrLen j = 0; j < aField2.Len(); j++)
- {
- const sal_Unicode c = aField2.GetChar(j);
- if ( j == nSpaceCount && m_cFieldDelimiter != 32 && c == 32 )
- {
- ++nSpaceCount;
- continue;
- }
- // just digits, decimal- and thousands-delimiter?
- if ( ( !cDecimalDelimiter || c != cDecimalDelimiter ) &&
- ( !cThousandDelimiter || c != cThousandDelimiter ) &&
- !aCharClass.isDigit(aField2,j) &&
- ( j != 0 || (c != '+' && c != '-' ) ) )
- {
- bNumeric = sal_False;
- break;
- }
- if (cDecimalDelimiter && c == cDecimalDelimiter)
- {
- io_nPrecisions = 15; // we have an decimal value
- io_nScales = 2;
- ++nDecimalDelCount;
- } // if (cDecimalDelimiter && c == cDecimalDelimiter)
- if ( c == '.' )
- ++nDot;
- }
-
- if (nDecimalDelCount > 1 || nDot > 1 ) // if there is more than one dot it isn't a number
- bNumeric = sal_False;
- if (bNumeric && cThousandDelimiter)
- {
- // Is the delimiter correct?
- const String aValue = aField2.GetToken(0,cDecimalDelimiter);
- for (sal_Int32 j = aValue.Len() - 4; j >= 0; j -= 4)
- {
- const sal_Unicode c = aValue.GetChar(static_cast<sal_uInt16>(j));
- // just digits, decimal- and thousands-delimiter?
- if (c == cThousandDelimiter && j)
- continue;
- else
- {
- bNumeric = sal_False;
- break;
- }
- }
- }
-
- // now also check for a date field
- if (!bNumeric)
- {
- try
- {
- nIndex = m_xNumberFormatter->detectNumberFormat(::com::sun::star::util::NumberFormat::ALL,aField2);
- }
- catch(Exception&)
- {
- }
- }
- }
- }
- }
- else if ( io_nType == DataType::DATE || io_nType == DataType::TIMESTAMP || io_nType == DataType::TIME)
- {
- String aField;
- aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine,m_cFieldDelimiter,'\0');
- if (aField.Len() == 0 ||
- (m_cStringDelimiter && m_cStringDelimiter == aField.GetChar(0)))
- {
- }
- else
- {
- String aField2;
- if ( m_cStringDelimiter != '\0' )
- aFirstLine.GetTokenSpecial(aField2,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter);
- else
- aField2 = aField;
- if (aField2.Len() )
- {
- try
- {
- nIndex = m_xNumberFormatter->detectNumberFormat(::com::sun::star::util::NumberFormat::ALL,aField2);
- }
- catch(Exception&)
- {
- }
- }
- }
- }
-
- sal_Int32 nFlags = 0;
- if (bNumeric)
- {
- if (cDecimalDelimiter)
- {
- if(io_nPrecisions)
- {
- io_nType = DataType::DECIMAL;
- static const ::rtl::OUString s_sDECIMAL(RTL_CONSTASCII_USTRINGPARAM("DECIMAL"));
- o_sTypeName = s_sDECIMAL;
- }
- else
- {
- io_nType = DataType::DOUBLE;
- static const ::rtl::OUString s_sDOUBLE(RTL_CONSTASCII_USTRINGPARAM("DOUBLE"));
- o_sTypeName = s_sDOUBLE;
- }
- }
- else
- {
- io_nType = DataType::INTEGER;
- io_nPrecisions = 0;
- io_nScales = 0;
- }
- nFlags = ColumnSearch::BASIC;
- }
- else
- {
- switch (comphelper::getNumberFormatType(m_xNumberFormatter,nIndex))
- {
- case NUMBERFORMAT_DATE:
- io_nType = DataType::DATE;
- {
- static const ::rtl::OUString s_sDATE(RTL_CONSTASCII_USTRINGPARAM("DATE"));
- o_sTypeName = s_sDATE;
- }
- break;
- case NUMBERFORMAT_DATETIME:
- io_nType = DataType::TIMESTAMP;
- {
- static const ::rtl::OUString s_sTIMESTAMP(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP"));
- o_sTypeName = s_sTIMESTAMP;
- }
- break;
- case NUMBERFORMAT_TIME:
- io_nType = DataType::TIME;
- {
- static const ::rtl::OUString s_sTIME(RTL_CONSTASCII_USTRINGPARAM("TIME"));
- o_sTypeName = s_sTIME;
- }
- break;
- default:
- io_nType = DataType::VARCHAR;
- io_nPrecisions = 0; // nyi: Data can be longer!
- io_nScales = 0;
- {
- static const ::rtl::OUString s_sVARCHAR(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"));
- o_sTypeName = s_sVARCHAR;
- }
- };
- nFlags |= ColumnSearch::CHAR;
- }
- }
- else
- {
- String aField;
- aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine,m_cFieldDelimiter,'\0');
- if (aField.Len() == 0 ||
- (m_cStringDelimiter && m_cStringDelimiter == aField.GetChar(0)))
- {
- if ( m_cStringDelimiter != '\0' )
- aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter);
- else
- nStartPosFirstLine2 = nStartPosFirstLine;
- }
- else
- {
- String aField2;
- if ( m_cStringDelimiter != '\0' )
- aFirstLine.GetTokenSpecial(aField2,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter);
- }
- }
-}
-// -------------------------------------------------------------------------
-OFlatTable::OFlatTable(sdbcx::OCollection* _pTables,OFlatConnection* _pConnection,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description ,
- const ::rtl::OUString& _SchemaName,
- const ::rtl::OUString& _CatalogName
- ) : OFlatTable_BASE(_pTables,_pConnection,_Name,
- _Type,
- _Description,
- _SchemaName,
- _CatalogName)
- ,m_nStartRowFilePos(0)
- ,m_nRowPos(0)
- ,m_nMaxRowCount(0)
- ,m_cStringDelimiter(_pConnection->getStringDelimiter())
- ,m_cFieldDelimiter(_pConnection->getFieldDelimiter())
- ,m_bNeedToReadLine(false)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::OFlatTable" );
-
-}
-// -----------------------------------------------------------------------------
-void OFlatTable::construct()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::construct" );
- SvtSysLocale aLocale;
- ::com::sun::star::lang::Locale aAppLocale(aLocale.GetLocaleDataPtr()->getLocale());
- Sequence< ::com::sun::star::uno::Any > aArg(1);
- aArg[0] <<= aAppLocale;
-
- Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier(m_pConnection->getDriver()->getFactory()->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatsSupplier")),aArg),UNO_QUERY);
- m_xNumberFormatter = Reference< ::com::sun::star::util::XNumberFormatter >(m_pConnection->getDriver()->getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))),UNO_QUERY);
- m_xNumberFormatter->attachNumberFormatsSupplier(xSupplier);
- Reference<XPropertySet> xProp(xSupplier->getNumberFormatSettings(),UNO_QUERY);
- xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NullDate"))) >>= m_aNullDate;
-
- INetURLObject aURL;
- aURL.SetURL(getEntry());
-
- if(aURL.getExtension() != rtl::OUString(m_pConnection->getExtension()))
- aURL.setExtension(m_pConnection->getExtension());
-
- String aFileName = aURL.GetMainURL(INetURLObject::NO_DECODE);
-
- m_pFileStream = createStream_simpleError( aFileName,STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE);
-
- if(!m_pFileStream)
- m_pFileStream = createStream_simpleError( aFileName,STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYNONE);
-
- if(m_pFileStream)
- {
- m_pFileStream->Seek(STREAM_SEEK_TO_END);
- sal_Int32 nSize = m_pFileStream->Tell();
- m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
-
- // Buffersize is dependent on the file-size
- m_pFileStream->SetBufferSize(nSize > 1000000 ? 32768 :
- nSize > 100000 ? 16384 :
- nSize > 10000 ? 4096 : 1024);
-
- fillColumns(aAppLocale);
-
- refreshColumns();
- }
-}
-// -------------------------------------------------------------------------
-String OFlatTable::getEntry()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::getEntry" );
- ::rtl::OUString sURL;
- try
- {
- Reference< XResultSet > xDir = m_pConnection->getDir()->getStaticResultSet();
- Reference< XRow> xRow(xDir,UNO_QUERY);
- ::rtl::OUString sName;
- ::rtl::OUString sExt;
-
- INetURLObject aURL;
- xDir->beforeFirst();
- static const ::rtl::OUString s_sSeparator(RTL_CONSTASCII_USTRINGPARAM("/"));
- while(xDir->next())
- {
- sName = xRow->getString(1);
- aURL.SetSmartProtocol(INET_PROT_FILE);
- String sUrl = m_pConnection->getURL() + s_sSeparator + sName;
- aURL.SetSmartURL( sUrl );
-
- // cut the extension
- sExt = aURL.getExtension();
-
- // name and extension have to coincide
- if ( m_pConnection->matchesExtension( sExt ) )
- {
- if ( sExt.getLength() )
- sName = sName.replaceAt(sName.getLength()-(sExt.getLength()+1),sExt.getLength()+1,::rtl::OUString());
- if ( sName == m_Name )
- {
- Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY );
- sURL = xContentAccess->queryContentIdentifierString();
- break;
- }
- }
- }
- xDir->beforeFirst(); // move back to before first record
- }
- catch(Exception&)
- {
- OSL_ASSERT(0);
- }
- return sURL.getStr();
-}
-// -------------------------------------------------------------------------
-void OFlatTable::refreshColumns()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::refreshColumns" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
- TStringVector aVector;
- aVector.reserve(m_aColumns->get().size());
-
- for(OSQLColumns::Vector::const_iterator aIter = m_aColumns->get().begin();aIter != m_aColumns->get().end();++aIter)
- aVector.push_back(Reference< XNamed>(*aIter,UNO_QUERY)->getName());
-
- if(m_pColumns)
- m_pColumns->reFill(aVector);
- else
- m_pColumns = new OFlatColumns(this,m_aMutex,aVector);
-}
-
-// -------------------------------------------------------------------------
-void SAL_CALL OFlatTable::disposing(void)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::disposing" );
- OFileTable::disposing();
- ::osl::MutexGuard aGuard(m_aMutex);
- m_aColumns = NULL;
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OFlatTable::getTypes( ) throw(RuntimeException)
-{
- Sequence< Type > aTypes = OTable_TYPEDEF::getTypes();
- ::std::vector<Type> aOwnTypes;
- aOwnTypes.reserve(aTypes.getLength());
- const Type* pBegin = aTypes.getConstArray();
- const Type* pEnd = pBegin + aTypes.getLength();
- for(;pBegin != pEnd;++pBegin)
- {
- if(!(*pBegin == ::getCppuType((const Reference<XKeysSupplier>*)0) ||
- *pBegin == ::getCppuType((const Reference<XRename>*)0) ||
- *pBegin == ::getCppuType((const Reference<XIndexesSupplier>*)0) ||
- *pBegin == ::getCppuType((const Reference<XAlterTable>*)0) ||
- *pBegin == ::getCppuType((const Reference<XDataDescriptorFactory>*)0)))
- {
- aOwnTypes.push_back(*pBegin);
- }
- }
- Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- return Sequence< Type >(pTypes, aOwnTypes.size());
-}
-
-// -------------------------------------------------------------------------
-Any SAL_CALL OFlatTable::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- if( rType == ::getCppuType((const Reference<XKeysSupplier>*)0) ||
- rType == ::getCppuType((const Reference<XIndexesSupplier>*)0) ||
- rType == ::getCppuType((const Reference<XRename>*)0) ||
- rType == ::getCppuType((const Reference<XAlterTable>*)0) ||
- rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0))
- return Any();
-
- Any aRet = OTable_TYPEDEF::queryInterface(rType);
- return aRet.hasValue() ? aRet : ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this));
-}
-
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OFlatTable::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OFlatTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::getSomething" );
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : OFlatTable_BASE::getSomething(rId);
-}
-//------------------------------------------------------------------
-sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal_Bool bIsTable,sal_Bool bRetrieveData)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::fetchRow" );
- *(_rRow->get())[0] = m_nFilePos;
-
- if (!bRetrieveData)
- return sal_True;
- if ( m_bNeedToReadLine )
- {
- sal_Int32 nCurrentPos = 0;
- m_pFileStream->Seek(m_nFilePos);
- readLine(nCurrentPos);
- m_bNeedToReadLine = false;
- }
-
- OFlatConnection* pConnection = (OFlatConnection*)m_pConnection;
- const sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter();
- const sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter();
- // Fields:
- xub_StrLen nStartPos = 0;
- String aStr;
- OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin();
- OSQLColumns::Vector::const_iterator aEnd = _rCols.get().end();
- const OValueRefVector::Vector::size_type nCount = _rRow->get().size();
- for (OValueRefVector::Vector::size_type i = 1; aIter != aEnd && i < nCount;
- ++aIter, i++)
- {
- m_aCurrentLine.GetTokenSpecial(aStr,nStartPos,m_cFieldDelimiter,m_cStringDelimiter);
-
- if (aStr.Len() == 0)
- (_rRow->get())[i]->setNull();
- else
- {
- // lengths depending on data-type:
- sal_Int32 nLen,
- nType = 0;
- if(bIsTable)
- {
- nLen = m_aPrecisions[i-1];
- nType = m_aTypes[i-1];
- }
- else
- {
- Reference< XPropertySet> xColumn = *aIter;
- xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nLen;
- xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nType;
- }
- switch(nType)
- {
- case DataType::TIMESTAMP:
- case DataType::DATE:
- case DataType::TIME:
- {
- try
- {
- double nRes = m_xNumberFormatter->convertStringToNumber(::com::sun::star::util::NumberFormat::ALL,aStr);
-
- switch(nType)
- {
- case DataType::DATE:
- *(_rRow->get())[i] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(nRes,m_aNullDate));
- break;
- case DataType::TIMESTAMP:
- *(_rRow->get())[i] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDateTime(nRes,m_aNullDate));
- break;
- default:
- *(_rRow->get())[i] = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(nRes));
- }
- }
- catch(Exception&)
- {
- (_rRow->get())[i]->setNull();
- }
- } break;
- case DataType::DOUBLE:
- case DataType::INTEGER:
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- {
-
- String aStrConverted;
- if ( DataType::INTEGER != nType )
- {
- sal_Unicode* pData = aStrConverted.AllocBuffer(aStr.Len());
- const sal_Unicode* pStart = pData;
-
- OSL_ENSURE((cDecimalDelimiter && nType != DataType::INTEGER) ||
- (!cDecimalDelimiter && nType == DataType::INTEGER),
- "FalscherTyp");
-
- // convert to Standard-Notation (DecimalPOINT without thousands-comma):
- for (xub_StrLen j = 0; j < aStr.Len(); ++j)
- {
- const sal_Unicode cChar = aStr.GetChar(j);
- if (cDecimalDelimiter && cChar == cDecimalDelimiter)
- *pData++ = '.';
- //aStrConverted.Append( '.' );
- else if ( cChar == '.' ) // special case, if decimal seperator isn't '.' we have to put the string after it
- continue;
- else if (cThousandDelimiter && cChar == cThousandDelimiter)
- {
- // leave out
- }
- else
- *pData++ = cChar;
- //aStrConverted.Append(cChar);
- } // for (xub_StrLen j = 0; j < aStr.Len(); ++j)
- aStrConverted.ReleaseBufferAccess(xub_StrLen(pData - pStart));
- } // if ( DataType::INTEGER != nType )
- else
- {
- aStrConverted = aStr;
- if ( cThousandDelimiter )
- aStrConverted.EraseAllChars(cThousandDelimiter);
- }
- const double nVal = ::rtl::math::stringToDouble(aStrConverted,'.',',',NULL,NULL);
-
- // #99178# OJ
- if ( DataType::DECIMAL == nType || DataType::NUMERIC == nType )
- *(_rRow->get())[i] = ::rtl::OUString::valueOf(nVal);
- else
- *(_rRow->get())[i] = nVal;
- } break;
-
- default:
- {
- // Copy Value as String in Row-Variable
- *(_rRow->get())[i] = ORowSetValue(aStr);
- }
- break;
- } // switch(nType)
- (_rRow->get())[i]->setTypeKind(nType);
- }
- }
- return sal_True;
-}
-void OFlatTable::refreshHeader()
-{
- m_nRowPos = 0;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::seekRow" );
- OSL_ENSURE(m_pFileStream,"OFlatTable::seekRow: FileStream is NULL!");
- // ----------------------------------------------------------
- // Prepare positioning:
- m_nFilePos = nCurPos;
-
- switch(eCursorPosition)
- {
- case IResultSetHelper::FIRST:
- m_nRowPos = 0;
- // run through
- case IResultSetHelper::NEXT:
- {
- ++m_nRowPos;
- ::std::map<sal_Int32,TRowPositionsInFile::iterator>::const_iterator aFind = m_aRowPosToFilePos.find(m_nRowPos);
- m_bNeedToReadLine = aFind != m_aRowPosToFilePos.end();
- if ( m_bNeedToReadLine )
- {
- m_nFilePos = aFind->second->first;
- nCurPos = aFind->second->second;
- } // if ( m_bNeedToReadLine )
- else
- {
- if ( m_nRowPos == 1 )
- m_nFilePos = m_nStartRowFilePos;
- m_pFileStream->Seek(m_nFilePos);
- if ( m_pFileStream->IsEof() || !readLine(nCurPos) /*|| !checkHeaderLine()*/)
- {
- m_nMaxRowCount = m_nRowPos -1;
- return sal_False;
- } // if ( m_pFileStream->IsEof() || !readLine(nCurPos) /*|| !checkHeaderLine()*/)
-
- TRowPositionsInFile::iterator aPos = m_aFilePosToEndLinePos.insert(TRowPositionsInFile::value_type(m_nFilePos,nCurPos)).first;
- m_aRowPosToFilePos.insert(::std::map<sal_Int32,TRowPositionsInFile::iterator>::value_type(m_nRowPos,aPos));
- }
- }
-
- break;
- case IResultSetHelper::PRIOR:
- --m_nRowPos;
- if(m_nRowPos > 0)
- {
- TRowPositionsInFile::iterator aPositions = m_aRowPosToFilePos[m_nRowPos];
- m_nFilePos = aPositions->first;
- nCurPos = aPositions->second;
- m_bNeedToReadLine = true;
- }
- else
- m_nRowPos = 0;
-
- break;
- case IResultSetHelper::LAST:
- if ( m_nMaxRowCount )
- {
- ::std::map<sal_Int32,TRowPositionsInFile::iterator>::reverse_iterator aLastPos = m_aRowPosToFilePos.rbegin();
- m_nRowPos = aLastPos->first;
- m_nFilePos = aLastPos->second->first;
- nCurPos = aLastPos->second->second;
-
- //m_pFileStream->Seek(m_nFilePos);
- m_bNeedToReadLine = true;
- //if ( m_pFileStream->IsEof() /*|| !checkHeaderLine()*/ || !readLine(nCurPos) )
- // return sal_False;
- }
- else
- {
- while(seekRow(IResultSetHelper::NEXT,1,nCurPos)) ; // run through after last row
- // now I know all
- seekRow(IResultSetHelper::PRIOR,1,nCurPos);
- }
- break;
- case IResultSetHelper::RELATIVE:
- if(nOffset > 0)
- {
- for(sal_Int32 i = 0;i<nOffset;++i)
- seekRow(IResultSetHelper::NEXT,1,nCurPos);
- }
- else if(nOffset < 0)
- {
- for(sal_Int32 i = nOffset;i;++i)
- seekRow(IResultSetHelper::PRIOR,1,nCurPos);
- }
- break;
- case IResultSetHelper::ABSOLUTE:
- {
- if(nOffset < 0)
- nOffset = m_nRowPos + nOffset;
- ::std::map<sal_Int32,TRowPositionsInFile::iterator>::const_iterator aIter = m_aRowPosToFilePos.find(nOffset);
- if(aIter != m_aRowPosToFilePos.end())
- {
- m_nFilePos = aIter->second->first;
- nCurPos = aIter->second->second;
- //m_pFileStream->Seek(m_nFilePos);
- m_bNeedToReadLine = true;
- //if ( m_pFileStream->IsEof() /*|| !checkHeaderLine()*/ || !readLine(nCurPos) )
- // return sal_False;
- }
- else if(m_nMaxRowCount && nOffset > m_nMaxRowCount) // offset is outside the table
- {
- m_nRowPos = m_nMaxRowCount;
- return sal_False;
- }
- else
- {
- aIter = m_aRowPosToFilePos.upper_bound(nOffset);
- if(aIter == m_aRowPosToFilePos.end())
- {
- ::std::map<sal_Int32,TRowPositionsInFile::iterator>::reverse_iterator aLastPos = m_aRowPosToFilePos.rbegin();
- m_nRowPos = aLastPos->first;
- nCurPos = m_nFilePos = aLastPos->second->first;
- while(m_nRowPos != nOffset)
- seekRow(IResultSetHelper::NEXT,1,nCurPos);
- }
- else
- {
- --aIter;
- m_nRowPos = aIter->first;
- m_nFilePos = aIter->second->first;
- nCurPos = aIter->second->second;
- //m_pFileStream->Seek(m_nFilePos);
- m_bNeedToReadLine = true;
- //if ( m_pFileStream->IsEof() /*|| !checkHeaderLine()*/ || !readLine(nCurPos) )
- // return sal_False;
- }
- }
- }
-
- break;
- case IResultSetHelper::BOOKMARK:
- {
- TRowPositionsInFile::const_iterator aFind = m_aFilePosToEndLinePos.find(nOffset);
- m_bNeedToReadLine = aFind != m_aFilePosToEndLinePos.end();
- if ( m_bNeedToReadLine )
- {
- m_nFilePos = aFind->first;
- nCurPos = aFind->second;
- }
- else
- {
- m_nFilePos = nOffset;
- m_pFileStream->Seek(nOffset);
- if (m_pFileStream->IsEof() || !readLine(nCurPos) )
- return sal_False;
- }
- break;
- }
- }
-
- //nCurPos = m_nFilePos;
-
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OFlatTable::readLine(sal_Int32& _rnCurrentPos)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::readLine" );
- const rtl_TextEncoding nEncoding = m_pConnection->getTextEncoding();
- m_pFileStream->ReadByteStringLine(m_aCurrentLine,nEncoding);
- if (m_pFileStream->IsEof())
- return sal_False;
-
- QuotedTokenizedString sLine = m_aCurrentLine; // check if the string continues on next line
- while( (sLine.GetString().GetTokenCount(m_cStringDelimiter) % 2) != 1 )
- {
- m_pFileStream->ReadByteStringLine(sLine,nEncoding);
- if ( !m_pFileStream->IsEof() )
- {
- m_aCurrentLine.GetString().Append('\n');
- m_aCurrentLine.GetString() += sLine.GetString();
- sLine = m_aCurrentLine;
- }
- else
- break;
- }
- _rnCurrentPos = m_pFileStream->Tell();
- return sal_True;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/ETables.cxx b/connectivity/source/drivers/flat/ETables.cxx
deleted file mode 100644
index e709141b52..0000000000
--- a/connectivity/source/drivers/flat/ETables.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "flat/ETables.hxx"
-#include "flat/ETable.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include "file/FCatalog.hxx"
-#include "file/FConnection.hxx"
-#include <comphelper/types.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;
-namespace starutil = ::com::sun::star::util;
-
-sdbcx::ObjectType OFlatTables::createObject(const ::rtl::OUString& _rName)
-{
- OFlatTable* pRet = new OFlatTable(this,(OFlatConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(),
- _rName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE")));
- sdbcx::ObjectType xRet = pRet;
- pRet->construct();
- return xRet;
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/Eservices.cxx b/connectivity/source/drivers/flat/Eservices.cxx
deleted file mode 100644
index 445d81f7cf..0000000000
--- a/connectivity/source/drivers/flat/Eservices.cxx
+++ /dev/null
@@ -1,114 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "flat/EDriver.hxx"
-#include <cppuhelper/factory.hxx>
-
-using namespace connectivity::flat;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount* _pT
- );
-
-//---------------------------------------------------------------------------------------
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- sal_Char const* pImplementationName
- )
- : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- inline
- sal_Bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
- }
- catch(...)
- {
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = 0;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- ODriver::getImplementationName_Static(),
- ODriver::getSupportedServiceNames_Static(),
- ODriver_CreateInstance, ::cppu::createSingleFactory)
- ;
-
- if(aReq.xRet.is())
- aReq.xRet->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/exports.dxp b/connectivity/source/drivers/flat/exports.dxp
deleted file mode 100755
index 7003307892..0000000000
--- a/connectivity/source/drivers/flat/exports.dxp
+++ /dev/null
@@ -1 +0,0 @@
-component_getFactory
diff --git a/connectivity/source/drivers/flat/flat.component b/connectivity/source/drivers/flat/flat.component
deleted file mode 100755
index fe8b79ee73..0000000000
--- a/connectivity/source/drivers/flat/flat.component
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.sdbc.flat.ODriver">
- <service name="com.sun.star.sdbc.Driver"/>
- <service name="com.sun.star.sdbcx.Driver"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/flat/flat.mxp.map b/connectivity/source/drivers/flat/flat.mxp.map
deleted file mode 100755
index 9a6cbf91b7..0000000000
--- a/connectivity/source/drivers/flat/flat.mxp.map
+++ /dev/null
@@ -1,139 +0,0 @@
-component_getFactory
-__mh_dylib_header
-___builtin_delete
-___builtin_vec_delete
-___builtin_vec_new
-___check_eh_spec
-___cp_pop_exception
-___cp_push_exception
-___eh_alloc
-___get_eh_context
-___pure_virtual
-___rtti_class
-___rtti_si
-___rtti_user
-___sjthrow
-___start_cp_handler
-___terminate
-_terminate__Fv
-dyld_stub_binding_helper
-rest_world
-save_world
-___eh_rtime_match
-___builtin_new
-___tf9bad_alloc
-__._10bad_typeid
-__._8bad_cast
-___get_eh_info
-___is_pointer__FPv
-___throw_type_match_rtti
-___vt_10bad_typeid
-___vt_8bad_cast
-__keymgr_get_per_thread_data
-__keymgr_set_per_thread_data
-___tf9exception
-___ti9exception
-___vt_9exception
-_what__C9exception
-__._9bad_alloc
-___vt_9bad_alloc
-__._9type_info
-___eq__C9type_infoRCB0
-___tf16__user_type_info
-___tf9type_info
-___ti9type_info
-___vt_9type_info
-__._Q312connectivity4flat18UStringDescription
-___Q312connectivity4flat18UStringDescriptionPFv_PCc
-_getPropertySetInfo__Q312connectivity4flat14OFlatResultSet
-_release__Q312connectivity4flat14OFlatResultSet
-_acquire__Q312connectivity4flat14OFlatResultSet
-__._Q312connectivity4flat14OFlatResultSet
-__._Q312connectivity4flat14OFlatStatement
-__._Q312connectivity4flat22OFlatPreparedStatement
-__._Q312connectivity4flat10OFlatTable
-_toDouble__FRC10ByteString
-_checkHeaderLine__Q312connectivity4flat10OFlatTable
-_refreshColumns__Q312connectivity4flat10OFlatTable
-_AllocBuffer__Q312connectivity4flat10OFlatTable
-_fillColumns__Q312connectivity4flat10OFlatTable
-_getEntry__Q312connectivity4flat10OFlatTable
-_GetToken__CQ312connectivity4flat11OFlatStringUsUcUc
-_GetTokenCount__CQ312connectivity4flat11OFlatStringUcUc
-_refreshTables__Q312connectivity4flat12OFlatCatalog
-_getPropertySetInfo__Q312connectivity4file26ODatabaseMetaDataResultSet
-_release__Q312connectivity4file26ODatabaseMetaDataResultSet
-_acquire__Q312connectivity4file26ODatabaseMetaDataResultSet
-_getPropertySetInfo__Q312connectivity4file10OResultSet
-_release__Q312connectivity4file10OResultSet
-_acquire__Q312connectivity4file10OResultSet
-_scanParameter__Q312connectivity4file10OResultSetPQ212connectivity13OSQLParseNodeRQ24_STLt6vector2ZPB1ZQ24_STLt9allocator1ZPB1
-_AddParameter__Q312connectivity4file10OResultSetPQ212connectivity13OSQLParseNodeRCQ53com3sun4star3unot9Reference1ZQ53com3sun4star5beans12XPropertySet
-_SetAssignValue__Q312connectivity4file10OResultSetRC6Stringn1UcUl
-_ParseAssignValues__Q312connectivity4file10OResultSetRCQ24_STLt6vector2Z6StringZQ24_STLt9allocator1ZB2PQ212connectivity13OSQLParseNodeUs
-_getUnoTunnelImplementationId__Q312connectivity4file10OResultSet
-_setOrderbyColumn__Q312connectivity4file10OResultSetUsPQ212connectivity13OSQLParseNoden1
-_CreateKeySet__Q312connectivity4file14OFILESortIndex
-___Q312connectivity4file14OFILESortIndexPCQ312connectivity4file8OKeyTypePCUclUs
-_anylizeSQL__Q312connectivity4file10OResultSet
-_GetAssignValues__Q312connectivity4file10OResultSet
-_moveAbsolute__Q312connectivity4file10OResultSetlUc
-_ExecuteRow__Q312connectivity4file10OResultSetQ412connectivity4file10OFileTable12FilePositionlUcn2
-_AddKeyValue__Q312connectivity4file14OFILESortIndexPQ312connectivity4file13OFILEKeyValue
-_GetOrderbyKeyValue__Q312connectivity4file10OResultSetGQ23vost4ORef1ZQ312connectivity4file12OValueVector
-_evaluate__Q312connectivity4file10OResultSet
-_SkipDeleted__Q312connectivity4file10OResultSetQ412connectivity4file10OFileTable12FilePositionlUc
-__._Q312connectivity4file14OFILESortIndex
-_construct__Q312connectivity4file10OResultSet
-_isCount__CQ312connectivity4file10OResultSet
-__._Q312connectivity4file18UStringDescription
-___Q312connectivity4file18UStringDescriptionPFv_PCc
-_disposing__Q312connectivity4file15OStatement_Base
-_acquire__Q312connectivity4file15OStatement_Base
-__._Q312connectivity4file16OStatement_BASE2
-__._Q312connectivity4file10OStatement
-_disposeResultSet__Q312connectivity4file15OStatement_Base
-_getImplementationName_Static__Q312connectivity4file11OFileDriver
-_operate__CQ312connectivity4file8OOp_LIKEPCQ312connectivity4file8OOperandn1
-_operate__CQ312connectivity4file10OOp_ISNULLPCQ312connectivity4file8OOperandn1
-_IsOf__Q312connectivity4file12ONumOperatorPFv_Pv
-_StaticType__Q312connectivity4file12ONumOperator
-_IsOf__Q312connectivity4file11OOp_COMPAREPFv_Pv
-_StaticType__Q312connectivity4file11OOp_COMPARE
-_IsOf__Q312connectivity4file11OOp_NOTLIKEPFv_Pv
-_StaticType__Q312connectivity4file11OOp_NOTLIKE
-_IsOf__Q312connectivity4file8OOp_LIKEPFv_Pv
-_StaticType__Q312connectivity4file8OOp_LIKE
-_IsOf__Q312connectivity4file13OOp_ISNOTNULLPFv_Pv
-_StaticType__Q312connectivity4file13OOp_ISNOTNULL
-_IsOf__Q312connectivity4file10OOp_ISNULLPFv_Pv
-_StaticType__Q312connectivity4file10OOp_ISNULL
-_IsOf__Q312connectivity4file6OOp_ORPFv_Pv
-_StaticType__Q312connectivity4file6OOp_OR
-_IsOf__Q312connectivity4file7OOp_ANDPFv_Pv
-_StaticType__Q312connectivity4file7OOp_AND
-_IsOf__Q312connectivity4file13OBoolOperatorPFv_Pv
-_IsOf__Q312connectivity4file9OOperatorPFv_Pv
-_IsOf__Q312connectivity4file14OOperandResultPFv_Pv
-_IsOf__Q312connectivity4file13OOperandConstPFv_Pv
-_IsOf__Q312connectivity4file13OOperandValuePFv_Pv
-_StaticType__Q312connectivity4file13OOperandValue
-_IsOf__Q312connectivity4file13OOperandParamPFv_Pv
-_IsOf__Q312connectivity4file16OFILEOperandAttrPFv_Pv
-_StaticType__Q312connectivity4file16OFILEOperandAttr
-_IsOf__Q312connectivity4file12OOperandAttrPFv_Pv
-_IsOf__Q312connectivity4file11OOperandRowPFv_Pv
-_StaticType__Q312connectivity4file11OOperandRow
-_IsOf__Q312connectivity4file8OOperandPFv_Pv
-_IsOf__Q312connectivity4file5OCodePFv_Pv
-_StaticType__Q312connectivity4file5OCode
-__._Q312connectivity4file5OCode
-_execute_Operand__Q312connectivity4file18OPredicateCompilerPQ212connectivity13OSQLParseNode
-_execute_ISNULL__Q312connectivity4file18OPredicateCompilerPQ212connectivity13OSQLParseNode
-_execute_LIKE__Q312connectivity4file18OPredicateCompilerPQ212connectivity13OSQLParseNode
-_execute_COMPARE__Q312connectivity4file18OPredicateCompilerPQ212connectivity13OSQLParseNode
-___tf13bad_exception
-___uncatch_exception
-___eh_free
-___tfv
-___dynamic_cast
diff --git a/connectivity/source/drivers/flat/flat.xcu b/connectivity/source/drivers/flat/flat.xcu
deleted file mode 100644
index ba43121844..0000000000
--- a/connectivity/source/drivers/flat/flat.xcu
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="sdbc:flat:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.flat.ODriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Text</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="CharSet" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="Extension" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="HeaderLine" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FieldDelimiter" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>,</value>
- </prop>
- </node>
- <node oor:name="StringDelimiter" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>"</value>
- </prop>
- </node>
- <node oor:name="DecimalDelimiter" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>.</value>
- </prop>
- </node>
- <node oor:name="ThousandDelimiter" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="EnableSQL92Check" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- <node oor:name="MaxRowScan" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:int">
- <value>100</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="MaxRowScan" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FileSystemBased" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="MediaType" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>text/csv</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/flat/flat.xml b/connectivity/source/drivers/flat/flat.xml
deleted file mode 100755
index 77b45c48da..0000000000
--- a/connectivity/source/drivers/flat/flat.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE module-description PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
-<module-description>
- <module-name>file</module-name>
- <component-description>
- <author>Ocke Jannsen</author>
- <name>com.sun.star.comp.sdbc.flat.ODriver</name>
- <description>This library implements the database driver for flat file formats.
-</description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service>com.sun.star.sdbc.Driver</supported-service>
- <supported-service>com.sun.star.sdbcx.Driver</supported-service>
- <service-dependency> ... </service-dependency>
- </component-description>
- <project-build-dependency>cppuhelper</project-build-dependency>
- <project-build-dependency>cppu</project-build-dependency>
- <project-build-dependency>sal</project-build-dependency>
- <runtime-module-dependency>file</runtime-module-dependency>
- <runtime-module-dependency>cppuhelper</runtime-module-dependency>
- <runtime-module-dependency>cppu</runtime-module-dependency>
- <runtime-module-dependency>sal</runtime-module-dependency>
- <runtime-module-dependency>osl</runtime-module-dependency>
- <runtime-module-dependency>svtools-light1</runtime-module-dependency>
- <runtime-module-dependency>svtools</runtime-module-dependency>
- <runtime-module-dependency>ucbhelper</runtime-module-dependency>
- <runtime-module-dependency>dbtools</runtime-module-dependency>
- <runtime-module-dependency>unotools</runtime-module-dependency>
- <runtime-module-dependency>comphelper</runtime-module-dependency>
-</module-description>
diff --git a/connectivity/source/drivers/flat/makefile.mk b/connectivity/source/drivers/flat/makefile.mk
deleted file mode 100755
index 0fe857919d..0000000000
--- a/connectivity/source/drivers/flat/makefile.mk
+++ /dev/null
@@ -1,115 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=flat
-
-VISIBILITY_HIDDEN=TRUE
-
-# --- Settings ----------------------------------
-.IF "$(DBGUTIL_OJ)"!=""
-ENVCFLAGS+=/FR$(SLO)$/
-.ENDIF
-
-.INCLUDE : $(PRJ)$/makefile.pmk
-.INCLUDE : $(PRJ)$/version.mk
-
-
-# --- Files -------------------------------------
-
-SLOFILES=\
- $(SLO)$/EResultSet.obj \
- $(SLO)$/EStatement.obj \
- $(SLO)$/EPreparedStatement.obj \
- $(SLO)$/ETable.obj \
- $(SLO)$/EDatabaseMetaData.obj \
- $(SLO)$/ECatalog.obj \
- $(SLO)$/EColumns.obj \
- $(SLO)$/ETables.obj \
- $(SLO)$/EConnection.obj \
- $(SLO)$/Eservices.obj \
- $(SLO)$/EDriver.obj
-
-EXCEPTIONSFILES=\
- $(SLO)$/EResultSet.obj \
- $(SLO)$/EStatement.obj \
- $(SLO)$/EPreparedStatement.obj \
- $(SLO)$/ETable.obj \
- $(SLO)$/EDatabaseMetaData.obj \
- $(SLO)$/ECatalog.obj \
- $(SLO)$/EColumns.obj \
- $(SLO)$/ETables.obj \
- $(SLO)$/EConnection.obj \
- $(SLO)$/Eservices.obj \
- $(SLO)$/EDriver.obj
-
-
-SHL1VERSIONMAP=$(SOLARENV)/src/component.map
-
-# --- Library -----------------------------------
-SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(TOOLSLIB) \
- $(SVLLIB) \
- $(UNOTOOLSLIB) \
- $(SALLIB) \
- $(SALHELPERLIB) \
- $(DBTOOLSLIB) \
- $(DBFILELIB) \
- $(COMPHELPERLIB)
-
-.IF "$(DBFILELIB)" == ""
-SHL1STDLIBS+= ifile.lib
-.ENDIF
-
-SHL1DEPN=
-SHL1IMPLIB= i$(TARGET)
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
-
-
-# --- Targets ----------------------------------
-
-.INCLUDE : $(PRJ)$/target.pmk
-
-
-
-ALLTAR : $(MISC)/flat.component
-
-$(MISC)/flat.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- flat.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt flat.component
diff --git a/connectivity/source/drivers/hsqldb/HCatalog.cxx b/connectivity/source/drivers/hsqldb/HCatalog.cxx
deleted file mode 100644
index 7c7d66fc00..0000000000
--- a/connectivity/source/drivers/hsqldb/HCatalog.cxx
+++ /dev/null
@@ -1,167 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "hsqldb/HCatalog.hxx"
-#include "hsqldb/HUsers.hxx"
-#include "hsqldb/HTables.hxx"
-#include "hsqldb/HViews.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <comphelper/types.hxx>
-
-
-// -------------------------------------------------------------------------
-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)
-{
-}
-// -----------------------------------------------------------------------------
-void OHCatalog::refreshObjects(const Sequence< ::rtl::OUString >& _sKindOfObject,TStringVector& _rNames)
-{
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),
- _sKindOfObject);
- fillNames(xResult,_rNames);
-}
-// -------------------------------------------------------------------------
-void OHCatalog::refreshTables()
-{
- TStringVector aVector;
- static const ::rtl::OUString s_sTableTypeView(RTL_CONSTASCII_USTRINGPARAM("VIEW"));
- static const ::rtl::OUString s_sTableTypeTable(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
-
- Sequence< ::rtl::OUString > sTableTypes(2);
- sTableTypes[0] = s_sTableTypeView;
- sTableTypes[1] = s_sTableTypeTable;
-
- refreshObjects(sTableTypes,aVector);
-
- if ( m_pTables )
- m_pTables->reFill(aVector);
- else
- m_pTables = new OTables(m_xMetaData,*this,m_aMutex,aVector);
-}
-// -------------------------------------------------------------------------
-void OHCatalog::refreshViews()
-{
- Sequence< ::rtl::OUString > aTypes(1);
- aTypes[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW"));
-
- sal_Bool bSupportsViews = sal_False;
- try
- {
- Reference<XResultSet> xRes = m_xMetaData->getTableTypes();
- Reference<XRow> xRow(xRes,UNO_QUERY);
- while ( xRow.is() && xRes->next() )
- {
- if ( (bSupportsViews = xRow->getString(1).equalsIgnoreAsciiCase(aTypes[0])) )
- {
- break;
- }
- }
- }
- catch(const SQLException&)
- {
- }
-
- TStringVector aVector;
- if ( bSupportsViews )
- refreshObjects(aTypes,aVector);
-
- if ( m_pViews )
- m_pViews->reFill(aVector);
- else
- m_pViews = new HViews( m_xConnection, *this, m_aMutex, aVector );
-}
-// -------------------------------------------------------------------------
-void OHCatalog::refreshGroups()
-{
-}
-// -------------------------------------------------------------------------
-void OHCatalog::refreshUsers()
-{
- TStringVector aVector;
- Reference< XStatement > xStmt = m_xConnection->createStatement( );
- Reference< XResultSet > xResult = xStmt->executeQuery(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("select User from hsqldb.user group by User")));
- if ( xResult.is() )
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- TString2IntMap aMap;
- while( xResult->next() )
- aVector.push_back(xRow->getString(1));
- ::comphelper::disposeComponent(xResult);
- }
- ::comphelper::disposeComponent(xStmt);
-
- if(m_pUsers)
- m_pUsers->reFill(aVector);
- else
- m_pUsers = new OUsers(*this,m_aMutex,aVector,m_xConnection,this);
-}
-// -----------------------------------------------------------------------------
-Any SAL_CALL OHCatalog::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- if ( rType == ::getCppuType((const Reference<XGroupsSupplier>*)0) )
- return Any();
-
- return OCatalog::queryInterface(rType);
-}
-// -----------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OHCatalog::getTypes( ) throw(RuntimeException)
-{
- Sequence< Type > aTypes = OCatalog::getTypes();
- ::std::vector<Type> aOwnTypes;
- aOwnTypes.reserve(aTypes.getLength());
- const Type* pBegin = aTypes.getConstArray();
- const Type* pEnd = pBegin + aTypes.getLength();
- for(;pBegin != pEnd;++pBegin)
- {
- if ( !(*pBegin == ::getCppuType((const Reference<XGroupsSupplier>*)0)))
- {
- aOwnTypes.push_back(*pBegin);
- }
- }
- const Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- return Sequence< Type >(pTypes, aOwnTypes.size());
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HColumns.cxx b/connectivity/source/drivers/hsqldb/HColumns.cxx
deleted file mode 100644
index 8c7b58c33d..0000000000
--- a/connectivity/source/drivers/hsqldb/HColumns.cxx
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "hsqldb/HColumns.hxx"
-#include "TConnection.hxx"
-
-
-using namespace ::comphelper;
-using namespace connectivity::hsqldb;
-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
- ,sal_Bool _bCase
- ,::osl::Mutex& _rMutex
- ,const TStringVector &_rVector
- ,sal_Bool _bUseHardRef
- ) : OColumnsHelper(_rParent,_bCase,_rMutex,_rVector,_bUseHardRef)
-{
-}
-// -----------------------------------------------------------------------------
-Reference< XPropertySet > OHSQLColumns::createDescriptor()
-{
- return new OHSQLColumn(sal_True);
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-OHSQLColumn::OHSQLColumn( sal_Bool _bCase)
- : connectivity::sdbcx::OColumn( _bCase )
-{
- construct();
-}
-// -------------------------------------------------------------------------
-void OHSQLColumn::construct()
-{
- m_sAutoIncrement = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IDENTITY"));
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_AUTOINCREMENTCREATION),PROPERTY_ID_AUTOINCREMENTCREATION,0,&m_sAutoIncrement, ::getCppuType(&m_sAutoIncrement));
-}
-// -----------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OHSQLColumn::createArrayHelper( sal_Int32 /*_nId*/ ) const
-{
- return doCreateArrayHelper();
-}
-// -----------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & SAL_CALL OHSQLColumn::getInfoHelper()
-{
- return *OHSQLColumn_PROP::getArrayHelper(isNew() ? 1 : 0);
-}
-// -----------------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL OHSQLColumn::getSupportedServiceNames( ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(1);
- aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.Column"));
-
- return aSupported;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HConnection.cxx b/connectivity/source/drivers/hsqldb/HConnection.cxx
deleted file mode 100644
index 34888d13d1..0000000000
--- a/connectivity/source/drivers/hsqldb/HConnection.cxx
+++ /dev/null
@@ -1,386 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "hsqldb/HConnection.hxx"
-#include "hsqldb/HTools.hxx"
-#include "hsqlui.hrc"
-
-#include <connectivity/dbtools.hxx>
-
-/** === begin UNO includes === **/
-#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
-#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/graphic/XGraphicProvider.hpp>
-#include <com/sun/star/graphic/GraphicColorMode.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/sdbc/XDatabaseMetaData2.hpp>
-/** === end UNO includes === **/
-
-#include <comphelper/componentcontext.hxx>
-#include <comphelper/listenernotification.hxx>
-#include <comphelper/sequence.hxx>
-#include <cppuhelper/exc_hlp.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <tools/diagnose_ex.h>
-
-#include "resource/sharedresources.hxx"
-#include "resource/hsqldb_res.hrc"
-
-/** === begin UNO using === **/
-using ::com::sun::star::util::XFlushListener;
-using ::com::sun::star::lang::EventObject;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::sdbc::XStatement;
-using ::com::sun::star::sdbc::XConnection;
-using ::com::sun::star::sdbcx::XDataDefinitionSupplier;
-using ::com::sun::star::sdbcx::XTablesSupplier;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::beans::NamedValue;
-using ::com::sun::star::lang::WrappedTargetException;
-using ::com::sun::star::lang::ServiceNotRegisteredException;
-using ::com::sun::star::sdbc::XDriver;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::graphic::XGraphic;
-using ::com::sun::star::graphic::XGraphicProvider;
-using ::com::sun::star::uno::XInterface;
-using ::com::sun::star::lang::IllegalArgumentException;
-using ::com::sun::star::ui::dialogs::XExecutableDialog;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::makeAny;
-using ::com::sun::star::sdbc::XResultSet;
-using ::com::sun::star::sdbc::XDatabaseMetaData;
-using ::com::sun::star::sdbc::XDatabaseMetaData2;
-using ::com::sun::star::sdbc::XRow;
-using ::com::sun::star::sdb::application::XDatabaseDocumentUI;
-using ::com::sun::star::beans::PropertyValue;
-/** === end UNO using === **/
-namespace GraphicColorMode = ::com::sun::star::graphic::GraphicColorMode;
-
-namespace connectivity { namespace hsqldb
-{
- // =============================================================================
- // = FlushListeners
- // =============================================================================
- typedef ::comphelper::OListenerContainerBase< XFlushListener, EventObject > FlushListeners_Base;
- class FlushListeners : public FlushListeners_Base
- {
- public:
- FlushListeners( ::osl::Mutex& _rMutex ) :FlushListeners_Base( _rMutex ) { }
-
- protected:
- virtual bool implTypedNotify(
- const Reference< XFlushListener >& _rxListener,
- const EventObject& _rEvent
- ) SAL_THROW( ( Exception ) );
- };
-
- // -----------------------------------------------------------------------------
- bool FlushListeners::implTypedNotify( const Reference< XFlushListener >& _rxListener, const EventObject& _rEvent ) SAL_THROW( ( Exception ) )
- {
- _rxListener->flushed( _rEvent );
- return true; // continue notifying the other listeners, if any
- }
-
- // =============================================================================
- // = OHsqlConnection
- // =============================================================================
- // -----------------------------------------------------------------------------
- void SAL_CALL OHsqlConnection::disposing(void)
- {
- m_aFlushListeners.disposeAndClear( EventObject( *this ) );
- OHsqlConnection_BASE::disposing();
- OConnectionWrapper::disposing();
- }
- // -----------------------------------------------------------------------------
- OHsqlConnection::OHsqlConnection( const Reference< XDriver > _rxDriver,
- const Reference< XConnection >& _xConnection ,const Reference< XMultiServiceFactory>& _xORB )
- :OHsqlConnection_BASE( m_aMutex )
- ,m_aFlushListeners( m_aMutex )
- ,m_xDriver( _rxDriver )
- ,m_xORB( _xORB )
- ,m_bIni(true)
- ,m_bReadOnly(false)
- {
- setDelegation(_xConnection,_xORB,m_refCount);
- }
- // -----------------------------------------------------------------------------
- OHsqlConnection::~OHsqlConnection()
- {
- if ( !OHsqlConnection_BASE::rBHelper.bDisposed )
- {
- osl_incrementInterlockedCount( &m_refCount );
- dispose();
- }
- }
- // -----------------------------------------------------------------------------
- IMPLEMENT_FORWARD_XINTERFACE2(OHsqlConnection,OHsqlConnection_BASE,OConnectionWrapper)
- IMPLEMENT_SERVICE_INFO(OHsqlConnection, "com.sun.star.sdbc.drivers.hsqldb.OHsqlConnection", "com.sun.star.sdbc.Connection")
- IMPLEMENT_FORWARD_XTYPEPROVIDER2(OHsqlConnection,OHsqlConnection_BASE,OConnectionWrapper)
-
- //--------------------------------------------------------------------
- ::osl::Mutex& OHsqlConnection::getMutex() const
- {
- return m_aMutex;
- }
-
- //--------------------------------------------------------------------
- void OHsqlConnection::checkDisposed() const
- {
- ::connectivity::checkDisposed( rBHelper.bDisposed );
- }
-
- // XFlushable
- //--------------------------------------------------------------------
- void SAL_CALL OHsqlConnection::flush( ) throw (RuntimeException)
- {
- MethodGuard aGuard( *this );
-
- try
- {
- if ( m_xConnection.is() )
- {
- if ( m_bIni )
- {
- m_bIni = false;
- Reference< XDatabaseMetaData2 > xMeta2(m_xConnection->getMetaData(),UNO_QUERY_THROW);
- const Sequence< PropertyValue > aInfo = xMeta2->getConnectionInfo();
- const PropertyValue* pIter = aInfo.getConstArray();
- const PropertyValue* pEnd = pIter + aInfo.getLength();
- for(;pIter != pEnd;++pIter)
- {
- if ( pIter->Name.compareToAscii("readonly") == 0 )
- m_bReadOnly = true;
- }
- }
- if ( !m_bReadOnly )
- {
- Reference< XStatement > xStmt( m_xConnection->createStatement(), UNO_QUERY_THROW );
- xStmt->execute( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CHECKPOINT" ) ) );
- }
- }
-
- EventObject aFlushedEvent( *this );
- m_aFlushListeners.notifyEach( &XFlushListener::flushed, aFlushedEvent );
- }
- catch(const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL OHsqlConnection::addFlushListener( const Reference< XFlushListener >& l ) throw (RuntimeException)
- {
- MethodGuard aGuard( *this );
- m_aFlushListeners.addInterface( l );
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL OHsqlConnection::removeFlushListener( const Reference< XFlushListener >& l ) throw (RuntimeException)
- {
- MethodGuard aGuard( *this );
- m_aFlushListeners.removeInterface( l );
- }
-
- // -------------------------------------------------------------------
- Reference< XGraphic > SAL_CALL OHsqlConnection::getTableIcon( const ::rtl::OUString& _TableName, ::sal_Int32 /*_ColorMode*/ ) throw (RuntimeException)
- {
- MethodGuard aGuard( *this );
-
- impl_checkExistingTable_throw( _TableName );
- if ( !impl_isTextTable_nothrow( _TableName ) )
- return NULL;
-
- return impl_getTextTableIcon_nothrow();
- }
-
- // -------------------------------------------------------------------
- Reference< XInterface > SAL_CALL OHsqlConnection::getTableEditor( const Reference< XDatabaseDocumentUI >& _DocumentUI, const ::rtl::OUString& _TableName ) throw (IllegalArgumentException, WrappedTargetException, RuntimeException)
- {
- MethodGuard aGuard( *this );
-
- impl_checkExistingTable_throw( _TableName );
- if ( !impl_isTextTable_nothrow( _TableName ) )
- return NULL;
-
- if ( !_DocumentUI.is() )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(STR_NO_DOCUMENTUI));
- throw IllegalArgumentException(
- sError,
- *this,
- 0
- );
- } // if ( !_DocumentUI.is() )
-
-
-// Reference< XExecutableDialog > xEditor = impl_createLinkedTableEditor_throw( _DocumentUI, _TableName );
-// return xEditor.get();
- return NULL;
- // editor not yet implemented in this CWS
- }
-
- // -------------------------------------------------------------------
- Reference< XNameAccess > OHsqlConnection::impl_getTableContainer_throw()
- {
- Reference< XNameAccess > xTables;
- try
- {
- Reference< XConnection > xMe( *this, UNO_QUERY );
- Reference< XDataDefinitionSupplier > xDefinitionsSupp( m_xDriver, UNO_QUERY_THROW );
- Reference< XTablesSupplier > xTablesSupp( xDefinitionsSupp->getDataDefinitionByConnection( xMe ), UNO_QUERY_THROW );
- xTables.set( xTablesSupp->getTables(), UNO_QUERY_THROW );
- }
- catch( const RuntimeException& ) { throw; }
- catch( const Exception& )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(STR_NO_TABLE_CONTAINER));
- throw WrappedTargetException( sError ,*this, ::cppu::getCaughtException() );
- }
-
- OSL_POSTCOND( xTables.is(), "OHsqlConnection::impl_getTableContainer_throw: post condition not met!" );
- return xTables;
- }
-
- //TODO: resource
- // -------------------------------------------------------------------
- void OHsqlConnection::impl_checkExistingTable_throw( const ::rtl::OUString& _rTableName )
- {
- bool bDoesExist = false;
- try
- {
- Reference< XNameAccess > xTables( impl_getTableContainer_throw(), UNO_QUERY_THROW );
- if ( xTables.is() )
- bDoesExist = xTables->hasByName( _rTableName );
- }
- catch( const Exception& )
- {
- // that's a serious error in impl_getTableContainer_throw, or hasByName, however, we're only
- // allowed to throw an IllegalArgumentException ourself
- DBG_UNHANDLED_EXCEPTION();
- }
-
- if ( !bDoesExist )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(
- STR_NO_TABLENAME,
- "$tablename$", _rTableName
- ));
- throw IllegalArgumentException( sError,*this, 0 );
- } // if ( !bDoesExist )
- }
-
- // -------------------------------------------------------------------
- bool OHsqlConnection::impl_isTextTable_nothrow( const ::rtl::OUString& _rTableName )
- {
- bool bIsTextTable = false;
- try
- {
- Reference< XConnection > xMe( *this, UNO_QUERY_THROW );
-
- // split the fully qualified name
- Reference< XDatabaseMetaData > xMetaData( xMe->getMetaData(), UNO_QUERY_THROW );
- ::rtl::OUString sCatalog, sSchema, sName;
- ::dbtools::qualifiedNameComponents( xMetaData, _rTableName, sCatalog, sSchema, sName, ::dbtools::eComplete );
-
- // get the table information
- ::rtl::OUStringBuffer sSQL;
- sSQL.appendAscii( "SELECT HSQLDB_TYPE FROM INFORMATION_SCHEMA.SYSTEM_TABLES" );
- HTools::appendTableFilterCrit( sSQL, sCatalog, sSchema, sName, true );
- sSQL.appendAscii( " AND TABLE_TYPE = 'TABLE'" );
-
- Reference< XStatement > xStatement( xMe->createStatement(), UNO_QUERY_THROW );
- Reference< XResultSet > xTableHsqlType( xStatement->executeQuery( sSQL.makeStringAndClear() ), UNO_QUERY_THROW );
-
- if ( xTableHsqlType->next() ) // might not succeed in case of VIEWs
- {
- Reference< XRow > xValueAccess( xTableHsqlType, UNO_QUERY_THROW );
- ::rtl::OUString sTableType = xValueAccess->getString( 1 );
- bIsTextTable = sTableType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "TEXT" ) );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- return bIsTextTable;
- }
-
- // -------------------------------------------------------------------
- Reference< XGraphic > OHsqlConnection::impl_getTextTableIcon_nothrow()
- {
- Reference< XGraphic > xGraphic;
- try
- {
- // create a graphic provider
- Reference< XGraphicProvider > xProvider;
- if ( m_xORB.is() )
- xProvider.set( m_xORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ), UNO_QUERY_THROW );
-
- // assemble the image URL
- ::rtl::OUStringBuffer aImageURL;
- // load the graphic from the global graphic repository
- aImageURL.appendAscii( "private:graphicrepository/" );
- // the relative path within the images.zip
- aImageURL.appendAscii( "database/" );
- aImageURL.appendAscii( LINKED_TEXT_TABLE_IMAGE_RESOURCE );
- // the name of the graphic to use
- ::rtl::OUString sImageURL( aImageURL.makeStringAndClear() );
-
- // ask the provider to obtain a graphic
- Sequence< PropertyValue > aMediaProperties( 1 );
- aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
- aMediaProperties[0].Value <<= sImageURL;
- xGraphic = xProvider->queryGraphic( aMediaProperties );
- OSL_ENSURE( xGraphic.is(), "OHsqlConnection::impl_getTextTableIcon_nothrow: the provider did not give us a graphic object!" );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return xGraphic;
- }
-
-} } // namespace connectivity::hsqldb
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx
deleted file mode 100644
index bdad9dac75..0000000000
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ /dev/null
@@ -1,924 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "hsqldb/HDriver.hxx"
-#include "hsqldb/HConnection.hxx"
-#include <osl/diagnose.h>
-#include "connectivity/dbexception.hxx"
-#include <com/sun/star/sdbc/XDriverAccess.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/embed/XTransactionBroadcaster.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include "TConnection.hxx"
-#include "hsqldb/HStorageMap.hxx"
-#include <jvmfwk/framework.h>
-#include <com/sun/star/reflection/XProxyFactory.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
-#include <com/sun/star/lang/Locale.hpp>
-#include <com/sun/star/util/XFlushable.hpp>
-#include "HTerminateListener.hxx"
-#include "hsqldb/HCatalog.hxx"
-#include "diagnose_ex.h"
-#include <rtl/ustrbuf.hxx>
-#include <osl/file.h>
-#include <osl/process.h>
-#include <connectivity/dbexception.hxx>
-#include <comphelper/namedvaluecollection.hxx>
-#include <unotools/confignode.hxx>
-#include <unotools/ucbstreamhelper.hxx>
-#include "resource/hsqldb_res.hrc"
-#include "resource/sharedresources.hxx"
-
-#include <o3tl/compat_functional.hxx>
-
-//........................................................................
-namespace connectivity
-{
-//........................................................................
- using namespace hsqldb;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::sdbcx;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::frame;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::embed;
- using namespace ::com::sun::star::io;
- using namespace ::com::sun::star::task;
- using namespace ::com::sun::star::util;
- using namespace ::com::sun::star::reflection;
-
- namespace hsqldb
- {
- Reference< XInterface > SAL_CALL ODriverDelegator_CreateInstance(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFac) throw( Exception )
- {
- return *(new ODriverDelegator(_rxFac));
- }
- }
-
-
-
- //====================================================================
- //= ODriverDelegator
- //====================================================================
- //--------------------------------------------------------------------
- ODriverDelegator::ODriverDelegator(const Reference< XMultiServiceFactory >& _rxFactory)
- : ODriverDelegator_BASE(m_aMutex)
- ,m_xFactory(_rxFactory)
- ,m_bInShutDownConnections(sal_False)
- {
- }
-
- //--------------------------------------------------------------------
- ODriverDelegator::~ODriverDelegator()
- {
- try
- {
- ::comphelper::disposeComponent(m_xDriver);
- }
- catch(const Exception&)
- {
- }
- }
-
- // --------------------------------------------------------------------------------
- void SAL_CALL ODriverDelegator::disposing()
- {
- ::osl::MutexGuard aGuard(m_aMutex);
-
- try
- {
- for (TWeakPairVector::iterator i = m_aConnections.begin(); m_aConnections.end() != i; ++i)
- {
- Reference<XInterface > xTemp = i->first.get();
- ::comphelper::disposeComponent(xTemp);
- }
- }
- catch(Exception&)
- {
- // not interested in
- }
- m_aConnections.clear();
- TWeakPairVector().swap(m_aConnections);
-
- cppu::WeakComponentImplHelperBase::disposing();
- }
- //--------------------------------------------------------------------
- Reference< XDriver > ODriverDelegator::loadDriver( )
- {
- if ( !m_xDriver.is() )
- {
- ::rtl::OUString sURL(RTL_CONSTASCII_USTRINGPARAM("jdbc:hsqldb:db"));
- Reference<XDriverAccess> xDriverAccess(m_xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.DriverManager")) ),UNO_QUERY);
- OSL_ENSURE(xDriverAccess.is(),"Could not load driver manager!");
- if ( xDriverAccess.is() )
- m_xDriver = xDriverAccess->getDriverByURL(sURL);
- }
-
- return m_xDriver;
- }
-
- //--------------------------------------------------------------------
- namespace
- {
- ::rtl::OUString lcl_getPermittedJavaMethods_nothrow( const Reference< XMultiServiceFactory >& _rxORB )
- {
- ::rtl::OUStringBuffer aConfigPath;
- aConfigPath.appendAscii( "/org.openoffice.Office.DataAccess/DriverSettings/" );
- aConfigPath.append ( ODriverDelegator::getImplementationName_Static() );
- aConfigPath.appendAscii( "/PermittedJavaMethods" );
- ::utl::OConfigurationTreeRoot aConfig( ::utl::OConfigurationTreeRoot::createWithServiceFactory(
- _rxORB, aConfigPath.makeStringAndClear() ) );
-
- ::rtl::OUStringBuffer aPermittedMethods;
- Sequence< ::rtl::OUString > aNodeNames( aConfig.getNodeNames() );
- for ( const ::rtl::OUString* pNodeNames = aNodeNames.getConstArray();
- pNodeNames != aNodeNames.getConstArray() + aNodeNames.getLength();
- ++pNodeNames
- )
- {
- ::rtl::OUString sPermittedMethod;
- OSL_VERIFY( aConfig.getNodeValue( *pNodeNames ) >>= sPermittedMethod );
-
- if ( aPermittedMethods.getLength() )
- aPermittedMethods.append( (sal_Unicode)';' );
- aPermittedMethods.append( sPermittedMethod );
- }
-
- return aPermittedMethods.makeStringAndClear();;
- }
- }
-
- //--------------------------------------------------------------------
- Reference< XConnection > SAL_CALL ODriverDelegator::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw (SQLException, RuntimeException)
- {
- Reference< XConnection > xConnection;
- if ( acceptsURL(url) )
- {
- Reference< XDriver > xDriver = loadDriver();
- if ( xDriver.is() )
- {
- ::rtl::OUString sURL;
- Reference<XStorage> xStorage;
- const PropertyValue* pIter = info.getConstArray();
- const PropertyValue* pEnd = pIter + info.getLength();
-
- for (;pIter != pEnd; ++pIter)
- {
- if ( pIter->Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Storage")) )
- {
- xStorage.set(pIter->Value,UNO_QUERY);
- }
- else if ( pIter->Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("URL")) )
- {
- pIter->Value >>= sURL;
- }
- }
-
- if ( !xStorage.is() || !sURL.getLength() )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_NO_STROAGE);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- }
-
- ::rtl::OUString sSystemPath;
- osl_getSystemPathFromFileURL( sURL.pData, &sSystemPath.pData );
- sal_Int32 nIndex = sSystemPath.lastIndexOf('.');
- if ( !sURL.getLength() || !sSystemPath.getLength() )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_INVALID_FILE_URL);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- }
-
- bool bIsNewDatabase = !xStorage->hasElements();
-
- ::comphelper::NamedValueCollection aProperties;
-
- // properties for accessing the embedded storage
- ::rtl::OUString sConnPartURL = sSystemPath.copy( 0, ::std::max< sal_Int32 >( nIndex, sSystemPath.getLength() ) );
- ::rtl::OUString sKey = StorageContainer::registerStorage( xStorage, sConnPartURL );
- aProperties.put( "storage_key", sKey );
- aProperties.put( "storage_class_name",
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdbcx.comp.hsqldb.StorageAccess" ) ) );
- aProperties.put( "fileaccess_class_name",
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdbcx.comp.hsqldb.StorageFileAccess" ) ) );
-
- // JDBC driver and driver's classpath
- aProperties.put( "JavaDriverClass",
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.hsqldb.jdbcDriver" ) ) );
- aProperties.put( "JavaDriverClassPath",
- ::rtl::OUString(
-#ifdef SYSTEM_HSQLDB
- RTL_CONSTASCII_USTRINGPARAM(HSQLDB_JAR
- " vnd.sun.star.expand:$OOO_BASE_DIR/program/classes/sdbc_hsqldb.jar" )
-#else
- RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$OOO_BASE_DIR/program/classes/hsqldb.jar"
- " vnd.sun.star.expand:$OOO_BASE_DIR/program/classes/sdbc_hsqldb.jar" )
-#endif
- ) );
-
- // auto increment handling
- aProperties.put( "IsAutoRetrievingEnabled", true );
- aProperties.put( "AutoRetrievingStatement",
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CALL IDENTITY()" ) ) );
- aProperties.put( "IgnoreDriverPrivileges", true );
-
- // don't want to expose HSQLDB's schema capabilities which exist since 1.8.0RC10
- aProperties.put( "default_schema",
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) );
-
- // security: permitted Java classes
- NamedValue aPermittedClasses(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hsqldb.method_class_names" ) ),
- makeAny( lcl_getPermittedJavaMethods_nothrow( m_xFactory ) )
- );
- aProperties.put( "SystemProperties", Sequence< NamedValue >( &aPermittedClasses, 1 ) );
-
- const ::rtl::OUString sProperties( RTL_CONSTASCII_USTRINGPARAM( "properties" ) );
- ::rtl::OUString sMessage;
- try
- {
- if ( !bIsNewDatabase && xStorage->isStreamElement(sProperties) )
- {
- Reference<XStream > xStream = xStorage->openStreamElement(sProperties,ElementModes::READ);
- if ( xStream.is() )
- {
- ::std::auto_ptr<SvStream> pStream( ::utl::UcbStreamHelper::CreateStream(xStream) );
- if ( pStream.get() )
- {
- ByteString sLine;
- ByteString sVersionString;
- while ( pStream->ReadLine(sLine) )
- {
- if ( sLine.Len() == 0 )
- continue;
- const ByteString sIniKey = sLine.GetToken( 0, '=' );
- const ByteString sValue = sLine.GetToken( 1, '=' );
- if ( sIniKey.Equals( "hsqldb.compatible_version" ) )
- {
- sVersionString = sValue;
- }
- else
- {
- if ( sIniKey.Equals( "version" )
- && ( sVersionString.Len() == 0 )
- )
- {
- sVersionString = sValue;
- }
- }
- }
- if ( sVersionString.Len() )
- {
- const sal_Int32 nMajor = sVersionString.GetToken(0,'.').ToInt32();
- const sal_Int32 nMinor = sVersionString.GetToken(1,'.').ToInt32();
- const sal_Int32 nMicro = sVersionString.GetToken(2,'.').ToInt32();
- if ( nMajor > 1
- || ( nMajor == 1 && nMinor > 8 )
- || ( nMajor == 1 && nMinor == 8 && nMicro > 0 ) )
- {
- ::connectivity::SharedResources aResources;
- sMessage = aResources.getResourceString(STR_ERROR_NEW_VERSION);
- }
- }
- }
- } // if ( xStream.is() )
- ::comphelper::disposeComponent(xStream);
- }
- }
- catch(Exception&)
- {
- }
- if ( sMessage.getLength() )
- {
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- }
-
- // readonly?
- Reference<XPropertySet> xProp(xStorage,UNO_QUERY);
- if ( xProp.is() )
- {
- sal_Int32 nMode = 0;
- xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenMode"))) >>= nMode;
- if ( (nMode & ElementModes::WRITE) != ElementModes::WRITE )
- {
- aProperties.put( "readonly", ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) );
- }
- }
-
- Sequence< PropertyValue > aConnectionArgs;
- aProperties >>= aConnectionArgs;
-
- ::rtl::OUString sConnectURL(RTL_CONSTASCII_USTRINGPARAM("jdbc:hsqldb:"));
-
- sConnectURL += sConnPartURL;
- Reference<XConnection> xOrig;
- try
- {
- xOrig = xDriver->connect( sConnectURL, aConnectionArgs );
- }
- catch(const Exception& e)
- {
- StorageContainer::revokeStorage(sKey,NULL);
- (void)e;
- throw;
- }
-
- // if the storage is completely empty, then we just created a new HSQLDB
- // In this case, do some initializations.
- if ( bIsNewDatabase && xOrig.is() )
- onConnectedNewDatabase( xOrig );
-
- if ( xOrig.is() )
- {
- OMetaConnection* pMetaConnection = NULL;
- // now we have to set the URL to get the correct answer for metadata()->getURL()
- Reference< XUnoTunnel> xTunnel(xOrig,UNO_QUERY);
- if ( xTunnel.is() )
- {
- pMetaConnection = reinterpret_cast<OMetaConnection*>(xTunnel->getSomething( OMetaConnection::getUnoTunnelImplementationId() ));
- if ( pMetaConnection )
- pMetaConnection->setURL(url);
- }
-
- Reference<XComponent> xComp(xOrig,UNO_QUERY);
- if ( xComp.is() )
- xComp->addEventListener(this);
-
- // we want to close all connections when the office shuts down
- static Reference< XTerminateListener> s_xTerminateListener;
- if( !s_xTerminateListener.is() )
- {
- Reference< XDesktop > xDesktop( m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), UNO_QUERY );
-
- if( xDesktop.is() )
- {
- s_xTerminateListener = new OConnectionController(this);
- xDesktop->addTerminateListener(s_xTerminateListener);
- }
- }
- Reference< XComponent> xIfc = new OHsqlConnection( this, xOrig, m_xFactory );
- xConnection.set(xIfc,UNO_QUERY);
- m_aConnections.push_back(TWeakPair(WeakReferenceHelper(xOrig),TWeakConnectionPair(sKey,TWeakRefPair(WeakReferenceHelper(xConnection),WeakReferenceHelper()))));
-
- Reference<XTransactionBroadcaster> xBroad(xStorage,UNO_QUERY);
- if ( xBroad.is() )
- {
- Reference<XTransactionListener> xListener(*this,UNO_QUERY);
- xBroad->addTransactionListener(xListener);
- }
- }
- }
- }
- return xConnection;
- }
-
- //--------------------------------------------------------------------
- sal_Bool SAL_CALL ODriverDelegator::acceptsURL( const ::rtl::OUString& url ) throw (SQLException, RuntimeException)
- {
- sal_Bool bEnabled = sal_False;
- OSL_VERIFY_EQUALS( jfw_getEnabled( &bEnabled ), JFW_E_NONE, "error in jfw_getEnabled" );
- return bEnabled && url.compareToAscii("sdbc:embedded:hsqldb",sizeof("sdbc:embedded:hsqldb")) == 0;
- }
-
- //--------------------------------------------------------------------
- Sequence< DriverPropertyInfo > SAL_CALL ODriverDelegator::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw (SQLException, RuntimeException)
- {
- if ( !acceptsURL(url) )
- return Sequence< DriverPropertyInfo >();
- ::std::vector< DriverPropertyInfo > aDriverInfo;
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Defines the storage where the database will be stored."))
- ,sal_True
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Defines the url of the data source."))
- ,sal_True
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoRetrievingStatement"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Defines the statement which will be executed to retrieve auto increment values."))
- ,sal_False
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CALL IDENTITY()"))
- ,Sequence< ::rtl::OUString >())
- );
- return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size());
- }
-
- //--------------------------------------------------------------------
- sal_Int32 SAL_CALL ODriverDelegator::getMajorVersion( ) throw (RuntimeException)
- {
- return 1;
- }
-
- //--------------------------------------------------------------------
- sal_Int32 SAL_CALL ODriverDelegator::getMinorVersion( ) throw (RuntimeException)
- {
- return 0;
- }
-
- //--------------------------------------------------------------------
- Reference< XTablesSupplier > SAL_CALL ODriverDelegator::getDataDefinitionByConnection( const Reference< XConnection >& connection ) throw (SQLException, RuntimeException)
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODriverDelegator_BASE::rBHelper.bDisposed);
-
- Reference< XTablesSupplier > xTab;
-
- TWeakPairVector::iterator aEnd = m_aConnections.end();
- for (TWeakPairVector::iterator i = m_aConnections.begin(); aEnd != i; ++i)
- {
- if ( i->second.second.first.get() == connection.get() )
- {
- xTab = Reference< XTablesSupplier >(i->second.second.second.get().get(),UNO_QUERY);
- if ( !xTab.is() )
- {
- xTab = new OHCatalog(connection);
- i->second.second.second = WeakReferenceHelper(xTab);
- }
- break;
- }
- }
-
- return xTab;
- }
-
- //--------------------------------------------------------------------
- Reference< XTablesSupplier > SAL_CALL ODriverDelegator::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw (SQLException, RuntimeException)
- {
- if ( ! acceptsURL(url) )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- }
-
- return getDataDefinitionByConnection(connect(url,info));
- }
-
- // XServiceInfo
- // --------------------------------------------------------------------------------
- //------------------------------------------------------------------------------
- rtl::OUString ODriverDelegator::getImplementationName_Static( ) throw(RuntimeException)
- {
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.comp.hsqldb.Driver"));
- }
- //------------------------------------------------------------------------------
- Sequence< ::rtl::OUString > ODriverDelegator::getSupportedServiceNames_Static( ) throw (RuntimeException)
- {
- Sequence< ::rtl::OUString > aSNS( 2 );
- aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver"));
- aSNS[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.Driver"));
- return aSNS;
- }
- //------------------------------------------------------------------
- ::rtl::OUString SAL_CALL ODriverDelegator::getImplementationName( ) throw(RuntimeException)
- {
- return getImplementationName_Static();
- }
-
- //------------------------------------------------------------------
- sal_Bool SAL_CALL ODriverDelegator::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
- {
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
- }
- //------------------------------------------------------------------
- Sequence< ::rtl::OUString > SAL_CALL ODriverDelegator::getSupportedServiceNames( ) throw(RuntimeException)
- {
- return getSupportedServiceNames_Static();
- }
- //------------------------------------------------------------------
- void SAL_CALL ODriverDelegator::createCatalog( const Sequence< PropertyValue >& /*info*/ ) throw (SQLException, ::com::sun::star::container::ElementExistException, RuntimeException)
- {
- ::dbtools::throwFeatureNotImplementedException( "XCreateCatalog::createCatalog", *this );
- }
- //------------------------------------------------------------------
- void ODriverDelegator::shutdownConnection(const TWeakPairVector::iterator& _aIter )
- {
- OSL_ENSURE(m_aConnections.end() != _aIter,"Iterator equals .end()");
- sal_Bool bLastOne = sal_True;
- try
- {
- Reference<XConnection> _xConnection(_aIter->first.get(),UNO_QUERY);
-
- if ( _xConnection.is() )
- {
- Reference<XStatement> xStmt = _xConnection->createStatement();
- if ( xStmt.is() )
- {
- Reference<XResultSet> xRes(xStmt->executeQuery(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT COUNT(*) FROM INFORMATION_SCHEMA.SYSTEM_SESSIONS WHERE USER_NAME ='SA'"))),UNO_QUERY);
- Reference<XRow> xRow(xRes,UNO_QUERY);
- if ( xRow.is() && xRes->next() )
- bLastOne = xRow->getInt(1) == 1;
- if ( bLastOne )
- xStmt->execute(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SHUTDOWN")));
- }
- }
- }
- catch(Exception&)
- {
- }
- if ( bLastOne )
- {
- // Reference<XTransactionListener> xListener(*this,UNO_QUERY);
- // a shutdown should commit all changes to the db files
- StorageContainer::revokeStorage(_aIter->second.first,NULL);
- }
- if ( !m_bInShutDownConnections )
- m_aConnections.erase(_aIter);
- }
- //------------------------------------------------------------------
- void SAL_CALL ODriverDelegator::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
- {
- ::osl::MutexGuard aGuard(m_aMutex);
- Reference<XConnection> xCon(Source.Source,UNO_QUERY);
- if ( xCon.is() )
- {
- TWeakPairVector::iterator i = m_aConnections.begin();
- for (; m_aConnections.end() != i; ++i)
- {
- if ( i->first.get() == xCon.get() )
- {
- shutdownConnection(i);
- break;
- }
- }
- }
- else
- {
- Reference< XStorage> xStorage(Source.Source,UNO_QUERY);
- if ( xStorage.is() )
- {
- ::rtl::OUString sKey = StorageContainer::getRegisteredKey(xStorage);
- TWeakPairVector::iterator i = ::std::find_if(m_aConnections.begin(),m_aConnections.end(),::o3tl::compose1(
- ::std::bind2nd(::std::equal_to< ::rtl::OUString >(),sKey)
- ,::o3tl::compose1(::o3tl::select1st<TWeakConnectionPair>(),::o3tl::select2nd< TWeakPair >())));
- if ( i != m_aConnections.end() )
- shutdownConnection(i);
- }
- }
- }
- //------------------------------------------------------------------
- void ODriverDelegator::shutdownConnections()
- {
- m_bInShutDownConnections = sal_True;
- TWeakPairVector::iterator aEnd = m_aConnections.end();
- for (TWeakPairVector::iterator i = m_aConnections.begin(); aEnd != i; ++i)
- {
- try
- {
- Reference<XConnection> xCon(i->first,UNO_QUERY);
- ::comphelper::disposeComponent(xCon);
- }
- catch(Exception&)
- {
- }
- }
- m_aConnections.clear();
- m_bInShutDownConnections = sal_True;
- }
- //------------------------------------------------------------------
- void ODriverDelegator::flushConnections()
- {
- TWeakPairVector::iterator aEnd = m_aConnections.end();
- for (TWeakPairVector::iterator i = m_aConnections.begin(); aEnd != i; ++i)
- {
- try
- {
- Reference<XFlushable> xCon(i->second.second.first.get(),UNO_QUERY);
- xCon->flush();
- }
- catch(Exception&)
- {
- }
- }
- }
- //------------------------------------------------------------------
- void SAL_CALL ODriverDelegator::preCommit( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
- {
- ::osl::MutexGuard aGuard(m_aMutex);
-
- Reference< XStorage> xStorage(aEvent.Source,UNO_QUERY);
- ::rtl::OUString sKey = StorageContainer::getRegisteredKey(xStorage);
- if ( sKey.getLength() )
- {
- TWeakPairVector::iterator i = ::std::find_if(m_aConnections.begin(),m_aConnections.end(),::o3tl::compose1(
- ::std::bind2nd(::std::equal_to< ::rtl::OUString >(),sKey)
- ,::o3tl::compose1(::o3tl::select1st<TWeakConnectionPair>(),::o3tl::select2nd< TWeakPair >())));
- OSL_ENSURE( i != m_aConnections.end(), "ODriverDelegator::preCommit: they're committing a storage which I do not know!" );
- if ( i != m_aConnections.end() )
- {
- try
- {
- Reference<XConnection> xConnection(i->first,UNO_QUERY);
- if ( xConnection.is() )
- {
- Reference< XStatement> xStmt = xConnection->createStatement();
- OSL_ENSURE( xStmt.is(), "ODriverDelegator::preCommit: no statement!" );
- if ( xStmt.is() )
- xStmt->execute( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SET WRITE_DELAY 0" ) ) );
-
- sal_Bool bPreviousAutoCommit = xConnection->getAutoCommit();
- xConnection->setAutoCommit( sal_False );
- xConnection->commit();
- xConnection->setAutoCommit( bPreviousAutoCommit );
-
- if ( xStmt.is() )
- xStmt->execute( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SET WRITE_DELAY 60" ) ) );
- }
- }
- catch(Exception&)
- {
- OSL_FAIL( "ODriverDelegator::preCommit: caught an exception!" );
- }
- }
- }
- }
- //------------------------------------------------------------------
- void SAL_CALL ODriverDelegator::commited( const ::com::sun::star::lang::EventObject& /*aEvent*/ ) throw (::com::sun::star::uno::RuntimeException)
- {
- }
- //------------------------------------------------------------------
- void SAL_CALL ODriverDelegator::preRevert( const ::com::sun::star::lang::EventObject& /*aEvent*/ ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
- {
- }
- //------------------------------------------------------------------
- void SAL_CALL ODriverDelegator::reverted( const ::com::sun::star::lang::EventObject& /*aEvent*/ ) throw (::com::sun::star::uno::RuntimeException)
- {
- }
- //------------------------------------------------------------------
- namespace
- {
- //..............................................................
- const sal_Char* lcl_getCollationForLocale( const ::rtl::OUString& _rLocaleString, bool _bAcceptCountryMismatch = false )
- {
- static const sal_Char* pTranslations[] =
- {
- "af-ZA", "Afrikaans",
- "am-ET", "Amharic",
- "ar", "Arabic",
- "as-IN", "Assamese",
- "az-AZ", "Azerbaijani_Latin",
- "az-cyrillic", "Azerbaijani_Cyrillic",
- "be-BY", "Belarusian",
- "bg-BG", "Bulgarian",
- "bn-IN", "Bengali",
- "bo-CN", "Tibetan",
- "bs-BA", "Bosnian",
- "ca-ES", "Catalan",
- "cs-CZ", "Czech",
- "cy-GB", "Welsh",
- "da-DK", "Danish",
- "de-DE", "German",
- "el-GR", "Greek",
- "en-US", "Latin1_General",
- "es-ES", "Spanish",
- "et-EE", "Estonian",
- "eu", "Basque",
- "fi-FI", "Finnish",
- "fr-FR", "French",
- "gn-PY", "Guarani",
- "gu-IN", "Gujarati",
- "ha-NG", "Hausa",
- "he-IL", "Hebrew",
- "hi-IN", "Hindi",
- "hr-HR", "Croatian",
- "hu-HU", "Hungarian",
- "hy-AM", "Armenian",
- "id-ID", "Indonesian",
- "ig-NG", "Igbo",
- "is-IS", "Icelandic",
- "it-IT", "Italian",
- "iu-CA", "Inuktitut",
- "ja-JP", "Japanese",
- "ka-GE", "Georgian",
- "kk-KZ", "Kazakh",
- "km-KH", "Khmer",
- "kn-IN", "Kannada",
- "ko-KR", "Korean",
- "kok-IN", "Konkani",
- "ks", "Kashmiri",
- "ky-KG", "Kirghiz",
- "lo-LA", "Lao",
- "lt-LT", "Lithuanian",
- "lv-LV", "Latvian",
- "mi-NZ", "Maori",
- "mk-MK", "Macedonian",
- "ml-IN", "Malayalam",
- "mn-MN", "Mongolian",
- "mni-IN", "Manipuri",
- "mr-IN", "Marathi",
- "ms-MY", "Malay",
- "mt-MT", "Maltese",
- "my-MM", "Burmese",
- "nb-NO", "Danish_Norwegian",
- "ne-NP", "Nepali",
- "nl-NL", "Dutch",
- "nn-NO", "Norwegian",
- "or-IN", "Oriya",
- "pa-IN", "Punjabi",
- "pl-PL", "Polish",
- "ps-AF", "Pashto",
- "pt-PT", "Portuguese",
- "ro-RO", "Romanian",
- "ru-RU", "Russian",
- "sa-IN", "Sanskrit",
- "sd-IN", "Sindhi",
- "sk-SK", "Slovak",
- "sl-SI", "Slovenian",
- "so-SO", "Somali",
- "sq-AL", "Albanian",
- "sr-YU", "Serbian_Cyrillic",
- "sv-SE", "Swedish",
- "sw-KE", "Swahili",
- "ta-IN", "Tamil",
- "te-IN", "Telugu",
- "tg-TJ", "Tajik",
- "th-TH", "Thai",
- "tk-TM", "Turkmen",
- "tn-BW", "Tswana",
- "tr-TR", "Turkish",
- "tt-RU", "Tatar",
- "uk-UA", "Ukrainian",
- "ur-PK", "Urdu",
- "uz-UZ", "Uzbek_Latin",
- "ven-ZA", "Venda",
- "vi-VN", "Vietnamese",
- "yo-NG", "Yoruba",
- "zh-CN", "Chinese",
- "zu-ZA", "Zulu",
- NULL, NULL
- };
-
- ::rtl::OUString sLocaleString( _rLocaleString );
- sal_Char nCompareTermination = 0;
-
- if ( _bAcceptCountryMismatch )
- {
- // strip the country part from the compare string
- sal_Int32 nCountrySep = sLocaleString.indexOf( '-' );
- if ( nCountrySep > -1 )
- sLocaleString = sLocaleString.copy( 0, nCountrySep );
-
- // the entries in the translation table are compared until the
- // - character only, not until the terminating 0
- nCompareTermination = '-';
- }
-
- const sal_Char** pLookup = pTranslations;
- for ( ; *pLookup; pLookup +=2 )
- {
- sal_Int32 nCompareUntil = 0;
- while ( (*pLookup)[ nCompareUntil ] != nCompareTermination && (*pLookup)[ nCompareUntil ] != 0 )
- ++nCompareUntil;
-
- if ( sLocaleString.equalsAsciiL( *pLookup, nCompareUntil ) )
- return *( pLookup + 1 );
- }
-
- if ( !_bAcceptCountryMismatch )
- // second round, this time without matching the country
- return lcl_getCollationForLocale( _rLocaleString, true );
-
- OSL_FAIL( "lcl_getCollationForLocale: unknown locale string, falling back to Latin1_General!" );
- return "Latin1_General";
- }
-
- //..............................................................
- ::rtl::OUString lcl_getSystemLocale( const Reference< XMultiServiceFactory >& _rxORB )
- {
- ::rtl::OUString sLocaleString = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "en-US" ) );
- try
- {
- //.........................................................
- Reference< XMultiServiceFactory > xConfigProvider(
- _rxORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider")) ),
- UNO_QUERY
- );
- OSL_ENSURE( xConfigProvider.is(), "lcl_getSystemLocale: could not create the config provider!" );
-
- if ( !xConfigProvider.is() )
- return sLocaleString;
-
- //.........................................................
- // arguments for creating the config access
- Sequence< Any > aArguments(2);
- // the path to the node to open
- ::rtl::OUString sNodePath(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup/L10N" ));
- aArguments[0] <<= PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), 0,
- makeAny( sNodePath ), PropertyState_DIRECT_VALUE
- );
- // the depth: -1 means unlimited
- aArguments[1] <<= PropertyValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("depth")), 0,
- makeAny( (sal_Int32)-1 ), PropertyState_DIRECT_VALUE
- );
-
- //.........................................................
- // create the access
- Reference< XPropertySet > xNode(
- xConfigProvider->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")),
- aArguments ),
- UNO_QUERY );
- OSL_ENSURE( xNode.is(), "lcl_getSystemLocale: invalid access returned (should throw an exception instead)!" );
-
- //.........................................................
- // ask for the system locale setting
- if ( xNode.is() )
- xNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooSetupSystemLocale" ) ) ) >>= sLocaleString;
- }
- catch( const Exception& )
- {
- OSL_FAIL( "lcl_getSystemLocale: caught an exception!" );
- }
- if ( !sLocaleString.getLength() )
- {
- rtl_Locale* pProcessLocale = NULL;
- osl_getProcessLocale( &pProcessLocale );
-
- ::rtl::OUStringBuffer aProcLocale;
- aProcLocale.append( pProcessLocale->Language->buffer, pProcessLocale->Language->length );
- if ( pProcessLocale->Country->length )
- {
- aProcLocale.appendAscii( "-" );
- aProcLocale.append( pProcessLocale->Country->buffer, pProcessLocale->Country->length );
- }
- sLocaleString = aProcLocale.makeStringAndClear();
- }
- return sLocaleString;
- }
- }
- //------------------------------------------------------------------
- void ODriverDelegator::onConnectedNewDatabase( const Reference< XConnection >& _rxConnection )
- {
- try
- {
- Reference< XStatement > xStatement = _rxConnection->createStatement();
- OSL_ENSURE( xStatement.is(), "ODriverDelegator::onConnectedNewDatabase: could not create a statement!" );
- if ( xStatement.is() )
- {
- ::rtl::OUStringBuffer aStatement;
- aStatement.appendAscii( "SET DATABASE COLLATION \"" );
- aStatement.appendAscii( lcl_getCollationForLocale( lcl_getSystemLocale( m_xFactory ) ) );
- aStatement.appendAscii( "\"" );
-
- xStatement->execute( aStatement.makeStringAndClear() );
- }
- }
- catch( const Exception& )
- {
- OSL_FAIL( "ODriverDelegator::onConnectedNewDatabase: caught an exception!" );
- }
- }
-
- //------------------------------------------------------------------
- //------------------------------------------------------------------
-//........................................................................
-} // namespace connectivity
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HStorage.hxx b/connectivity/source/drivers/hsqldb/HStorage.hxx
deleted file mode 100644
index f13dc3be28..0000000000
--- a/connectivity/source/drivers/hsqldb/HStorage.hxx
+++ /dev/null
@@ -1,120 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_HSQLDB_STORAGE_HXX
-#define CONNECTIVITY_HSQLDB_STORAGE_HXX
-
-#include <cppuhelper/compbase6.hxx>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include "connectivity/CommonTools.hxx"
-#include <comphelper/broadcasthelper.hxx>
-
-
-#define DECLARE_SERVICE_INFO_STATIC() \
- DECLARE_SERVICE_INFO(); \
- static ::rtl::OUString SAL_CALL getImplementationName_Static( ) throw (::com::sun::star::uno::RuntimeException); \
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static( ) throw(::com::sun::star::uno::RuntimeException); \
- static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > \
- SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&) \
-
-
-namespace connectivity
-{
- namespace hsqldb
- {
- typedef ::cppu::WeakComponentImplHelper6< ::com::sun::star::io::XStream
- , ::com::sun::star::io::XInputStream
- , ::com::sun::star::io::XOutputStream
- , ::com::sun::star::io::XSeekable
- , ::com::sun::star::lang::XInitialization
- , ::com::sun::star::lang::XServiceInfo> OStorage_Base;
- class OStorage : public ::comphelper::OBaseMutex
- ,public OStorage_Base
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
- ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentSubStorageSupplier> m_xDS;
-
-
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage> m_xStorge;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xIn;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > m_xOut;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable > m_xSeek;
-
- OStorage(); // never implemented
- OStorage(const OStorage&); // never implemented
- int operator= (const OStorage&); // never implemented
-
- OStorage(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
- protected:
- /** this function is called upon disposing the component
- */
- virtual void SAL_CALL disposing();
- public:
- // ::com::sun::star::lang::XServiceInfo
- DECLARE_SERVICE_INFO_STATIC();
-
- // XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XStream
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XInputStream
- virtual ::sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nMaxBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL skipBytes( ::sal_Int32 nBytesToSkip ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL available( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL closeInput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
- // XOutputStream
- virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL flush( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL closeOutput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
- // XSeekable
- virtual void SAL_CALL seek( ::sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int64 SAL_CALL getPosition( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int64 SAL_CALL getLength( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- };
- }
-// .......................................................................
-} // connectivity
-// .......................................................................
-#endif // CONNECTIVITY_HSQLDB_STORAGE_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
deleted file mode 100644
index d1572e9753..0000000000
--- a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
+++ /dev/null
@@ -1,554 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "hsqldb/HStorageAccess.hxx"
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/io/XStream.hpp>
-#include "hsqldb/HStorageMap.hxx"
-#include "hsqldb/StorageNativeInputStream.h"
-#include "accesslog.hxx"
-#include "diagnose_ex.h"
-
-#include <string.h>
-
-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 OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
-#define ThrowException(env, type, msg) { \
- env->ThrowNew(env->FindClass(type), msg); }
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess
- * Method: openStream
- * Signature: (Ljava/lang/String;Ljava/lang/String;I)V
- */
-SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_openStream
- (JNIEnv * env, jobject /*obj_this*/,jstring name, jstring key, jint mode)
-{
-#ifdef HSQLDB_DBG
- {
- OperationLogFile( env, name, "data" ).logOperation( "openStream" );
- LogFile( env, name, "data" ).create();
- }
-#endif
-
- StorageContainer::registerStream(env,name,key,mode);
-}
-// -----------------------------------------------------------------------------
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess
- * Method: close
- * Signature: (Ljava/lang/String;Ljava/lang/String;)V
- */
-SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_close
- (JNIEnv * env, jobject /*obj_this*/,jstring name, jstring key)
-{
-#ifdef HSQLDB_DBG
- {
- ::rtl::OUString sKey = StorageContainer::jstring2ustring(env,key);
- ::rtl::OUString sName = StorageContainer::jstring2ustring(env,name);
- }
-#endif
- ::boost::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
- Reference< XOutputStream> xFlush = pHelper.get() ? pHelper->getOutputStream() : Reference< XOutputStream>();
- if ( xFlush.is() )
- try
- {
- xFlush->flush();
- }
- catch(const Exception&)
- {
- OSL_FAIL( "NativeStorageAccess::close: caught an exception while flushing!" );
- }
-#ifdef HSQLDB_DBG
- {
- OperationLogFile aOpLog( env, name, "data" );
- aOpLog.logOperation( "close" );
- aOpLog.close();
-
- LogFile aDataLog( env, name, "data" );
- aDataLog.close();
- }
-#endif
-
- StorageContainer::revokeStream(env,name,key);
-}
-// -----------------------------------------------------------------------------
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess
- * Method: getFilePointer
- * Signature: (Ljava/lang/String;Ljava/lang/String;)J
- */
-SAL_DLLPUBLIC_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_getFilePointer
- (JNIEnv * env, jobject /*obj_this*/,jstring name, jstring key)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile aOpLog( env, name, "data" );
- aOpLog.logOperation( "getFilePointer" );
-#endif
-
- ::boost::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
- OSL_ENSURE(pHelper.get(),"No stream helper!");
-
- jlong nReturn = pHelper.get() ? pHelper->getSeek()->getPosition() : jlong(0);
-#ifdef HSQLDB_DBG
- aOpLog.logReturn( nReturn );
-#endif
- return nReturn;
-}
-// -----------------------------------------------------------------------------
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess
- * Method: length
- * Signature: (Ljava/lang/String;Ljava/lang/String;)J
- */
-SAL_DLLPUBLIC_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_length
- (JNIEnv * env, jobject /*obj_this*/,jstring name, jstring key)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile aOpLog( env, name, "data" );
- aOpLog.logOperation( "length" );
-#endif
-
- ::boost::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
- OSL_ENSURE(pHelper.get(),"No stream helper!");
-
- jlong nReturn = pHelper.get() ? pHelper->getSeek()->getLength() :jlong(0);
-#ifdef HSQLDB_DBG
- aOpLog.logReturn( nReturn );
-#endif
- return nReturn;
-}
-
-// -----------------------------------------------------------------------------
-
-jint read_from_storage_stream( JNIEnv * env, jobject /*obj_this*/, jstring name, jstring key, DataLogFile* logger )
-{
- OSL_UNUSED( logger );
- ::boost::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
- Reference< XInputStream> xIn = pHelper.get() ? pHelper->getInputStream() : Reference< XInputStream>();
- OSL_ENSURE(xIn.is(),"Input stream is NULL!");
- if ( xIn.is() )
- {
- Sequence< ::sal_Int8 > aData(1);
- sal_Int32 nBytesRead = -1;
- try
- {
- nBytesRead = xIn->readBytes(aData,1);
- }
- catch(const Exception& e)
- {
- StorageContainer::throwJavaException(e,env);
- return -1;
-
- }
- if (nBytesRead <= 0)
- {
- return (-1);
- }
- else
- {
- sal_Int32 tmpInt = aData[0];
- if (tmpInt < 0 )
- tmpInt = 256 +tmpInt;
-
-#ifdef HSQLDB_DBG
- if ( logger )
- logger->write( tmpInt );
-#endif
- return(tmpInt);
- }
- }
- return -1;
-}
-
-// -----------------------------------------------------------------------------
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess
- * Method: read
- * Signature: (Ljava/lang/String;Ljava/lang/String;)I
- */
-SAL_DLLPUBLIC_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_read__Ljava_lang_String_2Ljava_lang_String_2
- (JNIEnv* env, jobject obj_this, jstring name, jstring key)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile aOpLog( env, name, "data" );
- aOpLog.logOperation( "read" );
-
- DataLogFile aDataLog( env, name, "data" );
- return read_from_storage_stream( env, obj_this, name, key, &aDataLog );
-#else
- return read_from_storage_stream( env, obj_this, name, key );
-#endif
-}
-
-// -----------------------------------------------------------------------------
-
-jint read_from_storage_stream_into_buffer( JNIEnv * env, jobject /*obj_this*/,jstring name, jstring key, jbyteArray buffer, jint off, jint len, DataLogFile* logger )
-{
- OSL_UNUSED( logger );
-#ifdef HSQLDB_DBG
- {
- ::rtl::OUString sKey = StorageContainer::jstring2ustring(env,key);
- ::rtl::OUString sName = StorageContainer::jstring2ustring(env,name);
- }
-#endif
- ::boost::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
- Reference< XInputStream> xIn = pHelper.get() ? pHelper->getInputStream() : Reference< XInputStream>();
- OSL_ENSURE(xIn.is(),"Input stream is NULL!");
- if ( xIn.is() )
- {
- jsize nLen = env->GetArrayLength(buffer);
- if ( nLen < len || len <= 0 )
- {
- ThrowException( env,
- "java/io/IOException",
- "len is greater or equal to the buffer size");
- return -1;
- }
- sal_Int32 nBytesRead = -1;
-
- Sequence< ::sal_Int8 > aData(nLen);
- try
- {
- nBytesRead = xIn->readBytes(aData, len);
- }
- catch(const Exception& e)
- {
- StorageContainer::throwJavaException(e,env);
- return -1;
- }
-
- if (nBytesRead <= 0)
- return -1;
- env->SetByteArrayRegion(buffer,off,nBytesRead,(const jbyte*) &aData[0]);
-
-#ifdef HSQLDB_DBG
- if ( logger )
- logger->write( aData.getConstArray(), nBytesRead );
-#endif
- return nBytesRead;
- }
- ThrowException( env,
- "java/io/IOException",
- "Stream is not valid");
- return -1;
-}
-// -----------------------------------------------------------------------------
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess
- * Method: read
- * Signature: (Ljava/lang/String;Ljava/lang/String;[BII)I
- */
-SAL_DLLPUBLIC_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_read__Ljava_lang_String_2Ljava_lang_String_2_3BII
- (JNIEnv * env, jobject obj_this,jstring name, jstring key, jbyteArray buffer, jint off, jint len)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile aOpLog( env, name, "data" );
- aOpLog.logOperation( "read( byte[], int, int )" );
-
- DataLogFile aDataLog( env, name, "data" );
- return read_from_storage_stream_into_buffer( env, obj_this, name, key, buffer, off, len, &aDataLog );
-#else
- return read_from_storage_stream_into_buffer( env, obj_this, name, key, buffer, off, len );
-#endif
-}
-
-// -----------------------------------------------------------------------------
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess
- * Method: readInt
- * Signature: (Ljava/lang/String;Ljava/lang/String;)I
- */
-SAL_DLLPUBLIC_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_readInt
- (JNIEnv * env, jobject /*obj_this*/,jstring name, jstring key)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile aOpLog( env, name, "data" );
- aOpLog.logOperation( "readInt" );
-#endif
-
- ::boost::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
- Reference< XInputStream> xIn = pHelper.get() ? pHelper->getInputStream() : Reference< XInputStream>();
- OSL_ENSURE(xIn.is(),"Input stream is NULL!");
- if ( xIn.is() )
- {
- Sequence< ::sal_Int8 > aData(4);
- sal_Int32 nBytesRead = -1;
- try
- {
- nBytesRead = xIn->readBytes(aData, 4);
- }
- catch(const Exception& e)
- {
- StorageContainer::throwJavaException(e,env);
- return -1;
- }
-
- if ( nBytesRead != 4 ) {
- ThrowException( env,
- "java/io/IOException",
- "Bytes read != 4");
- return -1;
- }
-
- Sequence< sal_Int32 > ch(4);
- for(sal_Int32 i = 0;i < 4; ++i)
- {
- ch[i] = aData[i];
- if (ch[i] < 0 )
- ch[i] = 256 + ch[i];
- }
-
- if ((ch[0] | ch[1] | ch[2] | ch[3]) < 0)
- {
- ThrowException( env,
- "java/io/IOException",
- "One byte is < 0");
- return -1;
- }
- jint nRet = ((ch[0] << 24) + (ch[1] << 16) + (ch[2] << 8) + (ch[3] << 0));
-#ifdef HSQLDB_DBG
- DataLogFile aDataLog( env, name, "data" );
- aDataLog.write( nRet );
-
- aOpLog.logReturn( nRet );
-#endif
- return nRet;
- }
- ThrowException( env,
- "java/io/IOException",
- "No InputStream");
- return -1;
-}
-// -----------------------------------------------------------------------------
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess
- * Method: seek
- * Signature: (Ljava/lang/String;Ljava/lang/String;J)V
- */
-SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_seek
- (JNIEnv * env, jobject /*obj_this*/,jstring name, jstring key, jlong position)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile aOpLog( env, name, "data" );
- aOpLog.logOperation( "seek", position );
-#endif
-
- ::boost::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
- Reference< XSeekable> xSeek = pHelper.get() ? pHelper->getSeek() : Reference< XSeekable>();
-
- OSL_ENSURE(xSeek.is(),"No Seekable stream!");
- if ( xSeek.is() )
- {
- #ifdef HSQLDB_DBG
- DataLogFile aDataLog( env, name, "data" );
- #endif
-
- ::sal_Int64 nLen = xSeek->getLength();
- if ( nLen < position)
- {
- static ::sal_Int64 BUFFER_SIZE = 9192;
- #ifdef HSQLDB_DBG
- aDataLog.seek( nLen );
- #endif
- xSeek->seek(nLen);
- Reference< XOutputStream> xOut = pHelper->getOutputStream();
- OSL_ENSURE(xOut.is(),"No output stream!");
-
- ::sal_Int64 diff = position - nLen;
- sal_Int32 n;
- while( diff != 0 )
- {
- if ( BUFFER_SIZE < diff )
- {
- n = static_cast<sal_Int32>(BUFFER_SIZE);
- diff = diff - BUFFER_SIZE;
- }
- else
- {
- n = static_cast<sal_Int32>(diff);
- diff = 0;
- }
- Sequence< ::sal_Int8 > aData(n);
- memset(aData.getArray(),0,n);
- xOut->writeBytes(aData);
- #ifdef HSQLDB_DBG
- aDataLog.write( aData.getConstArray(), n );
- #endif
- }
- }
- xSeek->seek(position);
- OSL_ENSURE(xSeek->getPosition() == position,"Wrong position after seeking the stream");
-
- #ifdef HSQLDB_DBG
- aDataLog.seek( position );
- OSL_ENSURE( xSeek->getPosition() == aDataLog.tell(), "Wrong position after seeking the stream" );
- #endif
- }
-}
-// -----------------------------------------------------------------------------
-
-void write_to_storage_stream_from_buffer( JNIEnv* env, jobject /*obj_this*/, jstring name, jstring key, jbyteArray buffer, jint off, jint len, DataLogFile* logger )
-{
- OSL_UNUSED( logger );
- ::boost::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
- Reference< XOutputStream> xOut = pHelper.get() ? pHelper->getOutputStream() : Reference< XOutputStream>();
- OSL_ENSURE(xOut.is(),"Stream is NULL");
-
- try
- {
- if ( xOut.is() )
- {
- jbyte *buf = env->GetByteArrayElements(buffer,NULL);
- if (JNI_FALSE != env->ExceptionCheck())
- {
- env->ExceptionClear();
- OSL_FAIL("ExceptionClear");
- }
- OSL_ENSURE(buf,"buf is NULL");
- if ( buf && len > 0 && len <= env->GetArrayLength(buffer))
- {
- Sequence< ::sal_Int8 > aData((const signed char*) buf + off,len);
- env->ReleaseByteArrayElements(buffer, buf, JNI_ABORT);
- xOut->writeBytes(aData);
-#ifdef HSQLDB_DBG
- if ( logger )
- logger->write( aData.getConstArray(), len );
-#endif
- }
- }
- else
- {
- ThrowException( env,
- "java/io/IOException",
- "No OutputStream");
- }
- }
- catch(const Exception& e)
- {
- OSL_FAIL("Exception caught! : write [BII)V");
- StorageContainer::throwJavaException(e,env);
- }
-}
-
-// -----------------------------------------------------------------------------
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess
- * Method: write
- * Signature: (Ljava/lang/String;Ljava/lang/String;[BII)V
- */
-SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_write
- (JNIEnv * env, jobject obj_this,jstring name, jstring key, jbyteArray buffer, jint off, jint len)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile aOpLog( env, name, "data" );
- aOpLog.logOperation( "write( byte[], int, int )" );
-
- DataLogFile aDataLog( env, name, "data" );
- write_to_storage_stream_from_buffer( env, obj_this, name, key, buffer, off, len, &aDataLog );
-#else
- write_to_storage_stream_from_buffer( env, obj_this, name, key, buffer, off, len );
-#endif
-}
-// -----------------------------------------------------------------------------
-
-void write_to_storage_stream( JNIEnv* env, jobject /*obj_this*/, jstring name, jstring key, jint v, DataLogFile* logger )
-{
- OSL_UNUSED( logger );
-
- ::boost::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
- Reference< XOutputStream> xOut = pHelper.get() ? pHelper->getOutputStream() : Reference< XOutputStream>();
- OSL_ENSURE(xOut.is(),"Stream is NULL");
- try
- {
- if ( xOut.is() )
- {
- Sequence< ::sal_Int8 > oneByte(4);
- oneByte[0] = (sal_Int8) ((v >> 24) & 0xFF);
- oneByte[1] = (sal_Int8) ((v >> 16) & 0xFF);
- oneByte[2] = (sal_Int8) ((v >> 8) & 0xFF);
- oneByte[3] = (sal_Int8) ((v >> 0) & 0xFF);
-
- xOut->writeBytes(oneByte);
-#ifdef HSQLDB_DBG
- if ( logger )
- logger->write( oneByte.getConstArray(), 4 );
-#endif
- }
- else
- {
- ThrowException( env,
- "java/io/IOException",
- "No OutputStream");
- }
- }
- catch(const Exception& e)
- {
- OSL_FAIL("Exception caught! : writeBytes(aData);");
- StorageContainer::throwJavaException(e,env);
- }
-}
-
-// -----------------------------------------------------------------------------
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess
- * Method: writeInt
- * Signature: (Ljava/lang/String;Ljava/lang/String;I)V
- */
-SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_writeInt
- (JNIEnv * env, jobject obj_this,jstring name, jstring key, jint v)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile aOpLog( env, name, "data" );
- aOpLog.logOperation( "writeInt" );
-
- DataLogFile aDataLog( env, name, "data" );
- write_to_storage_stream( env, obj_this, name, key, v, &aDataLog );
-#else
- write_to_storage_stream( env, obj_this, name, key, v );
-#endif
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx
deleted file mode 100644
index ba100916ff..0000000000
--- a/connectivity/source/drivers/hsqldb/HStorageMap.cxx
+++ /dev/null
@@ -1,365 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "hsqldb/HStorageMap.hxx"
-#include <comphelper/types.hxx>
-#include <com/sun/star/embed/XTransactionBroadcaster.hpp>
-#include <com/sun/star/embed/XTransactedObject.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "diagnose_ex.h"
-#include <osl/thread.h>
-
-#include <o3tl/compat_functional.hxx>
-
-//........................................................................
-namespace connectivity
-{
-//........................................................................
- namespace hsqldb
- {
- //........................................................................
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::embed;
- using namespace ::com::sun::star::io;
-
-#define ThrowException(env, type, msg) { \
- env->ThrowNew(env->FindClass(type), msg); }
-
-
- StreamHelper::StreamHelper(const Reference< XStream>& _xStream)
- : m_xStream(_xStream)
- {
- }
- // -----------------------------------------------------------------------------
- StreamHelper::~StreamHelper()
- {
- try
- {
- m_xStream.clear();
- m_xSeek.clear();
- if ( m_xInputStream.is() )
- {
- m_xInputStream->closeInput();
- m_xInputStream.clear();
- }
- // this is done implicity by the closing of the input stream
- else if ( m_xOutputStream.is() )
- {
- m_xOutputStream->closeOutput();
- try
- {
- ::comphelper::disposeComponent(m_xOutputStream);
- }
- catch(const DisposedException&)
- {
- }
- catch(const Exception&)
- {
- OSL_FAIL("Could not dispose OutputStream");
- }
- m_xOutputStream.clear();
- }
- }
- catch(const Exception&)
- {
- OSL_FAIL("Exception caught!");
- }
- }
- // -----------------------------------------------------------------------------
- Reference< XInputStream> StreamHelper::getInputStream()
- {
- if ( !m_xInputStream.is() )
- m_xInputStream = m_xStream->getInputStream();
- return m_xInputStream;
- }
- // -----------------------------------------------------------------------------
- Reference< XOutputStream> StreamHelper::getOutputStream()
- {
- if ( !m_xOutputStream.is() )
- m_xOutputStream = m_xStream->getOutputStream();
- return m_xOutputStream;
- }
- // -----------------------------------------------------------------------------
- Reference< XSeekable> StreamHelper::getSeek()
- {
- if ( !m_xSeek.is() )
- m_xSeek.set(m_xStream,UNO_QUERY);
- return m_xSeek;
- }
- // -----------------------------------------------------------------------------
- TStorages& lcl_getStorageMap()
- {
- static TStorages s_aMap;
- return s_aMap;
- }
- // -----------------------------------------------------------------------------
- ::rtl::OUString lcl_getNextCount()
- {
- static sal_Int32 s_nCount = 0;
- return ::rtl::OUString::valueOf(s_nCount++);
- }
- // -----------------------------------------------------------------------------
- ::rtl::OUString StorageContainer::removeURLPrefix(const ::rtl::OUString& _sURL,const ::rtl::OUString& _sFileURL)
- {
- return _sURL.copy(_sFileURL.getLength()+1);
- }
- // -----------------------------------------------------------------------------
- ::rtl::OUString StorageContainer::removeOldURLPrefix(const ::rtl::OUString& _sURL)
- {
- ::rtl::OUString sRet = _sURL;
-#if defined(WNT)
- sal_Int32 nIndex = sRet.lastIndexOf('\\');
-#else
- sal_Int32 nIndex = sRet.lastIndexOf('/');
-#endif
- if ( nIndex != -1 )
- {
- sRet = _sURL.copy(nIndex+1);
- }
- return sRet;
-
- }
- /*****************************************************************************/
- /* convert jstring to rtl_uString */
-
- ::rtl::OUString StorageContainer::jstring2ustring(JNIEnv * env, jstring jstr)
- {
- if (JNI_FALSE != env->ExceptionCheck())
- {
- env->ExceptionClear();
- OSL_FAIL("ExceptionClear");
- }
- ::rtl::OUString aStr;
- if ( jstr )
- {
- jboolean bCopy(sal_True);
- const jchar* pChar = env->GetStringChars(jstr,&bCopy);
- jsize len = env->GetStringLength(jstr);
- aStr = ::rtl::OUString(pChar,len);
-
- if(bCopy)
- env->ReleaseStringChars(jstr,pChar);
- }
-
- if (JNI_FALSE != env->ExceptionCheck())
- {
- env->ExceptionClear();
- OSL_FAIL("ExceptionClear");
- }
- return aStr;
- }
-
- // -----------------------------------------------------------------------------
- ::rtl::OUString StorageContainer::registerStorage(const Reference< XStorage>& _xStorage,const ::rtl::OUString& _sURL)
- {
- OSL_ENSURE(_xStorage.is(),"Storage is NULL!");
- TStorages& rMap = lcl_getStorageMap();
- // check if the storage is already in our map
- TStorages::iterator aFind = ::std::find_if(rMap.begin(),rMap.end(),
- ::o3tl::compose1(
- ::std::bind2nd(::std::equal_to<Reference<XStorage> >(),_xStorage)
- ,::o3tl::compose1(::o3tl::select1st<TStorageURLPair>(),::o3tl::compose1(::o3tl::select1st<TStorages::mapped_type>(),::o3tl::select2nd<TStorages::value_type>())))
- );
- if ( aFind == rMap.end() )
- {
- aFind = rMap.insert(TStorages::value_type(lcl_getNextCount(),TStorages::mapped_type(TStorageURLPair(_xStorage,_sURL),TStreamMap()))).first;
- }
-
- return aFind->first;
- }
- // -----------------------------------------------------------------------------
- TStorages::mapped_type StorageContainer::getRegisteredStorage(const ::rtl::OUString& _sKey)
- {
- TStorages::mapped_type aRet;
- TStorages& rMap = lcl_getStorageMap();
- TStorages::iterator aFind = rMap.find(_sKey);
- OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!");
- if ( aFind != rMap.end() )
- aRet = aFind->second;
-
- return aRet;
- }
- // -----------------------------------------------------------------------------
- ::rtl::OUString StorageContainer::getRegisteredKey(const Reference< XStorage>& _xStorage)
- {
- ::rtl::OUString sKey;
- OSL_ENSURE(_xStorage.is(),"Storage is NULL!");
- TStorages& rMap = lcl_getStorageMap();
- // check if the storage is already in our map
- TStorages::iterator aFind = ::std::find_if(rMap.begin(),rMap.end(),
- ::o3tl::compose1(
- ::std::bind2nd(::std::equal_to<Reference<XStorage> >(),_xStorage)
- ,::o3tl::compose1(::o3tl::select1st<TStorageURLPair>(),::o3tl::compose1(::o3tl::select1st<TStorages::mapped_type>(),::o3tl::select2nd<TStorages::value_type>())))
- );
- if ( aFind != rMap.end() )
- sKey = aFind->first;
- return sKey;
- }
- // -----------------------------------------------------------------------------
- void StorageContainer::revokeStorage(const ::rtl::OUString& _sKey,const Reference<XTransactionListener>& _xListener)
- {
- TStorages& rMap = lcl_getStorageMap();
- TStorages::iterator aFind = rMap.find(_sKey);
- if ( aFind != rMap.end() )
- {
- try
- {
- if ( _xListener.is() )
- {
- Reference<XTransactionBroadcaster> xBroad(aFind->second.first.first,UNO_QUERY);
- if ( xBroad.is() )
- xBroad->removeTransactionListener(_xListener);
- Reference<XTransactedObject> xTrans(aFind->second.first.first,UNO_QUERY);
- if ( xTrans.is() )
- xTrans->commit();
- }
- }
- catch(const Exception&)
- {
- }
- rMap.erase(aFind);
- }
- }
- // -----------------------------------------------------------------------------
- TStreamMap::mapped_type StorageContainer::registerStream(JNIEnv * env,jstring name, jstring key,sal_Int32 _nMode)
- {
- TStreamMap::mapped_type pHelper;
- TStorages& rMap = lcl_getStorageMap();
- ::rtl::OUString sKey = jstring2ustring(env,key);
- TStorages::iterator aFind = rMap.find(sKey);
- OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!");
- if ( aFind != rMap.end() )
- {
- TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(sKey);
- OSL_ENSURE(aStoragePair.first.first.is(),"No Storage available!");
- if ( aStoragePair.first.first.is() )
- {
- ::rtl::OUString sOrgName = StorageContainer::jstring2ustring(env,name);
- ::rtl::OUString sName = removeURLPrefix(sOrgName,aStoragePair.first.second);
- TStreamMap::iterator aStreamFind = aFind->second.second.find(sName);
- OSL_ENSURE( aStreamFind == aFind->second.second.end(),"A Stream was already registered for this object!");
- if ( aStreamFind != aFind->second.second.end() )
- {
- pHelper = aStreamFind->second;
- }
- else
- {
- try
- {
- try
- {
- pHelper.reset(new StreamHelper(aStoragePair.first.first->openStreamElement(sName,_nMode)));
- }
- catch(const Exception&)
- {
- ::rtl::OUString sStrippedName = removeOldURLPrefix(sOrgName);
-
- if ( ((_nMode & ElementModes::WRITE) != ElementModes::WRITE ) )
- {
- sal_Bool bIsStream = sal_True;
- try
- {
- bIsStream = aStoragePair.first.first->isStreamElement(sStrippedName);
- }
- catch(const Exception&)
- {
- bIsStream = sal_False;
- }
- if ( !bIsStream )
- return pHelper; // readonly file without data stream
- }
- pHelper.reset( new StreamHelper(aStoragePair.first.first->openStreamElement( sStrippedName, _nMode ) ) );
- }
- aFind->second.second.insert(TStreamMap::value_type(sName,pHelper));
- }
- catch(const Exception& e)
- {
-#if OSL_DEBUG_LEVEL > 0
- ::rtl::OString sMessage( "[HSQLDB-SDBC] caught an exception while opening a stream\n" );
- sMessage += "Name: ";
- sMessage += ::rtl::OString( sName.getStr(), sName.getLength(), osl_getThreadTextEncoding() );
- sMessage += "\nMode: 0x";
- if ( _nMode < 16 )
- sMessage += "0";
- sMessage += ::rtl::OString::valueOf( _nMode, 16 ).toAsciiUpperCase();
- OSL_FAIL( sMessage.getStr() );
-#endif
- StorageContainer::throwJavaException(e,env);
- }
- }
- }
- }
- return pHelper;
- }
- // -----------------------------------------------------------------------------
- void StorageContainer::revokeStream( JNIEnv * env,jstring name, jstring key)
- {
- TStorages& rMap = lcl_getStorageMap();
- TStorages::iterator aFind = rMap.find(jstring2ustring(env,key));
- OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!");
- if ( aFind != rMap.end() )
- aFind->second.second.erase(removeURLPrefix(jstring2ustring(env,name),aFind->second.first.second));
- }
- // -----------------------------------------------------------------------------
- TStreamMap::mapped_type StorageContainer::getRegisteredStream( JNIEnv * env,jstring name, jstring key)
- {
- TStreamMap::mapped_type pRet;
- TStorages& rMap = lcl_getStorageMap();
- TStorages::iterator aFind = rMap.find(jstring2ustring(env,key));
- OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!");
- if ( aFind != rMap.end() )
- {
- TStreamMap::iterator aStreamFind = aFind->second.second.find(removeURLPrefix(jstring2ustring(env,name),aFind->second.first.second));
- if ( aStreamFind != aFind->second.second.end() )
- pRet = aStreamFind->second;
- }
-
- return pRet;
- }
- // -----------------------------------------------------------------------------
- void StorageContainer::throwJavaException(const Exception& _aException,JNIEnv * env)
- {
- if (JNI_FALSE != env->ExceptionCheck())
- env->ExceptionClear();
- ::rtl::OString cstr( ::rtl::OUStringToOString(_aException.Message, RTL_TEXTENCODING_JAVA_UTF8 ) );
- OSL_TRACE( __FILE__": forwarding Exception: %s", cstr.getStr() );
- env->ThrowNew(env->FindClass("java/io/IOException"), cstr.getStr());
- }
- //........................................................................
- } // namespace hsqldb
- //........................................................................
-//........................................................................
-}
-// namespace connectivity
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HTable.cxx b/connectivity/source/drivers/hsqldb/HTable.cxx
deleted file mode 100644
index 732737eaf8..0000000000
--- a/connectivity/source/drivers/hsqldb/HTable.cxx
+++ /dev/null
@@ -1,429 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "hsqldb/HTable.hxx"
-#include "hsqldb/HTables.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#include <comphelper/property.hxx>
-#include <comphelper/extract.hxx>
-#include <comphelper/types.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-#include "connectivity/TKeys.hxx"
-#include "connectivity/TIndexes.hxx"
-#include "connectivity/TColumnsHelper.hxx"
-#include "hsqldb/HCatalog.hxx"
-#include "hsqldb/HColumns.hxx"
-#include "TConnection.hxx"
-
-#include <tools/diagnose_ex.h>
-
-
-using namespace ::comphelper;
-using namespace connectivity::hsqldb;
-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;
-
-OHSQLTable::OHSQLTable( sdbcx::OCollection* _pTables,
- const Reference< XConnection >& _xConnection)
- :OTableHelper(_pTables,_xConnection,sal_True)
-{
- // we create a new table here, so we should have all the rights or ;-)
- m_nPrivileges = Privilege::DROP |
- Privilege::REFERENCE |
- Privilege::ALTER |
- Privilege::CREATE |
- Privilege::READ |
- Privilege::DELETE |
- Privilege::UPDATE |
- Privilege::INSERT |
- Privilege::SELECT;
- construct();
-}
-// -------------------------------------------------------------------------
-OHSQLTable::OHSQLTable( sdbcx::OCollection* _pTables,
- const Reference< XConnection >& _xConnection,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description ,
- const ::rtl::OUString& _SchemaName,
- const ::rtl::OUString& _CatalogName,
- sal_Int32 _nPrivileges
- ) : OTableHelper( _pTables,
- _xConnection,
- sal_True,
- _Name,
- _Type,
- _Description,
- _SchemaName,
- _CatalogName)
- , m_nPrivileges(_nPrivileges)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-void OHSQLTable::construct()
-{
- OTableHelper::construct();
- if ( !isNew() )
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRIVILEGES), PROPERTY_ID_PRIVILEGES,PropertyAttribute::READONLY,&m_nPrivileges, ::getCppuType(&m_nPrivileges));
-}
-// -----------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OHSQLTable::createArrayHelper( sal_Int32 /*_nId*/ ) const
-{
- return doCreateArrayHelper();
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & OHSQLTable::getInfoHelper()
-{
- return *static_cast<OHSQLTable_PROP*>(const_cast<OHSQLTable*>(this))->getArrayHelper(isNew() ? 1 : 0);
-}
-// -----------------------------------------------------------------------------
-sdbcx::OCollection* OHSQLTable::createColumns(const TStringVector& _rNames)
-{
- OHSQLColumns* pColumns = new OHSQLColumns(*this,sal_True,m_aMutex,_rNames);
- pColumns->setParent(this);
- return pColumns;
-}
-// -----------------------------------------------------------------------------
-sdbcx::OCollection* OHSQLTable::createKeys(const TStringVector& _rNames)
-{
- return new OKeysHelper(this,m_aMutex,_rNames);
-}
-// -----------------------------------------------------------------------------
-sdbcx::OCollection* OHSQLTable::createIndexes(const TStringVector& _rNames)
-{
- return new OIndexesHelper(this,m_aMutex,_rNames);
-}
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OHSQLTable::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OHSQLTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : OTable_TYPEDEF::getSomething(rId);
-}
-// -------------------------------------------------------------------------
-// XAlterTable
-void SAL_CALL OHSQLTable::alterColumnByName( const ::rtl::OUString& colName, const Reference< XPropertySet >& descriptor ) throw(SQLException, NoSuchElementException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(
-#ifdef GCC
- ::connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed
-#else
- rBHelper.bDisposed
-#endif
- );
-
- if ( m_pColumns && !m_pColumns->hasByName(colName) )
- throw NoSuchElementException(colName,*this);
-
-
- if ( !isNew() )
- {
- // first we have to check what should be altered
- Reference<XPropertySet> xProp;
- m_pColumns->getByName(colName) >>= xProp;
- // first check the types
- sal_Int32 nOldType = 0,nNewType = 0,nOldPrec = 0,nNewPrec = 0,nOldScale = 0,nNewScale = 0;
- ::rtl::OUString sOldTypeName, sNewTypeName;
-
- ::dbtools::OPropertyMap& rProp = OMetaConnection::getPropMap();
-
- // type/typename
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPE)) >>= nOldType;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPE)) >>= nNewType;
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPENAME)) >>= sOldTypeName;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPENAME))>>= sNewTypeName;
-
- // and precsions and scale
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_PRECISION)) >>= nOldPrec;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_PRECISION))>>= nNewPrec;
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_SCALE)) >>= nOldScale;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_SCALE)) >>= nNewScale;
-
- // second: check the "is nullable" value
- sal_Int32 nOldNullable = 0,nNewNullable = 0;
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nOldNullable;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nNewNullable;
-
- // check also the auto_increment
- sal_Bool bOldAutoIncrement = sal_False,bAutoIncrement = sal_False;
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)) >>= bOldAutoIncrement;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)) >>= bAutoIncrement;
-
- // now we should look if the name of the column changed
- ::rtl::OUString sNewColumnName;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_NAME)) >>= sNewColumnName;
- if ( !sNewColumnName.equals(colName) )
- {
- const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( );
-
- ::rtl::OUString sSql = getAlterTableColumnPart();
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ALTER COLUMN "));
- sSql += ::dbtools::quoteName(sQuote,colName);
-
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" RENAME TO "));
- sSql += ::dbtools::quoteName(sQuote,sNewColumnName);
-
- executeStatement(sSql);
- }
-
- if ( nOldType != nNewType
- || sOldTypeName != sNewTypeName
- || nOldPrec != nNewPrec
- || nOldScale != nNewScale
- || nNewNullable != nOldNullable
- || bOldAutoIncrement != bAutoIncrement )
- {
- // special handling because they change the type names to distinguish
- // if a column should be an auto_incmrement one
- if ( bOldAutoIncrement != bAutoIncrement )
- {
- /// TODO: insert special handling for auto increment "IDENTITY" and primary key
- }
- alterColumnType(nNewType,sNewColumnName,descriptor);
- }
-
- // third: check the default values
- ::rtl::OUString sNewDefault,sOldDefault;
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_DEFAULTVALUE)) >>= sOldDefault;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_DEFAULTVALUE)) >>= sNewDefault;
-
- if(sOldDefault.getLength())
- {
- dropDefaultValue(colName);
- if(sNewDefault.getLength() && sOldDefault != sNewDefault)
- alterDefaultValue(sNewDefault,sNewColumnName);
- }
- else if(!sOldDefault.getLength() && sNewDefault.getLength())
- alterDefaultValue(sNewDefault,sNewColumnName);
-
- m_pColumns->refresh();
- }
- else
- {
- if(m_pColumns)
- {
- m_pColumns->dropByName(colName);
- m_pColumns->appendByDescriptor(descriptor);
- }
- }
-
-}
-// -----------------------------------------------------------------------------
-void OHSQLTable::alterColumnType(sal_Int32 nNewType,const ::rtl::OUString& _rColName, const Reference<XPropertySet>& _xDescriptor)
-{
- ::rtl::OUString sSql = getAlterTableColumnPart();
-
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ALTER COLUMN "));
-#if OSL_DEBUG_LEVEL > 0
- try
- {
- ::rtl::OUString sDescriptorName;
- OSL_ENSURE( _xDescriptor.is()
- && ( _xDescriptor->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_NAME ) ) >>= sDescriptorName )
- && ( sDescriptorName == _rColName ),
- "OHSQLTable::alterColumnType: unexpected column name!" );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-#else
- (void)_rColName;
-#endif
-
- OHSQLColumn* pColumn = new OHSQLColumn(sal_True);
- Reference<XPropertySet> xProp = pColumn;
- ::comphelper::copyProperties(_xDescriptor,xProp);
- xProp->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),makeAny(nNewType));
-
- sSql += ::dbtools::createStandardColumnPart(xProp,getConnection());
- executeStatement(sSql);
-}
-// -----------------------------------------------------------------------------
-void OHSQLTable::alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName)
-{
- ::rtl::OUString sSql = getAlterTableColumnPart();
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ALTER COLUMN "));
-
- const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( );
- sSql += ::dbtools::quoteName(sQuote,_rColName);
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" SET DEFAULT '")) + _sNewDefault;
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'"));
-
- executeStatement(sSql);
-}
-// -----------------------------------------------------------------------------
-void OHSQLTable::dropDefaultValue(const ::rtl::OUString& _rColName)
-{
- ::rtl::OUString sSql = getAlterTableColumnPart();
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ALTER COLUMN "));
-
- const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( );
- sSql += ::dbtools::quoteName(sQuote,_rColName);
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DROP DEFAULT"));
-
- executeStatement(sSql);
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OHSQLTable::getAlterTableColumnPart()
-{
- ::rtl::OUString sSql( RTL_CONSTASCII_USTRINGPARAM( "ALTER TABLE " ));
- const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( );
-
- ::rtl::OUString sComposedName( ::dbtools::composeTableName( getMetaData(), m_CatalogName, m_SchemaName, m_Name, sal_True, ::dbtools::eInTableDefinitions ) );
- sSql += sComposedName;
-
- return sSql;
-}
-// -----------------------------------------------------------------------------
-void OHSQLTable::executeStatement(const ::rtl::OUString& _rStatement )
-{
- ::rtl::OUString sSQL = _rStatement;
- if(sSQL.lastIndexOf(',') == (sSQL.getLength()-1))
- sSQL = sSQL.replaceAt(sSQL.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")));
-
- Reference< XStatement > xStmt = getConnection()->createStatement( );
- if ( xStmt.is() )
- {
- try { xStmt->execute(sSQL); }
- catch( const Exception& )
- {
- ::comphelper::disposeComponent(xStmt);
- throw;
- }
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OHSQLTable::getTypes( ) throw(RuntimeException)
-{
- if ( ! m_Type.compareToAscii("VIEW") )
- {
- Sequence< Type > aTypes = OTableHelper::getTypes();
- ::std::vector<Type> aOwnTypes;
- aOwnTypes.reserve(aTypes.getLength());
- const Type* pIter = aTypes.getConstArray();
- const Type* pEnd = pIter + aTypes.getLength();
- for(;pIter != pEnd;++pIter)
- {
- if( *pIter != ::getCppuType((const Reference<XRename>*)0) )
- {
- aOwnTypes.push_back(*pIter);
- }
- }
- Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- return Sequence< Type >(pTypes, aOwnTypes.size());
- }
- return OTableHelper::getTypes();
-}
-// -------------------------------------------------------------------------
-// XRename
-void SAL_CALL OHSQLTable::rename( const ::rtl::OUString& newName ) throw(SQLException, ElementExistException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(
-#ifdef GCC
- ::connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed
-#else
- rBHelper.bDisposed
-#endif
- );
-
- if(!isNew())
- {
- ::rtl::OUString sSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALTER "));
- if ( m_Type == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW")) )
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" VIEW "));
- else
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" TABLE "));
-
- ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( );
-
- ::rtl::OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(getMetaData(),newName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
-
- ::rtl::OUString sComposedName(
- ::dbtools::composeTableName( getMetaData(), m_CatalogName, m_SchemaName, m_Name, sal_True, ::dbtools::eInDataManipulation ) );
- sSql += sComposedName
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" RENAME TO "));
- sSql += ::dbtools::composeTableName( getMetaData(), sCatalog, sSchema, sTable, sal_True, ::dbtools::eInDataManipulation );
-
- executeStatement(sSql);
-
- ::connectivity::OTable_TYPEDEF::rename(newName);
- }
- else
- ::dbtools::qualifiedNameComponents(getMetaData(),newName,m_CatalogName,m_SchemaName,m_Name,::dbtools::eInTableDefinitions);
-}
-
-// -------------------------------------------------------------------------
-Any SAL_CALL OHSQLTable::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- if( !m_Type.compareToAscii("VIEW") && rType == ::getCppuType((const Reference<XRename>*)0) )
- return Any();
-
- return OTableHelper::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HTables.cxx b/connectivity/source/drivers/hsqldb/HTables.cxx
deleted file mode 100644
index 0e0725af27..0000000000
--- a/connectivity/source/drivers/hsqldb/HTables.cxx
+++ /dev/null
@@ -1,202 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "hsqldb/HTables.hxx"
-#include "hsqldb/HViews.hxx"
-#include "hsqldb/HTable.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include "hsqldb/HCatalog.hxx"
-#include <comphelper/extract.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/dbexception.hxx"
-#include <cppuhelper/interfacecontainer.h>
-#include <comphelper/types.hxx>
-#include "TConnection.hxx"
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace ::cppu;
-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;
-using namespace dbtools;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OTables::createObject(const ::rtl::OUString& _rName)
-{
- ::rtl::OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(m_xMetaData,_rName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
-
- static const ::rtl::OUString s_sTableTypeView(RTL_CONSTASCII_USTRINGPARAM("VIEW"));
- static const ::rtl::OUString s_sTableTypeTable(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
- static const ::rtl::OUString s_sAll(RTL_CONSTASCII_USTRINGPARAM("%"));
-
- Sequence< ::rtl::OUString > sTableTypes(3);
- sTableTypes[0] = s_sTableTypeView;
- sTableTypes[1] = s_sTableTypeTable;
- sTableTypes[2] = s_sAll; // just to be sure to include anything else ....
-
- Any aCatalog;
- if ( sCatalog.getLength() )
- aCatalog <<= sCatalog;
- Reference< XResultSet > xResult = m_xMetaData->getTables(aCatalog,sSchema,sTable,sTableTypes);
-
- sdbcx::ObjectType xRet = NULL;
- if ( xResult.is() )
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- if ( xResult->next() ) // there can be only one table with this name
- {
- sal_Int32 nPrivileges = ::dbtools::getTablePrivileges( m_xMetaData, sCatalog, sSchema, sTable );
- if ( m_xMetaData->isReadOnly() )
- nPrivileges &= ~( Privilege::INSERT | Privilege::UPDATE | Privilege::DELETE | Privilege::CREATE | Privilege::ALTER | Privilege::DROP );
-
- // obtain privileges
- OHSQLTable* pRet = new OHSQLTable( this
- ,static_cast<OHCatalog&>(m_rParent).getConnection()
- ,sTable
- ,xRow->getString(4)
- ,xRow->getString(5)
- ,sSchema
- ,sCatalog
- ,nPrivileges);
- xRet = pRet;
- }
- ::comphelper::disposeComponent(xResult);
- }
-
- return xRet;
-}
-// -------------------------------------------------------------------------
-void OTables::impl_refresh( ) throw(RuntimeException)
-{
- static_cast<OHCatalog&>(m_rParent).refreshTables();
-}
-// -------------------------------------------------------------------------
-void OTables::disposing(void)
-{
-m_xMetaData.clear();
- OCollection::disposing();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OTables::createDescriptor()
-{
- return new OHSQLTable(this,static_cast<OHCatalog&>(m_rParent).getConnection());
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OTables::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- createTable(descriptor);
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName)
-{
- Reference< XInterface > xObject( getObject( _nPos ) );
- sal_Bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject );
- if (!bIsNew)
- {
- Reference< XConnection > xConnection = static_cast<OHCatalog&>(m_rParent).getConnection();
-
-
- ::rtl::OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(m_xMetaData,_sElementName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
-
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP " ));
-
- Reference<XPropertySet> xProp(xObject,UNO_QUERY);
- sal_Bool bIsView;
- if((bIsView = (xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW"))))) // here we have a view
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW "));
- else
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE "));
-
- ::rtl::OUString sComposedName(
- ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sTable, sal_True, ::dbtools::eInDataManipulation ) );
- aSql += sComposedName;
- Reference< XStatement > xStmt = xConnection->createStatement( );
- if ( xStmt.is() )
- {
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
- // if no exception was thrown we must delete it from the views
- if ( bIsView )
- {
- HViews* pViews = static_cast<HViews*>(static_cast<OHCatalog&>(m_rParent).getPrivateViews());
- if ( pViews && pViews->hasByName(_sElementName) )
- pViews->dropByNameImpl(_sElementName);
- }
- }
-}
-// -------------------------------------------------------------------------
-void OTables::createTable( const Reference< XPropertySet >& descriptor )
-{
- Reference< XConnection > xConnection = static_cast<OHCatalog&>(m_rParent).getConnection();
- ::rtl::OUString aSql = ::dbtools::createSqlCreateTableStatement(descriptor,xConnection);
-
- Reference< XStatement > xStmt = xConnection->createStatement( );
- if ( xStmt.is() )
- {
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-void OTables::appendNew(const ::rtl::OUString& _rsNewTable)
-{
- insertElement(_rsNewTable,NULL);
-
- // notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any());
- OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners);
- while (aListenerLoop.hasMoreElements())
- static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent);
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OTables::getNameForObject(const sdbcx::ObjectType& _xObject)
-{
- OSL_ENSURE(_xObject.is(),"OTables::getNameForObject: Object is NULL!");
- return ::dbtools::composeTableName( m_xMetaData, _xObject, ::dbtools::eInDataManipulation, false, false, false );
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HTerminateListener.cxx b/connectivity/source/drivers/hsqldb/HTerminateListener.cxx
deleted file mode 100644
index 3b0bd52bba..0000000000
--- a/connectivity/source/drivers/hsqldb/HTerminateListener.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "HTerminateListener.hxx"
-#include "hsqldb/HDriver.hxx"
-
-//........................................................................
-namespace connectivity
-{
-//........................................................................
- using namespace hsqldb;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::frame;
- using namespace ::com::sun::star::lang;
- using namespace ::rtl;
-
-// XEventListener
-void SAL_CALL OConnectionController::disposing( const EventObject& /*Source*/ )
-throw( RuntimeException )
-{
-}
-
-// XTerminateListener
-void SAL_CALL OConnectionController::queryTermination( const EventObject& /*aEvent*/ )
-throw( TerminationVetoException, RuntimeException )
-{
- m_pDriver->flushConnections();
-}
-
-void SAL_CALL OConnectionController::notifyTermination( const EventObject& /*aEvent*/ )
-throw( RuntimeException )
-{
- m_pDriver->shutdownConnections();
-}
-
-//........................................................................
-} // namespace connectivity
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HTerminateListener.hxx b/connectivity/source/drivers/hsqldb/HTerminateListener.hxx
deleted file mode 100644
index 681985951e..0000000000
--- a/connectivity/source/drivers/hsqldb/HTerminateListener.hxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_HSQLDB_TERMINATELISTENER_HXX
-#define CONNECTIVITY_HSQLDB_TERMINATELISTENER_HXX
-
-#include <cppuhelper/compbase1.hxx>
-#include <com/sun/star/frame/XTerminateListener.hpp>
-
-//........................................................................
-namespace connectivity
-{
-//........................................................................
-
- namespace hsqldb
- {
- class ODriverDelegator;
- class OConnectionController : public ::cppu::WeakImplHelper1<
- ::com::sun::star::frame::XTerminateListener >
- {
- ODriverDelegator* m_pDriver;
- protected:
- virtual ~OConnectionController() {m_pDriver = NULL;}
- public:
- OConnectionController(ODriverDelegator* _pDriver) : m_pDriver(_pDriver){}
-
- // XEventListener
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
- throw( ::com::sun::star::uno::RuntimeException );
-
- // XTerminateListener
- virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& aEvent )
- throw( ::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException );
- virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent )
- throw( ::com::sun::star::uno::RuntimeException );
- };
- }
-//........................................................................
-} // namespace connectivity
-//........................................................................
-#endif // CONNECTIVITY_HSQLDB_TERMINATELISTENER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HTools.cxx b/connectivity/source/drivers/hsqldb/HTools.cxx
deleted file mode 100644
index 8f35c9246a..0000000000
--- a/connectivity/source/drivers/hsqldb/HTools.cxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "hsqldb/HTools.hxx"
-
-/** === begin UNO includes === **/
-/** === end UNO includes === **/
-
-//........................................................................
-namespace connectivity { namespace hsqldb
-{
-//........................................................................
-
- /** === begin UNO using === **/
- /** === end UNO using === **/
-
- //====================================================================
- //= HTools
- //====================================================================
- //--------------------------------------------------------------------
- void HTools::appendTableFilterCrit( ::rtl::OUStringBuffer& _inout_rBuffer, const ::rtl::OUString& _rCatalog,
- const ::rtl::OUString _rSchema, const ::rtl::OUString _rName, bool _bShortForm )
- {
- _inout_rBuffer.appendAscii( " WHERE " );
- if ( _rCatalog.getLength() )
- {
- _inout_rBuffer.appendAscii( _bShortForm ? "TABLE_CAT" : "TABLE_CATALOG" );
- _inout_rBuffer.appendAscii( " = '" );
- _inout_rBuffer.append ( _rCatalog );
- _inout_rBuffer.appendAscii( "' AND " );
- }
- if ( _rSchema.getLength() )
- {
- _inout_rBuffer.appendAscii( _bShortForm ? "TABLE_SCHEM" : "TABLE_SCHEMA" );
- _inout_rBuffer.appendAscii( " = '" );
- _inout_rBuffer.append ( _rSchema );
- _inout_rBuffer.appendAscii( "' AND " );
- }
- _inout_rBuffer.appendAscii( "TABLE_NAME = '" );
- _inout_rBuffer.append ( _rName );
- _inout_rBuffer.appendAscii( "'" );
- }
-
-//........................................................................
-} } // namespace connectivity::hsqldb
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HUser.cxx b/connectivity/source/drivers/hsqldb/HUser.cxx
deleted file mode 100644
index a968a0ca0d..0000000000
--- a/connectivity/source/drivers/hsqldb/HUser.cxx
+++ /dev/null
@@ -1,353 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "hsqldb/HUser.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/dbexception.hxx"
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#include <com/sun/star/sdbcx/PrivilegeObject.hpp>
-#include "TConnection.hxx"
-#include "resource/hsqldb_res.hrc"
-
-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;
-// -------------------------------------------------------------------------
-OHSQLUser::OHSQLUser( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection) : connectivity::sdbcx::OUser(sal_True)
- ,m_xConnection(_xConnection)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-OHSQLUser::OHSQLUser( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
- const ::rtl::OUString& _Name
- ) : connectivity::sdbcx::OUser(_Name,sal_True)
- ,m_xConnection(_xConnection)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-void OHSQLUser::refreshGroups()
-{
-}
-// -------------------------------------------------------------------------
-OUserExtend::OUserExtend( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection) : OHSQLUser(_xConnection)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-typedef connectivity::sdbcx::OUser OUser_TYPEDEF;
-void OUserExtend::construct()
-{
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), PROPERTY_ID_PASSWORD,0,&m_Password,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
-}
-// -----------------------------------------------------------------------------
-cppu::IPropertyArrayHelper* OUserExtend::createArrayHelper() const
-{
- Sequence< 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 OHSQLUser::getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
-
- sal_Int32 nRights,nRightsWithGrant;
- findPrivilegesAndGrantPrivileges(objName,objType,nRights,nRightsWithGrant);
- return nRights;
-}
-// -----------------------------------------------------------------------------
-void OHSQLUser::findPrivilegesAndGrantPrivileges(const ::rtl::OUString& objName, sal_Int32 objType,sal_Int32& nRights,sal_Int32& nRightsWithGrant) throw(SQLException, RuntimeException)
-{
- nRightsWithGrant = nRights = 0;
- // first we need to create the sql stmt to select the privs
- Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
- ::rtl::OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(xMeta,objName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
- Reference<XResultSet> xRes;
- switch(objType)
- {
- case PrivilegeObject::TABLE:
- case PrivilegeObject::VIEW:
- {
- Any aCatalog;
- if ( sCatalog.getLength() )
- aCatalog <<= sCatalog;
- xRes = xMeta->getTablePrivileges(aCatalog,sSchema,sTable);
- }
- break;
-
- case PrivilegeObject::COLUMN:
- {
- Any aCatalog;
- if ( sCatalog.getLength() )
- aCatalog <<= sCatalog;
- xRes = xMeta->getColumnPrivileges(aCatalog,sSchema,sTable,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")));
- }
- break;
- }
-
- if ( xRes.is() )
- {
- static const ::rtl::OUString sSELECT( RTL_CONSTASCII_USTRINGPARAM( "SELECT" ));
- static const ::rtl::OUString sINSERT( RTL_CONSTASCII_USTRINGPARAM( "INSERT" ));
- static const ::rtl::OUString sUPDATE( RTL_CONSTASCII_USTRINGPARAM( "UPDATE" ));
- static const ::rtl::OUString sDELETE( RTL_CONSTASCII_USTRINGPARAM( "DELETE" ));
- static const ::rtl::OUString sREAD( RTL_CONSTASCII_USTRINGPARAM( "READ" ));
- static const ::rtl::OUString sCREATE( RTL_CONSTASCII_USTRINGPARAM( "CREATE" ));
- static const ::rtl::OUString sALTER( RTL_CONSTASCII_USTRINGPARAM( "ALTER" ));
- static const ::rtl::OUString sREFERENCE( RTL_CONSTASCII_USTRINGPARAM( "REFERENCE" ));
- static const ::rtl::OUString sDROP( RTL_CONSTASCII_USTRINGPARAM( "DROP" ));
- static const ::rtl::OUString sYes( RTL_CONSTASCII_USTRINGPARAM( "YES" ));
-
- nRightsWithGrant = nRights = 0;
-
- Reference<XRow> xCurrentRow(xRes,UNO_QUERY);
- while( xCurrentRow.is() && xRes->next() )
- {
- ::rtl::OUString sGrantee = xCurrentRow->getString(5);
- ::rtl::OUString sPrivilege = xCurrentRow->getString(6);
- ::rtl::OUString sGrantable = xCurrentRow->getString(7);
-
- if (!m_Name.equalsIgnoreAsciiCase(sGrantee))
- continue;
-
- if (sPrivilege.equalsIgnoreAsciiCase(sSELECT))
- {
- nRights |= Privilege::SELECT;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::SELECT;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sINSERT))
- {
- nRights |= Privilege::INSERT;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::INSERT;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sUPDATE))
- {
- nRights |= Privilege::UPDATE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::UPDATE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sDELETE))
- {
- nRights |= Privilege::DELETE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::DELETE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sREAD))
- {
- nRights |= Privilege::READ;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::READ;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sCREATE))
- {
- nRights |= Privilege::CREATE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::CREATE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sALTER))
- {
- nRights |= Privilege::ALTER;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::ALTER;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sREFERENCE))
- {
- nRights |= Privilege::REFERENCE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::REFERENCE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sDROP))
- {
- nRights |= Privilege::DROP;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::DROP;
- }
- }
- ::comphelper::disposeComponent(xRes);
- }
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OHSQLUser::getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
-
- sal_Int32 nRights,nRightsWithGrant;
- findPrivilegesAndGrantPrivileges(objName,objType,nRights,nRightsWithGrant);
- return nRightsWithGrant;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OHSQLUser::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException)
-{
- if ( objType != PrivilegeObject::TABLE )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(STR_PRIVILEGE_NOT_GRANTED));
- ::dbtools::throwGenericSQLException(sError,*this);
- } // if ( objType != PrivilegeObject::TABLE )
-
-
- ::osl::MutexGuard aGuard(m_aMutex);
-
- ::rtl::OUString sPrivs = getPrivilegeString(objPrivileges);
- if(sPrivs.getLength())
- {
- ::rtl::OUString sGrant;
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GRANT "));
- sGrant += sPrivs;
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON "));
- Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
- sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation);
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" TO "));
- sGrant += m_Name;
-
- Reference<XStatement> xStmt = m_xConnection->createStatement();
- if(xStmt.is())
- xStmt->execute(sGrant);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OHSQLUser::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException)
-{
- if ( objType != PrivilegeObject::TABLE )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(STR_PRIVILEGE_NOT_REVOKED));
- ::dbtools::throwGenericSQLException(sError,*this);
- } // if ( objType != PrivilegeObject::TABLE )
-
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
- ::rtl::OUString sPrivs = getPrivilegeString(objPrivileges);
- if(sPrivs.getLength())
- {
- ::rtl::OUString sGrant;
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REVOKE "));
- sGrant += sPrivs;
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON "));
- Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
- sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation);
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FROM "));
- sGrant += m_Name;
-
- Reference<XStatement> xStmt = m_xConnection->createStatement();
- if(xStmt.is())
- xStmt->execute(sGrant);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-// XUser
-void SAL_CALL OHSQLUser::changePassword( const ::rtl::OUString& /*oldPassword*/, const ::rtl::OUString& newPassword ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
- ::rtl::OUString sAlterPwd;
- sAlterPwd = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SET PASSWORD FOR "));
- sAlterPwd += m_Name;
- sAlterPwd += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("@\"%\" = PASSWORD('")) ;
- sAlterPwd += newPassword;
- sAlterPwd += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("')")) ;
-
-
- Reference<XStatement> xStmt = m_xConnection->createStatement();
- if ( xStmt.is() )
- {
- xStmt->execute(sAlterPwd);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OHSQLUser::getPrivilegeString(sal_Int32 nRights) const
-{
- ::rtl::OUString sPrivs;
- if((nRights & Privilege::INSERT) == Privilege::INSERT)
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INSERT"));
-
- if((nRights & Privilege::DELETE) == Privilege::DELETE)
- {
- if(sPrivs.getLength())
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DELETE"));
- }
-
- if((nRights & Privilege::UPDATE) == Privilege::UPDATE)
- {
- if(sPrivs.getLength())
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UPDATE"));
- }
-
- if((nRights & Privilege::ALTER) == Privilege::ALTER)
- {
- if(sPrivs.getLength())
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALTER"));
- }
-
- if((nRights & Privilege::SELECT) == Privilege::SELECT)
- {
- if(sPrivs.getLength())
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT"));
- }
-
- if((nRights & Privilege::REFERENCE) == Privilege::REFERENCE)
- {
- if(sPrivs.getLength())
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REFERENCES"));
- }
-
- return sPrivs;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HUsers.cxx b/connectivity/source/drivers/hsqldb/HUsers.cxx
deleted file mode 100644
index 9816e56c4f..0000000000
--- a/connectivity/source/drivers/hsqldb/HUsers.cxx
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "hsqldb/HUsers.hxx"
-#include "hsqldb/HUser.hxx"
-#include "hsqldb/HTable.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include "connectivity/sdbcx/IRefreshable.hxx"
-#include <comphelper/types.hxx>
-#include "connectivity/dbexception.hxx"
-#include "connectivity/dbtools.hxx"
-#include "TConnection.hxx"
-
-using namespace ::comphelper;
-using namespace connectivity;
-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;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-OUsers::OUsers( ::cppu::OWeakObject& _rParent,
- ::osl::Mutex& _rMutex,
- const TStringVector &_rVector,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
- connectivity::sdbcx::IRefreshableUsers* _pParent)
- : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector)
- ,m_xConnection(_xConnection)
- ,m_pParent(_pParent)
-{
-}
-// -----------------------------------------------------------------------------
-
-sdbcx::ObjectType OUsers::createObject(const ::rtl::OUString& _rName)
-{
- return new OHSQLUser(m_xConnection,_rName);
-}
-// -------------------------------------------------------------------------
-void OUsers::impl_refresh() throw(RuntimeException)
-{
- m_pParent->refreshUsers();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OUsers::createDescriptor()
-{
- OUserExtend* pNew = new OUserExtend(m_xConnection);
- return pNew;
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OUsers::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "GRANT USAGE ON * TO " ));
- ::rtl::OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString( );
- ::rtl::OUString sUserName( _rForName );
- aSql += ::dbtools::quoteName(aQuote,sUserName)
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" @\"%\" "));
- ::rtl::OUString sPassword;
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)) >>= sPassword;
- if ( sPassword.getLength() )
- {
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IDENTIFIED BY '"));
- aSql += sPassword;
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'"));
- }
-
- Reference< XStatement > xStmt = m_xConnection->createStatement( );
- if(xStmt.is())
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
-
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OUsers::dropObject(sal_Int32 /*nPos*/,const ::rtl::OUString _sElementName)
-{
- {
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "REVOKE ALL ON * FROM " ));
- ::rtl::OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString( );
- aSql += ::dbtools::quoteName(aQuote,_sElementName);
-
- Reference< XStatement > xStmt = m_xConnection->createStatement( );
- if(xStmt.is())
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HView.cxx b/connectivity/source/drivers/hsqldb/HView.cxx
deleted file mode 100644
index 1596ee7025..0000000000
--- a/connectivity/source/drivers/hsqldb/HView.cxx
+++ /dev/null
@@ -1,216 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "hsqldb/HView.hxx"
-#include "hsqldb/HTools.hxx"
-
-#include "propertyids.hxx"
-
-#include "connectivity/dbexception.hxx"
-#include "connectivity/dbtools.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/lang/WrappedTargetException.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-/** === end UNO includes === **/
-
-#include <cppuhelper/exc_hlp.hxx>
-#include <tools/diagnose_ex.h>
-#include <unotools/sharedunocomponent.hxx>
-
-//........................................................................
-namespace connectivity { namespace hsqldb
-{
-//........................................................................
-
- /** === begin UNO using === **/
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::UNO_QUERY;
- 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::uno::makeAny;
- using ::com::sun::star::sdbc::XDatabaseMetaData;
- 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;
- /** === end UNO using === **/
-
- //====================================================================
- //= HView
- //====================================================================
- //--------------------------------------------------------------------
- HView::HView( const Reference< XConnection >& _rxConnection, sal_Bool _bCaseSensitive,
- const ::rtl::OUString& _rSchemaName, const ::rtl::OUString& _rName )
- :HView_Base( _bCaseSensitive, _rName, _rxConnection->getMetaData(), 0, ::rtl::OUString(), _rSchemaName, ::rtl::OUString() )
- ,m_xConnection( _rxConnection )
- {
- }
-
- //--------------------------------------------------------------------
- HView::~HView()
- {
- }
-
- //--------------------------------------------------------------------
- IMPLEMENT_FORWARD_XINTERFACE2( HView, HView_Base, HView_IBASE )
- IMPLEMENT_FORWARD_XTYPEPROVIDER2( HView, HView_Base, HView_IBASE )
-
- //--------------------------------------------------------------------
- void SAL_CALL HView::alterCommand( const ::rtl::OUString& _rNewCommand ) throw (SQLException, RuntimeException)
- {
- // not really atomic ... as long as we do not have something like
- // ALTER VIEW <name> TO <command>
- // in HSQL, we need to do it this way ...
- //
- // I can imagine scenarios where this fails, e.g. when dropping the view
- // succeedes, re-creating it fails, some other thread alters a table which
- // the view was based on, and then we try to restore the view with the
- // original command, which then fails, too.
- //
- // However, there's not much chance to prevent this kind of errors without
- // backend support.
-
- ::rtl::OUString sQualifiedName( ::dbtools::composeTableName(
- m_xMetaData, m_CatalogName, m_SchemaName, m_Name, true, ::dbtools::eInDataManipulation ) );
-
- ::utl::SharedUNOComponent< XStatement > xStatement; xStatement.set( m_xConnection->createStatement(), UNO_QUERY_THROW );
-
- // create a statement which can be used to re-create the original view, in case
- // dropping it succeeds, but creating it with a new statement fails
- ::rtl::OUStringBuffer aRestoreCommand;
- aRestoreCommand.appendAscii( "CREATE VIEW " );
- aRestoreCommand.append ( sQualifiedName );
- aRestoreCommand.appendAscii( " AS " );
- aRestoreCommand.append ( impl_getCommand_throw( true ) );
- ::rtl::OUString sRestoreCommand( aRestoreCommand.makeStringAndClear() );
-
- bool bDropSucceeded( false );
- try
- {
- // drop the existing view
- ::rtl::OUStringBuffer aCommand;
- aCommand.appendAscii( "DROP VIEW " );
- aCommand.append ( sQualifiedName );
- xStatement->execute( aCommand.makeStringAndClear() );
- bDropSucceeded = true;
-
- // create a new one with the same name
- aCommand.appendAscii( "CREATE VIEW " );
- aCommand.append ( sQualifiedName );
- aCommand.appendAscii( " AS " );
- aCommand.append ( _rNewCommand );
- xStatement->execute( aCommand.makeStringAndClear() );
- }
- catch( const SQLException& )
- {
- if ( bDropSucceeded )
- // drop succeeded, but creation failed -> re-create the view with the original
- // statemnet
- xStatement->execute( sRestoreCommand );
- throw;
- }
- catch( const RuntimeException& )
- {
- if ( bDropSucceeded )
- xStatement->execute( sRestoreCommand );
- throw;
- }
- catch( const Exception& )
- {
- if ( bDropSucceeded )
- xStatement->execute( sRestoreCommand );
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL HView::getFastPropertyValue( 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_throw( false );
- return;
- }
-
- HView_Base::getFastPropertyValue( _rValue, _nHandle );
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString HView::impl_getCommand_throw( bool _bAllowSQLException ) const
- {
- ::rtl::OUString sCommand;
-
- try
- {
- ::rtl::OUStringBuffer aCommand;
- aCommand.appendAscii( "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() ), UNO_QUERY_THROW );
- if ( !xResult->next() )
- {
- // hmm. There is no view view the name as we know it. Can only mean some other instance
- // dropped this view meanwhile ...
- throw DisposedException();
- }
-
- Reference< XRow > xRow( xResult, UNO_QUERY_THROW );
- sCommand = xRow->getString( 1 );
- }
- catch( const RuntimeException& ) { throw; }
- catch( const SQLException& e )
- {
- if ( _bAllowSQLException )
- throw;
- throw WrappedTargetException( e.Message, static_cast< XAlterView* >( const_cast< HView* >( this ) ), ::cppu::getCaughtException() );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- return sCommand;
- }
-
-//........................................................................
-} } // namespace connectivity::hsqldb
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/HViews.cxx b/connectivity/source/drivers/hsqldb/HViews.cxx
deleted file mode 100644
index 55b51f66fc..0000000000
--- a/connectivity/source/drivers/hsqldb/HViews.cxx
+++ /dev/null
@@ -1,172 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "hsqldb/HTables.hxx"
-#include "hsqldb/HViews.hxx"
-#include "hsqldb/HView.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include <com/sun/star/sdbcx/CheckOption.hpp>
-#include "hsqldb/HCatalog.hxx"
-#include <comphelper/extract.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/dbexception.hxx"
-#include <cppuhelper/interfacecontainer.h>
-#include <comphelper/types.hxx>
-#include "TConnection.hxx"
-
-using namespace ::comphelper;
-
-using namespace ::cppu;
-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;
-using namespace dbtools;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-// -------------------------------------------------------------------------
-HViews::HViews( const Reference< XConnection >& _rxConnection, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
- const TStringVector &_rVector )
- :sdbcx::OCollection( _rParent, sal_True, _rMutex, _rVector )
- ,m_xConnection( _rxConnection )
- ,m_xMetaData( _rxConnection->getMetaData() )
- ,m_bInDrop( sal_False )
-{
-}
-
-// -------------------------------------------------------------------------
-sdbcx::ObjectType HViews::createObject(const ::rtl::OUString& _rName)
-{
- ::rtl::OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(m_xMetaData,
- _rName,
- sCatalog,
- sSchema,
- sTable,
- ::dbtools::eInDataManipulation);
- return new HView( m_xConnection, isCaseSensitive(), sSchema, sTable );
-}
-
-// -------------------------------------------------------------------------
-void HViews::impl_refresh( ) throw(RuntimeException)
-{
- static_cast<OHCatalog&>(m_rParent).refreshTables();
-}
-// -------------------------------------------------------------------------
-void HViews::disposing(void)
-{
-m_xMetaData.clear();
- OCollection::disposing();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > HViews::createDescriptor()
-{
- Reference<XConnection> xConnection = static_cast<OHCatalog&>(m_rParent).getConnection();
- connectivity::sdbcx::OView* pNew = new connectivity::sdbcx::OView(sal_True,xConnection->getMetaData());
- return pNew;
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType HViews::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- createView(descriptor);
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void HViews::dropObject(sal_Int32 _nPos,const ::rtl::OUString /*_sElementName*/)
-{
- if ( m_bInDrop )
- return;
-
- Reference< XInterface > xObject( getObject( _nPos ) );
- sal_Bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject );
- if (!bIsNew)
- {
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP VIEW" ));
-
- Reference<XPropertySet> xProp(xObject,UNO_QUERY);
- aSql += ::dbtools::composeTableName( m_xMetaData, xProp, ::dbtools::eInTableDefinitions, false, false, true );
-
- Reference<XConnection> xConnection = static_cast<OHCatalog&>(m_rParent).getConnection();
- Reference< XStatement > xStmt = xConnection->createStatement( );
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-void HViews::dropByNameImpl(const ::rtl::OUString& elementName)
-{
- m_bInDrop = sal_True;
- OCollection_TYPE::dropByName(elementName);
- m_bInDrop = sal_False;
-}
-// -----------------------------------------------------------------------------
-void HViews::createView( const Reference< XPropertySet >& descriptor )
-{
- Reference<XConnection> xConnection = static_cast<OHCatalog&>(m_rParent).getConnection();
-
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE VIEW " ));
- ::rtl::OUString aQuote = xConnection->getMetaData()->getIdentifierQuoteString( );
- ::rtl::OUString sSchema,sCommand;
-
- aSql += ::dbtools::composeTableName( m_xMetaData, descriptor, ::dbtools::eInTableDefinitions, false, false, true );
-
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" AS "));
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND)) >>= sCommand;
- aSql += sCommand;
-
- Reference< XStatement > xStmt = xConnection->createStatement( );
- if ( xStmt.is() )
- {
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
-
- // insert the new view also in the tables collection
- OTables* pTables = static_cast<OTables*>(static_cast<OHCatalog&>(m_rParent).getPrivateTables());
- if ( pTables )
- {
- ::rtl::OUString sName = ::dbtools::composeTableName( m_xMetaData, descriptor, ::dbtools::eInDataManipulation, false, false, false );
- pTables->appendNew(sName);
- }
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/Hservices.cxx b/connectivity/source/drivers/hsqldb/Hservices.cxx
deleted file mode 100644
index d6399f36cc..0000000000
--- a/connectivity/source/drivers/hsqldb/Hservices.cxx
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "hsqldb/HDriver.hxx"
-#include <cppuhelper/factory.hxx>
-
-using namespace connectivity::hsqldb;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount* _pT
- );
-
-//---------------------------------------------------------------------------------------
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- sal_Char const* pImplementationName
- )
- : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- inline
- sal_Bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
- }
- catch(...)
- {
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = 0;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- ODriverDelegator::getImplementationName_Static(),
- ODriverDelegator::getSupportedServiceNames_Static(),
- ODriverDelegator_CreateInstance, ::cppu::createSingleFactory)
- ;
-
- if(aReq.xRet.is())
- aReq.xRet->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
deleted file mode 100644
index 7bfca0847f..0000000000
--- a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
+++ /dev/null
@@ -1,183 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
-#include "hsqldb/StorageFileAccess.h"
-#include "hsqldb/HStorageMap.hxx"
-
-#include <rtl/logfile.hxx>
-
-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 OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
-/*****************************************************************************/
-/* exception macros */
-
-#define ThrowException(env, type, msg) { \
- env->ThrowNew(env->FindClass(type), msg); }
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess
- * Method: isStreamElement
- * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
- */
-SAL_DLLPUBLIC_EXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement
- (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name)
-{
- TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key));
- if ( aStoragePair.first.first.is() )
- {
- try
- {
- ::rtl::OUString sName = StorageContainer::jstring2ustring(env,name);
- try
- {
- ::rtl::OUString sOldName = StorageContainer::removeOldURLPrefix(sName);
- if ( aStoragePair.first.first->isStreamElement(sOldName) )
- {
- try
- {
- aStoragePair.first.first->renameElement(sOldName,StorageContainer::removeURLPrefix(sName,aStoragePair.first.second));
- }
- catch(const Exception&)
- {
- }
- }
- }
- catch(const NoSuchElementException&)
- {
- }
- return aStoragePair.first.first->isStreamElement(StorageContainer::removeURLPrefix(sName,aStoragePair.first.second));
- }
- catch(const NoSuchElementException&)
- {
- }
- catch(const Exception& e)
- {
- OSL_FAIL("Exception caught! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement");
- if (JNI_FALSE != env->ExceptionCheck())
- env->ExceptionClear();
- ::rtl::OString cstr( ::rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_JAVA_UTF8 ) );
- OSL_TRACE( __FILE__": forwarding Exception: %s", cstr.getStr() );
- }
- }
- return JNI_FALSE;
-}
-// -----------------------------------------------------------------------------
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess
- * Method: removeElement
- * Signature: (Ljava/lang/String;Ljava/lang/String;)V
- */
-SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_removeElement
- (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name)
-{
-#ifdef HSQLDB_DBG
- {
- ::rtl::OUString sKey = StorageContainer::jstring2ustring(env,key);
- ::rtl::OUString sName = StorageContainer::jstring2ustring(env,name);
- }
-#endif
- TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key));
- if ( aStoragePair.first.first.is() )
- {
- try
- {
- aStoragePair.first.first->removeElement(StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,name),aStoragePair.first.second));
- }
- catch(const NoSuchElementException&)
- {
- if (JNI_FALSE != env->ExceptionCheck())
- env->ExceptionClear();
- }
- catch(const Exception& e)
- {
- OSL_FAIL("Exception caught! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_removeElement");
- StorageContainer::throwJavaException(e,env);
- }
- }
-}
-// -----------------------------------------------------------------------------
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess
- * Method: renameElement
- * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
- */
-SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_renameElement
- (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring oldname, jstring newname)
-{
-#ifdef HSQLDB_DBG
- {
- ::rtl::OUString sKey = StorageContainer::jstring2ustring(env,key);
- ::rtl::OUString sNewName = StorageContainer::jstring2ustring(env,newname);
- ::rtl::OUString sOldName = StorageContainer::jstring2ustring(env,oldname);
- }
-#endif
- TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key));
- if ( aStoragePair.first.first.is() )
- {
- try
- {
- aStoragePair.first.first->renameElement(
- StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,oldname),aStoragePair.first.second),
- StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,newname),aStoragePair.first.second)
- );
-#ifdef HSQLDB_DBG
- {
- ::rtl::OUString sNewName = StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,newname),aStoragePair.first.second);
- OSL_ENSURE(aStoragePair.first.first->isStreamElement(sNewName),"Stream could not be renamed");
- }
-#endif
- }
- catch(const NoSuchElementException&)
- {
- }
- catch(const Exception& e)
- {
- OSL_FAIL("Exception caught! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_renameElement");
- StorageContainer::throwJavaException(e,env);
- }
- }
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx
deleted file mode 100644
index 471ceea237..0000000000
--- a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx
+++ /dev/null
@@ -1,309 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <comphelper/stl_types.hxx>
-#include <comphelper/types.hxx>
-#include "hsqldb/HStorageAccess.hxx"
-#include "hsqldb/HStorageMap.hxx"
-#include "hsqldb/StorageNativeInputStream.h"
-
-#include "jvmaccess/virtualmachine.hxx"
-#include <com/sun/star/lang/XSingleComponentFactory.hpp>
-#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;
-
-#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
-/*****************************************************************************/
-/* exception macros */
-
-#define ThrowException(env, type, msg) { \
- env->ThrowNew(env->FindClass(type), msg); }
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream
- * Method: openStream
- * Signature: (Ljava/lang/String;Ljava/lang/String;I)V
- */
-SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_openStream
- (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name, jint mode)
-{
-#ifdef HSQLDB_DBG
- {
- OperationLogFile( env, name, "input" ).logOperation( "openStream" );
- LogFile( env, name, "input" ).create();
- }
-#endif
- StorageContainer::registerStream(env,name,key,mode);
-}
-// -----------------------------------------------------------------------------
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream
- * Method: read
- * Signature: (Ljava/lang/String;Ljava/lang/String;)I
- */
-SAL_DLLPUBLIC_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_read__Ljava_lang_String_2Ljava_lang_String_2
- (JNIEnv * env, jobject obj_this,jstring key, jstring name)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile( env, name, "input" ).logOperation( "read()" );
-
- DataLogFile aDataLog( env, name, "input" );
- return read_from_storage_stream( env, obj_this, name, key, &aDataLog );
-#else
- return read_from_storage_stream( env, obj_this, name, key );
-#endif
-}
-// -----------------------------------------------------------------------------
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream
- * Method: read
- * Signature: (Ljava/lang/String;Ljava/lang/String;[BII)I
- */
-SAL_DLLPUBLIC_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_read__Ljava_lang_String_2Ljava_lang_String_2_3BII
- (JNIEnv * env, jobject obj_this,jstring key, jstring name, jbyteArray buffer, jint off, jint len)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile( env, name, "input" ).logOperation( "read( byte[], int, int )" );
-
- DataLogFile aDataLog( env, name, "input" );
- return read_from_storage_stream_into_buffer( env, obj_this, name, key, buffer, off, len, &aDataLog );
-#else
- return read_from_storage_stream_into_buffer(env,obj_this,name,key,buffer,off,len);
-#endif
-}
-// -----------------------------------------------------------------------------
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream
- * Method: close
- * Signature: (Ljava/lang/String;Ljava/lang/String;)V
- */
-SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_close
- (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile aOpLog( env, name, "input" );
- aOpLog.logOperation( "close" );
- aOpLog.close();
-
- LogFile aDataLog( env, name, "input" );
- aDataLog.close();
-#endif
- StorageContainer::revokeStream(env,name,key);
-}
-// -----------------------------------------------------------------------------
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream
- * Method: skip
- * Signature: (Ljava/lang/String;Ljava/lang/String;J)J
- */
-SAL_DLLPUBLIC_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_skip
- (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name, jlong n)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile( env, name, "input" ).logOperation( "skip()" );
-#endif
-
- if ( n < 0 )
- ThrowException( env,
- "java/io/IOException",
- "n < 0");
-
- ::boost::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
- OSL_ENSURE(pHelper.get(),"No stream helper!");
- if ( pHelper.get() )
- {
- Reference<XInputStream> xIn = pHelper->getInputStream();
- if ( xIn.is() )
- {
- try
- {
- sal_Int64 tmpLongVal = n;
- sal_Int32 tmpIntVal;
-
- try
- {
- do {
- if (tmpLongVal >= ::std::numeric_limits<sal_Int64>::max() )
- tmpIntVal = ::std::numeric_limits<sal_Int32>::max();
- else // Casting is safe here.
- tmpIntVal = static_cast<sal_Int32>(tmpLongVal);
-
- tmpLongVal -= tmpIntVal;
-
- xIn->skipBytes(tmpIntVal);
-
- } while (tmpLongVal > 0);
- }
- catch(const Exception&)
- {
- }
-
- return n - tmpLongVal;
- }
- catch(const Exception& e)
- {
- OSL_FAIL("Exception caught! : skip();");
- StorageContainer::throwJavaException(e,env);
- }
- }
- }
- else
- {
- ThrowException( env,
- "java/io/IOException",
- "Stream is not valid");
- }
- return 0;
-}
-// -----------------------------------------------------------------------------
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream
- * Method: available
- * Signature: (Ljava/lang/String;Ljava/lang/String;)I
- */
-SAL_DLLPUBLIC_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_available
- (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile aOpLog( env, name, "input" );
- aOpLog.logOperation( "available" );
-#endif
-
- ::boost::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
- OSL_ENSURE(pHelper.get(),"No stream helper!");
- Reference<XInputStream> xIn = pHelper.get() ? pHelper->getInputStream() : Reference<XInputStream>();
- if ( xIn.is() )
- {
- try
- {
- jint nAvailable = xIn->available();
-#ifdef HSQLDB_DBG
- aOpLog.logReturn( nAvailable );
-#endif
- return nAvailable;
- }
- catch(const Exception& e)
- {
- OSL_FAIL("Exception caught! : available();");
- StorageContainer::throwJavaException(e,env);
- }
- }
- else
- {
- ThrowException( env,
- "java/io/IOException",
- "Stream is not valid");
- }
- return 0;
-}
-// -----------------------------------------------------------------------------
-
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream
- * Method: read
- * Signature: (Ljava/lang/String;Ljava/lang/String;[B)I
- */
-SAL_DLLPUBLIC_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_read__Ljava_lang_String_2Ljava_lang_String_2_3B
- (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name, jbyteArray buffer)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile aOpLog( env, name, "input" );
- aOpLog.logOperation( "read( byte[] )" );
-
- DataLogFile aDataLog( env, name, "input" );
-#endif
-
- ::boost::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
- Reference< XInputStream> xIn = pHelper.get() ? pHelper->getInputStream() : Reference< XInputStream>();
- OSL_ENSURE(xIn.is(),"Input stream is NULL!");
- jint nBytesRead = 0;
- if ( xIn.is() )
- {
- jsize nLen = env->GetArrayLength(buffer);
- Sequence< ::sal_Int8 > aData(nLen);
-
- try
- {
- nBytesRead = xIn->readBytes(aData,nLen);
- }
- catch(const Exception& e)
- {
- OSL_FAIL("Exception caught! : skip();");
- StorageContainer::throwJavaException(e,env);
- }
-
- // Casting bytesRead to an int is okay, since the user can
- // only pass in an integer length to read, so the bytesRead
- // must <= len.
- //
- if (nBytesRead <= 0) {
-#ifdef HSQLDB_DBG
- aOpLog.logReturn( (jint)-1 );
-#endif
- return -1;
- }
- OSL_ENSURE(nLen >= nBytesRead,"Buffer is too small!");
- OSL_ENSURE(aData.getLength() >= nBytesRead,"Buffer is too small!");
- env->SetByteArrayRegion(buffer,0,nBytesRead,(const jbyte*) &aData[0]);
-#ifdef HSQLDB_DBG
- aDataLog.write( &aData[0], nBytesRead );
-#endif
- }
-#ifdef HSQLDB_DBG
- aOpLog.logReturn( nBytesRead );
-#endif
- return nBytesRead;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx b/connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx
deleted file mode 100644
index 17b7fd89db..0000000000
--- a/connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx
+++ /dev/null
@@ -1,222 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "uno/mapping.hxx"
-#include "uno/environment.hxx"
-#include "cppuhelper/bootstrap.hxx"
-#include "cppuhelper/compbase1.hxx"
-#include "cppuhelper/component_context.hxx"
-#include "accesslog.hxx"
-#include <com/sun/star/embed/XTransactedObject.hpp>
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <comphelper/stl_types.hxx>
-#include <comphelper/types.hxx>
-#include "hsqldb/HStorageAccess.hxx"
-#include "hsqldb/HStorageMap.hxx"
-
-#include "jvmaccess/virtualmachine.hxx"
-#include "com/sun/star/lang/XSingleComponentFactory.hpp"
-#include "diagnose_ex.h"
-
-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;
-
-#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
-/*****************************************************************************/
-/* exception macros */
-
-#define ThrowException(env, type, msg) { \
- env->ThrowNew(env->FindClass(type), msg); }
-
-// -----------------------------------------------------------------------------
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream
- * Method: openStream
- * Signature: (Ljava/lang/String;Ljava/lang/String;I)V
- */
-extern "C" SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_openStream
- (JNIEnv * env, jobject /*obj_this*/, jstring name, jstring key, jint mode)
-{
-#ifdef HSQLDB_DBG
- {
- OperationLogFile( env, name, "output" ).logOperation( "openStream" );
- LogFile( env, name, "output" ).create();
- }
-#endif
- StorageContainer::registerStream(env,name,key,mode);
-}
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream
- * Method: write
- * Signature: (Ljava/lang/String;Ljava/lang/String;[BII)V
- */
-extern "C" SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2_3BII
- (JNIEnv * env, jobject obj_this, jstring key, jstring name, jbyteArray buffer, jint off, jint len)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile( env, name, "output" ).logOperation( "write( byte[], int, int )" );
-
- DataLogFile aDataLog( env, name, "output" );
- write_to_storage_stream_from_buffer( env, obj_this, name, key, buffer, off, len, &aDataLog );
-#else
- write_to_storage_stream_from_buffer( env, obj_this, name, key, buffer, off, len );
-#endif
-}
-// -----------------------------------------------------------------------------
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream
- * Method: write
- * Signature: (Ljava/lang/String;Ljava/lang/String;[B)V
- */
-extern "C" SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2_3B
- (JNIEnv * env, jobject obj_this, jstring key, jstring name, jbyteArray buffer)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile( env, name, "output" ).logOperation( "write( byte[] )" );
-
- DataLogFile aDataLog( env, name, "output" );
- write_to_storage_stream_from_buffer( env, obj_this, name, key, buffer, 0, env->GetArrayLength( buffer ), &aDataLog );
-#else
- write_to_storage_stream_from_buffer( env, obj_this, name, key, buffer, 0, env->GetArrayLength( buffer ) );
-#endif
-}
-// -----------------------------------------------------------------------------
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream
- * Method: close
- * Signature: (Ljava/lang/String;Ljava/lang/String;)V
- */
-extern "C" SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_close
- (JNIEnv * env, jobject /*obj_this*/, jstring key, jstring name)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile aOpLog( env, name, "output" );
- aOpLog.logOperation( "close" );
-
- LogFile aDataLog( env, name, "output" );
-#endif
-
- ::boost::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
- Reference< XOutputStream> xFlush = pHelper.get() ? pHelper->getOutputStream() : Reference< XOutputStream>();
- if ( xFlush.is() )
- try
- {
- xFlush->flush();
- }
- catch(Exception&)
- {}
-
-#ifdef HSQLDB_DBG
- aDataLog.close();
- aOpLog.close();
-#endif
- StorageContainer::revokeStream(env,name,key);
-}
-// -----------------------------------------------------------------------------
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream
- * Method: write
- * Signature: (Ljava/lang/String;Ljava/lang/String;I)V
- */
-extern "C" SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2I
- (JNIEnv * env, jobject obj_this, jstring key, jstring name,jint b)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile( env, name, "output" ).logOperation( "write( int )" );
-
- DataLogFile aDataLog( env, name, "output" );
- write_to_storage_stream( env, obj_this, name, key, b, &aDataLog );
-#else
- write_to_storage_stream( env, obj_this, name, key, b );
-#endif
-}
-// -----------------------------------------------------------------------------
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream
- * Method: flush
- * Signature: (Ljava/lang/String;Ljava/lang/String;)V
- */
-extern "C" SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_flush
- (JNIEnv * env, jobject /*obj_this*/, jstring key, jstring name)
-{
- OSL_UNUSED( env );
- OSL_UNUSED( key );
- OSL_UNUSED( name );
-#ifdef HSQLDB_DBG
- OperationLogFile( env, name, "output" ).logOperation( "flush" );
-
- ::rtl::OUString sKey = StorageContainer::jstring2ustring(env,key);
- ::rtl::OUString sName = StorageContainer::jstring2ustring(env,name);
-#endif
-}
-// -----------------------------------------------------------------------------
-/*
- * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream
- * Method: sync
- * Signature: (Ljava/lang/String;Ljava/lang/String;)V
- */
-extern "C" SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_sync
- (JNIEnv * env, jobject /*obj_this*/, jstring key, jstring name)
-{
-#ifdef HSQLDB_DBG
- OperationLogFile( env, name, "output" ).logOperation( "sync" );
-#endif
- ::boost::shared_ptr< StreamHelper > pStream = StorageContainer::getRegisteredStream( env, name, key );
- Reference< XOutputStream > xFlush = pStream.get() ? pStream->getOutputStream() : Reference< XOutputStream>();
- OSL_ENSURE( xFlush.is(), "StorageNativeOutputStream::sync: could not retrieve an output stream!" );
- if ( xFlush.is() )
- {
- try
- {
- xFlush->flush();
- }
- catch(Exception&)
- {
- OSL_FAIL( "StorageNativeOutputStream::sync: could not flush output stream!" );
- }
- }
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/accesslog.cxx b/connectivity/source/drivers/hsqldb/accesslog.cxx
deleted file mode 100644
index 111e1da186..0000000000
--- a/connectivity/source/drivers/hsqldb/accesslog.cxx
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#ifdef HSQLDB_DBG
-#include "accesslog.hxx"
-#include "hsqldb/HStorageMap.hxx"
-
-#include <osl/thread.h>
-
-namespace connectivity { namespace hsqldb
-{
- DECLARE_STL_USTRINGACCESS_MAP(FILE *,TDebugStreamMap);
- TDebugStreamMap& getStreams()
- {
- static TDebugStreamMap streams;
- return streams;
- }
-
- //---------------------------------------------------------------------
- LogFile::LogFile( JNIEnv* env, jstring streamName, const sal_Char* _pAsciiSuffix )
- {
- m_sFileName = StorageContainer::jstring2ustring(env,streamName);
- m_sFileName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("."));
- m_sFileName += ::rtl::OUString::createFromAscii( _pAsciiSuffix );
- }
-
- //---------------------------------------------------------------------
- FILE*& LogFile::getLogFile()
- {
- FILE*& pLogFile = getStreams()[m_sFileName];
- if ( !pLogFile )
- {
- ::rtl::OString sByteLogName = ::rtl::OUStringToOString(m_sFileName,osl_getThreadTextEncoding());
- pLogFile = fopen( sByteLogName.getStr(), "a+" );
- }
- return pLogFile;
- }
-
- //---------------------------------------------------------------------
- void LogFile::writeString( const sal_Char* _pString, bool _bEndLine )
- {
- FILE* pLogFile = getLogFile();
- fwrite( _pString, sizeof( *_pString ), strlen( _pString ), pLogFile );
- if ( _bEndLine )
- fwrite( "\n", sizeof( *_pString ), strlen( "\n" ), pLogFile );
- fflush( pLogFile );
- }
-
- //---------------------------------------------------------------------
- void LogFile::close()
- {
- fclose( getLogFile() );
- getLogFile() = NULL;
- }
-} }
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/accesslog.hxx b/connectivity/source/drivers/hsqldb/accesslog.hxx
deleted file mode 100644
index f10ae77d4e..0000000000
--- a/connectivity/source/drivers/hsqldb/accesslog.hxx
+++ /dev/null
@@ -1,148 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONNECTIVITY_HSQLDB_ACCESSLOG_HXX
-#define CONNECTIVITY_HSQLDB_ACCESSLOG_HXX
-
-#ifdef HSQLDB_DBG
-
-#include <stdio.h>
-#include <jni.h>
-#include <rtl/ustring.hxx>
-#include <rtl/string.hxx>
-
-namespace connectivity { namespace hsqldb
-{
- class LogFile
- {
- private:
- ::rtl::OUString m_sFileName;
-
- public:
- LogFile( JNIEnv* env, jstring streamName, const sal_Char* _pAsciiSuffix );
-
- public:
- void writeString( const sal_Char* _pString, bool _bEndLine = true );
- void create() { getLogFile(); }
- virtual void close();
-
- protected:
- FILE*& getLogFile();
- };
-
- class OperationLogFile : public LogFile
- {
- public:
- OperationLogFile( JNIEnv* env, jstring streamName, const sal_Char* _pAsciiSuffix )
- :LogFile( env, streamName, ( ::rtl::OString( _pAsciiSuffix ) += ".op" ).getStr() )
- {
- }
-
- void logOperation( const sal_Char* _pOp )
- {
- writeString( _pOp, true );
- }
-
- void logOperation( const sal_Char* _pOp, jlong _nLongArg )
- {
- ::rtl::OString sLine( _pOp );
- sLine += "( ";
- sLine += ::rtl::OString::valueOf( _nLongArg );
- sLine += " )";
- writeString( sLine.getStr(), true );
- }
-
- void logReturn( jlong _nRetVal )
- {
- ::rtl::OString sLine( " -> " );
- sLine += ::rtl::OString::valueOf( _nRetVal );
- writeString( sLine.getStr(), true );
- }
-
- void logReturn( jint _nRetVal )
- {
- ::rtl::OString sLine( " -> " );
- sLine += ::rtl::OString::valueOf( _nRetVal );
- writeString( sLine.getStr(), true );
- }
-
- virtual void close()
- {
- writeString( "-------------------------------", true );
- writeString( "", true );
- LogFile::close();
- }
- };
-
- class DataLogFile : public LogFile
- {
- public:
- DataLogFile( JNIEnv* env, jstring streamName, const sal_Char* _pAsciiSuffix )
- :LogFile( env, streamName, _pAsciiSuffix )
- {
- }
-
- void write( jint value )
- {
- fputc( value, getLogFile() );
- fflush( getLogFile() );
- }
-
- void write( const sal_Int8* buffer, sal_Int32 bytesRead )
- {
- fwrite( buffer, sizeof(sal_Int8), bytesRead, getLogFile() );
- fflush( getLogFile() );
- }
-
- sal_Int64 seek( sal_Int64 pos )
- {
- FILE* pFile = getLogFile();
- fseek( pFile, 0, SEEK_END );
- if ( ftell( pFile ) < pos )
- {
- sal_Int8 filler( 0 );
- while ( ftell( pFile ) < pos )
- fwrite( &filler, sizeof( sal_Int8 ), 1, pFile );
- fflush( pFile );
- }
- fseek( pFile, pos, SEEK_SET );
- return ftell( pFile );
- }
-
- sal_Int64 tell()
- {
- return ftell( getLogFile() );
- }
- };
-
-} }
-#endif
-
-#endif // CONNECTIVITY_HSQLDB_ACCESSLOG_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/hsqldb/exports.dxp b/connectivity/source/drivers/hsqldb/exports.dxp
deleted file mode 100755
index de2bf561d4..0000000000
--- a/connectivity/source/drivers/hsqldb/exports.dxp
+++ /dev/null
@@ -1,28 +0,0 @@
-component_getFactory
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_openStream
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2_3BII
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2_3B
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_close
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2I
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_flush
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_sync
-Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_openStream
-Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_close
-Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_getFilePointer
-Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_length
-Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_read__Ljava_lang_String_2Ljava_lang_String_2
-Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_read__Ljava_lang_String_2Ljava_lang_String_2_3BII
-Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_readInt
-Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_seek
-Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_write
-Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_writeInt
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_openStream
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_read__Ljava_lang_String_2Ljava_lang_String_2
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_read__Ljava_lang_String_2Ljava_lang_String_2_3BII
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_close
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_skip
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_available
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_read__Ljava_lang_String_2Ljava_lang_String_2_3B
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_removeElement
-Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_renameElement
diff --git a/connectivity/source/drivers/hsqldb/hsqldb.component b/connectivity/source/drivers/hsqldb/hsqldb.component
deleted file mode 100755
index eb8ae477e7..0000000000
--- a/connectivity/source/drivers/hsqldb/hsqldb.component
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.sdbcx.comp.hsqldb.Driver">
- <service name="com.sun.star.sdbc.Driver"/>
- <service name="com.sun.star.sdbcx.Driver"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/hsqldb/hsqldb.map b/connectivity/source/drivers/hsqldb/hsqldb.map
deleted file mode 100755
index 2ffbabaac1..0000000000
--- a/connectivity/source/drivers/hsqldb/hsqldb.map
+++ /dev/null
@@ -1,33 +0,0 @@
-UDK_3_0_0 {
- global:
- component_getFactory;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_openStream;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2_3BII;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2_3B;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_close;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2I;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_flush;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_sync;
- Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_openStream;
- Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_close;
- Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_getFilePointer;
- Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_length;
- Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_read__Ljava_lang_String_2Ljava_lang_String_2;
- Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_read__Ljava_lang_String_2Ljava_lang_String_2_3BII;
- Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_readInt;
- Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_seek;
- Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_write;
- Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_writeInt;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_openStream;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_read__Ljava_lang_String_2Ljava_lang_String_2;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_read__Ljava_lang_String_2Ljava_lang_String_2_3BII;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_close;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_skip;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_available;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_read__Ljava_lang_String_2Ljava_lang_String_2_3B;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_removeElement;
- Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_renameElement;
- local:
- *;
-};
diff --git a/connectivity/source/drivers/hsqldb/hsqldb.xcu b/connectivity/source/drivers/hsqldb/hsqldb.xcu
deleted file mode 100644
index af9c348242..0000000000
--- a/connectivity/source/drivers/hsqldb/hsqldb.xcu
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="sdbc:embedded:hsqldb" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.sdbcx.comp.hsqldb.Driver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">HSQL database engine</value>
- </prop>
- <node oor:name="Features">
- <node oor:name="UseDOSLineEnds" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FormsCheckRequiredFields" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="AddIndexAppendix" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseJava" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="AutoIncrementIsPrimaryKey" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/hsqldb/hsqldb.xml b/connectivity/source/drivers/hsqldb/hsqldb.xml
deleted file mode 100755
index f8e5c61af6..0000000000
--- a/connectivity/source/drivers/hsqldb/hsqldb.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<!DOCTYPE module-description PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
-<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
- <module-name>hsqldb</module-name>
- <component-description>
- <author>Ocke Janssen</author>
- <name>com.sun.star.sdbcx.comp.hsqldb.Driver</name>
- <description>
- This is the implementation of the HSQLDB driver.
- </description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service>com.sun.star.sdbcx.Driver</supported-service>
- </component-description>
- <project-build-dependency>cppuhelper</project-build-dependency>
- <project-build-dependency>cppu</project-build-dependency>
- <project-build-dependency>sal</project-build-dependency>
- <runtime-module-dependency>cppuhelper</runtime-module-dependency>
- <runtime-module-dependency>cppu</runtime-module-dependency>
- <runtime-module-dependency>sal</runtime-module-dependency>
- <runtime-module-dependency>dbtools</runtime-module-dependency>
- <runtime-module-dependency>comphelper</runtime-module-dependency>
-</module-description>
-
-
diff --git a/connectivity/source/drivers/hsqldb/hsqlui.hrc b/connectivity/source/drivers/hsqldb/hsqlui.hrc
deleted file mode 100755
index e17ffb5e99..0000000000
--- a/connectivity/source/drivers/hsqldb/hsqlui.hrc
+++ /dev/null
@@ -1,35 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONNECTIVITY_HSQLUI_HRC
-#define CONNECTIVITY_HSQLUI_HRC
-
-#define LINKED_TEXT_TABLE_IMAGE_RESOURCE "linked_text_table.png"
-
-#endif // CONNECTIVITY_HSQLUI_HRC
-
-
diff --git a/connectivity/source/drivers/hsqldb/hsqlui.src b/connectivity/source/drivers/hsqldb/hsqlui.src
deleted file mode 100644
index 27166edf26..0000000000
--- a/connectivity/source/drivers/hsqldb/hsqlui.src
+++ /dev/null
@@ -1,48 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONNECTIVITY_HSQLUI_HRC
-#include "hsqlui.hrc"
-#endif
-
-/* Note:
- The resource file built here (hsqldb.res, finally) is *not* included
- in the final OOo installation. Instead, it is only built to ensure that
- the image below is included in the application-wide image repository
- (images.zip). This way, they can be accessed at runtime, but without the
- indirection via a resource file - the GraphicProvider service supports
- a "private:imagerepository/*" protocol meanwhile, which allows this.
-
- If there were another possibility to ensure that the images are
- put into the repository, instead of creating a resource file for them,
- then we would use this other way ...
-*/
-
-Image 1000
-{
- ImageBitmap = Bitmap { File = LINKED_TEXT_TABLE_IMAGE_RESOURCE; };
-};
diff --git a/connectivity/source/drivers/hsqldb/makefile.mk b/connectivity/source/drivers/hsqldb/makefile.mk
deleted file mode 100755
index 6e400696fa..0000000000
--- a/connectivity/source/drivers/hsqldb/makefile.mk
+++ /dev/null
@@ -1,126 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=hsqldb
-
-ENABLE_EXCEPTIONS=TRUE
-VISIBILITY_HIDDEN=TRUE
-USE_DEFFILE=TRUE
-
-# --- Settings ----------------------------------
-.INCLUDE : $(PRJ)$/makefile.pmk
-.INCLUDE : $(PRJ)$/version.mk
-
-.IF "$(SOLAR_JAVA)"==""
-nojava:
- @echo "Not building jurt because Java is disabled"
-.ENDIF
-
-.IF "$(SYSTEM_HSQLDB)" == "YES"
-CDEFS+=-DSYSTEM_HSQLDB -DHSQLDB_JAR=\""file://$(HSQLDB_JAR)"\"
-.ENDIF
-# --- Resources ---------------------------------
-
-SRS1NAME=$(TARGET)
-SRC1FILES = \
- hsqlui.src
-
-RES1FILELIST=\
- $(SRS)$/$(TARGET).srs
-
-RESLIB1NAME=$(TARGET)
-RESLIB1IMAGES=$(SOLARDEFIMG)$/database
-RESLIB1SRSFILES=$(RES1FILELIST)
-
-# Note that the resource file built here is currently *not* included
-# in installation sets. See hsqlui.src for an explanation
-
-# --- Files -------------------------------------
-
-SLOFILES=\
- $(SLO)$/HStorageMap.obj \
- $(SLO)$/HStorageAccess.obj \
- $(SLO)$/HDriver.obj \
- $(SLO)$/HConnection.obj \
- $(SLO)$/HTerminateListener.obj \
- $(SLO)$/StorageNativeOutputStream.obj \
- $(SLO)$/StorageNativeInputStream.obj \
- $(SLO)$/StorageFileAccess.obj \
- $(SLO)$/HTables.obj \
- $(SLO)$/HTable.obj \
- $(SLO)$/HView.obj \
- $(SLO)$/HViews.obj \
- $(SLO)$/HCatalog.obj \
- $(SLO)$/HColumns.obj \
- $(SLO)$/HUser.obj \
- $(SLO)$/HUsers.obj \
- $(SLO)$/Hservices.obj \
- $(SLO)$/HTools.obj \
- $(SLO)$/accesslog.obj
-
-SHL1VERSIONMAP=$(HSQLDB_TARGET).map
-
-# --- Library -----------------------------------
-# NO $(DLLPOSTFIX) otherwise we have to find on which plattform we are for the java files
-SHL1TARGET= $(HSQLDB_TARGET)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SALLIB) \
- $(DBTOOLSLIB) \
- $(JVMFWKLIB) \
- $(COMPHELPERLIB) \
- $(TOOLSLIB) \
- $(UNOTOOLSLIB)
-
-
-SHL1DEPN=
-SHL1CREATEJNILIB=TRUE
-SHL1IMPLIB= i$(HSQLDB_TARGET)
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
-
-# --- Targets ----------------------------------
-
-.INCLUDE : $(PRJ)$/target.pmk
-
-
-
-ALLTAR : $(MISC)/hsqldb.component
-
-$(MISC)/hsqldb.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- hsqldb.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt hsqldb.component
diff --git a/connectivity/source/drivers/jdbc/Array.cxx b/connectivity/source/drivers/jdbc/Array.cxx
deleted file mode 100644
index 77b2492b9f..0000000000
--- a/connectivity/source/drivers/jdbc/Array.cxx
+++ /dev/null
@@ -1,144 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/sql/Array.hxx"
-#include "java/tools.hxx"
-#include "java/sql/ResultSet.hxx"
-
-using namespace connectivity;
-//**************************************************************
-//************ Class: java.sql.Array
-//**************************************************************
-
-jclass java_sql_Array::theClass = 0;
-
-java_sql_Array::~java_sql_Array()
-{}
-
-jclass java_sql_Array::getMyClass() const
-{
- // the class must be fetched once, therefore its static
- if( !theClass )
- theClass = findMyClass("java/sql/Array");
-
- return theClass;
-}
-
-::rtl::OUString SAL_CALL java_sql_Array::getBaseTypeName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- static jmethodID mID(NULL);
- return callStringMethod("getBaseTypeName",mID);
-}
-
-sal_Int32 SAL_CALL java_sql_Array::getBaseType( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- static jmethodID mID(NULL);
- return callIntMethod("getBaseType",mID);
-}
-
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL java_sql_Array::getArray( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
- jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap);
- static const char * cSignature = "(Ljava/util/Map;)[Ljava/lang/Object;";
- static const char * cMethodName = "getArray";
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- // submit Java-Call
- (jobjectArray)t.pEnv->CallObjectMethod( object, mID, obj);
- ThrowSQLException(t.pEnv,*this);
- // and clean up
- t.pEnv->DeleteLocalRef(obj);
- } //t.pEnv
- return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >();
-}
-
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL java_sql_Array::getArrayAtIndex( sal_Int32 index, sal_Int32 count, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
- jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap);
- static const char * cSignature = "(IILjava/util/Map;)[Ljava/lang/Object;";
- static const char * cMethodName = "getArray";
- // submit Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- (jobjectArray)t.pEnv->CallObjectMethod( object, mID, index,count,obj);
- ThrowSQLException(t.pEnv,*this);
- // and clean up
- t.pEnv->DeleteLocalRef(obj);
- }
- return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >();
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Array::getResultSet( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
- // convert Parameter
- jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap);
- // initialize temporary variable
- static const char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;";
- static const char * cMethodName = "getResultSet";
- // submit Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- t.pEnv->CallObjectMethod( object, mID, obj);
- ThrowSQLException(t.pEnv,*this);
- // and cleanup
- t.pEnv->DeleteLocalRef(obj);
- }
- return NULL;
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Array::getResultSetAtIndex( sal_Int32 index, sal_Int32 count, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
- // convert parameter
- jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap);
- // initialize temporary variable
- static const char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;";
- static const char * cMethodName = "getResultSetAtIndex";
- // Java-Call absetzen
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- t.pEnv->CallObjectMethod( object, mID, index,count,obj);
- ThrowSQLException(t.pEnv,*this);
- // and cleanup
- t.pEnv->DeleteLocalRef(obj);
- }
- return NULL;
-}
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/Blob.cxx b/connectivity/source/drivers/jdbc/Blob.cxx
deleted file mode 100644
index a0d9fd73a8..0000000000
--- a/connectivity/source/drivers/jdbc/Blob.cxx
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/sql/Blob.hxx"
-#include "java/tools.hxx"
-#include "java/io/InputStream.hxx"
-#include <connectivity/dbexception.hxx>
-
-#include <string.h>
-
-using namespace connectivity;
-//**************************************************************
-//************ Class: java.sql.Blob
-//**************************************************************
-
-jclass java_sql_Blob::theClass = 0;
-java_sql_Blob::java_sql_Blob( JNIEnv * pEnv, jobject myObj )
- : java_lang_Object( pEnv, myObj )
-{
- SDBThreadAttach::addRef();
-}
-java_sql_Blob::~java_sql_Blob()
-{
- SDBThreadAttach::releaseRef();
-}
-
-jclass java_sql_Blob::getMyClass() const
-{
- // the class must be fetched only once, therefore it's static
- if( !theClass )
- theClass = findMyClass("java/sql/Blob");
- return theClass;
-}
-
-sal_Int64 SAL_CALL java_sql_Blob::length( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- jlong out(0);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- // initialize temporary variable
- static const char * cSignature = "()J";
- static const char * cMethodName = "length";
- // submit Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- out = t.pEnv->CallLongMethod( object, mID );
- ThrowSQLException(t.pEnv,*this);
- } //t.pEnv
- return (sal_Int64)out;
-}
-::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL java_sql_Blob::getBytes( sal_Int64 pos, sal_Int32 count ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- ::com::sun::star::uno::Sequence< sal_Int8 > aSeq;
- {
- // initialize temporary variable
- static const char * cSignature = "(JI)[B";
- static const char * cMethodName = "getBytes";
- // submit Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- jbyteArray out = (jbyteArray)t.pEnv->CallObjectMethod( object, mID,pos,count);
- ThrowSQLException(t.pEnv,*this);
- if(out)
- {
- jboolean p = sal_False;
- aSeq.realloc(t.pEnv->GetArrayLength(out));
- memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength());
- t.pEnv->DeleteLocalRef(out);
- }
- } //t.pEnv
- // WARNING: the caller becomes the owner of the returned pointer
- return aSeq;
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_Blob::getBinaryStream( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- static jmethodID mID(NULL);
- jobject out = callObjectMethod(t.pEnv,"getBinaryStream","()Ljava/io/InputStream;", mID);
- // WARNING: the caller becomes the owner of the returned pointer
- return out==0 ? 0 : new java_io_InputStream( t.pEnv, out );
-}
-
-sal_Int64 SAL_CALL java_sql_Blob::position( const ::com::sun::star::uno::Sequence< sal_Int8 >& pattern, sal_Int64 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- jlong out(0);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- // initialize temporary variable
- static const char * cSignature = "([BI)J";
- static const char * cMethodName = "position";
- // submit Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- // convert Parameter
- jbyteArray pByteArray = t.pEnv->NewByteArray(pattern.getLength());
- t.pEnv->SetByteArrayRegion(pByteArray,0,pattern.getLength(),(jbyte*)pattern.getConstArray());
- out = t.pEnv->CallLongMethod( object, mID, pByteArray,start );
- t.pEnv->DeleteLocalRef(pByteArray);
- ThrowSQLException(t.pEnv,*this);
- } //t.pEnv
- return (sal_Int64)out;
-}
-
-sal_Int64 SAL_CALL java_sql_Blob::positionOfBlob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& /*pattern*/, sal_Int64 /*start*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XBlob::positionOfBlob", *this );
- // this was put here in CWS warnings01. The previous implementation was defective, as it did ignore
- // the pattern parameter. Since the effort for proper implementation is rather high - we would need
- // to translated patter into a byte[] -, we defer this functionality for the moment (hey, it was
- // unusable, anyway)
- // #i57457#
- return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/Boolean.cxx b/connectivity/source/drivers/jdbc/Boolean.cxx
deleted file mode 100644
index cc41160b28..0000000000
--- a/connectivity/source/drivers/jdbc/Boolean.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/lang/Boolean.hxx"
-using namespace connectivity;
-//**************************************************************
-//************ Class: java.lang.Boolean
-//**************************************************************
-
-jclass java_lang_Boolean::theClass = 0;
-
-java_lang_Boolean::~java_lang_Boolean()
-{}
-jclass java_lang_Boolean::st_getMyClass()
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/lang/Boolean");
- return theClass;
-}
-
-jclass java_lang_Boolean::getMyClass() const
-{
- return st_getMyClass();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/CallableStatement.cxx b/connectivity/source/drivers/jdbc/CallableStatement.cxx
deleted file mode 100644
index 910b64347d..0000000000
--- a/connectivity/source/drivers/jdbc/CallableStatement.cxx
+++ /dev/null
@@ -1,360 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/sql/CallableStatement.hxx"
-#include "java/tools.hxx"
-#include "java/sql/Array.hxx"
-#include "java/sql/Clob.hxx"
-#include "java/sql/Blob.hxx"
-#include "java/sql/Connection.hxx"
-#include "java/sql/Ref.hxx"
-#include "java/sql/Timestamp.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-
-#include <string.h>
-
-using namespace connectivity;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-
-
-IMPLEMENT_SERVICE_INFO(java_sql_CallableStatement,"com.sun.star.sdbcx.ACallableStatement","com.sun.star.sdbc.CallableStatement");
-
-//**************************************************************
-//************ Class: java.sql.CallableStatement
-//**************************************************************
-java_sql_CallableStatement::java_sql_CallableStatement( JNIEnv * pEnv, java_sql_Connection& _rCon,const ::rtl::OUString& sql )
- : java_sql_PreparedStatement( pEnv, _rCon, sql )
-{
-}
-// -----------------------------------------------------------------------------
-java_sql_CallableStatement::~java_sql_CallableStatement()
-{
-}
-// -----------------------------------------------------------------------------
-
-Any SAL_CALL java_sql_CallableStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = java_sql_PreparedStatement::queryInterface(rType);
- return aRet.hasValue() ? aRet : ::cppu::queryInterface(rType,static_cast< starsdbc::XRow*>(this),static_cast< starsdbc::XOutParameters*>(this));
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL java_sql_CallableStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< starsdbc::XRow > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< starsdbc::XOutParameters > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),java_sql_PreparedStatement::getTypes());
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_CallableStatement::wasNull( ) throw(starsdbc::SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return callBooleanMethod( "wasNull", mID );
-}
-
-sal_Bool SAL_CALL java_sql_CallableStatement::getBoolean( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return callBooleanMethodWithIntArg( "getBoolean", mID,columnIndex );
-}
-sal_Int8 SAL_CALL java_sql_CallableStatement::getByte( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jbyte (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallByteMethod;
- return callMethodWithIntArg<jbyte>(pCallMethod,"getByte","(I)B",mID,columnIndex);
-}
-Sequence< sal_Int8 > SAL_CALL java_sql_CallableStatement::getBytes( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- Sequence< sal_Int8 > aSeq;
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jbyteArray out = (jbyteArray)callObjectMethodWithIntArg(t.pEnv,"getBytes","(I)[B", mID, columnIndex);
- if (out)
- {
- jboolean p = sal_False;
- aSeq.realloc(t.pEnv->GetArrayLength(out));
- memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength());
- t.pEnv->DeleteLocalRef(out);
- }
- return aSeq;
-}
-::com::sun::star::util::Date SAL_CALL java_sql_CallableStatement::getDate( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getDate","(I)Ljava/sql/Date;", mID, columnIndex);
- return out ? static_cast <com::sun::star::util::Date>(java_sql_Date( t.pEnv, out )) : ::com::sun::star::util::Date();
-}
-double SAL_CALL java_sql_CallableStatement::getDouble( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- double (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallDoubleMethod;
- return callMethodWithIntArg<double>(pCallMethod,"getDouble","(I)D",mID,columnIndex);
-}
-
-float SAL_CALL java_sql_CallableStatement::getFloat( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jfloat (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallFloatMethod;
- return callMethodWithIntArg<jfloat>(pCallMethod,"getFloat","(I)F",mID,columnIndex);
-}
-
-sal_Int32 SAL_CALL java_sql_CallableStatement::getInt( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- return callIntMethodWithIntArg("getInt",mID,columnIndex);
-}
-
-sal_Int64 SAL_CALL java_sql_CallableStatement::getLong( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jlong (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallLongMethod;
- return callMethodWithIntArg<jlong>(pCallMethod,"getLong","(I)J",mID,columnIndex);
-}
-
-Any SAL_CALL java_sql_CallableStatement::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(starsdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callObjectMethodWithIntArg(t.pEnv,"getObject","(I)Ljava/lang/Object;", mID, columnIndex);
- // WARNING: the caller becomes the owner of the returned pointer
- return Any();
-}
-
-sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jshort (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallShortMethod;
- return callMethodWithIntArg<jshort>(pCallMethod,"getShort","(I)S",mID,columnIndex);
-}
-
-::rtl::OUString SAL_CALL java_sql_CallableStatement::getString( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- return callStringMethodWithIntArg("getString",mID,columnIndex);
-}
-
- ::com::sun::star::util::Time SAL_CALL java_sql_CallableStatement::getTime( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getTime","(I)Ljava/sql/Time;", mID, columnIndex);
- // WARNING: the caller becomes the owner of the returned pointer
- return out ? static_cast <com::sun::star::util::Time> (java_sql_Time( t.pEnv, out )) : ::com::sun::star::util::Time();
-}
-
- ::com::sun::star::util::DateTime SAL_CALL java_sql_CallableStatement::getTimestamp( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getTimestamp","(I)Ljava/sql/Timestamp;", mID, columnIndex);
- // WARNING: the caller becomes the owner of the returned pointer
- return out ? static_cast <com::sun::star::util::DateTime> (java_sql_Timestamp( t.pEnv, out )) : ::com::sun::star::util::DateTime();
-}
-
-void SAL_CALL java_sql_CallableStatement::registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(starsdbc::SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- createStatement(t.pEnv);
-
- // initialize temporary variable
- static const char * cSignature = "(IILjava/lang/String;)V";
- static const char * cMethodName = "registerOutParameter";
- // execute Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- // Convert Parameter
- jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,typeName));
- t.pEnv->CallVoidMethod( object, mID, parameterIndex,sqlType,str.get());
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
-}
-void SAL_CALL java_sql_CallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- createStatement(t.pEnv);
- // initialize temporary variable
- static const char * cSignature = "(III)V";
- static const char * cMethodName = "registerOutParameter";
- // execute Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- t.pEnv->CallVoidMethod( object, mID, parameterIndex,sqlType,scale);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
-}
-
-jclass java_sql_CallableStatement::theClass = 0;
-
-jclass java_sql_CallableStatement::getMyClass() const
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/sql/CallableStatement");
- return theClass;
-}
-
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_CallableStatement::getBinaryStream( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- Reference< starsdbc::XBlob > xBlob = getBlob(columnIndex);
- return xBlob.is() ? xBlob->getBinaryStream() : Reference< ::com::sun::star::io::XInputStream >();
-}
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_CallableStatement::getCharacterStream( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- Reference< starsdbc::XClob > xClob = getClob(columnIndex);
- return xClob.is() ? xClob->getCharacterStream() : Reference< ::com::sun::star::io::XInputStream >();
-}
-
-Reference< starsdbc::XArray > SAL_CALL java_sql_CallableStatement::getArray( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getArray","(I)Ljava/sql/Array;", mID, columnIndex);
- // WARNING: the caller becomes the owner of the returned pointer
- return out==0 ? 0 : new java_sql_Array( t.pEnv, out );
-}
-
-Reference< starsdbc::XClob > SAL_CALL java_sql_CallableStatement::getClob( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getClob","(I)Ljava/sql/Clob;", mID, columnIndex);
- // WARNING: the caller becomes the owner of the returned pointer
- return out==0 ? 0 : new java_sql_Clob( t.pEnv, out );
-}
-Reference< starsdbc::XBlob > SAL_CALL java_sql_CallableStatement::getBlob( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getBlob","(I)Ljava/sql/Blob;", mID, columnIndex);
- // WARNING: the caller becomes the owner of the returned pointer
- return out==0 ? 0 : new java_sql_Blob( t.pEnv, out );
-}
-
-Reference< starsdbc::XRef > SAL_CALL java_sql_CallableStatement::getRef( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getRef","(I)Ljava/sql/Ref;", mID, columnIndex);
- // WARNING: the caller becomes the owner of the returned pointer
- return out==0 ? 0 : new java_sql_Ref( t.pEnv, out );
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL java_sql_CallableStatement::acquire() throw()
-{
- java_sql_PreparedStatement::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL java_sql_CallableStatement::release() throw()
-{
- java_sql_PreparedStatement::release();
-}
-// -----------------------------------------------------------------------------
-void java_sql_CallableStatement::createStatement(JNIEnv* /*_pEnv*/)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- if( t.pEnv && !object ){
- // initialize temporary variable
- static const char * cSignature = "(Ljava/lang/String;II)Ljava/sql/CallableStatement;";
- static const char * cMethodName = "prepareCall";
- // execute Java-Call
- jobject out = NULL;
- // convert Parameter
- jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,m_sSqlStatement));
-
- static jmethodID mID(NULL);
- if ( !mID )
- mID = t.pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature );
- if( mID ){
- out = t.pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID, str.get() ,m_nResultSetType,m_nResultSetConcurrency);
- } //mID
- else
- {
- static const char * cSignature2 = "(Ljava/lang/String;)Ljava/sql/CallableStatement;";
- static jmethodID mID2 = t.pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature2 );OSL_ENSURE(mID2,"Unknown method id!");
- if( mID2 ){
- out = t.pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID2, str.get() );
- } //mID
- }
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
-
- if ( out )
- object = t.pEnv->NewGlobalRef( out );
- } //t.pEnv
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/Class.cxx b/connectivity/source/drivers/jdbc/Class.cxx
deleted file mode 100644
index b122ad593d..0000000000
--- a/connectivity/source/drivers/jdbc/Class.cxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/lang/Class.hxx"
-#include "java/tools.hxx"
-#include <rtl/ustring.hxx>
-
-using namespace connectivity;
-//**************************************************************
-//************ Class: java.lang.Class
-//**************************************************************
-
-jclass java_lang_Class::theClass = 0;
-
-java_lang_Class::~java_lang_Class()
-{}
-
-jclass java_lang_Class::getMyClass() const
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/lang/Class");
- return theClass;
-}
-
-java_lang_Class * java_lang_Class::forName( const ::rtl::OUString& _par0 )
-{
- jobject out(NULL);
- SDBThreadAttach t;
-
- {
- ::rtl::OString sClassName = ::rtl::OUStringToOString(_par0, RTL_TEXTENCODING_JAVA_UTF8);
- sClassName = sClassName.replace('.','/');
- out = t.pEnv->FindClass(sClassName.getStr());
- ThrowSQLException(t.pEnv,0);
- } //t.pEnv
- // WARNING: the caller becomes the owner of the returned pointer
- return out==0 ? NULL : new java_lang_Class( t.pEnv, out );
-}
-
-jobject java_lang_Class::newInstanceObject()
-{
- SDBThreadAttach t;
- static jmethodID mID(NULL);
- return callObjectMethod(t.pEnv,"newInstance","()Ljava/lang/Object;", mID);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/Clob.cxx b/connectivity/source/drivers/jdbc/Clob.cxx
deleted file mode 100644
index 6cc5a4573f..0000000000
--- a/connectivity/source/drivers/jdbc/Clob.cxx
+++ /dev/null
@@ -1,148 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/sql/Clob.hxx"
-#include "java/tools.hxx"
-#include "java/io/Reader.hxx"
-#include <connectivity/dbexception.hxx>
-#include <rtl/logfile.hxx>
-
-using namespace connectivity;
-//**************************************************************
-//************ Class: java.sql.Clob
-//**************************************************************
-
-jclass java_sql_Clob::theClass = 0;
-
-java_sql_Clob::java_sql_Clob( JNIEnv * pEnv, jobject myObj )
- : java_lang_Object( pEnv, myObj )
-{
- SDBThreadAttach::addRef();
-}
-java_sql_Clob::~java_sql_Clob()
-{
- SDBThreadAttach::releaseRef();
-}
-
-jclass java_sql_Clob::getMyClass() const
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/sql/Clob");
- return theClass;
-}
-
-sal_Int64 SAL_CALL java_sql_Clob::length( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_Clob::length" );
- jlong out(0);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- // initialize temporary variable
- static const char * cSignature = "()J";
- static const char * cMethodName = "length";
- // execute Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- out = t.pEnv->CallLongMethod( object, mID );
- ThrowSQLException(t.pEnv,*this);
- } //t.pEnv
- return (sal_Int64)out;
-}
-
-::rtl::OUString SAL_CALL java_sql_Clob::getSubString( sal_Int64 pos, sal_Int32 subStringLength ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_Clob::getSubString" );
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- ::rtl::OUString aStr;
- {
- // initialize temporary variable
- static const char * cSignature = "(JI)Ljava/lang/String;";
- static const char * cMethodName = "getSubString";
- // execute Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID,pos,subStringLength);
- ThrowSQLException(t.pEnv,*this);
- aStr = JavaString2String(t.pEnv,out);
- } //t.pEnv
- // WARNING: the caller becomes the owner of the returned pointer
- return aStr;
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_Clob::getCharacterStream( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_Clob::getCharacterStream" );
- SDBThreadAttach t;
- static jmethodID mID(NULL);
- jobject out = callObjectMethod(t.pEnv,"getCharacterStream","()Ljava/io/Reader;", mID);
-
- // WARNING: the caller becomes the owner of the returned pointer
- return out==0 ? 0 : new java_io_Reader( t.pEnv, out );
-}
-
-sal_Int64 SAL_CALL java_sql_Clob::position( const ::rtl::OUString& searchstr, sal_Int32 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_Clob::position" );
- jlong out(0);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- jvalue args[1];
- // convert Parameter
- args[0].l = convertwchar_tToJavaString(t.pEnv,searchstr);
- // initialize temporary Variable
- static const char * cSignature = "(Ljava/lang/String;I)J";
- static const char * cMethodName = "position";
- // execute Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- out = t.pEnv->CallLongMethod( object, mID, args[0].l,start );
- ThrowSQLException(t.pEnv,*this);
- t.pEnv->DeleteLocalRef((jstring)args[0].l);
- } //t.pEnv
- return (sal_Int64)out;
-}
-
-sal_Int64 SAL_CALL java_sql_Clob::positionOfClob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& /*pattern*/, sal_Int64 /*start*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_Clob::positionOfClob" );
- ::dbtools::throwFeatureNotImplementedException( "XClob::positionOfClob", *this );
- // this was put here in CWS warnings01. The previous implementation was defective, as it did ignore
- // the pattern parameter. Since the effort for proper implementation is rather high - we would need
- // to translated patter into a byte[] -, we defer this functionality for the moment (hey, it was
- // unusable, anyway)
- // 2005-11-15 / #i57457# / frank.schoenheit@sun.com
- return 0;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/ConnectionLog.cxx b/connectivity/source/drivers/jdbc/ConnectionLog.cxx
deleted file mode 100644
index c50d4bdc9e..0000000000
--- a/connectivity/source/drivers/jdbc/ConnectionLog.cxx
+++ /dev/null
@@ -1,137 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "java/sql/ConnectionLog.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/util/Date.hpp>
-#include <com/sun/star/util/Time.hpp>
-#include <com/sun/star/util/DateTime.hpp>
-/** === end UNO includes === **/
-
-#include <stdio.h>
-
-//........................................................................
-namespace connectivity { namespace java { namespace sql {
-//........................................................................
-
- /** === begin UNO using === **/
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::XComponentContext;
- /** === end UNO using === **/
-
- //--------------------------------------------------------------------
- namespace
- {
- sal_Int32 lcl_getFreeID( ConnectionLog::ObjectType _eType )
- {
- static oslInterlockedCount s_nCounts[ ConnectionLog::ObjectTypeCount ] = { 0, 0 };
- return osl_incrementInterlockedCount( s_nCounts + _eType );
- }
- }
-
- //====================================================================
- //= ConnectionLog
- //====================================================================
- //--------------------------------------------------------------------
- ConnectionLog::ConnectionLog( const ::comphelper::ResourceBasedEventLogger& _rDriverLog )
- :ConnectionLog_Base( _rDriverLog )
- ,m_nObjectID( lcl_getFreeID( CONNECTION ) )
- {
- }
-
- //--------------------------------------------------------------------
- ConnectionLog::ConnectionLog( const ConnectionLog& _rSourceLog )
- :ConnectionLog_Base( _rSourceLog )
- ,m_nObjectID( _rSourceLog.m_nObjectID )
- {
- }
-
- //--------------------------------------------------------------------
- ConnectionLog::ConnectionLog( const ConnectionLog& _rSourceLog, ConnectionLog::ObjectType _eType )
- :ConnectionLog_Base( _rSourceLog )
- ,m_nObjectID( lcl_getFreeID( _eType ) )
- {
- }
-
-//........................................................................
-} } } // namespace connectivity::java::sql
-//........................................................................
-
-//........................................................................
-namespace comphelper { namespace log { namespace convert
-{
-//........................................................................
-
- /** === begin UNO using === **/
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::XComponentContext;
- using ::com::sun::star::util::Date;
- using ::com::sun::star::util::Time;
- using ::com::sun::star::util::DateTime;
- /** === end UNO using === **/
-
- //--------------------------------------------------------------------
- ::rtl::OUString convertLogArgToString( const Date& _rDate )
- {
- char buffer[ 30 ];
- const size_t buffer_size = sizeof( buffer );
- snprintf( buffer, buffer_size, "%04i-%02i-%02i",
- (int)_rDate.Year, (int)_rDate.Month, (int)_rDate.Day );
- return ::rtl::OUString::createFromAscii( buffer );
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString convertLogArgToString( const Time& _rTime )
- {
- char buffer[ 30 ];
- const size_t buffer_size = sizeof( buffer );
- snprintf( buffer, buffer_size, "%02i:%02i:%02i.%02i",
- (int)_rTime.Hours, (int)_rTime.Minutes, (int)_rTime.Seconds, (int)_rTime.HundredthSeconds );
- return ::rtl::OUString::createFromAscii( buffer );
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString convertLogArgToString( const DateTime& _rDateTime )
- {
- char buffer[ 30 ];
- const size_t buffer_size = sizeof( buffer );
- snprintf( buffer, buffer_size, "%04i-%02i-%02i %02i:%02i:%02i.%02i",
- (int)_rDateTime.Year, (int)_rDateTime.Month, (int)_rDateTime.Day,
- (int)_rDateTime.Hours, (int)_rDateTime.Minutes, (int)_rDateTime.Seconds, (int)_rDateTime.HundredthSeconds );
- return ::rtl::OUString::createFromAscii( buffer );
- }
-
-//........................................................................
-} } } // comphelper::log::convert
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/ContextClassLoader.cxx b/connectivity/source/drivers/jdbc/ContextClassLoader.cxx
deleted file mode 100644
index da1802f710..0000000000
--- a/connectivity/source/drivers/jdbc/ContextClassLoader.cxx
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "java/ContextClassLoader.hxx"
-#include "java/lang/Object.hxx"
-
-/** === begin UNO includes === **/
-/** === end UNO includes === **/
-
-//........................................................................
-namespace connectivity { namespace jdbc
-{
-//........................................................................
-
- /** === begin UNO using === **/
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::XInterface;
- /** === end UNO using === **/
-
- using ::connectivity::java_lang_Object;
-
- //====================================================================
- //= ContextClassLoaderScope
- //====================================================================
- //--------------------------------------------------------------------
- ContextClassLoaderScope::ContextClassLoaderScope( JNIEnv& environment, const GlobalRef< jobject >& newClassLoader,
- const ::comphelper::ResourceBasedEventLogger& _rLoggerForErrors, const Reference< XInterface >& _rxErrorContext )
- :m_environment( environment )
- ,m_currentThread( environment )
- ,m_oldContextClassLoader( environment )
- {
- if ( !newClassLoader.is() )
- return;
-
- do // artificial loop for easier flow control
- {
-
- LocalRef< jclass > threadClass( m_environment );
- threadClass.set( m_environment.FindClass( "java/lang/Thread" ) );
- if ( !threadClass.is() )
- break;
-
- jmethodID currentThreadMethod( m_environment.GetStaticMethodID(
- threadClass.get(), "currentThread", "()Ljava/lang/Thread;" ) );
- if ( currentThreadMethod == NULL )
- break;
-
- m_currentThread.set( m_environment.CallStaticObjectMethod( threadClass.get(), currentThreadMethod ) );
- if ( !m_currentThread.is() )
- break;
-
- jmethodID getContextClassLoaderMethod( m_environment.GetMethodID(
- threadClass.get(), "getContextClassLoader", "()Ljava/lang/ClassLoader;" ) );
- if ( getContextClassLoaderMethod == NULL )
- break;
- m_oldContextClassLoader.set( m_environment.CallObjectMethod( m_currentThread.get(), getContextClassLoaderMethod ) );
- LocalRef< jthrowable > throwable( m_environment, m_environment.ExceptionOccurred() );
- if ( throwable.is() )
- break;
-
- m_setContextClassLoaderMethod = m_environment.GetMethodID(
- threadClass.get(), "setContextClassLoader", "(Ljava/lang/ClassLoader;)V" );
- if ( m_setContextClassLoaderMethod == NULL )
- break;
-
- }
- while ( false );
-
- if ( !isActive() )
- {
- java_lang_Object::ThrowLoggedSQLException( _rLoggerForErrors, &environment, _rxErrorContext );
- return;
- }
-
- // set the new class loader
- m_environment.CallObjectMethod( m_currentThread.get(), m_setContextClassLoaderMethod, newClassLoader.get() );
- LocalRef< jthrowable > throwable( m_environment, m_environment.ExceptionOccurred() );
- if ( throwable.is() )
- {
- m_currentThread.reset();
- m_setContextClassLoaderMethod = NULL;
- java_lang_Object::ThrowLoggedSQLException( _rLoggerForErrors, &environment, _rxErrorContext );
- }
- }
-
- //--------------------------------------------------------------------
- void ContextClassLoaderScope::pop( bool clearExceptions )
- {
- if ( isActive() )
- {
- LocalRef< jobject > currentThread( m_currentThread.env(), m_currentThread.release() );
- jmethodID setContextClassLoaderMethod( m_setContextClassLoaderMethod );
- m_setContextClassLoaderMethod = NULL;
-
- m_environment.CallObjectMethod( currentThread.get(), setContextClassLoaderMethod, m_oldContextClassLoader.get() );
- if ( clearExceptions )
- {
- m_environment.ExceptionClear();
- }
- }
- }
-//........................................................................
-} } // namespace connectivity::jdbc
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
deleted file mode 100644
index 256c08fd36..0000000000
--- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
+++ /dev/null
@@ -1,1465 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <sal/macros.h>
-#include "java/sql/DatabaseMetaData.hxx"
-#include "java/sql/Connection.hxx"
-#include "java/sql/ResultSet.hxx"
-#include "java/tools.hxx"
-#include "java/lang/String.hxx"
-#include "connectivity/CommonTools.hxx"
-#include "FDatabaseMetaDataResultSet.hxx"
-#include <comphelper/types.hxx>
-#include "TPrivilegesResultSet.hxx"
-#include "diagnose_ex.h"
-#include "resource/jdbc_log.hrc"
-
-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;
-
-//**************************************************************
-//************ Class: java.sql.DatabaseMetaData
-//**************************************************************
-
-jclass java_sql_DatabaseMetaData::theClass = 0;
-
-java_sql_DatabaseMetaData::~java_sql_DatabaseMetaData()
-{
- SDBThreadAttach::releaseRef();
-}
-
-jclass java_sql_DatabaseMetaData::getMyClass() const
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/sql/DatabaseMetaData");
- return theClass;
-}
-// -----------------------------------------------------------------------------
-java_sql_DatabaseMetaData::java_sql_DatabaseMetaData( JNIEnv * pEnv, jobject myObj, java_sql_Connection& _rConnection )
- :ODatabaseMetaDataBase( &_rConnection,_rConnection.getConnectionInfo() )
- ,java_lang_Object( pEnv, myObj )
- ,m_pConnection( &_rConnection )
- ,m_aLogger( _rConnection.getLogger() )
-{
- SDBThreadAttach::addRef();
-}
-
-// -------------------------------------------------------------------------
-Reference< XResultSet > java_sql_DatabaseMetaData::impl_getTypeInfo_throw( )
-{
- static jmethodID mID(NULL);
- return impl_callResultSetMethod( "getTypeInfo", mID );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callResultSetMethod( "getCatalogs", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString java_sql_DatabaseMetaData::impl_getCatalogSeparator_throw( )
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getCatalogSeparator", mID );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callResultSetMethod( "getSchemas", mID );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getColumnPrivileges(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callResultSetMethodWithStrings( "getColumnPrivileges", mID, catalog, schema, table, &columnNamePattern );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getColumns(
- const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callResultSetMethodWithStrings( "getColumns", mID, catalog, schemaPattern, tableNamePattern, &columnNamePattern );
-}
-
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
- const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& _types ) throw(SQLException, RuntimeException)
-{
- static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/ResultSet;";
- static const char * cMethodName = "getTables";
-
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, cMethodName );
-
- jobject out(0);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- // execute Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- OSL_VERIFY_RES( !isExceptionOccurred(t.pEnv,sal_True),"Exception occurred!");
- jvalue args[4];
-
- args[3].l = 0;
- sal_Int32 typeFilterCount = _types.getLength();
- if ( typeFilterCount )
- {
- jobjectArray pObjArray = static_cast< jobjectArray >( t.pEnv->NewObjectArray( (jsize)typeFilterCount, java_lang_String::st_getMyClass(), 0 ) );
- OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, sal_True ), "Exception occurred!" );
- const ::rtl::OUString* typeFilter = _types.getConstArray();
- bool bIncludeAllTypes = false;
- for ( sal_Int32 i=0; i<typeFilterCount; ++i, ++typeFilter )
- {
- if ( typeFilter->equalsAsciiL( "%", 1 ) )
- {
- bIncludeAllTypes = true;
- break;
- }
- jstring aT = convertwchar_tToJavaString( t.pEnv, *typeFilter );
- t.pEnv->SetObjectArrayElement( pObjArray, (jsize)i, aT );
- OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, sal_True ), "Exception occurred!" );
- }
-
- if ( bIncludeAllTypes )
- {
- // the SDBC API allows to pass "%" as table type filter, but in JDBC, "all table types"
- // is represented by the table type being <null/>
- t.pEnv->DeleteLocalRef( pObjArray );
- OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, sal_True ), "Exception occurred!" );
- }
- else
- {
- args[3].l = pObjArray;
- }
- }
- // if we are to display "all catalogs", then respect m_aCatalogRestriction
- Any aCatalogFilter( catalog );
- if ( !aCatalogFilter.hasValue() )
- aCatalogFilter = m_pConnection->getCatalogRestriction();
- // similar for schema
- Any aSchemaFilter;
- if ( schemaPattern.equalsAsciiL( "%", 1 ) )
- aSchemaFilter = m_pConnection->getSchemaRestriction();
- else
- aSchemaFilter <<= schemaPattern;
-
- args[0].l = aCatalogFilter.hasValue() ? convertwchar_tToJavaString( t.pEnv, ::comphelper::getString( aCatalogFilter ) ) : NULL;
- args[1].l = aSchemaFilter.hasValue() ? convertwchar_tToJavaString( t.pEnv, ::comphelper::getString( aSchemaFilter ) ) : NULL;
- args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern);
- out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l);
- jthrowable jThrow = t.pEnv->ExceptionOccurred();
- if ( jThrow )
- t.pEnv->ExceptionClear();// we have to clear the exception here because we want to handle it below
- if ( aCatalogFilter.hasValue() )
- {
- t.pEnv->DeleteLocalRef((jstring)args[0].l);
- OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, sal_True ), "Exception occurred!" );
- }
- if(args[1].l)
- {
- t.pEnv->DeleteLocalRef((jstring)args[1].l);
- OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, sal_True ), "Exception occurred!" );
- }
- if(tableNamePattern.getLength())
- {
- t.pEnv->DeleteLocalRef((jstring)args[2].l);
- OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, sal_True ), "Exception occurred!" );
- }
- //for(INT16 i=0;i<len;i++)
- if ( args[3].l )
- {
- t.pEnv->DeleteLocalRef( (jobjectArray)args[3].l );
- OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, sal_True ), "Exception occurred!" );
- }
-
- if ( jThrow )
- {
- if ( t.pEnv->IsInstanceOf( jThrow,java_sql_SQLException_BASE::st_getMyClass() ) )
- {
- java_sql_SQLException_BASE* pException = new java_sql_SQLException_BASE( t.pEnv, jThrow );
- SQLException e( pException->getMessage(),
- *this,
- pException->getSQLState(),
- pException->getErrorCode(),
- Any()
- );
- delete pException;
- throw e;
- }
- }
- }
-
- if ( !out )
- return NULL;
-
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_SUCCESS, cMethodName );
- return new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection);
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getProcedureColumns(
- const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callResultSetMethodWithStrings( "getProcedureColumns", mID, catalog, schemaPattern, procedureNamePattern, &columnNamePattern );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getProcedures( const Any&
- catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callResultSetMethodWithStrings( "getProcedures", mID, catalog, schemaPattern, procedureNamePattern );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getVersionColumns(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callResultSetMethodWithStrings( "getVersionColumns", mID, catalog, schema, table );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxBinaryLiteralLength", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxRowSize", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxCatalogNameLength", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxCharLiteralLength", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxColumnNameLength", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxColumnsInIndex", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxCursorNameLength", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxConnections", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxColumnsInTable", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxStatementLength", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxTableNameLength", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 java_sql_DatabaseMetaData::impl_getMaxTablesInSelect_throw( )
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxTablesInSelect", mID );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getExportedKeys(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callResultSetMethodWithStrings( "getExportedKeys", mID, catalog, schema, table );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getImportedKeys(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callResultSetMethodWithStrings( "getImportedKeys", mID, catalog, schema, table );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getPrimaryKeys(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callResultSetMethodWithStrings( "getPrimaryKeys", mID, catalog, schema, table );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getIndexInfo(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
- sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException)
-{
- static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ)Ljava/sql/ResultSet;";
- static const char * cMethodName = "getIndexInfo";
-
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, cMethodName );
-
- jobject out(0);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- // execute Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- jvalue args[5];
- // convert Parameter
- args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
- args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
- args[2].l = convertwchar_tToJavaString(t.pEnv,table);
- args[3].z = unique;
- args[4].z = approximate;
- out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,args[3].z,args[4].z );
-
- // and clean up
- if(catalog.hasValue())
- t.pEnv->DeleteLocalRef((jstring)args[0].l);
- if(args[1].l)
- t.pEnv->DeleteLocalRef((jstring)args[1].l);
- if(table.getLength())
- t.pEnv->DeleteLocalRef((jstring)args[2].l);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
- if ( !out )
- return NULL;
-
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_SUCCESS, cMethodName );
- return new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection);
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getBestRowIdentifier(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope,
- sal_Bool nullable ) throw(SQLException, RuntimeException)
-{
- static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZ)Ljava/sql/ResultSet;";
- static const char * cMethodName = "getBestRowIdentifier";
-
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, cMethodName );
-
- jobject out(0);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- // execute Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- jvalue args[3];
- // convert Parameter
- args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
- args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
- args[2].l = convertwchar_tToJavaString(t.pEnv,table);
- out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,scope,nullable);
-
- // and cleanup
- if(catalog.hasValue())
- t.pEnv->DeleteLocalRef((jstring)args[0].l);
- if(args[1].l)
- t.pEnv->DeleteLocalRef((jstring)args[1].l);
- if(table.getLength())
- t.pEnv->DeleteLocalRef((jstring)args[2].l);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
-
- if ( !out )
- return NULL;
-
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_SUCCESS, cMethodName );
- return new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection);
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges(
- const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException)
-{
- if ( m_pConnection->isIgnoreDriverPrivilegesEnabled() )
- return new OResultSetPrivileges(this,catalog,schemaPattern,tableNamePattern);
-
- static jmethodID mID(NULL);
- Reference< XResultSet > xReturn( impl_callResultSetMethodWithStrings( "getTablePrivileges", mID, catalog, schemaPattern, tableNamePattern ) );
-
- if ( xReturn.is() )
- {
- // we have to check the result columns for the tables privleges
- Reference< XResultSetMetaDataSupplier > xMetaSup(xReturn,UNO_QUERY);
- if ( xMetaSup.is() )
- {
- Reference< XResultSetMetaData> xMeta = xMetaSup->getMetaData();
- if ( xMeta.is() && xMeta->getColumnCount() != 7 )
- {
- // here we know that the count of column doesn't match
- ::std::map<sal_Int32,sal_Int32> aColumnMatching;
- static const ::rtl::OUString sPrivs[] = {
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE_CAT")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE_SCHEM")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE_NAME")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GRANTOR")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GRANTEE")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PRIVILEGE")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IS_GRANTABLE"))
- };
-
- ::rtl::OUString sColumnName;
- sal_Int32 nCount = xMeta->getColumnCount();
- for (sal_Int32 i = 1 ; i <= nCount ; ++i)
- {
- sColumnName = xMeta->getColumnName(i);
- for (sal_uInt32 j = 0 ; j < SAL_N_ELEMENTS(sPrivs); ++j)
- {
- if ( sPrivs[j] == sColumnName )
- {
- aColumnMatching.insert( ::std::map<sal_Int32,sal_Int32>::value_type(i,j+1) );
- break;
- }
- }
-
- }
- // fill our own resultset
- ODatabaseMetaDataResultSet* pNewPrivRes = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
- Reference< XResultSet > xTemp = xReturn;
- xReturn = pNewPrivRes;
- ODatabaseMetaDataResultSet::ORows aRows;
- Reference< XRow > xRow(xTemp,UNO_QUERY);
- ::rtl::OUString sValue;
-
- ODatabaseMetaDataResultSet::ORow aRow(8);
- while ( xRow.is() && xTemp->next() )
- {
- ::std::map<sal_Int32,sal_Int32>::iterator aIter = aColumnMatching.begin();
- ::std::map<sal_Int32,sal_Int32>::iterator aEnd = aColumnMatching.end();
- for (;aIter != aEnd ; ++aIter)
- {
- sValue = xRow->getString(aIter->first);
- if ( xRow->wasNull() )
- aRow[aIter->second] = ODatabaseMetaDataResultSet::getEmptyValue();
- else
- aRow[aIter->second] = new ORowSetValueDecorator(sValue);
- }
-
- aRows.push_back(aRow);
- }
- pNewPrivRes->setRows(aRows);
- }
- }
- }
- return xReturn;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCrossReference(
- const Any& primaryCatalog, const ::rtl::OUString& primarySchema,
- const ::rtl::OUString& primaryTable, const Any& foreignCatalog,
- const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException)
-{
- static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;";
- static const char * cMethodName = "getCrossReference";
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, cMethodName );
-
- jobject out(0);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
-
- // execute Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- jvalue args[6];
- // convert Parameter
- args[0].l = primaryCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(primaryCatalog)) : 0;
- args[1].l = primarySchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,primarySchema);
- args[2].l = convertwchar_tToJavaString(t.pEnv,primaryTable);
- args[3].l = foreignCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(foreignCatalog)) : 0;
- args[4].l = foreignSchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,foreignSchema);
- args[5].l = convertwchar_tToJavaString(t.pEnv,foreignTable);
- out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[2].l,args[2].l,args[3].l,args[4].l,args[5].l );
-
- // and clean up
- if(primaryCatalog.hasValue())
- t.pEnv->DeleteLocalRef((jstring)args[0].l);
- if(args[1].l)
- t.pEnv->DeleteLocalRef((jstring)args[1].l);
- if(primaryTable.getLength())
- t.pEnv->DeleteLocalRef((jstring)args[2].l);
- if(foreignCatalog.hasValue())
- t.pEnv->DeleteLocalRef((jstring)args[3].l);
- if(args[4].l)
- t.pEnv->DeleteLocalRef((jstring)args[4].l);
- if(foreignTable.getLength())
- t.pEnv->DeleteLocalRef((jstring)args[5].l);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
-
- if ( !out )
- return NULL;
-
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_SUCCESS, cMethodName );
- return new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection);
-}
-
-// -------------------------------------------------------------------------
-sal_Bool java_sql_DatabaseMetaData::impl_callBooleanMethod( const char* _pMethodName, jmethodID& _inout_MethodID )
-{
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName );
- jboolean out( java_lang_Object::callBooleanMethod(_pMethodName,_inout_MethodID) );
- m_aLogger.log< const sal_Char*, sal_Int16>( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, _pMethodName, out );
- return out;
-}
-
-// -------------------------------------------------------------------------
-::rtl::OUString java_sql_DatabaseMetaData::impl_callStringMethod( const char* _pMethodName, jmethodID& _inout_MethodID )
-{
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName );
-
- const ::rtl::OUString sReturn( callStringMethod(_pMethodName,_inout_MethodID) );
- if ( m_aLogger.isLoggable( LogLevel::FINEST ) )
- {
- ::rtl::OUString sLoggedResult( sReturn );
- if ( !sLoggedResult.getLength() )
- sLoggedResult = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "<empty string>" ) );
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, _pMethodName, sLoggedResult );
- }
-
- return sReturn;
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 java_sql_DatabaseMetaData::impl_callIntMethod( const char* _pMethodName, jmethodID& _inout_MethodID )
-{
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName );
- sal_Int32 out( (sal_Int32)callIntMethod(_pMethodName,_inout_MethodID) );
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, _pMethodName, (sal_Int32)out );
- return out;
-}
-
-// -------------------------------------------------------------------------
-sal_Bool java_sql_DatabaseMetaData::impl_callBooleanMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument )
-{
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG1, _pMethodName, _nArgument );
-
- jboolean out( callBooleanMethodWithIntArg(_pMethodName,_inout_MethodID,_nArgument) );
-
- m_aLogger.log< const sal_Char*, sal_Int16 >( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, _pMethodName, out );
- return out;
-}
-
-// -------------------------------------------------------------------------
-Reference< XResultSet > java_sql_DatabaseMetaData::impl_callResultSetMethod( const char* _pMethodName, jmethodID& _inout_MethodID )
-{
- SDBThreadAttach t;
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName );
- jobject out(callResultSetMethod(t.env(),_pMethodName,_inout_MethodID));
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_SUCCESS, _pMethodName );
- return new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection);
-}
-
-// -------------------------------------------------------------------------
-Reference< XResultSet > java_sql_DatabaseMetaData::impl_callResultSetMethodWithStrings( const char* _pMethodName, jmethodID& _inout_MethodID,
- const Any& _rCatalog, const ::rtl::OUString& _rSchemaPattern, const ::rtl::OUString& _rLeastPattern,
- const ::rtl::OUString* _pOptionalAdditionalString )
-{
- bool bCatalog = _rCatalog.hasValue();
- ::rtl::OUString sCatalog;
- _rCatalog >>= sCatalog;
-
- bool bSchema = _rSchemaPattern.toChar() != '%';
-
- // log the call
- if ( m_aLogger.isLoggable( LogLevel::FINEST ) )
- {
- ::rtl::OUString sCatalogLog = bCatalog ? sCatalog : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "null" ) );
- ::rtl::OUString sSchemaLog = bSchema ? _rSchemaPattern : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "null" ) );
- if ( _pOptionalAdditionalString )
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG4, _pMethodName, sCatalogLog, sSchemaLog, _rLeastPattern, *_pOptionalAdditionalString );
- else
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG3, _pMethodName, sCatalogLog, sSchemaLog, _rLeastPattern );
- }
-
- jobject out(0);
-
- SDBThreadAttach t;
- OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callResultSetMethodWithStrings: no Java enviroment anymore!" );
-
- {
- const char* pSignature = _pOptionalAdditionalString
- ? "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"
- : "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;";
- // obtain method ID
- obtainMethodId(t.pEnv, _pMethodName,pSignature, _inout_MethodID);
-
- // call method
-
- {
- jvalue args[4];
- // convert parameters
- args[0].l = bCatalog ? convertwchar_tToJavaString( t.pEnv, sCatalog ) : NULL;
- args[1].l = bSchema ? convertwchar_tToJavaString( t.pEnv, _rSchemaPattern ) : NULL;
- args[2].l = convertwchar_tToJavaString( t.pEnv, _rLeastPattern );
- args[3].l = _pOptionalAdditionalString ? convertwchar_tToJavaString( t.pEnv, *_pOptionalAdditionalString ) : NULL;
-
- // actually do the call
- if ( _pOptionalAdditionalString )
- out = t.pEnv->CallObjectMethod( object, _inout_MethodID, args[0].l, args[1].l, args[2].l, args[3].l );
- else
- out = t.pEnv->CallObjectMethod( object, _inout_MethodID, args[0].l, args[1].l, args[2].l );
-
- // clean up
- if ( args[0].l )
- t.pEnv->DeleteLocalRef( (jstring)args[0].l );
- if ( args[1].l )
- t.pEnv->DeleteLocalRef( (jstring)args[1].l );
- if ( args[2].l )
- t.pEnv->DeleteLocalRef( (jstring)args[2].l );
- if ( args[3].l )
- t.pEnv->DeleteLocalRef( (jstring)args[3].l );
-
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
- }
-
- if ( !out )
- return NULL;
-
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_SUCCESS, _pMethodName );
- return new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection);
-}
-
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "doesMaxRowSizeIncludeBlobs", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "storesLowerCaseQuotedIdentifiers", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "storesLowerCaseIdentifiers", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool java_sql_DatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "storesMixedCaseQuotedIdentifiers", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "storesMixedCaseIdentifiers", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "storesUpperCaseQuotedIdentifiers", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "storesUpperCaseIdentifiers", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool java_sql_DatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsAlterTableWithAddColumn", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool java_sql_DatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsAlterTableWithDropColumn", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxIndexLength", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsNonNullableColumns", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getCatalogTerm", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString java_sql_DatabaseMetaData::impl_getIdentifierQuoteString_throw( )
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getIdentifierQuoteString", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getExtraNameCharacters", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsDifferentTableCorrelationNames", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool java_sql_DatabaseMetaData::impl_isCatalogAtStart_throw( )
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "isCatalogAtStart", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "dataDefinitionIgnoredInTransactions", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "dataDefinitionCausesTransactionCommit", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsDataManipulationTransactionsOnly", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsDataDefinitionAndDataManipulationTransactions", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsPositionedDelete", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsPositionedUpdate", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsOpenStatementsAcrossRollback", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsOpenStatementsAcrossCommit", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsOpenCursorsAcrossCommit", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsOpenCursorsAcrossRollback", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethodWithIntArg( "supportsTransactionIsolationLevel", mID, level );
-}
-// -------------------------------------------------------------------------
-sal_Bool java_sql_DatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsSchemasInDataManipulation", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsANSI92FullSQL", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsANSI92EntryLevelSQL", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsIntegrityEnhancementFacility", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsSchemasInIndexDefinitions", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool java_sql_DatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsSchemasInTableDefinitions", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool java_sql_DatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsCatalogsInTableDefinitions", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsCatalogsInIndexDefinitions", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool java_sql_DatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsCatalogsInDataManipulation", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsOuterJoins", mID );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callResultSetMethod( "getTableTypes", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 java_sql_DatabaseMetaData::impl_getMaxStatements_throw( )
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxStatements", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxProcedureNameLength", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxSchemaNameLength", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsTransactions", mID );
-}
-
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "allProceduresAreCallable", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsStoredProcedures", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsSelectForUpdate", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "allTablesAreSelectable", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "isReadOnly", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "usesLocalFiles", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "usesLocalFilePerTable", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsTypeConversion", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "nullPlusNonNullIsNull", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsColumnAliasing", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsTableCorrelationNames", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(SQLException, RuntimeException)
-{
- static const char* pMethodName = "supportsConvert";
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG2, pMethodName, fromType, toType );
-
- jboolean out( sal_False );
- SDBThreadAttach t;
-
- {
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, pMethodName,"(II)Z", mID);
- out = t.pEnv->CallBooleanMethod( object, mID, fromType, toType );
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
-
- m_aLogger.log< const sal_Char*, sal_Int16 >( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, pMethodName, out );
- return out;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsExpressionsInOrderBy", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsGroupBy", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsGroupByBeyondSelect", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsGroupByUnrelated", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsMultipleTransactions", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsMultipleResultSets", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsLikeEscapeClause", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsOrderByUnrelated", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsUnion", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsUnionAll", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsMixedCaseIdentifiers", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool java_sql_DatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsMixedCaseQuotedIdentifiers", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "nullsAreSortedAtEnd", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "nullsAreSortedAtStart", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "nullsAreSortedHigh", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "nullsAreSortedLow", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsSchemasInProcedureCalls", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsSchemasInPrivilegeDefinitions", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsCatalogsInProcedureCalls", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsCatalogsInPrivilegeDefinitions", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsCorrelatedSubqueries", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsSubqueriesInComparisons", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsSubqueriesInExists", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsSubqueriesInIns", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsSubqueriesInQuantifieds", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsANSI92IntermediateSQL", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString sURL = m_pConnection->getURL();
- if ( !sURL.getLength() )
- {
- static jmethodID mID(NULL);
- sURL = impl_callStringMethod( "getURL", mID );
- }
- return sURL;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getUserName", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getDriverName", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getDriverVersion", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getDatabaseProductVersion", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getDatabaseProductName", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getProcedureTerm", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getSchemaTerm", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getDriverMajorVersion", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getDefaultTransactionIsolation", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getDriverMinorVersion", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getSQLKeywords", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getSearchStringEscape", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getStringFunctions", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getTimeDateFunctions", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getSystemFunctions", mID );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callStringMethod( "getNumericFunctions", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsExtendedSQLGrammar", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsCoreSQLGrammar", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsMinimumSQLGrammar", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsFullOuterJoins", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsLimitedOuterJoins", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxColumnsInGroupBy", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxColumnsInOrderBy", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxColumnsInSelect", mID );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callIntMethod( "getMaxUserNameLength", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethodWithIntArg( "supportsResultSetType", mID, setType );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException)
-{
- static const char* pMethodName = "supportsResultSetConcurrency";
- m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG2, pMethodName, setType, concurrency );
-
- jboolean out( sal_False );
- SDBThreadAttach t;
-
- {
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, pMethodName,"(II)Z", mID);
- out = t.pEnv->CallBooleanMethod( object, mID, setType, concurrency);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
-
- m_aLogger.log< const sal_Char*, sal_Int16 >( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, pMethodName, out );
- return out;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethodWithIntArg( "ownUpdatesAreVisible", mID, setType );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethodWithIntArg( "ownDeletesAreVisible", mID, setType );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethodWithIntArg( "ownInsertsAreVisible", mID, setType );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethodWithIntArg( "othersUpdatesAreVisible", mID, setType );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethodWithIntArg( "othersDeletesAreVisible", mID, setType );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethodWithIntArg( "othersInsertsAreVisible", mID, setType );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethodWithIntArg( "updatesAreDetected", mID, setType );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethodWithIntArg( "deletesAreDetected", mID, setType );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethodWithIntArg( "insertsAreDetected", mID, setType );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_callBooleanMethod( "supportsBatchUpdates", mID );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getUDTs(
- const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern,
- const Sequence< sal_Int32 >& types ) throw(SQLException, RuntimeException)
-{
- jobject out(0);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
-
-
- static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[I)Ljava/sql/ResultSet;";
- static const char * cMethodName = "getUDTs";
- // dismiss Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- {
- jvalue args[4];
- // initialize temporary Variable
- args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
- args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern);
- args[2].l = convertwchar_tToJavaString(t.pEnv,typeNamePattern);
- jintArray pArray = t.pEnv->NewIntArray(types.getLength());
- t.pEnv->SetIntArrayRegion(pArray,0,types.getLength(),(jint*)types.getConstArray());
- args[3].l = pArray;
-
- out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l);
-
- if(catalog.hasValue())
- t.pEnv->DeleteLocalRef((jstring)args[0].l);
- if(schemaPattern.getLength())
- t.pEnv->DeleteLocalRef((jstring)args[1].l);
- if(typeNamePattern.getLength())
- t.pEnv->DeleteLocalRef((jstring)args[2].l);
- if(args[3].l)
- t.pEnv->DeleteLocalRef((jintArray)args[3].l);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
- }
-
- return out ? new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection ) : 0;
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/Date.cxx b/connectivity/source/drivers/jdbc/Date.cxx
deleted file mode 100644
index a2c05a67bf..0000000000
--- a/connectivity/source/drivers/jdbc/Date.cxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/util/Date.hxx"
-#include "java/tools.hxx"
-#include "connectivity/dbconversion.hxx"
-using namespace connectivity;
-//**************************************************************
-//************ Class: java.util.Date
-//**************************************************************
-
-jclass java_util_Date::theClass = 0;
-
-java_util_Date::~java_util_Date()
-{}
-
-jclass java_util_Date::getMyClass() const
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/util/Date");
- return theClass;
-}
-
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx b/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx
deleted file mode 100644
index f64e9cc4f7..0000000000
--- a/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx
+++ /dev/null
@@ -1,143 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/sql/DriverPropertyInfo.hxx"
-#include "java/lang/Boolean.hxx"
-#include "java/tools.hxx"
-#include "java/lang/String.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;
-
-
-//**************************************************************
-//************ Class: java.sql.Driver
-//**************************************************************
-
-jclass java_sql_DriverPropertyInfo::theClass = 0;
-// --------------------------------------------------------------------------------
-java_sql_DriverPropertyInfo::~java_sql_DriverPropertyInfo()
-{}
-// --------------------------------------------------------------------------------
-jclass java_sql_DriverPropertyInfo::getMyClass() const
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/sql/DriverPropertyInfo");
- return theClass;
-}
-
-// --------------------------------------------------------------------------------
-java_sql_DriverPropertyInfo::operator starsdbc::DriverPropertyInfo()
-{
- starsdbc::DriverPropertyInfo aInfo;
- aInfo.Name = name();
- aInfo.Description = description();
- aInfo.IsRequired = required();
- aInfo.Value = value();
- aInfo.Choices = choices();
-
- return aInfo;
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString java_sql_DriverPropertyInfo::name()
-{
- ::rtl::OUString aStr;
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- jfieldID id = t.pEnv->GetFieldID(getMyClass(),"name","Ljava/lang/String;");
- if(id)
- aStr = JavaString2String(t.pEnv,(jstring)t.pEnv->GetObjectField( object, id));
- } //t.pEnv
- return aStr;
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString java_sql_DriverPropertyInfo::description()
-{
- ::rtl::OUString aStr;
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- jfieldID id = t.pEnv->GetFieldID(getMyClass(),"description","Ljava/lang/String;");
- if(id)
- aStr = JavaString2String(t.pEnv,(jstring)t.pEnv->GetObjectField( object, id));
- } //t.pEnv
- return aStr;
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString java_sql_DriverPropertyInfo::value()
-{
- ::rtl::OUString aStr;
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- jfieldID id = t.pEnv->GetFieldID(getMyClass(),"value","Ljava/lang/String;");
- if(id)
- aStr = JavaString2String(t.pEnv,(jstring)t.pEnv->GetObjectField( object, id));
- } //t.pEnv
- return aStr;
-}
-// --------------------------------------------------------------------------------
-sal_Bool java_sql_DriverPropertyInfo::required()
-{
- jboolean out(0);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- jfieldID id = t.pEnv->GetFieldID(getMyClass(),"required","Z");
- if(id)
- out = t.pEnv->GetBooleanField( object, id);
- } //t.pEnv
- return out;
-}
-// --------------------------------------------------------------------------------
-Sequence< ::rtl::OUString> java_sql_DriverPropertyInfo::choices()
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- jfieldID id = t.pEnv->GetFieldID(getMyClass(),"choices","[Ljava/lang/String;");
- if(id)
- {
- const java_lang_String * pEmpty = NULL;
- const ::rtl::OUString * pEmpty2 = NULL;
- return copyArrayAndDelete(t.pEnv,(jobjectArray)t.pEnv->GetObjectField( object, id), pEmpty2, pEmpty);
- }
- } //t.pEnv
- return Sequence< ::rtl::OUString>();
-}
-// --------------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/Exception.cxx b/connectivity/source/drivers/jdbc/Exception.cxx
deleted file mode 100644
index 09e0624d54..0000000000
--- a/connectivity/source/drivers/jdbc/Exception.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/lang/Exception.hxx"
-using namespace connectivity;
-//**************************************************************
-//************ Class: java.lang.Exception
-//**************************************************************
-
-jclass java_lang_Exception::theClass = 0;
-
-java_lang_Exception::~java_lang_Exception()
-{}
-
-jclass java_lang_Exception::getMyClass() const
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/lang/Exception");
- return theClass;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/InputStream.cxx b/connectivity/source/drivers/jdbc/InputStream.cxx
deleted file mode 100644
index 33e8acc3a4..0000000000
--- a/connectivity/source/drivers/jdbc/InputStream.cxx
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/io/InputStream.hxx"
-#include "java/tools.hxx"
-
-#include <string.h>
-
-using namespace connectivity;
-//**************************************************************
-//************ Class: java.io.InputStream
-//**************************************************************
-
-jclass java_io_InputStream::theClass = 0;
-java_io_InputStream::java_io_InputStream( JNIEnv * pEnv, jobject myObj )
- : java_lang_Object( pEnv, myObj )
-{
- SDBThreadAttach::addRef();
-}
-java_io_InputStream::~java_io_InputStream()
-{
- SDBThreadAttach::releaseRef();
-}
-
-jclass java_io_InputStream::getMyClass() const
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/io/InputStream");
- return theClass;
-}
-
-
-sal_Int32 SAL_CALL java_io_InputStream::readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- return readBytes(aData,nMaxBytesToRead);
-}
-
-void SAL_CALL java_io_InputStream::skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- static jmethodID mID(NULL);
- callIntMethodWithIntArg("skip",mID,nBytesToSkip);
-}
-
-sal_Int32 SAL_CALL java_io_InputStream::available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- static jmethodID mID(NULL);
- return callIntMethod("available",mID);
-}
-void SAL_CALL java_io_InputStream::closeInput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- static jmethodID mID(NULL);
- callVoidMethod("close",mID);
-}
-// -----------------------------------------------------
-sal_Int32 SAL_CALL java_io_InputStream::readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- if (nBytesToRead < 0)
- throw ::com::sun::star::io::BufferSizeExceededException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), *this );
-
- jint out(0);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- jbyteArray pByteArray = t.pEnv->NewByteArray(nBytesToRead);
- static const char * cSignature = "([BII)I";
- static const char * cMethodName = "read";
- // execute Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- out = t.pEnv->CallIntMethod( object, mID, pByteArray, 0, nBytesToRead );
- if ( !out )
- ThrowSQLException(t.pEnv,*this);
- if(out > 0)
- {
- jboolean p = sal_False;
- aData.realloc ( out );
- rtl_copyMemory(aData.getArray(),t.pEnv->GetByteArrayElements(pByteArray,&p),out);
- }
- t.pEnv->DeleteLocalRef((jbyteArray)pByteArray);
- } //t.pEnv
- return out;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/JBigDecimal.cxx b/connectivity/source/drivers/jdbc/JBigDecimal.cxx
deleted file mode 100644
index a724a07de1..0000000000
--- a/connectivity/source/drivers/jdbc/JBigDecimal.cxx
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/math/BigDecimal.hxx"
-#include "java/tools.hxx"
-#include "resource/jdbc_log.hrc"
-using namespace connectivity;
-//**************************************************************
-//************ Class: java.lang.Boolean
-//**************************************************************
-
-jclass java_math_BigDecimal::theClass = 0;
-
-java_math_BigDecimal::~java_math_BigDecimal()
-{}
-
-jclass java_math_BigDecimal::getMyClass() const
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/math/BigDecimal");
- return theClass;
-}
-
-java_math_BigDecimal::java_math_BigDecimal( const ::rtl::OUString& _par0 ): java_lang_Object( NULL, (jobject)NULL )
-{
- SDBThreadAttach t;
- if( !t.pEnv )
- return;
- // Java-Call for the Constructor
- // initialize temporary Variable
- static const char * cSignature = "(Ljava/lang/String;)V";
- jobject tempObj;
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, "<init>",cSignature, mID);
-
- jstring str = convertwchar_tToJavaString(t.pEnv,_par0.replace(',','.'));
- tempObj = t.pEnv->NewObject( getMyClass(), mID, str );
- t.pEnv->DeleteLocalRef(str);
- saveRef( t.pEnv, tempObj );
- t.pEnv->DeleteLocalRef( tempObj );
- ThrowSQLException( t.pEnv, NULL );
- // and cleanup
-}
-
-java_math_BigDecimal::java_math_BigDecimal( const double& _par0 ): java_lang_Object( NULL, (jobject)NULL )
-{
- SDBThreadAttach t;
- if( !t.pEnv )
- return;
- // Java-Call for the Constructor
- // initialize temporary Variable
- static const char * cSignature = "(D)V";
- jobject tempObj;
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, "<init>",cSignature, mID);
- tempObj = t.pEnv->NewObject( getMyClass(), mID, _par0 );
- saveRef( t.pEnv, tempObj );
- t.pEnv->DeleteLocalRef( tempObj );
- ThrowSQLException( t.pEnv, NULL );
- // and cleanup
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx
deleted file mode 100644
index 3b3648ef8c..0000000000
--- a/connectivity/source/drivers/jdbc/JConnection.cxx
+++ /dev/null
@@ -1,876 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "java/sql/Connection.hxx"
-#include "java/lang/Class.hxx"
-#include "java/tools.hxx"
-#include "java/ContextClassLoader.hxx"
-#include "java/sql/DatabaseMetaData.hxx"
-#include "java/sql/JStatement.hxx"
-#include "java/sql/Driver.hxx"
-#include "java/sql/PreparedStatement.hxx"
-#include "java/sql/CallableStatement.hxx"
-#include "java/sql/SQLWarning.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/SQLWarning.hpp>
-#include <com/sun/star/sdbc/SQLWarning.hpp>
-#include <com/sun/star/beans/NamedValue.hpp>
-#include "connectivity/sqlparse.hxx"
-#include "connectivity/dbexception.hxx"
-#include "java/util/Property.hxx"
-#include "java/LocalRef.hxx"
-#include "resource/jdbc_log.hrc"
-#include "com/sun/star/uno/XComponentContext.hpp"
-#include "jvmaccess/classpath.hxx"
-#include <comphelper/namedvaluecollection.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <jni.h>
-#include "resource/common_res.hrc"
-#include <unotools/confignode.hxx>
-
-#include <list>
-#include <memory>
-
-using namespace connectivity;
-using namespace connectivity::jdbc;
-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;
-
-namespace {
-
-struct ClassMapEntry {
- ClassMapEntry(
- rtl::OUString const & theClassPath, rtl::OUString const & theClassName):
- classPath(theClassPath), className(theClassName), classLoader(NULL),
- classObject(NULL) {}
-
- rtl::OUString classPath;
- rtl::OUString className;
- jweak classLoader;
- jweak classObject;
-};
-
-typedef std::list< ClassMapEntry > ClassMap;
-
-struct ClassMapData {
- osl::Mutex mutex;
-
- ClassMap map;
-};
-
-struct ClassMapDataInit {
- ClassMapData * operator()() {
- static ClassMapData instance;
- return &instance;
- }
-};
-
-template < typename T >
-bool getLocalFromWeakRef( jweak& _weak, LocalRef< T >& _inout_local )
-{
- _inout_local.set( static_cast< T >( _inout_local.env().NewLocalRef( _weak ) ) );
-
- if ( !_inout_local.is() )
- {
- if ( _inout_local.env().ExceptionCheck())
- {
- return false;
- }
- else if ( _weak != NULL )
- {
- _inout_local.env().DeleteWeakGlobalRef( _weak );
- _weak = NULL;
- }
- }
- return true;
-}
-
-// Load a class. A map from pairs of (classPath, name) to pairs of weak Java
-// references to (ClassLoader, Class) is maintained, so that a class is only
-// loaded once.
-//
-// It may happen that the weak reference to the ClassLoader becomes null while
-// the reference to the Class remains non-null (in case the Class was actually
-// loaded by some parent of the ClassLoader), in which case the ClassLoader is
-// resurrected (which cannot cause any classes to be loaded multiple times, as
-// the ClassLoader is no longer reachable, so no classes it has ever loaded are
-// still reachable).
-//
-// Similarly, it may happen that the weak reference to the Class becomes null
-// while the reference to the ClassLoader remains non-null, in which case the
-// Class is simply re-loaded.
-//
-// This code is close to the implementation of jvmaccess::ClassPath::loadClass
-// in jvmaccess/classpath.hxx, but not close enough to avoid the duplication.
-//
-// If false is returned, a (still pending) JNI exception occurred.
-bool loadClass(
- Reference< XComponentContext > const & context, JNIEnv& environment,
- rtl::OUString const & classPath, rtl::OUString const & name,
- LocalRef< jobject > * classLoaderPtr, LocalRef< jclass > * classPtr)
-{
- OSL_ASSERT(classLoaderPtr != NULL);
- // For any jweak entries still present in the map upon destruction,
- // DeleteWeakGlobalRef is not called (which is a leak):
- ClassMapData * d =
- rtl_Instance< ClassMapData, ClassMapDataInit, osl::MutexGuard,
- osl::GetGlobalMutex >::create(
- ClassMapDataInit(), osl::GetGlobalMutex());
- osl::MutexGuard g(d->mutex);
- ClassMap::iterator i(d->map.begin());
- LocalRef< jobject > cloader(environment);
- LocalRef< jclass > cl(environment);
- // Prune dangling weak references from the list while searching for a match,
- // so that the list cannot grow unbounded:
- for (; i != d->map.end();)
- {
- LocalRef< jobject > classLoader( environment );
- if ( !getLocalFromWeakRef( i->classLoader, classLoader ) )
- return false;
-
- LocalRef< jclass > classObject( environment );
- if ( !getLocalFromWeakRef( i->classObject, classObject ) )
- return false;
-
- if ( !classLoader.is() && !classObject.is() )
- {
- i = d->map.erase(i);
- }
- else if ( i->classPath == classPath && i->className == name )
- {
- cloader.set( classLoader.release() );
- cl.set( classObject.release() );
- break;
- }
- else
- {
- ++i;
- }
- }
- if ( !cloader.is() || !cl.is() )
- {
- if ( i == d->map.end() )
- {
- // Push a new ClassMapEntry (which can potentially fail) before
- // loading the class, so that it never happens that a class is
- // loaded but not added to the map (which could have effects on the
- // 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:
- d->map.push_front( ClassMapEntry( classPath, name ) );
- i = d->map.begin();
- }
-
- LocalRef< jclass > clClass( environment );
- clClass.set( environment.FindClass( "java/net/URLClassLoader" ) );
- if ( !clClass.is() )
- return false;
-
- jweak wcloader = NULL;
- if (!cloader.is())
- {
- jmethodID ctorLoader( environment.GetMethodID( clClass.get(), "<init>", "([Ljava/net/URL;)V" ) );
- if (ctorLoader == NULL)
- return false;
-
- LocalRef< jobjectArray > arr( environment );
- arr.set( jvmaccess::ClassPath::translateToUrls( context, &environment, classPath ) );
- if ( !arr.is() )
- return false;
-
- jvalue arg;
- arg.l = arr.get();
- cloader.set( environment.NewObjectA( clClass.get(), ctorLoader, &arg ) );
- if ( !cloader.is() )
- return false;
-
- wcloader = environment.NewWeakGlobalRef( cloader.get() );
- if ( wcloader == NULL )
- return false;
- }
-
- jweak wcl = NULL;
- if ( !cl.is() )
- {
- jmethodID methLoadClass( environment.GetMethodID( clClass.get(), "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;" ) );
- if ( methLoadClass == NULL )
- return false;
-
- LocalRef< jstring > str( environment );
- str.set( convertwchar_tToJavaString( &environment, name ) );
- if ( !str.is() )
- return false;
-
- jvalue arg;
- arg.l = str.get();
- cl.set( static_cast< jclass >( environment.CallObjectMethodA( cloader.get(), methLoadClass, &arg ) ) );
- if ( !cl.is() )
- return false;
-
- wcl = environment.NewWeakGlobalRef( cl.get() );
- if ( wcl == NULL )
- return false;
- }
-
- if ( wcloader != NULL)
- {
- i->classLoader = wcloader;
- }
- if ( wcl != NULL )
- {
- i->classObject = wcl;
- }
- }
-
- classLoaderPtr->set( cloader.release() );
- classPtr->set( cl.release() );
- return true;
-}
-
-}
-
-//------------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(java_sql_Connection,"com.sun.star.sdbcx.JConnection","com.sun.star.sdbc.Connection");
-//------------------------------------------------------------------------------
-//**************************************************************
-//************ Class: java.sql.Connection
-//**************************************************************
-jclass java_sql_Connection::theClass = 0;
-
-java_sql_Connection::java_sql_Connection( const java_sql_Driver& _rDriver )
- :java_lang_Object( _rDriver.getContext().getLegacyServiceFactory() )
- ,OSubComponent<java_sql_Connection, java_sql_Connection_BASE>((::cppu::OWeakObject*)(&_rDriver), this)
- ,m_pDriver( &_rDriver )
- ,m_pDriverobject(NULL)
- ,m_pDriverClassLoader()
- ,m_Driver_theClass(NULL)
- ,m_aLogger( _rDriver.getLogger() )
- ,m_bParameterSubstitution(sal_False)
- ,m_bIgnoreDriverPrivileges(sal_True)
- ,m_bIgnoreCurrency(sal_False)
-{
-}
-// -----------------------------------------------------------------------------
-java_sql_Connection::~java_sql_Connection()
-{
- ::rtl::Reference< jvmaccess::VirtualMachine > xTest = java_lang_Object::getVM();
- if ( xTest.is() )
- {
- SDBThreadAttach t;
- clearObject(*t.pEnv);
-
- {
- if ( m_pDriverobject )
- t.pEnv->DeleteGlobalRef( m_pDriverobject );
- m_pDriverobject = NULL;
- if ( m_Driver_theClass )
- t.pEnv->DeleteGlobalRef( m_Driver_theClass );
- m_Driver_theClass = NULL;
- }
- t.releaseRef();
- }
-}
-//-----------------------------------------------------------------------------
-void SAL_CALL java_sql_Connection::release() throw()
-{
- relase_ChildImpl();
-}
-//------------------------------------------------------------------------------
-void java_sql_Connection::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_aLogger.log( LogLevel::INFO, STR_LOG_SHUTDOWN_CONNECTION );
-
- dispose_ChildImpl();
- java_sql_Connection_BASE::disposing();
-
- if ( object )
- {
- static jmethodID mID(NULL);
- callVoidMethod("close",mID);
- }
-}
-// -------------------------------------------------------------------------
-jclass java_sql_Connection::getMyClass() const
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/sql/Connection");
- return theClass;
-}
-
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_Connection::getCatalog( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed);
-
- static jmethodID mID(NULL);
- return callStringMethod("getCatalog",mID);
-}
-// -------------------------------------------------------------------------
-Reference< XDatabaseMetaData > SAL_CALL java_sql_Connection::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed);
-
-
- Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
- if(!xMetaData.is())
- {
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- static jmethodID mID(NULL);
- jobject out = callObjectMethod(t.pEnv,"getMetaData","()Ljava/sql/DatabaseMetaData;", mID);
- if(out)
- {
- xMetaData = new java_sql_DatabaseMetaData( t.pEnv, out, *this );
- m_xMetaData = xMetaData;
- }
- }
-
- return xMetaData;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_Connection::close( ) throw(SQLException, RuntimeException)
-{
- dispose();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_Connection::commit( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- callVoidMethod("commit",mID);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_Connection::isClosed( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- static jmethodID mID(NULL);
- return callBooleanMethod( "isClosed", mID ) && java_sql_Connection_BASE::rBHelper.bDisposed;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_Connection::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed);
- static jmethodID mID(NULL);
- return callBooleanMethod( "isReadOnly", mID );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_Connection::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- callVoidMethodWithStringArg("setCatalog",mID,catalog);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_Connection::rollback( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- callVoidMethod("rollback",mID);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_Connection::getAutoCommit( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return callBooleanMethod( "getAutoCommit", mID );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_Connection::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- callVoidMethodWithBoolArg("setReadOnly",mID,readOnly);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_Connection::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- callVoidMethodWithBoolArg("setAutoCommit",mID,autoCommit);
-}
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::container::XNameAccess > SAL_CALL java_sql_Connection::getTypeMap( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- static jmethodID mID(NULL);
- callObjectMethod(t.pEnv,"getTypeMap","()Ljava/util/Map;", mID);
- // WARNING: the caller becomes the owner of the returned pointer
- return 0;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_Connection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed);
-
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setTypeMap", *this );
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_Connection::getTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed);
-
- static jmethodID mID(NULL);
- return callIntMethod("getTransactionIsolation",mID);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_Connection::setTransactionIsolation( sal_Int32 level ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed);
-
- static jmethodID mID(NULL);
- callVoidMethodWithIntArg("setTransactionIsolation",mID,level);
-}
-// -------------------------------------------------------------------------
-Reference< XStatement > SAL_CALL java_sql_Connection::createStatement( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed);
- m_aLogger.log( LogLevel::FINE, STR_LOG_CREATE_STATEMENT );
-
- SDBThreadAttach t;
- java_sql_Statement* pStatement = new java_sql_Statement( t.pEnv, *this );
- Reference< XStatement > xStmt = pStatement;
- m_aStatements.push_back( WeakReferenceHelper( xStmt ) );
-
- m_aLogger.log( LogLevel::FINE, STR_LOG_CREATED_STATEMENT_ID, pStatement->getStatementObjectID() );
- return xStmt;
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString java_sql_Connection::transFormPreparedStatement(const ::rtl::OUString& _sSQL)
-{
- ::rtl::OUString sSqlStatement = _sSQL;
- if ( m_bParameterSubstitution )
- {
- try
- {
- OSQLParser aParser( m_pDriver->getContext().getLegacyServiceFactory() );
- ::rtl::OUString sErrorMessage;
- ::rtl::OUString sNewSql;
- OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,_sSQL);
- if(pNode)
- { // special handling for parameters
- OSQLParseNode::substituteParameterNames(pNode);
- pNode->parseNodeToStr( sNewSql, this );
- delete pNode;
- sSqlStatement = sNewSql;
- }
- }
- catch(const Exception&)
- {
- }
- }
- return sSqlStatement;
-}
-// -------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed);
- m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARE_STATEMENT, sql );
-
- SDBThreadAttach t;
- ::rtl::OUString sSqlStatement = sql;
- sSqlStatement = transFormPreparedStatement( sSqlStatement );
-
- java_sql_PreparedStatement* pStatement = new java_sql_PreparedStatement( t.pEnv, *this, sSqlStatement );
- Reference< XPreparedStatement > xReturn( pStatement );
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
-
- m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_STATEMENT_ID, pStatement->getStatementObjectID() );
- return xReturn;
-}
-// -------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareCall( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed);
- m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARE_CALL, sql );
-
- SDBThreadAttach t;
- ::rtl::OUString sSqlStatement = sql;
- sSqlStatement = transFormPreparedStatement( sSqlStatement );
-
- java_sql_CallableStatement* pStatement = new java_sql_CallableStatement( t.pEnv, *this, sSqlStatement );
- Reference< XPreparedStatement > xStmt( pStatement );
- m_aStatements.push_back(WeakReferenceHelper(xStmt));
-
- m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_CALL_ID, pStatement->getStatementObjectID() );
- return xStmt;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_Connection::nativeSQL( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed);
-
- ::rtl::OUString aStr;
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
-
- // initialize temporary Variable
- static const char * cSignature = "(Ljava/lang/String;)Ljava/lang/String;";
- static const char * cMethodName = "nativeSQL";
- // Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- // Convert Parameter
- jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,sql));
-
- jobject out = t.pEnv->CallObjectMethod( object, mID, str.get() );
- aStr = JavaString2String(t.pEnv, (jstring)out );
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- } //t.pEnv
-
- m_aLogger.log( LogLevel::FINER, STR_LOG_NATIVE_SQL, sql, aStr );
-
- return aStr;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_Connection::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- callVoidMethod("clearWarnings",mID);
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL java_sql_Connection::getWarnings( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Connection_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t;
- static jmethodID mID(NULL);
- jobject out = callObjectMethod(t.pEnv,"getWarnings","()Ljava/sql/SQLWarning;", mID);
- // WARNING: the caller becomes the owner of the returned pointer
- if( out )
- {
- java_sql_SQLWarning_BASE warn_base(t.pEnv, out);
- SQLException aAsException( static_cast< starsdbc::SQLException >( 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 );
- }
-
- return Any();
-}
-
-// -----------------------------------------------------------------------------
-namespace
-{
- ::rtl::OUString lcl_getDriverLoadErrorMessage( const ::connectivity::SharedResources& _aResource,const ::rtl::OUString& _rDriverClass, const ::rtl::OUString& _rDriverClassPath )
- {
- ::rtl::OUString sError1( _aResource.getResourceStringWithSubstitution(
- STR_NO_CLASSNAME,
- "$classname$", _rDriverClass
- ) );
- if ( _rDriverClassPath.getLength() )
- {
- const ::rtl::OUString sError2( _aResource.getResourceStringWithSubstitution(
- STR_NO_CLASSNAME_PATH,
- "$classpath$", _rDriverClassPath
- ) );
- sError1 += sError2;
- } // if ( _rDriverClassPath.getLength() )
- return sError1;
- }
-}
-
-// -----------------------------------------------------------------------------
-namespace
-{
- bool lcl_setSystemProperties_nothrow( const java::sql::ConnectionLog& _rLogger,
- JNIEnv& _rEnv, const Sequence< NamedValue >& _rSystemProperties )
- {
- if ( _rSystemProperties.getLength() == 0 )
- // nothing to do
- return true;
-
- LocalRef< jclass > systemClass( _rEnv );
- jmethodID nSetPropertyMethodID = 0;
- // retrieve the java.lang.System class
- systemClass.set( _rEnv.FindClass( "java/lang/System" ) );
- if ( systemClass.is() )
- {
- nSetPropertyMethodID = _rEnv.GetStaticMethodID(
- systemClass.get(), "setProperty", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;" );
- }
-
- if ( nSetPropertyMethodID == 0 )
- return false;
-
- for ( const NamedValue* pSystemProp = _rSystemProperties.getConstArray();
- pSystemProp != _rSystemProperties.getConstArray() + _rSystemProperties.getLength();
- ++pSystemProp
- )
- {
- ::rtl::OUString sValue;
- OSL_VERIFY( pSystemProp->Value >>= sValue );
-
- _rLogger.log( LogLevel::FINER, STR_LOG_SETTING_SYSTEM_PROPERTY, pSystemProp->Name, sValue );
-
- LocalRef< jstring > jName( _rEnv, convertwchar_tToJavaString( &_rEnv, pSystemProp->Name ) );
- LocalRef< jstring > jValue( _rEnv, convertwchar_tToJavaString( &_rEnv, sValue ) );
-
- _rEnv.CallStaticObjectMethod( systemClass.get(), nSetPropertyMethodID, jName.get(), jValue.get() );
- LocalRef< jthrowable > throwable( _rEnv, _rEnv.ExceptionOccurred() );
- if ( throwable.is() )
- return false;
- }
-
- return true;
- }
-}
-
-// -----------------------------------------------------------------------------
-void java_sql_Connection::loadDriverFromProperties( const ::rtl::OUString& _sDriverClass, const ::rtl::OUString& _sDriverClassPath,
- const Sequence< NamedValue >& _rSystemProperties )
-{
- // contains the statement which should be used when query for automatically generated values
- ::rtl::OUString sGeneratedValueStatement;
- // set to <TRUE/> when we should allow to query for generated values
- sal_Bool bAutoRetrievingEnabled = sal_False;
-
- // first try if the jdbc driver is alraedy registered at the driver manager
- SDBThreadAttach t;
- try
- {
- if ( !object )
- {
- if ( !lcl_setSystemProperties_nothrow( getLogger(), *t.pEnv, _rSystemProperties ) )
- ThrowLoggedSQLException( getLogger(), t.pEnv, *this );
-
- m_pDriverClassLoader.reset();
-
- // here I try to find the class for jdbc driver
- java_sql_SQLException_BASE::st_getMyClass();
- java_lang_Throwable::st_getMyClass();
-
- if ( !_sDriverClass.getLength() )
- {
- m_aLogger.log( LogLevel::SEVERE, STR_LOG_NO_DRIVER_CLASS );
- ::dbtools::throwGenericSQLException(
- lcl_getDriverLoadErrorMessage( getResources(),_sDriverClass, _sDriverClassPath ),
- *this
- );
- }
- else
- {
- m_aLogger.log( LogLevel::INFO, STR_LOG_LOADING_DRIVER, _sDriverClass );
- // the driver manager holds the class of the driver for later use
- ::std::auto_ptr< java_lang_Class > pDrvClass;
- if ( !_sDriverClassPath.getLength() )
- {
- // if forName didn't find the class it will throw an exception
- pDrvClass = ::std::auto_ptr< java_lang_Class >(java_lang_Class::forName(_sDriverClass));
- }
- else
- {
- LocalRef< jclass > driverClass(t.env());
- LocalRef< jobject > driverClassLoader(t.env());
-
- loadClass(
- m_pDriver->getContext().getUNOContext(),
- t.env(), _sDriverClassPath, _sDriverClass, &driverClassLoader, &driverClass );
-
- m_pDriverClassLoader.set( driverClassLoader );
- pDrvClass.reset( new java_lang_Class( t.pEnv, driverClass.release() ) );
-
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
- if ( pDrvClass.get() )
- {
- LocalRef< jobject > driverObject( t.env() );
- driverObject.set( pDrvClass->newInstanceObject() );
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- m_pDriverobject = driverObject.release();
-
- if( t.pEnv && m_pDriverobject )
- m_pDriverobject = t.pEnv->NewGlobalRef( m_pDriverobject );
-
- {
- jclass tempClass = t.pEnv->GetObjectClass(m_pDriverobject);
- if ( m_pDriverobject )
- {
- m_Driver_theClass = (jclass)t.pEnv->NewGlobalRef( tempClass );
- t.pEnv->DeleteLocalRef( tempClass );
- }
- }
- }
- m_aLogger.log( LogLevel::INFO, STR_LOG_CONN_SUCCESS );
- }
- }
- }
- catch( const SQLException& e )
- {
- throw SQLException(
- lcl_getDriverLoadErrorMessage( getResources(),_sDriverClass, _sDriverClassPath ),
- *this,
- ::rtl::OUString(),
- 1000,
- makeAny(e)
- );
- }
- catch( Exception& )
- {
- ::dbtools::throwGenericSQLException(
- lcl_getDriverLoadErrorMessage( getResources(),_sDriverClass, _sDriverClassPath ),
- *this
- );
- }
-
- enableAutoRetrievingEnabled( bAutoRetrievingEnabled );
- setAutoRetrievingStatement( sGeneratedValueStatement );
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString java_sql_Connection::impl_getJavaDriverClassPath_nothrow(const ::rtl::OUString& _sDriverClass)
-{
- static const ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess/JDBC/DriverClassPaths"));
- ::utl::OConfigurationTreeRoot aNamesRoot = ::utl::OConfigurationTreeRoot::createWithServiceFactory(
- m_pDriver->getContext().getLegacyServiceFactory(), s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
- ::rtl::OUString sURL;
- if ( aNamesRoot.isValid() && aNamesRoot.hasByName( _sDriverClass ) )
- {
- ::utl::OConfigurationNode aRegisterObj = aNamesRoot.openNode( _sDriverClass );
- OSL_VERIFY( aRegisterObj.getNodeValue( "Path" ) >>= sURL );
- }
- return sURL;
-}
-// -----------------------------------------------------------------------------
-sal_Bool java_sql_Connection::construct(const ::rtl::OUString& url,
- const Sequence< PropertyValue >& info)
-{
- { // initialize the java vm
- ::rtl::Reference< jvmaccess::VirtualMachine > xTest = java_lang_Object::getVM(getORB());
- if ( !xTest.is() )
- throwGenericSQLException(STR_NO_JAVA,*this);
- }
- SDBThreadAttach t;
- t.addRef(); // will be released in dtor
- if ( !t.pEnv )
- throwGenericSQLException(STR_NO_JAVA,*this);
-
- ::rtl::OUString sGeneratedValueStatement; // contains the statement which should be used when query for automatically generated values
- sal_Bool bAutoRetrievingEnabled = sal_False; // set to <TRUE/> when we should allow to query for generated values
- ::rtl::OUString sDriverClassPath,sDriverClass;
- Sequence< NamedValue > aSystemProperties;
-
- ::comphelper::NamedValueCollection aSettings( info );
- sDriverClass = aSettings.getOrDefault( "JavaDriverClass", sDriverClass );
- sDriverClassPath = aSettings.getOrDefault( "JavaDriverClassPath", sDriverClassPath);
- if ( !sDriverClassPath.getLength() )
- sDriverClassPath = impl_getJavaDriverClassPath_nothrow(sDriverClass);
- bAutoRetrievingEnabled = aSettings.getOrDefault( "IsAutoRetrievingEnabled", bAutoRetrievingEnabled );
- sGeneratedValueStatement = aSettings.getOrDefault( "AutoRetrievingStatement", sGeneratedValueStatement );
- m_bParameterSubstitution = aSettings.getOrDefault( "ParameterNameSubstitution", m_bParameterSubstitution );
- m_bIgnoreDriverPrivileges = aSettings.getOrDefault( "IgnoreDriverPrivileges", m_bIgnoreDriverPrivileges );
- m_bIgnoreCurrency = aSettings.getOrDefault( "IgnoreCurrency", m_bIgnoreCurrency );
- aSystemProperties = aSettings.getOrDefault( "SystemProperties", aSystemProperties );
- m_aCatalogRestriction = aSettings.getOrDefault( "ImplicitCatalogRestriction", Any() );
- m_aSchemaRestriction = aSettings.getOrDefault( "ImplicitSchemaRestriction", Any() );
-
- loadDriverFromProperties( sDriverClass, sDriverClassPath, aSystemProperties );
-
- enableAutoRetrievingEnabled(bAutoRetrievingEnabled);
- setAutoRetrievingStatement(sGeneratedValueStatement);
-
- if ( t.pEnv && m_Driver_theClass && m_pDriverobject )
- {
- // initialize temporary Variable
- static const char * cSignature = "(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;";
- static const char * cMethodName = "connect";
- // Java-Call
- jmethodID mID = NULL;
- if ( !mID )
- mID = t.pEnv->GetMethodID( m_Driver_theClass, cMethodName, cSignature );
- if ( mID )
- {
- jvalue args[2];
- // convert Parameter
- args[0].l = convertwchar_tToJavaString(t.pEnv,url);
- java_util_Properties* pProps = createStringPropertyArray(info);
- args[1].l = pProps->getJavaObject();
-
- LocalRef< jobject > ensureDelete( t.env(), args[0].l );
-
- jobject out = NULL;
- // In some cases (e.g.,
- // connectivity/source/drivers/hsqldb/HDriver.cxx:1.24
- // l. 249) the JavaDriverClassPath contains multiple jars,
- // as creating the JavaDriverClass instance requires
- // (reflective) access to those other jars. Now, if the
- // JavaDriverClass is actually loaded by some parent class
- // loader (e.g., because its jar is also on the global
- // class path), it would still not have access to the
- // additional jars on the JavaDriverClassPath. Hence, the
- // JavaDriverClassPath class loader is pushed as context
- // class loader around the JavaDriverClass instance
- // creation:
- // #i82222# / 2007-10-15
- {
- ContextClassLoaderScope ccl( t.env(), getDriverClassLoader(), getLogger(), *this );
- out = t.pEnv->CallObjectMethod( m_pDriverobject, mID, args[0].l,args[1].l );
- delete pProps, pProps = NULL;
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
-
- if ( !out )
- m_aLogger.log( LogLevel::SEVERE, STR_LOG_NO_SYSTEM_CONNECTION );
-
- if ( out )
- object = t.pEnv->NewGlobalRef( out );
-
- if ( object )
- m_aLogger.log( LogLevel::INFO, STR_LOG_GOT_JDBC_CONNECTION, url );
-
- m_aConnectionInfo = info;
- } //mID
- } //t.pEnv
- return object != NULL;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx
deleted file mode 100644
index 8decaa3751..0000000000
--- a/connectivity/source/drivers/jdbc/JDriver.cxx
+++ /dev/null
@@ -1,258 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/sql/Driver.hxx"
-#include "java/lang/Object.hxx"
-#include "java/lang/Class.hxx"
-#include "java/sql/DriverPropertyInfo.hxx"
-#include "java/sql/Connection.hxx"
-#include "java/util/Property.hxx"
-#include "java/tools.hxx"
-#include "connectivity/dbexception.hxx"
-#include <jvmfwk/framework.h>
-#include "diagnose_ex.h"
-#include "resource/jdbc_log.hrc"
-#include "resource/common_res.hrc"
-#include "resource/sharedresources.hxx"
-#include <comphelper/componentcontext.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;
-
-// -------------------------------------------------------------------------
-java_sql_Driver::java_sql_Driver(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory)
- :m_aContext( _rxFactory )
- ,m_aLogger( m_aContext.getUNOContext(), "sdbcl", "org.openoffice.sdbc.jdbcBridge" )
-{
-}
-// --------------------------------------------------------------------------------
-java_sql_Driver::~java_sql_Driver()
-{
-}
-
-// static ServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString java_sql_Driver::getImplementationName_Static( ) throw(RuntimeException)
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sdbc.JDBCDriver"));
- // this name is referenced in the configuration and in the jdbc.xml
- // Please take care when changing it.
-}
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > java_sql_Driver::getSupportedServiceNames_Static( ) throw (RuntimeException)
-{
- Sequence< ::rtl::OUString > aSNS( 1 );
- aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver"));
- return aSNS;
-}
-//------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::java_sql_Driver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
-{
- return *(new java_sql_Driver(_rxFactory));
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_Driver::getImplementationName( ) throw(RuntimeException)
-{
- return getImplementationName_Static();
-}
-
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_Driver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-
-// --------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL java_sql_Driver::getSupportedServiceNames( ) throw(RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-// -------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUString& url, const
- Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
-{
- m_aLogger.log( LogLevel::INFO, STR_LOG_DRIVER_CONNECTING_URL, url );
-
- Reference< XConnection > xOut;
- if ( acceptsURL(url ) )
- {
- java_sql_Connection* pConnection = new java_sql_Connection( *this );
- xOut = pConnection;
- if ( !pConnection->construct(url,info) )
- xOut.clear(); // an error occurred and the java driver didn't throw an exception
- else
- m_aLogger.log( LogLevel::INFO, STR_LOG_DRIVER_SUCCESS );
- }
- return xOut;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_Driver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException)
-{
- // don't ask the real driver for the url
- // I feel responsible for all jdbc url's
- sal_Bool bEnabled = sal_False;
- OSL_VERIFY_EQUALS( jfw_getEnabled( &bEnabled ), JFW_E_NONE, "error in jfw_getEnabled" );
- static const ::rtl::OUString s_sJdbcPrefix( RTL_CONSTASCII_USTRINGPARAM( "jdbc:" ));
- return bEnabled && 0 == url.compareTo(s_sJdbcPrefix, 5);
-}
-// -------------------------------------------------------------------------
-Sequence< DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyInfo( const ::rtl::OUString& url,
- const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException)
-{
- if ( acceptsURL(url) )
- {
- ::std::vector< DriverPropertyInfo > aDriverInfo;
-
- Sequence< ::rtl::OUString > aBooleanValues(2);
- aBooleanValues[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) );
- aBooleanValues[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
-
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The JDBC driver class name."))
- ,sal_True
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClassPath"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The class path where to look for the JDBC driver."))
- ,sal_True
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ) )
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SystemProperties"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Additional properties to set at java.lang.System before loading the driver."))
- ,sal_True
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ) )
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParameterNameSubstitution"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Change named parameters with '?'."))
- ,sal_False
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) )
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreDriverPrivileges"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Ignore the privileges from the database driver."))
- ,sal_False
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) )
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsAutoRetrievingEnabled"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Retrieve generated values."))
- ,sal_False
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) )
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoRetrievingStatement"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Auto-increment statement."))
- ,sal_False
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GenerateASBeforeCorrelationName"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Generate AS before table correlation names."))
- ,sal_False
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) )
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreCurrency"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Ignore the currency field from the ResultsetMetaData."))
- ,sal_False
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) )
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EscapeDateTime"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Escape date time format."))
- ,sal_False
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) )
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TypeInfoSettings"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Defines how the type info of the database metadata should be manipulated."))
- ,sal_False
- ,::rtl::OUString( )
- ,Sequence< ::rtl::OUString > ())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImplicitCatalogRestriction"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The catalog which should be used in getTables calls, when the caller passed NULL."))
- ,sal_False
- ,::rtl::OUString( )
- ,Sequence< ::rtl::OUString > ())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImplicitSchemaRestriction"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The schema which should be used in getTables calls, when the caller passed NULL."))
- ,sal_False
- ,::rtl::OUString( )
- ,Sequence< ::rtl::OUString > ())
- );
- return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size());
- }
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- return Sequence< DriverPropertyInfo >();
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_Driver::getMajorVersion( ) throw(RuntimeException)
-{
- return 1;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_Driver::getMinorVersion( ) throw(RuntimeException)
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx
deleted file mode 100644
index b5847ba21e..0000000000
--- a/connectivity/source/drivers/jdbc/JStatement.cxx
+++ /dev/null
@@ -1,831 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "java/sql/JStatement.hxx"
-#include "java/sql/ResultSet.hxx"
-#include "java/sql/Connection.hxx"
-#include "java/sql/SQLWarning.hxx"
-#include "java/tools.hxx"
-#include "java/ContextClassLoader.hxx"
-#include <comphelper/property.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include "TConnection.hxx"
-#include <comphelper/types.hxx>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-
-#include "resource/jdbc_log.hrc"
-
-#include <algorithm>
-#include <string.h>
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace ::cppu;
-//------------------------------------------------------------------------------
-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;
-
-//------------------------------------------------------------------------------
-//**************************************************************
-//************ Class: java.sql.Statement
-//**************************************************************
-
-jclass java_sql_Statement_Base::theClass = 0;
-
-// -------------------------------------------------------------------------
-java_sql_Statement_Base::java_sql_Statement_Base( JNIEnv * pEnv, java_sql_Connection& _rCon )
- :java_sql_Statement_BASE(m_aMutex)
- ,java_lang_Object( pEnv, NULL )
- ,OPropertySetHelper(java_sql_Statement_BASE::rBHelper)
- ,m_pConnection( &_rCon )
- ,m_aLogger( _rCon.getLogger(), java::sql::ConnectionLog::STATEMENT )
- ,m_nResultSetConcurrency(ResultSetConcurrency::READ_ONLY)
- ,m_nResultSetType(ResultSetType::FORWARD_ONLY)
- ,m_bEscapeProcessing(sal_True)
- ,rBHelper(java_sql_Statement_BASE::rBHelper)
-{
- m_pConnection->acquire();
-}
-
-//------------------------------------------------------------------------------
-java_sql_Statement_Base::~java_sql_Statement_Base()
-{
-}
-
-//------------------------------------------------------------------------------
-void SAL_CALL OStatement_BASE2::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- if ( object )
- {
- static jmethodID mID(NULL);
- callVoidMethod("close",mID);
- }
-
- ::comphelper::disposeComponent(m_xGeneratedStatement);
- if (m_pConnection)
- m_pConnection->release();
- m_pConnection = NULL;
-
- dispose_ChildImpl();
- java_sql_Statement_Base::disposing();
-}
-// -------------------------------------------------------------------------
-jclass java_sql_Statement_Base::getMyClass() const
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/sql/Statement");
- return theClass;
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL java_sql_Statement_Base::disposing(void)
-{
- m_aLogger.log( LogLevel::FINE, STR_LOG_CLOSING_STATEMENT );
- java_sql_Statement_BASE::disposing();
- clearObject();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OStatement_BASE2::release() throw()
-{
- relase_ChildImpl();
-}
-
-// -------------------------------------------------------------------------
-Any SAL_CALL java_sql_Statement_Base::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- if ( m_pConnection && !m_pConnection->isAutoRetrievingEnabled() && rType == ::getCppuType( (const Reference< XGeneratedResultSet > *)0 ) )
- return Any();
- Any aRet( java_sql_Statement_BASE::queryInterface(rType) );
- return aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL java_sql_Statement_Base::getTypes( ) throw(RuntimeException)
-{
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
-
- Sequence< Type > aOldTypes = java_sql_Statement_BASE::getTypes();
- if ( m_pConnection && !m_pConnection->isAutoRetrievingEnabled() )
- {
- ::std::remove(aOldTypes.getArray(),aOldTypes.getArray() + aOldTypes.getLength(),
- ::getCppuType( (const Reference< XGeneratedResultSet > *)0 ));
- aOldTypes.realloc(aOldTypes.getLength() - 1);
- }
-
- return ::comphelper::concatSequences(aTypes.getTypes(),aOldTypes);
-}
-// -----------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL java_sql_Statement_Base::getGeneratedValues( ) throw (SQLException, RuntimeException)
-{
- m_aLogger.log( LogLevel::FINE, STR_LOG_GENERATED_VALUES );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- jobject out(0);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- // initialize temporary Variable
- try
- {
- static jmethodID mID(NULL);
- out = callResultSetMethod(t.env(),"getGeneratedKeys",mID);
- }
- catch(const SQLException&)
- {
- // ignore
- }
-
- Reference< XResultSet > xRes;
- if ( !out )
- {
- OSL_ENSURE( m_pConnection && m_pConnection->isAutoRetrievingEnabled(),"Illegal call here. isAutoRetrievingEnabled is false!");
- if ( m_pConnection )
- {
- ::rtl::OUString sStmt = m_pConnection->getTransformedGeneratedStatement(m_sSqlStatement);
- if ( sStmt.getLength() )
- {
- m_aLogger.log( LogLevel::FINER, STR_LOG_GENERATED_VALUES_FALLBACK, sStmt );
- ::comphelper::disposeComponent(m_xGeneratedStatement);
- m_xGeneratedStatement = m_pConnection->createStatement();
- xRes = m_xGeneratedStatement->executeQuery(sStmt);
- }
- }
- }
- else
- xRes = new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection, this );
- return xRes;
-}
-
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_Statement_Base::cancel( ) throw(RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethod("cancel",mID);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_Statement_Base::close( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- if (java_sql_Statement_BASE::rBHelper.bDisposed)
- throw DisposedException();
- }
- dispose();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_Statement::clearBatch( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
-
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethod("clearBatch",mID);
- } //t.pEnv
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_Statement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- m_aLogger.log( LogLevel::FINE, STR_LOG_EXECUTE_STATEMENT, sql );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- jboolean out(sal_False);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
- createStatement(t.pEnv);
- m_sSqlStatement = sql;
- // initialize temporary Variable
- static const char * cSignature = "(Ljava/lang/String;)Z";
- static const char * cMethodName = "execute";
- // Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- // convert Parameter
- jdbc::LocalRef< jstring > str( t.env(), convertwchar_tToJavaString( t.pEnv, sql ) );
- {
- jdbc::ContextClassLoaderScope ccl( t.env(),
- m_pConnection ? m_pConnection->getDriverClassLoader() : jdbc::GlobalRef< jobject >(),
- m_aLogger,
- *this
- );
-
- out = t.pEnv->CallBooleanMethod( object, mID, str.get() );
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
- } //t.pEnv
- return out;
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSet > SAL_CALL java_sql_Statement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- m_aLogger.log( LogLevel::FINE, STR_LOG_EXECUTE_QUERY, sql );
-
- jobject out(0);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- createStatement(t.pEnv);
- m_sSqlStatement = sql;
- // initialize temporary variable
- static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/ResultSet;";
- static const char * cMethodName = "executeQuery";
- // Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- // convert Parameter
- jdbc::LocalRef< jstring > str( t.env(), convertwchar_tToJavaString( t.pEnv, sql ) );
- {
- jdbc::ContextClassLoaderScope ccl( t.env(),
- m_pConnection ? m_pConnection->getDriverClassLoader() : jdbc::GlobalRef< jobject >(),
- m_aLogger,
- *this
- );
-
- out = t.pEnv->CallObjectMethod( object, mID, str.get() );
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
- } //t.pEnv
- // WARNING: the caller becomes the owner of the returned pointer
- return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out, m_aLogger, *m_pConnection,this );
-}
-// -------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL java_sql_Statement_Base::getConnection( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- return (Reference< XConnection >)m_pConnection;
-}
-// -------------------------------------------------------------------------
-
-Any SAL_CALL java_sql_Statement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this));
- return aRet.hasValue() ? aRet : java_sql_Statement_Base::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_Statement::addBatch( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethodWithStringArg("addBatch",mID,sql);
- } //t.pEnv
-}
-// -------------------------------------------------------------------------
-
-Sequence< sal_Int32 > SAL_CALL java_sql_Statement::executeBatch( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- Sequence< sal_Int32 > aSeq;
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jintArray out = (jintArray)callObjectMethod(t.pEnv,"executeBatch","()[I", mID);
- if (out)
- {
- jboolean p = sal_False;
- aSeq.realloc(t.pEnv->GetArrayLength(out));
- memcpy(aSeq.getArray(),t.pEnv->GetIntArrayElements(out,&p),aSeq.getLength());
- t.pEnv->DeleteLocalRef(out);
- }
- return aSeq;
-}
-// -------------------------------------------------------------------------
-
-
-sal_Int32 SAL_CALL java_sql_Statement_Base::executeUpdate( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- m_aLogger.log( LogLevel::FINE, STR_LOG_EXECUTE_UPDATE, sql );
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- m_sSqlStatement = sql;
- static jmethodID mID(NULL);
- return callIntMethodWithStringArg("executeUpdate",mID,sql);
-}
-// -------------------------------------------------------------------------
-
-Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Statement_Base::getResultSet( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jobject out = callResultSetMethod(t.env(),"getResultSet",mID);
-
- // WARNING: the caller becomes the owner of the returned pointer
- return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out, m_aLogger, *m_pConnection,this );
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL java_sql_Statement_Base::getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- sal_Int32 out = callIntMethod("getUpdateCount",mID);
- m_aLogger.log( LogLevel::FINER, STR_LOG_UPDATE_COUNT, (sal_Int32)out );
- return out;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_Statement_Base::getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return callBooleanMethod( "getMoreResults", mID );
-}
-// -------------------------------------------------------------------------
-
-// -------------------------------------------------------------------------
-Any SAL_CALL java_sql_Statement_Base::getWarnings( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- SDBThreadAttach t;
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jobject out = callObjectMethod(t.pEnv,"getWarnings","()Ljava/sql/SQLWarning;", mID);
- // WARNING: the caller becomes the owner of the returned pointer
- if( out )
- {
- java_sql_SQLWarning_BASE warn_base( t.pEnv, out );
- return makeAny(
- static_cast< starsdbc::SQLException >(
- java_sql_SQLWarning(warn_base,*(::cppu::OWeakObject*)this)));
- }
-
- return Any();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_Statement_Base::clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- SDBThreadAttach t;
-
- {
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethod("clearWarnings",mID);
- }
-}
-//------------------------------------------------------------------------------
-sal_Int32 java_sql_Statement_Base::getQueryTimeOut() throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_getProperty("getQueryTimeOut",mID);
-}
-//------------------------------------------------------------------------------
-sal_Int32 java_sql_Statement_Base::getMaxRows() throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_getProperty("getMaxRows",mID);
-}
-//------------------------------------------------------------------------------
-sal_Int32 java_sql_Statement_Base::getResultSetConcurrency() throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_getProperty("getResultSetConcurrency",mID,m_nResultSetConcurrency);
-}
-
-//------------------------------------------------------------------------------
-sal_Int32 java_sql_Statement_Base::getResultSetType() throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_getProperty("getResultSetType",mID,m_nResultSetType);
-}
-//------------------------------------------------------------------------------
-sal_Int32 java_sql_Statement_Base::impl_getProperty(const char* _pMethodName, jmethodID& _inout_MethodID,sal_Int32 _nDefault)
-{
- sal_Int32 out = _nDefault;
- if ( object )
- out = callIntMethod(_pMethodName,_inout_MethodID,true);
-
- return out;
-}
-//------------------------------------------------------------------------------
-sal_Int32 java_sql_Statement_Base::impl_getProperty(const char* _pMethodName, jmethodID& _inout_MethodID)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- return callIntMethod(_pMethodName,_inout_MethodID,true);
-}
-
-//------------------------------------------------------------------------------
-sal_Int32 java_sql_Statement_Base::getFetchDirection() throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_getProperty("getFetchDirection",mID);
-}
-//------------------------------------------------------------------------------
-sal_Int32 java_sql_Statement_Base::getFetchSize() throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_getProperty("getFetchSize",mID);
-}
-//------------------------------------------------------------------------------
-sal_Int32 java_sql_Statement_Base::getMaxFieldSize() throw(SQLException, RuntimeException)
-{
- static jmethodID mID(NULL);
- return impl_getProperty("getMaxFieldSize",mID);
-}
-//------------------------------------------------------------------------------
-::rtl::OUString java_sql_Statement_Base::getCursorName() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- try
- {
- return callStringMethod("getCursorName",mID);
- }
- catch(const SQLException&)
- {
- }
- return ::rtl::OUString();
-}
-//------------------------------------------------------------------------------
-void java_sql_Statement_Base::setQueryTimeOut(sal_Int32 _par0) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethodWithIntArg("setQueryTimeOut",mID,_par0,true);
-}
-
-//------------------------------------------------------------------------------
-void java_sql_Statement_Base::setEscapeProcessing(sal_Bool _par0) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- m_aLogger.log( LogLevel::FINE, STR_LOG_SET_ESCAPE_PROCESSING, _par0 );
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- m_bEscapeProcessing = _par0;
- createStatement( t.pEnv );
- static jmethodID mID(NULL);
- callVoidMethodWithBoolArg("setEscapeProcessing",mID,_par0,true);
-}
-
-//------------------------------------------------------------------------------
-void java_sql_Statement_Base::setMaxRows(sal_Int32 _par0) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethodWithIntArg("setMaxRows",mID,_par0,true);
-}
-//------------------------------------------------------------------------------
-void java_sql_Statement_Base::setResultSetConcurrency(sal_Int32 _par0) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- m_aLogger.log( LogLevel::FINE, STR_LOG_RESULT_SET_CONCURRENCY, (sal_Int32)_par0 );
- m_nResultSetConcurrency = _par0;
-
- clearObject();
-}
-//------------------------------------------------------------------------------
-void java_sql_Statement_Base::setResultSetType(sal_Int32 _par0) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- m_aLogger.log( LogLevel::FINE, STR_LOG_RESULT_SET_TYPE, (sal_Int32)_par0 );
- m_nResultSetType = _par0;
-
- clearObject();
-}
-//------------------------------------------------------------------------------
-void java_sql_Statement_Base::setFetchDirection(sal_Int32 _par0) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- m_aLogger.log( LogLevel::FINER, STR_LOG_FETCH_DIRECTION, (sal_Int32)_par0 );
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethodWithIntArg("setFetchDirection",mID,_par0,true);
-}
-//------------------------------------------------------------------------------
-void java_sql_Statement_Base::setFetchSize(sal_Int32 _par0) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- m_aLogger.log( LogLevel::FINER, STR_LOG_FETCH_SIZE, (sal_Int32)_par0 );
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethodWithIntArg("setFetchSize",mID,_par0,true);
-}
-//------------------------------------------------------------------------------
-void java_sql_Statement_Base::setMaxFieldSize(sal_Int32 _par0) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethodWithIntArg("setMaxFieldSize",mID,_par0,true);
-}
-//------------------------------------------------------------------------------
-void java_sql_Statement_Base::setCursorName(const ::rtl::OUString &_par0) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethodWithStringArg("setCursorName",mID,_par0);
- } //t.pEnv
-}
-
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* java_sql_Statement_Base::createArrayHelper( ) const
-{
- Sequence< Property > aProps(10);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP0(CURSORNAME, ::rtl::OUString);
- DECL_BOOL_PROP0(ESCAPEPROCESSING);
- DECL_PROP0(FETCHDIRECTION,sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP0(MAXFIELDSIZE,sal_Int32);
- DECL_PROP0(MAXROWS, sal_Int32);
- DECL_PROP0(QUERYTIMEOUT,sal_Int32);
- DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32);
- DECL_PROP0(RESULTSETTYPE,sal_Int32);
- DECL_BOOL_PROP0(USEBOOKMARKS);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & java_sql_Statement_Base::getInfoHelper()
-
-{
- return *const_cast<java_sql_Statement_Base*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool java_sql_Statement_Base::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getQueryTimeOut());
- case PROPERTY_ID_MAXFIELDSIZE:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxFieldSize());
- case PROPERTY_ID_MAXROWS:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxRows());
- case PROPERTY_ID_CURSORNAME:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getCursorName());
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetConcurrency());
- case PROPERTY_ID_RESULTSETTYPE:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetType());
- case PROPERTY_ID_FETCHDIRECTION:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection());
- case PROPERTY_ID_FETCHSIZE:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize());
- case PROPERTY_ID_ESCAPEPROCESSING:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bEscapeProcessing );
- case PROPERTY_ID_USEBOOKMARKS:
- // return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink);
- default:
- ;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-void java_sql_Statement_Base::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& rValue
- )
- throw (Exception)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- setQueryTimeOut(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_MAXFIELDSIZE:
- setMaxFieldSize(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_MAXROWS:
- setMaxRows(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_CURSORNAME:
- setCursorName(comphelper::getString(rValue));
- break;
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- setResultSetConcurrency(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- setResultSetType(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- setFetchDirection(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_FETCHSIZE:
- setFetchSize(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_ESCAPEPROCESSING:
- setEscapeProcessing( ::comphelper::getBOOL( rValue ) );
- break;
- case PROPERTY_ID_USEBOOKMARKS:
- // return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink);
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void java_sql_Statement_Base::getFastPropertyValue(
- Any& rValue,
- sal_Int32 nHandle
- ) const
-{
- java_sql_Statement_Base* THIS = const_cast<java_sql_Statement_Base*>(this);
- try
- {
- switch(nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- rValue <<= THIS->getQueryTimeOut();
- break;
- case PROPERTY_ID_MAXFIELDSIZE:
- rValue <<= THIS->getMaxFieldSize();
- break;
- case PROPERTY_ID_MAXROWS:
- rValue <<= THIS->getMaxRows();
- break;
- case PROPERTY_ID_CURSORNAME:
- rValue <<= THIS->getCursorName();
- break;
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- rValue <<= THIS->getResultSetConcurrency();
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- rValue <<= THIS->getResultSetType();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- rValue <<= THIS->getFetchDirection();
- break;
- case PROPERTY_ID_FETCHSIZE:
- rValue <<= THIS->getFetchSize();
- break;
- case PROPERTY_ID_ESCAPEPROCESSING:
- rValue <<= (sal_Bool)m_bEscapeProcessing;
- break;
- case PROPERTY_ID_USEBOOKMARKS:
- default:
- ;
- }
- }
- catch(const Exception&)
- {
- }
-}
-// -------------------------------------------------------------------------
-jclass java_sql_Statement::theClass = 0;
-
-java_sql_Statement::~java_sql_Statement()
-{}
-
-jclass java_sql_Statement::getMyClass() const
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/sql/Statement");
- return theClass;
-}
-
-// -----------------------------------------------------------------------------
-void java_sql_Statement::createStatement(JNIEnv* _pEnv)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- if( _pEnv && !object ){
- // initialize temporary variable
- static const char * cSignature = "(II)Ljava/sql/Statement;";
- static const char * cMethodName = "createStatement";
- // Java-Call
- jobject out = NULL;
- static jmethodID mID(NULL);
- if ( !mID )
- mID = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature );
- if( mID ){
- out = _pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID,m_nResultSetType,m_nResultSetConcurrency );
- } //mID
- else
- {
- static const char * cSignature2 = "()Ljava/sql/Statement;";
- static jmethodID mID2 = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature2 );OSL_ENSURE(mID2,"Unknown method id!");
- if( mID2 ){
- out = _pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID2);
- } //mID
- }
- ThrowLoggedSQLException( m_aLogger, _pEnv, *this );
-
- if ( out )
- object = _pEnv->NewGlobalRef( out );
- } //_pEnv
-}
-// -----------------------------------------------------------------------------
-
-
-IMPLEMENT_SERVICE_INFO(java_sql_Statement,"com.sun.star.sdbcx.JStatement","com.sun.star.sdbc.Statement");
-// -----------------------------------------------------------------------------
-void SAL_CALL java_sql_Statement_Base::acquire() throw()
-{
- java_sql_Statement_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL java_sql_Statement_Base::release() throw()
-{
- java_sql_Statement_BASE::release();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL java_sql_Statement::acquire() throw()
-{
- OStatement_BASE2::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL java_sql_Statement::release() throw()
-{
- OStatement_BASE2::release();
-}
-// -----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL java_sql_Statement_Base::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx
deleted file mode 100644
index a78d8fe3de..0000000000
--- a/connectivity/source/drivers/jdbc/Object.cxx
+++ /dev/null
@@ -1,428 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-
-#include "java/lang/Class.hxx"
-#include "connectivity/CommonTools.hxx"
-#include <com/sun/star/uno/Exception.hpp>
-#include "java/tools.hxx"
-#include "java/sql/SQLException.hxx"
-#include <osl/mutex.hxx>
-#include <osl/thread.h>
-#include <com/sun/star/uno/Sequence.hxx>
-#include "java/LocalRef.hxx"
-#include "resource/jdbc_log.hrc"
-#include <rtl/logfile.hxx>
-#include <comphelper/logging.hxx>
-
-#include <memory>
-
-using namespace connectivity;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-
-
-// -----------------------------------------------------------------------------
-::rtl::Reference< jvmaccess::VirtualMachine > getJavaVM2(const ::rtl::Reference< jvmaccess::VirtualMachine >& _rVM = ::rtl::Reference< jvmaccess::VirtualMachine >(),
- sal_Bool _bSet = sal_False)
-{
- static ::rtl::Reference< jvmaccess::VirtualMachine > s_VM;
- if ( _rVM.is() || _bSet )
- s_VM = _rVM;
- return s_VM;
-}
-// -----------------------------------------------------------------------------
-::rtl::Reference< jvmaccess::VirtualMachine > java_lang_Object::getVM(const Reference<XMultiServiceFactory >& _rxFactory)
-{
- ::rtl::Reference< jvmaccess::VirtualMachine > xVM = getJavaVM2();
- if ( !xVM.is() && _rxFactory.is() )
- xVM = getJavaVM2(::connectivity::getJavaVM(_rxFactory));
-
- return xVM;
-}
-// -----------------------------------------------------------------------------
-SDBThreadAttach::SDBThreadAttach()
- : m_aGuard(java_lang_Object::getVM())
- , pEnv(NULL)
-{
- pEnv = m_aGuard.getEnvironment();
- OSL_ENSURE(pEnv,"Environment is nULL!");
-}
-// -----------------------------------------------------------------------------
-SDBThreadAttach::~SDBThreadAttach()
-{
-}
-// -----------------------------------------------------------------------------
-oslInterlockedCount& getJavaVMRefCount()
-{
- static oslInterlockedCount s_nRefCount = 0;
- return s_nRefCount;
-}
-// -----------------------------------------------------------------------------
-void SDBThreadAttach::addRef()
-{
- osl_incrementInterlockedCount(&getJavaVMRefCount());
-}
-// -----------------------------------------------------------------------------
-void SDBThreadAttach::releaseRef()
-{
- osl_decrementInterlockedCount(&getJavaVMRefCount());
- if ( getJavaVMRefCount() == 0 )
- {
- getJavaVM2(::rtl::Reference< jvmaccess::VirtualMachine >(),sal_True);
- }
-}
-// -----------------------------------------------------------------------------
-// static variables of the class
-jclass java_lang_Object::theClass = 0;
-
-jclass java_lang_Object::getMyClass() const
-{
- if( !theClass )
- theClass = findMyClass("java/lang/Object");
- return theClass;
-}
-// the actual constructor
-java_lang_Object::java_lang_Object(const Reference<XMultiServiceFactory >& _rxFactory)
- : m_xFactory(_rxFactory),object( 0 )
-{
- SDBThreadAttach::addRef();
-}
-
-// the protected-constructor for the derived classes
-java_lang_Object::java_lang_Object( JNIEnv * pXEnv, jobject myObj )
- : object( NULL )
-{
- SDBThreadAttach::addRef();
- if( pXEnv && myObj )
- object = pXEnv->NewGlobalRef( myObj );
-}
-
-java_lang_Object::~java_lang_Object()
-{
- if( object )
- {
- SDBThreadAttach t;
- clearObject(*t.pEnv);
- }
- SDBThreadAttach::releaseRef();
-}
-void java_lang_Object::clearObject(JNIEnv& rEnv)
-{
- if( object )
- {
- rEnv.DeleteGlobalRef( object );
- object = NULL;
- }
-}
-
-void java_lang_Object::clearObject()
-{
- if( object )
- {
- SDBThreadAttach t;
- clearObject(*t.pEnv);
- }
-}
-// the protected-constructor for the derived classes
-void java_lang_Object::saveRef( JNIEnv * pXEnv, jobject myObj )
-{
- OSL_ENSURE( myObj, "object in c++ -> Java Wrapper" );
- if( myObj )
- object = pXEnv->NewGlobalRef( myObj );
-}
-
-
-::rtl::OUString java_lang_Object::toString() const
-{
- static jmethodID mID(NULL);
- return callStringMethod("toString",mID);
-}
-
-// --------------------------------------------------------------------------------
-namespace
-{
- bool lcl_translateJNIExceptionToUNOException(
- JNIEnv* _pEnvironment, const Reference< XInterface >& _rxContext, SQLException& _out_rException )
- {
- jthrowable jThrow = _pEnvironment ? _pEnvironment->ExceptionOccurred() : NULL;
- if ( !jThrow )
- return false;
-
- _pEnvironment->ExceptionClear();
- // we have to clear the exception here because we want to handle it itself
-
- if ( _pEnvironment->IsInstanceOf( jThrow, java_sql_SQLException_BASE::st_getMyClass() ) )
- {
- ::std::auto_ptr< java_sql_SQLException_BASE > pException( new java_sql_SQLException_BASE( _pEnvironment, jThrow ) );
- _out_rException = SQLException( pException->getMessage(), _rxContext,
- pException->getSQLState(), pException->getErrorCode(), Any() );
- return true;
- }
- else if ( _pEnvironment->IsInstanceOf( jThrow, java_lang_Throwable::st_getMyClass() ) )
- {
- ::std::auto_ptr< java_lang_Throwable > pThrow( new java_lang_Throwable( _pEnvironment, jThrow ) );
- ::rtl::OUString sMessage = pThrow->getMessage();
- if ( !sMessage.getLength() )
- sMessage = pThrow->getLocalizedMessage();
- if( !sMessage.getLength() )
- sMessage = pThrow->toString();
- _out_rException = SQLException( sMessage, _rxContext, ::rtl::OUString(), -1, Any() );
- return true;
- }
- else
- _pEnvironment->DeleteLocalRef( jThrow );
- return false;
- }
-}
-
-// --------------------------------------------------------------------------------
-void java_lang_Object::ThrowLoggedSQLException( const ::comphelper::ResourceBasedEventLogger& _rLogger, JNIEnv* _pEnvironment,
- const Reference< XInterface >& _rxContext )
-{
- SQLException aException;
- if ( lcl_translateJNIExceptionToUNOException( _pEnvironment, _rxContext, aException ) )
- {
- _rLogger.log( ::com::sun::star::logging::LogLevel::SEVERE, STR_LOG_THROWING_EXCEPTION, aException.Message, aException.SQLState, aException.ErrorCode );
- throw aException;
- }
-}
-
-// --------------------------------------------------------------------------------
-void java_lang_Object::ThrowSQLException( JNIEnv* _pEnvironment, const Reference< XInterface>& _rxContext )
-{
- SQLException aException;
- if ( lcl_translateJNIExceptionToUNOException( _pEnvironment, _rxContext, aException ) )
- throw aException;
-}
-// -----------------------------------------------------------------------------
-void java_lang_Object::obtainMethodId(JNIEnv* _pEnv,const char* _pMethodName, const char* _pSignature,jmethodID& _inout_MethodID) const
-{
- if ( !_inout_MethodID )
- {
- _inout_MethodID = _pEnv->GetMethodID( getMyClass(), _pMethodName, _pSignature );
- OSL_ENSURE( _inout_MethodID, _pSignature );
- if ( !_inout_MethodID )
- throw SQLException();
- } // if ( !_inout_MethodID )
-}
-// -----------------------------------------------------------------------------
-sal_Bool java_lang_Object::callBooleanMethod( const char* _pMethodName, jmethodID& _inout_MethodID ) const
-{
- jboolean out( sal_False );
-
- SDBThreadAttach t;
- OSL_ENSURE( t.pEnv, "java_lang_Object::callBooleanMethod: no Java enviroment anymore!" );
- obtainMethodId(t.pEnv, _pMethodName,"()Z", _inout_MethodID);
- // call method
- out = t.pEnv->CallBooleanMethod( object, _inout_MethodID );
- ThrowSQLException( t.pEnv, NULL );
-
- return out;
-}
-// -----------------------------------------------------------------------------
-sal_Bool java_lang_Object::callBooleanMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument ) const
-{
- jboolean out( sal_False );
- SDBThreadAttach t;
- OSL_ENSURE( t.pEnv, "java_lang_Object::callBooleanMethodWithIntArg: no Java enviroment anymore!" );
- obtainMethodId(t.pEnv, _pMethodName,"(I)Z", _inout_MethodID);
- // call method
- out = t.pEnv->CallBooleanMethod( object, _inout_MethodID, _nArgument );
- ThrowSQLException( t.pEnv, NULL );
-
- return out;
-}
-// -------------------------------------------------------------------------
-jobject java_lang_Object::callResultSetMethod( JNIEnv& _rEnv,const char* _pMethodName, jmethodID& _inout_MethodID ) const
-{
- // call method
- jobject out = callObjectMethod(&_rEnv,_pMethodName,"()Ljava/sql/ResultSet;", _inout_MethodID);
- return out;
-}
-// -------------------------------------------------------------------------
-sal_Int32 java_lang_Object::callIntMethod( const char* _pMethodName, jmethodID& _inout_MethodID,bool _bIgnoreException ) const
-{
- SDBThreadAttach t;
- OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java enviroment anymore!" );
- obtainMethodId(t.pEnv, _pMethodName,"()I", _inout_MethodID);
-
- // call method
- jint out( t.pEnv->CallIntMethod( object, _inout_MethodID ) );
- if ( _bIgnoreException )
- isExceptionOccurred(t.pEnv,sal_True);
- else
- ThrowSQLException( t.pEnv, NULL );
-
- return (sal_Int32)out;
-}
-// -------------------------------------------------------------------------
-sal_Int32 java_lang_Object::callIntMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID,sal_Int32 _nArgument ) const
-{
- SDBThreadAttach t;
- OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java enviroment anymore!" );
- obtainMethodId(t.pEnv, _pMethodName,"(I)I", _inout_MethodID);
- // call method
- jint out( t.pEnv->CallIntMethod( object, _inout_MethodID , _nArgument) );
- ThrowSQLException( t.pEnv, NULL );
-
- return (sal_Int32)out;
-}
-// -------------------------------------------------------------------------
-void java_lang_Object::callVoidMethod( const char* _pMethodName, jmethodID& _inout_MethodID) const
-{
- SDBThreadAttach t;
- OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java enviroment anymore!" );
- obtainMethodId(t.pEnv, _pMethodName,"()V", _inout_MethodID);
-
- // call method
- t.pEnv->CallVoidMethod( object, _inout_MethodID );
- ThrowSQLException( t.pEnv, NULL );
-}
-// -------------------------------------------------------------------------
-void java_lang_Object::callVoidMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument,bool _bIgnoreException ) const
-{
- SDBThreadAttach t;
- OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java enviroment anymore!" );
- obtainMethodId(t.pEnv, _pMethodName,"(I)V", _inout_MethodID);
-
- // call method
- t.pEnv->CallVoidMethod( object, _inout_MethodID,_nArgument );
- if ( _bIgnoreException )
- isExceptionOccurred(t.pEnv,sal_True);
- else
- ThrowSQLException( t.pEnv, NULL );
-}
-// -------------------------------------------------------------------------
-void java_lang_Object::callVoidMethodWithBoolArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument,bool _bIgnoreException ) const
-{
- SDBThreadAttach t;
- OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java enviroment anymore!" );
- obtainMethodId(t.pEnv, _pMethodName,"(Z)V", _inout_MethodID);
- // call method
- t.pEnv->CallVoidMethod( object, _inout_MethodID,_nArgument );
- if ( _bIgnoreException )
- isExceptionOccurred(t.pEnv,sal_True);
- else
- ThrowSQLException( t.pEnv, NULL );
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString java_lang_Object::callStringMethod( const char* _pMethodName, jmethodID& _inout_MethodID ) const
-{
- SDBThreadAttach t;
- OSL_ENSURE( t.pEnv, "java_lang_Object::callStringMethod: no Java enviroment anymore!" );
-
- // call method
- jstring out = (jstring)callObjectMethod(t.pEnv,_pMethodName,"()Ljava/lang/String;", _inout_MethodID);
- return JavaString2String( t.pEnv, out );
-}
-// -----------------------------------------------------------------------------
-jobject java_lang_Object::callObjectMethod( JNIEnv * _pEnv,const char* _pMethodName,const char* _pSignature, jmethodID& _inout_MethodID ) const
-{
- // obtain method ID
- obtainMethodId(_pEnv, _pMethodName,_pSignature, _inout_MethodID);
- // call method
- jobject out = _pEnv->CallObjectMethod( object, _inout_MethodID);
- ThrowSQLException( _pEnv, NULL );
- return out;
-}
-
-// -----------------------------------------------------------------------------
-jobject java_lang_Object::callObjectMethodWithIntArg( JNIEnv * _pEnv,const char* _pMethodName,const char* _pSignature, jmethodID& _inout_MethodID , sal_Int32 _nArgument) const
-{
- obtainMethodId(_pEnv, _pMethodName,_pSignature, _inout_MethodID);
- // call method
- jobject out = _pEnv->CallObjectMethod( object, _inout_MethodID,_nArgument );
- ThrowSQLException( _pEnv, NULL );
- return out;
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString java_lang_Object::callStringMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID , sal_Int32 _nArgument) const
-{
- SDBThreadAttach t;
- OSL_ENSURE( t.pEnv, "java_lang_Object::callStringMethod: no Java enviroment anymore!" );
- jstring out = (jstring)callObjectMethodWithIntArg(t.pEnv,_pMethodName,"(I)Ljava/lang/String;",_inout_MethodID,_nArgument);
- return JavaString2String( t.pEnv, out );
-}
-// -------------------------------------------------------------------------
-void java_lang_Object::callVoidMethodWithStringArg( const char* _pMethodName, jmethodID& _inout_MethodID,const ::rtl::OUString& _nArgument ) const
-{
- SDBThreadAttach t;
- OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethod: no Java enviroment anymore!" );
- obtainMethodId(t.pEnv, _pMethodName,"(Ljava/lang/String;)V", _inout_MethodID);
-
- jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,_nArgument));
- // call method
- t.pEnv->CallVoidMethod( object, _inout_MethodID , str.get());
- ThrowSQLException( t.pEnv, NULL );
-}
-// -------------------------------------------------------------------------
-sal_Int32 java_lang_Object::callIntMethodWithStringArg( const char* _pMethodName, jmethodID& _inout_MethodID,const ::rtl::OUString& _nArgument ) const
-{
- SDBThreadAttach t;
- OSL_ENSURE( t.pEnv, "java_lang_Object::callIntMethodWithStringArg: no Java enviroment anymore!" );
- obtainMethodId(t.pEnv, _pMethodName,"(Ljava/lang/String;)I", _inout_MethodID);
-
- //TODO: Check if the code below is needed
- //jdbc::LocalRef< jstring > str( t.env(), convertwchar_tToJavaString( t.pEnv, sql ) );
- //{
- // jdbc::ContextClassLoaderScope ccl( t.env(),
- // m_pConnection ? m_pConnection->getDriverClassLoader() : jdbc::GlobalRef< jobject >(),
- // m_aLogger,
- // *this
- // );
-
- jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,_nArgument));
- // call method
- jint out = t.pEnv->CallIntMethod( object, _inout_MethodID , str.get());
- ThrowSQLException( t.pEnv, NULL );
- return (sal_Int32)out;
-}
-// -----------------------------------------------------------------------------
-jclass java_lang_Object::findMyClass(const char* _pClassName)
-{
- // the class must be fetched only once, therefore static
- SDBThreadAttach t;
- jclass tempClass = t.pEnv->FindClass(_pClassName); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!");
- if(!tempClass)
- {
- t.pEnv->ExceptionDescribe();
- t.pEnv->ExceptionClear();
- }
- jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass );
- t.pEnv->DeleteLocalRef( tempClass );
- return globClass;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
deleted file mode 100644
index 5c112dd70e..0000000000
--- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx
+++ /dev/null
@@ -1,668 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/sql/PreparedStatement.hxx"
-#include "java/sql/ResultSet.hxx"
-#include "java/sql/ResultSetMetaData.hxx"
-#include "java/sql/Connection.hxx"
-#include "java/sql/Timestamp.hxx"
-#include "java/math/BigDecimal.hxx"
-#include "java/tools.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/FValue.hxx"
-#include "connectivity/dbexception.hxx"
-#include "resource/jdbc_log.hrc"
-#include "resource/common_res.hrc"
-#include "resource/sharedresources.hxx"
-#include "java/LocalRef.hxx"
-#include <string.h>
-
-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;
-
-//**************************************************************
-//************ Class: java.sql.PreparedStatement
-//**************************************************************
-IMPLEMENT_SERVICE_INFO(java_sql_PreparedStatement,"com.sun.star.sdbcx.JPreparedStatement","com.sun.star.sdbc.PreparedStatement");
-
-java_sql_PreparedStatement::java_sql_PreparedStatement( JNIEnv * pEnv, java_sql_Connection& _rCon, const ::rtl::OUString& sql )
- : OStatement_BASE2( pEnv, _rCon )
-{
- m_sSqlStatement = sql;
-}
-// -----------------------------------------------------------------------------
-jclass java_sql_PreparedStatement::theClass = 0;
-
-java_sql_PreparedStatement::~java_sql_PreparedStatement()
-{
-}
-// -----------------------------------------------------------------------------
-
-jclass java_sql_PreparedStatement::getMyClass() const
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/sql/PreparedStatement");
- return theClass;
-}
-// -------------------------------------------------------------------------
-
-::com::sun::star::uno::Any SAL_CALL java_sql_PreparedStatement::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::com::sun::star::uno::Any aRet = OStatement_BASE2::queryInterface(rType);
- return aRet.hasValue() ? aRet : ::cppu::queryInterface( rType,
- static_cast< XPreparedStatement*>(this),
- static_cast< XParameters*>(this),
- static_cast< XResultSetMetaDataSupplier*>(this),
- static_cast< XPreparedBatchExecution*>(this));
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL java_sql_PreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedStatement > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< XParameters > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< XResultSetMetaDataSupplier > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedBatchExecution > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_BASE2::getTypes());
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_PreparedStatement::execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINE, STR_LOG_EXECUTING_PREPARED );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- static jmethodID mID(NULL);
- return callBooleanMethod( "execute", mID );
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL java_sql_PreparedStatement::executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- m_aLogger.log( LogLevel::FINE, STR_LOG_EXECUTING_PREPARED_UPDATE );
- static jmethodID mID(NULL);
- return callIntMethod("executeUpdate",mID);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- m_aLogger.log( LogLevel::FINER, STR_LOG_STRING_PARAMETER, parameterIndex, x );
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- { // initialize temporary Variable
- createStatement(t.pEnv);
- static const char * cSignature = "(ILjava/lang/String;)V";
- static const char * cMethodName = "setString";
- // Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,x));
- t.pEnv->CallVoidMethod( object, mID, parameterIndex,str.get());
- // and clean up
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- } //t.pEnv
-}
-// -------------------------------------------------------------------------
-
-::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL java_sql_PreparedStatement::getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return (Reference< XConnection >)m_pConnection;
-}
-// -------------------------------------------------------------------------
-
-::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_PreparedStatement::executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINE, STR_LOG_EXECUTING_PREPARED_QUERY );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jobject out = callResultSetMethod(t.env(),"executeQuery",mID);
-
- return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out, m_aLogger, *m_pConnection,this);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_BOOLEAN_PARAMETER, parameterIndex, x );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethod("setBoolean", "(IZ)V", mID, parameterIndex, x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_BYTE_PARAMETER, parameterIndex, (sal_Int32)x );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethod("setByte", "(IB)V", mID, parameterIndex, x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_DATE_PARAMETER, parameterIndex, x );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- java_sql_Date aT(x);
- static jmethodID mID(NULL);
- callVoidMethod("setDate", "(ILjava/sql/Date;)V", mID, parameterIndex, aT.getJavaObject());
-}
-// -------------------------------------------------------------------------
-
-
-void SAL_CALL java_sql_PreparedStatement::setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_TIME_PARAMETER, parameterIndex, x );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- java_sql_Time aT(x);
- static jmethodID mID(NULL);
- callVoidMethod("setTime", "(ILjava/sql/Time;)V", mID, parameterIndex, aT.getJavaObject());
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_TIMESTAMP_PARAMETER, parameterIndex, x );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- java_sql_Timestamp aD(x);
- callVoidMethod("setTimestamp", "(ILjava/sql/Timestamp;)V", mID, parameterIndex, aD.getJavaObject());
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_PreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_DOUBLE_PARAMETER, parameterIndex, x );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethod("setDouble", "(ID)V", mID, parameterIndex, x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_FLOAT_PARAMETER, parameterIndex, x );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethod("setFloat", "(IF)V", mID, parameterIndex, x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_INT_PARAMETER, parameterIndex, x );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethod("setInt", "(II)V", mID, parameterIndex, x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_LONG_PARAMETER, parameterIndex, x );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethod("setLong", "(IJ)V", mID, parameterIndex, x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_NULL_PARAMETER, parameterIndex, sqlType );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethod("setNull", "(II)V", mID, parameterIndex, sqlType);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setClob( sal_Int32 /*parameterIndex*/, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& /*x*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setClob", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setBlob( sal_Int32 /*parameterIndex*/, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& /*x*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setBlob", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& /*x*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setArray", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& /*x*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setRef", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_OBJECT_NULL_PARAMETER, parameterIndex );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
- createStatement(t.pEnv);
-
- // initialize temporary Variable
- static const char * cSignature = "(ILjava/lang/Object;II)V";
- static const char * cMethodName = "setObject";
- // Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- {
- jobject obj = NULL;
- double nTemp = 0.0;
- switch(targetSqlType)
- {
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- {
- ::std::auto_ptr<java_math_BigDecimal> pBigDecimal;
- if ( x >>= nTemp)
- {
- pBigDecimal.reset(new java_math_BigDecimal(nTemp));
- //setDouble(parameterIndex,nTemp);
- //return;
- }
- else
- {
- ORowSetValue aValue;
- aValue.fill(x);
- const ::rtl::OUString sValue = aValue;
- if ( sValue.getLength() )
- pBigDecimal.reset(new java_math_BigDecimal(sValue));
- else
- pBigDecimal.reset(new java_math_BigDecimal(0.0));
- }
- //obj = convertwchar_tToJavaString(t.pEnv,::comphelper::getString(x));
- t.pEnv->CallVoidMethod( object, mID, parameterIndex,pBigDecimal->getJavaObject(),targetSqlType,scale);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- return;
- }
- default:
- obj = convertwchar_tToJavaString(t.pEnv,::comphelper::getString(x));
- break;
- }
- t.pEnv->CallVoidMethod( object, mID, parameterIndex,obj,targetSqlType,scale);
- t.pEnv->DeleteLocalRef(obj);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- // and clean up
- } //mID
- } //t.pEnv
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/, const ::rtl::OUString& /*typeName*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_OBJECT_NULL_PARAMETER, parameterIndex );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethod<jobject>("setObject", "(ILjava/lang/Object;)V", mID, parameterIndex, NULL);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- if(!::dbtools::implSetObject(this,parameterIndex,x))
- {
- const ::rtl::OUString sError( m_pConnection->getResources().getResourceStringWithSubstitution(
- STR_UNKNOWN_PARA_TYPE,
- "$position$", ::rtl::OUString::valueOf(parameterIndex)
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_SHORT_PARAMETER, parameterIndex, x );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethod("setShort", "(IS)V", mID, parameterIndex, x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_BYTES_PARAMETER, parameterIndex );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
- createStatement(t.pEnv);
-
- // initialize temporary Variable
- static const char * cSignature = "(I[B)V";
- static const char * cMethodName = "setBytes";
- // Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- jbyteArray pByteArray = t.pEnv->NewByteArray(x.getLength());
- t.pEnv->SetByteArrayRegion(pByteArray,0,x.getLength(),(jbyte*)x.getConstArray());
- t.pEnv->CallVoidMethod( object, mID, parameterIndex,pByteArray);
- t.pEnv->DeleteLocalRef(pByteArray);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- } //t.pEnv
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_CHARSTREAM_PARAMETER, parameterIndex );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
- createStatement(t.pEnv);
-
- // initialize temporary variable
- static const char * cSignature = "(ILjava/io/InputStream;I)V";
- static const char * cMethodName = "setCharacterStream";
- // Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- Sequence< sal_Int8 > aSeq;
- if ( x.is() )
- x->readBytes( aSeq, length );
- sal_Int32 actualLength = aSeq.getLength();
-
- jvalue args2[3];
- jbyteArray pByteArray = t.pEnv->NewByteArray( actualLength );
- t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,(jbyte*)aSeq.getConstArray());
- args2[0].l = pByteArray;
- args2[1].i = 0;
- args2[2].i = actualLength;
- // initialize temporary variable
- const char * cSignatureStream = "([BII)V";
- // Java-Call
- jclass aClass = t.pEnv->FindClass("java/io/CharArrayInputStream");
- static jmethodID mID2 = NULL;
- if ( !mID2 )
- mID2 = t.pEnv->GetMethodID( aClass, "<init>", cSignatureStream );
- jobject tempObj = NULL;
- if(mID2)
- tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 );
-
- t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,actualLength);
- // and clean up
- t.pEnv->DeleteLocalRef(pByteArray);
- t.pEnv->DeleteLocalRef(tempObj);
- t.pEnv->DeleteLocalRef(aClass);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- } //t.pEnv
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_BINARYSTREAM_PARAMETER, parameterIndex );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
- createStatement(t.pEnv);
- // initialize temporary variable
- static const char * cSignature = "(ILjava/io/InputStream;I)V";
- static const char * cMethodName = "setBinaryStream";
- // Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- {
- Sequence< sal_Int8 > aSeq;
- if ( x.is() )
- x->readBytes( aSeq, length );
- sal_Int32 actualLength = aSeq.getLength();
-
- jvalue args2[3];
- jbyteArray pByteArray = t.pEnv->NewByteArray(actualLength);
- t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,(jbyte*)aSeq.getConstArray());
- args2[0].l = pByteArray;
- args2[1].i = 0;
- args2[2].i = (sal_Int32)actualLength;
-
- // initialize temporary variable
- const char * cSignatureStream = "([BII)V";
- // Java-Call
- jclass aClass = t.pEnv->FindClass("java/io/ByteArrayInputStream");
- static jmethodID mID2 = NULL;
- if ( !mID2 )
- mID2 = t.pEnv->GetMethodID( aClass, "<init>", cSignatureStream );
- jobject tempObj = NULL;
- if(mID2)
- tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 );
- t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,(sal_Int32)actualLength);
- // and clean up
- t.pEnv->DeleteLocalRef(pByteArray);
- t.pEnv->DeleteLocalRef(tempObj);
- t.pEnv->DeleteLocalRef(aClass);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
- } //t.pEnv
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- m_aLogger.log( LogLevel::FINER, STR_LOG_CLEAR_PARAMETERS );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- SDBThreadAttach t;
- {
- createStatement(t.pEnv);
-
- static jmethodID mID(NULL);
- callVoidMethod("clearParameters",mID);
- } //t.pEnv
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_PreparedStatement::clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethod("clearBatch",mID);
- } //t.pEnv
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_PreparedStatement::addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- callVoidMethod("addBatch",mID);
- } //t.pEnv
-}
-// -------------------------------------------------------------------------
-
-::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL java_sql_PreparedStatement::executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- ::com::sun::star::uno::Sequence< sal_Int32 > aSeq;
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jintArray out = (jintArray)callObjectMethod(t.pEnv,"executeBatch","()[I", mID);
- if(out)
- {
- jboolean p = sal_False;
- aSeq.realloc(t.pEnv->GetArrayLength(out));
- memcpy(aSeq.getArray(),t.pEnv->GetIntArrayElements(out,&p),aSeq.getLength());
- t.pEnv->DeleteLocalRef(out);
- }
- return aSeq;
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL java_sql_PreparedStatement::getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- createStatement(t.pEnv);
- static jmethodID mID(NULL);
- jobject out = callObjectMethod(t.pEnv,"getMetaData","()Ljava/sql/ResultSetMetaData;", mID);
-
- return out==0 ? 0 : new java_sql_ResultSetMetaData( t.pEnv, out, m_aLogger,*m_pConnection );
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL java_sql_PreparedStatement::acquire() throw()
-{
- OStatement_BASE2::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL java_sql_PreparedStatement::release() throw()
-{
- OStatement_BASE2::release();
-}
-// -----------------------------------------------------------------------------
-void java_sql_PreparedStatement::createStatement(JNIEnv* _pEnv)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
-
- if( !object && _pEnv ){
- // initialize temporary variable
- static const char * cSignature = "(Ljava/lang/String;II)Ljava/sql/PreparedStatement;";
- static const char * cMethodName = "prepareStatement";
-
- jvalue args[1];
- // convert Parameter
- args[0].l = convertwchar_tToJavaString(_pEnv,m_sSqlStatement);
- // Java-Call
- jobject out = NULL;
- static jmethodID mID(NULL);
- if ( !mID )
- mID = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature );
- if( mID )
- {
- out = _pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID, args[0].l ,m_nResultSetType,m_nResultSetConcurrency);
- }
- else
- {
- static const char * cSignature2 = "(Ljava/lang/String;)Ljava/sql/PreparedStatement;";
- static jmethodID mID2 = NULL;
- if ( !mID2)
- mID2 = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature2 );OSL_ENSURE(mID,"Unknown method id!");
- if ( mID2 )
- out = _pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID2, args[0].l );
- }
- _pEnv->DeleteLocalRef((jstring)args[0].l);
- ThrowLoggedSQLException( m_aLogger, _pEnv, *this );
- if ( out )
- object = _pEnv->NewGlobalRef( out );
- } //t.pEnv
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/Reader.cxx b/connectivity/source/drivers/jdbc/Reader.cxx
deleted file mode 100644
index 9998b6c87d..0000000000
--- a/connectivity/source/drivers/jdbc/Reader.cxx
+++ /dev/null
@@ -1,121 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/io/Reader.hxx"
-#include <string.h>
-using namespace connectivity;
-
-//**************************************************************
-//************ Class: java.io.Reader
-//**************************************************************
-
-jclass java_io_Reader::theClass = 0;
-java_io_Reader::java_io_Reader( JNIEnv * pEnv, jobject myObj )
- : java_lang_Object( pEnv, myObj )
-{
- SDBThreadAttach::addRef();
-}
-java_io_Reader::~java_io_Reader()
-{
- SDBThreadAttach::releaseRef();
-}
-
-jclass java_io_Reader::getMyClass() const
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/io/Reader");
- return theClass;
-}
-
-sal_Int32 SAL_CALL java_io_Reader::readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- return readBytes(aData,nMaxBytesToRead);
-}
-
-void SAL_CALL java_io_Reader::skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- static jmethodID mID(NULL);
- callIntMethodWithIntArg("skip",mID,nBytesToSkip);
-}
-
-sal_Int32 SAL_CALL java_io_Reader::available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- jboolean out(sal_False);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- static const char * cSignature = "()Z";
- static const char * cMethodName = "available";
- // Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- out = t.pEnv->CallBooleanMethod( object, mID);
- ThrowSQLException(t.pEnv,*this);
- } //t.pEnv
- return out;
-}
-
-void SAL_CALL java_io_Reader::closeInput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- static jmethodID mID(NULL);
- callVoidMethod("close",mID);
-}
-// -----------------------------------------------------
-sal_Int32 SAL_CALL java_io_Reader::readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- OSL_ENSURE(aData.getLength() < nBytesToRead," Sequence is smaller than BytesToRead");
- jint out(0);
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
-
- {
- jcharArray pCharArray = t.pEnv->NewCharArray(nBytesToRead);
- static const char * cSignature = "([CII)I";
- static const char * cMethodName = "read";
- // Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- out = t.pEnv->CallIntMethod( object, mID, pCharArray, 0, nBytesToRead );
- if ( !out )
- ThrowSQLException(t.pEnv,*this);
- if(out > 0)
- {
- jboolean p = sal_False;
- if(aData.getLength() < out)
- aData.realloc(out-aData.getLength());
-
- memcpy(aData.getArray(),t.pEnv->GetCharArrayElements(pCharArray,&p),out);
- }
- t.pEnv->DeleteLocalRef((jcharArray)pCharArray);
- } //t.pEnv
- return out;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/Ref.cxx b/connectivity/source/drivers/jdbc/Ref.cxx
deleted file mode 100644
index ad49a24f76..0000000000
--- a/connectivity/source/drivers/jdbc/Ref.cxx
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/sql/Ref.hxx"
-#include "java/tools.hxx"
-using namespace connectivity;
-//**************************************************************
-//************ Class: java.sql.Ref
-//**************************************************************
-
-jclass java_sql_Ref::theClass = 0;
-java_sql_Ref::java_sql_Ref( JNIEnv * pEnv, jobject myObj )
-: java_lang_Object( pEnv, myObj )
-{
- SDBThreadAttach::addRef();
-}
-java_sql_Ref::~java_sql_Ref()
-{
- SDBThreadAttach::releaseRef();
-}
-
-jclass java_sql_Ref::getMyClass() const
-{
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/sql/Ref");
- return theClass;
-}
-
-::rtl::OUString SAL_CALL java_sql_Ref::getBaseTypeName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- static jmethodID mID(NULL);
- return callStringMethod("getBaseTypeName",mID);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx
deleted file mode 100644
index 64a17ad1ca..0000000000
--- a/connectivity/source/drivers/jdbc/ResultSet.cxx
+++ /dev/null
@@ -1,1088 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/lang/String.hxx"
-#include "java/lang/Boolean.hxx"
-#include "java/sql/ResultSet.hxx"
-#include "java/math/BigDecimal.hxx"
-#include "java/sql/JStatement.hxx"
-#include "java/sql/SQLWarning.hxx"
-#include "java/sql/Timestamp.hxx"
-#include "java/sql/Array.hxx"
-#include "java/sql/Ref.hxx"
-#include "java/sql/Clob.hxx"
-#include "java/sql/Timestamp.hxx"
-#include "java/sql/Blob.hxx"
-#include "java/sql/ResultSetMetaData.hxx"
-#include "java/io/InputStream.hxx"
-#include "java/io/Reader.hxx"
-#include "java/tools.hxx"
-#include <comphelper/property.hxx>
-#include "connectivity/CommonTools.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include "TConnection.hxx"
-#include <comphelper/types.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/dbexception.hxx"
-#include "resource/common_res.hrc"
-#include "resource/sharedresources.hxx"
-#include "java/LocalRef.hxx"
-
-#include <rtl/logfile.hxx>
-#include <string.h>
-
-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;
-
-IMPLEMENT_SERVICE_INFO(java_sql_ResultSet,"com.sun.star.sdbcx.JResultSet","com.sun.star.sdbc.ResultSet");
-//**************************************************************
-//************ Class: java.sql.ResultSet
-//**************************************************************
-
-jclass java_sql_ResultSet::theClass = 0;
-java_sql_ResultSet::java_sql_ResultSet( JNIEnv * pEnv, jobject myObj, const java::sql::ConnectionLog& _rParentLogger,java_sql_Connection& _rConnection, java_sql_Statement_Base* pStmt)
- :java_sql_ResultSet_BASE(m_aMutex)
- ,java_lang_Object( pEnv, myObj )
- ,OPropertySetHelper(java_sql_ResultSet_BASE::rBHelper)
- ,m_aLogger( _rParentLogger, java::sql::ConnectionLog::RESULTSET )
- ,m_pConnection(&_rConnection)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::java_sql_ResultSet" );
- SDBThreadAttach::addRef();
- osl_incrementInterlockedCount(&m_refCount);
- if ( pStmt )
- m_xStatement = *pStmt;
-
- osl_decrementInterlockedCount(&m_refCount);
-}
-// -----------------------------------------------------------------------------
-java_sql_ResultSet::~java_sql_ResultSet()
-{
- if ( !java_sql_ResultSet_BASE::rBHelper.bDisposed && !java_sql_ResultSet_BASE::rBHelper.bInDispose )
- {
- // increment ref count to prevent double call of Dtor
- osl_incrementInterlockedCount( &m_refCount );
- dispose();
- }
-}
-
-jclass java_sql_ResultSet::getMyClass() const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getMyClass" );
- // the class must be fetched only once, therefore static
- if( !theClass )
- theClass = findMyClass("java/sql/ResultSet");
- return theClass;
-}
-
-// -------------------------------------------------------------------------
-void java_sql_ResultSet::disposing(void)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::disposing" );
- OPropertySetHelper::disposing();
-
- ::osl::MutexGuard aGuard(m_aMutex);
-m_xMetaData.clear();
- if( object )
- {
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- static jmethodID mID(NULL);
- callVoidMethod("close",mID);
- clearObject(*t.pEnv);
- }
-
- SDBThreadAttach::releaseRef();
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Any SAL_CALL java_sql_ResultSet::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::queryInterface" );
- ::com::sun::star::uno::Any aRet = OPropertySetHelper::queryInterface(rType);
- return aRet.hasValue() ? aRet : java_sql_ResultSet_BASE::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL java_sql_ResultSet::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getTypes" );
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ),
- ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),java_sql_ResultSet_BASE::getTypes());
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL java_sql_ResultSet::findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::findColumn" );
- static jmethodID mID(NULL);
- return callIntMethodWithStringArg("findColumn",mID,columnName);
-}
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBinaryStream" );
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getBinaryStream","(I)Ljava/io/InputStream;", mID, columnIndex);
-
- // WARNING: the caller becomes the owner of the returned pointer
- return out==0 ? 0 : new java_io_InputStream( t.pEnv, out );
-}
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getCharacterStream" );
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getCharacterStream","(I)Ljava/io/Reader;", mID, columnIndex);
-
- // WARNING: the caller becomes the owner of the returned pointer
- return out==0 ? 0 : new java_io_Reader( t.pEnv, out );
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_ResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBoolean" );
- static jmethodID mID(NULL);
- return callBooleanMethodWithIntArg( "getBoolean", mID,columnIndex );
-}
-// -------------------------------------------------------------------------
-
-sal_Int8 SAL_CALL java_sql_ResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getByte" );
- static jmethodID mID(NULL);
- jbyte (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallByteMethod;
- return callMethodWithIntArg<jbyte>(pCallMethod,"getByte","(I)B",mID,columnIndex);
-}
-// -------------------------------------------------------------------------
-
-Sequence< sal_Int8 > SAL_CALL java_sql_ResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBytes" );
- Sequence< sal_Int8 > aSeq;
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- static jmethodID mID(NULL);
- jbyteArray out = (jbyteArray)callObjectMethodWithIntArg(t.pEnv,"getBytes","(I)[B", mID, columnIndex);
- if (out)
- {
- jboolean p = sal_False;
- aSeq.realloc(t.pEnv->GetArrayLength(out));
- memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength());
- t.pEnv->DeleteLocalRef(out);
- }
- return aSeq;
-}
-// -------------------------------------------------------------------------
-
-::com::sun::star::util::Date SAL_CALL java_sql_ResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getDate" );
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getDate","(I)Ljava/sql/Date;", mID, columnIndex);
- // WARNING: the caller becomes the owner of the returned pointer
- return out ? static_cast <com::sun::star::util::Date> (java_sql_Date( t.pEnv, out )) : ::com::sun::star::util::Date();
-}
-// -------------------------------------------------------------------------
-
-double SAL_CALL java_sql_ResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getDouble" );
- static jmethodID mID(NULL);
- jdouble (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallDoubleMethod;
- return callMethodWithIntArg<double>(pCallMethod,"getDouble","(I)D",mID,columnIndex);
-}
-// -------------------------------------------------------------------------
-
-float SAL_CALL java_sql_ResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFloat" );
- static jmethodID mID(NULL);
- jfloat (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallFloatMethod;
- return callMethodWithIntArg<jfloat>(pCallMethod,"getFloat","(I)F",mID,columnIndex);
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL java_sql_ResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getInt" );
- static jmethodID mID(NULL);
- return callIntMethodWithIntArg("getInt",mID,columnIndex);
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL java_sql_ResultSet::getRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getRow" );
- static jmethodID mID(NULL);
- return callIntMethod("getRow",mID);
-}
-// -------------------------------------------------------------------------
-
-sal_Int64 SAL_CALL java_sql_ResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getLong" );
- static jmethodID mID(NULL);
- jlong (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallLongMethod;
- return callMethodWithIntArg<jlong>(pCallMethod,"getLong","(I)J",mID,columnIndex);
-}
-// -------------------------------------------------------------------------
-
-::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL java_sql_ResultSet::getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getMetaData" );
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- static jmethodID mID(NULL);
- jobject out = callObjectMethod(t.pEnv,"getMetaData","()Ljava/sql/ResultSetMetaData;", mID);
-
- return out==0 ? 0 : new java_sql_ResultSetMetaData( t.pEnv, out, m_aLogger,*m_pConnection );
-}
-// -------------------------------------------------------------------------
-Reference< XArray > SAL_CALL java_sql_ResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getArray" );
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getArray","(I)Ljava/sql/Array;", mID, columnIndex);
-
- // WARNING: the caller becomes the owner of the returned pointer
- return out==0 ? 0 : new java_sql_Array( t.pEnv, out );
-}
-// -------------------------------------------------------------------------
-
-Reference< XClob > SAL_CALL java_sql_ResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getClob" );
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getClob","(I)Ljava/sql/Clob;", mID, columnIndex);
- // WARNING: the caller becomes the owner of the returned pointer
- return out==0 ? 0 : new java_sql_Clob( t.pEnv, out );
-}
-// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL java_sql_ResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBlob" );
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getBlob","(I)Ljava/sql/Blob;", mID, columnIndex);
- // WARNING: the caller becomes the owner of the returned pointer
- return out==0 ? 0 : new java_sql_Blob( t.pEnv, out );
-}
-// -------------------------------------------------------------------------
-
-Reference< XRef > SAL_CALL java_sql_ResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getRef" );
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getRef","(I)Ljava/sql/Ref;", mID, columnIndex);
-
- // WARNING: the caller becomes the owner of the returned pointer
- return out==0 ? 0 : new java_sql_Ref( t.pEnv, out );
-}
-// -------------------------------------------------------------------------
-
-Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getObject" );
- jobject out(0);
- Any aRet;
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- {
- jvalue args[2];
- // convert parameter
- args[0].i = (sal_Int32)columnIndex;
- args[1].l = convertTypeMapToJavaMap(t.pEnv,typeMap);
- // initialize temporary Variable
- // Java-Call
- static jmethodID mID(NULL);
- if ( !mID )
- {
- static const char * cSignature = "(I)Ljava/lang/Object;";
- static const char * cMethodName = "getObject";
-
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- }
-
- out = t.pEnv->CallObjectMethodA( object, mID, args);
- t.pEnv->DeleteLocalRef((jstring)args[1].l);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- // and clean up
- if ( out )
- {
- if ( t.pEnv->IsInstanceOf(out,java_lang_String::st_getMyClass()) )
- {
- java_lang_String aVal(t.pEnv,out);
- aRet <<= (::rtl::OUString)aVal;
- }
- else if ( t.pEnv->IsInstanceOf(out,java_lang_Boolean::st_getMyClass()) )
- {
- java_lang_Boolean aVal(t.pEnv,out);
- static jmethodID methodID = NULL;
- aRet <<= aVal.callBooleanMethod("booleanValue",methodID);
- }
- else if ( t.pEnv->IsInstanceOf(out,java_sql_Date::st_getMyClass()) )
- {
- java_sql_Date aVal(t.pEnv,out);
- aRet <<= (::com::sun::star::util::Date)aVal;
- }
- else if ( t.pEnv->IsInstanceOf(out,java_sql_Time::st_getMyClass()) )
- {
- java_sql_Time aVal(t.pEnv,out);
- aRet <<= (::com::sun::star::util::Time)aVal;
- }
- else if ( t.pEnv->IsInstanceOf(out,java_sql_Timestamp::st_getMyClass()) )
- {
- java_sql_Timestamp aVal(t.pEnv,out);
- aRet <<= (::com::sun::star::util::DateTime)aVal;
- }
- else
- t.pEnv->DeleteLocalRef(out);
- }
- } //t.pEnv
- return aRet;
-}
-// -------------------------------------------------------------------------
-
-sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getShort" );
- static jmethodID mID(NULL);
- jshort (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallShortMethod;
- return callMethodWithIntArg<jshort>(pCallMethod,"getShort","(I)S",mID,columnIndex);
-}
-// -------------------------------------------------------------------------
-
-
-::rtl::OUString SAL_CALL java_sql_ResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getString" );
- static jmethodID mID(NULL);
- return callStringMethodWithIntArg("getString",mID,columnIndex);
-}
-// -------------------------------------------------------------------------
-
-
-::com::sun::star::util::Time SAL_CALL java_sql_ResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getTime" );
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getTime","(I)Ljava/sql/Time;", mID, columnIndex);
- // WARNING: the caller becomes the owner of the returned pointer
- return out ? static_cast <com::sun::star::util::Time> (java_sql_Time( t.pEnv, out )) : ::com::sun::star::util::Time();
-}
-// -------------------------------------------------------------------------
-
-
-::com::sun::star::util::DateTime SAL_CALL java_sql_ResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getTimestamp" );
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- static jmethodID mID(NULL);
- jobject out = callObjectMethodWithIntArg(t.pEnv,"getTimestamp","(I)Ljava/sql/Timestamp;", mID, columnIndex);
- // WARNING: the caller becomes the owner of the returned pointer
- return out ? static_cast <com::sun::star::util::DateTime> (java_sql_Timestamp( t.pEnv, out )) : ::com::sun::star::util::DateTime();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_ResultSet::isAfterLast( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isAfterLast" );
- static jmethodID mID(NULL);
- return callBooleanMethod( "isAfterLast", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_ResultSet::isFirst( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isFirst" );
- static jmethodID mID(NULL);
- return callBooleanMethod( "isFirst", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_ResultSet::isLast( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isLast" );
- static jmethodID mID(NULL);
- return callBooleanMethod( "isLast", mID );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::beforeFirst( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::beforeFirst" );
- static jmethodID mID(NULL);
- callVoidMethod("beforeFirst",mID);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::afterLast( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::afterLast" );
- static jmethodID mID(NULL);
- callVoidMethod("afterLast",mID);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::close" );
- dispose();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_ResultSet::first( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::first" );
- static jmethodID mID(NULL);
- return callBooleanMethod( "first", mID );
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_ResultSet::last( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::last" );
- static jmethodID mID(NULL);
- return callBooleanMethod( "last", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_ResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::absolute" );
- static jmethodID mID(NULL);
- return callBooleanMethodWithIntArg( "absolute", mID,row );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_ResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::relative" );
- static jmethodID mID(NULL);
- return callBooleanMethodWithIntArg( "relative", mID,row );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_ResultSet::previous( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::previous" );
- static jmethodID mID(NULL);
- return callBooleanMethod( "previous", mID );
-}
-// -------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL java_sql_ResultSet::getStatement( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getStatement" );
- return m_xStatement;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_ResultSet::rowDeleted( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowDeleted" );
- static jmethodID mID(NULL);
- return callBooleanMethod( "rowDeleted", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_ResultSet::rowInserted( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowInserted" );
- static jmethodID mID(NULL);
- return callBooleanMethod( "rowInserted", mID );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_ResultSet::rowUpdated( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowUpdated" );
- static jmethodID mID(NULL);
- return callBooleanMethod( "rowUpdated", mID );
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_ResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isBeforeFirst" );
- static jmethodID mID(NULL);
- return callBooleanMethod( "isBeforeFirst", mID );
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_ResultSet::next( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::next" );
- static jmethodID mID(NULL);
- return callBooleanMethod( "next", mID );
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_ResultSet::wasNull( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::wasNull" );
- static jmethodID mID(NULL);
- return callBooleanMethod( "wasNull", mID );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::cancel( ) throw(::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::cancel" );
- static jmethodID mID(NULL);
- callVoidMethod("cancel",mID);
-}
-// -------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::clearWarnings" );
- static jmethodID mID(NULL);
- callVoidMethod("clearWarnings",mID);
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Any SAL_CALL java_sql_ResultSet::getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getWarnings" );
- SDBThreadAttach t;
- static jmethodID mID(NULL);
- jobject out = callObjectMethod(t.pEnv,"getWarnings","()Ljava/sql/SQLWarning;", mID);
- // WARNING: the caller becomes the owner of the returned pointer
- if( out )
- {
- java_sql_SQLWarning_BASE warn_base( t.pEnv, out );
- return makeAny(
- static_cast< starsdbc::SQLException >(
- java_sql_SQLWarning(warn_base,*this)));
- }
-
- return ::com::sun::star::uno::Any();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::insertRow" );
- static jmethodID mID(NULL);
- callVoidMethod("insertRow",mID);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateRow" );
- static jmethodID mID(NULL);
- callVoidMethod("updateRow",mID);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::deleteRow" );
- static jmethodID mID(NULL);
- callVoidMethod("deleteRow",mID);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::cancelRowUpdates" );
- static jmethodID mID(NULL);
- callVoidMethod("cancelRowUpdates",mID);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::moveToInsertRow" );
- static jmethodID mID(NULL);
- callVoidMethod("moveToInsertRow",mID);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::moveToCurrentRow" );
- static jmethodID mID(NULL);
- callVoidMethod("moveToCurrentRow",mID);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateNull" );
- static jmethodID mID(NULL);
- callVoidMethodWithIntArg("updateNull",mID,columnIndex);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBoolean" );
- static jmethodID mID(NULL);
- callVoidMethod("updateBoolean", "(IZ)V", mID, columnIndex, x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateByte" );
- static jmethodID mID(NULL);
- callVoidMethod("updateByte", "(IB)V", mID, columnIndex, x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateShort" );
- static jmethodID mID(NULL);
- callVoidMethod("updateShort", "(IS)V", mID, columnIndex, x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateInt" );
- static jmethodID mID(NULL);
- callVoidMethod("updateInt", "(II)V", mID, columnIndex, x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateLong" );
- static jmethodID mID(NULL);
- callVoidMethod("updateLong", "(IJ)V", mID, columnIndex, x);
-}
-// -------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateFloat" );
- static jmethodID mID(NULL);
- callVoidMethod("updateFloat", "(IF)V", mID, columnIndex, x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateDouble" );
- static jmethodID mID(NULL);
- callVoidMethod("updateDouble", "(ID)V", mID, columnIndex, x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateString" );
- SDBThreadAttach t;
-
- {
-
- // initialize temporary variable
- // Java-Call
- static jmethodID mID(NULL);
- if ( !mID )
- {
- static const char * cSignature = "(ILjava/lang/String;)V";
- static const char * cMethodName = "updateString";
-
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- }
-
- {
- // convert parameter
- jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,x));
- t.pEnv->CallVoidMethod( object, mID,columnIndex,str.get());
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
- }
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBytes" );
- SDBThreadAttach t;
-
- {
- // initialize temporary variable
- // Java-Call
- static jmethodID mID(NULL);
- if ( !mID )
- {
- static const char * cSignature = "(I[B)V";
- static const char * cMethodName = "updateBytes";
-
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- }
-
- {
- jbyteArray aArray = t.pEnv->NewByteArray(x.getLength());
- t.pEnv->SetByteArrayRegion(aArray,0,x.getLength(),(jbyte*)x.getConstArray());
- // convert parameter
- t.pEnv->CallVoidMethod( object, mID,columnIndex,aArray);
- t.pEnv->DeleteLocalRef(aArray);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
- }
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateDate" );
- java_sql_Date aD(x);
- static jmethodID mID(NULL);
- callVoidMethod("updateDate", "(ILjava/sql/Date;)V", mID, columnIndex, aD.getJavaObject());
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateTime" );
- java_sql_Time aD(x);
- static jmethodID mID(NULL);
- callVoidMethod("updateTime", "(ILjava/sql/Time;)V", mID, columnIndex, aD.getJavaObject());
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateTimestamp" );
- java_sql_Timestamp aD(x);
- static jmethodID mID(NULL);
- callVoidMethod("updateTimestamp", "(ILjava/sql/Timestamp;)V", mID, columnIndex, aD.getJavaObject());
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBinaryStream" );
- try
- {
- SDBThreadAttach t;
- {
-
- // initialize temporary variable
- // Java-Call
- static jmethodID mID(NULL);
- if ( !mID )
- {
- static const char * cSignature = "(ILjava/io/InputStream;I)V";
- static const char * cMethodName = "updateBinaryStream";
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- }
-
- {
- // convert Parameter
- jobject obj = createByteInputStream(x,length);
- t.pEnv->CallVoidMethod( object, mID, columnIndex,obj,length);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
- }
- }
- catch(const Exception&)
- {
- ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateBinaryStream", *this );
- }
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateCharacterStream" );
- try
- {
- SDBThreadAttach t;
- {
-
- // initialize temporary variable
- // Java-Call
- static jmethodID mID(NULL);
- if ( !mID )
- {
- static const char * cSignature = "(ILjava/io/Reader;I)V";
- static const char * cMethodName = "updateCharacterStream";
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- }
-
- {
- // convert Parameter
- jobject obj = createCharArrayReader(x,length);
- t.pEnv->CallVoidMethod( object, mID, columnIndex,obj,length);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
- }
- }
- catch(const Exception&)
- {
- ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateCharacterStream", *this );
- }
-}
-// -------------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateObject" );
- if(!::dbtools::implUpdateObject(this,columnIndex,x))
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(
- STR_UNKNOWN_COLUMN_TYPE,
- "$position$", ::rtl::OUString::valueOf(columnIndex)
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL java_sql_ResultSet::updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateNumericObject" );
- // OSL_FAIL("java_sql_ResultSet::updateNumericObject: NYI");
- try
- {
- SDBThreadAttach t;
-
- {
-
- // initialize temporary variable
- // Java-Call
- static jmethodID mID(NULL);
- if ( !mID )
- {
- static const char * cSignature = "(ILjava/lang/Object;I)V";
- static const char * cMethodName = "updateObject";
-
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- }
-
- {
- // convert parameter
- double nTemp = 0.0;
- ::std::auto_ptr<java_math_BigDecimal> pBigDecimal;
- if ( x >>= nTemp)
- {
- pBigDecimal.reset(new java_math_BigDecimal(nTemp));
- }
- else
- pBigDecimal.reset(new java_math_BigDecimal(::comphelper::getString(x)));
-
- t.pEnv->CallVoidMethod( object, mID, columnIndex,pBigDecimal->getJavaObject(),scale);
- ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
- }
- }
- }
- catch(const Exception&)
- {
- updateObject( columnIndex,x);
- }
-}
-//------------------------------------------------------------------------------
-sal_Int32 java_sql_ResultSet::getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getResultSetConcurrency" );
- static jmethodID mID(NULL);
- return callIntMethod("getConcurrency",mID,true);
-}
-//------------------------------------------------------------------------------
-sal_Int32 java_sql_ResultSet::getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getResultSetType" );
- static jmethodID mID(NULL);
- return callIntMethod("getType",mID,true);
-}
-//------------------------------------------------------------------------------
-sal_Int32 java_sql_ResultSet::getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFetchDirection" );
- static jmethodID mID(NULL);
- return callIntMethod("getFetchDirection",mID,true);
-}
-//------------------------------------------------------------------------------
-sal_Int32 java_sql_ResultSet::getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFetchSize" );
- static jmethodID mID(NULL);
- return callIntMethod("getFetchSize",mID,true);
-}
-//------------------------------------------------------------------------------
-::rtl::OUString java_sql_ResultSet::getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getCursorName" );
- static jmethodID mID(NULL);
- return callStringMethod("getCursorName",mID);
-}
-
-//------------------------------------------------------------------------------
-void java_sql_ResultSet::setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::setFetchDirection" );
- static jmethodID mID(NULL);
- callVoidMethodWithIntArg("setFetchDirection",mID,_par0,true);
-}
-//------------------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::refreshRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::refreshRow" );
- static jmethodID mID(NULL);
- callVoidMethod("refreshRow",mID);
-}
-//------------------------------------------------------------------------------
-void java_sql_ResultSet::setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::setFetchSize" );
- static jmethodID mID(NULL);
- callVoidMethodWithIntArg("setFetchSize",mID,_par0,true);
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* java_sql_ResultSet::createArrayHelper( ) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::createArrayHelper" );
- Sequence< Property > aProps(5);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY);
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & java_sql_ResultSet::getInfoHelper()
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getInfoHelper" );
- return *const_cast<java_sql_ResultSet*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool java_sql_ResultSet::convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::convertFastPropertyValue" );
- sal_Bool bRet = sal_False;
- switch(nHandle)
- {
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw ::com::sun::star::lang::IllegalArgumentException();
- case PROPERTY_ID_FETCHDIRECTION:
- bRet = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection());
- break;
- case PROPERTY_ID_FETCHSIZE:
- bRet = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize());
- default:
- ;
- }
- return bRet;
-}
-
-// -------------------------------------------------------------------------
-void java_sql_ResultSet::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue
- )
- throw (::com::sun::star::uno::Exception)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::setFastPropertyValue_NoBroadcast" );
- switch(nHandle)
- {
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw ::com::sun::star::uno::Exception();
- case PROPERTY_ID_FETCHDIRECTION:
- setFetchDirection(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_FETCHSIZE:
- setFetchSize(comphelper::getINT32(rValue));
- break;
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void java_sql_ResultSet::getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle
- ) const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFastPropertyValue" );
- try
- {
- switch(nHandle)
- {
- case PROPERTY_ID_CURSORNAME:
- rValue <<= getCursorName();
- break;
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- rValue <<= getResultSetConcurrency();
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- rValue <<= getResultSetType();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- rValue <<= getFetchDirection();
- break;
- case PROPERTY_ID_FETCHSIZE:
- rValue <<= getFetchSize();
- break;
- }
- }
- catch(const Exception&)
- {
- }
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::acquire() throw()
-{
- java_sql_ResultSet_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL java_sql_ResultSet::release() throw()
-{
- java_sql_ResultSet_BASE::release();
-}
-// -----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL java_sql_ResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getPropertySetInfo" );
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx
deleted file mode 100644
index a6da0676a2..0000000000
--- a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx
+++ /dev/null
@@ -1,239 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/sql/ResultSetMetaData.hxx"
-#include "java/sql/Connection.hxx"
-#include "java/tools.hxx"
-#include <rtl/logfile.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;
-
-#define NULLABLE_UNDEFINED 99
-//**************************************************************
-//************ Class: java.sql.ResultSetMetaData
-//**************************************************************
-
-jclass java_sql_ResultSetMetaData::theClass = 0;
-java_sql_ResultSetMetaData::java_sql_ResultSetMetaData( JNIEnv * pEnv, jobject myObj, const java::sql::ConnectionLog& _rResultSetLogger, java_sql_Connection& _rCon )
- :java_lang_Object( pEnv, myObj )
- ,m_aLogger( _rResultSetLogger )
- ,m_pConnection( &_rCon )
- ,m_nColumnCount(-1)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::java_sql_ResultSetMetaData" );
- SDBThreadAttach::addRef();
-}
-java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData()
-{
- SDBThreadAttach::releaseRef();
-}
-
-jclass java_sql_ResultSetMetaData::getMyClass() const
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getMyClass" );
- // The class needs to be fetched just once, that is why it is static
- if( !theClass )
- theClass = findMyClass("java/sql/ResultSetMetaData");
- return theClass;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnDisplaySize" );
- static jmethodID mID(NULL);
- return callIntMethodWithIntArg("getColumnDisplaySize",mID,column);
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnType" );
- static jmethodID mID(NULL);
- return callIntMethodWithIntArg("getColumnType",mID,column);
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnCount" );
- if ( m_nColumnCount == -1 )
- {
- static jmethodID mID(NULL);
- m_nColumnCount = callIntMethod("getColumnCount",mID);
- } // if ( m_nColumnCount == -1 )
- return m_nColumnCount;
-
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCaseSensitive" );
- static jmethodID mID(NULL);
- return callBooleanMethodWithIntArg( "isCaseSensitive", mID,column );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getSchemaName" );
- static jmethodID mID(NULL);
- return callStringMethodWithIntArg("getSchemaName",mID,column);
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnName" );
- static jmethodID mID(NULL);
- return callStringMethodWithIntArg("getColumnName",mID,column);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getTableName" );
- static jmethodID mID(NULL);
- return callStringMethodWithIntArg("getTableName",mID,column);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getCatalogName" );
- static jmethodID mID(NULL);
- return callStringMethodWithIntArg("getCatalogName",mID,column);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnTypeName" );
- static jmethodID mID(NULL);
- return callStringMethodWithIntArg("getColumnTypeName",mID,column);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnLabel" );
- static jmethodID mID(NULL);
- return callStringMethodWithIntArg("getColumnLabel",mID,column);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnServiceName" );
- static jmethodID mID(NULL);
- return callStringMethodWithIntArg("getColumnClassName",mID,column);
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCurrency" );
- if ( m_pConnection->isIgnoreCurrencyEnabled() )
- return sal_False;
- static jmethodID mID(NULL);
- return callBooleanMethodWithIntArg( "isCurrency", mID,column );
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_ResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isAutoIncrement" );
- static jmethodID mID(NULL);
- return callBooleanMethodWithIntArg( "isAutoIncrement", mID,column );
-}
-// -------------------------------------------------------------------------
-
-
-sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSigned" );
- static jmethodID mID(NULL);
- return callBooleanMethodWithIntArg( "isSigned", mID,column );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getPrecision" );
- static jmethodID mID(NULL);
- return callIntMethodWithIntArg("getPrecision",mID,column);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getScale" );
- static jmethodID mID(NULL);
- return callIntMethodWithIntArg("getScale",mID,column);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL java_sql_ResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isNullable" );
- static jmethodID mID(NULL);
- return callIntMethodWithIntArg("isNullable",mID,column);
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSearchable" );
- static jmethodID mID(NULL);
- return callBooleanMethodWithIntArg( "isSearchable", mID,column );
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_ResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isReadOnly" );
- static jmethodID mID(NULL);
- return callBooleanMethodWithIntArg( "isReadOnly", mID,column );
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL java_sql_ResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isDefinitelyWritable" );
- static jmethodID mID(NULL);
- return callBooleanMethodWithIntArg( "isDefinitelyWritable", mID,column );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL java_sql_ResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isWritable" );
- static jmethodID mID(NULL);
- return callBooleanMethodWithIntArg( "isWritable", mID,column );
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/SQLException.cxx b/connectivity/source/drivers/jdbc/SQLException.cxx
deleted file mode 100644
index a0ebe17938..0000000000
--- a/connectivity/source/drivers/jdbc/SQLException.cxx
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/sql/SQLException.hxx"
-#include "java/tools.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;
-//**************************************************************
-//************ Class: java.sql.SQLException
-//**************************************************************
-java_sql_SQLException::java_sql_SQLException( const java_sql_SQLException_BASE& _rException,const Reference< XInterface> & _rContext)
- : starsdbc::SQLException( _rException.getMessage(),
- _rContext,
- _rException.getSQLState(),
- _rException.getErrorCode(),
- makeAny(_rException.getNextException())
- )
-{
-}
-
-java_sql_SQLException_BASE::java_sql_SQLException_BASE( JNIEnv * pEnv, jobject myObj ) : java_lang_Exception( pEnv, myObj )
-{
-}
-
-jclass java_sql_SQLException_BASE::theClass = 0;
-
-java_sql_SQLException_BASE::~java_sql_SQLException_BASE()
-{}
-
-
-jclass java_sql_SQLException_BASE::getMyClass() const
-{
- return st_getMyClass();
-}
-jclass java_sql_SQLException_BASE::st_getMyClass()
-{
- // The class needs to be fetched just once, that is why it is static
- if( !theClass )
- theClass = findMyClass("java/sql/SQLException");
- return theClass;
-}
-
-starsdbc::SQLException java_sql_SQLException_BASE::getNextException() const
-{
- SDBThreadAttach t;
- static jmethodID mID(NULL);
- jobject out = callObjectMethod(t.pEnv,"getNextException","()Ljava/sql/SQLException;", mID);
- // WARNING: the caller will become the owner of the returned pointers !!!
- if( out )
- {
- java_sql_SQLException_BASE warn_base(t.pEnv,out);
- return (starsdbc::SQLException)java_sql_SQLException(warn_base,0);
- }
-
- return starsdbc::SQLException();
-}
-
-::rtl::OUString java_sql_SQLException_BASE::getSQLState() const
-{
- static jmethodID mID(NULL);
- return callStringMethod("getSQLState",mID);
-}
-sal_Int32 java_sql_SQLException_BASE::getErrorCode() const
-{
- static jmethodID mID(NULL);
- return callIntMethod("getErrorCode",mID);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/SQLWarning.cxx b/connectivity/source/drivers/jdbc/SQLWarning.cxx
deleted file mode 100644
index aa5c8fe456..0000000000
--- a/connectivity/source/drivers/jdbc/SQLWarning.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/sql/SQLWarning.hxx"
-using namespace connectivity;
-//**************************************************************
-//************ Class: java.sql.SQLWarning
-//**************************************************************
-
-jclass java_sql_SQLWarning_BASE::theClass = 0;
-
-java_sql_SQLWarning_BASE::~java_sql_SQLWarning_BASE()
-{}
-
-jclass java_sql_SQLWarning_BASE::getMyClass() const
-{
- // the class needs to be fetched only once, that is why it is static
- if( !theClass )
- theClass = findMyClass("java/sql/SQLWarning");
- return theClass;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/String.cxx b/connectivity/source/drivers/jdbc/String.cxx
deleted file mode 100644
index a85a3fd6b2..0000000000
--- a/connectivity/source/drivers/jdbc/String.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/lang/String.hxx"
-#include "java/tools.hxx"
-using namespace connectivity;
-//**************************************************************
-//************ Class: java.lang.String
-//**************************************************************
-
-jclass java_lang_String::theClass = 0;
-
-java_lang_String::~java_lang_String()
-{}
-
-jclass java_lang_String::getMyClass() const
-{
- return st_getMyClass();
-}
-jclass java_lang_String::st_getMyClass()
-{
- // the class needs to be fetched only once, that is why it is static
- if( !theClass )
- theClass = findMyClass("java/lang/String");
- return theClass;
-}
-
-//--------------------------------------------------------------------------
-java_lang_String::operator ::rtl::OUString()
-{
- SDBThreadAttach t;
- if(!t.pEnv)
- return ::rtl::OUString();
- return JavaString2String(t.pEnv,(jstring)object);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/Throwable.cxx b/connectivity/source/drivers/jdbc/Throwable.cxx
deleted file mode 100644
index 50302bcb7c..0000000000
--- a/connectivity/source/drivers/jdbc/Throwable.cxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/lang/Throwable.hxx"
-#include "java/tools.hxx"
-using namespace connectivity;
-//**************************************************************
-//************ Class: java.lang.Throwable
-//**************************************************************
-
-jclass java_lang_Throwable::theClass = 0;
-
-java_lang_Throwable::~java_lang_Throwable()
-{}
-
-jclass java_lang_Throwable::getMyClass() const
-{
- return st_getMyClass();
-}
-jclass java_lang_Throwable::st_getMyClass()
-{
- // the class needs to be fetched only once, that is why it is static
- if( !theClass )
- theClass = findMyClass("java/lang/Throwable");
- return theClass;
-}
-// -----------------------------------------------------------------------------
-
-::rtl::OUString java_lang_Throwable::getMessage() const
-{
- static jmethodID mID(NULL);
- return callStringMethod("getMessage",mID);
-}
-// -----------------------------------------------------------------------------
-
-::rtl::OUString java_lang_Throwable::getLocalizedMessage() const
-{
- static jmethodID mID(NULL);
- return callStringMethod("getLocalizedMessage",mID);
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/Timestamp.cxx b/connectivity/source/drivers/jdbc/Timestamp.cxx
deleted file mode 100644
index f38a1a610b..0000000000
--- a/connectivity/source/drivers/jdbc/Timestamp.cxx
+++ /dev/null
@@ -1,194 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/sql/Timestamp.hxx"
-#include "java/tools.hxx"
-#include <comphelper/types.hxx>
-#include "connectivity/dbconversion.hxx"
-
-using namespace ::comphelper;
-using namespace connectivity;
-//**************************************************************
-//************ Class: java.sql.Date
-//**************************************************************
-const double fMilliSecondsPerDay = 86400000.0;
-jclass java_sql_Date::theClass = 0;
-java_sql_Date::java_sql_Date( const ::com::sun::star::util::Date& _rOut ) : java_util_Date( NULL, (jobject)NULL )
-{
- SDBThreadAttach t;
- if( !t.pEnv )
- return;
- jvalue args[1];
- // Convert parameters
- ::rtl::OUString sDateStr;
- sDateStr = ::dbtools::DBTypeConversion::toDateString(_rOut);
- args[0].l = convertwchar_tToJavaString(t.pEnv,sDateStr);
-
- // Turn of Java-Call for the constructor
- // initialise temporary variables
- static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/Date;";
- jobject tempObj;
- static jmethodID mID(NULL);
- if ( !mID )
- mID = t.pEnv->GetStaticMethodID( getMyClass(), "valueOf", cSignature );OSL_ENSURE(mID,"Unknown method id!");
- tempObj = t.pEnv->CallStaticObjectMethod( getMyClass(), mID, args[0].l );
- saveRef( t.pEnv, tempObj );
- t.pEnv->DeleteLocalRef( tempObj );
- // and clean
-}
-
-java_sql_Date::~java_sql_Date()
-{}
-
-jclass java_sql_Date::getMyClass() const
-{
- return st_getMyClass();
-}
-jclass java_sql_Date::st_getMyClass()
-{
- // the class needs only be fetched once, that is why it is static
- if( !theClass )
- theClass = findMyClass("java/sql/Date");
- return theClass;
-}
-// -----------------------------------------------------------------------------
-
-java_sql_Date::operator ::com::sun::star::util::Date()
-{
- return ::dbtools::DBTypeConversion::toDate(toString());
-}
-
-//**************************************************************
-//************ Class: java.sql.Time
-//**************************************************************
-
-jclass java_sql_Time::theClass = 0;
-
-java_sql_Time::~java_sql_Time()
-{}
-
-jclass java_sql_Time::getMyClass() const
-{
- return st_getMyClass();
-}
-jclass java_sql_Time::st_getMyClass()
-{
- // the class needs only be fetched once, that is why it is static
- if( !theClass )
- theClass = findMyClass("java/sql/Time");
- return theClass;
-}
-java_sql_Time::java_sql_Time( const ::com::sun::star::util::Time& _rOut ): java_util_Date( NULL, (jobject)NULL )
-{
- SDBThreadAttach t;
- if( !t.pEnv )
- return;
- jvalue args[1];
- // Convert parameters
- ::rtl::OUString sDateStr;
- sDateStr = ::dbtools::DBTypeConversion::toTimeString(_rOut);
- args[0].l = convertwchar_tToJavaString(t.pEnv,sDateStr);
-
- // Turn off Java-Call for the constructor
- // intialise temporary variables
- static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/Time;";
- jobject tempObj;
- static jmethodID mID(NULL);
- if ( !mID )
- mID = t.pEnv->GetStaticMethodID( getMyClass(), "valueOf", cSignature );OSL_ENSURE(mID,"Unknown method id!");
- tempObj = t.pEnv->CallStaticObjectMethod( getMyClass(), mID, args[0].l );
- t.pEnv->DeleteLocalRef((jstring)args[0].l);
- saveRef( t.pEnv, tempObj );
- t.pEnv->DeleteLocalRef( tempObj );
- // and clean
-}
-// -----------------------------------------------------------------------------
-java_sql_Time::operator ::com::sun::star::util::Time()
-{
- return ::dbtools::DBTypeConversion::toTime(toString());
-}
-//**************************************************************
-//************ Class: java.sql.Timestamp
-//**************************************************************
-
-jclass java_sql_Timestamp::theClass = 0;
-
-java_sql_Timestamp::~java_sql_Timestamp()
-{}
-
-jclass java_sql_Timestamp::getMyClass() const
-{
- return st_getMyClass();
-}
-
-jclass java_sql_Timestamp::st_getMyClass()
-{
- // the class needs only be fetched once, that is why it is static
- if( !theClass )
- theClass = findMyClass("java/sql/Timestamp");
- return theClass;
-}
-
-java_sql_Timestamp::java_sql_Timestamp(const ::com::sun::star::util::DateTime& _rOut)
- :java_util_Date( NULL, (jobject)NULL )
-{
- SDBThreadAttach t;
- if( !t.pEnv )
- return;
- jvalue args[1];
- // Convert parameters
- ::rtl::OUString sDateStr;
- sDateStr = ::dbtools::DBTypeConversion::toDateTimeString(_rOut);
-
- args[0].l = convertwchar_tToJavaString(t.pEnv,sDateStr);
-
- // Turn off Java-Call for the constructor
- // initialise temporary variables
- static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/Timestamp;";
- jobject tempObj;
- static jmethodID mID(NULL);
- if ( !mID )
- mID = t.pEnv->GetStaticMethodID( getMyClass(), "valueOf", cSignature );OSL_ENSURE(mID,"Unknown method id!");
- tempObj = t.pEnv->CallStaticObjectMethod( getMyClass(), mID, args[0].l );
-
- saveRef( t.pEnv, tempObj );
- t.pEnv->DeleteLocalRef( tempObj );
- // and clean
-}
-
-// -----------------------------------------------------------------------------
-java_sql_Timestamp::operator ::com::sun::star::util::DateTime()
-{
- return ::dbtools::DBTypeConversion::toDateTime(toString());
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/exports.dxp b/connectivity/source/drivers/jdbc/exports.dxp
deleted file mode 100755
index 7003307892..0000000000
--- a/connectivity/source/drivers/jdbc/exports.dxp
+++ /dev/null
@@ -1 +0,0 @@
-component_getFactory
diff --git a/connectivity/source/drivers/jdbc/jdbc.component b/connectivity/source/drivers/jdbc/jdbc.component
deleted file mode 100755
index 5d7db4690b..0000000000
--- a/connectivity/source/drivers/jdbc/jdbc.component
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.sdbc.JDBCDriver">
- <service name="com.sun.star.sdbc.Driver"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/jdbc/jdbc.mxp.map b/connectivity/source/drivers/jdbc/jdbc.mxp.map
deleted file mode 100755
index 2437d90ec8..0000000000
--- a/connectivity/source/drivers/jdbc/jdbc.mxp.map
+++ /dev/null
@@ -1,152 +0,0 @@
-component_getFactory
-__mh_dylib_header
-___builtin_delete
-___check_eh_spec
-___cp_pop_exception
-___get_eh_context
-___pure_virtual
-___rtti_class
-___rtti_si
-___rtti_user
-___sjthrow
-___start_cp_handler
-___terminate
-dyld_stub_binding_helper
-rest_world
-save_world
-___builtin_new
-___builtin_vec_delete
-___builtin_vec_new
-___cp_push_exception
-___eh_alloc
-_terminate__Fv
-___eh_rtime_match
-__._10bad_typeid
-__._8bad_cast
-___get_eh_info
-___is_pointer__FPv
-___throw_type_match_rtti
-___vt_10bad_typeid
-___vt_8bad_cast
-__keymgr_get_per_thread_data
-__keymgr_set_per_thread_data
-___tf9exception
-___ti9exception
-___vt_9exception
-_what__C9exception
-__._9bad_alloc
-___tf9bad_alloc
-___vt_9bad_alloc
-__._9type_info
-___eq__C9type_infoRCB0
-___tf16__user_type_info
-___tf9type_info
-___ti9type_info
-___vt_9type_info
-_getMyClass__Q212connectivity14java_sql_Array
-_saveClassRef__Q212connectivity14java_sql_ArrayP7_jclass
-_getMyClass__Q212connectivity13java_sql_Blob
-_saveClassRef__Q212connectivity13java_sql_BlobP7_jclass
-_saveClassRef__Q212connectivity17java_lang_BooleanP7_jclass
-__._Q212connectivity26java_sql_CallableStatement
-_release__Q212connectivity26java_sql_CallableStatement
-_acquire__Q212connectivity26java_sql_CallableStatement
-_saveClassRef__Q212connectivity26java_sql_CallableStatementP7_jclass
-_getMyClass__Q212connectivity26java_sql_CallableStatement
-_getMyClass__Q212connectivity15java_lang_Class
-_saveClassRef__Q212connectivity15java_lang_ClassP7_jclass
-_getMyClass__Q212connectivity13java_sql_Clob
-_saveClassRef__Q212connectivity13java_sql_ClobP7_jclass
-_getMyClass__Q212connectivity19java_sql_Connection
-_saveClassRef__Q212connectivity19java_sql_ConnectionP7_jclass
-_getMyClass__Q212connectivity25java_sql_DatabaseMetaData
-_saveClassRef__Q212connectivity25java_sql_DatabaseMetaDataP7_jclass
-_saveClassRef__Q212connectivity14java_util_DateP7_jclass
-_getMyClass__Q212connectivity14java_util_Date
-_getMyClass__Q212connectivity22java_sql_DriverManager
-_saveClassRef__Q212connectivity22java_sql_DriverManagerP7_jclass
-_choices__CQ212connectivity27java_sql_DriverPropertyInfo
-_value__CQ212connectivity27java_sql_DriverPropertyInfo
-_required__CQ212connectivity27java_sql_DriverPropertyInfo
-_description__CQ212connectivity27java_sql_DriverPropertyInfo
-_name__CQ212connectivity27java_sql_DriverPropertyInfo
-_saveClassRef__Q212connectivity27java_sql_DriverPropertyInfoP7_jclass
-_saveClassRef__Q212connectivity19java_lang_ExceptionP7_jclass
-_getMyClass__Q212connectivity19java_io_InputStream
-_saveClassRef__Q212connectivity19java_io_InputStreamP7_jclass
-_getMyClass__Q212connectivity15java_sql_Driver
-_saveClassRef__Q212connectivity15java_sql_DriverP7_jclass
-___Q212connectivity15java_sql_DriverRCQ53com3sun4star3unot9Reference1ZQ53com3sun4star4lang20XMultiServiceFactory
-_getMyClass__Q212connectivity16java_lang_Object
-_setError__Q212connectivity15SDBThreadAttach
-_StartJava__Q212connectivity15SDBThreadAttachRCQ53com3sun4star3unot9Reference1ZQ53com3sun4star4lang20XMultiServiceFactory
-_xInit__Q212connectivity15SDBThreadAttachRCQ53com3sun4star3unot9Reference1ZQ53com3sun4star4lang20XMultiServiceFactory
-_detachThread__Q212connectivity15SDBThreadAttach
-_attachThread__Q212connectivity15SDBThreadAttachRP7JNIEnv_RCQ53com3sun4star3unot9Reference1ZQ53com3sun4star4lang20XMultiServiceFactory
-_release__Q212connectivity26java_sql_PreparedStatement
-_acquire__Q212connectivity26java_sql_PreparedStatement
-_getMyClass__Q212connectivity26java_sql_PreparedStatement
-_saveClassRef__Q212connectivity26java_sql_PreparedStatementP7_jclass
-_getMyClass__Q212connectivity14java_io_Reader
-_saveClassRef__Q212connectivity14java_io_ReaderP7_jclass
-_getMyClass__Q212connectivity12java_sql_Ref
-_saveClassRef__Q212connectivity12java_sql_RefP7_jclass
-__._Q312connectivity4jdbc18UStringDescription
-___Q312connectivity4jdbc18UStringDescriptionPFv_PCc
-_getPropertySetInfo__Q212connectivity18java_sql_ResultSet
-_release__Q212connectivity18java_sql_ResultSet
-_acquire__Q212connectivity18java_sql_ResultSet
-_getResultSetType__CQ212connectivity18java_sql_ResultSet
-_getResultSetConcurrency__CQ212connectivity18java_sql_ResultSet
-_getCursorName__CQ212connectivity18java_sql_ResultSet
-_setFetchSize__Q212connectivity18java_sql_ResultSetl
-_setFetchDirection__Q212connectivity18java_sql_ResultSetl
-_getFetchSize__CQ212connectivity18java_sql_ResultSet
-_getFetchDirection__CQ212connectivity18java_sql_ResultSet
-_saveClassRef__Q212connectivity18java_sql_ResultSetP7_jclass
-_getMyClass__Q212connectivity18java_sql_ResultSet
-_getMyClass__Q212connectivity26java_sql_ResultSetMetaData
-_saveClassRef__Q212connectivity26java_sql_ResultSetMetaDataP7_jclass
-_saveClassRef__Q212connectivity26java_sql_SQLException_BASEP7_jclass
-_getNextException__CQ212connectivity26java_sql_SQLException_BASE
-_getErrorCode__CQ212connectivity26java_sql_SQLException_BASE
-_getSQLState__CQ212connectivity26java_sql_SQLException_BASE
-_saveClassRef__Q212connectivity24java_sql_SQLWarning_BASEP7_jclass
-_disposing__Q212connectivity23java_sql_Statement_Base
-_release__Q212connectivity23java_sql_Statement_Base
-_acquire__Q212connectivity23java_sql_Statement_Base
-__._Q212connectivity16OStatement_BASE2
-_release__Q212connectivity18java_sql_Statement
-_acquire__Q212connectivity18java_sql_Statement
-_saveClassRef__Q212connectivity18java_sql_StatementP7_jclass
-_setFetchSize__Q212connectivity23java_sql_Statement_Basel
-_setFetchDirection__Q212connectivity23java_sql_Statement_Basel
-_setResultSetType__Q212connectivity23java_sql_Statement_Basel
-_setResultSetConcurrency__Q212connectivity23java_sql_Statement_Basel
-_setCursorName__Q212connectivity23java_sql_Statement_BaseRCQ23rtl8OUString
-_setMaxRows__Q212connectivity23java_sql_Statement_Basel
-_setMaxFieldSize__Q212connectivity23java_sql_Statement_Basel
-_setQueryTimeOut__Q212connectivity23java_sql_Statement_Basel
-_getFetchSize__CQ212connectivity23java_sql_Statement_Base
-_getFetchDirection__CQ212connectivity23java_sql_Statement_Base
-_getResultSetType__CQ212connectivity23java_sql_Statement_Base
-_getResultSetConcurrency__CQ212connectivity23java_sql_Statement_Base
-_getCursorName__CQ212connectivity23java_sql_Statement_Base
-_getMaxRows__CQ212connectivity23java_sql_Statement_Base
-_getMaxFieldSize__CQ212connectivity23java_sql_Statement_Base
-_getQueryTimeOut__CQ212connectivity23java_sql_Statement_Base
-_getMyClass__Q212connectivity18java_sql_Statement
-_saveClassRef__Q212connectivity23java_sql_Statement_BaseP7_jclass
-_getMyClass__Q212connectivity23java_sql_Statement_Base
-_saveClassRef__Q212connectivity16java_lang_StringP7_jclass
-_saveClassRef__Q212connectivity19java_lang_ThrowableP7_jclass
-_getMyClass__Q212connectivity18java_sql_Timestamp
-_saveClassRef__Q212connectivity18java_sql_TimestampP7_jclass
-_getMyClass__Q212connectivity13java_sql_Time
-_saveClassRef__Q212connectivity13java_sql_TimeP7_jclass
-_saveClassRef__Q212connectivity13java_sql_DateP7_jclass
-___tf13bad_exception
-___uncatch_exception
-___eh_free
-___tfv
-___dynamic_cast
diff --git a/connectivity/source/drivers/jdbc/jdbc.xcu b/connectivity/source/drivers/jdbc/jdbc.xcu
deleted file mode 100644
index dd0da5df4d..0000000000
--- a/connectivity/source/drivers/jdbc/jdbc.xcu
+++ /dev/null
@@ -1,219 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="jdbc:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.JDBCDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">JDBC</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="JavaDriverClass" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="JavaDriverClassPath" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="AutoIncrementCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="AutoRetrievingStatement" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="IsAutoRetrievingEnabled" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- <node oor:name="AddIndexAppendix" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="GeneratedValues" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="AppendTableAliasInSelect" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseBracketedOuterJoinSyntax" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="ParameterNameSubstitution" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="DisplayVersionColumns" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseCatalogInSelect" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseSchemaInSelect" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseIndexDirectionKeyword" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseDOSLineEnds" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="BooleanComparisonMode" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FormsCheckRequiredFields" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="PrimaryKeySupport" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="RespectDriverResultSetType" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseJava" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="jdbc:oracle:thin:*" oor:op="replace">
- <prop oor:name="ParentURLPattern">
- <value>jdbc:*</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Oracle JDBC</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="IgnoreCurrency" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="TypeInfoSettings" oor:op="replace">
- <prop oor:name="Value" oor:type="oor:string-list">
- <value oor:separator=",">Column(2) = -5,Column(6) = PRECISION,Column(2) = -4,Column(6) = PRECISION,Column(2) = -3,Column(6) = PRECISION,Column(2) = -2,Column(6) = PRECISION,Column(2) = -1,Column(6) = PRECISION,Column(2) = -1,Column(6) = PRECISION,Column(2) = 2,Column(6) = PRECISION,Column(2) = 12,Column(6) = PRECISION</value>
- </prop>
- </node>
- <node oor:name="JavaDriverClass" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>oracle.jdbc.driver.OracleDriver</value>
- </prop>
- </node>
- <node oor:name="AddIndexAppendix" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="IgnoreCurrency" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/jdbc/jdbc.xml b/connectivity/source/drivers/jdbc/jdbc.xml
deleted file mode 100755
index 8fe04eb8a5..0000000000
--- a/connectivity/source/drivers/jdbc/jdbc.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<!DOCTYPE module-description PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
-<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
- <module-name> jdbc </module-name>
- <component-description>
- <author>Ocke Janssen</author>
- <name>com.sun.star.comp.sdbc.JDBCDriver</name>
- <description>
- This is the implementation of the sdbc-jdbc bridge.
- </description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service> com.sun.star.sdbc.Driver </supported-service>
- <service-dependency> ... </service-dependency>
- </component-description>
- <project-build-dependency>cppuhelper</project-build-dependency>
- <project-build-dependency>cppu</project-build-dependency>
- <project-build-dependency>sal</project-build-dependency>
- <runtime-module-dependency>cppuhelper</runtime-module-dependency>
- <runtime-module-dependency>cppu</runtime-module-dependency>
- <runtime-module-dependency>sal</runtime-module-dependency>
- <runtime-module-dependency>osl</runtime-module-dependency>
- <runtime-module-dependency>dbtools</runtime-module-dependency>
- <runtime-module-dependency>comphelper</runtime-module-dependency>
-</module-description>
-
-
diff --git a/connectivity/source/drivers/jdbc/jservices.cxx b/connectivity/source/drivers/jdbc/jservices.cxx
deleted file mode 100644
index cf4d8cdc20..0000000000
--- a/connectivity/source/drivers/jdbc/jservices.cxx
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "java/sql/Driver.hxx"
-#include <cppuhelper/factory.hxx>
-
-using namespace connectivity;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount* _pModCount
- );
-
-//---------------------------------------------------------------------------------------
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- sal_Char const* pImplementationName
- )
- : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- inline
- sal_Bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
- }
- catch(...)
- {
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = 0;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- java_sql_Driver::getImplementationName_Static(),
- java_sql_Driver::getSupportedServiceNames_Static(),
- java_sql_Driver_CreateInstance,
- ::cppu::createSingleFactory);
-
- if(aReq.xRet.is())
- aReq.xRet->acquire();
- pRet = aReq.getProvider();
- }
-
- return pRet;
-}
-
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/jdbc/makefile.mk b/connectivity/source/drivers/jdbc/makefile.mk
deleted file mode 100755
index befdc73d7b..0000000000
--- a/connectivity/source/drivers/jdbc/makefile.mk
+++ /dev/null
@@ -1,120 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=jdbc
-
-ENABLE_EXCEPTIONS=TRUE
-VISIBILITY_HIDDEN=TRUE
-
-# --- Settings ----------------------------------
-.IF "$(DBGUTIL_OJ)"!=""
-ENVCFLAGS+=/FR$(SLO)$/
-.ENDIF
-
-.INCLUDE : $(PRJ)$/makefile.pmk
-.INCLUDE : $(PRJ)$/version.mk
-
-
-.IF "$(SOLAR_JAVA)" != ""
-
-# --- Files -------------------------------------
-
-SLOFILES=\
- $(SLO)$/Array.obj \
- $(SLO)$/Blob.obj \
- $(SLO)$/Boolean.obj \
- $(SLO)$/CallableStatement.obj \
- $(SLO)$/Class.obj \
- $(SLO)$/Clob.obj \
- $(SLO)$/ConnectionLog.obj \
- $(SLO)$/DatabaseMetaData.obj \
- $(SLO)$/Date.obj \
- $(SLO)$/DriverPropertyInfo.obj \
- $(SLO)$/Exception.obj \
- $(SLO)$/InputStream.obj \
- $(SLO)$/JConnection.obj \
- $(SLO)$/JDriver.obj \
- $(SLO)$/JStatement.obj \
- $(SLO)$/Object.obj \
- $(SLO)$/PreparedStatement.obj \
- $(SLO)$/Reader.obj \
- $(SLO)$/Ref.obj \
- $(SLO)$/ResultSet.obj \
- $(SLO)$/ResultSetMetaData.obj \
- $(SLO)$/SQLException.obj \
- $(SLO)$/SQLWarning.obj \
- $(SLO)$/String.obj \
- $(SLO)$/Throwable.obj \
- $(SLO)$/Timestamp.obj \
- $(SLO)$/jservices.obj \
- $(SLO)$/JBigDecimal.obj \
- $(SLO)$/tools.obj \
- $(SLO)$/ContextClassLoader.obj
-
-SHL1VERSIONMAP=$(SOLARENV)/src/component.map
-
-# --- Library -----------------------------------
-
-SHL1TARGET= $(JDBC_TARGET)$(DLLPOSTFIX)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SALLIB) \
- $(SALHELPERLIB) \
- $(JVMACCESSLIB) \
- $(DBTOOLSLIB) \
- $(UNOTOOLSLIB) \
- $(JVMFWKLIB) \
- $(COMPHELPERLIB)
-
-SHL1DEPN=
-SHL1IMPLIB= i$(JDBC_TARGET)
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
-
-.ENDIF # SOLAR_JAVA
-
-# --- Targets ----------------------------------
-
-.INCLUDE : $(PRJ)$/target.pmk
-
-
-
-ALLTAR : $(MISC)/jdbc.component
-
-$(MISC)/jdbc.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- jdbc.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt jdbc.component
diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx
deleted file mode 100644
index 4e938585c1..0000000000
--- a/connectivity/source/drivers/jdbc/tools.cxx
+++ /dev/null
@@ -1,277 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <cstdarg>
-#include "java/tools.hxx"
-#include "java/lang/String.hxx"
-#include "java/lang/Class.hxx"
-#include "java/util/Property.hxx"
-#include <com/sun/star/sdbc/DriverPropertyInfo.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <connectivity/dbexception.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;
-
-void java_util_Properties::setProperty(const ::rtl::OUString key, const ::rtl::OUString& value)
-{
- SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
- jobject out(0);
-
- {
- jvalue args[2];
- // Convert Parameter
- args[0].l = convertwchar_tToJavaString(t.pEnv,key);
- args[1].l = convertwchar_tToJavaString(t.pEnv,value);
- // Initialize temporary Variables
- static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;";
- static const char * cMethodName = "setProperty";
- // Turn off Java-Call
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
- out = t.pEnv->CallObjectMethod(object, mID, args[0].l,args[1].l);
- ThrowSQLException(t.pEnv,NULL);
- t.pEnv->DeleteLocalRef((jstring)args[1].l);
- t.pEnv->DeleteLocalRef((jstring)args[0].l);
- ThrowSQLException(t.pEnv,0);
- if(out)
- t.pEnv->DeleteLocalRef(out);
- } //t.pEnv
- // WARNING: The caller will be owner of the returned pointers!!!
-}
-jclass java_util_Properties::theClass = 0;
-
-java_util_Properties::~java_util_Properties()
-{}
-
-jclass java_util_Properties::getMyClass() const
-{
- // the class needs only be called once, that is why it is static
- if( !theClass )
- theClass = findMyClass("java/util/Properties");
- return theClass;
-}
-
-//--------------------------------------------------------------------------
-java_util_Properties::java_util_Properties( ): java_lang_Object( NULL, (jobject)NULL )
-{
- SDBThreadAttach t;
- if( !t.pEnv )
- return;
- // Turn off Java-Call for the constructor
- // Initialize temperary Variables
- static const char * cSignature = "()V";
- jobject tempObj;
- static jmethodID mID(NULL);
- obtainMethodId(t.pEnv, "<init>",cSignature, mID);
- tempObj = t.pEnv->NewObject( getMyClass(), mID);
- saveRef( t.pEnv, tempObj );
- t.pEnv->DeleteLocalRef( tempObj );
-}
-
-// --------------------------------------------------------------------------------
-jstring connectivity::convertwchar_tToJavaString(JNIEnv *pEnv,const ::rtl::OUString& _rTemp)
-{
- OSL_ENSURE(pEnv,"Environment is NULL!");
- jstring pStr = pEnv->NewString(_rTemp.getStr(), _rTemp.getLength());
- pEnv->ExceptionClear();
- OSL_ENSURE(pStr,"Could not create a jsstring object!");
- return pStr;
-}
-
-// --------------------------------------------------------------------------------
-java_util_Properties* connectivity::createStringPropertyArray(const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
-{
- java_util_Properties* pProps = new java_util_Properties();
- const PropertyValue* pBegin = info.getConstArray();
- const PropertyValue* pEnd = pBegin + info.getLength();
-
- for(;pBegin != pEnd;++pBegin)
- {
- // this is a special property to find the jdbc driver
- if ( pBegin->Name.compareToAscii( "JavaDriverClass" )
- && pBegin->Name.compareToAscii( "JavaDriverClassPath" )
- && pBegin->Name.compareToAscii( "SystemProperties" )
- && pBegin->Name.compareToAscii( "CharSet" )
- && pBegin->Name.compareToAscii( "AppendTableAliasName" )
- && pBegin->Name.compareToAscii( "AddIndexAppendix" )
- && pBegin->Name.compareToAscii( "FormsCheckRequiredFields" )
- && pBegin->Name.compareToAscii( "GenerateASBeforeCorrelationName" )
- && pBegin->Name.compareToAscii( "EscapeDateTime" )
- && pBegin->Name.compareToAscii( "ParameterNameSubstitution" )
- && pBegin->Name.compareToAscii( "IsPasswordRequired" )
- && pBegin->Name.compareToAscii( "IsAutoRetrievingEnabled" )
- && pBegin->Name.compareToAscii( "AutoRetrievingStatement" )
- && pBegin->Name.compareToAscii( "UseCatalogInSelect" )
- && pBegin->Name.compareToAscii( "UseSchemaInSelect" )
- && pBegin->Name.compareToAscii( "AutoIncrementCreation" )
- && pBegin->Name.compareToAscii( "Extension" )
- && pBegin->Name.compareToAscii( "NoNameLengthLimit" )
- && pBegin->Name.compareToAscii( "EnableSQL92Check" )
- && pBegin->Name.compareToAscii( "EnableOuterJoinEscape" )
- && pBegin->Name.compareToAscii( "BooleanComparisonMode" )
- && pBegin->Name.compareToAscii( "IgnoreCurrency" )
- && pBegin->Name.compareToAscii( "TypeInfoSettings" )
- && pBegin->Name.compareToAscii( "IgnoreDriverPrivileges" )
- && pBegin->Name.compareToAscii( "ImplicitCatalogRestriction" )
- && pBegin->Name.compareToAscii( "ImplicitSchemaRestriction" )
- && pBegin->Name.compareToAscii( "SupportsTableCreation" )
- && pBegin->Name.compareToAscii( "UseJava" )
- && pBegin->Name.compareToAscii( "Authentication" )
- && pBegin->Name.compareToAscii( "PreferDosLikeLineEnds" )
- && pBegin->Name.compareToAscii( "PrimaryKeySupport" )
- && pBegin->Name.compareToAscii( "RespectDriverResultSetType" )
- )
- {
- ::rtl::OUString aStr;
- OSL_VERIFY( pBegin->Value >>= aStr );
- pProps->setProperty(pBegin->Name,aStr);
- }
- }
- return pProps;
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString connectivity::JavaString2String(JNIEnv *pEnv,jstring _Str)
-{
- ::rtl::OUString aStr;
- if(_Str)
- {
- jboolean bCopy(sal_True);
- const jchar* pChar = pEnv->GetStringChars(_Str,&bCopy);
- jsize len = pEnv->GetStringLength(_Str);
- aStr = ::rtl::OUString(pChar,len);
-
- if(bCopy)
- pEnv->ReleaseStringChars(_Str,pChar);
- pEnv->DeleteLocalRef(_Str);
- }
- return aStr;
-}
-// --------------------------------------------------------------------------------
-jobject connectivity::convertTypeMapToJavaMap(JNIEnv* /*pEnv*/,const Reference< ::com::sun::star::container::XNameAccess > & _rMap)
-{
- if ( _rMap.is() )
- {
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames = _rMap->getElementNames();
- if ( aNames.getLength() > 0 )
- ::dbtools::throwFeatureNotImplementedException( "Type maps", NULL );
- }
- return 0;
-}
-// -----------------------------------------------------------------------------
-sal_Bool connectivity::isExceptionOccurred(JNIEnv *pEnv,sal_Bool _bClear)
-{
- if ( !pEnv )
- return sal_False;
-
- jthrowable pThrowable = pEnv->ExceptionOccurred();
- sal_Bool bRet = pThrowable != NULL;
- if ( pThrowable )
- {
- if ( _bClear )
- pEnv->ExceptionClear();
-#if OSL_DEBUG_LEVEL > 1
- if(pEnv->IsInstanceOf(pThrowable,java_sql_SQLException_BASE::st_getMyClass()))
- {
-
- java_sql_SQLException_BASE* pException = new java_sql_SQLException_BASE(pEnv,pThrowable);
- ::rtl::OUString sError = pException->getMessage();
- delete pException;
- }
-#else
- pEnv->DeleteLocalRef(pThrowable);
-#endif
-
- }
-
- return bRet;
-}
-// -----------------------------------------------------------------------------
-jobject connectivity::createByteInputStream(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x,sal_Int32 length)
-{
- SDBThreadAttach t;
- if( !t.pEnv || !x.is() )
- return NULL;
- // Turn off Java-Call for the constructor
- // Initialize temperary variables
- jclass clazz = java_lang_Object::findMyClass("java/io/ByteArrayInputStream");
- static jmethodID mID(NULL);
- if ( !mID )
- {
- static const char * cSignature = "([B)V";
- mID = t.pEnv->GetMethodID( clazz, "<init>", cSignature );
- OSL_ENSURE( mID, cSignature );
- if ( !mID )
- throw SQLException();
- } // if ( !_inout_MethodID )
- jbyteArray pByteArray = t.pEnv->NewByteArray(length);
- Sequence< sal_Int8 > aData;
- x->readBytes(aData,length);
- jboolean p = sal_False;
- rtl_copyMemory(t.pEnv->GetByteArrayElements(pByteArray,&p),aData.getArray(),aData.getLength());
- jobject out = t.pEnv->NewObject( clazz, mID,pByteArray);
- t.pEnv->DeleteLocalRef((jbyteArray)pByteArray);
- return out;
-}
-// -----------------------------------------------------------------------------
-jobject connectivity::createCharArrayReader(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x,sal_Int32 length)
-{
- SDBThreadAttach t;
- if( !t.pEnv || !x.is() )
- return NULL;
- // Turn off Java-Call for the constructor
- // Initialize temperary Variables
- jclass clazz = java_lang_Object::findMyClass("java/io/CharArrayReader");
- static jmethodID mID(NULL);
- if ( !mID )
- {
- static const char * cSignature = "([C)V";
- mID = t.pEnv->GetMethodID( clazz, "<init>", cSignature );
- OSL_ENSURE( mID, cSignature );
- if ( !mID )
- throw SQLException();
- } // if ( !_inout_MethodID )
- jcharArray pCharArray = t.pEnv->NewCharArray(length);
- Sequence< sal_Int8 > aData;
- x->readBytes(aData,length);
- jboolean p = sal_False;
- rtl_copyMemory(t.pEnv->GetCharArrayElements(pCharArray,&p),aData.getArray(),aData.getLength());
- jobject out = t.pEnv->NewObject( clazz, mID,pCharArray);
- t.pEnv->DeleteLocalRef((jcharArray)pCharArray);
- return out;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KCatalog.cxx b/connectivity/source/drivers/kab/KCatalog.cxx
deleted file mode 100644
index 44d95d1e85..0000000000
--- a/connectivity/source/drivers/kab/KCatalog.cxx
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "KCatalog.hxx"
-#include "KConnection.hxx"
-#include "KTables.hxx"
-
-using namespace connectivity::kab;
-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 ::cppu;
-
-// -------------------------------------------------------------------------
-KabCatalog::KabCatalog(KabConnection* _pCon)
- : connectivity::sdbcx::OCatalog(_pCon),
- m_pConnection(_pCon),
- m_xMetaData(m_pConnection->getMetaData())
-{
-}
-// -------------------------------------------------------------------------
-void KabCatalog::refreshTables()
-{
- TStringVector aVector;
- Sequence< ::rtl::OUString > aTypes(1);
- aTypes[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%"));
- Reference< XResultSet > xResult = m_xMetaData->getTables(
- Any(),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")),
- aTypes);
-
- if (xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- ::rtl::OUString aName;
- // const ::rtl::OUString& sDot = KabCatalog::getDot();
-
- while (xResult->next())
- {
- // aName = xRow->getString(2);
- // aName += sDot;
- aName = xRow->getString(3);
- aVector.push_back(aName);
- }
- }
- if (m_pTables)
- m_pTables->reFill(aVector);
- else
- m_pTables = new KabTables(m_xMetaData,*this,m_aMutex,aVector);
-}
-// -------------------------------------------------------------------------
-void KabCatalog::refreshViews()
-{
-}
-// -------------------------------------------------------------------------
-void KabCatalog::refreshGroups()
-{
-}
-// -------------------------------------------------------------------------
-void KabCatalog::refreshUsers()
-{
-}
-// -------------------------------------------------------------------------
-const ::rtl::OUString& KabCatalog::getDot()
-{
- static const ::rtl::OUString sDot = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("."));
- return sDot;
-}
-// -----------------------------------------------------------------------------
-
-// XTablesSupplier
-Reference< XNameAccess > SAL_CALL KabCatalog::getTables( ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(rBHelper.bDisposed);
-
- try
- {
- if (!m_pTables)
- refreshTables();
- }
- catch( const RuntimeException& )
- {
- // allowed to leave this method
- throw;
- }
- catch( const Exception& )
- {
- // allowed
- }
-
- return m_pTables;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KCatalog.hxx b/connectivity/source/drivers/kab/KCatalog.hxx
deleted file mode 100644
index b24a0a92db..0000000000
--- a/connectivity/source/drivers/kab/KCatalog.hxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_KAB_CATALOG_HXX_
-#define _CONNECTIVITY_KAB_CATALOG_HXX_
-
-#include "connectivity/sdbcx/VCatalog.hxx"
-
-namespace connectivity
-{
- namespace kab
- {
- class KabConnection;
-
- class KabCatalog : public connectivity::sdbcx::OCatalog
- {
- KabConnection* m_pConnection; // used to get the metadata
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier
-
- public:
- KabCatalog(KabConnection* _pCon);
-
- inline KabConnection* getConnection() const { return m_pConnection; }
-
- static const ::rtl::OUString& getDot();
-
- // implementation of the pure virtual methods
- virtual void refreshTables();
- virtual void refreshViews();
- virtual void refreshGroups();
- virtual void refreshUsers();
-
- // XTablesSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTables(
- ) throw(::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // _CONNECTIVITY_KAB_CATALOG_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KColumns.cxx b/connectivity/source/drivers/kab/KColumns.cxx
deleted file mode 100644
index 4fd9ca7cb9..0000000000
--- a/connectivity/source/drivers/kab/KColumns.cxx
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "KColumns.hxx"
-#include "KTable.hxx"
-#include "KTables.hxx"
-#include "KCatalog.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-
-using namespace connectivity::kab;
-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;
-
-// -------------------------------------------------------------------------
-sdbcx::ObjectType KabColumns::createObject(const ::rtl::OUString& _rName)
-{
- Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(
- Any(),
- m_pTable->getSchema(),
- m_pTable->getTableName(),
- _rName);
-
- sdbcx::ObjectType xRet = NULL;
- if (xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
-
- while (xResult->next())
- {
- if (xRow->getString(4) == _rName)
- {
- OColumn* pRet = new OColumn(
- _rName,
- xRow->getString(6),
- xRow->getString(13),
- xRow->getString(12),
- xRow->getInt(11),
- xRow->getInt(7),
- xRow->getInt(9),
- xRow->getInt(5),
- sal_False,
- sal_False,
- sal_False,
- sal_True);
- xRet = pRet;
- break;
- }
- }
- }
-
- return xRet;
-}
-// -------------------------------------------------------------------------
-void KabColumns::impl_refresh() throw(RuntimeException)
-{
- m_pTable->refreshColumns();
-}
-// -------------------------------------------------------------------------
-KabColumns::KabColumns( KabTable* _pTable,
- ::osl::Mutex& _rMutex,
- const TStringVector &_rVector)
- : sdbcx::OCollection(*_pTable, sal_True, _rMutex, _rVector),
- m_pTable(_pTable)
-{
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KColumns.hxx b/connectivity/source/drivers/kab/KColumns.hxx
deleted file mode 100644
index c31f0e1659..0000000000
--- a/connectivity/source/drivers/kab/KColumns.hxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_KAB_COLUMNS_HXX_
-#define _CONNECTIVITY_KAB_COLUMNS_HXX_
-
-#include "KTable.hxx"
-#include "connectivity/sdbcx/VCollection.hxx"
-
-namespace connectivity
-{
- namespace kab
- {
- class KabColumns : public sdbcx::OCollection
- {
- protected:
- KabTable* m_pTable;
-
- virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
- virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
-
- public:
- KabColumns( KabTable* _pTable,
- ::osl::Mutex& _rMutex,
- const TStringVector &_rVector);
- };
- }
-}
-
-#endif // _CONNECTIVITY_KAB_COLUMNS_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KConnection.cxx b/connectivity/source/drivers/kab/KConnection.cxx
deleted file mode 100644
index d612eed46a..0000000000
--- a/connectivity/source/drivers/kab/KConnection.cxx
+++ /dev/null
@@ -1,331 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "KConnection.hxx"
-#include "KDatabaseMetaData.hxx"
-#include "KStatement.hxx"
-#include "KPreparedStatement.hxx"
-#include "KDriver.hxx"
-#include "KCatalog.hxx"
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/TransactionIsolation.hpp>
-#include <shell/kde_headers.h>
-
-using namespace connectivity::kab;
-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;
-
-IMPLEMENT_SERVICE_INFO(KabConnection, "com.sun.star.sdbc.drivers.KabConnection", "com.sun.star.sdbc.Connection")
-//-----------------------------------------------------------------------------
-KabConnection::KabConnection(KabDriver* _pDriver)
- : OMetaConnection_BASE(m_aMutex),
- OSubComponent<KabConnection, KabConnection_BASE>((::cppu::OWeakObject*)_pDriver, this),
- m_xMetaData(NULL),
- m_pAddressBook(NULL),
- m_pDriver(_pDriver)
-{
- m_pDriver->acquire();
-}
-//-----------------------------------------------------------------------------
-KabConnection::~KabConnection()
-{
- if (!isClosed())
- close();
-
- m_pDriver->release();
- m_pDriver = NULL;
-}
-//-----------------------------------------------------------------------------
-void SAL_CALL KabConnection::release() throw()
-{
- relase_ChildImpl();
-}
-// -----------------------------------------------------------------------------
-void KabConnection::construct(const ::rtl::OUString&, const Sequence< PropertyValue >&) throw(SQLException)
-{
- osl_incrementInterlockedCount( &m_refCount );
-
- // create a KDE address book object
- m_pAddressBook = KABC::StdAddressBook::self();
- m_pAddressBook->setAutomaticSave(false);
-// perharps we should analyze the URL to know whether the addressbook is local, over LDAP, etc...
-// perharps we should get some user and password information from "info" properties
-
- osl_decrementInterlockedCount( &m_refCount );
-}
-// XServiceInfo
-// --------------------------------------------------------------------------------
-Reference< XStatement > SAL_CALL KabConnection::createStatement( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
-
- // create a statement
- // the statement can only be executed once
- Reference< XStatement > xReturn = new KabStatement(this);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
- return xReturn;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL KabConnection::prepareStatement( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
-
- // create a statement
- // the statement can only be executed more than once
- Reference< XPreparedStatement > xReturn = new KabPreparedStatement(this, _sSql);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
- return xReturn;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL KabConnection::prepareCall( const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
-
- // not implemented yet :-) a task to do
- return NULL;
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabConnection::nativeSQL( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- // when you need to transform SQL92 to you driver specific you can do it here
-
- return _sSql;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL KabConnection::setAutoCommit( sal_Bool ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
- // here you have to set your commit mode please have a look at the jdbc documentation to get a clear explanation
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL KabConnection::getAutoCommit( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
- // you have to distinguish which if you are in autocommit mode or not
- // at normal case true should be fine here
-
- return sal_True;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL KabConnection::commit( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
-
- // when you database does support transactions you should commit here
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL KabConnection::rollback( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
-
- // same as commit but for the other case
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL KabConnection::isClosed( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- // just simple -> we are closed when we are disposed, that means someone called dispose(); (XComponent)
- return KabConnection_BASE::rBHelper.bDisposed;
-}
-// --------------------------------------------------------------------------------
-Reference< XDatabaseMetaData > SAL_CALL KabConnection::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
-
- // here we have to create the class with biggest interface
- // The answer is 42 :-)
- Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
- if (!xMetaData.is())
- {
- xMetaData = new KabDatabaseMetaData(this); // need the connection because it can return it
- m_xMetaData = xMetaData;
- }
-
- return xMetaData;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL KabConnection::setReadOnly( sal_Bool ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
-
- // set you connection to readonly
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL KabConnection::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
-
- // return if your connection to readonly
- return sal_False;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL KabConnection::setCatalog( const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
-
- // if your database doesn't work with catalogs you go to next method otherwise you kjnow what to do
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabConnection::getCatalog( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
-
-
- // return your current catalog
- return ::rtl::OUString();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL KabConnection::setTransactionIsolation( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
-
- // set your isolation level
- // please have a look at @see com.sun.star.sdbc.TransactionIsolation
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
-
-
- // please have a look at @see com.sun.star.sdbc.TransactionIsolation
- return TransactionIsolation::NONE;
-}
-// --------------------------------------------------------------------------------
-Reference< ::com::sun::star::container::XNameAccess > SAL_CALL KabConnection::getTypeMap( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
-
- // if your driver has special database types you can return it here
-
- return NULL;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL KabConnection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& ) throw(SQLException, RuntimeException)
-{
- // the other way around
-}
-// --------------------------------------------------------------------------------
-// XCloseable
-void SAL_CALL KabConnection::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabConnection_BASE::rBHelper.bDisposed);
- }
- dispose();
-}
-// --------------------------------------------------------------------------------
-// XWarningsSupplier
-Any SAL_CALL KabConnection::getWarnings( ) throw(SQLException, RuntimeException)
-{
- // when you collected some warnings -> return it
- return Any();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL KabConnection::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- // you should clear your collected warnings here
-}
-//------------------------------------------------------------------------------
-void KabConnection::disposing()
-{
- // we noticed that we should be destroied in near future so we have to dispose our statements
- ::osl::MutexGuard aGuard(m_aMutex);
-
- for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i)
- {
- Reference< XComponent > xComp(i->get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- }
- m_aStatements.clear();
-
- if (m_pAddressBook != NULL)
- {
- m_pAddressBook->close();
- m_pAddressBook = NULL;
- }
-
- m_xMetaData = ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData>();
-
- dispose_ChildImpl();
- KabConnection_BASE::disposing();
-}
-// -----------------------------------------------------------------------------
-Reference< XTablesSupplier > SAL_CALL KabConnection::createCatalog()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- Reference< XTablesSupplier > xTab = m_xCatalog;
- if (!m_xCatalog.is())
- {
- KabCatalog *pCat = new KabCatalog(this);
- xTab = pCat;
- m_xCatalog = xTab;
- }
- return xTab;
-}
-// -----------------------------------------------------------------------------
-::KABC::AddressBook* KabConnection::getAddressBook() const
-{
- return m_pAddressBook;
-}
-// -----------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL createKabConnection( void* _pDriver )
-{
- KabConnection* pConnection = new KabConnection( static_cast< KabDriver* >( _pDriver ) );
- // by definition, the pointer crossing library boundaries as void ptr is acquired once
- pConnection->acquire();
- return pConnection;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KConnection.hxx b/connectivity/source/drivers/kab/KConnection.hxx
deleted file mode 100644
index df49547820..0000000000
--- a/connectivity/source/drivers/kab/KConnection.hxx
+++ /dev/null
@@ -1,142 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_KAB_CONNECTION_HXX_
-#define _CONNECTIVITY_KAB_CONNECTION_HXX_
-
-#include <map>
-#include "OSubComponent.hxx"
-#include "connectivity/CommonTools.hxx"
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/sdbc/SQLWarning.hpp>
-#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
-#include <com/sun/star/sdbc/XConnection.hpp>
-#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#include <comphelper/broadcasthelper.hxx>
-#include <cppuhelper/compbase3.hxx>
-
-namespace KABC
-{
- class StdAddressBook;
- class AddressBook;
-}
-
-namespace connectivity
-{
- namespace kab
- {
-
- typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XConnection,
- ::com::sun::star::sdbc::XWarningsSupplier,
- ::com::sun::star::lang::XServiceInfo
- > OMetaConnection_BASE;
-
- class KabStatement_Base;
- class KabDriver;
- class KabDatabaseMetaData;
-
- typedef OMetaConnection_BASE KabConnection_BASE; // implements basics and text encoding
- typedef std::vector< ::com::sun::star::uno::WeakReferenceHelper > OWeakRefArray;
-
- class KabConnection : public comphelper::OBaseMutex,
- public KabConnection_BASE,
- public OSubComponent<KabConnection, KabConnection_BASE>
- {
- friend class OSubComponent<KabConnection, KabConnection_BASE>;
-
- protected:
- //====================================================================
- // Data attributes
- //====================================================================
- ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
-
- OWeakRefArray m_aStatements; // vector containing a list of all the Statement objects
- // for this Connection
-
- ::KABC::StdAddressBook* m_pAddressBook; // the address book
- KabDriver* m_pDriver; // pointer to the owning driver object
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier>
- m_xCatalog; // needed for the SQL interpreter
-
- public:
- virtual void construct( const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException);
-
- KabConnection(KabDriver* _pDriver);
- virtual ~KabConnection();
-
- void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException);
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
-
- // XInterface
- virtual void SAL_CALL release() throw();
-
- // XServiceInfo
- DECLARE_SERVICE_INFO();
-
- // XConnection
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XWarningsSupplier
- virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // needed for the SQL interpreter
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL createCatalog();
-
- // accessors
- inline KabDriver* getDriver() const { return m_pDriver;}
- ::KABC::AddressBook* getAddressBook() const;
- };
- }
-}
-
-#endif // _CONNECTIVITY_KAB_CONNECTION_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KDEInit.cxx b/connectivity/source/drivers/kab/KDEInit.cxx
deleted file mode 100644
index 7264f60862..0000000000
--- a/connectivity/source/drivers/kab/KDEInit.cxx
+++ /dev/null
@@ -1,158 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "KDEInit.h"
-#include <osl/diagnose.h>
-#include <osl/process.h>
-#include <shell/kde_headers.h>
-
-namespace connectivity
-{
- namespace kab
- {
- // ===============================================================
- // = KDEInit
- // ===============================================================
- class KDEInit
- {
- private:
- /// KDE application if we own it
- static KApplication* s_pKApplication;
- static bool s_bDidInsertCatalogue;
-
- public:
- static void Init();
- static void Shutdown();
- };
-
- // ---------------------------------------------------------------
- KApplication* KDEInit::s_pKApplication = NULL;
- bool KDEInit::s_bDidInsertCatalogue = false;
-
- // ---------------------------------------------------------------
- void KDEInit::Init()
- {
- // TODO: All this is not thread-safe
-
- // we create a KDE application only if it is not already done
- if (KApplication::kApplication() == NULL)
- {
- OSL_ENSURE(s_pKApplication == NULL, "KDEInit::Init: inconsistency in the application pointers!");
-
- char *kabargs[1] = {(char*)"libkab1"};
- KCmdLineArgs::init(1, kabargs, "KAddressBook", *kabargs, "Address Book driver", KAB_DRIVER_VERSION);
-
- s_pKApplication = new KApplication(false, false);
- }
-
- // set language
- rtl_Locale *pProcessLocale;
- osl_getProcessLocale(&pProcessLocale);
- // sal_Unicode and QChar are (currently) both 16 bits characters
- QString aLanguage(
- (const QChar *) pProcessLocale->Language->buffer,
- (int) pProcessLocale->Language->length);
- KGlobal::locale()->setLanguage(aLanguage);
-
- // load KDE address book's localized messages
- KGlobal::locale()->insertCatalogue("kaddressbook");
- s_bDidInsertCatalogue = true;
- }
-
- // ---------------------------------------------------------------
- void KDEInit::Shutdown()
- {
- if ( s_bDidInsertCatalogue )
- // this guard is necessary, since KDE 3.3 seems to crash if we remove a catalogue
- // which we did not previously insert
- KGlobal::locale()->removeCatalogue("kaddressbook");
-
- if ( s_pKApplication != NULL )
- {
- delete s_pKApplication;
- s_pKApplication = NULL;
- }
- }
- }
-}
-
-// =======================================================================
-namespace
-{
- double normalizeVersion( unsigned int major, unsigned int minor )
- {
- return major + 1.0 * minor / 1000;
- }
-}
-
-// -----------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL initKApplication()
-{
- ::connectivity::kab::KDEInit::Init();
-}
-
-// -----------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL shutdownKApplication()
-{
- ::connectivity::kab::KDEInit::Shutdown();
-}
-// -----------------------------------------------------------------------
-/** checks whether the KDE version on the system we're running at is supported
- by the driver
-
- Has to be called before any other code from this library, in particular,
- it has to be called before initKApplication()
-
- If this function returns <code>0</code>, then no other code from this library
- has to be called, else the results are unpredictable.
-
- @return
- <ul><li><code>0</code> if the KDE version is supportednon</li>
- <li>a negative value if the version is too old</li>
- <li>a positive value if the version is too new to know whether it works with this driver</li>
- </ul>
-
- #i60062# / 2006-01-06 / frank.schoenheit@sun.com
-*/
-extern "C" SAL_DLLPUBLIC_EXPORT int SAL_CALL matchKDEVersion()
-{
- double nMinVersion = normalizeVersion( MIN_KDE_VERSION_MAJOR, MIN_KDE_VERSION_MINOR );
- double nCurVersion = normalizeVersion( ::KDE::versionMajor(), ::KDE::versionMinor() );
- double nMaxVersion = normalizeVersion( MAX_KDE_VERSION_MAJOR, MAX_KDE_VERSION_MINOR );
-
- if ( nCurVersion < nMinVersion )
- return -1;
- if ( nCurVersion > nMaxVersion )
- return 1;
-
- return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KDEInit.h b/connectivity/source/drivers/kab/KDEInit.h
deleted file mode 100755
index c1f3963561..0000000000
--- a/connectivity/source/drivers/kab/KDEInit.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONNECTIVITY_KAB_KDEINIT_H
-#define CONNECTIVITY_KAB_KDEINIT_H
-
-// the address book driver's version
-#define KAB_DRIVER_VERSION "0.2"
-#define KAB_DRIVER_VERSION_MAJOR 0
-#define KAB_DRIVER_VERSION_MINOR 2
-
-// the minimum KDE version which is required at runtime
-#define MIN_KDE_VERSION_MAJOR 3
-#define MIN_KDE_VERSION_MINOR 2
-
-#define MAX_KDE_VERSION_MAJOR 3
-#define MAX_KDE_VERSION_MINOR 6
-
-
-#endif // CONNECTIVITY_KAB_KDEINIT_H
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KDatabaseMetaData.cxx b/connectivity/source/drivers/kab/KDatabaseMetaData.cxx
deleted file mode 100644
index 18c8915dec..0000000000
--- a/connectivity/source/drivers/kab/KDatabaseMetaData.cxx
+++ /dev/null
@@ -1,1083 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "KDatabaseMetaData.hxx"
-#include "kfields.hxx"
-#include "KDEInit.h"
-#include <shell/kde_headers.h>
-#include "FDatabaseMetaDataResultSet.hxx"
-#include "OTypeInfo.hxx"
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/TransactionIsolation.hpp>
-
-using namespace connectivity::kab;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-
-KabDatabaseMetaData::KabDatabaseMetaData(KabConnection* _pCon)
- : m_xConnection(_pCon),
- m_bUseCatalog(sal_True)
-{
- OSL_ENSURE(_pCon,"KabDatabaseMetaData::KabDatabaseMetaData: No connection set!");
-
- osl_incrementInterlockedCount( &m_refCount );
- m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable());
- osl_decrementInterlockedCount( &m_refCount );
-}
-// -------------------------------------------------------------------------
-KabDatabaseMetaData::~KabDatabaseMetaData()
-{
-}
-// -------------------------------------------------------------------------
-const ::rtl::OUString & KabDatabaseMetaData::getAddressBookTableName()
-{
- static const ::rtl::OUString aAddressBookTableName
- (::rtl::OUString::createFromAscii( i18n("Address Book") ));
-
- return aAddressBookTableName;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aVal;
- if (m_bUseCatalog)
- { // do some special here for you database
- }
-
- return aVal;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException)
-{
- // MaxTablesInSelect describes how many tables can participate in the FROM part of a given SELECT statement,
- // currently, the resultset/statement implementations can cope with one table only
- sal_Int32 nValue = 1;
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aVal;
- if (m_bUseCatalog)
- {
- }
- return aVal;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException)
-{
- // normally this is "
- ::rtl::OUString aVal(RTL_CONSTASCII_USTRINGPARAM("\""));
- return aVal;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aVal;
- return aVal;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException)
-{
- sal_Bool bValue = sal_False;
- if (m_bUseCatalog)
- {
- }
- return bValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException)
-{
- return sal_True; // should be supported at least
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- // for the moment, we have read-only addresses, but this might change in the future
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsConvert( sal_Int32, sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
-{
- // if someday we support more than the default address book,
- // this method should return the URL which was used to create it
- ::rtl::OUString aValue( RTL_CONSTASCII_USTRINGPARAM( "sdbc:address:kab:" ));
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue( RTL_CONSTASCII_USTRINGPARAM( "kab" ));
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue(RTL_CONSTASCII_USTRINGPARAM(KAB_DRIVER_VERSION));
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
-{
- return KAB_DRIVER_VERSION_MAJOR;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- return TransactionIsolation::NONE;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
-{
- return KAB_DRIVER_VERSION_MINOR;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- switch (setType)
- {
- case ResultSetType::FORWARD_ONLY:
- case ResultSetType::SCROLL_INSENSITIVE:
- return sal_True;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 ) throw(SQLException, RuntimeException)
-{
- switch (setType)
- {
- case ResultSetType::FORWARD_ONLY:
- case ResultSetType::SCROLL_INSENSITIVE:
- return sal_True;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::ownUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::ownDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::ownInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::othersUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::othersDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::othersInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::updatesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::deletesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::insertsAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL KabDatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException)
-{
- return (Reference< XConnection >) m_xConnection.get();
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
-{
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
- Reference< XResultSet > xRef = pResult;
-
- static ODatabaseMetaDataResultSet::ORows aRows;
- static const ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
-
- if (aRows.empty())
- {
- ODatabaseMetaDataResultSet::ORow aRow(2);
- aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[1] = new ORowSetValueDecorator(aTable);
- aRows.push_back(aRow);
- }
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException)
-{
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
- Reference< XResultSet > xRef = pResult;
-
- static ODatabaseMetaDataResultSet::ORows aRows;
- if (aRows.empty())
- {
- ODatabaseMetaDataResultSet::ORow aRow(19);
-
- aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR")));
- aRow[2] = new ORowSetValueDecorator(DataType::CHAR);
- aRow[3] = new ORowSetValueDecorator((sal_Int32) 254);
- aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[7] = new ORowSetValueDecorator((sal_Int32) ColumnValue::NULLABLE);
- aRow[8] = ODatabaseMetaDataResultSet::get1Value();
- aRow[9] = new ORowSetValueDecorator((sal_Int32) ColumnSearch::CHAR);
- aRow[10] = ODatabaseMetaDataResultSet::get1Value();
- aRow[11] = ODatabaseMetaDataResultSet::get0Value();
- aRow[12] = ODatabaseMetaDataResultSet::get0Value();
- aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[14] = ODatabaseMetaDataResultSet::get0Value();
- aRow[15] = ODatabaseMetaDataResultSet::get0Value();
- aRow[16] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[17] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[18] = new ORowSetValueDecorator((sal_Int32) 10);
- aRows.push_back(aRow);
-// Much more types might appear in KDE address books
-// To be completed
- }
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCatalogs );
-}
-// -----------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eSchemas );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getColumnPrivileges(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString&,
- const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumnPrivileges );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getColumns(
- const Any&,
- const ::rtl::OUString&,
- const ::rtl::OUString& tableNamePattern,
- const ::rtl::OUString& columnNamePattern) throw(SQLException, RuntimeException)
-{
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
- Reference< XResultSet > xRef = pResult;
-
- ODatabaseMetaDataResultSet::ORows aRows;
-
- if (match(tableNamePattern, getAddressBookTableName(), '\0'))
- {
- ODatabaseMetaDataResultSet::ORow aRow(19);
-
- aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[3] = new ORowSetValueDecorator(getAddressBookTableName());
- aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[9] = ODatabaseMetaDataResultSet::get0Value();
- aRow[10] = new ORowSetValueDecorator((sal_Int32) 10);
- aRow[11] = ODatabaseMetaDataResultSet::get1Value();
- aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[16] = new ORowSetValueDecorator((sal_Int32) 254);
- aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES")));
-
- sal_Int32 nPosition = 1;
- QString aQtName;
- ::rtl::OUString sName;
-
- aQtName = ::KABC::Addressee::revisionLabel();
- sName = (const sal_Unicode *) aQtName.ucs2();
- if (match(columnNamePattern, sName, '\0'))
- {
- aRow[4] = new ORowSetValueDecorator(sName);
- aRow[5] = new ORowSetValueDecorator(DataType::TIMESTAMP);
- aRow[6] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")));
- aRow[17] = new ORowSetValueDecorator(nPosition++);
- aRows.push_back(aRow);
- }
-
- ::KABC::Field::List aFields = ::KABC::Field::allFields();
- ::KABC::Field::List::iterator aField;
-
- for ( aField = aFields.begin();
- aField != aFields.end();
- ++aField, ++nPosition)
- {
- aQtName = (*aField)->label();
- sName = (const sal_Unicode *) aQtName.ucs2();
- if (match(columnNamePattern, sName, '\0'))
- {
- aRow[4] = new ORowSetValueDecorator(sName);
- aRow[5] = new ORowSetValueDecorator(DataType::CHAR);
- aRow[6] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR")));
- aRow[7] = new ORowSetValueDecorator((sal_Int32) 256);
-// Might be VARCHAR and not CHAR[256]...
- aRow[17] = new ORowSetValueDecorator(nPosition);
- aRows.push_back(aRow);
- }
- }
- }
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTables(
- const Any&,
- const ::rtl::OUString&,
- const ::rtl::OUString&,
- const Sequence< ::rtl::OUString >& types) throw(SQLException, RuntimeException)
-{
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
- Reference< XResultSet > xRef = pResult;
-
- // 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 const ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
- sal_Bool bTableFound = sal_False;
- const ::rtl::OUString* p = types.getConstArray(),
- * pEnd = p + types.getLength();
-
- if (p == pEnd)
- {
- bTableFound = sal_True;
- }
- else while (p < pEnd)
- {
- if (match(*p, aTable, '\0'))
- {
- bTableFound = sal_True;
- break;
- }
- p++;
- }
- if (!bTableFound)
- return xRef;
-
- static ODatabaseMetaDataResultSet::ORows aRows;
-
- if (aRows.empty())
- {
- ODatabaseMetaDataResultSet::ORow aRow(6);
-
- aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[3] = new ORowSetValueDecorator(getAddressBookTableName());
- aRow[4] = new ORowSetValueDecorator(aTable);
- aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRows.push_back(aRow);
- }
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getProcedureColumns(
- const Any&, const ::rtl::OUString&,
- const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedureColumns );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getProcedures(
- const Any&, const ::rtl::OUString&,
- const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedures );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getVersionColumns(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
-{
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
-
- Reference< XResultSet > xRef = pResult;
-
- ODatabaseMetaDataResultSet::ORows aRows;
-
- if (table == getAddressBookTableName())
- {
- ODatabaseMetaDataResultSet::ORow aRow( 9 );
- QString aQtName = ::KABC::Addressee::revisionLabel();
- ::rtl::OUString sName = (const sal_Unicode *) aQtName.ucs2();
-
- aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
-
- aRow[2] = new ORowSetValueDecorator(sName);
- aRow[3] = new ORowSetValueDecorator(DataType::TIMESTAMP);
- aRow[4] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")));
-
- aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[7] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
-
- aRows.push_back(aRow);
- }
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getExportedKeys(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eExportedKeys );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getImportedKeys(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eImportedKeys );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getPrimaryKeys(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::ePrimaryKeys );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getIndexInfo(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString&,
- sal_Bool, sal_Bool ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eIndexInfo );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getBestRowIdentifier(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString&, sal_Int32,
- sal_Bool ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eBestRowIdentifier );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTablePrivileges(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getCrossReference(
- const Any&, const ::rtl::OUString&,
- const ::rtl::OUString&, const Any&,
- const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCrossReference );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getUDTs( const Any&, const ::rtl::OUString&, const ::rtl::OUString&, const Sequence< sal_Int32 >& ) throw(SQLException, RuntimeException)
-{
- OSL_FAIL("Not implemented yet!");
- throw SQLException();
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KDatabaseMetaData.hxx b/connectivity/source/drivers/kab/KDatabaseMetaData.hxx
deleted file mode 100644
index 00b0bb6414..0000000000
--- a/connectivity/source/drivers/kab/KDatabaseMetaData.hxx
+++ /dev/null
@@ -1,216 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_KAB_DATABASEMETADATA_HXX_
-#define _CONNECTIVITY_KAB_DATABASEMETADATA_HXX_
-
-#include "KConnection.hxx"
-#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-#include <cppuhelper/implbase1.hxx>
-
-namespace connectivity
-{
- namespace kab
- {
- //**************************************************************
- //************ Class: KabDatabaseMetaData
- //**************************************************************
-
- typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XDatabaseMetaData> KabDatabaseMetaData_BASE;
-
- class KabDatabaseMetaData : public KabDatabaseMetaData_BASE
- {
- ::com::sun::star::uno::Reference< KabConnection > m_xConnection;
- sal_Bool m_bUseCatalog;
-
- public:
-
- inline KabConnection* getOwnConnection() const { return m_xConnection.get(); }
-
- KabDatabaseMetaData(KabConnection* _pCon);
- static const ::rtl::OUString & getAddressBookTableName();
- virtual ~KabDatabaseMetaData();
-
- // this interface is really BIG
- // XDatabaseMetaData
- virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getUserName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDriverName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL usesLocalFiles( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getIdentifierQuoteString( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isCatalogAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalogSeparator( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsUnion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsUnionAll( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxConnections( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxStatements( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getSchemas( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCatalogs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getVersionColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog, const ::rtl::OUString& primarySchema, const ::rtl::OUString& primaryTable, const ::com::sun::star::uno::Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTypeInfo( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // _CONNECTIVITY_KAB_DATABASEMETADATA_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KDriver.cxx b/connectivity/source/drivers/kab/KDriver.cxx
deleted file mode 100644
index 549d8aa745..0000000000
--- a/connectivity/source/drivers/kab/KDriver.cxx
+++ /dev/null
@@ -1,475 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "KDriver.hxx"
-#include "KDEInit.h"
-#include "KConnection.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/sdb/SQLContext.hpp>
-#include <com/sun/star/lang/NullPointerException.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
-/** === end UNO includes === **/
-#include <rtl/ustrbuf.hxx>
-#include <tools/diagnose_ex.h>
-#include "resource/kab_res.hrc"
-#include "resource/sharedresources.hxx"
-
-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::sdb;
-using namespace com::sun::star::frame;
-using namespace connectivity::kab;
-
-// =======================================================================
-// = KabImplModule
-// =======================================================================
-// --------------------------------------------------------------------------------
-KabImplModule::KabImplModule( const Reference< XMultiServiceFactory >& _rxFactory )
- :m_xORB(_rxFactory)
- ,m_bAttemptedLoadModule(false)
- ,m_bAttemptedInitialize(false)
- ,m_hConnectorModule(NULL)
- ,m_pConnectionFactoryFunc(NULL)
- ,m_pApplicationInitFunc(NULL)
- ,m_pApplicationShutdownFunc(NULL)
- ,m_pKDEVersionCheckFunc(NULL)
-{
- if ( !m_xORB.is() )
- throw NullPointerException();
-}
-
-// --------------------------------------------------------------------------------
-bool KabImplModule::isKDEPresent()
-{
- if ( !impl_loadModule() )
- return false;
-
- return true;
-}
-
-// --------------------------------------------------------------------------------
-KabImplModule::KDEVersionType KabImplModule::matchKDEVersion()
-{
- OSL_PRECOND( m_pKDEVersionCheckFunc, "KabImplModule::matchKDEVersion: module not loaded!" );
-
- int nVersionInfo = (*m_pKDEVersionCheckFunc)();
- if ( nVersionInfo < 0 )
- return eTooOld;
- if ( nVersionInfo > 0 )
- return eToNew;
- return eSupported;
-}
-
-// --------------------------------------------------------------------------------
-namespace
-{
- template< typename FUNCTION >
- void lcl_getFunctionFromModuleOrUnload( oslModule& _rModule, const sal_Char* _pAsciiSymbolName, FUNCTION& _rFunction )
- {
- _rFunction = NULL;
- if ( _rModule )
- {
- //
- const ::rtl::OUString sSymbolName = ::rtl::OUString::createFromAscii( _pAsciiSymbolName );
- _rFunction = (FUNCTION)( osl_getSymbol( _rModule, sSymbolName.pData ) );
-
- if ( !_rFunction )
- { // did not find the symbol
- OSL_FAIL( ::rtl::OString( "lcl_getFunctionFromModuleOrUnload: could not find the symbol " ) + ::rtl::OString( _pAsciiSymbolName ) );
- osl_unloadModule( _rModule );
- _rModule = NULL;
- }
- }
- }
-}
-
-// --------------------------------------------------------------------------------
-extern "C" { void SAL_CALL thisModule() {} }
-
-bool KabImplModule::impl_loadModule()
-{
- if ( m_bAttemptedLoadModule )
- return ( m_hConnectorModule != NULL );
- m_bAttemptedLoadModule = true;
-
- OSL_ENSURE( !m_hConnectorModule && !m_pConnectionFactoryFunc && !m_pApplicationInitFunc && !m_pApplicationShutdownFunc && !m_pKDEVersionCheckFunc,
- "KabImplModule::impl_loadModule: inconsistence: inconsistency (never attempted load before, but some values already set)!");
-
- const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM( SAL_MODULENAME( "kabdrv1" ) ));
- m_hConnectorModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, SAL_LOADMODULE_NOW ); // LAZY! #i61335#
- OSL_ENSURE( m_hConnectorModule, "KabImplModule::impl_loadModule: could not load the implementation library!" );
- if ( !m_hConnectorModule )
- return false;
-
- lcl_getFunctionFromModuleOrUnload( m_hConnectorModule, "createKabConnection", m_pConnectionFactoryFunc );
- lcl_getFunctionFromModuleOrUnload( m_hConnectorModule, "initKApplication", m_pApplicationInitFunc );
- lcl_getFunctionFromModuleOrUnload( m_hConnectorModule, "shutdownKApplication", m_pApplicationShutdownFunc );
- lcl_getFunctionFromModuleOrUnload( m_hConnectorModule, "matchKDEVersion", m_pKDEVersionCheckFunc );
-
- if ( !m_hConnectorModule )
- // one of the symbols did not exist
- throw RuntimeException();
-
- return true;
-}
-
-// --------------------------------------------------------------------------------
-void KabImplModule::impl_unloadModule()
-{
- OSL_PRECOND( m_hConnectorModule != NULL, "KabImplModule::impl_unloadModule: no module!" );
-
- osl_unloadModule( m_hConnectorModule );
- m_hConnectorModule = NULL;
-
- m_pConnectionFactoryFunc = NULL;
- m_pApplicationInitFunc = NULL;
- m_pApplicationShutdownFunc = NULL;
- m_pKDEVersionCheckFunc = NULL;
-
- m_bAttemptedLoadModule = false;
-}
-
-// --------------------------------------------------------------------------------
-void KabImplModule::init()
-{
- if ( !impl_loadModule() )
- impl_throwNoKdeException();
-
- // if we're not running on a supported version, throw
- KabImplModule::KDEVersionType eKDEVersion = matchKDEVersion();
-
- if ( eKDEVersion == eTooOld )
- impl_throwKdeTooOldException();
-
- if ( ( eKDEVersion == eToNew ) && !impl_doAllowNewKDEVersion() )
- impl_throwKdeTooNewException();
-
- if ( !m_bAttemptedInitialize )
- {
- m_bAttemptedInitialize = true;
- (*m_pApplicationInitFunc)();
- }
-}
-
-// --------------------------------------------------------------------------------
-bool KabImplModule::impl_doAllowNewKDEVersion()
-{
- try
- {
- Reference< XMultiServiceFactory > xConfigProvider(
- m_xORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ) ),
- UNO_QUERY_THROW );
- Sequence< Any > aCreationArgs(1);
- aCreationArgs[0] <<= PropertyValue(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ),
- 0,
- makeAny( KabDriver::impl_getConfigurationSettingsPath() ),
- PropertyState_DIRECT_VALUE );
- Reference< XPropertySet > xSettings( xConfigProvider->createInstanceWithArguments(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" ) ),
- aCreationArgs ),
- UNO_QUERY_THROW );
-
- sal_Bool bDisableCheck = sal_False;
- xSettings->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableKDEMaximumVersionCheck" ) ) ) >>= bDisableCheck;
-
- return bDisableCheck != sal_False;
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return false;
-}
-
-// --------------------------------------------------------------------------------
-void KabImplModule::impl_throwNoKdeException()
-{
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(
- STR_NO_KDE_INST
- ) );
- impl_throwGenericSQLException( sError );
-}
-
-// --------------------------------------------------------------------------------
-void KabImplModule::impl_throwKdeTooOldException()
-{
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(
- STR_KDE_VERSION_TOO_OLD,
- "$major$",::rtl::OUString::valueOf((sal_Int32)MIN_KDE_VERSION_MAJOR),
- "$minor$",::rtl::OUString::valueOf((sal_Int32)MIN_KDE_VERSION_MINOR)
- ) );
- impl_throwGenericSQLException( sError );
-}
-
-// --------------------------------------------------------------------------------
-void KabImplModule::impl_throwGenericSQLException( const ::rtl::OUString& _rMessage )
-{
- SQLException aError;
- aError.Message = _rMessage;
- aError.SQLState = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "S1000" ) );
- aError.ErrorCode = 0;
- throw aError;
-}
-
-// --------------------------------------------------------------------------------
-void KabImplModule::impl_throwKdeTooNewException()
-{
- ::connectivity::SharedResources aResources;
-
- SQLException aError;
- aError.Message = aResources.getResourceStringWithSubstitution(
- STR_KDE_VERSION_TOO_NEW,
- "$major$",::rtl::OUString::valueOf((sal_Int32)MIN_KDE_VERSION_MAJOR),
- "$minor$",::rtl::OUString::valueOf((sal_Int32)MIN_KDE_VERSION_MINOR)
- );
- aError.SQLState = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "S1000" ) );
- aError.ErrorCode = 0;
-
- SQLContext aDetails;
- ::rtl::OUStringBuffer aMessage;
- aMessage.append( aResources.getResourceString(STR_KDE_VERSION_TOO_NEW_WORK_AROUND) );
-
- aMessage.appendAscii( "Sub disableKDEMaxVersionCheck\n" );
- aMessage.appendAscii( " BasicLibraries.LoadLibrary( \"Tools\" )\n" );
-
- aMessage.appendAscii( " Dim configNode as Object\n" );
- aMessage.appendAscii( " configNode = GetRegistryKeyContent( \"" );
- aMessage.append( KabDriver::impl_getConfigurationSettingsPath() );
- aMessage.appendAscii( "\", true )\n" );
-
- aMessage.appendAscii( " configNode.DisableKDEMaximumVersionCheck = TRUE\n" );
- aMessage.appendAscii( " configNode.commitChanges\n" );
- aMessage.appendAscii( "End Sub\n" );
-
- aDetails.Message = aMessage.makeStringAndClear();
-
- aError.NextException <<= aDetails;
-
- throw aError;
-}
-
-// --------------------------------------------------------------------------------
-KabConnection* KabImplModule::createConnection( KabDriver* _pDriver ) const
-{
- OSL_PRECOND( m_hConnectorModule, "KabImplModule::createConnection: not initialized!" );
-
- void* pUntypedConnection = (*m_pConnectionFactoryFunc)( _pDriver );
- if ( !pUntypedConnection )
- throw RuntimeException();
-
- return static_cast< KabConnection* >( pUntypedConnection );
-}
-
-// --------------------------------------------------------------------------------
-void KabImplModule::shutdown()
-{
- if ( !m_hConnectorModule )
- return;
-
- (*m_pApplicationShutdownFunc)();
- m_bAttemptedInitialize = false;
-
- impl_unloadModule();
-}
-
-// =======================================================================
-// = KabDriver
-// =======================================================================
-KabDriver::KabDriver(
- const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory)
- : KDriver_BASE(m_aMutex),
- m_xMSFactory(_rxFactory),
- m_aImplModule(_rxFactory)
-{
- if ( !m_xMSFactory.is() )
- throw NullPointerException();
-
- osl_incrementInterlockedCount( &m_refCount );
- try
- {
- Reference< XDesktop > xDesktop(
- m_xMSFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ),
- UNO_QUERY_THROW );
- xDesktop->addTerminateListener( this );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- osl_decrementInterlockedCount( &m_refCount );
-}
-// --------------------------------------------------------------------------------
-void KabDriver::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- // when driver will be destroied so all our connections have to be destroied as well
- for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
- {
- Reference< XComponent > xComp(i->get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- }
- m_xConnections.clear();
-
- WeakComponentImplHelperBase::disposing();
-}
-// static ServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString KabDriver::getImplementationName_Static( ) throw(RuntimeException)
-{
- return rtl::OUString::createFromAscii( impl_getAsciiImplementationName() );
-}
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > KabDriver::getSupportedServiceNames_Static( ) throw (RuntimeException)
-{
- // which service is supported
- // for more information @see com.sun.star.sdbc.Driver
- Sequence< ::rtl::OUString > aSNS( 1 );
- aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver"));
-
- return aSNS;
-}
-//------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabDriver::getImplementationName( ) throw(RuntimeException)
-{
- return getImplementationName_Static();
-}
-//------------------------------------------------------------------
-sal_Bool SAL_CALL KabDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
-
- while (pSupported != pEnd && !pSupported->equals(_rServiceName))
- ++pSupported;
- return pSupported != pEnd;
-}
-//------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL KabDriver::getSupportedServiceNames( ) throw(RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-// --------------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL KabDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_aImplModule.init();
-
- // create a new connection with the given properties and append it to our vector
- KabConnection* pConnection = m_aImplModule.createConnection( this );
- OSL_POSTCOND( pConnection, "KabDriver::connect: no connection has been created by the factory!" );
-
- // by definition, the factory function returned an object which was acquired once
- Reference< XConnection > xConnection = pConnection;
- pConnection->release();
-
- // late constructor call which can throw exception and allows a correct dtor call when so
- pConnection->construct( url, info );
-
- // remember it
- m_xConnections.push_back( WeakReferenceHelper( *pConnection ) );
-
- return xConnection;
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL KabDriver::acceptsURL( const ::rtl::OUString& url )
- throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- if ( !m_aImplModule.isKDEPresent() )
- return sal_False;
-
- // here we have to look whether we support this URL format
- return (!url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:kab:")), 16));
-}
-// --------------------------------------------------------------------------------
-Sequence< DriverPropertyInfo > SAL_CALL KabDriver::getPropertyInfo( const ::rtl::OUString&, const Sequence< PropertyValue >& ) throw(SQLException, RuntimeException)
-{
- // if you have something special to say, return it here :-)
- return Sequence< DriverPropertyInfo >();
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDriver::getMajorVersion( ) throw(RuntimeException)
-{
- return KAB_DRIVER_VERSION_MAJOR;
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabDriver::getMinorVersion( ) throw(RuntimeException)
-{
- return KAB_DRIVER_VERSION_MINOR;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL KabDriver::queryTermination( const EventObject& ) throw (TerminationVetoException, RuntimeException)
-{
- // nothing to do, nothing to veto
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL KabDriver::notifyTermination( const EventObject& ) throw (RuntimeException)
-{
- m_aImplModule.shutdown();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL KabDriver::disposing( const EventObject& ) throw (RuntimeException)
-{
- // not interested in (this is the disposing of the desktop, if any)
-}
-// --------------------------------------------------------------------------------
-const sal_Char* KabDriver::impl_getAsciiImplementationName()
-{
- return "com.sun.star.comp.sdbc.kab.Driver";
- // this name is referenced in the configuration and in the kab.xml
- // Please be careful when changing it.
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString KabDriver::impl_getConfigurationSettingsPath()
-{
- ::rtl::OUStringBuffer aPath;
- aPath.appendAscii( "/org.openoffice.Office.DataAccess/DriverSettings/" );
- aPath.appendAscii( "com.sun.star.comp.sdbc.kab.Driver" );
- return aPath.makeStringAndClear();
-}
-// --------------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL KabDriver::Create( const Reference< XMultiServiceFactory >& _rxFactory ) throw( Exception )
-{
- return *(new KabDriver(_rxFactory));
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KDriver.hxx b/connectivity/source/drivers/kab/KDriver.hxx
deleted file mode 100644
index aa2d1f252b..0000000000
--- a/connectivity/source/drivers/kab/KDriver.hxx
+++ /dev/null
@@ -1,226 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_KAB_DRIVER_HXX_
-#define _CONNECTIVITY_KAB_DRIVER_HXX_
-
-/** === begin UNO includes === **/
-#include <com/sun/star/sdbc/XDriver.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/frame/XTerminateListener.hpp>
-/** === end UNO includes === **/
-#include <cppuhelper/compbase3.hxx>
-#include <osl/module.h>
-
-namespace connectivity
-{
- namespace kab
- {
- class KabConnection;
- class KabDriver;
-
- typedef void* (SAL_CALL * ConnectionFactoryFunction)( void* _pDriver );
- typedef void (SAL_CALL * ApplicationInitFunction)( void );
- typedef void (SAL_CALL * ApplicationShutdownFunction)( void );
- typedef int (SAL_CALL * KDEVersionCheckFunction)( void );
-
- typedef std::vector< ::com::sun::star::uno::WeakReferenceHelper > OWeakRefArray;
-
- // ===============================================================
- // = KabImplModule
- // ===============================================================
- class KabImplModule
- {
- private:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- m_xORB;
-
- /// Did we already attempt to load the module and to retrieve the symbols?
- bool m_bAttemptedLoadModule;
- /// Did we already check the KDE version and initialize the impl module (or at least attempted to)?
- bool m_bAttemptedInitialize;
-
- oslModule m_hConnectorModule;
- ConnectionFactoryFunction m_pConnectionFactoryFunc;
- ApplicationInitFunction m_pApplicationInitFunc;
- ApplicationShutdownFunction m_pApplicationShutdownFunc;
- KDEVersionCheckFunction m_pKDEVersionCheckFunc;
-
- public:
- KabImplModule( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory );
-
- /** determines whether there is a KDE present in the environment
- */
- bool isKDEPresent();
-
- enum KDEVersionType
- {
- eTooOld,
- eSupported,
- eToNew
- };
- /** checks whether the KDE version we're running against is supported
- @precond
- the module is loaded, i.e impl_loadModule has successfully been called
- */
- KDEVersionType matchKDEVersion();
-
- /** initializes the implementation module.
-
- @raises ::com::sun::star::uno::RuntimeException
- if the module could be loaded, but required symbols are missing
- @raises ::com::sun::star::sdbc::SQLException
- if the KDE version we're running against is not supported, or no KDE was found at all
- */
- void init();
-
- /** shuts down the impl module (and the KDE application, if we own it)
- */
- void shutdown();
-
- /** creates a new connection
- @precond
- <member>init</member> has been called before
- @raises ::com::sun::star::uno::RuntimeException
- if no connection object could be created (which is a severe error, normally impossible)
- */
- KabConnection* createConnection( KabDriver* _pDriver ) const;
-
- private:
- /** loads the implementation module and retrieves the needed symbols
-
- Save against being called multiple times.
-
- @return <TRUE/> if the module could be loaded successfully.
-
- @raises ::com::sun::star::uno::RuntimeException
- if the module could be loaded, but required symbols are missing
- */
- bool impl_loadModule();
-
- /** unloads the implementation module, and resets all function pointers to <NULL/>
- @precond m_hConnectorModule is not <NULL/>
- */
- void impl_unloadModule();
-
- /** throws an SQLException saying than no KDE installation was found
- */
- void impl_throwNoKdeException();
-
- /** throws an SQLException saying that the found KDE version is too old
- */
- void impl_throwKdeTooOldException();
-
- /** throws an SQLException saying that the found KDE version is too new
- */
- void impl_throwKdeTooNewException();
-
- /** throws a generic SQL exception with SQLState S1000 and error code 0
- */
- void impl_throwGenericSQLException( const ::rtl::OUString& _rMessage );
-
- /** determines whether it's allowed to run on a too-new (not confirmed to work) version
- */
- bool impl_doAllowNewKDEVersion();
- };
-
- // ===============================================================
- // = KabDriver
- // ===============================================================
- typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XDriver,
- ::com::sun::star::lang::XServiceInfo,
- ::com::sun::star::frame::XTerminateListener > KDriver_BASE;
- class KabDriver : public KDriver_BASE
- {
- protected:
- ::osl::Mutex m_aMutex; // mutex is need to control member access
- OWeakRefArray m_xConnections; // vector containing a list of all the
- // KabConnection objects for this Driver
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- m_xMSFactory; // the multi-service factory
- KabImplModule m_aImplModule;
-
- public:
- static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception );
-
- // XServiceInfo - static versions
- static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException);
-
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
- getMSFactory() const { return m_xMSFactory; }
-
- /** returns the driver's implementation name (being pure ASCII) for reference in various places
- */
- static const sal_Char* impl_getAsciiImplementationName();
-
- /** returns the path of our configuration settings
- */
- static ::rtl::OUString impl_getConfigurationSettingsPath();
-
- protected:
- KabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XDriver
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMajorVersion() throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMinorVersion() throw(::com::sun::star::uno::RuntimeException);
-
- // XTerminateListener
- virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
-
- // XEventListener
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
-
- private:
- /** shuts down the library which contains the real implementations
-
- This method is safe against being called multiple times
-
- @precond our mutex is locked
- */
- void impl_shutdownImplementationModule();
- };
- }
-
-}
-
-#endif // _CONNECTIVITY_KAB_DRIVER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KPreparedStatement.cxx b/connectivity/source/drivers/kab/KPreparedStatement.cxx
deleted file mode 100644
index d82ca654d7..0000000000
--- a/connectivity/source/drivers/kab/KPreparedStatement.cxx
+++ /dev/null
@@ -1,393 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "KPreparedStatement.hxx"
-#include "propertyids.hxx"
-#include <connectivity/dbexception.hxx>
-#include <connectivity/dbtools.hxx>
-#include "resource/kab_res.hrc"
-#include "resource/sharedresources.hxx"
-
-using namespace connectivity::kab;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::util;
-
-IMPLEMENT_SERVICE_INFO(KabPreparedStatement, "com.sun.star.sdbc.drivers.KabPreparedStatement", "com.sun.star.sdbc.PreparedStatement");
-// -------------------------------------------------------------------------
-void KabPreparedStatement::checkAndResizeParameters(sal_Int32 nParams) throw(SQLException)
-{
- if ( !m_aParameterRow.is() )
- m_aParameterRow = new OValueVector();
-
- if (nParams < 1)
- ::dbtools::throwInvalidIndexException(*(KabPreparedStatement *) this,Any());
-
- if (nParams >= (sal_Int32) (m_aParameterRow->get()).size())
- (m_aParameterRow->get()).resize(nParams);
-}
-// -------------------------------------------------------------------------
-void KabPreparedStatement::setKabFields() const throw(SQLException)
-{
- ::rtl::Reference<connectivity::OSQLColumns> xColumns; // selected columns
-
- xColumns = m_aSQLIterator.getSelectColumns();
- if (!xColumns.is())
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(
- STR_INVALID_COLUMN_SELECTION
- ) );
- ::dbtools::throwGenericSQLException(sError,NULL);
- }
- m_xMetaData->setKabFields(xColumns);
-}
-// -------------------------------------------------------------------------
-void KabPreparedStatement::resetParameters() const throw(SQLException)
-{
- m_nParameterIndex = 0;
-}
-// -------------------------------------------------------------------------
-void KabPreparedStatement::getNextParameter(::rtl::OUString &rParameter) const throw(SQLException)
-{
- if (m_nParameterIndex >= (sal_Int32) (m_aParameterRow->get()).size())
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(
- STR_INVALID_PARA_COUNT
- ) );
- ::dbtools::throwGenericSQLException(sError,*(KabPreparedStatement *) this);
- } // if (m_nParameterIndex >= (sal_Int32) (*m_aParameterRow).size())
-
- rParameter = (m_aParameterRow->get())[m_nParameterIndex];
-
- m_nParameterIndex++;
-}
-// -------------------------------------------------------------------------
-KabPreparedStatement::KabPreparedStatement(
- KabConnection* _pConnection,
- const ::rtl::OUString& sql)
- : KabPreparedStatement_BASE(_pConnection),
- m_sSqlStatement(sql),
- m_bPrepared(sal_False),
- m_nParameterIndex(0),
- m_aParameterRow()
-{
-}
-// -------------------------------------------------------------------------
-KabPreparedStatement::~KabPreparedStatement()
-{
-}
-// -------------------------------------------------------------------------
-void KabPreparedStatement::disposing()
-{
- KabPreparedStatement_BASE::disposing();
-
- if (m_aParameterRow.is())
- {
- m_aParameterRow->get().clear();
- m_aParameterRow = NULL;
- }
-}
-// -------------------------------------------------------------------------
-Reference< XResultSetMetaData > SAL_CALL KabPreparedStatement::getMetaData() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
-
- if (!m_xMetaData.is())
- {
- m_xMetaData = new KabResultSetMetaData(getOwnConnection());
- setKabFields();
- }
- Reference< XResultSetMetaData > xMetaData = m_xMetaData.get();
- return xMetaData;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::close() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
-
- // Reset last warning message
- try {
- clearWarnings ();
- KabCommonStatement::close();
- }
- catch (SQLException &) {
- // If we get an error, ignore
- }
-
- // Remove this Statement object from the Connection object's
- // list
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabPreparedStatement::execute() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
-
- Reference< XResultSet> xRS = KabCommonStatement::executeQuery(m_sSqlStatement);
-
- return xRS.is();
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabPreparedStatement::executeUpdate() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
-
- // same as in statement with the difference that this statement also can contain parameter
- return 0;
-}
-// -------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL KabPreparedStatement::getConnection() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
-
- return (Reference< XConnection >) m_pConnection;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabPreparedStatement::executeQuery() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
-
- Reference< XResultSet > rs = KabCommonStatement::executeQuery(m_sSqlStatement);
-
- return rs;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setNull(sal_Int32 parameterIndex, sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
-
- checkAndResizeParameters(parameterIndex);
-
- (m_aParameterRow->get())[parameterIndex - 1].setNull();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setObjectNull(sal_Int32, sal_Int32, const ::rtl::OUString&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setObjectNull", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setBoolean(sal_Int32, sal_Bool) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setBoolean", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setByte(sal_Int32, sal_Int8) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setByte", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setShort(sal_Int32, sal_Int16) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setShort", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setInt(sal_Int32, sal_Int32) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setInt", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setLong(sal_Int32, sal_Int64) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setFloat(sal_Int32, float) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setFloat", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setDouble(sal_Int32, double) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setDouble", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setString(sal_Int32 parameterIndex, const ::rtl::OUString &x) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
-
- checkAndResizeParameters(parameterIndex);
-
- (m_aParameterRow->get())[parameterIndex - 1] = x;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setBytes(sal_Int32, const Sequence< sal_Int8 >&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setBytes", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setDate(sal_Int32, const Date&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setDate", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setTime(sal_Int32, const Time&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setTime", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setTimestamp(sal_Int32, const DateTime&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setTimestamp", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setBinaryStream(sal_Int32, const Reference< ::com::sun::star::io::XInputStream >&, sal_Int32) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setBinaryStream", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setCharacterStream(sal_Int32, const Reference< ::com::sun::star::io::XInputStream >&, sal_Int32) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setCharacterStream", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setObject(sal_Int32 parameterIndex, const Any& x) throw(SQLException, RuntimeException)
-{
- if(!::dbtools::implSetObject(this,parameterIndex,x))
- {
- throw SQLException();
- }
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setObjectWithInfo(sal_Int32, const Any&, sal_Int32, sal_Int32) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setObjectWithInfo", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setRef(sal_Int32, const Reference< XRef >&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setRef", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setBlob(sal_Int32, const Reference< XBlob >&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setBlob", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setClob(sal_Int32, const Reference< XClob >&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setClob", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::setArray(sal_Int32, const Reference< XArray >&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setArray", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabPreparedStatement::clearParameters() throw(SQLException, RuntimeException)
-{
-::dbtools::throwFunctionNotSupportedException("clearParameters", NULL);
-}
-// -------------------------------------------------------------------------
-void KabPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
-{
- switch (nHandle)
- {
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- break;
- case PROPERTY_ID_USEBOOKMARKS:
- break;
- default:
- KabCommonStatement::setFastPropertyValue_NoBroadcast(nHandle,rValue);
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KPreparedStatement.hxx b/connectivity/source/drivers/kab/KPreparedStatement.hxx
deleted file mode 100644
index 876afb1719..0000000000
--- a/connectivity/source/drivers/kab/KPreparedStatement.hxx
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_KAB_PREPAREDSTATEMENT_HXX_
-#define _CONNECTIVITY_KAB_PREPAREDSTATEMENT_HXX_
-
-#include "KStatement.hxx"
-#include "KResultSetMetaData.hxx"
-#include <connectivity/FValue.hxx>
-#include <com/sun/star/sdbc/XParameters.hpp>
-#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
-#include <cppuhelper/implbase4.hxx>
-
-namespace connectivity
-{
- namespace kab
- {
-
- class OBoundParam;
- typedef ::cppu::ImplInheritanceHelper4< KabCommonStatement,
- ::com::sun::star::sdbc::XPreparedStatement,
- ::com::sun::star::sdbc::XParameters,
- ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
- ::com::sun::star::lang::XServiceInfo> KabPreparedStatement_BASE;
-
- class KabPreparedStatement : public KabPreparedStatement_BASE
- {
- protected:
- ::rtl::OUString m_sSqlStatement;
- ::rtl::Reference< KabResultSetMetaData >
- m_xMetaData;
- sal_Bool m_bPrepared;
- mutable sal_Int32 m_nParameterIndex;
- OValueRow m_aParameterRow;
-
- void checkAndResizeParameters(sal_Int32 nParams) throw(::com::sun::star::sdbc::SQLException);
- void setKabFields() const throw(::com::sun::star::sdbc::SQLException);
-
- protected:
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception);
-
- virtual void resetParameters() const throw(::com::sun::star::sdbc::SQLException);
- virtual void getNextParameter(::rtl::OUString &rParameter) const throw(::com::sun::star::sdbc::SQLException);
- virtual ~KabPreparedStatement();
-
- public:
- DECLARE_SERVICE_INFO();
- KabPreparedStatement(KabConnection* _pConnection, const ::rtl::OUString& sql);
-
- // OComponentHelper
- virtual void SAL_CALL disposing();
-
- // XPreparedStatement
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XParameters
- virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XResultSetMetaDataSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // _CONNECTIVITY_KAB_PREPAREDSTATEMENT_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KResultSet.cxx b/connectivity/source/drivers/kab/KResultSet.cxx
deleted file mode 100644
index 1c1b8f35dc..0000000000
--- a/connectivity/source/drivers/kab/KResultSet.cxx
+++ /dev/null
@@ -1,990 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "KResultSet.hxx"
-#include "KResultSetMetaData.hxx"
-#include "KConnection.hxx"
-#include "kcondition.hxx"
-#include "korder.hxx"
-#include "kfields.hxx"
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/sdbcx/CompareBookmark.hpp>
-#include "TConnection.hxx"
-#include <connectivity/dbexception.hxx>
-#include "resource/kab_res.hrc"
-#include "resource/sharedresources.hxx"
-
-using namespace connectivity::kab;
-using namespace cppu;
-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::io;
-using namespace com::sun::star::util;
-
-IMPLEMENT_SERVICE_INFO(KabResultSet, "com.sun.star.sdbc.drivers.KabResultSet", "com.sun.star.sdbc.ResultSet");
-// -------------------------------------------------------------------------
-KabResultSet::KabResultSet(KabCommonStatement* pStmt)
- : KabResultSet_BASE(m_aMutex),
- OPropertySetHelper(KabResultSet_BASE::rBHelper),
- m_xStatement(pStmt),
- m_xMetaData(NULL),
- m_aKabAddressees(),
- m_nRowPos(-1),
- m_bWasNull(sal_True)
-{
-}
-// -------------------------------------------------------------------------
-KabResultSet::~KabResultSet()
-{
-}
-// -------------------------------------------------------------------------
-void KabResultSet::allKabAddressees()
-{
- KabConnection* pConnection = static_cast< KabConnection *>(m_xStatement->getConnection().get());
- KABC::AddressBook* pAddressBook = pConnection->getAddressBook();
-
- m_aKabAddressees = pAddressBook->allAddressees();
-}
-// -------------------------------------------------------------------------
-void KabResultSet::someKabAddressees(const KabCondition *pCondition)
-{
- KabConnection* pConnection = static_cast< KabConnection *>(m_xStatement->getConnection().get());
- KABC::AddressBook* pAddressBook = pConnection->getAddressBook();
-
- KABC::AddressBook::Iterator iterator;
-
- for (iterator = pAddressBook->begin();
- iterator != pAddressBook->end();
- ++iterator)
- {
- if (pCondition->eval(*iterator))
- m_aKabAddressees.push_back(*iterator);
- }
-}
-// -------------------------------------------------------------------------
-void KabResultSet::sortKabAddressees(const KabOrder *pOrder)
-{
- // We do not use class KAddresseeList, which has a sorting algorithm in it, because
- // it uses templates. It would expand to more or less the same code as the one
- // which follows, but it would need not be called in a much less convenient way.
-
- KABC::Addressee::List::Iterator
- begin = m_aKabAddressees.begin(),
- end = m_aKabAddressees.end(),
- iterator;
-
- // Bubble sort. Feel free to implement a better algorithm.
- while (begin != end)
- {
- end--;
- for (iterator = begin; iterator != end; ++iterator)
- {
- if (pOrder->compare(*iterator, *end) > 0)
- qSwap(*iterator, *end);
- }
- }
-}
-// -------------------------------------------------------------------------
-void KabResultSet::disposing()
-{
- OPropertySetHelper::disposing();
-
- ::osl::MutexGuard aGuard(m_aMutex);
-
-m_xStatement.clear();
-m_xMetaData.clear();
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL KabResultSet::queryInterface(const Type & rType) throw(RuntimeException)
-{
- Any aRet = OPropertySetHelper::queryInterface(rType);
- if (!aRet.hasValue())
- aRet = KabResultSet_BASE::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::acquire() throw()
-{
- KabResultSet_BASE::acquire();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::release() throw()
-{
- KabResultSet_BASE::release();
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL KabResultSet::getTypes() throw(RuntimeException)
-{
- OTypeCollection aTypes(
- ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet >*) 0),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet >*) 0),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet >*) 0));
-
- return comphelper::concatSequences(aTypes.getTypes(), KabResultSet_BASE::getTypes());
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL KabResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabResultSet::findColumn(const ::rtl::OUString& columnName) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- // find the first column with the name columnName
- Reference< XResultSetMetaData > xMeta = getMetaData();
- sal_Int32 nLen = xMeta->getColumnCount();
-
- for (sal_Int32 i = 1; i <= nLen; ++i)
- if (xMeta->isCaseSensitive(i) ?
- columnName == xMeta->getColumnName(i) :
- columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
- return i;
-
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(
- STR_INVALID_COLUMNNAME,
- "$columnname$",columnName
- ) );
- ::dbtools::throwGenericSQLException(sError,NULL);
-
- // Unreachable:
- OSL_ASSERT(false);
- return 0;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabResultSet::getString(sal_Int32 columnIndex) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- ::rtl::OUString aRet;
- sal_Int32 nAddressees = m_aKabAddressees.size();
- ::KABC::Field::List aFields = ::KABC::Field::allFields();
-
- if (m_nRowPos != -1 && m_nRowPos != nAddressees && m_xMetaData.is())
- {
- sal_Int32 nFieldNumber = m_xMetaData->fieldAtColumn(columnIndex);
- QString aQtName;
-
- switch (nFieldNumber)
- {
- case KAB_FIELD_REVISION:
-// trigger an exception here
-m_bWasNull = true;
-return aRet;
- default:
- aQtName = aFields[nFieldNumber - KAB_DATA_FIELDS]->value(m_aKabAddressees[m_nRowPos]);
- }
-// KDE address book currently does not use NULL values.
-// But it might do it someday
- if (!aQtName.isNull())
- {
- m_bWasNull = false;
- aRet = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2());
- return aRet;
- }
- }
-// Trigger an exception ?
- m_bWasNull = true;
- return aRet;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::getBoolean(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getBoolean", NULL);
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int8 SAL_CALL KabResultSet::getByte(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getByte", NULL);
-
- sal_Int8 nRet = 0;
- return nRet;
-}
-// -------------------------------------------------------------------------
-sal_Int16 SAL_CALL KabResultSet::getShort(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getShort", NULL);
-
- sal_Int16 nRet = 0;
- return nRet;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabResultSet::getInt(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getInt", NULL);
-
- sal_Int32 nRet = 0;
- return nRet;
-}
-// -------------------------------------------------------------------------
-sal_Int64 SAL_CALL KabResultSet::getLong(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getLong", NULL);
-
- return sal_Int64();
-}
-// -------------------------------------------------------------------------
-float SAL_CALL KabResultSet::getFloat(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getFloat", NULL);
-
- float nVal(0);
- return nVal;
-}
-// -------------------------------------------------------------------------
-double SAL_CALL KabResultSet::getDouble(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getDouble", NULL);
-
- double nRet = 0;
- return nRet;
-}
-// -------------------------------------------------------------------------
-Sequence< sal_Int8 > SAL_CALL KabResultSet::getBytes(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("", NULL);
-
- return Sequence< sal_Int8 >();
-}
-// -------------------------------------------------------------------------
-Date SAL_CALL KabResultSet::getDate(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getDate", NULL);
-
- Date aRet;
- return aRet;
-}
-// -------------------------------------------------------------------------
-Time SAL_CALL KabResultSet::getTime(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getTime", NULL);
-
- Time nRet;
- return nRet;
-}
-// -------------------------------------------------------------------------
-DateTime SAL_CALL KabResultSet::getTimestamp(sal_Int32 columnIndex) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- DateTime nRet;
- sal_Int32 nAddressees = m_aKabAddressees.size();
-
- if (m_nRowPos != -1 && m_nRowPos != nAddressees && m_xMetaData.is())
- {
- KabResultSetMetaData *pMeta = static_cast<KabResultSetMetaData *>(m_xMetaData.get());
- sal_Int32 nFieldNumber = pMeta->fieldAtColumn(columnIndex);
-
- if (nFieldNumber == KAB_FIELD_REVISION)
- {
- QDateTime nRevision(m_aKabAddressees[m_nRowPos].revision());
-
- if (!nRevision.isNull())
- {
- m_bWasNull = false;
- nRet.Year = nRevision.date().year();
- nRet.Month = nRevision.date().month();
- nRet.Day = nRevision.date().day();
- nRet.Hours = nRevision.time().hour();
- nRet.Minutes = nRevision.time().minute();
- nRet.Seconds = nRevision.time().second();
- nRet.HundredthSeconds = nRevision.time().msec() / 10;
- return nRet;
- }
- }
- else {
- ;
- }
-// trigger an exception here
- }
-// Trigger an exception ?
- m_bWasNull = true;
- return nRet;
-}
-// -------------------------------------------------------------------------
-Reference< XInputStream > SAL_CALL KabResultSet::getBinaryStream(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getBinaryStream", NULL);
-
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XInputStream > SAL_CALL KabResultSet::getCharacterStream(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getCharacterStream", NULL);
-
- return NULL;
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL KabResultSet::getObject(sal_Int32, const Reference< ::com::sun::star::container::XNameAccess >&) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getObject", NULL);
-
- return Any();
-}
-// -------------------------------------------------------------------------
-Reference< XRef > SAL_CALL KabResultSet::getRef(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getRef", NULL);
-
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL KabResultSet::getBlob(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getBlob", NULL);
-
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XClob > SAL_CALL KabResultSet::getClob(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getClob", NULL);
-
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XArray > SAL_CALL KabResultSet::getArray(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getArray", NULL);
-
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSetMetaData > SAL_CALL KabResultSet::getMetaData() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- if (!m_xMetaData.is())
- m_xMetaData = new KabResultSetMetaData(m_xStatement->getOwnConnection());
-
- Reference< XResultSetMetaData > xMetaData = m_xMetaData.get();
- return xMetaData;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::isBeforeFirst() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- if (m_nRowPos == -1)
- return sal_True;
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::isAfterLast() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nAddressees = m_aKabAddressees.size();
- if (m_nRowPos == nAddressees)
- return sal_True;
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::isFirst() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- if (m_nRowPos == 0)
- return sal_True;
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::isLast() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nAddressees = m_aKabAddressees.size();
- if (m_nRowPos == nAddressees - 1)
- return sal_True;
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::beforeFirst() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- // move before the first row
- m_nRowPos = -1;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::afterLast() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- // move after the last row
- sal_Int32 nAddressees = m_aKabAddressees.size();
- m_nRowPos = nAddressees;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::close() throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
- }
- dispose();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::first() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nAddressees = m_aKabAddressees.size();
- if (nAddressees == 0)
- return sal_False;
-
- m_nRowPos = 0;
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::last() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nAddressees = m_aKabAddressees.size();
- if (nAddressees == 0)
- return sal_False;
-
- m_nRowPos = nAddressees - 1;
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabResultSet::getRow() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- return m_nRowPos;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::absolute(sal_Int32 row) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nAddressees = m_aKabAddressees.size();
- if (row <= -1 ||
- row >= nAddressees)
- return sal_False;
-
- m_nRowPos = row;
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::relative(sal_Int32 row) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- return absolute(m_nRowPos + row);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::next() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- return absolute(m_nRowPos + 1);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::previous() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- return absolute(m_nRowPos - 1);
-}
-// -------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL KabResultSet::getStatement() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- Reference< XStatement > xStatement = m_xStatement.get();
- return xStatement;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::rowDeleted() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::rowInserted() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::rowUpdated() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::wasNull() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- return m_bWasNull;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::cancel() throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::clearWarnings() throw(SQLException, RuntimeException)
-{
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL KabResultSet::getWarnings() throw(SQLException, RuntimeException)
-{
- return Any();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::insertRow() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- // you only have to implement this if you want to insert new rows
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateRow() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- // only when you allow updates
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::deleteRow() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::cancelRowUpdates() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::moveToInsertRow() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- // only when you allow inserts
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::moveToCurrentRow() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateNull(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateBoolean(sal_Int32, sal_Bool) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateByte(sal_Int32, sal_Int8) throw(SQLException, RuntimeException)
-{
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateShort(sal_Int32, sal_Int16) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateInt(sal_Int32, sal_Int32) throw(SQLException, RuntimeException)
-{
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateLong(sal_Int32, sal_Int64) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -----------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateFloat(sal_Int32, float) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateDouble(sal_Int32, double) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateString(sal_Int32, const ::rtl::OUString&) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateBytes(sal_Int32, const Sequence< sal_Int8 >&) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateDate(sal_Int32, const Date&) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateTime(sal_Int32, const Time&) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateTimestamp(sal_Int32, const DateTime&) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateBinaryStream(sal_Int32, const Reference< XInputStream >&, sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateCharacterStream(sal_Int32, const Reference< XInputStream >&, sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::refreshRow() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateObject(sal_Int32, const Any&) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabResultSet::updateNumericObject(sal_Int32, const Any&, sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-// XRowLocate
-Any SAL_CALL KabResultSet::getBookmark() throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nAddressees = m_aKabAddressees.size();
-
- if (m_nRowPos != -1 && m_nRowPos != nAddressees)
- {
- QString aQtName = m_aKabAddressees[m_nRowPos].uid();
- ::rtl::OUString sUniqueIdentifier = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2());
- return makeAny(sUniqueIdentifier);
- }
- return Any();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::moveToBookmark(const Any& bookmark) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- ::rtl::OUString sBookmark = comphelper::getString(bookmark);
- sal_Int32 nAddressees = m_aKabAddressees.size();
-
- for (sal_Int32 nRow = 0; nRow < nAddressees; nRow++)
- {
- QString aQtName = m_aKabAddressees[nRow].uid();
- ::rtl::OUString sUniqueIdentifier = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2());
-
- if (sUniqueIdentifier == sBookmark)
- {
- m_nRowPos = nRow;
- return sal_True;
- }
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nRowSave = m_nRowPos;
-
- if (moveToBookmark(bookmark))
- {
- sal_Int32 nAddressees = m_aKabAddressees.size();
-
- m_nRowPos += rows;
-
- if (-1 < m_nRowPos && m_nRowPos < nAddressees)
- return sal_True;
- }
-
- m_nRowPos = nRowSave;
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabResultSet::compareBookmarks(const Any& firstItem, const Any& secondItem) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- ::rtl::OUString sFirst = comphelper::getString(firstItem);
- ::rtl::OUString sSecond = comphelper::getString(secondItem);
-
- if (sFirst < sSecond)
- return CompareBookmark::LESS;
- if (sFirst > sSecond)
- return CompareBookmark::GREATER;
- return CompareBookmark::EQUAL;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSet::hasOrderedBookmarks() throw( SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabResultSet::hashBookmark(const Any& bookmark) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- ::rtl::OUString sBookmark = comphelper::getString(bookmark);
-
- return sBookmark.hashCode();
-}
-// -------------------------------------------------------------------------
-// XDeleteRows
-Sequence< sal_Int32 > SAL_CALL KabResultSet::deleteRows(const Sequence< Any >&) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
-
- return Sequence< sal_Int32 >();
-}
-// -------------------------------------------------------------------------
-IPropertyArrayHelper* KabResultSet::createArrayHelper() const
-{
- Sequence< Property > aProps(6);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY);
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY);
-
- return new OPropertyArrayHelper(aProps);
-}
-// -------------------------------------------------------------------------
-IPropertyArrayHelper & KabResultSet::getInfoHelper()
-{
- return *static_cast<KabResultSet*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool KabResultSet::convertFastPropertyValue(
- Any &,
- Any &,
- sal_Int32 nHandle,
- const Any& )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- switch (nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw ::com::sun::star::lang::IllegalArgumentException();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- default:
- ;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-void KabResultSet::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& )
- throw (Exception)
-{
- switch (nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw Exception();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- break;
- case PROPERTY_ID_FETCHSIZE:
- break;
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void KabResultSet::getFastPropertyValue(
- Any& _rValue,
- sal_Int32 nHandle) const
-{
- switch (nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- _rValue <<= (sal_Bool)sal_False;
- break;
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- ;
- }
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KResultSet.hxx b/connectivity/source/drivers/kab/KResultSet.hxx
deleted file mode 100644
index 209f9a1d6c..0000000000
--- a/connectivity/source/drivers/kab/KResultSet.hxx
+++ /dev/null
@@ -1,227 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_KAB_RESULTSET_HXX_
-#define _CONNECTIVITY_KAB_RESULTSET_HXX_
-
-#include "KStatement.hxx"
-#include "KResultSetMetaData.hxx"
-#include <shell/kde_headers.h>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
-#include <com/sun/star/sdbc/XColumnLocate.hpp>
-#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
-#include <com/sun/star/sdbc/XRowUpdate.hpp>
-#include <com/sun/star/sdbcx/XRowLocate.hpp>
-#include <com/sun/star/sdbcx/XDeleteRows.hpp>
-#include <cppuhelper/compbase12.hxx>
-
-namespace connectivity
-{
- namespace kab
- {
- /*
- ** KabResultSet
- */
- typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet,
- ::com::sun::star::sdbc::XRow,
- ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
- ::com::sun::star::util::XCancellable,
- ::com::sun::star::sdbc::XWarningsSupplier,
- ::com::sun::star::sdbc::XResultSetUpdate,
- ::com::sun::star::sdbc::XRowUpdate,
- ::com::sun::star::sdbcx::XRowLocate,
- ::com::sun::star::sdbcx::XDeleteRows,
- ::com::sun::star::sdbc::XCloseable,
- ::com::sun::star::sdbc::XColumnLocate,
- ::com::sun::star::lang::XServiceInfo> KabResultSet_BASE;
-
- class KabResultSet : public comphelper::OBaseMutex,
- public KabResultSet_BASE,
- public ::cppu::OPropertySetHelper,
- public comphelper::OPropertyArrayUsageHelper<KabResultSet>
- {
- protected:
- ::rtl::Reference< KabCommonStatement > m_xStatement; // the statement that has created this result set
- ::rtl::Reference< KabResultSetMetaData > m_xMetaData; // the description of the columns in this result set
- ::KABC::Addressee::List m_aKabAddressees; // address book entries matching the query
- sal_Int32 m_nRowPos; // the current row within the result set
- sal_Bool m_bWasNull; // last entry retrieved from this result set was NULL
-
- // OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
-
- // OPropertySetHelper
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
-
- virtual sal_Bool SAL_CALL convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue)
- throw (::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue)
- throw (::com::sun::star::uno::Exception);
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle) const;
-
- // you can't delete objects of this type
- virtual ~KabResultSet();
-
- public:
- DECLARE_SERVICE_INFO();
-
- KabResultSet(KabCommonStatement *pStmt);
-
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *()
- {
- return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(KabResultSet_BASE*) this);
- }
-
- void allKabAddressees();
- void someKabAddressees(const class KabCondition *pCondition);
- void sortKabAddressees(const class KabOrder *pOrder);
-
- // ::cppu::OComponentHelper
- virtual void SAL_CALL disposing(void);
-
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
-
- // XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XResultSet
- virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XRow
- virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XResultSetMetaDataSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XCancellable
- virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XWarningsSupplier
- virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XResultSetUpdate
- virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XRowUpdate
- virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XColumnLocate
- virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XRowLocate
- virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& firstItem, const ::com::sun::star::uno::Any& secondItem ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XDeleteRows
- virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // _CONNECTIVITY_KAB_RESULTSET_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KResultSetMetaData.cxx b/connectivity/source/drivers/kab/KResultSetMetaData.cxx
deleted file mode 100644
index 567f3fbaf5..0000000000
--- a/connectivity/source/drivers/kab/KResultSetMetaData.cxx
+++ /dev/null
@@ -1,190 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "KResultSetMetaData.hxx"
-#include "kfields.hxx"
-#include "KDatabaseMetaData.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-
-using namespace connectivity::kab;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::sdbc;
-
-KabResultSetMetaData::KabResultSetMetaData(KabConnection* _pConnection)
- : m_pConnection(_pConnection),
- m_aKabFields()
-{
-}
-// -------------------------------------------------------------------------
-KabResultSetMetaData::~KabResultSetMetaData()
-{
-}
-// -------------------------------------------------------------------------
-void KabResultSetMetaData::setKabFields(const ::rtl::Reference<connectivity::OSQLColumns> &xColumns) throw(SQLException)
-{
- OSQLColumns::Vector::const_iterator aIter;
- static const ::rtl::OUString aName(RTL_CONSTASCII_USTRINGPARAM("Name"));
-
- for (aIter = xColumns->get().begin(); aIter != xColumns->get().end(); ++aIter)
- {
- ::rtl::OUString aFieldName;
- sal_uInt32 nFieldNumber;
-
- (*aIter)->getPropertyValue(aName) >>= aFieldName;
- nFieldNumber = findKabField(aFieldName);
- m_aKabFields.push_back(nFieldNumber);
- }
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabResultSetMetaData::getColumnDisplaySize(sal_Int32 column) throw(SQLException, RuntimeException)
-{
- return m_aKabFields[column - 1] < KAB_DATA_FIELDS? 20: 50;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabResultSetMetaData::getColumnType(sal_Int32 column) throw(SQLException, RuntimeException)
-{
- return m_aKabFields[column - 1] == KAB_FIELD_REVISION? DataType::TIMESTAMP: DataType::CHAR;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabResultSetMetaData::getColumnCount() throw(SQLException, RuntimeException)
-{
- return m_aKabFields.size();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSetMetaData::isCaseSensitive(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabResultSetMetaData::getSchemaName(sal_Int32) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabResultSetMetaData::getColumnName(sal_Int32 column) throw(SQLException, RuntimeException)
-{
- sal_uInt32 nFieldNumber = m_aKabFields[column - 1];
- ::KABC::Field::List aFields = ::KABC::Field::allFields();
- QString aQtName;
-
- switch (nFieldNumber)
- {
- case KAB_FIELD_REVISION:
- aQtName = KABC::Addressee::revisionLabel();
- break;
- default:
- aQtName = aFields[nFieldNumber - KAB_DATA_FIELDS]->label();
- }
- ::rtl::OUString aName((const sal_Unicode *) aQtName.ucs2());
-
- return aName;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabResultSetMetaData::getTableName(sal_Int32) throw(SQLException, RuntimeException)
-{
- return KabDatabaseMetaData::getAddressBookTableName();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabResultSetMetaData::getCatalogName(sal_Int32) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabResultSetMetaData::getColumnTypeName(sal_Int32) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabResultSetMetaData::getColumnLabel(sal_Int32) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL KabResultSetMetaData::getColumnServiceName(sal_Int32) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSetMetaData::isCurrency(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSetMetaData::isAutoIncrement(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSetMetaData::isSigned(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabResultSetMetaData::getPrecision(sal_Int32) throw(SQLException, RuntimeException)
-{
- return 0;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabResultSetMetaData::getScale(sal_Int32) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabResultSetMetaData::isNullable(sal_Int32) throw(SQLException, RuntimeException)
-{
- return (sal_Int32) sal_True;
-// KDE address book currently does not use NULL values.
-// But it might do it someday
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSetMetaData::isSearchable(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSetMetaData::isReadOnly(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSetMetaData::isDefinitelyWritable(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabResultSetMetaData::isWritable(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KResultSetMetaData.hxx b/connectivity/source/drivers/kab/KResultSetMetaData.hxx
deleted file mode 100644
index 5bf1dd2495..0000000000
--- a/connectivity/source/drivers/kab/KResultSetMetaData.hxx
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_KAB_RESULTSETMETADATA_HXX_
-#define _CONNECTIVITY_KAB_RESULTSETMETADATA_HXX_
-
-#include "KConnection.hxx"
-#include <connectivity/CommonTools.hxx>
-#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <rtl/ref.hxx>
-
-namespace connectivity
-{
- namespace kab
- {
- /*
- ** KabResultSetMetaData
- */
- typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> KabResultSetMetaData_BASE;
-
- class KabResultSetMetaData : public KabResultSetMetaData_BASE
- {
- KabConnection* m_pConnection;
- ::std::vector<sal_Int32> m_aKabFields; // for each selected column, contains the number
- // of the corresponding KAddressBook field
-
- protected:
- virtual ~KabResultSetMetaData();
-
- public:
- KabResultSetMetaData(KabConnection* _pConnection);
-
- // avoid ambigous cast error from the compiler
- inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw()
- { return this; }
-
- void setKabFields(
- const ::rtl::Reference<connectivity::OSQLColumns> &xColumns) throw(::com::sun::star::sdbc::SQLException);
- inline sal_uInt32 fieldAtColumn(sal_Int32 columnIndex) const
- { return m_aKabFields[columnIndex - 1]; }
-
- virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // _CONNECTIVITY_KAB_RESULTSETMETADATA_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KServices.cxx b/connectivity/source/drivers/kab/KServices.cxx
deleted file mode 100644
index e2bea9cd3c..0000000000
--- a/connectivity/source/drivers/kab/KServices.cxx
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "KDriver.hxx"
-#include <cppuhelper/factory.hxx>
-
-using namespace connectivity::kab;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount* _pTemp
- );
-
-//---------------------------------------------------------------------------------------
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- sal_Char const* pImplementationName
- )
- : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- inline
- sal_Bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
- }
- catch(...)
- {
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void*)
-{
- void* pRet = 0;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- KabDriver::getImplementationName_Static(),
- KabDriver::getSupportedServiceNames_Static(),
- &KabDriver::Create,
- ::cppu::createSingleFactory)
- ;
-
- if (aReq.xRet.is())
- aReq.xRet->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KStatement.cxx b/connectivity/source/drivers/kab/KStatement.cxx
deleted file mode 100644
index 655e8ae656..0000000000
--- a/connectivity/source/drivers/kab/KStatement.cxx
+++ /dev/null
@@ -1,587 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "KStatement.hxx"
-#include "KConnection.hxx"
-#include "KDriver.hxx"
-#include "KResultSet.hxx"
-#include "KResultSetMetaData.hxx"
-#include "kcondition.hxx"
-#include "korder.hxx"
-#include "TConnection.hxx"
-#include <connectivity/dbexception.hxx>
-#include "resource/kab_res.hrc"
-#include "resource/sharedresources.hxx"
-
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-using namespace connectivity::kab;
-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;
-
-namespace
-{
- void lcl_throwError(sal_uInt16 _nErrorId)
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(_nErrorId) );
- ::dbtools::throwGenericSQLException(sError,NULL);
- }
-}
-
-IMPLEMENT_SERVICE_INFO(KabStatement, "com.sun.star.sdbc.drivers.KabStatement", "com.sun.star.sdbc.Statement");
-//------------------------------------------------------------------------------
-KabCommonStatement::KabCommonStatement(KabConnection* _pConnection )
- : KabCommonStatement_BASE(m_aMutex),
- OPropertySetHelper(KabCommonStatement_BASE::rBHelper),
- m_aParser(_pConnection->getDriver()->getMSFactory()),
- m_aSQLIterator(_pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL ),
- m_pParseTree(NULL),
- m_pConnection(_pConnection),
- rBHelper(KabCommonStatement_BASE::rBHelper)
-{
- m_pConnection->acquire();
-}
-// -----------------------------------------------------------------------------
-KabCommonStatement::~KabCommonStatement()
-{
-}
-// -----------------------------------------------------------------------------
-void KabCommonStatement::disposing()
-{
- KabCommonStatement_BASE::disposing();
-}
-// -----------------------------------------------------------------------------
-void KabCommonStatement::resetParameters() const throw(::com::sun::star::sdbc::SQLException)
-{
- lcl_throwError(STR_PARA_ONLY_PREPARED);
-}
-// -----------------------------------------------------------------------------
-void KabCommonStatement::getNextParameter(::rtl::OUString &) const throw(::com::sun::star::sdbc::SQLException)
-{
- lcl_throwError(STR_PARA_ONLY_PREPARED);
-}
-// -----------------------------------------------------------------------------
-KabCondition *KabCommonStatement::analyseWhereClause(const OSQLParseNode *pParseNode) const throw(SQLException)
-{
- if (pParseNode->count() == 3)
- {
- const OSQLParseNode *pLeft = pParseNode->getChild(0),
- *pMiddle = pParseNode->getChild(1),
- *pRight = pParseNode->getChild(2);
-
- // WHERE ( ... ) ?
- if (SQL_ISPUNCTUATION(pLeft, "(") && SQL_ISPUNCTUATION(pRight, ")"))
- {
- return analyseWhereClause(pMiddle);
- }
- else if (SQL_ISRULE(pParseNode, comparison_predicate))
- {
- if (pLeft->isToken() && pRight->isToken())
- {
- switch (pMiddle->getNodeType())
- {
- case SQL_NODE_EQUAL:
- // WHERE 0 = 1
- return new KabConditionConstant(pLeft->getTokenValue() == pRight->getTokenValue());
-
- case SQL_NODE_NOTEQUAL:
- // WHERE 0 <> 1
- // (might not be correct SQL... don't care, handling anyway)
- return new KabConditionConstant(pLeft->getTokenValue() != pRight->getTokenValue());
-
- default:
- break;
- }
- }
- else if (SQL_ISRULE(pLeft, column_ref))
- {
- ::rtl::OUString sColumnName,
- sTableRange;
-
- m_aSQLIterator.getColumnRange(pLeft, sColumnName, sTableRange);
-
- if (pRight->isToken() || SQL_ISRULE(pRight, parameter))
- {
- ::rtl::OUString sMatchString;
-
- if (pRight->isToken()) // WHERE Name = 'Doe'
- sMatchString = pRight->getTokenValue();
- else if (SQL_ISRULE(pRight, parameter)) // WHERE Name = ?
- getNextParameter(sMatchString);
-
- switch (pMiddle->getNodeType())
- {
- case SQL_NODE_EQUAL:
- // WHERE Name = 'Smith'
- return new KabConditionEqual(sColumnName, sMatchString);
-
- case SQL_NODE_NOTEQUAL:
- // WHERE Name <> 'Jones'
- return new KabConditionDifferent(sColumnName, sMatchString);
-
- default:
- break;
- }
- }
- }
- }
- else if (SQL_ISRULE(pParseNode, search_condition))
- {
- if (SQL_ISTOKEN(pMiddle, OR))
- {
- // WHERE Name = 'Smith' OR Name = 'Jones'
- return new KabConditionOr(
- analyseWhereClause(pLeft),
- analyseWhereClause(pRight));
- }
- }
- else if (SQL_ISRULE(pParseNode, boolean_term))
- {
- if (SQL_ISTOKEN(pMiddle, AND))
- {
- // WHERE Name = 'Smith' AND "Given Name" = 'Peter'
- return new KabConditionAnd(
- analyseWhereClause(pLeft),
- analyseWhereClause(pRight));
- }
- }
- }
- else if (SQL_ISRULE(pParseNode, test_for_null) || SQL_ISRULE(pParseNode, like_predicate))
- {
- const OSQLParseNode *pLeft = pParseNode->getChild(0);
- const OSQLParseNode* pPart2 = pParseNode->getChild(1);
- const OSQLParseNode *pMiddleLeft = pPart2->getChild(0),
- *pMiddleRight = pPart2->getChild(1),
- *pRight = pPart2->getChild(2);
-
- if (SQL_ISRULE(pParseNode, test_for_null))
- {
- if (SQL_ISRULE(pLeft, column_ref) &&
- SQL_ISTOKEN(pMiddleLeft, IS) &&
- SQL_ISTOKEN(pRight, NULL))
- {
- ::rtl::OUString sColumnName,
- sTableRange;
-
- m_aSQLIterator.getColumnRange(pLeft, sColumnName, sTableRange);
-
- if (SQL_ISTOKEN(pMiddleRight, NOT))
- {
- // WHERE "Mobile Phone" IS NOT NULL
- return new KabConditionNotNull(sColumnName);
- }
- else
- {
- // WHERE "Mobile Phone" IS NULL
- return new KabConditionNull(sColumnName);
- }
- }
- }
- else if (SQL_ISRULE(pParseNode, like_predicate))
- {
- if (SQL_ISRULE(pLeft, column_ref))
- {
- ::rtl::OUString sColumnName,
- sTableRange;
-
- m_aSQLIterator.getColumnRange(pLeft, sColumnName, sTableRange);
-
- if (pMiddleRight->isToken() || SQL_ISRULE(pMiddleRight, parameter))
- {
- ::rtl::OUString sMatchString;
-
- if (pMiddleRight->isToken()) // WHERE Name LIKE 'Sm%'
- sMatchString = pMiddleRight->getTokenValue();
- else if (SQL_ISRULE(pMiddleRight, parameter)) // WHERE Name LIKE ?
- getNextParameter(sMatchString);
-
- return new KabConditionSimilar(sColumnName, sMatchString);
- }
- }
- }
- }
-
- lcl_throwError(STR_QUERY_TOO_COMPLEX);
-
- // Unreachable:
- OSL_ASSERT(false);
- return 0;
-}
-// -----------------------------------------------------------------------------
-KabOrder *KabCommonStatement::analyseOrderByClause(const OSQLParseNode *pParseNode) const throw(SQLException)
-{
- if (SQL_ISRULE(pParseNode, ordering_spec_commalist))
- {
- KabComplexOrder *list = new KabComplexOrder();
- sal_uInt32 n = pParseNode->count();
-
- // Iterate through the ordering columns
- for (sal_uInt32 i = 0; i < n; i++)
- {
- list->addOrder
- (analyseOrderByClause(pParseNode->getChild(i)));
- }
-
- return list;
- }
- else if (SQL_ISRULE(pParseNode, ordering_spec))
- {
- if (pParseNode->count() == 2)
- {
- OSQLParseNode* pColumnRef = pParseNode->getChild(0);
- OSQLParseNode* pAscendingDescending = pParseNode->getChild(1);
-
- if (SQL_ISRULE(pColumnRef, column_ref))
- {
- if (pColumnRef->count() == 3)
- pColumnRef = pColumnRef->getChild(2);
-
- if (pColumnRef->count() == 1)
- {
- ::rtl::OUString sColumnName =
- pColumnRef->getChild(0)->getTokenValue();
- sal_Bool bAscending =
- SQL_ISTOKEN(pAscendingDescending, DESC)?
- sal_False:
- sal_True;
-
- return new KabSimpleOrder(sColumnName, bAscending);
- }
- }
- }
- }
- lcl_throwError(STR_QUERY_TOO_COMPLEX);
- // Unreachable:
- OSL_ASSERT(false);
- return 0;
-}
-//------------------------------------------------------------------------------
-sal_Bool KabCommonStatement::isTableKnown(KabResultSet *pResult) const
-{
- // can handle requests like SELECT * FROM addresses addresses
- // but cannot handle requests like SELECT * FROM addresses persons
- if (m_aSQLIterator.getTables().size() != 1)
- return sal_False;
-
- if (m_aSQLIterator.getTables().begin()->first != pResult->getMetaData()->getTableName(0))
- return sal_False;
-
- return sal_True;
-}
-//------------------------------------------------------------------------------
-void KabCommonStatement::setKabFields(KabResultSet *pResult) const throw(SQLException)
-{
- ::rtl::Reference<connectivity::OSQLColumns> xColumns; // selected columns
- KabResultSetMetaData *pMeta; // meta information - holds the list of KAddressBook fields
-
- xColumns = m_aSQLIterator.getSelectColumns();
- if (!xColumns.is())
- {
- lcl_throwError(STR_INVALID_COLUMN_SELECTION);
- }
- pMeta = static_cast<KabResultSetMetaData *>(pResult->getMetaData().get());
- pMeta->setKabFields(xColumns);
-}
-// -------------------------------------------------------------------------
-void KabCommonStatement::selectAddressees(KabResultSet *pResult) const throw(SQLException)
-{
- const OSQLParseNode *pParseNode;
- KabCondition *pCondition;
-
- pParseNode = m_aSQLIterator.getWhereTree();
- if (pParseNode != NULL)
- {
- if (SQL_ISRULE(pParseNode, where_clause))
- {
- resetParameters();
- pParseNode = pParseNode->getChild(1);
- pCondition = analyseWhereClause(pParseNode);
- if (pCondition->isAlwaysTrue())
- pResult->allKabAddressees();
- else if (!pCondition->isAlwaysFalse())
- pResult->someKabAddressees(pCondition);
- delete pCondition;
- return;
- }
- }
-
- // no WHERE clause: get all rows
- pResult->allKabAddressees();
-}
-// -------------------------------------------------------------------------
-void KabCommonStatement::sortAddressees(KabResultSet *pResult) const throw(SQLException)
-{
- const OSQLParseNode *pParseNode;
- KabOrder *pOrder;
-
- pParseNode = m_aSQLIterator.getOrderTree();
- if (pParseNode != NULL)
- {
- if (SQL_ISRULE(pParseNode, opt_order_by_clause))
- {
- pParseNode = pParseNode->getChild(2);
- pOrder = analyseOrderByClause(pParseNode);
- pResult->sortKabAddressees(pOrder);
- delete pOrder;
- }
- }
-}
-//-----------------------------------------------------------------------------
-Any SAL_CALL KabCommonStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = KabCommonStatement_BASE::queryInterface(rType);
- if (!aRet.hasValue())
- aRet = OPropertySetHelper::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL KabCommonStatement::getTypes( ) throw(RuntimeException)
-{
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
- ::getCppuType( (const Reference< XFastPropertySet > *)0 ),
- ::getCppuType( (const Reference< XPropertySet > *)0 ));
-
- return comphelper::concatSequences(aTypes.getTypes(),KabCommonStatement_BASE::getTypes());
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabCommonStatement::cancel( ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
- // cancel the current sql statement
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabCommonStatement::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
-
- }
- dispose();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL KabCommonStatement::execute(
- const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
-
- Reference< XResultSet > xRS = executeQuery(sql);
-
- return xRS.is();
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL KabCommonStatement::executeQuery(
- const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
-
-OSL_TRACE("KDE Address book - SQL Request: %s", OUtoCStr(sql));
-
- KabResultSet* pResult = new KabResultSet(this);
- Reference< XResultSet > xRS = pResult;
- ::rtl::OUString aErr;
-
- m_pParseTree = m_aParser.parseTree(aErr, sql);
- if (m_pParseTree == NULL)
- throw SQLException(aErr, *this, aErr, 0, Any());
-
- m_aSQLIterator.setParseTree(m_pParseTree);
- m_aSQLIterator.traverseAll();
- switch (m_aSQLIterator.getStatementType())
- {
- case SQL_STATEMENT_SELECT:
- if (isTableKnown(pResult)) // FROM which table ?
- {
- setKabFields(pResult); // SELECT which columns ?
- selectAddressees(pResult); // WHERE which condition ?
- sortAddressees(pResult); // ORDER BY which columns ?
-// To be continued: DISTINCT
-// etc...
- }
- break;
-
- default:
-// To be continued: UPDATE
-// DELETE
-// etc...
- lcl_throwError(STR_QUERY_TOO_COMPLEX);
- }
-
- return xRS;
-}
-// -------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL KabCommonStatement::getConnection( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
-
- // just return our connection here
- return (Reference< XConnection >) m_pConnection;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL KabCommonStatement::executeUpdate( const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
-
- // the return values gives information about how many rows are affected by executing the sql statement
- return 0;
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL KabCommonStatement::getWarnings( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
-
- return makeAny(m_aLastWarning);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL KabCommonStatement::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed);
-
- m_aLastWarning = SQLWarning();
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* KabCommonStatement::createArrayHelper( ) const
-{
- // 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;
- DECL_PROP0(CURSORNAME, ::rtl::OUString);
- DECL_BOOL_PROP0(ESCAPEPROCESSING);
- DECL_PROP0(FETCHDIRECTION,sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP0(MAXFIELDSIZE,sal_Int32);
- DECL_PROP0(MAXROWS, sal_Int32);
- DECL_PROP0(QUERYTIMEOUT,sal_Int32);
- DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32);
- DECL_PROP0(RESULTSETTYPE,sal_Int32);
- DECL_BOOL_PROP0(USEBOOKMARKS);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & KabCommonStatement::getInfoHelper()
-{
- return *const_cast<KabCommonStatement*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool KabCommonStatement::convertFastPropertyValue(
- Any &,
- Any &,
- sal_Int32,
- const Any&) throw (::com::sun::star::lang::IllegalArgumentException)
-{
- sal_Bool bConverted = sal_False;
- // here we have to try to convert
- return bConverted;
-}
-// -------------------------------------------------------------------------
-void KabCommonStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any&) throw (Exception)
-{
- // set the value to whatever is nescessary
- switch (nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- case PROPERTY_ID_MAXFIELDSIZE:
- case PROPERTY_ID_MAXROWS:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- case PROPERTY_ID_ESCAPEPROCESSING:
- case PROPERTY_ID_USEBOOKMARKS:
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void KabCommonStatement::getFastPropertyValue(Any&,sal_Int32 nHandle) const
-{
- switch (nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- case PROPERTY_ID_MAXFIELDSIZE:
- case PROPERTY_ID_MAXROWS:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- case PROPERTY_ID_ESCAPEPROCESSING:
- case PROPERTY_ID_USEBOOKMARKS:
- default:
- ;
- }
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL KabCommonStatement::acquire() throw()
-{
- KabCommonStatement_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL KabCommonStatement::release() throw()
-{
- KabCommonStatement_BASE::release();
-}
-// -----------------------------------------------------------------------------
-Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL KabCommonStatement::getPropertySetInfo( ) throw(RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-KabStatement::KabStatement(KabConnection* _pConnection)
- : KabStatement_BASE(_pConnection)
-{
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KStatement.hxx b/connectivity/source/drivers/kab/KStatement.hxx
deleted file mode 100644
index 044c473ee1..0000000000
--- a/connectivity/source/drivers/kab/KStatement.hxx
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_KAB_STATEMENT_HXX_
-#define _CONNECTIVITY_KAB_STATEMENT_HXX_
-
-#include "KConnection.hxx"
-#include <list>
-#include "connectivity/sqliterator.hxx"
-#include "connectivity/sqlparse.hxx"
-#include <com/sun/star/sdbc/XStatement.hpp>
-#include <com/sun/star/util/XCancellable.hpp>
-#include <cppuhelper/compbase4.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <comphelper/proparrhlp.hxx>
-
-namespace connectivity
-{
- namespace kab
- {
- typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbc::XStatement,
- ::com::sun::star::sdbc::XWarningsSupplier,
- ::com::sun::star::util::XCancellable,
- ::com::sun::star::sdbc::XCloseable> KabCommonStatement_BASE;
-
- //**************************************************************
- // Class KabCommonStatement
- // is a base class for the normal statement and for the prepared statement
- //**************************************************************
- class KabCommonStatement : public comphelper::OBaseMutex,
- public KabCommonStatement_BASE,
- public ::cppu::OPropertySetHelper,
- public comphelper::OPropertyArrayUsageHelper<KabCommonStatement>
-
- {
- ::com::sun::star::sdbc::SQLWarning m_aLastWarning;
-
- protected:
- ::std::list< ::rtl::OUString> m_aBatchList;
- connectivity::OSQLParser m_aParser;
- connectivity::OSQLParseTreeIterator m_aSQLIterator;
- connectivity::OSQLParseNode* m_pParseTree;
- KabConnection* m_pConnection; // The owning Connection object
-
- protected:
- class KabCondition *analyseWhereClause(
- const OSQLParseNode *pParseNode) const throw(::com::sun::star::sdbc::SQLException);
- class KabOrder *analyseOrderByClause(
- const OSQLParseNode *pParseNode) const throw(::com::sun::star::sdbc::SQLException);
- sal_Bool isTableKnown(class KabResultSet *pResult) const;
- void setKabFields(class KabResultSet *pResult) const throw(::com::sun::star::sdbc::SQLException);
- void selectAddressees(KabResultSet *pResult) const throw(::com::sun::star::sdbc::SQLException);
- void sortAddressees(KabResultSet *pResult) const throw(::com::sun::star::sdbc::SQLException);
-
- // OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
-
- // OPropertySetHelper
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
- virtual sal_Bool SAL_CALL convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception);
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle) const;
-
- virtual void resetParameters() const throw(::com::sun::star::sdbc::SQLException);
- virtual void getNextParameter(::rtl::OUString &rParameter) const throw(::com::sun::star::sdbc::SQLException);
- virtual ~KabCommonStatement();
-
- public:
- ::cppu::OBroadcastHelper& rBHelper;
-
- KabCommonStatement(KabConnection *_pConnection);
- using KabCommonStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
-
- // OComponentHelper
- virtual void SAL_CALL disposing();
-
- // XInterface
- virtual void SAL_CALL release() throw();
- virtual void SAL_CALL acquire() throw();
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType
- ) throw(::com::sun::star::uno::RuntimeException);
-
- // XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(
- ) throw(::com::sun::star::uno::RuntimeException);
-
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(
- ) throw(::com::sun::star::uno::RuntimeException);
-
- // XStatement
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery(
- const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL executeUpdate(
- const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL execute(
- const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection(
- ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XWarningsSupplier
- virtual ::com::sun::star::uno::Any SAL_CALL getWarnings(
- ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearWarnings(
- ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XCancellable
- virtual void SAL_CALL cancel(
- ) throw(::com::sun::star::uno::RuntimeException);
-
- // XCloseable
- virtual void SAL_CALL close(
- ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // other methods
- inline KabConnection* getOwnConnection() const { return m_pConnection; }
- };
-
- //**************************************************************
- // Class KabStatement
- //**************************************************************
- typedef ::cppu::ImplInheritanceHelper1<
- KabCommonStatement, ::com::sun::star::lang::XServiceInfo > KabStatement_BASE;
-
- class KabStatement : public KabStatement_BASE
- {
- protected:
- virtual ~KabStatement() { }
-
- public:
- KabStatement(KabConnection* _pConnection);
- DECLARE_SERVICE_INFO();
- };
- }
-}
-
-#endif // _CONNECTIVITY_KAB_STATEMENT_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KTable.cxx b/connectivity/source/drivers/kab/KTable.cxx
deleted file mode 100644
index 20247273a5..0000000000
--- a/connectivity/source/drivers/kab/KTable.cxx
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "KTable.hxx"
-#include "KTables.hxx"
-#include "KColumns.hxx"
-#include "KCatalog.hxx"
-
-using namespace connectivity::kab;
-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;
-
-// -------------------------------------------------------------------------
-KabTable::KabTable( sdbcx::OCollection* _pTables, KabConnection* _pConnection)
- : KabTable_TYPEDEF(_pTables, sal_True),
- m_pConnection(_pConnection)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-KabTable::KabTable( sdbcx::OCollection* _pTables,
- KabConnection* _pConnection,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description ,
- const ::rtl::OUString& _SchemaName,
- const ::rtl::OUString& _CatalogName
- ) : KabTable_TYPEDEF(_pTables,sal_True,
- _Name,
- _Type,
- _Description,
- _SchemaName,
- _CatalogName),
- m_pConnection(_pConnection)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-void KabTable::refreshColumns()
-{
- TStringVector aVector;
-
- if (!isNew())
- {
- Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(
- Any(),
- m_SchemaName,
- m_Name,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")));
-
- if (xResult.is())
- {
- Reference< XRow > xRow(xResult, UNO_QUERY);
- while (xResult->next())
- aVector.push_back(xRow->getString(4));
- }
- }
-
- if (m_pColumns)
- m_pColumns->reFill(aVector);
- else
- m_pColumns = new KabColumns(this,m_aMutex,aVector);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KTable.hxx b/connectivity/source/drivers/kab/KTable.hxx
deleted file mode 100644
index 2b640e4cdb..0000000000
--- a/connectivity/source/drivers/kab/KTable.hxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_KAB_TABLE_HXX_
-#define _CONNECTIVITY_KAB_TABLE_HXX_
-
-#include "KConnection.hxx"
-#include "connectivity/sdbcx/VTable.hxx"
-
-namespace connectivity
-{
- namespace kab
- {
- typedef connectivity::sdbcx::OTable KabTable_TYPEDEF;
-
- ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp);
-
- class KabTable : public KabTable_TYPEDEF
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
- KabConnection* m_pConnection;
-
- public:
- KabTable( sdbcx::OCollection* _pTables, KabConnection* _pConnection);
- KabTable( sdbcx::OCollection* _pTables,
- KabConnection* _pConnection,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description = ::rtl::OUString(),
- const ::rtl::OUString& _SchemaName = ::rtl::OUString(),
- const ::rtl::OUString& _CatalogName = ::rtl::OUString()
- );
-
- KabConnection* getConnection() { return m_pConnection;}
-
- virtual void refreshColumns();
-
- ::rtl::OUString getTableName() const { return m_Name; }
- ::rtl::OUString getSchema() const { return m_SchemaName; }
- };
- }
-}
-
-#endif // _CONNECTIVITY_KAB_TABLE_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KTables.cxx b/connectivity/source/drivers/kab/KTables.cxx
deleted file mode 100644
index 31d66547bd..0000000000
--- a/connectivity/source/drivers/kab/KTables.cxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "KTables.hxx"
-#include "KTable.hxx"
-#include "KCatalog.hxx"
-#include "KConnection.hxx"
-#include <comphelper/types.hxx>
-
-using namespace connectivity::kab;
-using namespace connectivity;
-using namespace ::comphelper;
-using namespace ::cppu;
-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 KabTables::createObject(const ::rtl::OUString& _rName)
-{
- ::rtl::OUString aName,aSchema;
- aSchema = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%"));
- aName = _rName;
-
- Sequence< ::rtl::OUString > aTypes(1);
- aTypes[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%"));
- ::rtl::OUString sEmpty;
-
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), aSchema, aName, aTypes);
-
- sdbcx::ObjectType xRet = NULL;
- if (xResult.is())
- {
- Reference< XRow > xRow(xResult, UNO_QUERY);
- if (xResult->next()) // there can be only one table with this name
- {
- KabTable* pRet = new KabTable(
- this,
- static_cast<KabCatalog&>(m_rParent).getConnection(),
- aName,
- xRow->getString(4),
- xRow->getString(5),
- sEmpty);
- xRet = pRet;
- }
- }
- ::comphelper::disposeComponent(xResult);
-
- return xRet;
-}
-// -------------------------------------------------------------------------
-void KabTables::impl_refresh( ) throw(RuntimeException)
-{
- static_cast<KabCatalog&>(m_rParent).refreshTables();
-}
-// -------------------------------------------------------------------------
-void KabTables::disposing(void)
-{
-m_xMetaData.clear();
- OCollection::disposing();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/KTables.hxx b/connectivity/source/drivers/kab/KTables.hxx
deleted file mode 100644
index 438458c8e3..0000000000
--- a/connectivity/source/drivers/kab/KTables.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_KAB_TABLES_HXX_
-#define _CONNECTIVITY_KAB_TABLES_HXX_
-
-#include "connectivity/sdbcx/VCollection.hxx"
-#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-
-namespace connectivity
-{
- namespace kab
- {
- class KabTables : public sdbcx::OCollection
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
-
- protected:
- virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
- virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
-
- public:
- KabTables(
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,
- ::cppu::OWeakObject& _rParent,
- ::osl::Mutex& _rMutex,
- const TStringVector &_rVector)
- : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector),
- m_xMetaData(_rMetaData)
- { }
-
- virtual void SAL_CALL disposing(void);
- };
- }
-}
-
-#endif // _CONNECTIVITY_KAB_TABLES_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/exports.dxp b/connectivity/source/drivers/kab/exports.dxp
deleted file mode 100755
index 7003307892..0000000000
--- a/connectivity/source/drivers/kab/exports.dxp
+++ /dev/null
@@ -1 +0,0 @@
-component_getFactory
diff --git a/connectivity/source/drivers/kab/kab.xcu b/connectivity/source/drivers/kab/kab.xcu
deleted file mode 100644
index 0cc515e4ee..0000000000
--- a/connectivity/source/drivers/kab/kab.xcu
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="sdbc:address:kab" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.kab.Driver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">KDE Address Book</value>
- </prop>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/kab/kab.xml b/connectivity/source/drivers/kab/kab.xml
deleted file mode 100755
index 115b9f5522..0000000000
--- a/connectivity/source/drivers/kab/kab.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
-<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
- <module-name> kab1 </module-name>
- <component-description>
- <Author>Eric Bischoff</Author>
- <Name>com.sun.star.comp.sdbc.kab.Driver</Name>
- <description>This library implements the database driver for KDE address book formats.</description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service>com.sun.star.sdbc.Driver</supported-service>
- <service-dependency> ... </service-dependency>
- </component-description>
- <project-build-dependency> cppuhelper </project-build-dependency>
- <project-build-dependency> cppu </project-build-dependency>
- <project-build-dependency> sal </project-build-dependency>
-
- <runtime-module-dependency> cppuhelper </runtime-module-dependency>
- <runtime-module-dependency> cppu1 </runtime-module-dependency>
- <runtime-module-dependency> sal1 </runtime-module-dependency>
-
- <type> com.sun.star.registry.XRegistryKey </type>
- <type> com.sun.star.util.XCancellable </type>
- <type> com.sun.star.util.XNumberFormatter </type>
- <type> com.sun.star.uno.TypeClass </type>
- <type> com.sun.star.uno.XWeak </type>
- <type> com.sun.star.uno.XAggregation </type>
- <type> com.sun.star.uno.XComponentContext </type>
- <type> com.sun.star.beans.PropertyAttribute </type>
- <type> com.sun.star.beans.XPropertyState </type>
- <type> com.sun.star.beans.XPropertySet </type>
- <type> com.sun.star.beans.PropertyValue </type>
- <type> com.sun.star.beans.XMultiPropertySet </type>
- <type> com.sun.star.beans.XFastPropertySet </type>
- <type> com.sun.star.lang.XSingleServiceFactory </type>
- <type> com.sun.star.lang.XTypeProvider </type>
- <type> com.sun.star.lang.XSingleComponentFactory </type>
- <type> com.sun.star.lang.EventObject </type>
- <type> com.sun.star.lang.XComponent </type>
- <type> com.sun.star.lang.IllegalArgumentException </type>
- <type> com.sun.star.lang.DisposedException </type>
- <type> com.sun.star.lang.XMultiServiceFactory </type>
- <type> com.sun.star.lang.XServiceInfo </type>
- <type> com.sun.star.lang.XUnoTunnel </type>
- <type> com.sun.star.java.XJavaThreadRegister_11 </type>
- <type> com.sun.star.java.XJavaVM </type>
- <type> com.sun.star.sdbc.FetchDirection </type>
- <type> com.sun.star.sdbc.XConnection </type>
- <type> com.sun.star.sdbc.XStatement </type>
- <type> com.sun.star.sdbc.XResultSet </type>
- <type> com.sun.star.sdbc.XResultSetMetaDataSupplier</type>
- <type> com.sun.star.sdbc.XColumnLocate </type>
- <type> com.sun.star.sdbc.XResultSetUpdate </type>
- <type> com.sun.star.sdbc.XWarningsSupplier </type>
- <type> com.sun.star.sdbc.XRowUpdate </type>
- <type> com.sun.star.sdbc.XMultipleResults </type>
- <type> com.sun.star.sdbc.XBatchExecution </type>
- <type> com.sun.star.sdbc.XPreparedBatchExecution </type>
- <type> com.sun.star.sdbc.XParameters </type>
- <type> com.sun.star.sdbc.XOutParameters </type>
- <type> com.sun.star.sdbc.DriverPropertyInfo </type>
- <type> com.sun.star.sdbc.SQLWarning </type>
- <type> com.sun.star.sdbc.XRow </type>
- <type> com.sun.star.sdbc.ColumnSearch </type>
- <type> com.sun.star.sdbc.ColumnValue </type>
- <type> com.sun.star.sdbc.DataType </type>
- <type> com.sun.star.sdbc.XDriver </type>
- <type> com.sun.star.sdbc.TransactionIsolation </type>
- <type> com.sun.star.sdbc.ResultSetType </type>
- <type> com.sun.star.sdbc.ResultSetConcurrency </type>
- <type> com.sun.star.sdbcx.XRowLocate </type>
- <type> com.sun.star.sdbcx.XDeleteRows </type>
- <type> com.sun.star.sdbcx.CompareBookmark </type>
- <type> com.sun.star.sdb.XColumnUpdate </type>
- <type> com.sun.star.sdb.XColumn </type>
-</module-description>
diff --git a/connectivity/source/drivers/kab/kab1.component b/connectivity/source/drivers/kab/kab1.component
deleted file mode 100755
index 77227501d3..0000000000
--- a/connectivity/source/drivers/kab/kab1.component
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.sdbc.kab.Driver">
- <service name="com.sun.star.sdbc.Driver"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/kab/kabdrv.map b/connectivity/source/drivers/kab/kabdrv.map
deleted file mode 100755
index 5de866f2e5..0000000000
--- a/connectivity/source/drivers/kab/kabdrv.map
+++ /dev/null
@@ -1,9 +0,0 @@
-UDK_3_0_0 {
- global:
- createKabConnection;
- initKApplication;
- shutdownKApplication;
- matchKDEVersion;
- local:
- *;
-};
diff --git a/connectivity/source/drivers/kab/kcondition.cxx b/connectivity/source/drivers/kab/kcondition.cxx
deleted file mode 100644
index 2ecdead169..0000000000
--- a/connectivity/source/drivers/kab/kcondition.cxx
+++ /dev/null
@@ -1,232 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "kcondition.hxx"
-#include "kfields.hxx"
-#include "connectivity/CommonTools.hxx"
-
-using namespace ::connectivity::kab;
-using namespace ::com::sun::star::sdbc;
-// -----------------------------------------------------------------------------
-KabCondition::~KabCondition()
-{
-}
-// -----------------------------------------------------------------------------
-KabConditionConstant::KabConditionConstant(const sal_Bool bValue)
- : KabCondition(),
- m_bValue(bValue)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionConstant::isAlwaysTrue() const
-{
- return m_bValue;
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionConstant::isAlwaysFalse() const
-{
- return !m_bValue;
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionConstant::eval(const ::KABC::Addressee &) const
-{
- return m_bValue;
-}
-// -----------------------------------------------------------------------------
-KabConditionColumn::KabConditionColumn(const ::rtl::OUString &sColumnName) throw(SQLException)
- : KabCondition(),
- m_nFieldNumber(findKabField(sColumnName))
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionColumn::isAlwaysTrue() const
-{
- // Sometimes true, sometimes false
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionColumn::isAlwaysFalse() const
-{
- // Sometimes true, sometimes false
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-KabConditionNull::KabConditionNull(const ::rtl::OUString &sColumnName) throw(SQLException)
- : KabConditionColumn(sColumnName)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionNull::eval(const ::KABC::Addressee &aAddressee) const
-{
- QString aQtName = valueOfKabField(aAddressee, m_nFieldNumber);
-
- return aQtName.isNull();
-// KDE address book currently does not use NULL values.
-// But it might do it someday
-}
-// -----------------------------------------------------------------------------
-KabConditionNotNull::KabConditionNotNull(const ::rtl::OUString &sColumnName) throw(SQLException)
- : KabConditionColumn(sColumnName)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionNotNull::eval(const ::KABC::Addressee &aAddressee) const
-{
- QString aQtName = valueOfKabField(aAddressee, m_nFieldNumber);
-
- return !aQtName.isNull();
-// KDE address book currently does not use NULL values.
-// But it might do it someday
-}
-// -----------------------------------------------------------------------------
-KabConditionCompare::KabConditionCompare(const ::rtl::OUString &sColumnName, const ::rtl::OUString &sMatchString) throw(SQLException)
- : KabConditionColumn(sColumnName),
- m_sMatchString(sMatchString)
-{
-}
-// -----------------------------------------------------------------------------
-KabConditionEqual::KabConditionEqual(const ::rtl::OUString &sColumnName, const ::rtl::OUString &sMatchString) throw(SQLException)
- : KabConditionCompare(sColumnName, sMatchString)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionEqual::eval(const ::KABC::Addressee &aAddressee) const
-{
- QString aQtName = valueOfKabField(aAddressee, m_nFieldNumber);
-// Timestamps should not be compared according to their string value
-// The syntax for such queries should be like
-// {ts '2004-03-29 12:55:00.000000'}
-// They should also support operators like '<' or '>='
-
- if (aQtName.isNull()) return sal_False;
-
- ::rtl::OUString sValue((const sal_Unicode *) aQtName.ucs2());
- return sValue == m_sMatchString;
-}
-// -----------------------------------------------------------------------------
-KabConditionDifferent::KabConditionDifferent(const ::rtl::OUString &sColumnName, const ::rtl::OUString &sMatchString) throw(SQLException)
- : KabConditionCompare(sColumnName, sMatchString)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionDifferent::eval(const ::KABC::Addressee &aAddressee) const
-{
- QString aQtName = valueOfKabField(aAddressee, m_nFieldNumber);
-
- if (aQtName.isNull()) return sal_False;
-
- ::rtl::OUString sValue((const sal_Unicode *) aQtName.ucs2());
- return sValue != m_sMatchString;
-}
-// -----------------------------------------------------------------------------
-KabConditionSimilar::KabConditionSimilar(const ::rtl::OUString &sColumnName, const ::rtl::OUString &sMatchString) throw(SQLException)
- : KabConditionCompare(sColumnName, sMatchString)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionSimilar::eval(const ::KABC::Addressee &aAddressee) const
-{
- QString aQtName = valueOfKabField(aAddressee, m_nFieldNumber);
-
- if (aQtName.isNull()) return sal_False;
-
- ::rtl::OUString sValue((const sal_Unicode *) aQtName.ucs2());
- return match(m_sMatchString, sValue, '\0');
-}
-// -----------------------------------------------------------------------------
-KabConditionBoolean::KabConditionBoolean(KabCondition *pLeft, KabCondition *pRight)
- : KabCondition(),
- m_pLeft(pLeft),
- m_pRight(pRight)
-{
-}
-// -----------------------------------------------------------------------------
-KabConditionBoolean::~KabConditionBoolean()
-{
- delete m_pLeft;
- delete m_pRight;
-}
-// -----------------------------------------------------------------------------
-KabConditionOr::KabConditionOr(KabCondition *pLeft, KabCondition *pRight)
- : KabConditionBoolean(pLeft, pRight)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionOr::isAlwaysTrue() const
-{
- return m_pLeft->isAlwaysTrue() || m_pRight->isAlwaysTrue();
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionOr::isAlwaysFalse() const
-{
- return m_pLeft->isAlwaysFalse() && m_pRight->isAlwaysFalse();
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionOr::eval(const ::KABC::Addressee &aAddressee) const
-{
- // We avoid evaluating terms as much as we can
- if (m_pLeft->isAlwaysTrue() || m_pRight->isAlwaysTrue()) return sal_True;
- if (m_pLeft->isAlwaysFalse() && m_pRight->isAlwaysFalse()) return sal_False;
-
- if (m_pLeft->eval(aAddressee)) return sal_True;
- if (m_pRight->eval(aAddressee)) return sal_True;
-
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-KabConditionAnd::KabConditionAnd(KabCondition *pLeft, KabCondition *pRight)
- : KabConditionBoolean(pLeft, pRight)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionAnd::isAlwaysTrue() const
-{
- return m_pLeft->isAlwaysTrue() && m_pRight->isAlwaysTrue();
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionAnd::isAlwaysFalse() const
-{
- return m_pLeft->isAlwaysFalse() || m_pRight->isAlwaysFalse();
-}
-// -----------------------------------------------------------------------------
-sal_Bool KabConditionAnd::eval(const ::KABC::Addressee &aAddressee) const
-{
- // We avoid evaluating terms as much as we can
- if (m_pLeft->isAlwaysFalse() || m_pRight->isAlwaysFalse()) return sal_False;
- if (m_pLeft->isAlwaysTrue() && m_pRight->isAlwaysTrue()) return sal_True;
-
- if (!m_pLeft->eval(aAddressee)) return sal_False;
- if (!m_pRight->eval(aAddressee)) return sal_False;
-
- return sal_True;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/kcondition.hxx b/connectivity/source/drivers/kab/kcondition.hxx
deleted file mode 100644
index 41873bd420..0000000000
--- a/connectivity/source/drivers/kab/kcondition.hxx
+++ /dev/null
@@ -1,163 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_KAB_CONDITION_HXX_
-#define _CONNECTIVITY_KAB_CONDITION_HXX_
-
-#include <comphelper/types.hxx>
-#include <shell/kde_headers.h>
-#include <connectivity/dbexception.hxx>
-
-namespace connectivity
-{
- namespace kab
- {
-// -----------------------------------------------------------------------------
-class KabCondition
-{
- public:
- virtual ~KabCondition();
- virtual sal_Bool isAlwaysTrue() const = 0;
- virtual sal_Bool isAlwaysFalse() const = 0;
- virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const = 0;
-};
-// -----------------------------------------------------------------------------
-class KabConditionConstant : public KabCondition
-{
- protected:
- sal_Bool m_bValue;
-
- public:
- KabConditionConstant(const sal_Bool bValue);
- virtual sal_Bool isAlwaysTrue() const;
- virtual sal_Bool isAlwaysFalse() const;
- virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const;
-};
-// -----------------------------------------------------------------------------
-class KabConditionColumn : public KabCondition
-{
- protected:
- sal_Int32 m_nFieldNumber;
-
- QString value(const ::KABC::Addressee &aAddressee) const;
-
- public:
- KabConditionColumn(
- const ::rtl::OUString &sColumnName) throw(::com::sun::star::sdbc::SQLException);
- virtual sal_Bool isAlwaysTrue() const;
- virtual sal_Bool isAlwaysFalse() const;
-};
-// -----------------------------------------------------------------------------
-class KabConditionNull : public KabConditionColumn
-{
- public:
- KabConditionNull(
- const ::rtl::OUString &sColumnName) throw(::com::sun::star::sdbc::SQLException);
- virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const;
-};
-// -----------------------------------------------------------------------------
-class KabConditionNotNull : public KabConditionColumn
-{
- public:
- KabConditionNotNull(
- const ::rtl::OUString &sColumnName) throw(::com::sun::star::sdbc::SQLException);
- virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const;
-};
-// -----------------------------------------------------------------------------
-class KabConditionCompare : public KabConditionColumn
-{
- protected:
- const ::rtl::OUString m_sMatchString;
-
- public:
- KabConditionCompare(
- const ::rtl::OUString &sColumnName,
- const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
-};
-// -----------------------------------------------------------------------------
-class KabConditionEqual : public KabConditionCompare
-{
- public:
- KabConditionEqual(
- const ::rtl::OUString &sColumnName,
- const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
- virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const;
-};
-// -----------------------------------------------------------------------------
-class KabConditionDifferent : public KabConditionCompare
-{
- public:
- KabConditionDifferent(
- const ::rtl::OUString &sColumnName,
- const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
- virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const;
-};
-// -----------------------------------------------------------------------------
-class KabConditionSimilar : public KabConditionCompare
-{
- public:
- KabConditionSimilar(
- const ::rtl::OUString &sColumnName,
- const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
- virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const;
-};
-// -----------------------------------------------------------------------------
-class KabConditionBoolean : public KabCondition
-{
- protected:
- KabCondition *m_pLeft, *m_pRight;
-
- public:
- KabConditionBoolean(KabCondition *pLeft, KabCondition *pRight);
- virtual ~KabConditionBoolean();
-};
-// -----------------------------------------------------------------------------
-class KabConditionOr : public KabConditionBoolean
-{
- public:
- KabConditionOr(KabCondition *pLeft, KabCondition *pRight);
- virtual sal_Bool isAlwaysTrue() const;
- virtual sal_Bool isAlwaysFalse() const;
- virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const;
-};
-// -----------------------------------------------------------------------------
-class KabConditionAnd : public KabConditionBoolean
-{
- public:
- KabConditionAnd(KabCondition *pLeft, KabCondition *pRight);
- virtual sal_Bool isAlwaysTrue() const;
- virtual sal_Bool isAlwaysFalse() const;
- virtual sal_Bool eval(const ::KABC::Addressee &addressee) const;
-};
-// -----------------------------------------------------------------------------
- }
-}
-
-#endif // _CONNECTIVITY_KAB_CONDITION_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/kfields.cxx b/connectivity/source/drivers/kab/kfields.cxx
deleted file mode 100644
index cf1632b3cd..0000000000
--- a/connectivity/source/drivers/kab/kfields.cxx
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "kfields.hxx"
-#include "resource/common_res.hrc"
-#include "resource/sharedresources.hxx"
-
-using namespace ::connectivity::kab;
-using namespace ::com::sun::star::sdbc;
-
-namespace connectivity
-{
- namespace kab
- {
-// -----------------------------------------------------------------------------
-// return the value of a KDE address book field, given an addressee and a field number
-QString valueOfKabField(const ::KABC::Addressee &aAddressee, sal_Int32 nFieldNumber)
-{
- switch (nFieldNumber)
- {
- case KAB_FIELD_REVISION:
- return aAddressee.revision().toString("yyyy-MM-dd hh:mm:ss");
- default:
- ::KABC::Field::List aFields = ::KABC::Field::allFields();
- return aFields[nFieldNumber - KAB_DATA_FIELDS]->value(aAddressee);
- }
-}
-// ------------------------------------------------------------------------------
-// search the KDE address book field number of a given column name
-sal_uInt32 findKabField(const ::rtl::OUString& columnName) throw(SQLException)
-{
- QString aQtName;
- ::rtl::OUString aName;
-
- aQtName = KABC::Addressee::revisionLabel();
- aName = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2());
- if (columnName == aName)
- return KAB_FIELD_REVISION;
-
- ::KABC::Field::List aFields = ::KABC::Field::allFields();
- ::KABC::Field::List::iterator aField;
- sal_uInt32 nResult;
-
- for ( aField = aFields.begin(), nResult = KAB_DATA_FIELDS;
- aField != aFields.end();
- ++aField, ++nResult)
- {
- aQtName = (*aField)->label();
- aName = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2());
-
- if (columnName == aName)
- return nResult;
- }
-
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(
- STR_INVALID_COLUMNNAME,
- "$columnname$",columnName
- ) );
- ::dbtools::throwGenericSQLException(sError,NULL);
- // Unreachable:
- OSL_ASSERT(false);
- return 0;
-}
-// ------------------------------------------------------------------------------
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/kfields.hxx b/connectivity/source/drivers/kab/kfields.hxx
deleted file mode 100644
index 2e628cd413..0000000000
--- a/connectivity/source/drivers/kab/kfields.hxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_KAB_FIELDS_HXX_
-#define _CONNECTIVITY_KAB_FIELDS_HXX_
-
-#include <shell/kde_headers.h>
-#include <connectivity/dbexception.hxx>
-#include <rtl/ustring.hxx>
-
-#define KAB_FIELD_REVISION 0
-#define KAB_DATA_FIELDS 1
-
-namespace connectivity
-{
- namespace kab
- {
- QString valueOfKabField(const ::KABC::Addressee &aAddressee, sal_Int32 nFieldNumber);
- sal_uInt32 findKabField(const ::rtl::OUString& columnName) throw(::com::sun::star::sdbc::SQLException);
- }
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/korder.cxx b/connectivity/source/drivers/kab/korder.cxx
deleted file mode 100644
index e10d2cfeee..0000000000
--- a/connectivity/source/drivers/kab/korder.cxx
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "korder.hxx"
-#include "kfields.hxx"
-
-using namespace ::connectivity::kab;
-
-KabOrder::~KabOrder()
-{
-}
-// -----------------------------------------------------------------------------
-KabSimpleOrder::KabSimpleOrder(::rtl::OUString &sColumnName, sal_Bool bAscending)
- : KabOrder(),
- m_nFieldNumber(findKabField(sColumnName)),
- m_bAscending(bAscending)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Int32 KabSimpleOrder::compare(const ::KABC::Addressee &aAddressee1, const ::KABC::Addressee &aAddressee2) const
-{
- sal_Int32 result;
-
- result = QString::compare(
- valueOfKabField(aAddressee1, m_nFieldNumber),
- valueOfKabField(aAddressee2, m_nFieldNumber));
-// Timestamps should be compared differently than with their string value
-
- if (!m_bAscending) result = -result;
-
- return result;
-}
-// -----------------------------------------------------------------------------
-KabComplexOrder::KabComplexOrder()
- : KabOrder(),
- m_aOrders()
-{
-}
-// -----------------------------------------------------------------------------
-KabComplexOrder::~KabComplexOrder()
-{
- for (sal_uInt32 i = 0; i < m_aOrders.size(); i++)
- delete m_aOrders[i];
-}
-// -----------------------------------------------------------------------------
-void KabComplexOrder::addOrder(KabOrder *pOrder)
-{
- m_aOrders.push_back(pOrder);
-}
-// -----------------------------------------------------------------------------
-sal_Int32 KabComplexOrder::compare(const ::KABC::Addressee &aAddressee1, const ::KABC::Addressee &aAddressee2) const
-{
- for (sal_uInt32 i = 0; i < m_aOrders.size(); i++)
- {
- const KabOrder *pOrder = m_aOrders[i];
- sal_Int32 result = pOrder->compare(aAddressee1, aAddressee2);
-
- if (result) return result;
- }
- return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/korder.hxx b/connectivity/source/drivers/kab/korder.hxx
deleted file mode 100644
index d6df56d383..0000000000
--- a/connectivity/source/drivers/kab/korder.hxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_KAB_ORDER_HXX_
-#define _CONNECTIVITY_KAB_ORDER_HXX_
-
-#include "rtl/ustring.hxx"
-#include <shell/kde_headers.h>
-
-#include <vector>
-
-namespace connectivity
-{
- namespace kab
- {
- class KabOrder
- {
- public:
- virtual ~KabOrder();
-
- virtual sal_Int32 compare(const ::KABC::Addressee &aAddressee1, const ::KABC::Addressee &aAddressee2) const = 0;
- };
-
- class KabSimpleOrder : public KabOrder
- {
- sal_Int32 m_nFieldNumber;
- sal_Bool m_bAscending;
-
- QString value(const ::KABC::Addressee &aAddressee) const;
- public:
- KabSimpleOrder(::rtl::OUString &sColumnName, sal_Bool bAscending);
-
- virtual sal_Int32 compare(const ::KABC::Addressee &aAddressee1, const ::KABC::Addressee &aAddressee2) const;
- };
-
- class KabComplexOrder : public KabOrder
- {
- ::std::vector<KabOrder *> m_aOrders;
-
- public:
- KabComplexOrder();
- virtual ~KabComplexOrder();
-
- void addOrder(KabOrder *pOrder);
- virtual sal_Int32 compare(const ::KABC::Addressee &aAddressee1, const ::KABC::Addressee &aAddressee2) const;
- };
- }
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/kab/makefile.mk b/connectivity/source/drivers/kab/makefile.mk
deleted file mode 100755
index 13d4857c91..0000000000
--- a/connectivity/source/drivers/kab/makefile.mk
+++ /dev/null
@@ -1,149 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=kab
-TARGET2=$(TARGET)drv
-
-ENABLE_EXCEPTIONS=TRUE
-VISIBILITY_HIDDEN=TRUE
-
-# --- Settings ----------------------------------
-
-.INCLUDE : $(PRJ)$/makefile.pmk
-.INCLUDE : $(PRJ)$/version.mk
-
-.IF "$(GUI)" == "UNX"
-.IF "$(ENABLE_KAB)" == "TRUE"
-
-CFLAGS+=$(KDE_CFLAGS)
-
-.IF "$(KDE_ROOT)"!=""
-EXTRALIBPATHS+=-L$(KDE_ROOT)$/lib
-.IF "$(OS)$(CPU)" == "LINUXX"
-EXTRALIBPATHS+=-L$(KDE_ROOT)$/lib64
-.ENDIF
-.ENDIF
-
-# === KAB base library ==========================
-
-# --- Files -------------------------------------
-
-SLOFILES= \
- $(SLO)$/KDriver.obj \
- $(SLO)$/KServices.obj
-
-DEPOBJFILES= \
- $(SLO2FILES)
-
-# --- Library -----------------------------------
-
-SHL1VERSIONMAP=$(SOLARENV)/src/component.map
-
-SHL1TARGET= $(TARGET)$(KAB_MAJOR)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(DBTOOLSLIB) \
- $(SALLIB) \
- $(SALHELPERLIB)
-
-SHL1DEPN=
-SHL1IMPLIB= i$(TARGET)
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-
-# === KAB impl library ==========================
-
-# --- Files -------------------------------------
-
-SLO2FILES=\
- $(SLO)$/KColumns.obj \
- $(SLO)$/KTable.obj \
- $(SLO)$/KTables.obj \
- $(SLO)$/KCatalog.obj \
- $(SLO)$/KResultSet.obj \
- $(SLO)$/KStatement.obj \
- $(SLO)$/KPreparedStatement.obj \
- $(SLO)$/KDatabaseMetaData.obj \
- $(SLO)$/KConnection.obj \
- $(SLO)$/KResultSetMetaData.obj \
- $(SLO)$/kcondition.obj \
- $(SLO)$/korder.obj \
- $(SLO)$/kfields.obj \
- $(SLO)$/KDEInit.obj
-
-KAB_LIB=$(KDE_LIBS) -lkabc
-
-# --- Library -----------------------------------
-
-SHL2VERSIONMAP=$(TARGET2).map
-
-SHL2TARGET= $(TARGET2)$(KAB_MAJOR)
-SHL2OBJS=$(SLO2FILES)
-SHL2LINKFLAGS+=$(KAB_LIB)
-SHL2STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SALLIB) \
- $(SALHELPERLIB) \
- $(DBTOOLSLIB) \
- $(COMPHELPERLIB)
-
-SHL2DEPN=
-SHL2IMPLIB= i$(TARGET2)
-
-SHL2DEF= $(MISC)$/$(SHL2TARGET).def
-
-DEF2NAME= $(SHL2TARGET)
-
-# --- Targets -----------------------------------
-.ELSE # "$(ENABLE_KAB)" == "TRUE"
-dummy:
- @echo KDE Addressbook disabled - nothing to build
-.ENDIF
-
-.ELSE # "$(GUI)" == "UNX"
-dummy:
- @echo "Nothing to build for GUI $(GUI)"
-.ENDIF
-
-.INCLUDE : $(PRJ)$/target.pmk
-
-
-ALLTAR : $(MISC)/kab1.component
-
-$(MISC)/kab1.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- kab1.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt kab1.component
diff --git a/connectivity/source/drivers/macab/MacabAddressBook.cxx b/connectivity/source/drivers/macab/MacabAddressBook.cxx
deleted file mode 100644
index 1f7d0a6b18..0000000000
--- a/connectivity/source/drivers/macab/MacabAddressBook.cxx
+++ /dev/null
@@ -1,258 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabAddressBook.hxx"
-#include "MacabRecords.hxx"
-#include "MacabGroup.hxx"
-
-#include <vector>
-
-#include <premac.h>
-#include <Carbon/Carbon.h>
-#include <AddressBook/ABAddressBookC.h>
-#include <postmac.h>
-#include "connectivity/CommonTools.hxx"
-
-using namespace connectivity::macab;
-using namespace ::com::sun::star::uno;
-
-// -----------------------------------------------------------------------------
-MacabAddressBook::MacabAddressBook( )
-{
- m_aAddressBook = ABGetSharedAddressBook();
- m_xMacabRecords = NULL;
- m_bRetrievedGroups = sal_False;
-}
-
-// -----------------------------------------------------------------------------
-MacabAddressBook::~MacabAddressBook()
-{
- if(m_xMacabRecords != NULL)
- {
- delete m_xMacabRecords;
- m_xMacabRecords = NULL;
- }
-
- if(!m_xMacabGroups.empty())
- {
- ::std::vector<MacabGroup *>::iterator iter, end;
- iter = m_xMacabGroups.begin();
- end = m_xMacabGroups.end();
- for( ; iter != end; ++iter)
- delete (*iter);
- }
-
- m_bRetrievedGroups = sal_False;
-}
-
-// -----------------------------------------------------------------------------
-/* Get the address book's default table name. This is the table name that
- * refers to the table containing _all_ records in the address book.
- */
-const ::rtl::OUString & MacabAddressBook::getDefaultTableName()
-{
- /* This string probably needs to be localized. */
- static const ::rtl::OUString aDefaultTableName
- (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Address Book")));
-
- return aDefaultTableName;
-}
-
-// -----------------------------------------------------------------------------
-MacabRecords *MacabAddressBook::getMacabRecords()
-{
- /* If the MacabRecords don't exist, create them. */
- if(m_xMacabRecords == NULL)
- {
- m_xMacabRecords = new MacabRecords(m_aAddressBook);
- m_xMacabRecords->setName(getDefaultTableName());
- m_xMacabRecords->initialize();
- }
-
- return m_xMacabRecords;
-}
-
-// -----------------------------------------------------------------------------
-/* Get the MacabRecords for a given name: either a group name or the
- * default table name.
- */
-MacabRecords *MacabAddressBook::getMacabRecords(const ::rtl::OUString _tableName)
-{
- if(_tableName == getDefaultTableName())
- {
- return getMacabRecords();
- }
- else
- {
- return getMacabGroup(_tableName);
- }
-}
-
-// -----------------------------------------------------------------------------
-MacabRecords *MacabAddressBook::getMacabRecordsMatch(const ::rtl::OUString _tableName)
-{
- if(match(_tableName, getDefaultTableName(), '\0'))
- {
- return getMacabRecords();
- }
-
- return getMacabGroupMatch(_tableName);
-}
-
-// -----------------------------------------------------------------------------
-::std::vector<MacabGroup *> MacabAddressBook::getMacabGroups()
-{
- /* If the MacabGroups haven't been created yet, create them. */
- if(m_bRetrievedGroups == sal_False)
- {
- /* If the MacabRecords haven't been created yet, create them. */
- if(m_xMacabRecords == NULL)
- {
- m_xMacabRecords = new MacabRecords(m_aAddressBook);
- m_xMacabRecords->setName(getDefaultTableName());
- m_xMacabRecords->initialize();
- }
-
- CFArrayRef allGroups = ABCopyArrayOfAllGroups(m_aAddressBook);
- sal_Int32 nGroups = CFArrayGetCount(allGroups);
- m_xMacabGroups = ::std::vector<MacabGroup *>(nGroups);
-
- sal_Int32 i;
- ABGroupRef xGroup;
-
- /* Go through each group and create a MacabGroup out of it. */
- for(i = 0; i < nGroups; i++)
- {
- xGroup = (ABGroupRef) CFArrayGetValueAtIndex(allGroups, i);
- m_xMacabGroups[i] = new MacabGroup(m_aAddressBook, m_xMacabRecords, xGroup);
- }
-
- CFRelease(allGroups);
-
- /* Manage duplicates. */
- manageDuplicateGroups(m_xMacabGroups);
- m_bRetrievedGroups = sal_True;
- }
-
- return m_xMacabGroups;
-}
-
-// -----------------------------------------------------------------------------
-MacabGroup *MacabAddressBook::getMacabGroup(::rtl::OUString _groupName)
-{
- // initialize groups if not already initialized
- if(m_bRetrievedGroups == sal_False)
- getMacabGroups();
-
- sal_Int32 nGroups = m_xMacabGroups.size();
- sal_Int32 i;
-
- for(i = 0; i < nGroups; i++)
- {
- if(m_xMacabGroups[i] != NULL)
- {
- if(m_xMacabGroups[i]->getName() == _groupName)
- {
- return m_xMacabGroups[i];
- }
- }
- }
-
- return NULL;
-}
-
-// -----------------------------------------------------------------------------
-MacabGroup *MacabAddressBook::getMacabGroupMatch(::rtl::OUString _groupName)
-{
- // initialize groups if not already initialized
- if(m_bRetrievedGroups == sal_False)
- getMacabGroups();
-
- sal_Int32 nGroups = m_xMacabGroups.size();
- sal_Int32 i;
-
- for(i = 0; i < nGroups; i++)
- {
- if(m_xMacabGroups[i] != NULL)
- {
- if(match(m_xMacabGroups[i]->getName(), _groupName, '\0'))
- {
- return m_xMacabGroups[i];
- }
- }
- }
-
- return NULL;
-}
-
-// -------------------------------------------------------------------------
-void MacabAddressBook::manageDuplicateGroups(::std::vector<MacabGroup *> _xGroups) const
-{
- /* If we have two cases of groups, say, family, this makes it:
- * family
- * family (2)
- */
- ::std::vector<MacabGroup *>::reverse_iterator iter1, iter2;
- sal_Int32 count;
-
- for(iter1 = _xGroups.rbegin(); iter1 != _xGroups.rend(); ++iter1)
- {
- /* If the name matches the default table name, there is already
- * (obviously) a conflict. So, start the count of groups with this
- * name at 2 instead of 1.
- */
- if( (*iter1)->getName() == getDefaultTableName() )
- count = 2;
- else
- count = 1;
-
- iter2 = iter1;
- for( ++iter2; iter2 != _xGroups.rend(); ++iter2)
- {
- if( (*iter1)->getName() == (*iter2)->getName() )
- {
- count++;
- }
- }
-
- // duplicate!
- if(count != 1)
- {
- ::rtl::OUString sName = (*iter1)->getName();
- sName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (")) +
- ::rtl::OUString::valueOf(count) +
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"));
- (*iter1)->setName(sName);
- }
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabAddressBook.hxx b/connectivity/source/drivers/macab/MacabAddressBook.hxx
deleted file mode 100644
index 2aefbd8d9e..0000000000
--- a/connectivity/source/drivers/macab/MacabAddressBook.hxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_ADDRESSBOOK_HXX_
-#define _CONNECTIVITY_MACAB_ADDRESSBOOK_HXX_
-
-#include "MacabRecords.hxx"
-#include "MacabGroup.hxx"
-
-#include <vector>
-
-#include <premac.h>
-#include <Carbon/Carbon.h>
-#include <AddressBook/ABAddressBookC.h>
-#include <postmac.h>
-
-namespace connectivity
-{
- namespace macab
- {
- class MacabAddressBook
- {
- protected:
- ABAddressBookRef m_aAddressBook;
- MacabRecords *m_xMacabRecords;
- ::std::vector<MacabGroup *> m_xMacabGroups;
- sal_Bool m_bRetrievedGroups;
- private:
- void manageDuplicateGroups(::std::vector<MacabGroup *> _xGroups) const;
- public:
- MacabAddressBook();
- ~MacabAddressBook();
- static const ::rtl::OUString & getDefaultTableName();
-
- MacabRecords *getMacabRecords();
- ::std::vector<MacabGroup *> getMacabGroups();
-
- MacabGroup *getMacabGroup(::rtl::OUString _groupName);
- MacabRecords *getMacabRecords(const ::rtl::OUString _tableName);
-
- MacabGroup *getMacabGroupMatch(::rtl::OUString _groupName);
- MacabRecords *getMacabRecordsMatch(const ::rtl::OUString _tableName);
- };
-
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_ADDRESSBOOK_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabCatalog.cxx b/connectivity/source/drivers/macab/MacabCatalog.cxx
deleted file mode 100644
index bd9342b4bd..0000000000
--- a/connectivity/source/drivers/macab/MacabCatalog.cxx
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabCatalog.hxx"
-#include "MacabConnection.hxx"
-#include "MacabTables.hxx"
-
-using namespace connectivity::macab;
-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 ::cppu;
-
-// -------------------------------------------------------------------------
-MacabCatalog::MacabCatalog(MacabConnection* _pCon)
- : connectivity::sdbcx::OCatalog(_pCon),
- m_pConnection(_pCon),
- m_xMetaData(m_pConnection->getMetaData())
-{
-}
-// -------------------------------------------------------------------------
-void MacabCatalog::refreshTables()
-{
- TStringVector aVector;
- Sequence< ::rtl::OUString > aTypes(1);
- aTypes[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%"));
- Reference< XResultSet > xResult = m_xMetaData->getTables(
- Any(),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")),
- aTypes);
-
- if (xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- ::rtl::OUString aName;
- // const ::rtl::OUString& sDot = MacabCatalog::getDot();
-
- while (xResult->next())
- {
- // aName = xRow->getString(2);
- // aName += sDot;
- aName = xRow->getString(3);
- aVector.push_back(aName);
- }
- }
- if (m_pTables)
- m_pTables->reFill(aVector);
- else
- m_pTables = new MacabTables(m_xMetaData,*this,m_aMutex,aVector);
-}
-// -------------------------------------------------------------------------
-void MacabCatalog::refreshViews()
-{
-}
-// -------------------------------------------------------------------------
-void MacabCatalog::refreshGroups()
-{
-}
-// -------------------------------------------------------------------------
-void MacabCatalog::refreshUsers()
-{
-}
-// -------------------------------------------------------------------------
-const ::rtl::OUString& MacabCatalog::getDot()
-{
- static const ::rtl::OUString sDot = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("."));
- return sDot;
-}
-// -----------------------------------------------------------------------------
-
-// XTablesSupplier
-Reference< XNameAccess > SAL_CALL MacabCatalog::getTables( ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(rBHelper.bDisposed);
-
- try
- {
- if (!m_pTables)
- refreshTables();
- }
- catch( const RuntimeException& )
- {
- // allowed to leave this method
- throw;
- }
- catch( const Exception& )
- {
- // allowed
- }
-
- return m_pTables;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabCatalog.hxx b/connectivity/source/drivers/macab/MacabCatalog.hxx
deleted file mode 100644
index 52e4e7782f..0000000000
--- a/connectivity/source/drivers/macab/MacabCatalog.hxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_CATALOG_HXX_
-#define _CONNECTIVITY_MACAB_CATALOG_HXX_
-
-#include "connectivity/sdbcx/VCatalog.hxx"
-
-namespace connectivity
-{
- namespace macab
- {
- class MacabConnection;
-
- class MacabCatalog : public connectivity::sdbcx::OCatalog
- {
- MacabConnection* m_pConnection; // used to get the metadata
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier
-
- public:
- MacabCatalog(MacabConnection* _pCon);
-
- inline MacabConnection* getConnection() const { return m_pConnection; }
-
- static const ::rtl::OUString& getDot();
-
- // implementation of the pure virtual methods
- virtual void refreshTables();
- virtual void refreshViews();
- virtual void refreshGroups();
- virtual void refreshUsers();
-
- // XTablesSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTables(
- ) throw(::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_CATALOG_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabColumns.cxx b/connectivity/source/drivers/macab/MacabColumns.cxx
deleted file mode 100644
index 0d78b45969..0000000000
--- a/connectivity/source/drivers/macab/MacabColumns.cxx
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabColumns.hxx"
-#include "MacabTable.hxx"
-#include "MacabTables.hxx"
-#include "MacabCatalog.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-
-using namespace connectivity::macab;
-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;
-
-// -------------------------------------------------------------------------
-sdbcx::ObjectType MacabColumns::createObject(const ::rtl::OUString& _rName)
-{
- Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(
- Any(),
- m_pTable->getSchema(),
- m_pTable->getTableName(),
- _rName);
-
- sdbcx::ObjectType xRet = NULL;
- if (xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
-
- while (xResult->next())
- {
- if (xRow->getString(4) == _rName)
- {
- OColumn* pRet = new OColumn(
- _rName,
- xRow->getString(6),
- xRow->getString(13),
- xRow->getString(12),
- xRow->getInt(11),
- xRow->getInt(7),
- xRow->getInt(9),
- xRow->getInt(5),
- sal_False,
- sal_False,
- sal_False,
- sal_True);
- xRet = pRet;
- break;
- }
- }
- }
-
- return xRet;
-}
-// -------------------------------------------------------------------------
-void MacabColumns::impl_refresh() throw(RuntimeException)
-{
- m_pTable->refreshColumns();
-}
-// -------------------------------------------------------------------------
-MacabColumns::MacabColumns( MacabTable* _pTable,
- ::osl::Mutex& _rMutex,
- const TStringVector &_rVector)
- : sdbcx::OCollection(*_pTable, sal_True, _rMutex, _rVector),
- m_pTable(_pTable)
-{
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabColumns.hxx b/connectivity/source/drivers/macab/MacabColumns.hxx
deleted file mode 100644
index 1d75c8b585..0000000000
--- a/connectivity/source/drivers/macab/MacabColumns.hxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_COLUMNS_HXX_
-#define _CONNECTIVITY_MACAB_COLUMNS_HXX_
-
-#include "MacabTable.hxx"
-#include "connectivity/sdbcx/VCollection.hxx"
-
-namespace connectivity
-{
- namespace macab
- {
- class MacabColumns : public sdbcx::OCollection
- {
- protected:
- MacabTable* m_pTable;
-
- virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
- virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
-
- public:
- MacabColumns( MacabTable* _pTable,
- ::osl::Mutex& _rMutex,
- const TStringVector &_rVector);
- };
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_COLUMNS_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabConnection.cxx b/connectivity/source/drivers/macab/MacabConnection.cxx
deleted file mode 100644
index 4841430a07..0000000000
--- a/connectivity/source/drivers/macab/MacabConnection.cxx
+++ /dev/null
@@ -1,326 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabConnection.hxx"
-#include "MacabAddressBook.hxx"
-#include "MacabDatabaseMetaData.hxx"
-#include "MacabStatement.hxx"
-#include "MacabPreparedStatement.hxx"
-#include "MacabDriver.hxx"
-#include "MacabCatalog.hxx"
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/TransactionIsolation.hpp>
-
-using namespace connectivity::macab;
-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;
-
-IMPLEMENT_SERVICE_INFO(MacabConnection, "com.sun.star.sdbc.drivers.MacabConnection", "com.sun.star.sdbc.Connection")
-//-----------------------------------------------------------------------------
-MacabConnection::MacabConnection(MacabDriver* _pDriver)
- : OSubComponent<MacabConnection, MacabConnection_BASE>((::cppu::OWeakObject*)_pDriver, this),
- m_pAddressBook(NULL),
- m_pDriver(_pDriver)
-{
- m_pDriver->acquire();
-}
-//-----------------------------------------------------------------------------
-MacabConnection::~MacabConnection()
-{
- if (!isClosed())
- close();
-
- m_pDriver->release();
- m_pDriver = NULL;
-}
-//-----------------------------------------------------------------------------
-void SAL_CALL MacabConnection::release() throw()
-{
- relase_ChildImpl();
-}
-// -----------------------------------------------------------------------------
-void MacabConnection::construct(const ::rtl::OUString&, const Sequence< PropertyValue >&) throw(SQLException)
-{
- osl_incrementInterlockedCount( &m_refCount );
-
- // get the Mac OS X shared address book
- m_pAddressBook = new MacabAddressBook();
-
- osl_decrementInterlockedCount( &m_refCount );
-}
-// XServiceInfo
-// --------------------------------------------------------------------------------
-Reference< XStatement > SAL_CALL MacabConnection::createStatement( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
-
- // create a statement
- // the statement can only be executed once
- Reference< XStatement > xReturn = new MacabStatement(this);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
- return xReturn;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL MacabConnection::prepareStatement( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
-
- // create a statement
- // the statement can only be executed more than once
- Reference< XPreparedStatement > xReturn = new MacabPreparedStatement(this, _sSql);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
- return xReturn;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL MacabConnection::prepareCall( const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
-
- // not implemented yet :-) a task to do
- return NULL;
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabConnection::nativeSQL( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- // when you need to transform SQL92 to you driver specific you can do it here
-
- return _sSql;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL MacabConnection::setAutoCommit( sal_Bool ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
- // here you have to set your commit mode please have a look at the jdbc documentation to get a clear explanation
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabConnection::getAutoCommit( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
- // you have to distinguish which if you are in autocommit mode or not
- // at normal case true should be fine here
-
- return sal_True;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL MacabConnection::commit( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
-
- // when you database does support transactions you should commit here
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL MacabConnection::rollback( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
-
- // same as commit but for the other case
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabConnection::isClosed( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- // just simple -> we are closed when we are disposed, that means someone called dispose(); (XComponent)
- return MacabConnection_BASE::rBHelper.bDisposed;
-}
-// --------------------------------------------------------------------------------
-Reference< XDatabaseMetaData > SAL_CALL MacabConnection::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
-
- // here we have to create the class with biggest interface
- // The answer is 42 :-)
- Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
- if (!xMetaData.is())
- {
- xMetaData = new MacabDatabaseMetaData(this); // need the connection because it can return it
- m_xMetaData = xMetaData;
- }
-
- return xMetaData;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL MacabConnection::setReadOnly( sal_Bool ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
-
- // set you connection to readonly
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabConnection::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
-
- // return if your connection to readonly
- return sal_False;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL MacabConnection::setCatalog( const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
-
- // if your database doesn't work with catalogs you go to next method otherwise you kjnow what to do
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabConnection::getCatalog( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
-
-
- // return your current catalog
- return ::rtl::OUString();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL MacabConnection::setTransactionIsolation( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
-
- // set your isolation level
- // please have a look at @see com.sun.star.sdbc.TransactionIsolation
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
-
-
- // please have a look at @see com.sun.star.sdbc.TransactionIsolation
- return TransactionIsolation::NONE;
-}
-// --------------------------------------------------------------------------------
-Reference< ::com::sun::star::container::XNameAccess > SAL_CALL MacabConnection::getTypeMap( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
-
- // if your driver has special database types you can return it here
-
- return NULL;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL MacabConnection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& ) throw(SQLException, RuntimeException)
-{
- // the other way around
-}
-// --------------------------------------------------------------------------------
-// XCloseable
-void SAL_CALL MacabConnection::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabConnection_BASE::rBHelper.bDisposed);
- }
- dispose();
-}
-// --------------------------------------------------------------------------------
-// XWarningsSupplier
-Any SAL_CALL MacabConnection::getWarnings( ) throw(SQLException, RuntimeException)
-{
- // when you collected some warnings -> return it
- return Any();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL MacabConnection::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- // you should clear your collected warnings here
-}
-//------------------------------------------------------------------------------
-void MacabConnection::disposing()
-{
- // we noticed that we should be destroied in near future so we have to dispose our statements
- ::osl::MutexGuard aGuard(m_aMutex);
-
- for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i)
- {
- Reference< XComponent > xComp(i->get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- }
- m_aStatements.clear();
-
- if (m_pAddressBook != NULL)
- {
- delete m_pAddressBook;
- m_pAddressBook = NULL;
- }
-
- m_xMetaData = ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData>();
-
- dispose_ChildImpl();
- MacabConnection_BASE::disposing();
-}
-// -----------------------------------------------------------------------------
-Reference< XTablesSupplier > SAL_CALL MacabConnection::createCatalog()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- Reference< XTablesSupplier > xTab = m_xCatalog;
- if (!m_xCatalog.is())
- {
- MacabCatalog *pCat = new MacabCatalog(this);
- xTab = pCat;
- m_xCatalog = xTab;
- }
- return xTab;
-}
-// -----------------------------------------------------------------------------
-MacabAddressBook* MacabConnection::getAddressBook() const
-{
- return m_pAddressBook;
-}
-// -----------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL createMacabConnection( void* _pDriver )
-{
- MacabConnection* pConnection = new MacabConnection( static_cast< MacabDriver* >( _pDriver ) );
- // by definition, the pointer crossing library boundaries as void ptr is acquired once
- pConnection->acquire();
- return pConnection;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabConnection.hxx b/connectivity/source/drivers/macab/MacabConnection.hxx
deleted file mode 100644
index 65ece28448..0000000000
--- a/connectivity/source/drivers/macab/MacabConnection.hxx
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_CONNECTION_HXX_
-#define _CONNECTIVITY_MACAB_CONNECTION_HXX_
-
-#include <map>
-#include "OSubComponent.hxx"
-#include "connectivity/CommonTools.hxx"
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/sdbc/SQLWarning.hpp>
-#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
-#include <com/sun/star/sdbc/XConnection.hpp>
-#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#include <comphelper/broadcasthelper.hxx>
-#include <cppuhelper/compbase3.hxx>
-#include "TConnection.hxx"
-
-namespace connectivity
-{
- namespace macab
- {
-
- typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XConnection,
- ::com::sun::star::sdbc::XWarningsSupplier,
- ::com::sun::star::lang::XServiceInfo
- > OMetaConnection_BASE;
-
- class MacabStatement_Base;
- class MacabDriver;
- class MacabDatabaseMetaData;
- class MacabAddressBook;
-
- //typedef OMetaConnection_BASE MacabConnection_BASE; // implements basics and text encoding
- typedef std::vector< ::com::sun::star::uno::WeakReferenceHelper > OWeakRefArray;
-
- typedef connectivity::OMetaConnection MacabConnection_BASE;
-
- class MacabConnection : public MacabConnection_BASE,
- public OSubComponent<MacabConnection, MacabConnection_BASE>
- {
- friend class OSubComponent<MacabConnection, MacabConnection_BASE>;
-
- protected:
- //====================================================================
- // Data attributes
- //====================================================================
- MacabAddressBook* m_pAddressBook; // the address book
- MacabDriver* m_pDriver; // pointer to the owning driver object
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier>
- m_xCatalog; // needed for the SQL interpreter
-
- public:
- virtual void construct( const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException);
-
- MacabConnection(MacabDriver* _pDriver);
- virtual ~MacabConnection();
-
- void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException);
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
-
- // XInterface
- virtual void SAL_CALL release() throw();
-
- // XServiceInfo
- DECLARE_SERVICE_INFO();
-
- // XConnection
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XWarningsSupplier
- virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // needed for the SQL interpreter
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL createCatalog();
-
- // accessors
- inline MacabDriver* getDriver() const { return m_pDriver;}
- MacabAddressBook* getAddressBook() const;
- };
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_CONNECTION_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx b/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx
deleted file mode 100644
index 7a8687eb13..0000000000
--- a/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx
+++ /dev/null
@@ -1,1127 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabDatabaseMetaData.hxx"
-#include "MacabAddressBook.hxx"
-#include "MacabHeader.hxx"
-#include "MacabGroup.hxx"
-#include "macabutilities.hxx"
-
-#include "MacabDriver.hxx"
-#include "FDatabaseMetaDataResultSet.hxx"
-#include "OTypeInfo.hxx"
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/TransactionIsolation.hpp>
-
-#include <vector>
-
-using namespace connectivity::macab;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-
-MacabDatabaseMetaData::MacabDatabaseMetaData(MacabConnection* _pCon)
- : m_xConnection(_pCon),
- m_bUseCatalog(sal_True)
-{
- OSL_ENSURE(_pCon,"MacabDatabaseMetaData::MacabDatabaseMetaData: No connection set!");
-
- osl_incrementInterlockedCount( &m_refCount );
- m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable());
- osl_decrementInterlockedCount( &m_refCount );
-}
-// -------------------------------------------------------------------------
-MacabDatabaseMetaData::~MacabDatabaseMetaData()
-{
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aVal;
- if (m_bUseCatalog)
- { // do some special here for you database
- }
-
- return aVal;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException)
-{
- // MaxTablesInSelect describes how many tables can participate in the FROM part of a given SELECT statement,
- // currently, the resultset/statement implementations can cope with one table only
- sal_Int32 nValue = 1;
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aVal;
- if (m_bUseCatalog)
- {
- }
- return aVal;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException)
-{
- // normally this is "
- ::rtl::OUString aVal(RTL_CONSTASCII_USTRINGPARAM("\""));
- return aVal;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aVal;
- return aVal;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException)
-{
- sal_Bool bValue = sal_False;
- if (m_bUseCatalog)
- {
- }
- return bValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException)
-{
- return sal_True; // should be supported at least
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- // for the moment, we have read-only addresses, but this might change in the future
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsConvert( sal_Int32, sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
-{
- // if someday we support more than the default address book,
- // this method should return the URL which was used to create it
- ::rtl::OUString aValue( RTL_CONSTASCII_USTRINGPARAM( "sdbc:address:macab:" ));
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue( RTL_CONSTASCII_USTRINGPARAM( "macab" ));
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue(RTL_CONSTASCII_USTRINGPARAM(MACAB_DRIVER_VERSION));
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
-{
- return MACAB_DRIVER_VERSION_MAJOR;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- return TransactionIsolation::NONE;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
-{
- return MACAB_DRIVER_VERSION_MINOR;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- switch (setType)
- {
- case ResultSetType::FORWARD_ONLY:
- case ResultSetType::SCROLL_INSENSITIVE:
- return sal_True;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 ) throw(SQLException, RuntimeException)
-{
- switch (setType)
- {
- case ResultSetType::FORWARD_ONLY:
- case ResultSetType::SCROLL_INSENSITIVE:
- return sal_True;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::ownUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::ownDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::ownInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::othersUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::othersDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::othersInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::updatesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::deletesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::insertsAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL MacabDatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException)
-{
- return (Reference< XConnection >) m_xConnection.get();
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
-{
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes);
- Reference< XResultSet > xRef = pResult;
-
- static ODatabaseMetaDataResultSet::ORows aRows;
- static const ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
-
- if (aRows.empty())
- {
- ODatabaseMetaDataResultSet::ORow aRow(2);
- aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[1] = new ORowSetValueDecorator(aTable);
- aRows.push_back(aRow);
- }
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException)
-{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo);
- Reference< XResultSet > xRef = pResult;
-
- static ODatabaseMetaDataResultSet::ORows aRows;
- if (aRows.empty())
- {
- ODatabaseMetaDataResultSet::ORow aRow(19);
-
- // We support four types: char, timestamp, integer, float
- aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR")));
- aRow[2] = new ORowSetValueDecorator(DataType::CHAR);
- aRow[3] = new ORowSetValueDecorator((sal_Int32) 254);
- aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[7] = new ORowSetValueDecorator((sal_Int32) ColumnValue::NULLABLE);
- aRow[8] = ODatabaseMetaDataResultSet::get1Value();
- aRow[9] = new ORowSetValueDecorator((sal_Int32) ColumnSearch::CHAR);
- aRow[10] = ODatabaseMetaDataResultSet::get1Value();
- aRow[11] = ODatabaseMetaDataResultSet::get0Value();
- aRow[12] = ODatabaseMetaDataResultSet::get0Value();
- aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[14] = ODatabaseMetaDataResultSet::get0Value();
- aRow[15] = ODatabaseMetaDataResultSet::get0Value();
- aRow[16] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[17] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[18] = new ORowSetValueDecorator((sal_Int32) 10);
-
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")));
- aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)19);
- aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INTEGER")));
- aRow[2] = new ORowSetValueDecorator(DataType::INTEGER);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
- aRow[15] = new ORowSetValueDecorator((sal_Int32)20);
- aRows.push_back(aRow);
-
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FLOAT")));
- aRow[2] = new ORowSetValueDecorator(DataType::FLOAT);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
- aRow[15] = new ORowSetValueDecorator((sal_Int32)15);
- aRows.push_back(aRow);
- }
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCatalogs );
-}
-// -----------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eSchemas );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getColumnPrivileges(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString&,
- const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumnPrivileges );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getColumns(
- const Any&,
- const ::rtl::OUString&,
- const ::rtl::OUString& tableNamePattern,
- const ::rtl::OUString& columnNamePattern) throw(SQLException, RuntimeException)
-{
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
- Reference< XResultSet > xRef = pResult;
- MacabRecords *aRecords;
- ::rtl::OUString sTableName;
-
- aRecords = m_xConnection->getAddressBook()->getMacabRecordsMatch(tableNamePattern);
-
- ODatabaseMetaDataResultSet::ORows aRows;
- if(aRecords != NULL)
- {
- MacabHeader *aHeader = aRecords->getHeader();
- sTableName = aRecords->getName();
-
- ODatabaseMetaDataResultSet::ORow aRow(19);
-
- aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[3] = new ORowSetValueDecorator(sTableName);
- aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[9] = ODatabaseMetaDataResultSet::get0Value();
- aRow[10] = new ORowSetValueDecorator((sal_Int32) 10);
- aRow[11] = ODatabaseMetaDataResultSet::get1Value();
- aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[16] = new ORowSetValueDecorator((sal_Int32) 254);
- aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES")));
-
- sal_Int32 nPosition = 1;
- ::rtl::OUString sName;
-
- MacabHeader::iterator aField;
-
- for ( aField = aHeader->begin();
- aField != aHeader->end();
- ++aField, ++nPosition)
- {
-
- sName = CFStringToOUString((CFStringRef) (*aField)->value);
- if (match(columnNamePattern, sName, '\0'))
- {
- aRow[4] = new ORowSetValueDecorator(sName);
- aRow[17] = new ORowSetValueDecorator(nPosition);
- switch((*aField)->type)
- {
- case kABStringProperty:
- aRow[5] = new ORowSetValueDecorator(DataType::CHAR);
- aRow[6] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR")));
- aRow[7] = new ORowSetValueDecorator((sal_Int32) 256);
- aRows.push_back(aRow);
- break;
- case kABDateProperty:
- aRow[5] = new ORowSetValueDecorator(DataType::TIMESTAMP);
- aRow[6] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")));
- aRows.push_back(aRow);
- break;
- case kABIntegerProperty:
- aRow[5] = new ORowSetValueDecorator(DataType::INTEGER);
- aRow[6] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INTEGER")));
- aRow[7] = new ORowSetValueDecorator((sal_Int32) 20);
- aRows.push_back(aRow);
- break;
- case kABRealProperty:
- aRow[5] = new ORowSetValueDecorator(DataType::FLOAT);
- aRow[6] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FLOAT")));
- aRow[7] = new ORowSetValueDecorator((sal_Int32) 15);
- aRows.push_back(aRow);
- break;
- default:
- ;
- // shouldn't happen -- throw an error...?
- }
- }
- }
- }
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTables(
- const Any&,
- const ::rtl::OUString&,
- const ::rtl::OUString&,
- const Sequence< ::rtl::OUString >& types) throw(SQLException, RuntimeException)
-{
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
- Reference< XResultSet > xRef = pResult;
-
- // 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 const ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
- sal_Bool bTableFound = sal_False;
- const ::rtl::OUString* p = types.getConstArray(),
- * pEnd = p + types.getLength();
-
- if (p == pEnd)
- {
- bTableFound = sal_True;
- }
- else while (p < pEnd)
- {
- if (match(*p, aTable, '\0'))
- {
- bTableFound = sal_True;
- break;
- }
- p++;
- }
- if (!bTableFound)
- return xRef;
-
- static ODatabaseMetaDataResultSet::ORows aRows;
-
- if (aRows.empty())
- {
- ODatabaseMetaDataResultSet::ORow aRow(6);
-
- MacabRecords *xRecords = m_xConnection->getAddressBook()->getMacabRecords();
- ::std::vector<MacabGroup *> xGroups = m_xConnection->getAddressBook()->getMacabGroups();
- sal_Int32 i, nGroups;
- nGroups = xGroups.size();
-
- aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[3] = new ORowSetValueDecorator(xRecords->getName());
- aRow[4] = new ORowSetValueDecorator(aTable);
- aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRows.push_back(aRow);
-
- for(i = 0; i < nGroups; i++)
- {
- aRow[3] = new ORowSetValueDecorator(xGroups[i]->getName());
- aRows.push_back(aRow);
- }
- }
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getProcedureColumns(
- const Any&, const ::rtl::OUString&,
- const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedureColumns );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getProcedures(
- const Any&, const ::rtl::OUString&,
- const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedures );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getVersionColumns(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eVersionColumns );
-
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
- Reference< XResultSet > xRef = pResult;
-
- ODatabaseMetaDataResultSet::ORows aRows;
-
- if (m_xConnection->getAddressBook()->getMacabRecords(table) != NULL)
- {
- ODatabaseMetaDataResultSet::ORow aRow( 9 );
-
- ::rtl::OUString sName = CFStringToOUString(kABModificationDateProperty);
-
- aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[2] = new ORowSetValueDecorator(sName);
- aRow[3] = new ORowSetValueDecorator(DataType::TIMESTAMP);
- aRow[4] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")));
-
- aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[7] = ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
-
- aRows.push_back(aRow);
- }
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getExportedKeys(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eExportedKeys );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getImportedKeys(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eImportedKeys );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getPrimaryKeys(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::ePrimaryKeys );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getIndexInfo(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString&,
- sal_Bool, sal_Bool ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eIndexInfo );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getBestRowIdentifier(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString&, sal_Int32,
- sal_Bool ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eBestRowIdentifier );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTablePrivileges(
- const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getCrossReference(
- const Any&, const ::rtl::OUString&,
- const ::rtl::OUString&, const Any&,
- const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCrossReference );
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getUDTs( const Any&, const ::rtl::OUString&, const ::rtl::OUString&, const Sequence< sal_Int32 >& ) throw(SQLException, RuntimeException)
-{
- OSL_FAIL("Not implemented yet!");
- throw SQLException();
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabDatabaseMetaData.hxx b/connectivity/source/drivers/macab/MacabDatabaseMetaData.hxx
deleted file mode 100644
index 852cd32c7d..0000000000
--- a/connectivity/source/drivers/macab/MacabDatabaseMetaData.hxx
+++ /dev/null
@@ -1,215 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_DATABASEMETADATA_HXX_
-#define _CONNECTIVITY_MACAB_DATABASEMETADATA_HXX_
-
-#include "MacabConnection.hxx"
-#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-#include <cppuhelper/implbase1.hxx>
-
-namespace connectivity
-{
- namespace macab
- {
- //**************************************************************
- //************ Class: MacabDatabaseMetaData
- //**************************************************************
-
- typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XDatabaseMetaData> MacabDatabaseMetaData_BASE;
-
- class MacabDatabaseMetaData : public MacabDatabaseMetaData_BASE
- {
- ::com::sun::star::uno::Reference< MacabConnection > m_xConnection;
- sal_Bool m_bUseCatalog;
-
- public:
-
- inline MacabConnection* getOwnConnection() const { return m_xConnection.get(); }
-
- MacabDatabaseMetaData(MacabConnection* _pCon);
- virtual ~MacabDatabaseMetaData();
-
- // this interface is really BIG
- // XDatabaseMetaData
- virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getUserName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDriverName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL usesLocalFiles( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getIdentifierQuoteString( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isCatalogAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalogSeparator( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsUnion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsUnionAll( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxConnections( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxStatements( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getSchemas( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCatalogs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getVersionColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog, const ::rtl::OUString& primarySchema, const ::rtl::OUString& primaryTable, const ::com::sun::star::uno::Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTypeInfo( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_DATABASEMETADATA_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabDriver.cxx b/connectivity/source/drivers/macab/MacabDriver.cxx
deleted file mode 100644
index 3751b24ddc..0000000000
--- a/connectivity/source/drivers/macab/MacabDriver.cxx
+++ /dev/null
@@ -1,350 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabDriver.hxx"
-#include "MacabConnection.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/sdb/SQLContext.hpp>
-#include <com/sun/star/lang/NullPointerException.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
-/** === end UNO includes === **/
-#include <rtl/ustrbuf.hxx>
-#include <tools/diagnose_ex.h>
-#include "resource/macab_res.hrc"
-
-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::sdb;
-using namespace com::sun::star::frame;
-using namespace connectivity::macab;
-
-// =======================================================================
-// = MacabImplModule
-// =======================================================================
-// --------------------------------------------------------------------------------
-MacabImplModule::MacabImplModule( const Reference< XMultiServiceFactory >& _rxFactory )
- :m_xORB(_rxFactory)
- ,m_bAttemptedLoadModule(false)
- ,m_hConnectorModule(NULL)
- ,m_pConnectionFactoryFunc(NULL)
-{
- if ( !m_xORB.is() )
- throw NullPointerException();
-}
-
-// --------------------------------------------------------------------------------
-bool MacabImplModule::isMacOSPresent()
-{
- return impl_loadModule();
-}
-
-// --------------------------------------------------------------------------------
-namespace
-{
- template< typename FUNCTION >
- void lcl_getFunctionFromModuleOrUnload( oslModule& _rModule, const sal_Char* _pAsciiSymbolName, FUNCTION& _rFunction )
- {
- _rFunction = NULL;
- if ( _rModule )
- {
- //
- const ::rtl::OUString sSymbolName = ::rtl::OUString::createFromAscii( _pAsciiSymbolName );
- _rFunction = (FUNCTION)( osl_getSymbol( _rModule, sSymbolName.pData ) );
-
- if ( !_rFunction )
- { // did not find the symbol
- OSL_FAIL( ::rtl::OString( "lcl_getFunctionFromModuleOrUnload: could not find the symbol " ) + ::rtl::OString( _pAsciiSymbolName ) );
- osl_unloadModule( _rModule );
- _rModule = NULL;
- }
- }
- }
-}
-
-// --------------------------------------------------------------------------------
-extern "C" { static void SAL_CALL thisModule() {} }
-
-bool MacabImplModule::impl_loadModule()
-{
- if ( m_bAttemptedLoadModule )
- return ( m_hConnectorModule != NULL );
- m_bAttemptedLoadModule = true;
-
- OSL_ENSURE( !m_hConnectorModule && !m_pConnectionFactoryFunc,
- "MacabImplModule::impl_loadModule: inconsistence: inconsistency (never attempted load before, but some values already set)!");
-
- const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM( SAL_MODULENAME( "macabdrv1" )) );
- 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 )
- return false;
-
- lcl_getFunctionFromModuleOrUnload( m_hConnectorModule, "createMacabConnection", m_pConnectionFactoryFunc );
-
- if ( !m_hConnectorModule )
- // one of the symbols did not exist
- throw RuntimeException();
-
- return true;
-}
-
-// --------------------------------------------------------------------------------
-void MacabImplModule::impl_unloadModule()
-{
- OSL_PRECOND( m_hConnectorModule != NULL, "MacabImplModule::impl_unloadModule: no module!" );
-
- osl_unloadModule( m_hConnectorModule );
- m_hConnectorModule = NULL;
-
- m_pConnectionFactoryFunc = NULL;
-
- m_bAttemptedLoadModule = false;
-}
-
-// --------------------------------------------------------------------------------
-void MacabImplModule::init()
-{
- if ( !impl_loadModule() )
- impl_throwNoMacOSException();
-
-}
-
-// --------------------------------------------------------------------------------
-void MacabImplModule::impl_throwNoMacOSException()
-{
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(
- STR_NO_MAC_OS_FOUND
- ) );
- impl_throwGenericSQLException( sError );
-}
-
-// --------------------------------------------------------------------------------
-void MacabImplModule::impl_throwGenericSQLException( const ::rtl::OUString& _rMessage )
-{
- SQLException aError;
- aError.Message = _rMessage;
- aError.SQLState = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "S1000" ) );
- aError.ErrorCode = 0;
- throw aError;
-}
-
-// --------------------------------------------------------------------------------
-MacabConnection* MacabImplModule::createConnection( MacabDriver* _pDriver ) const
-{
- OSL_PRECOND( m_hConnectorModule, "MacabImplModule::createConnection: not initialized!" );
-
- void* pUntypedConnection = (*m_pConnectionFactoryFunc)( _pDriver );
- if ( !pUntypedConnection )
- throw RuntimeException();
-
- return static_cast< MacabConnection* >( pUntypedConnection );
-}
-
-// --------------------------------------------------------------------------------
-void MacabImplModule::shutdown()
-{
- if ( !m_hConnectorModule )
- return;
-
- impl_unloadModule();
-}
-
-// =======================================================================
-// = MacabDriver
-// =======================================================================
-MacabDriver::MacabDriver(
- const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory)
- : MacabDriver_BASE(m_aMutex),
- m_xMSFactory(_rxFactory),
- m_aImplModule(_rxFactory)
-{
- if ( !m_xMSFactory.is() )
- throw NullPointerException();
-
- osl_incrementInterlockedCount( &m_refCount );
- try
- {
- Reference< XDesktop > xDesktop(
- m_xMSFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ),
- UNO_QUERY_THROW );
- xDesktop->addTerminateListener( this );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- osl_decrementInterlockedCount( &m_refCount );
-}
-// --------------------------------------------------------------------------------
-void MacabDriver::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- // when driver will be destroied so all our connections have to be destroied as well
- for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
- {
- Reference< XComponent > xComp(i->get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- }
- m_xConnections.clear();
-
- WeakComponentImplHelperBase::disposing();
-}
-// static ServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString MacabDriver::getImplementationName_Static( ) throw(RuntimeException)
-{
- return rtl::OUString::createFromAscii( impl_getAsciiImplementationName() );
-}
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > MacabDriver::getSupportedServiceNames_Static( ) throw (RuntimeException)
-{
- // which service is supported
- // for more information @see com.sun.star.sdbc.Driver
- Sequence< ::rtl::OUString > aSNS( 1 );
- aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver"));
-
- return aSNS;
-}
-//------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabDriver::getImplementationName( ) throw(RuntimeException)
-{
- return getImplementationName_Static();
-}
-//------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
-
- while (pSupported != pEnd && !pSupported->equals(_rServiceName))
- ++pSupported;
- return pSupported != pEnd;
-}
-//------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL MacabDriver::getSupportedServiceNames( ) throw(RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-// --------------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL MacabDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_aImplModule.init();
-
- // create a new connection with the given properties and append it to our vector
- MacabConnection* pConnection = m_aImplModule.createConnection( this );
- OSL_POSTCOND( pConnection, "MacabDriver::connect: no connection has been created by the factory!" );
-
- // by definition, the factory function returned an object which was acquired once
- Reference< XConnection > xConnection = pConnection;
- pConnection->release();
-
- // late constructor call which can throw exception and allows a correct dtor call when so
- pConnection->construct( url, info );
-
- // remember it
- m_xConnections.push_back( WeakReferenceHelper( *pConnection ) );
-
- return xConnection;
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabDriver::acceptsURL( const ::rtl::OUString& url )
- throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- if ( !m_aImplModule.isMacOSPresent() )
- return sal_False;
-
- // here we have to look whether we support this URL format
- return (!url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:macab:")), 18));
-}
-// --------------------------------------------------------------------------------
-Sequence< DriverPropertyInfo > SAL_CALL MacabDriver::getPropertyInfo( const ::rtl::OUString&, const Sequence< PropertyValue >& ) throw(SQLException, RuntimeException)
-{
- // if you have something special to say, return it here :-)
- return Sequence< DriverPropertyInfo >();
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDriver::getMajorVersion( ) throw(RuntimeException)
-{
- return MACAB_DRIVER_VERSION_MAJOR;
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabDriver::getMinorVersion( ) throw(RuntimeException)
-{
- return MACAB_DRIVER_VERSION_MINOR;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL MacabDriver::queryTermination( const EventObject& ) throw (TerminationVetoException, RuntimeException)
-{
- // nothing to do, nothing to veto
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL MacabDriver::notifyTermination( const EventObject& ) throw (RuntimeException)
-{
- m_aImplModule.shutdown();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL MacabDriver::disposing( const EventObject& ) throw (RuntimeException)
-{
- // not interested in (this is the disposing of the desktop, if any)
-}
-// --------------------------------------------------------------------------------
-const sal_Char* MacabDriver::impl_getAsciiImplementationName()
-{
- return "com.sun.star.comp.sdbc.macab.Driver";
- // this name is referenced in the configuration and in the macab.xml
- // Please be careful when changing it.
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString MacabDriver::impl_getConfigurationSettingsPath()
-{
- ::rtl::OUStringBuffer aPath;
- aPath.appendAscii( "/org.openoffice.Office.DataAccess/DriverSettings/" );
- aPath.appendAscii( "com.sun.star.comp.sdbc.macab.Driver" );
- return aPath.makeStringAndClear();
-}
-// --------------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL MacabDriver::Create( const Reference< XMultiServiceFactory >& _rxFactory ) throw( Exception )
-{
- return *(new MacabDriver(_rxFactory));
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabDriver.hxx b/connectivity/source/drivers/macab/MacabDriver.hxx
deleted file mode 100644
index c21715ec09..0000000000
--- a/connectivity/source/drivers/macab/MacabDriver.hxx
+++ /dev/null
@@ -1,199 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_DRIVER_HXX_
-#define _CONNECTIVITY_MACAB_DRIVER_HXX_
-
-/** === begin UNO includes === **/
-#include <com/sun/star/sdbc/XDriver.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/frame/XTerminateListener.hpp>
-/** === end UNO includes === **/
-#include <cppuhelper/compbase3.hxx>
-#include <osl/module.h>
-
-// the address book driver's version
-#define MACAB_DRIVER_VERSION "0.1"
-#define MACAB_DRIVER_VERSION_MAJOR 0
-#define MACAB_DRIVER_VERSION_MINOR 1
-
-namespace connectivity
-{
- namespace macab
- {
- class MacabConnection;
- class MacabDriver;
-
- typedef void* (SAL_CALL * ConnectionFactoryFunction)( void* _pDriver );
-
- typedef std::vector< ::com::sun::star::uno::WeakReferenceHelper > OWeakRefArray;
-
- // ===============================================================
- // = MacabImplModule
- // ===============================================================
- class MacabImplModule
- {
- private:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- m_xORB;
-
- /// Did we already attempt to load the module and to retrieve the symbols?
- bool m_bAttemptedLoadModule;
- oslModule m_hConnectorModule;
- ConnectionFactoryFunction m_pConnectionFactoryFunc;
-
- public:
- MacabImplModule( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory );
-
- /** determines whether there is a mac OS present in the environment
- */
- bool isMacOSPresent();
-
- /** initializes the implementation module.
-
- @raises ::com::sun::star::uno::RuntimeException
- if the module could be loaded, but required symbols are missing
- @raises ::com::sun::star::sdbc::SQLException
- if no Mac OS was found at all
- */
- void init();
-
- /** shuts down the impl module
- */
- void shutdown();
-
- /** creates a new connection
- @precond
- <member>init</member> has been called before
- @raises ::com::sun::star::uno::RuntimeException
- if no connection object could be created (which is a severe error, normally impossible)
- */
- MacabConnection* createConnection( MacabDriver* _pDriver ) const;
-
- private:
- /** loads the implementation module and retrieves the needed symbols
-
- Save against being called multiple times.
-
- @return <TRUE/> if the module could be loaded successfully.
-
- @raises ::com::sun::star::uno::RuntimeException
- if the module could be loaded, but required symbols are missing
- */
- bool impl_loadModule();
-
- /** unloads the implementation module, and resets all function pointers to <NULL/>
- @precond m_hConnectorModule is not <NULL/>
- */
- void impl_unloadModule();
-
- /** throws an SQLException saying than no Mac OS installation was found
- */
- void impl_throwNoMacOSException();
-
- /** throws a generic SQL exception with SQLState S1000 and error code 0
- */
- void impl_throwGenericSQLException( const ::rtl::OUString& _rMessage );
-
- };
-
- // ===============================================================
- // = MacabDriver
- // ===============================================================
- typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XDriver,
- ::com::sun::star::lang::XServiceInfo,
- ::com::sun::star::frame::XTerminateListener > MacabDriver_BASE;
- class MacabDriver : public MacabDriver_BASE
- {
- protected:
- ::osl::Mutex m_aMutex; // mutex is need to control member access
- OWeakRefArray m_xConnections; // vector containing a list of all the
- // MacabConnection objects for this Driver
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- m_xMSFactory; // the multi-service factory
- MacabImplModule m_aImplModule;
-
- public:
- static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception );
-
- // XServiceInfo - static versions
- static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException);
-
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
- getMSFactory() const { return m_xMSFactory; }
-
- /** returns the driver's implementation name (being pure ASCII) for reference in various places
- */
- static const sal_Char* impl_getAsciiImplementationName();
-
- /** returns the path of our configuration settings
- */
- static ::rtl::OUString impl_getConfigurationSettingsPath();
-
- protected:
- MacabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XDriver
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMajorVersion() throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMinorVersion() throw(::com::sun::star::uno::RuntimeException);
-
- // XTerminateListener
- virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
-
- // XEventListener
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
-
- private:
- /** shuts down the library which contains the real implementations
-
- This method is safe against being called multiple times
-
- @precond our mutex is locked
- */
- void impl_shutdownImplementationModule();
- };
- }
-
-}
-
-#endif // _CONNECTIVITY_MACAB_DRIVER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabGroup.cxx b/connectivity/source/drivers/macab/MacabGroup.cxx
deleted file mode 100644
index 6f0dabf45b..0000000000
--- a/connectivity/source/drivers/macab/MacabGroup.cxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabGroup.hxx"
-#include "MacabRecords.hxx"
-#include "macabutilities.hxx"
-
-using namespace connectivity::macab;
-
-// -------------------------------------------------------------------------
-/* A MacabGroup is basically a MacabRecords with a different constructor.
- * It only exists as a different entity for clarification purposes (a group
- * is its own entity in the Mac OS X Address Book) and because its
- * construction is so unique (it is based on an already existent
- * MacabRecords of the entire address book).
- */
-MacabGroup::MacabGroup(const ABAddressBookRef _addressBook, const MacabRecords *_allRecords, const ABGroupRef _xGroup)
- : MacabRecords(_addressBook)
-{
- sal_Int32 i, j, nAllRecordsSize;
- CFArrayRef xGroupMembers = ABGroupCopyArrayOfAllMembers(_xGroup);
- ABPersonRef xPerson;
- CFStringRef sGroupMemberUID;
- sal_Bool bFound;
- macabfield *xRecordField;
-
- // Set the group's name (stored in MacabRecords as m_sName)
- CFStringRef sGroupName;
- sGroupName = (CFStringRef) ABRecordCopyValue(_xGroup, kABGroupNameProperty);
- m_sName = CFStringToOUString(sGroupName);
- CFRelease(sGroupName);
-
- // The _group's_ records (remember MacabGroup inherits from MacabRecords)
- recordsSize = (sal_Int32) CFArrayGetCount(xGroupMembers);
- records = new MacabRecord *[recordsSize];
- setHeader(_allRecords->getHeader());
-
- /* Go through each record in the group and try to find that record's UID
- * in the MacabRecords that was passed in. If it is found, add that
- * record to the group. Otherwise, report an error. (All records should
- * exist in the MacabRecords that was passed in.)
- */
- nAllRecordsSize = _allRecords->size();
- for(i = 0; i < recordsSize; i++)
- {
- xPerson = (ABPersonRef) CFArrayGetValueAtIndex(xGroupMembers,i);
- if(xPerson != NULL)
- {
- sGroupMemberUID = (CFStringRef) ABRecordCopyValue(xPerson, kABUIDProperty);
- if(sGroupMemberUID != NULL)
- {
- bFound = sal_False;
- for(j = 0; j < nAllRecordsSize; j++)
- {
- xRecordField = _allRecords->getField(j,CFStringToOUString(kABUIDProperty));
- if(xRecordField != NULL && xRecordField->value != NULL)
- {
- if(CFEqual(xRecordField->value, sGroupMemberUID))
- {
- /* Found the matching UID! Insert into the group... */
- insertRecord(_allRecords->getRecord(j));
- bFound = sal_True;
- break;
- }
- }
- }
- OSL_ENSURE(bFound, "MacabGroup::MacabGroup : Could not find group member based on UID!\n");
- CFRelease(sGroupMemberUID);
- }
- }
- }
-
- CFRelease(xGroupMembers);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabGroup.hxx b/connectivity/source/drivers/macab/MacabGroup.hxx
deleted file mode 100644
index 1f09ac0d09..0000000000
--- a/connectivity/source/drivers/macab/MacabGroup.hxx
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_GROUP_HXX_
-#define _CONNECTIVITY_MACAB_GROUP_HXX_
-
-#include "MacabRecords.hxx"
-
-#include <premac.h>
-#include <Carbon/Carbon.h>
-#include <AddressBook/ABAddressBookC.h>
-#include <postmac.h>
-
-
-namespace connectivity
-{
- namespace macab
- {
- class MacabGroup: public MacabRecords {
- public:
- MacabGroup(const ABAddressBookRef _addressBook, const MacabRecords *_allRecords, const ABGroupRef _xGroup);
- };
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_GROUP_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabHeader.cxx b/connectivity/source/drivers/macab/MacabHeader.cxx
deleted file mode 100644
index 39fb28c62c..0000000000
--- a/connectivity/source/drivers/macab/MacabHeader.cxx
+++ /dev/null
@@ -1,346 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabHeader.hxx"
-#include "MacabRecord.hxx"
-#include "macabutilities.hxx"
-
-#include <math.h>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <connectivity/dbconversion.hxx>
-
-using namespace connectivity::macab;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::util;
-using namespace ::dbtools;
-
-// -------------------------------------------------------------------------
-MacabHeader::MacabHeader(const sal_Int32 _size, macabfield **_fields)
-{
- sal_Int32 i;
- size = _size;
- fields = new macabfield *[size];
- for(i = 0; i < size; i++)
- {
- if(_fields[i] == NULL)
- {
- fields[i] = NULL;
- }
- else
- {
- /* The constructor duplicates the macabfields it gets because they
- * are either deleted later or used for other purposes.
- */
- fields[i] = new macabfield;
- fields[i]->type = _fields[i]->type;
- fields[i]->value = _fields[i]->value;
- if (fields[i]->value)
- CFRetain(fields[i]->value);
- }
- }
-
-}
-
-// -------------------------------------------------------------------------
-MacabHeader::MacabHeader()
-{
- size = 0;
- fields = NULL;
-}
-
-// -------------------------------------------------------------------------
-MacabHeader::~MacabHeader()
-{
-}
-
-// -------------------------------------------------------------------------
-void MacabHeader::operator+= (const MacabHeader *r)
-{
- /* Add one MacabHeader to another. Anything not already in the header is
- * added to the end of it.
- */
- sal_Int32 rSize = r->getSize();
- if(rSize != 0) // If the new header does actually have fields
- {
- /* If our header is currently empty, just copy all of the fields from
- * the new header to this one.
- */
- if(size == 0)
- {
- sal_Int32 i;
- size = rSize;
- fields = new macabfield *[size];
- for(i = 0; i < size; i++)
- {
- fields[i] = r->copy(i);
- }
- }
-
- /* Otherwise, only add the duplicates. We do this with a two-pass
- * approach. First, find out how many fields to add, then reallocate
- * the size of the fields array and add the old ones at the end.
- * (More precisely, we create a _new_ fields array with the new length
- * allocated to it, then get all of the fields from the current
- * fields array to it, then copy the non-duplicates from the new
- * header to the end.)
- */
- else
- {
- sal_Int32 i;
- sal_Int32 numToAdd = 0, numAdded = 0;
- macabfield **newFields;
- for( i = 0; i < rSize; i++)
- {
- if(!contains(r->get(i)))
- {
- numToAdd++;
- }
- }
-
- newFields = new macabfield *[size+numToAdd];
- for(i = 0; i < size; i++)
- {
- newFields[i] = copy(i);
- }
-
- for( i = 0; i < rSize; i++)
- {
- if(!contains(r->get(i)))
- {
- newFields[size+numAdded] = r->copy(i);
- numAdded++;
- if(numAdded == numToAdd)
- break;
- }
- }
-
- releaseFields();
- delete [] fields;
- size += numAdded;
- fields = newFields;
- }
- }
-}
-
-// -------------------------------------------------------------------------
-::rtl::OUString MacabHeader::getString(const sal_Int32 i) const
-{
- ::rtl::OUString nRet;
-
- if(i < size)
- {
- if(fields[i] == NULL || fields[i]->value == NULL || CFGetTypeID(fields[i]->value) != CFStringGetTypeID())
- return ::rtl::OUString();
- try
- {
- nRet = CFStringToOUString( (CFStringRef) fields[i]->value);
- }
- catch(...){ }
- }
-
- return nRet;
-}
-
-// -------------------------------------------------------------------------
-void MacabHeader::sortRecord()
-{
- sortRecord(0,size);
-}
-
-// -------------------------------------------------------------------------
-macabfield **MacabHeader::sortRecord(const sal_Int32 _start, const sal_Int32 _length)
-{
- /* Sort using mergesort. Because it uses mergesort, it is recursive and
- * not in place (so it creates a new array at every step of the
- * recursion), so if you prefer to use a different sort, please feel
- * free to implement it.
- */
- macabfield** sorted = new macabfield *[_length];
- if(_length <= 2)
- {
- if(_length == 2)
- {
- if(compareFields(fields[_start], fields[_start+1]) > 0)
- {
- sorted[0] = get(_start+1);
- sorted[1] = get(_start);
- }
- else
- {
- sorted[0] = get(_start);
- sorted[1] = get(_start+1);
- }
- }
- else if(_length == 1)
- {
- sorted[0] = get(_start);
- }
- }
- else
- {
- sal_Int32 halfLength = floor(_length/2);
- sal_Int32 fp = 0, lp = 0;
- sal_Int32 i;
- macabfield **firstHalf = new macabfield *[halfLength];
- macabfield **lastHalf = new macabfield *[_length - halfLength];
-
- firstHalf = sortRecord(_start, halfLength);
- lastHalf = sortRecord(_start+halfLength, _length-halfLength);
- for(i = 0; i < _length; i++)
- {
- if(compareFields(firstHalf[fp],lastHalf[lp]) < 0)
- {
- sorted[i] = firstHalf[fp++];
- if(fp == halfLength)
- {
- for( i++; i < _length; i++)
- {
- sorted[i] = lastHalf[lp++];
- }
- break;
- }
- }
- else
- {
- sorted[i] = lastHalf[lp++];
- if(lp == _length - halfLength)
- {
- for( i++; i < _length; i++)
- {
- sorted[i] = firstHalf[fp++];
- }
- break;
- }
- }
- }
- if(_length == size)
- {
- fields = sorted;
- }
- }
- return sorted;
-}
-
-sal_Int32 MacabHeader::compareFields(const macabfield *_field1, const macabfield *_field2)
-{
- /* Comparing two fields in a MacabHeader is different than comparing two
- * fields in a MacabRecord. It starts in the same way (if one of the two
- * fields is NULL, it belongs after the other, so it is considered
- * "greater"). But, then, all headers are CFStrings, no matter what
- * type they claim to be (since they actually hold the expected type for
- * the records with that header). That being said, all we have to do is
- * the built-in CFStringCompare.
- */
- if(_field1 == _field2)
- return 0;
- if(_field1 == NULL)
- return 1;
- if(_field2 == NULL)
- return -1;
-
- CFComparisonResult result = CFStringCompare(
- (CFStringRef) _field1->value,
- (CFStringRef) _field2->value,
- 0); // 0 = no options (like ignore case)
-
- return (sal_Int32) result;
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 MacabHeader::getColumnNumber(const ::rtl::OUString s) const
-{
- sal_Int32 i;
- for(i = 0; i < size; i++)
- {
- if(getString(i) == s)
- break;
- }
-
- if(i == size)
- i = -1;
-
- return i;
-}
-
-// -------------------------------------------------------------------------
-MacabHeader *MacabHeader::begin()
-{
- return this;
-}
-
-// -------------------------------------------------------------------------
-MacabHeader::iterator::iterator ()
-{
-}
-
-// -------------------------------------------------------------------------
-MacabHeader::iterator::~iterator ()
-{
-}
-
-MacabHeader::iterator& MacabHeader::iterator::operator= (MacabHeader *_record)
-{
- id = 0;
- record = _record;
- return *this;
-}
-
-// -------------------------------------------------------------------------
-void MacabHeader::iterator::operator++ ()
-{
- id++;
-}
-
-// -------------------------------------------------------------------------
-sal_Bool MacabHeader::iterator::operator!= (const sal_Int32 i) const
-{
- return(id != i);
-}
-
-// -------------------------------------------------------------------------
-sal_Bool MacabHeader::iterator::operator== (const sal_Int32 i) const
-{
- return(id == i);
-}
-
-// -------------------------------------------------------------------------
-macabfield *MacabHeader::iterator::operator* () const
-{
- return record->get(id);
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 MacabHeader::end() const
-{
- return size;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabHeader.hxx b/connectivity/source/drivers/macab/MacabHeader.hxx
deleted file mode 100644
index f24b593a9b..0000000000
--- a/connectivity/source/drivers/macab/MacabHeader.hxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_HEADER_HXX_
-#define _CONNECTIVITY_MACAB_HEADER_HXX_
-
-#include "MacabRecord.hxx"
-#include <cppuhelper/compbase3.hxx>
-
-namespace connectivity
-{
- namespace macab
- {
- class MacabHeader: public MacabRecord{
- protected:
- macabfield **sortRecord(sal_Int32 _start, sal_Int32 _length);
- public:
- MacabHeader();
- MacabHeader(const sal_Int32 _size, macabfield **_fields);
- virtual ~MacabHeader();
- void operator+= (const MacabHeader *r);
- ::rtl::OUString getString(const sal_Int32 i) const;
- void sortRecord();
- sal_Int32 getColumnNumber(const ::rtl::OUString s) const;
-
- static sal_Int32 compareFields(const macabfield *_field1, const macabfield *_field2);
-
- MacabHeader *begin();
- sal_Int32 end() const;
- class iterator{
- protected:
- sal_Int32 id;
- MacabHeader *record;
- public:
- iterator& operator= (MacabHeader *_record);
- iterator();
- ~iterator();
- void operator++ ();
- sal_Bool operator!= (const sal_Int32 i) const;
- sal_Bool operator== (const sal_Int32 i) const;
- macabfield *operator* () const;
- };
- };
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_HEADER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabPreparedStatement.cxx b/connectivity/source/drivers/macab/MacabPreparedStatement.cxx
deleted file mode 100644
index 19d9c5f9de..0000000000
--- a/connectivity/source/drivers/macab/MacabPreparedStatement.cxx
+++ /dev/null
@@ -1,410 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabPreparedStatement.hxx"
-#include "MacabAddressBook.hxx"
-#include "propertyids.hxx"
-#include <connectivity/dbexception.hxx>
-#include "connectivity/dbtools.hxx"
-#include "resource/macab_res.hrc"
-#include "resource/sharedresources.hxx"
-
-using namespace connectivity::macab;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::util;
-
-IMPLEMENT_SERVICE_INFO(MacabPreparedStatement, "com.sun.star.sdbc.drivers.MacabPreparedStatement", "com.sun.star.sdbc.PreparedStatement");
-// -------------------------------------------------------------------------
-void MacabPreparedStatement::checkAndResizeParameters(sal_Int32 nParams) throw(SQLException)
-{
- if ( !m_aParameterRow.is() )
- m_aParameterRow = new OValueVector();
-
- if (nParams < 1)
- ::dbtools::throwInvalidIndexException(*(MacabPreparedStatement *) this,Any());
-
- if (nParams >= (sal_Int32) (m_aParameterRow->get()).size())
- (m_aParameterRow->get()).resize(nParams);
-}
-// -------------------------------------------------------------------------
-void MacabPreparedStatement::setMacabFields() const throw(SQLException)
-{
- ::rtl::Reference<connectivity::OSQLColumns> xColumns; // selected columns
-
- xColumns = m_aSQLIterator.getSelectColumns();
- if (!xColumns.is())
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(
- STR_INVALID_COLUMN_SELECTION
- ) );
- ::dbtools::throwGenericSQLException(sError,NULL);
- }
- m_xMetaData->setMacabFields(xColumns);
-}
-// -------------------------------------------------------------------------
-void MacabPreparedStatement::resetParameters() const throw(SQLException)
-{
- m_nParameterIndex = 0;
-}
-// -------------------------------------------------------------------------
-void MacabPreparedStatement::getNextParameter(::rtl::OUString &rParameter) const throw(SQLException)
-{
- if (m_nParameterIndex >= (sal_Int32) (m_aParameterRow->get()).size())
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(
- STR_INVALID_PARA_COUNT
- ) );
- ::dbtools::throwGenericSQLException(sError,*(MacabPreparedStatement *) this);
- }
-
- rParameter = (m_aParameterRow->get())[m_nParameterIndex];
-
- m_nParameterIndex++;
-}
-// -------------------------------------------------------------------------
-MacabPreparedStatement::MacabPreparedStatement(
- MacabConnection* _pConnection,
- const ::rtl::OUString& sql)
- : MacabPreparedStatement_BASE(_pConnection),
- m_sSqlStatement(sql),
- m_bPrepared(sal_False),
- m_nParameterIndex(0),
- m_aParameterRow()
-{
-
-}
-// -------------------------------------------------------------------------
-MacabPreparedStatement::~MacabPreparedStatement()
-{
-}
-// -------------------------------------------------------------------------
-void MacabPreparedStatement::disposing()
-{
- MacabPreparedStatement_BASE::disposing();
-
- if (m_aParameterRow.is())
- {
- m_aParameterRow->get().clear();
- m_aParameterRow = NULL;
- }
-}
-// -------------------------------------------------------------------------
-Reference< XResultSetMetaData > SAL_CALL MacabPreparedStatement::getMetaData() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
-
- if (!m_xMetaData.is())
- {
- const OSQLTables& xTabs = m_aSQLIterator.getTables();
- ::rtl::OUString sTableName = MacabAddressBook::getDefaultTableName();
-
- if(! xTabs.empty() )
- {
-
- // can only deal with one table at a time
- if(xTabs.size() == 1 && !m_aSQLIterator.hasErrors() )
- sTableName = xTabs.begin()->first;
-
- }
- m_xMetaData = new MacabResultSetMetaData(getOwnConnection(),sTableName);
- setMacabFields();
- }
- Reference< XResultSetMetaData > xMetaData = m_xMetaData.get();
- return xMetaData;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::close() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
-
- // Reset last warning message
- try {
- clearWarnings ();
- MacabCommonStatement::close();
- }
- catch (SQLException &) {
- // If we get an error, ignore
- }
-
- // Remove this Statement object from the Connection object's
- // list
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabPreparedStatement::execute() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
-
- Reference< XResultSet> xRS = MacabCommonStatement::executeQuery(m_sSqlStatement);
-
- return xRS.is();
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabPreparedStatement::executeUpdate() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
-
- // same as in statement with the difference that this statement also can contain parameter
- return 0;
-}
-// -------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL MacabPreparedStatement::getConnection() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
-
- return (Reference< XConnection >) m_pConnection;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabPreparedStatement::executeQuery() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
-
- Reference< XResultSet > rs = MacabCommonStatement::executeQuery(m_sSqlStatement);
-
- return rs;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setNull(sal_Int32 parameterIndex, sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
-
- checkAndResizeParameters(parameterIndex);
-
- (m_aParameterRow->get())[parameterIndex - 1].setNull();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setObjectNull(sal_Int32, sal_Int32, const ::rtl::OUString&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setObjectNull", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setBoolean(sal_Int32, sal_Bool) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setBoolean", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setByte(sal_Int32, sal_Int8) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setByte", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setShort(sal_Int32, sal_Int16) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setShort", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setInt(sal_Int32, sal_Int32) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setInt", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setLong(sal_Int32, sal_Int64) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setLong", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setFloat(sal_Int32, float) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setFloat", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setDouble(sal_Int32, double) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setDouble", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setString(sal_Int32 parameterIndex, const ::rtl::OUString &x) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
-
- checkAndResizeParameters(parameterIndex);
-
- (m_aParameterRow->get())[parameterIndex - 1] = x;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setBytes(sal_Int32, const Sequence< sal_Int8 >&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setBytes", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setDate(sal_Int32, const Date&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setDate", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setTime(sal_Int32, const Time&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setTime", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setTimestamp(sal_Int32, const DateTime&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setTimestamp", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setBinaryStream(sal_Int32, const Reference< ::com::sun::star::io::XInputStream >&, sal_Int32) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setBinaryStream", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setCharacterStream(sal_Int32, const Reference< ::com::sun::star::io::XInputStream >&, sal_Int32) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setCharacterStream", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setObject(sal_Int32 parameterIndex, const Any& x) throw(SQLException, RuntimeException)
-{
- if(!::dbtools::implSetObject(this,parameterIndex,x))
- {
- const ::rtl::OUString sError( m_pConnection->getResources().getResourceStringWithSubstitution(
- STR_UNKNOWN_PARA_TYPE,
- "$position$", ::rtl::OUString::valueOf(parameterIndex)
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setObjectWithInfo(sal_Int32, const Any&, sal_Int32, sal_Int32) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setObjectWithInfo", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setRef(sal_Int32, const Reference< XRef >&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setRef", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setBlob(sal_Int32, const Reference< XBlob >&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setBlob", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setClob(sal_Int32, const Reference< XClob >&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setClob", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::setArray(sal_Int32, const Reference< XArray >&) throw(SQLException, RuntimeException)
-{
-
-
-
-::dbtools::throwFunctionNotSupportedException("setArray", NULL);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabPreparedStatement::clearParameters() throw(SQLException, RuntimeException)
-{
-::dbtools::throwFunctionNotSupportedException("clearParameters", NULL);
-}
-// -------------------------------------------------------------------------
-void MacabPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
-{
- switch (nHandle)
- {
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- break;
- case PROPERTY_ID_USEBOOKMARKS:
- break;
- default:
- MacabCommonStatement::setFastPropertyValue_NoBroadcast(nHandle,rValue);
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabPreparedStatement.hxx b/connectivity/source/drivers/macab/MacabPreparedStatement.hxx
deleted file mode 100644
index 0fb1b6e92d..0000000000
--- a/connectivity/source/drivers/macab/MacabPreparedStatement.hxx
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_PREPAREDSTATEMENT_HXX_
-#define _CONNECTIVITY_MACAB_PREPAREDSTATEMENT_HXX_
-
-#include "MacabStatement.hxx"
-#include "MacabResultSetMetaData.hxx"
-#include <connectivity/FValue.hxx>
-#include <com/sun/star/sdbc/XParameters.hpp>
-#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
-#include <cppuhelper/implbase4.hxx>
-
-namespace connectivity
-{
- namespace macab
- {
-
- class OBoundParam;
- typedef ::cppu::ImplInheritanceHelper4< MacabCommonStatement,
- ::com::sun::star::sdbc::XPreparedStatement,
- ::com::sun::star::sdbc::XParameters,
- ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
- ::com::sun::star::lang::XServiceInfo> MacabPreparedStatement_BASE;
-
- class MacabPreparedStatement : public MacabPreparedStatement_BASE
- {
- protected:
- ::rtl::OUString m_sSqlStatement;
- ::rtl::Reference< MacabResultSetMetaData >
- m_xMetaData;
- sal_Bool m_bPrepared;
- mutable sal_Int32 m_nParameterIndex;
- OValueRow m_aParameterRow;
-
- void checkAndResizeParameters(sal_Int32 nParams) throw(::com::sun::star::sdbc::SQLException);
- void setMacabFields() const throw(::com::sun::star::sdbc::SQLException);
-
- protected:
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception);
-
- virtual void resetParameters() const throw(::com::sun::star::sdbc::SQLException);
- virtual void getNextParameter(::rtl::OUString &rParameter) const throw(::com::sun::star::sdbc::SQLException);
- virtual ~MacabPreparedStatement();
-
- public:
- DECLARE_SERVICE_INFO();
- MacabPreparedStatement(MacabConnection* _pConnection, const ::rtl::OUString& sql);
-
- // OComponentHelper
- virtual void SAL_CALL disposing();
-
- // XPreparedStatement
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XParameters
- virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XResultSetMetaDataSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_PREPAREDSTATEMENT_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabRecord.cxx b/connectivity/source/drivers/macab/MacabRecord.cxx
deleted file mode 100644
index 3bf9cac179..0000000000
--- a/connectivity/source/drivers/macab/MacabRecord.cxx
+++ /dev/null
@@ -1,350 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabRecord.hxx"
-#include "macabutilities.hxx"
-#include <com/sun/star/util/DateTime.hpp>
-
-#include <premac.h>
-#include <Carbon/Carbon.h>
-#include <AddressBook/ABAddressBookC.h>
-#include <postmac.h>
-#include <connectivity/dbconversion.hxx>
-
-using namespace connectivity::macab;
-using namespace com::sun::star::util;
-using namespace ::dbtools;
-
-// -------------------------------------------------------------------------
-MacabRecord::MacabRecord()
-{
- size = 0;
- fields = NULL;
-}
-
-// -------------------------------------------------------------------------
-MacabRecord::MacabRecord(const sal_Int32 _size)
-{
- size = _size;
- fields = new macabfield *[size];
- sal_Int32 i;
- for(i = 0; i < size; i++)
- fields[i] = NULL;
-}
-
-// -------------------------------------------------------------------------
-MacabRecord::~MacabRecord()
-{
- if(size > 0)
- {
- int i;
- for(i = 0; i < size; i++)
- {
- delete fields[i];
- fields[i] = NULL;
- }
- }
- delete [] fields;
- fields = NULL;
-}
-
-// -------------------------------------------------------------------------
-void MacabRecord::insertAtColumn (CFTypeRef _value, ABPropertyType _type, const sal_Int32 _column)
-{
- if(_column < size)
- {
- if(fields[_column] == NULL)
- fields[_column] = new macabfield;
-
- fields[_column]->value = _value;
- if (fields[_column]->value)
- CFRetain(fields[_column]->value);
- fields[_column]->type = _type;
- }
-}
-
-// -------------------------------------------------------------------------
-sal_Bool MacabRecord::contains (const macabfield *_field) const
-{
- if(_field == NULL)
- return sal_False;
- else
- return contains(_field->value);
-}
-
-// -------------------------------------------------------------------------
-sal_Bool MacabRecord::contains (const CFTypeRef _value) const
-{
- sal_Int32 i;
- for(i = 0; i < size; i++)
- {
- if(fields[i] != NULL)
- {
- if(CFEqual(fields[i]->value, _value))
- {
- return sal_True;
- }
- }
- }
-
- return sal_False;
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 MacabRecord::getSize() const
-{
- return size;
-}
-
-// -------------------------------------------------------------------------
-macabfield *MacabRecord::copy(const sal_Int32 i) const
-{
- /* Note: copy(i) creates a new macabfield identical to that at
- * location i, whereas get(i) returns a pointer to the macabfield
- * at location i.
- */
- if(i < size)
- {
- macabfield *_copy = new macabfield;
- _copy->type = fields[i]->type;
- _copy->value = fields[i]->value;
- if (_copy->value)
- CFRetain(_copy->value);
- return _copy;
- }
-
- return NULL;
-}
-
-// -------------------------------------------------------------------------
-macabfield *MacabRecord::get(const sal_Int32 i) const
-{
- /* Note: copy(i) creates a new macabfield identical to that at
- * location i, whereas get(i) returns a pointer to the macabfield
- * at location i.
- */
- if(i < size)
- {
- return fields[i];
- }
-
- return NULL;
-}
-
-// -------------------------------------------------------------------------
-void MacabRecord::releaseFields()
-{
- /* This method is, at the moment, only used in MacabHeader.cxx, but
- * the idea is simple: if you are not destroying this object but want
- * to clear it of its macabfields, you should release each field's
- * value.
- */
- sal_Int32 i;
- for(i = 0; i < size; i++)
- CFRelease(fields[i]->value);
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 MacabRecord::compareFields(const macabfield *_field1, const macabfield *_field2)
-{
-
- /* When comparing records, if either field is NULL (and the other is
- * not), that field is considered "greater than" the other, so that it
- * shows up later in the list when fields are ordered.
- */
- if(_field1 == _field2)
- return 0;
- if(_field1 == NULL)
- return 1;
- if(_field2 == NULL)
- return -1;
-
- /* If they aren't the same type, for now, return the one with
- * the smaller type ID... I don't know of a better way to compare
- * two different data types.
- */
- if(_field1->type != _field2->type)
- return(_field1->type - _field2->type);
-
- CFComparisonResult result;
-
- /* Carbon has a unique compare function for each data type: */
- switch(_field1->type)
- {
- case kABStringProperty:
- result = CFStringCompare(
- (CFStringRef) _field1->value,
- (CFStringRef) _field2->value,
- kCFCompareLocalized); // Specifies that the comparison should take into account differences related to locale, such as the thousands separator character.
- break;
-
- case kABDateProperty:
- result = CFDateCompare(
- (CFDateRef) _field1->value,
- (CFDateRef) _field2->value,
- NULL); // NULL = unused variable
- break;
-
- case kABIntegerProperty:
- case kABRealProperty:
- result = CFNumberCompare(
- (CFNumberRef) _field1->value,
- (CFNumberRef) _field2->value,
- NULL); // NULL = unused variable
- break;
-
- default:
- result = kCFCompareEqualTo; // can't compare
- }
-
- return (sal_Int32) result;
-}
-
-// -------------------------------------------------------------------------
-/* Create a macabfield out of an OUString and type. Together with the
- * method fieldToString() (below), it is possible to switch conveniently
- * between an OUString and a macabfield (for use when creating and handling
- * SQL statement).
- */
-macabfield *MacabRecord::createMacabField(const ::rtl::OUString _newFieldString, const ABPropertyType _abType)
-{
- macabfield *newField = NULL;
- switch(_abType)
- {
- case kABStringProperty:
- newField = new macabfield;
- newField->value = OUStringToCFString(_newFieldString);
- newField->type = _abType;
- break;
- case kABDateProperty:
- {
- DateTime aDateTime = DBTypeConversion::toDateTime(_newFieldString);
-
- // bad format...
- if(aDateTime.Year == 0 && aDateTime.Month == 0 && aDateTime.Day == 0)
- {
- }
- else
- {
- double nTime = DBTypeConversion::toDouble(aDateTime, DBTypeConversion::getStandardDate());
- nTime -= kCFAbsoluteTimeIntervalSince1970;
- newField = new macabfield;
- newField->value = CFDateCreate(NULL, (CFAbsoluteTime) nTime);
- newField->type = _abType;
- }
- }
- break;
- case kABIntegerProperty:
- try
- {
- sal_Int64 nVal = _newFieldString.toInt64();
-
- newField = new macabfield;
- newField->value = CFNumberCreate(NULL,kCFNumberLongType, &nVal);
- newField->type = _abType;
- }
- // bad format...
- catch(...)
- {
- }
- break;
- case kABRealProperty:
- try
- {
- double nVal = _newFieldString.toDouble();
-
- newField = new macabfield;
- newField->value = CFNumberCreate(NULL,kCFNumberDoubleType, &nVal);
- newField->type = _abType;
- }
- // bad format...
- catch(...)
- {
- }
- break;
- default:
- ;
- }
- return newField;
-}
-
-// -------------------------------------------------------------------------
-/* Create an OUString out of a macabfield. Together with the method
- * createMacabField() (above), it is possible to switch conveniently
- * between an OUString and a macabfield (for use when creating and handling
- * SQL statement).
- */
-::rtl::OUString MacabRecord::fieldToString(const macabfield *_aField)
-{
- if(_aField == NULL)
- return ::rtl::OUString();
-
- ::rtl::OUString fieldString;
-
- switch(_aField->type)
- {
- case kABStringProperty:
- fieldString = CFStringToOUString((CFStringRef) _aField->value);
- break;
- case kABDateProperty:
- {
- DateTime aTime = CFDateToDateTime((CFDateRef) _aField->value);
- fieldString = DBTypeConversion::toDateTimeString(aTime);
- }
- break;
- case kABIntegerProperty:
- {
- CFNumberType numberType = CFNumberGetType( (CFNumberRef) _aField->value );
- sal_Int64 nVal;
- // Should we check for the wrong type here, e.g., a float?
- sal_Bool m_bSuccess = !CFNumberGetValue((CFNumberRef) _aField->value, numberType, &nVal);
- if(m_bSuccess != sal_False)
- fieldString = ::rtl::OUString::valueOf(nVal);
- }
- break;
- case kABRealProperty:
- {
- CFNumberType numberType = CFNumberGetType( (CFNumberRef) _aField->value );
- double nVal;
- // Should we check for the wrong type here, e.g., an int?
- sal_Bool m_bSuccess = !CFNumberGetValue((CFNumberRef) _aField->value, numberType, &nVal);
- if(m_bSuccess != sal_False)
- fieldString = ::rtl::OUString::valueOf(nVal);
- }
- break;
- default:
- ;
- }
- return fieldString;
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabRecord.hxx b/connectivity/source/drivers/macab/MacabRecord.hxx
deleted file mode 100644
index aa47f8377b..0000000000
--- a/connectivity/source/drivers/macab/MacabRecord.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_RECORD_HXX_
-#define _CONNECTIVITY_MACAB_RECORD_HXX_
-
-#include <cppuhelper/compbase3.hxx>
-
-#include <premac.h>
-#include <Carbon/Carbon.h>
-#include <AddressBook/ABAddressBookC.h>
-#include <postmac.h>
-
-namespace connectivity
-{
- namespace macab
- {
- /* a MacabRecord is at root a list of macabfields (which is just
- * something to hold both a CFTypeRef (a CoreFoundation object) and
- * its Address Book type.
- */
- struct macabfield
- {
- CFTypeRef value;
- ABPropertyType type;
- };
-
- class MacabRecord{
- protected:
- sal_Int32 size;
- macabfield **fields;
- protected:
- void releaseFields();
- public:
- MacabRecord();
- MacabRecord(const sal_Int32 _size);
- virtual ~MacabRecord();
- void insertAtColumn (CFTypeRef _value, ABPropertyType _type, const sal_Int32 _column);
- sal_Bool contains(const macabfield *_field) const;
- sal_Bool contains(const CFTypeRef _value) const;
- sal_Int32 getSize() const;
- macabfield *copy(const sal_Int32 i) const;
- macabfield *get(const sal_Int32 i) const;
-
- static sal_Int32 compareFields(const macabfield *_field1, const macabfield *_field2);
- static macabfield *createMacabField(const ::rtl::OUString _newFieldString, const ABPropertyType _abtype);
- static ::rtl::OUString fieldToString(const macabfield *_aField);
-
- };
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_RECORD_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabRecords.cxx b/connectivity/source/drivers/macab/MacabRecords.cxx
deleted file mode 100644
index a92e2313e9..0000000000
--- a/connectivity/source/drivers/macab/MacabRecords.cxx
+++ /dev/null
@@ -1,1215 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabRecords.hxx"
-#include "MacabRecord.hxx"
-#include "MacabHeader.hxx"
-#include "macabutilities.hxx"
-
-#include <premac.h>
-#include <Carbon/Carbon.h>
-#include <AddressBook/ABAddressBookC.h>
-#include <postmac.h>
-#include <com/sun/star/util/DateTime.hpp>
-
-using namespace connectivity::macab;
-using namespace com::sun::star::util;
-
-// -------------------------------------------------------------------------
-MacabRecords::MacabRecords(const ABAddressBookRef _addressBook, MacabHeader *_header, MacabRecord **_records, sal_Int32 _numRecords)
-{
- /* Variables passed in... */
- header = _header;
- recordsSize = _numRecords;
- currentRecord = _numRecords;
- records = _records;
- addressBook = _addressBook;
-
- /* Default variables... */
- recordType = kABPersonRecordType;
-
- /* Variables constructed... */
- bootstrap_CF_types();
- bootstrap_requiredProperties();
-}
-
-// -------------------------------------------------------------------------
-/* Creates a MacabRecords from another: copies the length, name, and
- * address book of the original, but the header or the records themselves.
- * The idea is that the only reason to copy a MacabRecords is to create
- * a filtered version of it, which can have the same length (to avoid
- * resizing) and will work from the same base addressbook, but might have
- * entirey different values and even (possibly in the future) a different
- * header.
- */
-MacabRecords::MacabRecords(const MacabRecords *_copy)
-{
- /* Variables passed in... */
- recordsSize = _copy->recordsSize;
- addressBook = _copy->addressBook;
- m_sName = _copy->m_sName;
-
- /* Default variables... */
- currentRecord = 0;
- header = NULL;
- records = new MacabRecord *[recordsSize];
- recordType = kABPersonRecordType;
-
- /* Variables constructed... */
- bootstrap_CF_types();
- bootstrap_requiredProperties();
-}
-
-// -------------------------------------------------------------------------
-MacabRecords::MacabRecords(const ABAddressBookRef _addressBook)
-{
- /* Variables passed in... */
- addressBook = _addressBook;
-
- /* Default variables... */
- recordsSize = 0;
- currentRecord = 0;
- records = NULL;
- header = NULL;
- recordType = kABPersonRecordType;
-
- /* Variables constructed... */
- bootstrap_CF_types();
- bootstrap_requiredProperties();
-}
-
-// -------------------------------------------------------------------------
-void MacabRecords::initialize()
-{
-
- /* Make sure everything is NULL before initializing. (We usually just
- * initialize after we use the constructor that takes only a
- * MacabAddressBook, so these variables will most likely already be
- * NULL.
- */
- if(records != NULL)
- {
- sal_Int32 i;
-
- for(i = 0; i < recordsSize; i++)
- delete records[i];
-
- delete [] records;
- }
-
- if(header != NULL)
- delete header;
-
- /* We can handle both default record Address Book record types in
- * this method, though only kABPersonRecordType is ever used.
- */
- CFArrayRef allRecords;
- if(CFStringCompare(recordType, kABPersonRecordType, 0) == kCFCompareEqualTo)
- allRecords = ABCopyArrayOfAllPeople(addressBook);
- else
- allRecords = ABCopyArrayOfAllGroups(addressBook);
-
- ABRecordRef record;
- sal_Int32 i;
- recordsSize = (sal_Int32) CFArrayGetCount(allRecords);
- records = new MacabRecord *[recordsSize];
-
- /* First, we create the header... */
- header = createHeaderForRecordType(allRecords, recordType);
-
- /* Then, we create each of the records... */
- for(i = 0; i < recordsSize; i++)
- {
- record = (ABRecordRef) CFArrayGetValueAtIndex(allRecords, i);
- records[i] = createMacabRecord(record, header, recordType);
- }
- currentRecord = recordsSize;
-
- CFRelease(allRecords);
-}
-
-// -------------------------------------------------------------------------
-MacabRecords::~MacabRecords()
-{
-}
-
-// -------------------------------------------------------------------------
-void MacabRecords::setHeader(MacabHeader *_header)
-{
- if(header != NULL)
- delete header;
- header = _header;
-}
-
-// -------------------------------------------------------------------------
-MacabHeader *MacabRecords::getHeader() const
-{
- return header;
-}
-
-// -------------------------------------------------------------------------
-/* Inserts a MacabRecord at a given location. If there is already a
- * MacabRecord at that location, return it.
- */
-MacabRecord *MacabRecords::insertRecord(MacabRecord *_newRecord, const sal_Int32 _location)
-{
- MacabRecord *oldRecord;
-
- /* If the location is greater than the current allocated size of this
- * MacabRecords, allocate more space.
- */
- if(_location >= recordsSize)
- {
- sal_Int32 i;
- MacabRecord **newRecordsArray = new MacabRecord *[_location+1];
- for(i = 0; i < recordsSize; i++)
- {
- newRecordsArray[i] = records[i];
- }
- delete [] records;
- records = newRecordsArray;
- }
-
- /* Remember: currentRecord refers to one above the highest existing
- * record (i.e., it refers to where to place the next record if a
- * location is not given).
- */
- if(_location >= currentRecord)
- currentRecord = _location+1;
-
- oldRecord = records[_location];
- records[_location] = _newRecord;
- return oldRecord;
-}
-
-// -------------------------------------------------------------------------
-/* Insert a record at the next available place. */
-void MacabRecords::insertRecord(MacabRecord *_newRecord)
-{
- insertRecord(_newRecord, currentRecord);
-}
-
-// -------------------------------------------------------------------------
-MacabRecord *MacabRecords::getRecord(const sal_Int32 _location) const
-{
- if(_location >= recordsSize)
- return NULL;
- return records[_location];
-}
-
-// -------------------------------------------------------------------------
-macabfield *MacabRecords::getField(const sal_Int32 _recordNumber, const sal_Int32 _columnNumber) const
-{
- if(_recordNumber >= recordsSize)
- return NULL;
-
- MacabRecord *record = records[_recordNumber];
-
- if(_columnNumber < 0 || _columnNumber >= record->getSize())
- return NULL;
-
- return record->get(_columnNumber);
-}
-
-// -------------------------------------------------------------------------
-macabfield *MacabRecords::getField(const sal_Int32 _recordNumber, const ::rtl::OUString _columnName) const
-{
- if(header != NULL)
- {
- sal_Int32 columnNumber = header->getColumnNumber(_columnName);
- if(columnNumber == -1)
- return NULL;
-
- return getField(_recordNumber, columnNumber);
- }
- else
- {
- // error: shouldn't access field with null header!
- return NULL;
- }
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 MacabRecords::getFieldNumber(const ::rtl::OUString _columnName) const
-{
- if(header != NULL)
- return header->getColumnNumber(_columnName);
- else
- // error: shouldn't access field with null header!
- return -1;
-}
-
-// -------------------------------------------------------------------------
-/* Create the lcl_CFTypes array -- we need this because there is no
- * way to get the ABType of an object from the object itself, and the
- * function ABTypeOfProperty can't handle multiple levels of data
- * (e.g., it can tell us that "address" is of type
- * kABDictionaryProperty, but it cannot tell us that all of the keys
- * and values in the dictionary have type kABStringProperty. On the
- * other hand, we _can_ get the CFType out of any object.
- * Unfortunately, all information about CFTypeIDs comes with the
- * warning that they change between releases, so we build them
- * ourselves here. (The one that we can't build is for multivalues,
- * e.g., kABMultiStringProperty. All of these appear to have the
- * same type: 1, but there is no function that I've found to give
- * us that dynamically in case that number ever changes.
- */
-void MacabRecords::bootstrap_CF_types()
-{
- lcl_CFTypesLength = 6;
- lcl_CFTypes = new lcl_CFType[lcl_CFTypesLength];
-
- lcl_CFTypes[0].cf = CFNumberGetTypeID();
- lcl_CFTypes[0].ab = kABIntegerProperty;
-
- lcl_CFTypes[1].cf = CFStringGetTypeID();
- lcl_CFTypes[1].ab = kABStringProperty;
-
- lcl_CFTypes[2].cf = CFDateGetTypeID();
- lcl_CFTypes[2].ab = kABDateProperty;
-
- lcl_CFTypes[3].cf = CFArrayGetTypeID();
- lcl_CFTypes[3].ab = kABArrayProperty;
-
- lcl_CFTypes[4].cf = CFDictionaryGetTypeID();
- lcl_CFTypes[4].ab = kABDictionaryProperty;
-
- lcl_CFTypes[5].cf = CFDataGetTypeID();
- lcl_CFTypes[5].ab = kABDataProperty;
-}
-
-// -------------------------------------------------------------------------
-/* This is based on the possible fields required in the mail merge template
- * in sw. If the fields possible there change, it would be optimal to
- * change these fields as well.
- */
-void MacabRecords::bootstrap_requiredProperties()
-{
- numRequiredProperties = 7;
- requiredProperties = new CFStringRef[numRequiredProperties];
- requiredProperties[0] = kABTitleProperty;
- requiredProperties[1] = kABFirstNameProperty;
- requiredProperties[2] = kABLastNameProperty;
- requiredProperties[3] = kABOrganizationProperty;
- requiredProperties[4] = kABAddressProperty;
- requiredProperties[5] = kABPhoneProperty;
- requiredProperties[6] = kABEmailProperty;
-}
-
-// -------------------------------------------------------------------------
-/* Create the header for a given record type and a given array of records.
- * Because the array of records and the record type are given, if you want
- * to, you can run this method on the members of a group, or on any other
- * filtered list of people and get a header relevant to them (e.g., if
- * they only have home addresses, the work address fields won't show up).
- */
-MacabHeader *MacabRecords::createHeaderForRecordType(const CFArrayRef _records, const CFStringRef _recordType) const
-{
- /* We have two types of properties for a given record type, nonrequired
- * and required. Required properties are ones that will show up whether
- * or not they are empty. Nonrequired properties will only show up if
- * at least one record in the set has that property filled. The reason
- * is that some properties, like the kABTitleProperty are required by
- * the mail merge wizard (in module sw) but are by default not shown in
- * the Mac OS X address book, so they would be weeded out at this stage
- * and not shown if they were not required.
- *
- * Note: with the addition of required properties, I am not sure that
- * this method still works for kABGroupRecordType (since the required
- * properites are all for kABPersonRecordType).
- *
- * Note: required properties are constructed in the method
- * bootstrap_requiredProperties() (above).
- */
- CFArrayRef allProperties = ABCopyArrayOfPropertiesForRecordType(addressBook, _recordType);
- CFStringRef *nonRequiredProperties;
- sal_Int32 numRecords = (sal_Int32) CFArrayGetCount(_records);
- sal_Int32 numProperties = (sal_Int32) CFArrayGetCount(allProperties);
- sal_Int32 numNonRequiredProperties = numProperties - numRequiredProperties;
-
- /* While searching through the properties for required properties, these
- * sal_Bools will keep track of what we have found.
- */
- sal_Bool bFoundProperty;
- sal_Bool bFoundRequiredProperties[numRequiredProperties];
-
-
- /* We have three MacabHeaders: headerDataForProperty is where we
- * store the result of createHeaderForProperty(), which return a
- * MacabHeader for a single property. lcl_header is where we store
- * the MacabHeader that we are constructing. And, nonRequiredHeader
- * is where we construct the MacabHeader for non-required properties,
- * so that we can sort them before adding them to lcl_header.
- */
- MacabHeader *headerDataForProperty;
- MacabHeader *lcl_header = new MacabHeader();
- MacabHeader *nonRequiredHeader = new MacabHeader();
-
- /* Other variables... */
- sal_Int32 i, j, k;
- ABRecordRef record;
- CFStringRef property;
-
-
- /* Allocate and initialize... */
- nonRequiredProperties = new CFStringRef[numNonRequiredProperties];
- k = 0;
- for(i = 0; i < numRequiredProperties; i++)
- bFoundRequiredProperties[i] = sal_False;
-
- /* Determine the non-required properties... */
- for(i = 0; i < numProperties; i++)
- {
- property = (CFStringRef) CFArrayGetValueAtIndex(allProperties, i);
- bFoundProperty = sal_False;
- for(j = 0; j < numRequiredProperties; j++)
- {
- if(CFEqual(property, requiredProperties[j]))
- {
- bFoundProperty = sal_True;
- bFoundRequiredProperties[j] = sal_True;
- break;
- }
- }
-
- if(bFoundProperty == sal_False)
- {
- /* If we have found too many non-required properties */
- if(k == numNonRequiredProperties)
- {
- k++; // so that the OSL_ENSURE below fails
- break;
- }
- nonRequiredProperties[k] = property;
- k++;
- }
- }
-
- // Somehow, we got too many or too few non-requird properties...
- // Most likely, one of the required properties no longer exists, which
- // we also test later.
- OSL_ENSURE(k == numNonRequiredProperties, "MacabRecords::createHeaderForRecordType: Found an unexpected number of non-required properties");
-
- /* Fill the header with required properties first... */
- for(i = 0; i < numRequiredProperties; i++)
- {
- if(bFoundRequiredProperties[i] == sal_True)
- {
- /* The order of these matters (we want all address properties
- * before any phone properties, or else things will look weird),
- * so we get all possibilitities for each property, going through
- * each record, and then go onto the next property.
- * (Note: the reason that we have to go through all records
- * in the first place is that properties like address, phone, and
- * e-mail are multi-value properties with an unknown number of
- * values. A user could specify thirteen different kinds of
- * e-mail addresses for one of her or his contacts, and we need to
- * get all of them.
- */
- for(j = 0; j < numRecords; j++)
- {
- record = (ABRecordRef) CFArrayGetValueAtIndex(_records, j);
- headerDataForProperty = createHeaderForProperty(record,requiredProperties[i],_recordType,sal_True);
- if(headerDataForProperty != NULL)
- {
- (*lcl_header) += headerDataForProperty;
- delete headerDataForProperty;
- }
- }
- }
- else
- {
- // Couldn't find a required property...
- OSL_FAIL(::rtl::OString("MacabRecords::createHeaderForRecordType: could not find required property: ") +
- ::rtl::OUStringToOString(CFStringToOUString(requiredProperties[i]), RTL_TEXTENCODING_ASCII_US));
- }
- }
-
- /* And now, non-required properties... */
- for(i = 0; i < numRecords; i++)
- {
- record = (ABRecordRef) CFArrayGetValueAtIndex(_records, i);
-
- for(j = 0; j < numNonRequiredProperties; j++)
- {
- property = nonRequiredProperties[j];
- headerDataForProperty = createHeaderForProperty(record,property,_recordType,sal_False);
- if(headerDataForProperty != NULL)
- {
- (*nonRequiredHeader) += headerDataForProperty;
- delete headerDataForProperty;
- }
- }
-
- }
- nonRequiredHeader->sortRecord();
-
- (*lcl_header) += nonRequiredHeader;
- delete nonRequiredHeader;
-
- CFRelease(allProperties);
- delete [] nonRequiredProperties;
-
- return lcl_header;
-}
-
-// -------------------------------------------------------------------------
-/* Create a header for a single property. Basically, this method gets
- * the property's value and type and then calls another method of
- * the same name to do the dirty work.
- */
-MacabHeader *MacabRecords::createHeaderForProperty(const ABRecordRef _record, const CFStringRef _propertyName, const CFStringRef _recordType, const sal_Bool _isPropertyRequired) const
-{
- // local variables
- CFStringRef localizedPropertyName;
- CFTypeRef propertyValue;
- ABPropertyType propertyType;
- MacabHeader *result;
-
- /* Get the property's value */
- propertyValue = ABRecordCopyValue(_record,_propertyName);
- if(propertyValue == NULL && _isPropertyRequired == sal_False)
- return NULL;
-
- propertyType = ABTypeOfProperty(addressBook, _recordType, _propertyName);
- localizedPropertyName = ABCopyLocalizedPropertyOrLabel(_propertyName);
-
- result = createHeaderForProperty(propertyType, propertyValue, localizedPropertyName);
-
- if(propertyValue != NULL)
- CFRelease(propertyValue);
-
- return result;
-}
-
-// -------------------------------------------------------------------------
-/* Create a header for a single property. This method is recursive
- * because a single property might contain several sub-properties that
- * we also want to treat singly.
- */
-MacabHeader *MacabRecords::createHeaderForProperty(const ABPropertyType _propertyType, const CFTypeRef _propertyValue, const CFStringRef _propertyName) const
-{
- macabfield **headerNames = NULL;
- sal_Int32 length = 0;
-
- switch(_propertyType)
- {
- /* Scalars */
- case kABStringProperty:
- case kABRealProperty:
- case kABIntegerProperty:
- case kABDateProperty:
- length = 1;
- headerNames = new macabfield *[1];
- headerNames[0] = new macabfield;
- headerNames[0]->value = _propertyName;
- headerNames[0]->type = _propertyType;
- break;
-
- /* Multi-scalars */
- case kABMultiIntegerProperty:
- case kABMultiDateProperty:
- case kABMultiStringProperty:
- case kABMultiRealProperty:
- case kABMultiDataProperty:
- /* For non-scalars, we can only get more information if the property
- * actually exists.
- */
- if(_propertyValue != NULL)
- {
- sal_Int32 i;
-
- sal_Int32 multiLength = ABMultiValueCount((ABMutableMultiValueRef) _propertyValue);
- CFStringRef multiLabel, localizedMultiLabel;
- ::rtl::OUString multiLabelString;
- ::rtl::OUString multiPropertyString;
- ::rtl::OUString headerNameString;
- ABPropertyType multiType = (ABPropertyType) (ABMultiValuePropertyType((ABMutableMultiValueRef) _propertyValue) - 0x100);
-
- length = multiLength;
- headerNames = new macabfield *[multiLength];
- multiPropertyString = CFStringToOUString(_propertyName);
-
- /* Go through each element, and - since each element is a scalar -
- * just create a new macabfield for it.
- */
- for(i = 0; i < multiLength; i++)
- {
- multiLabel = ABMultiValueCopyLabelAtIndex((ABMutableMultiValueRef) _propertyValue, i);
- localizedMultiLabel = ABCopyLocalizedPropertyOrLabel(multiLabel);
- multiLabelString = CFStringToOUString(localizedMultiLabel);
- CFRelease(multiLabel);
- CFRelease(localizedMultiLabel);
- headerNameString = multiPropertyString + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(": ")) + fixLabel(multiLabelString);
- headerNames[i] = new macabfield;
- headerNames[i]->value = OUStringToCFString(headerNameString);
- headerNames[i]->type = multiType;
- }
- }
- break;
-
- /* Multi-array or dictionary */
- case kABMultiArrayProperty:
- case kABMultiDictionaryProperty:
- /* For non-scalars, we can only get more information if the property
- * actually exists.
- */
- if(_propertyValue != NULL)
- {
- sal_Int32 i,j,k;
-
- // Total number of multi-array or multi-dictionary elements.
- sal_Int32 multiLengthFirstLevel = ABMultiValueCount((ABMutableMultiValueRef) _propertyValue);
-
- /* Total length, including the length of each element (e.g., if
- * this multi-dictionary contains three dictionaries, and each
- * dictionary has four elements, this variable will be twelve,
- * whereas multiLengthFirstLevel will be three.
- */
- sal_Int32 multiLengthSecondLevel = 0;
-
- CFStringRef multiLabel, localizedMultiLabel;
- CFTypeRef multiValue;
- ::rtl::OUString multiLabelString;
- ::rtl::OUString multiPropertyString;
- MacabHeader **multiHeaders = new MacabHeader *[multiLengthFirstLevel];
- ABPropertyType multiType = (ABPropertyType) (ABMultiValuePropertyType((ABMutableMultiValueRef) _propertyValue) - 0x100);
-
- multiPropertyString = CFStringToOUString(_propertyName);
-
- /* Go through each element - since each element can really
- * contain anything, we run this method again on each element
- * and store the resulting MacabHeader (in the multiHeaders
- * array). Then, all we'll have to do is combine the MacabHeaders
- * into a single one.
- */
- for(i = 0; i < multiLengthFirstLevel; i++)
- {
- /* label */
- multiLabel = ABMultiValueCopyLabelAtIndex((ABMutableMultiValueRef) _propertyValue, i);
- multiValue = ABMultiValueCopyValueAtIndex((ABMutableMultiValueRef) _propertyValue, i);
- if(multiValue && multiLabel)
- {
- localizedMultiLabel = ABCopyLocalizedPropertyOrLabel(multiLabel);
- multiLabelString = multiPropertyString + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(": ")) + fixLabel(CFStringToOUString(localizedMultiLabel));
- CFRelease(multiLabel);
- CFRelease(localizedMultiLabel);
- multiLabel = OUStringToCFString(multiLabelString);
- multiHeaders[i] = createHeaderForProperty(multiType, multiValue, multiLabel);
- if (!multiHeaders[i])
- multiHeaders[i] = new MacabHeader();
- multiLengthSecondLevel += multiHeaders[i]->getSize();
- }
- else
- {
- multiHeaders[i] = new MacabHeader();
- }
- if(multiValue)
- CFRelease(multiValue);
- }
-
- /* We now have enough information to create our final MacabHeader.
- * We go through each field of each header and add it to the
- * headerNames array (which is what is used below to construct
- * the MacabHeader we return).
- */
- length = multiLengthSecondLevel;
- headerNames = new macabfield *[multiLengthSecondLevel];
-
- for(i = 0, j = 0, k = 0; i < multiLengthSecondLevel; i++,k++)
- {
- while(multiHeaders[j]->getSize() == k)
- {
- j++;
- k = 0;
- }
-
- headerNames[i] = multiHeaders[j]->copy(k);
- }
- for(i = 0; i < multiLengthFirstLevel; i++)
- delete multiHeaders[i];
-
- delete [] multiHeaders;
- }
- break;
-
- /* Dictionary */
- case kABDictionaryProperty:
- /* For non-scalars, we can only get more information if the property
- * actually exists.
- */
- if(_propertyValue != NULL)
- {
- /* Assume all keys are strings */
- sal_Int32 numRecords = (sal_Int32) CFDictionaryGetCount((CFDictionaryRef) _propertyValue);
-
- /* The only method for getting info out of a CFDictionary, of both
- * keys and values, is to all of them all at once, so these
- * variables will hold them.
- */
- CFStringRef *dictKeys;
- CFTypeRef *dictValues;
-
- sal_Int32 i,j,k;
- ::rtl::OUString dictKeyString, propertyNameString;
- ABPropertyType dictType;
- MacabHeader **dictHeaders = new MacabHeader *[numRecords];
- ::rtl::OUString dictLabelString;
- CFStringRef dictLabel, localizedDictKey;
-
- /* Get the keys and values */
- dictKeys = (CFStringRef *) malloc(sizeof(CFStringRef)*numRecords);
- dictValues = (CFTypeRef *) malloc(sizeof(CFTypeRef)*numRecords);
- CFDictionaryGetKeysAndValues((CFDictionaryRef) _propertyValue, (const void **) dictKeys, (const void **) dictValues);
-
- propertyNameString = CFStringToOUString(_propertyName);
-
- length = 0;
- /* Go through each element - assuming that the key is a string but
- * that the value could be anything. Since the value could be
- * anything, we can't assume that it is scalar (it could even be
- * another dictionary), so we attempt to get its type using
- * the method getABTypeFromCFType and then run this method
- * recursively on that element, storing the MacabHeader that
- * results. Then, we just combine all of the MacabHeaders into
- * one.
- */
- for(i = 0; i < numRecords; i++)
- {
- dictType = (ABPropertyType) getABTypeFromCFType( CFGetTypeID(dictValues[i]) );
- localizedDictKey = ABCopyLocalizedPropertyOrLabel(dictKeys[i]);
- dictKeyString = CFStringToOUString(localizedDictKey);
- dictLabelString = propertyNameString + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(": ")) + fixLabel(dictKeyString);
- dictLabel = OUStringToCFString(dictLabelString);
- dictHeaders[i] = createHeaderForProperty(dictType, dictValues[i], dictLabel);
- if (!dictHeaders[i])
- dictHeaders[i] = new MacabHeader();
- length += dictHeaders[i]->getSize();
- CFRelease(dictLabel);
- CFRelease(localizedDictKey);
- }
-
- /* Combine all of the macabfields in each MacabHeader into the
- * headerNames array, which (at the end of this method) is used
- * to create the MacabHeader that is returned.
- */
- headerNames = new macabfield *[length];
- for(i = 0, j = 0, k = 0; i < length; i++,k++)
- {
- while(dictHeaders[j]->getSize() == k)
- {
- j++;
- k = 0;
- }
-
- headerNames[i] = dictHeaders[j]->copy(k);
- }
-
- for(i = 0; i < numRecords; i++)
- delete dictHeaders[i];
-
- delete [] dictHeaders;
- free(dictKeys);
- free(dictValues);
- }
- break;
-
- /* Array */
- case kABArrayProperty:
- /* For non-scalars, we can only get more information if the property
- * actually exists.
- */
- if(_propertyValue != NULL)
- {
- sal_Int32 arrLength = (sal_Int32) CFArrayGetCount( (CFArrayRef) _propertyValue);
- sal_Int32 i,j,k;
- CFTypeRef arrValue;
- ABPropertyType arrType;
- MacabHeader **arrHeaders = new MacabHeader *[arrLength];
- ::rtl::OUString propertyNameString = CFStringToOUString(_propertyName);
- ::rtl::OUString arrLabelString;
- CFStringRef arrLabel;
-
- length = 0;
- /* Go through each element - since the elements here do not have
- * unique keys like the ones in dictionaries, we create a unique
- * key out of the id of the element in the array (the first
- * element gets a 0 plopped onto the end of it, the second a 1...
- * As with dictionaries, the elements could be anything, including
- * another array, so we have to run this method recursively on
- * each element, storing the resulting MacabHeader into an array,
- * which we then combine into one MacabHeader that is returned.
- */
- for(i = 0; i < arrLength; i++)
- {
- arrValue = (CFTypeRef) CFArrayGetValueAtIndex( (CFArrayRef) _propertyValue, i);
- arrType = (ABPropertyType) getABTypeFromCFType( CFGetTypeID(arrValue) );
- arrLabelString = propertyNameString + ::rtl::OUString::valueOf(i);
- arrLabel = OUStringToCFString(arrLabelString);
- arrHeaders[i] = createHeaderForProperty(arrType, arrValue, arrLabel);
- if (!arrHeaders[i])
- arrHeaders[i] = new MacabHeader();
- length += arrHeaders[i]->getSize();
- CFRelease(arrLabel);
- }
-
- headerNames = new macabfield *[length];
- for(i = 0, j = 0, k = 0; i < length; i++,k++)
- {
- while(arrHeaders[j]->getSize() == k)
- {
- j++;
- k = 0;
- }
-
- headerNames[i] = arrHeaders[j]->copy(k);
- }
- for(i = 0; i < arrLength; i++)
- delete arrHeaders[i];
-
- delete [] arrHeaders;
- }
- break;
-
- default:
- break;
-
- }
-
- /* If we succeeded at adding elements to the headerNames array, then
- * length will no longer be 0. If it is, create a new MacabHeader
- * out of the headerNames (after weeding out duplicate headers), and
- * then return the result. If the length is still 0, return NULL: we
- * failed to create a MacabHeader out of this property.
- */
- if(length != 0)
- {
- manageDuplicateHeaders(headerNames, length);
- MacabHeader *headerResult = new MacabHeader(length, headerNames);
- delete [] headerNames;
- return headerResult;
- }
- else
- return NULL;
-}
-
-// -------------------------------------------------------------------------
-void MacabRecords::manageDuplicateHeaders(macabfield **_headerNames, const sal_Int32 _length) const
-{
- /* If we have two cases of, say, phone: home, this makes it:
- * phone: home (1)
- * phone: home (2)
- */
- sal_Int32 i, j;
- sal_Int32 count;
- for(i = _length-1; i >= 0; i--)
- {
- count = 1;
- for( j = i-1; j >= 0; j--)
- {
- if(CFEqual(_headerNames[i]->value, _headerNames[j]->value))
- {
- count++;
- }
- }
-
- // duplicate!
- if(count != 1)
- {
- // There is probably a better way to do this...
- ::rtl::OUString newName = CFStringToOUString((CFStringRef) _headerNames[i]->value);
- CFRelease(_headerNames[i]->value);
- newName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (")) + ::rtl::OUString::valueOf(count) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"));
- _headerNames[i]->value = OUStringToCFString(newName);
- }
- }
-}
-
-// -------------------------------------------------------------------------
-/* Create a MacabRecord out of an ABRecord, using a given MacabHeader and
- * the record's type. We go through each property for this record type
- * then process it much like we processed the header (above), with two
- * exceptions: if we come upon something not in the header, we ignore it
- * (it's something we don't want to add), and once we find a corresponding
- * location in the header, we store the property and the property type in
- * a macabfield. (For the header, we stored the property type and the name
- * of the property as a CFString.)
- */
-MacabRecord *MacabRecords::createMacabRecord(const ABRecordRef _abrecord, const MacabHeader *_header, const CFStringRef _recordType) const
-{
- /* The new record that we will create... */
- MacabRecord *macabRecord = new MacabRecord(_header->getSize());
-
- CFArrayRef recordProperties = ABCopyArrayOfPropertiesForRecordType(addressBook, _recordType);
- sal_Int32 numProperties = (sal_Int32) CFArrayGetCount(recordProperties);
-
- sal_Int32 i;
-
- CFTypeRef propertyValue;
- ABPropertyType propertyType;
-
- CFStringRef propertyName, localizedPropertyName;
- ::rtl::OUString propertyNameString;
- for(i = 0; i < numProperties; i++)
- {
- propertyName = (CFStringRef) CFArrayGetValueAtIndex(recordProperties, i);
- localizedPropertyName = ABCopyLocalizedPropertyOrLabel(propertyName);
- propertyNameString = CFStringToOUString(localizedPropertyName);
- CFRelease(localizedPropertyName);
-
- /* Get the property's value */
- propertyValue = ABRecordCopyValue(_abrecord,propertyName);
- if(propertyValue != NULL)
- {
- propertyType = ABTypeOfProperty(addressBook, _recordType, propertyName);
- if(propertyType != kABErrorInProperty)
- insertPropertyIntoMacabRecord(propertyType, macabRecord, _header, propertyNameString, propertyValue);
-
- CFRelease(propertyValue);
- }
- }
- CFRelease(recordProperties);
- return macabRecord;
-}
-
-// -------------------------------------------------------------------------
-/* Inserts a given property into a MacabRecord. This method calls another
- * method by the same name after getting the property type (it only
- * receives the property value). It is called when we aren't given the
- * property's type already.
- */
-void MacabRecords::insertPropertyIntoMacabRecord(MacabRecord *_abrecord, const MacabHeader *_header, const ::rtl::OUString _propertyName, const CFTypeRef _propertyValue) const
-{
- CFTypeID cf_type = CFGetTypeID(_propertyValue);
- ABPropertyType ab_type = getABTypeFromCFType( cf_type );
-
- if(ab_type != kABErrorInProperty)
- insertPropertyIntoMacabRecord(ab_type, _abrecord, _header, _propertyName, _propertyValue);
-}
-
-// -------------------------------------------------------------------------
-/* Inserts a given property into a MacabRecord. This method is recursive
- * because properties can contain many sub-properties.
- */
-void MacabRecords::insertPropertyIntoMacabRecord(const ABPropertyType _propertyType, MacabRecord *_abrecord, const MacabHeader *_header, const ::rtl::OUString _propertyName, const CFTypeRef _propertyValue) const
-{
- /* If there is no value, return */
- if(_propertyValue == NULL)
- return;
-
- /* The main switch statement */
- switch(_propertyType)
- {
- /* Scalars */
- case kABStringProperty:
- case kABRealProperty:
- case kABIntegerProperty:
- case kABDateProperty:
- {
- /* Only scalars actually insert a property into the MacabRecord.
- * In all other cases, this method is called recursively until a
- * scalar type, an error, or an unknown type are found.
- * Because of that, the following checks only occur for this type.
- * We store whether we have successfully placed this property
- * into the MacabRecord (or whether an unrecoverable error occurred).
- * Then, we try over and over again to place the property into the
- * record. There are three possible results:
- * 1) Success!
- * 2) There is already a property stored at the column of this name,
- * in which case we have a duplicate header (see the method
- * manageDuplicateHeaders()). If that is the case, we add an ID
- * to the end of the column name in the same format as we do in
- * manageDuplicateHeaders() and try again.
- * 3) No column of this name exists in the header. In this case,
- * there is nothing we can do: we have failed to place this
- * property into the record.
- */
- sal_Bool bPlaced = sal_False;
- ::rtl::OUString columnName = ::rtl::OUString(_propertyName);
- sal_Int32 i = 1;
-
- // A big safeguard to prevent two fields from having the same name.
- while(bPlaced != sal_True)
- {
- sal_Int32 columnNumber = _header->getColumnNumber(columnName);
- bPlaced = sal_True;
- if(columnNumber != -1)
- {
- // collision! A property already exists here!
- if(_abrecord->get(columnNumber) != NULL)
- {
- bPlaced = sal_False;
- i++;
- columnName = ::rtl::OUString(_propertyName) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (")) + ::rtl::OUString::valueOf(i) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"));
- }
-
- // success!
- else
- {
- _abrecord->insertAtColumn(_propertyValue, _propertyType, columnNumber);
- }
- }
- }
- }
- break;
-
- /* Array */
- case kABArrayProperty:
- {
- /* An array is basically just a list of anything, so all we do
- * is go through the array, and rerun this method recursively
- * on each element.
- */
- sal_Int32 arrLength = (sal_Int32) CFArrayGetCount( (CFArrayRef) _propertyValue);
- sal_Int32 i;
- const void *arrValue;
- ::rtl::OUString newPropertyName;
-
- /* Going through each element... */
- for(i = 0; i < arrLength; i++)
- {
- arrValue = CFArrayGetValueAtIndex( (CFArrayRef) _propertyValue, i);
- newPropertyName = _propertyName + ::rtl::OUString::valueOf(i);
- insertPropertyIntoMacabRecord(_abrecord, _header, newPropertyName, arrValue);
- CFRelease(arrValue);
- }
-
- }
- break;
-
- /* Dictionary */
- case kABDictionaryProperty:
- {
- /* A dictionary is basically a hashmap. Technically, it can
- * hold any object as a key and any object as a value.
- * For our case, we assume that the key is a string (so that
- * we can use the key to get the column name and match it against
- * the header), but we don't assume anything about the value, so
- * we run this method recursively (or, rather, we run the version
- * of this method for when we don't know the object's type) until
- * we hit a scalar value.
- */
-
- sal_Int32 numRecords = (sal_Int32) CFDictionaryGetCount((CFDictionaryRef) _propertyValue);
- ::rtl::OUString dictKeyString;
- sal_Int32 i;
- ::rtl::OUString newPropertyName;
-
- /* Unfortunately, the only way to get both keys and values out
- * of a dictionary in Carbon is to get them all at once, so we
- * do that.
- */
- CFStringRef *dictKeys;
- CFStringRef localizedDictKey;
- CFTypeRef *dictValues;
- dictKeys = (CFStringRef *) malloc(sizeof(CFStringRef)*numRecords);
- dictValues = (CFTypeRef *) malloc(sizeof(CFTypeRef)*numRecords);
- CFDictionaryGetKeysAndValues((CFDictionaryRef) _propertyValue, (const void **) dictKeys, (const void **) dictValues);
-
- /* Going through each element... */
- for(i = 0; i < numRecords; i++)
- {
- localizedDictKey = ABCopyLocalizedPropertyOrLabel(dictKeys[i]);
- dictKeyString = CFStringToOUString(localizedDictKey);
- CFRelease(localizedDictKey);
- newPropertyName = _propertyName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(": ")) + fixLabel(dictKeyString);
- insertPropertyIntoMacabRecord(_abrecord, _header, newPropertyName, dictValues[i]);
- }
-
- free(dictKeys);
- free(dictValues);
- }
- break;
-
- /* Multivalue */
- case kABMultiIntegerProperty:
- case kABMultiDateProperty:
- case kABMultiStringProperty:
- case kABMultiRealProperty:
- case kABMultiDataProperty:
- case kABMultiDictionaryProperty:
- case kABMultiArrayProperty:
- {
- /* All scalar multivalues are handled in the same way. Each element
- * is a label and a value. All labels are strings
- * (kABStringProperty), and all values have the same type
- * (which is the type of the multivalue minus 255, or as
- * Carbon's list of property types has it, minus 0x100.
- * We just get the correct type, then go through each element
- * and get the label and value and print them in a list.
- */
-
- sal_Int32 i;
- sal_Int32 multiLength = ABMultiValueCount((ABMutableMultiValueRef) _propertyValue);
- CFStringRef multiLabel, localizedMultiLabel;
- CFTypeRef multiValue;
- ::rtl::OUString multiLabelString, newPropertyName;
- ABPropertyType multiType = (ABPropertyType) (ABMultiValuePropertyType((ABMutableMultiValueRef) _propertyValue) - 0x100);
-
- /* Go through each element... */
- for(i = 0; i < multiLength; i++)
- {
- /* Label and value */
- multiLabel = ABMultiValueCopyLabelAtIndex((ABMutableMultiValueRef) _propertyValue, i);
- multiValue = ABMultiValueCopyValueAtIndex((ABMutableMultiValueRef) _propertyValue, i);
-
- localizedMultiLabel = ABCopyLocalizedPropertyOrLabel(multiLabel);
- multiLabelString = CFStringToOUString(localizedMultiLabel);
- newPropertyName = _propertyName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(": ")) + fixLabel(multiLabelString);
- insertPropertyIntoMacabRecord(multiType, _abrecord, _header, newPropertyName, multiValue);
-
- /* free our variables */
- CFRelease(multiLabel);
- CFRelease(localizedMultiLabel);
- CFRelease(multiValue);
- }
- }
- break;
-
- /* Unhandled types */
- case kABErrorInProperty:
- case kABDataProperty:
- default:
- /* An error, as far as I have seen, only shows up as a type
- * returned by a function for dictionaries when the dictionary
- * holds many types of values. Since we do not use that function,
- * it shouldn't come up. I have yet to see the kABDataProperty,
- * and I am not sure how to represent it as a string anyway,
- * since it appears to just be a bunch of bytes. Assumably, if
- * these bytes made up a string, the type would be
- * kABStringProperty. I think that this is used when we are not
- * sure what the type is (e.g., it could be a string or a number).
- * That being the case, I still don't know how to represent it.
- * And, default should never come up, since we've exhausted all
- * of the possible types for ABPropertyType, but... just in case.
- */
- break;
- }
-
-}
-
-// -------------------------------------------------------------------------
-ABPropertyType MacabRecords::getABTypeFromCFType(const CFTypeID cf_type ) const
-{
- sal_Int32 i;
- for(i = 0; i < lcl_CFTypesLength; i++)
- {
- /* A match! */
- if(lcl_CFTypes[i].cf == (sal_Int32) cf_type)
- {
- return (ABPropertyType) lcl_CFTypes[i].ab;
- }
- }
- return kABErrorInProperty;
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 MacabRecords::size() const
-{
- return currentRecord;
-}
-
-// -------------------------------------------------------------------------
-MacabRecords *MacabRecords::begin()
-{
- return this;
-}
-
-// -------------------------------------------------------------------------
-MacabRecords::iterator::iterator ()
-{
-}
-
-// -------------------------------------------------------------------------
-MacabRecords::iterator::~iterator ()
-{
-}
-
-// -------------------------------------------------------------------------
-MacabRecords::iterator& MacabRecords::iterator::operator= (MacabRecords *_records)
-{
- id = 0;
- records = _records;
- return *this;
-}
-
-// -------------------------------------------------------------------------
-void MacabRecords::iterator::operator++ ()
-{
- id++;
-}
-
-// -------------------------------------------------------------------------
-sal_Bool MacabRecords::iterator::operator!= (const sal_Int32 i) const
-{
- return(id != i);
-}
-
-// -------------------------------------------------------------------------
-sal_Bool MacabRecords::iterator::operator== (const sal_Int32 i) const
-{
- return(id == i);
-}
-
-// -------------------------------------------------------------------------
-MacabRecord *MacabRecords::iterator::operator* () const
-{
- return records->getRecord(id);
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 MacabRecords::end() const
-{
- return currentRecord;
-}
-
-// -------------------------------------------------------------------------
-void MacabRecords::swap(const sal_Int32 _id1, const sal_Int32 _id2)
-{
- MacabRecord *swapRecord = records[_id1];
-
- records[_id1] = records[_id2];
- records[_id2] = swapRecord;
-}
-
-// -------------------------------------------------------------------------
-void MacabRecords::setName(const ::rtl::OUString _sName)
-{
- m_sName = _sName;
-}
-
-// -------------------------------------------------------------------------
-::rtl::OUString MacabRecords::getName() const
-{
- return m_sName;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabRecords.hxx b/connectivity/source/drivers/macab/MacabRecords.hxx
deleted file mode 100644
index 0ac946b5c0..0000000000
--- a/connectivity/source/drivers/macab/MacabRecords.hxx
+++ /dev/null
@@ -1,139 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_RECORDS_HXX_
-#define _CONNECTIVITY_MACAB_RECORDS_HXX_
-
-#include "MacabRecord.hxx"
-#include "MacabHeader.hxx"
-
-#include <premac.h>
-#include <Carbon/Carbon.h>
-#include <AddressBook/ABAddressBookC.h>
-#include <postmac.h>
-#include <com/sun/star/util/DateTime.hpp>
-
-namespace connectivity
-{
- namespace macab
- {
- /* This struct is for converting CF types to AB types (Core Foundation
- * types to Address Book types).
- */
- struct lcl_CFType {
- sal_Int32 cf;
- sal_Int32 ab;
- };
-
- class MacabRecords{
- protected:
- /* MacabRecords is, at its core, a table of macabfields, in the
- * form of a header and a list of objects of type MacabRecord.
- * It also has a unique name that refers to the name of the table.
- */
- sal_Int32 recordsSize;
- sal_Int32 currentRecord;
- CFStringRef recordType;
- MacabHeader *header;
- MacabRecord **records;
- ABAddressBookRef addressBook;
- ::rtl::OUString m_sName;
-
- /* For converting CF types to AB types */
- sal_Int32 lcl_CFTypesLength;
- lcl_CFType *lcl_CFTypes;
-
- /* For required properties */
- CFStringRef *requiredProperties;
- sal_Int32 numRequiredProperties;
-
- private:
- /* All of the private methods are for creating a MacabHeader or a
- * MacabRecord. They are used by the initialize method that goes
- * about filling a MacabRecords using all of the records in the
- * Mac OS X Address Book.
- */
- void bootstrap_CF_types();
- void bootstrap_requiredProperties();
- MacabHeader *createHeaderForProperty(const ABRecordRef _record, const CFStringRef _propertyName, const CFStringRef _recordType, const sal_Bool _isPropertyRequired) const;
- MacabHeader *createHeaderForProperty(const ABPropertyType _propertyType, const CFTypeRef _propertyValue, const CFStringRef _propertyName) const;
- void manageDuplicateHeaders(macabfield **_headerNames, const sal_Int32 _length) const;
- ABPropertyType getABTypeFromCFType(const CFTypeID cf_type ) const;
- void insertPropertyIntoMacabRecord(MacabRecord *_abrecord, const MacabHeader *_header, const ::rtl::OUString _propertyName, const CFTypeRef _propertyValue) const;
- void insertPropertyIntoMacabRecord(const ABPropertyType _propertyType, MacabRecord *_abrecord, const MacabHeader *_header, const ::rtl::OUString _propertyName, const CFTypeRef _propertyValue) const;
- public:
- MacabRecords(const ABAddressBookRef _addressBook, MacabHeader *_header, MacabRecord **_records, sal_Int32 _numRecords);
- MacabRecords(const MacabRecords *_copy);
- MacabRecords(const ABAddressBookRef _addressBook);
- ~MacabRecords();
-
- void initialize();
-
- void setHeader(MacabHeader *_header);
- MacabHeader *getHeader() const;
-
- void setName(const ::rtl::OUString _sName);
- ::rtl::OUString getName() const;
-
- MacabRecord *insertRecord(MacabRecord *_newRecord, const sal_Int32 _location);
- void insertRecord(MacabRecord *_newRecord);
- MacabRecord *getRecord(const sal_Int32 _location) const;
- void swap(const sal_Int32 _id1, const sal_Int32 _id2);
-
- macabfield *getField(const sal_Int32 _recordNumber, const sal_Int32 _columnNumber) const;
- macabfield *getField(const sal_Int32 _recordNumber, const ::rtl::OUString _columnName) const;
- sal_Int32 getFieldNumber(const ::rtl::OUString _columnName) const;
-
- sal_Int32 size() const;
-
- MacabHeader *createHeaderForRecordType(const CFArrayRef _records, const CFStringRef _recordType) const;
- MacabRecord *createMacabRecord(const ABRecordRef _abrecord, const MacabHeader *_header, const CFStringRef _recordType) const;
-
- MacabRecords *begin();
- sal_Int32 end() const;
- class iterator{
- protected:
- MacabRecords *records;
- public:
- sal_Int32 id;
- iterator& operator= (MacabRecords *_records);
- iterator();
- ~iterator();
- void operator++ ();
- sal_Bool operator!= (const sal_Int32 i) const;
- sal_Bool operator== (const sal_Int32 i) const;
- MacabRecord *operator* () const;
- };
-
- };
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_RECORDS_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabResultSet.cxx b/connectivity/source/drivers/macab/MacabResultSet.cxx
deleted file mode 100644
index 851052aa59..0000000000
--- a/connectivity/source/drivers/macab/MacabResultSet.cxx
+++ /dev/null
@@ -1,1076 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabResultSet.hxx"
-#include "MacabAddressBook.hxx"
-#include "MacabRecords.hxx"
-#include "macabutilities.hxx"
-#include "MacabResultSetMetaData.hxx"
-#include "MacabConnection.hxx"
-#include "macabcondition.hxx"
-#include "macaborder.hxx"
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/sdbcx/CompareBookmark.hpp>
-#include "TConnection.hxx"
-#include <connectivity/dbexception.hxx>
-#include "resource/sharedresources.hxx"
-#include "resource/macab_res.hrc"
-
-using namespace connectivity::macab;
-using namespace cppu;
-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::io;
-using namespace com::sun::star::util;
-
-IMPLEMENT_SERVICE_INFO(MacabResultSet, "com.sun.star.sdbc.drivers.MacabResultSet", "com.sun.star.sdbc.ResultSet");
-// -------------------------------------------------------------------------
-MacabResultSet::MacabResultSet(MacabCommonStatement* pStmt)
- : MacabResultSet_BASE(m_aMutex),
- OPropertySetHelper(MacabResultSet_BASE::rBHelper),
- m_xStatement(pStmt),
- m_xMetaData(NULL),
- m_aMacabRecords(),
- m_nRowPos(-1),
- m_bWasNull(sal_True)
-{
- m_sTableName = MacabAddressBook::getDefaultTableName();
-}
-// -------------------------------------------------------------------------
-MacabResultSet::~MacabResultSet()
-{
-}
-// -------------------------------------------------------------------------
-void MacabResultSet::allMacabRecords()
-{
- MacabConnection* pConnection = static_cast< MacabConnection *>(m_xStatement->getConnection().get());
-
- m_aMacabRecords = pConnection->getAddressBook()->getMacabRecords(m_sTableName);
-}
-// -------------------------------------------------------------------------
-void MacabResultSet::someMacabRecords(const MacabCondition *pCondition)
-{
- MacabConnection* pConnection = static_cast< MacabConnection *>(m_xStatement->getConnection().get());
- MacabRecords* allRecords;
-
- allRecords = pConnection->getAddressBook()->getMacabRecords(m_sTableName);
-
- // Bad table!! Throw exception?
- if(allRecords == NULL)
- return;
-
- if(m_aMacabRecords != NULL && m_aMacabRecords != allRecords)
- delete m_aMacabRecords;
-
- // The copy constructor copies everything but records (including the
- // maximum alloted size, which means that we'll never have to resize)
- m_aMacabRecords = new MacabRecords(allRecords);
-
- MacabRecords::iterator iterator;
-
- for (iterator = allRecords->begin();
- iterator != allRecords->end();
- ++iterator)
- {
- if (pCondition->eval(*iterator))
- m_aMacabRecords->insertRecord(*iterator);
- }
-}
-// -------------------------------------------------------------------------
-void MacabResultSet::sortMacabRecords(const MacabOrder *pOrder)
-{
- // I do this with ints rather than an iterator because the ids will
- // be changing when we change the order and ints are easier to deal
- // with (for me).
- sal_Int32 i, j, size, smallest;
- size = m_aMacabRecords->size();
-
- for(i = 0; i < size; i++)
- {
- smallest = i;
- for( j = i + 1; j < size; j++)
- {
- // if smallest > j
- if(pOrder->compare(m_aMacabRecords->getRecord(smallest),
- m_aMacabRecords->getRecord(j) ) > 0)
- {
- smallest = j;
- }
-
- }
-
- if(smallest != i)
- {
- m_aMacabRecords->swap(i,smallest);
- }
- }
-
-}
-// -------------------------------------------------------------------------
-void MacabResultSet::setTableName(::rtl::OUString _sTableName)
-{
- m_sTableName = _sTableName;
-}
-// -------------------------------------------------------------------------
-void MacabResultSet::disposing()
-{
- OPropertySetHelper::disposing();
-
- ::osl::MutexGuard aGuard(m_aMutex);
-
-m_xStatement.clear();
-m_xMetaData.clear();
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL MacabResultSet::queryInterface(const Type & rType) throw(RuntimeException)
-{
- Any aRet = OPropertySetHelper::queryInterface(rType);
- if (!aRet.hasValue())
- aRet = MacabResultSet_BASE::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::acquire() throw()
-{
- MacabResultSet_BASE::acquire();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::release() throw()
-{
- MacabResultSet_BASE::release();
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL MacabResultSet::getTypes() throw(RuntimeException)
-{
- OTypeCollection aTypes(
- ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet >*) 0),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet >*) 0),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet >*) 0));
-
- return comphelper::concatSequences(aTypes.getTypes(), MacabResultSet_BASE::getTypes());
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL MacabResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabResultSet::findColumn(const ::rtl::OUString& columnName) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- // find the first column with the name columnName
- Reference< XResultSetMetaData > xMeta = getMetaData();
- sal_Int32 nLen = xMeta->getColumnCount();
-
- for (sal_Int32 i = 1; i <= nLen; ++i)
- if (xMeta->isCaseSensitive(i) ?
- columnName == xMeta->getColumnName(i) :
- columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
- return i;
-
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(
- STR_NO_ELEMENT_NAME,
- "$name$", columnName
- ) );
- ::dbtools::throwGenericSQLException(sError , *this);
- // Unreachable:
- OSL_ASSERT(false);
- return 0;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabResultSet::getString(sal_Int32 columnIndex) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- ::rtl::OUString aRet;
- sal_Int32 nRecords = m_aMacabRecords->size();
- m_bWasNull = true;
-
- if (m_nRowPos != -1 && m_nRowPos != nRecords && m_xMetaData.is())
- {
- sal_Int32 nFieldNumber = m_xMetaData->fieldAtColumn(columnIndex);
- macabfield *aField = m_aMacabRecords->getField(m_nRowPos,nFieldNumber);
- if(aField != NULL)
- {
- if(aField->type == kABStringProperty)
- {
- aRet = CFStringToOUString( (CFStringRef) aField->value);
- m_bWasNull = false;
- }
- }
- }
-
-// Trigger an exception if m_bWasNull is true?
- return aRet;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::getBoolean(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getBoolean", NULL);
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int8 SAL_CALL MacabResultSet::getByte(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getByte", NULL);
-
- sal_Int8 nRet = 0;
- return nRet;
-}
-// -------------------------------------------------------------------------
-sal_Int16 SAL_CALL MacabResultSet::getShort(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getShort", NULL);
-
- sal_Int16 nRet = 0;
- return nRet;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabResultSet::getInt(sal_Int32 columnIndex) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nRet = 0;
- sal_Int32 nRecords = m_aMacabRecords->size();
- m_bWasNull = true;
-
- if (m_nRowPos != -1 && m_nRowPos != nRecords && m_xMetaData.is())
- {
- sal_Int32 nFieldNumber = m_xMetaData->fieldAtColumn(columnIndex);
- macabfield *aField = m_aMacabRecords->getField(m_nRowPos,nFieldNumber);
- if(aField != NULL)
- {
- if(aField->type == kABIntegerProperty)
- {
- CFNumberType numberType = CFNumberGetType( (CFNumberRef) aField->value );
- // m_bWasNull now becomes whether getting the value was successful
- // Should we check for the wrong type here, e.g., a float or a 64 bit int?
- m_bWasNull = !CFNumberGetValue((CFNumberRef) aField->value, numberType, &nRet);
- }
- }
- }
-
-// Trigger an exception if m_bWasNull is true?
- return nRet;
-}
-// -------------------------------------------------------------------------
-sal_Int64 SAL_CALL MacabResultSet::getLong(sal_Int32 columnIndex) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int64 nRet = 0;
- sal_Int32 nRecords = m_aMacabRecords->size();
- m_bWasNull = true;
-
- if (m_nRowPos != -1 && m_nRowPos != nRecords && m_xMetaData.is())
- {
- sal_Int32 nFieldNumber = m_xMetaData->fieldAtColumn(columnIndex);
- macabfield *aField = m_aMacabRecords->getField(m_nRowPos,nFieldNumber);
- if(aField != NULL)
- {
- if(aField->type == kABIntegerProperty)
- {
- CFNumberType numberType = CFNumberGetType( (CFNumberRef) aField->value );
- // m_bWasNull now becomes whether getting the value was successful
- // Should we check for the wrong type here, e.g., a float or a 32 bit int?
- m_bWasNull = !CFNumberGetValue((CFNumberRef) aField->value, numberType, &nRet);
- }
- }
- }
-
-// Trigger an exception if m_bWasNull is true?
- return nRet;
-}
-// -------------------------------------------------------------------------
-float SAL_CALL MacabResultSet::getFloat(sal_Int32 columnIndex) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- float nVal = 0;
- sal_Int32 nRecords = m_aMacabRecords->size();
- m_bWasNull = true;
-
- if (m_nRowPos != -1 && m_nRowPos != nRecords && m_xMetaData.is())
- {
- sal_Int32 nFieldNumber = m_xMetaData->fieldAtColumn(columnIndex);
- macabfield *aField = m_aMacabRecords->getField(m_nRowPos,nFieldNumber);
- if(aField != NULL)
- {
- if(aField->type == kABRealProperty)
- {
- CFNumberType numberType = CFNumberGetType( (CFNumberRef) aField->value );
- // m_bWasNull now becomes whether getting the value was successful
- // Should we check for the wrong type here, e.g., an int or a double?
- m_bWasNull = !CFNumberGetValue((CFNumberRef) aField->value, numberType, &nVal);
- }
- }
- }
-
-// Trigger an exception if m_bWasNull is true?
- return nVal;
-}
-// -------------------------------------------------------------------------
-double SAL_CALL MacabResultSet::getDouble(sal_Int32 columnIndex) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- double nVal = 0;
- sal_Int32 nRecords = m_aMacabRecords->size();
- m_bWasNull = true;
-
- if (m_nRowPos != -1 && m_nRowPos != nRecords && m_xMetaData.is())
- {
- sal_Int32 nFieldNumber = m_xMetaData->fieldAtColumn(columnIndex);
- macabfield *aField = m_aMacabRecords->getField(m_nRowPos,nFieldNumber);
- if(aField != NULL)
- {
- if(aField->type == kABRealProperty)
- {
- CFNumberType numberType = CFNumberGetType( (CFNumberRef) aField->value );
- // m_bWasNull now becomes whether getting the value was successful
- // Should we check for the wrong type here, e.g., an int or a float?
- m_bWasNull = !CFNumberGetValue((CFNumberRef) aField->value, numberType, &nVal);
- }
- }
- }
-
-// Trigger an exception if m_bWasNull is true?
- return nVal;
-}
-// -------------------------------------------------------------------------
-Sequence< sal_Int8 > SAL_CALL MacabResultSet::getBytes(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getBytes", NULL);
-
- return Sequence< sal_Int8 >();
-}
-// -------------------------------------------------------------------------
-Date SAL_CALL MacabResultSet::getDate(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getDate", NULL);
-
- Date aRet;
- return aRet;
-}
-// -------------------------------------------------------------------------
-Time SAL_CALL MacabResultSet::getTime(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getTime", NULL);
-
- Time nRet;
- return nRet;
-}
-// -------------------------------------------------------------------------
-DateTime SAL_CALL MacabResultSet::getTimestamp(sal_Int32 columnIndex) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- DateTime nRet;
- sal_Int32 nRecords = m_aMacabRecords->size();
- m_bWasNull = true;
-
- if (m_nRowPos != -1 && m_nRowPos != nRecords && m_xMetaData.is())
- {
- sal_Int32 nFieldNumber = m_xMetaData->fieldAtColumn(columnIndex);
- macabfield *aField = m_aMacabRecords->getField(m_nRowPos,nFieldNumber);
- if(aField != NULL)
- {
- if(aField->type == kABDateProperty)
- {
- nRet = CFDateToDateTime((CFDateRef) aField->value);
- m_bWasNull = false;
- }
- }
- }
-
-// Trigger an exception if m_bWasNull is true?
- return nRet;
-}
-// -------------------------------------------------------------------------
-Reference< XInputStream > SAL_CALL MacabResultSet::getBinaryStream(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getBinaryStream", NULL);
-
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XInputStream > SAL_CALL MacabResultSet::getCharacterStream(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getCharacterStream", NULL);
-
- return NULL;
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL MacabResultSet::getObject(sal_Int32, const Reference< ::com::sun::star::container::XNameAccess >&) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getObject", NULL);
-
- return Any();
-}
-// -------------------------------------------------------------------------
-Reference< XRef > SAL_CALL MacabResultSet::getRef(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getRef", NULL);
-
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL MacabResultSet::getBlob(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getBlob", NULL);
-
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XClob > SAL_CALL MacabResultSet::getClob(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getClob", NULL);
-
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XArray > SAL_CALL MacabResultSet::getArray(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
-::dbtools::throwFunctionNotSupportedException("getArray", NULL);
-
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSetMetaData > SAL_CALL MacabResultSet::getMetaData() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- if (!m_xMetaData.is())
- m_xMetaData = new MacabResultSetMetaData(m_xStatement->getOwnConnection(), m_sTableName);
-
- Reference< XResultSetMetaData > xMetaData = m_xMetaData.get();
- return xMetaData;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::isBeforeFirst() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- if (m_nRowPos == -1)
- return sal_True;
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::isAfterLast() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nRecords = m_aMacabRecords->size();
- if (m_nRowPos == nRecords)
- return sal_True;
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::isFirst() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- if (m_nRowPos == 0)
- return sal_True;
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::isLast() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nRecords = m_aMacabRecords->size();
- if (m_nRowPos == nRecords - 1)
- return sal_True;
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::beforeFirst() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- // move before the first row
- m_nRowPos = -1;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::afterLast() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- // move after the last row
- sal_Int32 nRecords = m_aMacabRecords->size();
- m_nRowPos = nRecords;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::close() throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
- }
- dispose();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::first() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nRecords = m_aMacabRecords->size();
- if (nRecords == 0)
- return sal_False;
-
- m_nRowPos = 0;
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::last() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nRecords = m_aMacabRecords->size();
- if (nRecords == 0)
- return sal_False;
-
- m_nRowPos = nRecords - 1;
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabResultSet::getRow() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- return m_nRowPos;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::absolute(sal_Int32 row) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nRecords = m_aMacabRecords->size();
- if (row <= -1 ||
- row >= nRecords)
- return sal_False;
-
- m_nRowPos = row;
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::relative(sal_Int32 row) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- return absolute(m_nRowPos + row);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::next() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- return absolute(m_nRowPos + 1);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::previous() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- return absolute(m_nRowPos - 1);
-}
-// -------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL MacabResultSet::getStatement() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- Reference< XStatement > xStatement = m_xStatement.get();
- return xStatement;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::rowDeleted() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::rowInserted() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::rowUpdated() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::wasNull() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- return m_bWasNull;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::cancel() throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::clearWarnings() throw(SQLException, RuntimeException)
-{
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL MacabResultSet::getWarnings() throw(SQLException, RuntimeException)
-{
- return Any();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::insertRow() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- // you only have to implement this if you want to insert new rows
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateRow() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- // only when you allow updates
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::deleteRow() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::cancelRowUpdates() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::moveToInsertRow() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- // only when you allow inserts
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::moveToCurrentRow() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateNull(sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateBoolean(sal_Int32, sal_Bool) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateByte(sal_Int32, sal_Int8) throw(SQLException, RuntimeException)
-{
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateShort(sal_Int32, sal_Int16) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateInt(sal_Int32, sal_Int32) throw(SQLException, RuntimeException)
-{
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateLong(sal_Int32, sal_Int64) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -----------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateFloat(sal_Int32, float) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateDouble(sal_Int32, double) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateString(sal_Int32, const ::rtl::OUString&) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateBytes(sal_Int32, const Sequence< sal_Int8 >&) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateDate(sal_Int32, const Date&) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateTime(sal_Int32, const Time&) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateTimestamp(sal_Int32, const DateTime&) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateBinaryStream(sal_Int32, const Reference< XInputStream >&, sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateCharacterStream(sal_Int32, const Reference< XInputStream >&, sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::refreshRow() throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateObject(sal_Int32, const Any&) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabResultSet::updateNumericObject(sal_Int32, const Any&, sal_Int32) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-}
-// -------------------------------------------------------------------------
-// XRowLocate
-Any SAL_CALL MacabResultSet::getBookmark() throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nRecords = m_aMacabRecords->size();
-
- if (m_nRowPos != -1 && m_nRowPos != nRecords)
- {
- macabfield *uidField = m_aMacabRecords->getField(m_nRowPos,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UID")));
- if(uidField != NULL)
- {
- if(uidField->type == kABStringProperty)
- {
- return makeAny(CFStringToOUString( (CFStringRef) uidField->value ));
- }
- }
- }
- return Any();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::moveToBookmark(const Any& bookmark) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- ::rtl::OUString sBookmark = comphelper::getString(bookmark);
- sal_Int32 nRecords = m_aMacabRecords->size();
-
- for (sal_Int32 nRow = 0; nRow < nRecords; nRow++)
- {
- macabfield *uidField = m_aMacabRecords->getField(m_nRowPos,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UID")));
- if(uidField != NULL)
- {
- if(uidField->type == kABStringProperty)
- {
- ::rtl::OUString sUniqueIdentifier = CFStringToOUString( (CFStringRef) uidField->value );
- if (sUniqueIdentifier == sBookmark)
- {
- m_nRowPos = nRow;
- return sal_True;
- }
- }
- }
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- sal_Int32 nRowSave = m_nRowPos;
-
- if (moveToBookmark(bookmark))
- {
- sal_Int32 nRecords = m_aMacabRecords->size();
-
- m_nRowPos += rows;
-
- if (-1 < m_nRowPos && m_nRowPos < nRecords)
- return sal_True;
- }
-
- m_nRowPos = nRowSave;
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabResultSet::compareBookmarks(const Any& firstItem, const Any& secondItem) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- ::rtl::OUString sFirst = comphelper::getString(firstItem);
- ::rtl::OUString sSecond = comphelper::getString(secondItem);
-
- if (sFirst < sSecond)
- return CompareBookmark::LESS;
- if (sFirst > sSecond)
- return CompareBookmark::GREATER;
- return CompareBookmark::EQUAL;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSet::hasOrderedBookmarks() throw( SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabResultSet::hashBookmark(const Any& bookmark) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- ::rtl::OUString sBookmark = comphelper::getString(bookmark);
-
- return sBookmark.hashCode();
-}
-// -------------------------------------------------------------------------
-// XDeleteRows
-Sequence< sal_Int32 > SAL_CALL MacabResultSet::deleteRows(const Sequence< Any >&) throw( SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed);
-
- return Sequence< sal_Int32 >();
-}
-// -------------------------------------------------------------------------
-IPropertyArrayHelper* MacabResultSet::createArrayHelper() const
-{
- Sequence< Property > aProps(6);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY);
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY);
-
- return new OPropertyArrayHelper(aProps);
-}
-// -------------------------------------------------------------------------
-IPropertyArrayHelper & MacabResultSet::getInfoHelper()
-{
- return *static_cast<MacabResultSet*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool MacabResultSet::convertFastPropertyValue(
- Any &,
- Any &,
- sal_Int32 nHandle,
- const Any& )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- switch (nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw ::com::sun::star::lang::IllegalArgumentException();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- default:
- ;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-void MacabResultSet::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& )
- throw (Exception)
-{
- switch (nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw Exception();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- break;
- case PROPERTY_ID_FETCHSIZE:
- break;
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void MacabResultSet::getFastPropertyValue(
- Any& _rValue,
- sal_Int32 nHandle) const
-{
- switch (nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- _rValue <<= (sal_Bool)sal_False;
- break;
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- ;
- }
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabResultSet.hxx b/connectivity/source/drivers/macab/MacabResultSet.hxx
deleted file mode 100644
index 029aa6c13a..0000000000
--- a/connectivity/source/drivers/macab/MacabResultSet.hxx
+++ /dev/null
@@ -1,229 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_RESULTSET_HXX_
-#define _CONNECTIVITY_MACAB_RESULTSET_HXX_
-
-#include "MacabStatement.hxx"
-#include "MacabResultSetMetaData.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
-#include <com/sun/star/sdbc/XColumnLocate.hpp>
-#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
-#include <com/sun/star/sdbc/XRowUpdate.hpp>
-#include <com/sun/star/sdbcx/XRowLocate.hpp>
-#include <com/sun/star/sdbcx/XDeleteRows.hpp>
-#include <cppuhelper/compbase12.hxx>
-
-namespace connectivity
-{
- namespace macab
- {
- /*
- ** MacabResultSet
- */
- typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet,
- ::com::sun::star::sdbc::XRow,
- ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
- ::com::sun::star::util::XCancellable,
- ::com::sun::star::sdbc::XWarningsSupplier,
- ::com::sun::star::sdbc::XResultSetUpdate,
- ::com::sun::star::sdbc::XRowUpdate,
- ::com::sun::star::sdbcx::XRowLocate,
- ::com::sun::star::sdbcx::XDeleteRows,
- ::com::sun::star::sdbc::XCloseable,
- ::com::sun::star::sdbc::XColumnLocate,
- ::com::sun::star::lang::XServiceInfo> MacabResultSet_BASE;
- class MacabRecords;
-
- class MacabResultSet : public comphelper::OBaseMutex,
- public MacabResultSet_BASE,
- public ::cppu::OPropertySetHelper,
- public comphelper::OPropertyArrayUsageHelper<MacabResultSet>
- {
- protected:
- ::rtl::Reference< MacabCommonStatement > m_xStatement; // the statement that has created this result set
- ::rtl::Reference< MacabResultSetMetaData > m_xMetaData; // the description of the columns in this result set
- MacabRecords * m_aMacabRecords; // address book entries matching the query
- sal_Int32 m_nRowPos; // the current row within the result set
- sal_Bool m_bWasNull; // last entry retrieved from this result set was NULL
- ::rtl::OUString m_sTableName;
-
- // OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
-
- // OPropertySetHelper
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
-
- virtual sal_Bool SAL_CALL convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue)
- throw (::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue)
- throw (::com::sun::star::uno::Exception);
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle) const;
-
- // you can't delete objects of this type
- virtual ~MacabResultSet();
-
- public:
- DECLARE_SERVICE_INFO();
-
- MacabResultSet(MacabCommonStatement *pStmt);
-
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *()
- {
- return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(MacabResultSet_BASE*) this);
- }
-
- void allMacabRecords();
- void someMacabRecords(const class MacabCondition *pCondition);
- void sortMacabRecords(const class MacabOrder *pOrder);
- void setTableName(const ::rtl::OUString _sTableName);
-
- // ::cppu::OComponentHelper
- virtual void SAL_CALL disposing(void);
-
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
-
- // XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XResultSet
- virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XRow
- virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XResultSetMetaDataSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XCancellable
- virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XWarningsSupplier
- virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XResultSetUpdate
- virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XRowUpdate
- virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XColumnLocate
- virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XRowLocate
- virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& firstItem, const ::com::sun::star::uno::Any& secondItem ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XDeleteRows
- virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_RESULTSET_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx b/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx
deleted file mode 100644
index 064065213c..0000000000
--- a/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx
+++ /dev/null
@@ -1,227 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabResultSetMetaData.hxx"
-#include "MacabHeader.hxx"
-#include "MacabRecords.hxx"
-#include "MacabAddressBook.hxx"
-#include "macabutilities.hxx"
-#include "resource/macab_res.hrc"
-
-using namespace connectivity::macab;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::sdbc;
-
-MacabResultSetMetaData::MacabResultSetMetaData(MacabConnection* _pConnection, ::rtl::OUString _sTableName)
- : m_pConnection(_pConnection),
- m_sTableName(_sTableName),
- m_aMacabFields()
-{
-}
-// -------------------------------------------------------------------------
-MacabResultSetMetaData::~MacabResultSetMetaData()
-{
-}
-// -------------------------------------------------------------------------
-void MacabResultSetMetaData::setMacabFields(const ::rtl::Reference<connectivity::OSQLColumns> &xColumns) throw(SQLException)
-{
- OSQLColumns::Vector::const_iterator aIter;
- static const ::rtl::OUString aName(RTL_CONSTASCII_USTRINGPARAM("Name"));
- MacabRecords *aRecords;
- MacabHeader *aHeader;
-
- aRecords = m_pConnection->getAddressBook()->getMacabRecords(m_sTableName);
-
- // In case, somehow, we don't have anything with the name m_sTableName
- if(aRecords == NULL)
- {
- impl_throwError(STR_NO_TABLE);
- }
-
- aHeader = aRecords->getHeader();
-
- for (aIter = xColumns->get().begin(); aIter != xColumns->get().end(); ++aIter)
- {
- ::rtl::OUString aFieldName;
- sal_uInt32 nFieldNumber;
-
- (*aIter)->getPropertyValue(aName) >>= aFieldName;
- nFieldNumber = aHeader->getColumnNumber(aFieldName);
- m_aMacabFields.push_back(nFieldNumber);
- }
-
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabResultSetMetaData::getColumnDisplaySize(sal_Int32 column) throw(SQLException, RuntimeException)
-{
- // For now, all columns are the same size.
- return 50;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabResultSetMetaData::getColumnType(sal_Int32 column) throw(SQLException, RuntimeException)
-{
- MacabRecords *aRecords;
- MacabHeader *aHeader;
- macabfield *aField;
-
- aRecords = m_pConnection->getAddressBook()->getMacabRecords(m_sTableName);
-
- // In case, somehow, we don't have anything with the name m_sTableName
- if(aRecords == NULL)
- {
- impl_throwError(STR_NO_TABLE);
- }
-
- aHeader = aRecords->getHeader();
- aField = aHeader->get(column-1);
-
- if(aField == NULL)
- {
- ::dbtools::throwInvalidIndexException(*this,Any());
- return -1;
- }
-
- return ABTypeToDataType(aField->type);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabResultSetMetaData::getColumnCount() throw(SQLException, RuntimeException)
-{
- return m_aMacabFields.size();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSetMetaData::isCaseSensitive(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabResultSetMetaData::getSchemaName(sal_Int32) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabResultSetMetaData::getColumnName(sal_Int32 column) throw(SQLException, RuntimeException)
-{
- sal_uInt32 nFieldNumber = m_aMacabFields[column - 1];
- MacabRecords *aRecords;
- MacabHeader *aHeader;
-
- aRecords = m_pConnection->getAddressBook()->getMacabRecords(m_sTableName);
-
- // In case, somehow, we don't have anything with the name m_sTableName
- if(aRecords == NULL)
- {
- impl_throwError(STR_NO_TABLE);
- }
-
- aHeader = aRecords->getHeader();
- ::rtl::OUString aName = aHeader->getString(nFieldNumber);
-
- return aName;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabResultSetMetaData::getTableName(sal_Int32) throw(SQLException, RuntimeException)
-{
- return m_sTableName;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabResultSetMetaData::getCatalogName(sal_Int32) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabResultSetMetaData::getColumnTypeName(sal_Int32) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabResultSetMetaData::getColumnLabel(sal_Int32) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MacabResultSetMetaData::getColumnServiceName(sal_Int32) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSetMetaData::isCurrency(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSetMetaData::isAutoIncrement(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSetMetaData::isSigned(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabResultSetMetaData::getPrecision(sal_Int32) throw(SQLException, RuntimeException)
-{
- return 0;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabResultSetMetaData::getScale(sal_Int32) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabResultSetMetaData::isNullable(sal_Int32) throw(SQLException, RuntimeException)
-{
- return (sal_Int32) sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSetMetaData::isSearchable(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSetMetaData::isReadOnly(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSetMetaData::isDefinitelyWritable(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabResultSetMetaData::isWritable(sal_Int32) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabResultSetMetaData.hxx b/connectivity/source/drivers/macab/MacabResultSetMetaData.hxx
deleted file mode 100644
index 2140a03b30..0000000000
--- a/connectivity/source/drivers/macab/MacabResultSetMetaData.hxx
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_RESULTSETMETADATA_HXX_
-#define _CONNECTIVITY_MACAB_RESULTSETMETADATA_HXX_
-
-#include "MacabConnection.hxx"
-#include <connectivity/CommonTools.hxx>
-#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <connectivity/dbexception.hxx>
-#include <rtl/ref.hxx>
-
-namespace connectivity
-{
- namespace macab
- {
- /*
- ** MacabResultSetMetaData
- */
- typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> MacabResultSetMetaData_BASE;
-
- class MacabResultSetMetaData : public MacabResultSetMetaData_BASE
- {
- MacabConnection* m_pConnection;
- ::rtl::OUString m_sTableName;
- ::std::vector<sal_Int32> m_aMacabFields; // for each selected column, contains the number
- // of the corresponding AddressBook field
-
- protected:
- virtual ~MacabResultSetMetaData();
-
- public:
- MacabResultSetMetaData(MacabConnection* _pConnection, ::rtl::OUString _sTableName);
-
- // avoid ambigous cast error from the compiler
- inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw()
- { return this; }
-
- void setMacabFields(
- const ::rtl::Reference<connectivity::OSQLColumns> &xColumns) throw(::com::sun::star::sdbc::SQLException);
- inline sal_uInt32 fieldAtColumn(sal_Int32 columnIndex) const
- { return m_aMacabFields[columnIndex - 1]; }
-
- virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_RESULTSETMETADATA_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabServices.cxx b/connectivity/source/drivers/macab/MacabServices.cxx
deleted file mode 100644
index 3319c19cdc..0000000000
--- a/connectivity/source/drivers/macab/MacabServices.cxx
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabDriver.hxx"
-#include <cppuhelper/factory.hxx>
-
-using namespace connectivity::macab;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount* _pTemp
- );
-
-//---------------------------------------------------------------------------------------
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- sal_Char const* pImplementationName
- )
- : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- inline
- sal_Bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
- }
- catch(...)
- {
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void*)
-{
- void* pRet = 0;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- MacabDriver::getImplementationName_Static(),
- MacabDriver::getSupportedServiceNames_Static(),
- &MacabDriver::Create,
- ::cppu::createSingleFactory)
- ;
-
- if (aReq.xRet.is())
- aReq.xRet->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabStatement.cxx b/connectivity/source/drivers/macab/MacabStatement.cxx
deleted file mode 100644
index fa2654131f..0000000000
--- a/connectivity/source/drivers/macab/MacabStatement.cxx
+++ /dev/null
@@ -1,614 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabStatement.hxx"
-#include "MacabConnection.hxx"
-#include "MacabAddressBook.hxx"
-#include "MacabDriver.hxx"
-#include "MacabResultSet.hxx"
-#include "MacabResultSetMetaData.hxx"
-#include "macabcondition.hxx"
-#include "macaborder.hxx"
-#include "TConnection.hxx"
-#include <connectivity/dbexception.hxx>
-#include "resource/sharedresources.hxx"
-#include "resource/macab_res.hrc"
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-using namespace connectivity::macab;
-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;
-
-namespace connectivity
-{
- namespace macab
- {
- void impl_throwError(sal_uInt16 _nErrorId)
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(_nErrorId) );
- ::dbtools::throwGenericSQLException(sError,NULL);
- }
- }
-}
-
-IMPLEMENT_SERVICE_INFO(MacabStatement, "com.sun.star.sdbc.drivers.MacabStatement", "com.sun.star.sdbc.Statement");
-//------------------------------------------------------------------------------
-MacabCommonStatement::MacabCommonStatement(MacabConnection* _pConnection )
- : MacabCommonStatement_BASE(m_aMutex),
- OPropertySetHelper(MacabCommonStatement_BASE::rBHelper),
- m_aParser(_pConnection->getDriver()->getMSFactory()),
- m_aSQLIterator(_pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL ),
- m_pParseTree(NULL),
- m_pConnection(_pConnection),
- rBHelper(MacabCommonStatement_BASE::rBHelper)
-{
- m_pConnection->acquire();
-}
-// -----------------------------------------------------------------------------
-MacabCommonStatement::~MacabCommonStatement()
-{
-}
-// -----------------------------------------------------------------------------
-void MacabCommonStatement::disposing()
-{
- MacabCommonStatement_BASE::disposing();
-}
-// -----------------------------------------------------------------------------
-void MacabCommonStatement::resetParameters() const throw(::com::sun::star::sdbc::SQLException)
-{
- impl_throwError(STR_PARA_ONLY_PREPARED);
-}
-// -----------------------------------------------------------------------------
-void MacabCommonStatement::getNextParameter(::rtl::OUString &) const throw(::com::sun::star::sdbc::SQLException)
-{
- impl_throwError(STR_PARA_ONLY_PREPARED);
-}
-// -----------------------------------------------------------------------------
-MacabCondition *MacabCommonStatement::analyseWhereClause(const OSQLParseNode *pParseNode) const throw(SQLException)
-{
- if (pParseNode->count() == 3)
- {
- const OSQLParseNode *pLeft = pParseNode->getChild(0),
- *pMiddle = pParseNode->getChild(1),
- *pRight = pParseNode->getChild(2);
-
- // WHERE ( ... ) ?
- if (SQL_ISPUNCTUATION(pLeft, "(") && SQL_ISPUNCTUATION(pRight, ")"))
- {
- return analyseWhereClause(pMiddle);
- }
- else if (SQL_ISRULE(pParseNode, comparison_predicate))
- {
- if (pLeft->isToken() && pRight->isToken())
- {
- switch (pMiddle->getNodeType())
- {
- case SQL_NODE_EQUAL:
- // WHERE 0 = 1
- return new MacabConditionConstant(pLeft->getTokenValue() == pRight->getTokenValue());
-
- case SQL_NODE_NOTEQUAL:
- // WHERE 0 <> 1
- // (might not be correct SQL... don't care, handling anyway)
- return new MacabConditionConstant(pLeft->getTokenValue() != pRight->getTokenValue());
-
- default:
- break;
- }
- }
- else if (SQL_ISRULE(pLeft, column_ref))
- {
- ::rtl::OUString sColumnName,
- sTableRange;
-
- m_aSQLIterator.getColumnRange(pLeft, sColumnName, sTableRange);
-
- if (pRight->isToken() || SQL_ISRULE(pRight, parameter))
- {
- ::rtl::OUString sMatchString;
-
- if (pRight->isToken()) // WHERE Name = 'Doe'
- sMatchString = pRight->getTokenValue();
- else if (SQL_ISRULE(pRight, parameter)) // WHERE Name = ?
- getNextParameter(sMatchString);
-
- switch (pMiddle->getNodeType())
- {
- case SQL_NODE_EQUAL:
- // WHERE Name = 'Smith'
- return new MacabConditionEqual(m_pHeader, sColumnName, sMatchString);
-
- case SQL_NODE_NOTEQUAL:
- // WHERE Name <> 'Jones'
- return new MacabConditionDifferent(m_pHeader, sColumnName, sMatchString);
-
- default:
- break;
- }
- }
- }
- }
- else if (SQL_ISRULE(pParseNode, search_condition))
- {
- if (SQL_ISTOKEN(pMiddle, OR))
- {
- // WHERE Name = 'Smith' OR Name = 'Jones'
- return new MacabConditionOr(
- analyseWhereClause(pLeft),
- analyseWhereClause(pRight));
- }
- }
- else if (SQL_ISRULE(pParseNode, boolean_term))
- {
- if (SQL_ISTOKEN(pMiddle, AND))
- {
- // WHERE Name = 'Smith' AND "Given Name" = 'Peter'
- return new MacabConditionAnd(
- analyseWhereClause(pLeft),
- analyseWhereClause(pRight));
- }
- }
- }
- else if (SQL_ISRULE(pParseNode, test_for_null) || SQL_ISRULE(pParseNode, like_predicate))
- {
- const OSQLParseNode *pLeft = pParseNode->getChild(0);
- const OSQLParseNode* pPart2 = pParseNode->getChild(1);
- const OSQLParseNode *pMiddleLeft = pPart2->getChild(0),
- *pMiddleRight = pPart2->getChild(1),
- *pRight = pPart2->getChild(2);
-
- if (SQL_ISRULE(pParseNode, test_for_null))
- {
- if (SQL_ISRULE(pLeft, column_ref) &&
- SQL_ISTOKEN(pMiddleLeft, IS) &&
- SQL_ISTOKEN(pRight, NULL))
- {
- ::rtl::OUString sColumnName,
- sTableRange;
-
- m_aSQLIterator.getColumnRange(pLeft, sColumnName, sTableRange);
-
- if (SQL_ISTOKEN(pMiddleRight, NOT))
- {
- // WHERE "Mobile Phone" IS NOT NULL
- return new MacabConditionNotNull(m_pHeader, sColumnName);
- }
- else
- {
- // WHERE "Mobile Phone" IS NULL
- return new MacabConditionNull(m_pHeader, sColumnName);
- }
- }
- }
- else if (SQL_ISRULE(pParseNode, like_predicate))
- {
- if (SQL_ISRULE(pLeft, column_ref))
- {
- ::rtl::OUString sColumnName,
- sTableRange;
-
- m_aSQLIterator.getColumnRange(pLeft, sColumnName, sTableRange);
-
- if (pMiddleRight->isToken() || SQL_ISRULE(pMiddleRight, parameter))
- {
- ::rtl::OUString sMatchString;
-
- if (pMiddleRight->isToken()) // WHERE Name LIKE 'Sm%'
- sMatchString = pMiddleRight->getTokenValue();
- else if (SQL_ISRULE(pMiddleRight, parameter)) // WHERE Name LIKE ?
- getNextParameter(sMatchString);
-
- return new MacabConditionSimilar(m_pHeader, sColumnName, sMatchString);
- }
- }
- }
- }
- impl_throwError(STR_QUERY_TOO_COMPLEX);
- // Unreachable:
- OSL_ASSERT(false);
- return 0;
-}
-// -----------------------------------------------------------------------------
-MacabOrder *MacabCommonStatement::analyseOrderByClause(const OSQLParseNode *pParseNode) const throw(SQLException)
-{
- if (SQL_ISRULE(pParseNode, ordering_spec_commalist))
- {
- MacabComplexOrder *list = new MacabComplexOrder();
- sal_uInt32 n = pParseNode->count();
-
- // Iterate through the ordering columns
- for (sal_uInt32 i = 0; i < n; i++)
- {
- list->addOrder
- (analyseOrderByClause(pParseNode->getChild(i)));
- }
-
- return list;
- }
- else if (SQL_ISRULE(pParseNode, ordering_spec))
- {
- if (pParseNode->count() == 2)
- {
- OSQLParseNode* pColumnRef = pParseNode->getChild(0);
- OSQLParseNode* pAscendingDescending = pParseNode->getChild(1);
-
- if (SQL_ISRULE(pColumnRef, column_ref))
- {
- if (pColumnRef->count() == 3)
- pColumnRef = pColumnRef->getChild(2);
-
- if (pColumnRef->count() == 1)
- {
- ::rtl::OUString sColumnName =
- pColumnRef->getChild(0)->getTokenValue();
- sal_Bool bAscending =
- SQL_ISTOKEN(pAscendingDescending, DESC)?
- sal_False:
- sal_True;
-
- return new MacabSimpleOrder(m_pHeader, sColumnName, bAscending);
- }
- }
- }
- }
- impl_throwError(STR_QUERY_TOO_COMPLEX);
- // Unreachable:
- OSL_ASSERT(false);
- return 0;
-}
-//------------------------------------------------------------------------------
-::rtl::OUString MacabCommonStatement::getTableName() const
-{
- const OSQLTables& xTabs = m_aSQLIterator.getTables();
-
- if( xTabs.empty() )
- return ::rtl::OUString();
-
- // can only deal with one table at a time
- if(xTabs.size() > 1 || m_aSQLIterator.hasErrors() )
- return ::rtl::OUString();
-
- return xTabs.begin()->first;
-}
-//------------------------------------------------------------------------------
-void MacabCommonStatement::setMacabFields(MacabResultSet *pResult) const throw(SQLException)
-{
- ::rtl::Reference<connectivity::OSQLColumns> xColumns; // selected columns
- MacabResultSetMetaData *pMeta; // meta information - holds the list of AddressBook fields
-
- xColumns = m_aSQLIterator.getSelectColumns();
- if (!xColumns.is())
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(
- STR_INVALID_COLUMN_SELECTION
- ) );
- ::dbtools::throwGenericSQLException(sError,NULL);
- }
- pMeta = static_cast<MacabResultSetMetaData *>(pResult->getMetaData().get());
- pMeta->setMacabFields(xColumns);
-}
-// -------------------------------------------------------------------------
-void MacabCommonStatement::selectRecords(MacabResultSet *pResult) const throw(SQLException)
-{
- const OSQLParseNode *pParseNode;
- MacabCondition *pCondition;
-
- pParseNode = m_aSQLIterator.getWhereTree();
- if (pParseNode != NULL)
- {
- if (SQL_ISRULE(pParseNode, where_clause))
- {
- // Since we don't support parameters, don't reset them. If we ever
- // support them, uncomment this line and fix resetParameters.
- //resetParameters();
- pParseNode = pParseNode->getChild(1);
- pCondition = analyseWhereClause(pParseNode);
- if (pCondition->isAlwaysTrue())
- pResult->allMacabRecords();
- else if (!pCondition->isAlwaysFalse())
- pResult->someMacabRecords(pCondition);
- delete pCondition;
- return;
- }
- }
-
- // no WHERE clause: get all rows
- pResult->allMacabRecords();
-}
-// -------------------------------------------------------------------------
-void MacabCommonStatement::sortRecords(MacabResultSet *pResult) const throw(SQLException)
-{
- const OSQLParseNode *pParseNode;
- MacabOrder *pOrder;
-
- pParseNode = m_aSQLIterator.getOrderTree();
- if (pParseNode != NULL)
- {
- if (SQL_ISRULE(pParseNode, opt_order_by_clause))
- {
- pParseNode = pParseNode->getChild(2);
- pOrder = analyseOrderByClause(pParseNode);
- pResult->sortMacabRecords(pOrder);
- delete pOrder;
- }
- }
-}
-//-----------------------------------------------------------------------------
-Any SAL_CALL MacabCommonStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = MacabCommonStatement_BASE::queryInterface(rType);
- if (!aRet.hasValue())
- aRet = OPropertySetHelper::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL MacabCommonStatement::getTypes( ) throw(RuntimeException)
-{
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
- ::getCppuType( (const Reference< XFastPropertySet > *)0 ),
- ::getCppuType( (const Reference< XPropertySet > *)0 ));
-
- return comphelper::concatSequences(aTypes.getTypes(),MacabCommonStatement_BASE::getTypes());
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabCommonStatement::cancel( ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
- // cancel the current sql statement
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabCommonStatement::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
-
- }
- dispose();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL MacabCommonStatement::execute(
- const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
-
- Reference< XResultSet > xRS = executeQuery(sql);
-
- return xRS.is();
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL MacabCommonStatement::executeQuery(
- const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
-
-OSL_TRACE("Mac OS Address book - SQL Request: %s", OUtoCStr(sql));
-
- MacabResultSet* pResult = new MacabResultSet(this);
- Reference< XResultSet > xRS = pResult;
- ::rtl::OUString aErr;
-
- m_pParseTree = m_aParser.parseTree(aErr, sql);
- if (m_pParseTree == NULL)
- throw SQLException(aErr, *this, aErr, 0, Any());
-
- m_aSQLIterator.setParseTree(m_pParseTree);
- m_aSQLIterator.traverseAll();
- switch (m_aSQLIterator.getStatementType())
- {
- case SQL_STATEMENT_SELECT:
- {
- ::rtl::OUString sTableName = getTableName(); // FROM which table ?
- if (sTableName.getLength() != 0) // a match
- {
- MacabRecords *aRecords;
- aRecords = m_pConnection->getAddressBook()->getMacabRecords(sTableName);
-
- // In case, somehow, we don't have anything with the name m_sTableName
- if(aRecords == NULL)
- {
- impl_throwError(STR_NO_TABLE);
- }
- else
- {
- m_pHeader = aRecords->getHeader();
-
- pResult->setTableName(sTableName);
-
- setMacabFields(pResult); // SELECT which columns ?
- selectRecords(pResult); // WHERE which condition ?
- sortRecords(pResult); // ORDER BY which columns ?
- }
-// To be continued: DISTINCT
-// etc...
- }
- }
- break;
-
- default:
-// To be continued: UPDATE
-// DELETE
-// etc...
- impl_throwError(STR_QUERY_TOO_COMPLEX);
- }
-
- m_xResultSet = Reference<XResultSet>(pResult);
- return xRS;
-}
-// -------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL MacabCommonStatement::getConnection( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
-
- // just return our connection here
- return (Reference< XConnection >) m_pConnection;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL MacabCommonStatement::executeUpdate( const ::rtl::OUString& ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
-
- // the return values gives information about how many rows are affected by executing the sql statement
- return 0;
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL MacabCommonStatement::getWarnings( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
-
- return makeAny(m_aLastWarning);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL MacabCommonStatement::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed);
-
- m_aLastWarning = SQLWarning();
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* MacabCommonStatement::createArrayHelper( ) const
-{
- // 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;
- DECL_PROP0(CURSORNAME, ::rtl::OUString);
- DECL_BOOL_PROP0(ESCAPEPROCESSING);
- DECL_PROP0(FETCHDIRECTION,sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP0(MAXFIELDSIZE,sal_Int32);
- DECL_PROP0(MAXROWS, sal_Int32);
- DECL_PROP0(QUERYTIMEOUT,sal_Int32);
- DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32);
- DECL_PROP0(RESULTSETTYPE,sal_Int32);
- DECL_BOOL_PROP0(USEBOOKMARKS);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & MacabCommonStatement::getInfoHelper()
-{
- return *const_cast<MacabCommonStatement*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool MacabCommonStatement::convertFastPropertyValue(
- Any &,
- Any &,
- sal_Int32,
- const Any&) throw (::com::sun::star::lang::IllegalArgumentException)
-{
- sal_Bool bConverted = sal_False;
- // here we have to try to convert
- return bConverted;
-}
-// -------------------------------------------------------------------------
-void MacabCommonStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any&) throw (Exception)
-{
- // set the value to whatever is nescessary
- switch (nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- case PROPERTY_ID_MAXFIELDSIZE:
- case PROPERTY_ID_MAXROWS:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- case PROPERTY_ID_ESCAPEPROCESSING:
- case PROPERTY_ID_USEBOOKMARKS:
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void MacabCommonStatement::getFastPropertyValue(Any&,sal_Int32 nHandle) const
-{
- switch (nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- case PROPERTY_ID_MAXFIELDSIZE:
- case PROPERTY_ID_MAXROWS:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- case PROPERTY_ID_ESCAPEPROCESSING:
- case PROPERTY_ID_USEBOOKMARKS:
- default:
- ;
- }
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL MacabCommonStatement::acquire() throw()
-{
- MacabCommonStatement_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL MacabCommonStatement::release() throw()
-{
- MacabCommonStatement_BASE::release();
-}
-// -----------------------------------------------------------------------------
-Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL MacabCommonStatement::getPropertySetInfo( ) throw(RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-MacabStatement::MacabStatement(MacabConnection* _pConnection)
- : MacabStatement_BASE(_pConnection)
-{
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabStatement.hxx b/connectivity/source/drivers/macab/MacabStatement.hxx
deleted file mode 100644
index 0eda7b05f5..0000000000
--- a/connectivity/source/drivers/macab/MacabStatement.hxx
+++ /dev/null
@@ -1,177 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_STATEMENT_HXX_
-#define _CONNECTIVITY_MACAB_STATEMENT_HXX_
-
-#include "MacabConnection.hxx"
-#include "MacabHeader.hxx"
-#include <list>
-#include "connectivity/sqliterator.hxx"
-#include "connectivity/sqlparse.hxx"
-#include <com/sun/star/sdbc/XStatement.hpp>
-#include <com/sun/star/util/XCancellable.hpp>
-#include <cppuhelper/compbase4.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <comphelper/proparrhlp.hxx>
-
-namespace connectivity
-{
- namespace macab
- {
- typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbc::XStatement,
- ::com::sun::star::sdbc::XWarningsSupplier,
- ::com::sun::star::util::XCancellable,
- ::com::sun::star::sdbc::XCloseable> MacabCommonStatement_BASE;
-
- //**************************************************************
- // Class MacabCommonStatement
- // is a base class for the normal statement and for the prepared statement
- //**************************************************************
- class MacabCommonStatement : public comphelper::OBaseMutex,
- public MacabCommonStatement_BASE,
- public ::cppu::OPropertySetHelper,
- public comphelper::OPropertyArrayUsageHelper<MacabCommonStatement>
-
- {
- ::com::sun::star::sdbc::SQLWarning m_aLastWarning;
-
- protected:
- ::std::list< ::rtl::OUString> m_aBatchList;
- connectivity::OSQLParser m_aParser;
- connectivity::OSQLParseTreeIterator m_aSQLIterator;
- connectivity::OSQLParseNode* m_pParseTree;
- MacabConnection* m_pConnection; // The owning Connection object
- MacabHeader* m_pHeader; // The header of the address book on which to run queries (provided by m_pConnection)
- ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created
-
-
- protected:
- class MacabCondition *analyseWhereClause(
- const OSQLParseNode *pParseNode) const throw(::com::sun::star::sdbc::SQLException);
- class MacabOrder *analyseOrderByClause(
- const OSQLParseNode *pParseNode) const throw(::com::sun::star::sdbc::SQLException);
- ::rtl::OUString getTableName( ) const;
- void setMacabFields(class MacabResultSet *pResult) const throw(::com::sun::star::sdbc::SQLException);
- void selectRecords(MacabResultSet *pResult) const throw(::com::sun::star::sdbc::SQLException);
- void sortRecords(MacabResultSet *pResult) const throw(::com::sun::star::sdbc::SQLException);
-
- // OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
-
- // OPropertySetHelper
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
- virtual sal_Bool SAL_CALL convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception);
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle) const;
-
- virtual void resetParameters() const throw(::com::sun::star::sdbc::SQLException);
- virtual void getNextParameter(::rtl::OUString &rParameter) const throw(::com::sun::star::sdbc::SQLException);
- virtual ~MacabCommonStatement();
-
- public:
- ::cppu::OBroadcastHelper& rBHelper;
-
- MacabCommonStatement(MacabConnection *_pConnection);
- using MacabCommonStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
-
- // OComponentHelper
- virtual void SAL_CALL disposing();
-
- // XInterface
- virtual void SAL_CALL release() throw();
- virtual void SAL_CALL acquire() throw();
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- const ::com::sun::star::uno::Type & rType
- ) throw(::com::sun::star::uno::RuntimeException);
-
- // XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(
- ) throw(::com::sun::star::uno::RuntimeException);
-
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(
- ) throw(::com::sun::star::uno::RuntimeException);
-
- // XStatement
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery(
- const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL executeUpdate(
- const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL execute(
- const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection(
- ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XWarningsSupplier
- virtual ::com::sun::star::uno::Any SAL_CALL getWarnings(
- ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearWarnings(
- ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XCancellable
- virtual void SAL_CALL cancel(
- ) throw(::com::sun::star::uno::RuntimeException);
-
- // XCloseable
- virtual void SAL_CALL close(
- ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // other methods
- inline MacabConnection* getOwnConnection() const { return m_pConnection; }
- };
-
- //**************************************************************
- // Class MacabStatement
- //**************************************************************
- typedef ::cppu::ImplInheritanceHelper1<
- MacabCommonStatement, ::com::sun::star::lang::XServiceInfo > MacabStatement_BASE;
-
- class MacabStatement : public MacabStatement_BASE
- {
- protected:
- virtual ~MacabStatement() { }
-
- public:
- MacabStatement(MacabConnection* _pConnection);
- DECLARE_SERVICE_INFO();
- };
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_STATEMENT_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabTable.cxx b/connectivity/source/drivers/macab/MacabTable.cxx
deleted file mode 100644
index ab4ff29d65..0000000000
--- a/connectivity/source/drivers/macab/MacabTable.cxx
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabTable.hxx"
-#include "MacabTables.hxx"
-#include "MacabColumns.hxx"
-#include "MacabCatalog.hxx"
-
-using namespace connectivity::macab;
-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;
-
-// -------------------------------------------------------------------------
-MacabTable::MacabTable( sdbcx::OCollection* _pTables, MacabConnection* _pConnection)
- : MacabTable_TYPEDEF(_pTables, sal_True),
- m_pConnection(_pConnection)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-MacabTable::MacabTable( sdbcx::OCollection* _pTables,
- MacabConnection* _pConnection,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description ,
- const ::rtl::OUString& _SchemaName,
- const ::rtl::OUString& _CatalogName
- ) : MacabTable_TYPEDEF(_pTables,sal_True,
- _Name,
- _Type,
- _Description,
- _SchemaName,
- _CatalogName),
- m_pConnection(_pConnection)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-void MacabTable::refreshColumns()
-{
- TStringVector aVector;
-
- if (!isNew())
- {
- Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(
- Any(),
- m_SchemaName,
- m_Name,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")));
-
- if (xResult.is())
- {
- Reference< XRow > xRow(xResult, UNO_QUERY);
- while (xResult->next())
- aVector.push_back(xRow->getString(4));
- }
- }
-
- if (m_pColumns)
- m_pColumns->reFill(aVector);
- else
- m_pColumns = new MacabColumns(this,m_aMutex,aVector);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabTable.hxx b/connectivity/source/drivers/macab/MacabTable.hxx
deleted file mode 100644
index 39f113368e..0000000000
--- a/connectivity/source/drivers/macab/MacabTable.hxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_TABLE_HXX_
-#define _CONNECTIVITY_MACAB_TABLE_HXX_
-
-#include "MacabConnection.hxx"
-#include "connectivity/sdbcx/VTable.hxx"
-
-namespace connectivity
-{
- namespace macab
- {
- typedef connectivity::sdbcx::OTable MacabTable_TYPEDEF;
-
- ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp);
-
- class MacabTable : public MacabTable_TYPEDEF
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
- MacabConnection* m_pConnection;
-
- public:
- MacabTable( sdbcx::OCollection* _pTables, MacabConnection* _pConnection);
- MacabTable( sdbcx::OCollection* _pTables,
- MacabConnection* _pConnection,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description = ::rtl::OUString(),
- const ::rtl::OUString& _SchemaName = ::rtl::OUString(),
- const ::rtl::OUString& _CatalogName = ::rtl::OUString()
- );
-
- MacabConnection* getConnection() { return m_pConnection;}
-
- virtual void refreshColumns();
-
- ::rtl::OUString getTableName() const { return m_Name; }
- ::rtl::OUString getSchema() const { return m_SchemaName; }
- };
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_TABLE_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabTables.cxx b/connectivity/source/drivers/macab/MacabTables.cxx
deleted file mode 100644
index 1d839f40f9..0000000000
--- a/connectivity/source/drivers/macab/MacabTables.cxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MacabTables.hxx"
-#include "MacabTable.hxx"
-#include "MacabCatalog.hxx"
-#include "MacabConnection.hxx"
-#include <comphelper/types.hxx>
-
-using namespace connectivity::macab;
-using namespace connectivity;
-using namespace ::comphelper;
-using namespace ::cppu;
-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 MacabTables::createObject(const ::rtl::OUString& _rName)
-{
- ::rtl::OUString aName,aSchema;
- aSchema = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%"));
- aName = _rName;
-
- Sequence< ::rtl::OUString > aTypes(1);
- aTypes[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%"));
- ::rtl::OUString sEmpty;
-
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), aSchema, aName, aTypes);
-
- sdbcx::ObjectType xRet = NULL;
- if (xResult.is())
- {
- Reference< XRow > xRow(xResult, UNO_QUERY);
- if (xResult->next()) // there can be only one table with this name
- {
- MacabTable* pRet = new MacabTable(
- this,
- static_cast<MacabCatalog&>(m_rParent).getConnection(),
- aName,
- xRow->getString(4),
- xRow->getString(5),
- sEmpty);
- xRet = pRet;
- }
- }
- ::comphelper::disposeComponent(xResult);
-
- return xRet;
-}
-// -------------------------------------------------------------------------
-void MacabTables::impl_refresh( ) throw(RuntimeException)
-{
- static_cast<MacabCatalog&>(m_rParent).refreshTables();
-}
-// -------------------------------------------------------------------------
-void MacabTables::disposing(void)
-{
-m_xMetaData.clear();
- OCollection::disposing();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/MacabTables.hxx b/connectivity/source/drivers/macab/MacabTables.hxx
deleted file mode 100644
index 17422ce862..0000000000
--- a/connectivity/source/drivers/macab/MacabTables.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_TABLES_HXX_
-#define _CONNECTIVITY_MACAB_TABLES_HXX_
-
-#include "connectivity/sdbcx/VCollection.hxx"
-#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-
-namespace connectivity
-{
- namespace macab
- {
- class MacabTables : public sdbcx::OCollection
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
-
- protected:
- virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
- virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
-
- public:
- MacabTables(
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,
- ::cppu::OWeakObject& _rParent,
- ::osl::Mutex& _rMutex,
- const TStringVector &_rVector)
- : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector),
- m_xMetaData(_rMetaData)
- { }
-
- virtual void SAL_CALL disposing(void);
- };
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_TABLES_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/exports.dxp b/connectivity/source/drivers/macab/exports.dxp
deleted file mode 100755
index 7003307892..0000000000
--- a/connectivity/source/drivers/macab/exports.dxp
+++ /dev/null
@@ -1 +0,0 @@
-component_getFactory
diff --git a/connectivity/source/drivers/macab/macab.xcu b/connectivity/source/drivers/macab/macab.xcu
deleted file mode 100644
index cbb9d0b6b0..0000000000
--- a/connectivity/source/drivers/macab/macab.xcu
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="sdbc:address:macab" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.macab.Driver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Mac OS X Address Book</value>
- </prop>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/macab/macab.xml b/connectivity/source/drivers/macab/macab.xml
deleted file mode 100755
index e1c4b57c37..0000000000
--- a/connectivity/source/drivers/macab/macab.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
-<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
- <module-name> macab1 </module-name>
- <component-description>
- <Author>Omer bar-or</Author>
- <Name>com.sun.star.comp.sdbc.macab.Driver</Name>
- <description>This library implements the database driver for Mac OS address book formats.</description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="alpha"/>
- <supported-service>com.sun.star.sdbc.Driver</supported-service>
- <service-dependency> ... </service-dependency>
- </component-description>
- <project-build-dependency> cppuhelper </project-build-dependency>
- <project-build-dependency> cppu </project-build-dependency>
- <project-build-dependency> sal </project-build-dependency>
-
- <runtime-module-dependency> cppuhelper </runtime-module-dependency>
- <runtime-module-dependency> cppu1 </runtime-module-dependency>
- <runtime-module-dependency> sal1 </runtime-module-dependency>
-
- <type> com.sun.star.registry.XRegistryKey </type>
- <type> com.sun.star.util.XCancellable </type>
- <type> com.sun.star.util.XNumberFormatter </type>
- <type> com.sun.star.uno.TypeClass </type>
- <type> com.sun.star.uno.XWeak </type>
- <type> com.sun.star.uno.XAggregation </type>
- <type> com.sun.star.uno.XComponentContext </type>
- <type> com.sun.star.beans.PropertyAttribute </type>
- <type> com.sun.star.beans.XPropertyState </type>
- <type> com.sun.star.beans.XPropertySet </type>
- <type> com.sun.star.beans.PropertyValue </type>
- <type> com.sun.star.beans.XMultiPropertySet </type>
- <type> com.sun.star.beans.XFastPropertySet </type>
- <type> com.sun.star.lang.XSingleServiceFactory </type>
- <type> com.sun.star.lang.XTypeProvider </type>
- <type> com.sun.star.lang.XSingleComponentFactory </type>
- <type> com.sun.star.lang.EventObject </type>
- <type> com.sun.star.lang.XComponent </type>
- <type> com.sun.star.lang.IllegalArgumentException </type>
- <type> com.sun.star.lang.DisposedException </type>
- <type> com.sun.star.lang.XMultiServiceFactory </type>
- <type> com.sun.star.lang.XServiceInfo </type>
- <type> com.sun.star.lang.XUnoTunnel </type>
- <type> com.sun.star.java.XJavaThreadRegister_11 </type>
- <type> com.sun.star.java.XJavaVM </type>
- <type> com.sun.star.sdbc.FetchDirection </type>
- <type> com.sun.star.sdbc.XConnection </type>
- <type> com.sun.star.sdbc.XStatement </type>
- <type> com.sun.star.sdbc.XResultSet </type>
- <type> com.sun.star.sdbc.XResultSetMetaDataSupplier</type>
- <type> com.sun.star.sdbc.XColumnLocate </type>
- <type> com.sun.star.sdbc.XResultSetUpdate </type>
- <type> com.sun.star.sdbc.XWarningsSupplier </type>
- <type> com.sun.star.sdbc.XRowUpdate </type>
- <type> com.sun.star.sdbc.XMultipleResults </type>
- <type> com.sun.star.sdbc.XBatchExecution </type>
- <type> com.sun.star.sdbc.XPreparedBatchExecution </type>
- <type> com.sun.star.sdbc.XParameters </type>
- <type> com.sun.star.sdbc.XOutParameters </type>
- <type> com.sun.star.sdbc.DriverPropertyInfo </type>
- <type> com.sun.star.sdbc.SQLWarning </type>
- <type> com.sun.star.sdbc.XRow </type>
- <type> com.sun.star.sdbc.ColumnSearch </type>
- <type> com.sun.star.sdbc.ColumnValue </type>
- <type> com.sun.star.sdbc.DataType </type>
- <type> com.sun.star.sdbc.XDriver </type>
- <type> com.sun.star.sdbc.TransactionIsolation </type>
- <type> com.sun.star.sdbc.ResultSetType </type>
- <type> com.sun.star.sdbc.ResultSetConcurrency </type>
- <type> com.sun.star.sdbcx.XRowLocate </type>
- <type> com.sun.star.sdbcx.XDeleteRows </type>
- <type> com.sun.star.sdbcx.CompareBookmark </type>
- <type> com.sun.star.sdb.XColumnUpdate </type>
- <type> com.sun.star.sdb.XColumn </type>
-</module-description>
diff --git a/connectivity/source/drivers/macab/macab1.component b/connectivity/source/drivers/macab/macab1.component
deleted file mode 100755
index 0a120c0418..0000000000
--- a/connectivity/source/drivers/macab/macab1.component
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.sdbc.macab.Driver">
- <service name="com.sun.star.sdbc.Driver"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/macab/macabcondition.cxx b/connectivity/source/drivers/macab/macabcondition.cxx
deleted file mode 100644
index 3faf0aa261..0000000000
--- a/connectivity/source/drivers/macab/macabcondition.cxx
+++ /dev/null
@@ -1,253 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "macabcondition.hxx"
-#include "MacabHeader.hxx"
-#include "MacabRecord.hxx"
-#include "connectivity/CommonTools.hxx"
-
-using namespace ::connectivity::macab;
-using namespace ::com::sun::star::sdbc;
-// -----------------------------------------------------------------------------
-MacabCondition::~MacabCondition()
-{
-}
-// -----------------------------------------------------------------------------
-MacabConditionConstant::MacabConditionConstant(const sal_Bool bValue)
- : MacabCondition(),
- m_bValue(bValue)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionConstant::isAlwaysTrue() const
-{
- return m_bValue;
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionConstant::isAlwaysFalse() const
-{
- return !m_bValue;
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionConstant::eval(const MacabRecord *) const
-{
- return m_bValue;
-}
-// -----------------------------------------------------------------------------
-MacabConditionColumn::MacabConditionColumn(const MacabHeader *header, const ::rtl::OUString &sColumnName) throw(SQLException)
- : MacabCondition(),
- m_nFieldNumber(header->getColumnNumber(sColumnName))
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionColumn::isAlwaysTrue() const
-{
- // Sometimes true, sometimes false
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionColumn::isAlwaysFalse() const
-{
- // Sometimes true, sometimes false
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-MacabConditionNull::MacabConditionNull(const MacabHeader *header, const ::rtl::OUString &sColumnName) throw(SQLException)
- : MacabConditionColumn(header, sColumnName)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionNull::eval(const MacabRecord *aRecord) const
-{
- macabfield *aValue = aRecord->get(m_nFieldNumber);
-
- if(aValue == NULL)
- return sal_True;
- else if(aValue->value == NULL)
- return sal_True;
- else
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-MacabConditionNotNull::MacabConditionNotNull(const MacabHeader *header, const ::rtl::OUString &sColumnName) throw(SQLException)
- : MacabConditionColumn(header, sColumnName)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionNotNull::eval(const MacabRecord *aRecord) const
-{
- macabfield *aValue = aRecord->get(m_nFieldNumber);
-
- if(aValue == NULL)
- return sal_False;
- else if(aValue->value == NULL)
- return sal_False;
- else
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-MacabConditionCompare::MacabConditionCompare(const MacabHeader *header, const ::rtl::OUString &sColumnName, const ::rtl::OUString &sMatchString) throw(SQLException)
- : MacabConditionColumn(header, sColumnName),
- m_sMatchString(sMatchString)
-{
-}
-// -----------------------------------------------------------------------------
-MacabConditionEqual::MacabConditionEqual(const MacabHeader *header, const ::rtl::OUString &sColumnName, const ::rtl::OUString &sMatchString) throw(SQLException)
- : MacabConditionCompare(header, sColumnName, sMatchString)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionEqual::eval(const MacabRecord *aRecord) const
-{
- macabfield *aValue = aRecord->get(m_nFieldNumber);
-
- if(aValue == NULL)
- return sal_False;
-
- macabfield *aValue2 = MacabRecord::createMacabField(m_sMatchString,aValue->type);
-
- if(aValue2 == NULL)
- return sal_False;
-
- sal_Int32 nReturn = MacabRecord::compareFields(aValue, aValue2);
-
- delete aValue2;
- return nReturn == 0;
-}
-// -----------------------------------------------------------------------------
-MacabConditionDifferent::MacabConditionDifferent(const MacabHeader *header, const ::rtl::OUString &sColumnName, const ::rtl::OUString &sMatchString) throw(SQLException)
- : MacabConditionCompare(header, sColumnName, sMatchString)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionDifferent::eval(const MacabRecord *aRecord) const
-{
- macabfield *aValue = aRecord->get(m_nFieldNumber);
-
- if(aValue == NULL)
- return sal_False;
-
- macabfield *aValue2 = MacabRecord::createMacabField(m_sMatchString,aValue->type);
-
- if(aValue2 == NULL)
- return sal_False;
-
- sal_Int32 nReturn = MacabRecord::compareFields(aValue, aValue2);
-
- delete aValue2;
- return nReturn != 0;
-}
-// -----------------------------------------------------------------------------
-MacabConditionSimilar::MacabConditionSimilar(const MacabHeader *header, const ::rtl::OUString &sColumnName, const ::rtl::OUString &sMatchString) throw(SQLException)
- : MacabConditionCompare(header, sColumnName, sMatchString)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionSimilar::eval(const MacabRecord *aRecord) const
-{
- macabfield *aValue = aRecord->get(m_nFieldNumber);
-
- if(aValue == NULL)
- return sal_False;
-
- ::rtl::OUString sName = MacabRecord::fieldToString(aValue);
-
- return match(m_sMatchString, sName, '\0');
-}
-// -----------------------------------------------------------------------------
-MacabConditionBoolean::MacabConditionBoolean(MacabCondition *pLeft, MacabCondition *pRight)
- : MacabCondition(),
- m_pLeft(pLeft),
- m_pRight(pRight)
-{
-}
-// -----------------------------------------------------------------------------
-MacabConditionBoolean::~MacabConditionBoolean()
-{
- delete m_pLeft;
- delete m_pRight;
-}
-// -----------------------------------------------------------------------------
-MacabConditionOr::MacabConditionOr(MacabCondition *pLeft, MacabCondition *pRight)
- : MacabConditionBoolean(pLeft, pRight)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionOr::isAlwaysTrue() const
-{
- return m_pLeft->isAlwaysTrue() || m_pRight->isAlwaysTrue();
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionOr::isAlwaysFalse() const
-{
- return m_pLeft->isAlwaysFalse() && m_pRight->isAlwaysFalse();
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionOr::eval(const MacabRecord *aRecord) const
-{
- // We avoid evaluating terms as much as we can
- if (m_pLeft->isAlwaysTrue() || m_pRight->isAlwaysTrue()) return sal_True;
- if (m_pLeft->isAlwaysFalse() && m_pRight->isAlwaysFalse()) return sal_False;
-
- if (m_pLeft->eval(aRecord)) return sal_True;
- if (m_pRight->eval(aRecord)) return sal_True;
-
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-MacabConditionAnd::MacabConditionAnd(MacabCondition *pLeft, MacabCondition *pRight)
- : MacabConditionBoolean(pLeft, pRight)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionAnd::isAlwaysTrue() const
-{
- return m_pLeft->isAlwaysTrue() && m_pRight->isAlwaysTrue();
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionAnd::isAlwaysFalse() const
-{
- return m_pLeft->isAlwaysFalse() || m_pRight->isAlwaysFalse();
-}
-// -----------------------------------------------------------------------------
-sal_Bool MacabConditionAnd::eval(const MacabRecord *aRecord) const
-{
- // We avoid evaluating terms as much as we can
- if (m_pLeft->isAlwaysFalse() || m_pRight->isAlwaysFalse()) return sal_False;
- if (m_pLeft->isAlwaysTrue() && m_pRight->isAlwaysTrue()) return sal_True;
-
- if (!m_pLeft->eval(aRecord)) return sal_False;
- if (!m_pRight->eval(aRecord)) return sal_False;
-
- return sal_True;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/macabcondition.hxx b/connectivity/source/drivers/macab/macabcondition.hxx
deleted file mode 100644
index 29f27bc52f..0000000000
--- a/connectivity/source/drivers/macab/macabcondition.hxx
+++ /dev/null
@@ -1,170 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_CONDITION_HXX_
-#define _CONNECTIVITY_MACAB_CONDITION_HXX_
-
-#include "MacabHeader.hxx"
-#include "MacabRecord.hxx"
-
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-
-namespace connectivity
-{
- namespace macab
- {
-// -----------------------------------------------------------------------------
-class MacabCondition
-{
- public:
- virtual ~MacabCondition();
- virtual sal_Bool isAlwaysTrue() const = 0;
- virtual sal_Bool isAlwaysFalse() const = 0;
- virtual sal_Bool eval(const MacabRecord *aRecord) const = 0;
-};
-// -----------------------------------------------------------------------------
-class MacabConditionConstant : public MacabCondition
-{
- protected:
- sal_Bool m_bValue;
-
- public:
- MacabConditionConstant(const sal_Bool bValue);
- virtual sal_Bool isAlwaysTrue() const;
- virtual sal_Bool isAlwaysFalse() const;
- virtual sal_Bool eval(const MacabRecord *aRecord) const;
-};
-// -----------------------------------------------------------------------------
-class MacabConditionColumn : public MacabCondition
-{
- protected:
- sal_Int32 m_nFieldNumber;
-
- public:
- MacabConditionColumn(
- const MacabHeader *header,
- const ::rtl::OUString &sColumnName) throw(::com::sun::star::sdbc::SQLException);
- virtual sal_Bool isAlwaysTrue() const;
- virtual sal_Bool isAlwaysFalse() const;
-};
-// -----------------------------------------------------------------------------
-class MacabConditionNull : public MacabConditionColumn
-{
- public:
- MacabConditionNull(
- const MacabHeader *header,
- const ::rtl::OUString &sColumnName) throw(::com::sun::star::sdbc::SQLException);
- virtual sal_Bool eval(const MacabRecord *aRecord) const;
-};
-// -----------------------------------------------------------------------------
-class MacabConditionNotNull : public MacabConditionColumn
-{
- public:
- MacabConditionNotNull(
- const MacabHeader *header,
- const ::rtl::OUString &sColumnName) throw(::com::sun::star::sdbc::SQLException);
- virtual sal_Bool eval(const MacabRecord *aRecord) const;
-};
-// -----------------------------------------------------------------------------
-class MacabConditionCompare : public MacabConditionColumn
-{
- protected:
- const ::rtl::OUString m_sMatchString;
-
- public:
- MacabConditionCompare(
- const MacabHeader *header,
- const ::rtl::OUString &sColumnName,
- const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
-};
-// -----------------------------------------------------------------------------
-class MacabConditionEqual : public MacabConditionCompare
-{
- public:
- MacabConditionEqual(
- const MacabHeader *header,
- const ::rtl::OUString &sColumnName,
- const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
- virtual sal_Bool eval(const MacabRecord *aRecord) const;
-};
-// -----------------------------------------------------------------------------
-class MacabConditionDifferent : public MacabConditionCompare
-{
- public:
- MacabConditionDifferent(
- const MacabHeader *header,
- const ::rtl::OUString &sColumnName,
- const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
- virtual sal_Bool eval(const MacabRecord *aRecord) const;
-};
-// -----------------------------------------------------------------------------
-class MacabConditionSimilar : public MacabConditionCompare
-{
- public:
- MacabConditionSimilar(
- const MacabHeader *header,
- const ::rtl::OUString &sColumnName,
- const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
- virtual sal_Bool eval(const MacabRecord *aRecord) const;
-};
-// -----------------------------------------------------------------------------
-class MacabConditionBoolean : public MacabCondition
-{
- protected:
- MacabCondition *m_pLeft, *m_pRight;
-
- public:
- MacabConditionBoolean(MacabCondition *pLeft, MacabCondition *pRight);
- virtual ~MacabConditionBoolean();
-};
-// -----------------------------------------------------------------------------
-class MacabConditionOr : public MacabConditionBoolean
-{
- public:
- MacabConditionOr(MacabCondition *pLeft, MacabCondition *pRight);
- virtual sal_Bool isAlwaysTrue() const;
- virtual sal_Bool isAlwaysFalse() const;
- virtual sal_Bool eval(const MacabRecord *aRecord) const;
-};
-// -----------------------------------------------------------------------------
-class MacabConditionAnd : public MacabConditionBoolean
-{
- public:
- MacabConditionAnd(MacabCondition *pLeft, MacabCondition *pRight);
- virtual sal_Bool isAlwaysTrue() const;
- virtual sal_Bool isAlwaysFalse() const;
- virtual sal_Bool eval(const MacabRecord *aRecord) const;
-};
-// -----------------------------------------------------------------------------
- }
-}
-
-#endif // _CONNECTIVITY_MACAB_CONDITION_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/macaborder.cxx b/connectivity/source/drivers/macab/macaborder.cxx
deleted file mode 100644
index fa8ba7a1ab..0000000000
--- a/connectivity/source/drivers/macab/macaborder.cxx
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "macaborder.hxx"
-#include "MacabHeader.hxx"
-#include "MacabRecord.hxx"
-
-using namespace ::connectivity::macab;
-
-MacabOrder::~MacabOrder()
-{
-}
-// -----------------------------------------------------------------------------
-MacabSimpleOrder::MacabSimpleOrder(MacabHeader *header, ::rtl::OUString &sColumnName, sal_Bool bAscending)
- : MacabOrder(),
- m_nFieldNumber(header->getColumnNumber(sColumnName)),
- m_bAscending(bAscending)
-{
-}
-// -----------------------------------------------------------------------------
-sal_Int32 MacabSimpleOrder::compare(const MacabRecord *record1, const MacabRecord *record2) const
-{
- sal_Int32 result;
-
- result = MacabRecord::compareFields(record1->get(m_nFieldNumber), record2->get(m_nFieldNumber));
-
- if (!m_bAscending) result = -result;
-
- return result;
-}
-// -----------------------------------------------------------------------------
-MacabComplexOrder::MacabComplexOrder()
- : MacabOrder(),
- m_aOrders()
-{
-}
-// -----------------------------------------------------------------------------
-MacabComplexOrder::~MacabComplexOrder()
-{
- for (sal_uInt32 i = 0; i < m_aOrders.size(); i++)
- delete m_aOrders[i];
-}
-// -----------------------------------------------------------------------------
-void MacabComplexOrder::addOrder(MacabOrder *pOrder)
-{
- m_aOrders.push_back(pOrder);
-}
-// -----------------------------------------------------------------------------
-sal_Int32 MacabComplexOrder::compare(const MacabRecord *record1, const MacabRecord *record2) const
-{
- for (sal_uInt32 i = 0; i < m_aOrders.size(); i++)
- {
- const MacabOrder *pOrder = m_aOrders[i];
- sal_Int32 result = pOrder->compare(record1, record2);
-
- if (result) return result;
- }
- return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/macaborder.hxx b/connectivity/source/drivers/macab/macaborder.hxx
deleted file mode 100644
index bad4bc8133..0000000000
--- a/connectivity/source/drivers/macab/macaborder.hxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_ORDER_HXX_
-#define _CONNECTIVITY_MACAB_ORDER_HXX_
-
-#include "rtl/ustring.hxx"
-#include "MacabHeader.hxx"
-#include "MacabRecord.hxx"
-
-#include <vector>
-
-namespace connectivity
-{
- namespace macab
- {
- class MacabOrder
- {
- public:
- virtual ~MacabOrder();
-
- virtual sal_Int32 compare(const MacabRecord *record1, const MacabRecord *record2) const = 0;
- };
-
- class MacabSimpleOrder : public MacabOrder
- {
- sal_Int32 m_nFieldNumber;
- sal_Bool m_bAscending;
-
- public:
- MacabSimpleOrder(MacabHeader *header, ::rtl::OUString &sColumnName, sal_Bool bAscending);
-
- virtual sal_Int32 compare(const MacabRecord *record1, const MacabRecord *record2) const;
- };
-
- class MacabComplexOrder : public MacabOrder
- {
- ::std::vector<MacabOrder *> m_aOrders;
-
- public:
- MacabComplexOrder();
- virtual ~MacabComplexOrder();
-
- void addOrder(MacabOrder *pOrder);
- virtual sal_Int32 compare(const MacabRecord *record1, const MacabRecord *record2) const;
- };
- }
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/macabutilities.hxx b/connectivity/source/drivers/macab/macabutilities.hxx
deleted file mode 100644
index 237a7e4456..0000000000
--- a/connectivity/source/drivers/macab/macabutilities.hxx
+++ /dev/null
@@ -1,152 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MACAB_UTILITIES_HXX_
-#define _CONNECTIVITY_MACAB_UTILITIES_HXX_
-
-#include <com/sun/star/util/DateTime.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
-
-#include <time.h>
-#include <premac.h>
-#include <Carbon/Carbon.h>
-#include <AddressBook/ABAddressBookC.h>
-#include <postmac.h>
-
-namespace connectivity
-{
- namespace macab
- {
- // -------------------------------------------------------------------------
- inline ::rtl::OUString CFStringToOUString(const CFStringRef sOrig)
- {
- /* Copied all-but directly from code by Florian Heckl in
- * cws_src680_aquafilepicker01
- * File was: fpicker/source/aqua/CFStringUtilities
- * I only removed commented debugging lines and changed variable
- * names.
- */
- if (NULL == sOrig) {
- return rtl::OUString();
- }
-
- CFRetain(sOrig);
- CFIndex nStringLength = CFStringGetLength(sOrig);
-
- UniChar unichars[nStringLength+1];
-
- //'close' the string buffer correctly
- unichars[nStringLength] = '\0';
-
- CFStringGetCharacters (sOrig, CFRangeMake(0,nStringLength), unichars);
- CFRelease(sOrig);
-
- return rtl::OUString(unichars);
- }
-
- // -------------------------------------------------------------------------
- inline CFStringRef OUStringToCFString(const ::rtl::OUString& aString)
- {
- /* Copied directly from code by Florian Heckl in
- * cws_src680_aquafilepicker01
- * File was: fpicker/source/aqua/CFStringUtilities
- */
-
- CFStringRef ref = CFStringCreateWithCharacters(kCFAllocatorDefault, aString.getStr(), aString.getLength());
-
- return ref;
- }
-
- // -------------------------------------------------------------------------
- inline com::sun::star::util::DateTime CFDateToDateTime(const CFDateRef _cfDate)
- {
- /* Carbon can give us the time since 2001 of any CFDateRef,
- * and it also stores the time since 1970 as a constant,
- * basically allowing us to get the unixtime of any
- * CFDateRef. From there, it is just a matter of choosing what
- * we want to do with it.
- */
- com::sun::star::util::DateTime nRet;
- double timeSince2001 = CFDateGetAbsoluteTime(_cfDate);
- time_t unixtime = timeSince2001+kCFAbsoluteTimeIntervalSince1970;
- struct tm *ptm = localtime(&unixtime);
- nRet.Year = ptm->tm_year+1900;
- nRet.Month = ptm->tm_mon+1;
- nRet.Day = ptm->tm_mday;
- nRet.Hours = ptm->tm_hour;
- nRet.Minutes = ptm->tm_min;
- nRet.Seconds = ptm->tm_sec;
- nRet.HundredthSeconds = 0;
- return nRet;
- }
-
- // -------------------------------------------------------------------------
- inline ::rtl::OUString fixLabel(const ::rtl::OUString _originalLabel)
- {
- /* Get the length, and make sure that there is actually a string
- * here.
- */
- if(_originalLabel.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_$!<"))) == 0)
- {
- return _originalLabel.copy(4,_originalLabel.getLength()-8);
- }
-
- return _originalLabel;
- }
-
- // -------------------------------------------------------------------------
- inline sal_Int32 ABTypeToDataType(const ABPropertyType _abType)
- {
- sal_Int32 dataType;
- switch(_abType)
- {
- case kABStringProperty:
- dataType = ::com::sun::star::sdbc::DataType::CHAR;
- break;
- case kABDateProperty:
- dataType = ::com::sun::star::sdbc::DataType::TIMESTAMP;
- break;
- case kABIntegerProperty:
- dataType = ::com::sun::star::sdbc::DataType::INTEGER;
- break;
- case kABRealProperty:
- dataType = ::com::sun::star::sdbc::DataType::FLOAT;
- break;
- default:
- dataType = -1;
- }
- return dataType;
- }
-
- void impl_throwError(sal_uInt16 _nErrorId);
- }
-}
-
-#endif // _ CONNECTIVITY_MACAB_UTILITIES_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/macab/makefile.mk b/connectivity/source/drivers/macab/makefile.mk
deleted file mode 100755
index b2e8db65dc..0000000000
--- a/connectivity/source/drivers/macab/makefile.mk
+++ /dev/null
@@ -1,138 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=macab
-TARGET2=$(TARGET)drv
-VISIBILITY_HIDDEN=TRUE
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings ----------------------------------
-
-.INCLUDE : $(PRJ)$/makefile.pmk
-.INCLUDE : $(PRJ)$/version.mk
-
-.IF "$(GUI)" == "UNX"
-.IF "$(OS)" == "MACOSX"
-
-# === MACAB base library ==========================
-
-# --- Files -------------------------------------
-
-SLOFILES= \
- $(SLO)$/MacabDriver.obj \
- $(SLO)$/MacabServices.obj
-
-DEPOBJFILES= \
- $(SLO2FILES)
-
-# --- Library -----------------------------------
-
-SHL1TARGET= $(TARGET)$(MACAB_MAJOR)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(DBTOOLSLIB) \
- $(SALHELPERLIB) \
- $(SALLIB)
-
-SHL1DEPN=
-SHL1IMPLIB= i$(TARGET)
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-
-# === MACAB impl library ==========================
-
-# --- Files -------------------------------------
-
-SLO2FILES=\
- $(SLO)$/MacabColumns.obj \
- $(SLO)$/MacabTable.obj \
- $(SLO)$/MacabTables.obj \
- $(SLO)$/MacabCatalog.obj \
- $(SLO)$/MacabResultSet.obj \
- $(SLO)$/MacabStatement.obj \
- $(SLO)$/MacabPreparedStatement.obj \
- $(SLO)$/MacabDatabaseMetaData.obj \
- $(SLO)$/MacabConnection.obj \
- $(SLO)$/MacabResultSetMetaData.obj \
- $(SLO)$/macabcondition.obj \
- $(SLO)$/macaborder.obj \
- $(SLO)$/MacabRecord.obj \
- $(SLO)$/MacabRecords.obj \
- $(SLO)$/MacabHeader.obj \
- $(SLO)$/MacabGroup.obj \
- $(SLO)$/MacabAddressBook.obj
-
-MACAB_LIB=-framework Carbon -framework AddressBook
-
-# --- Library -----------------------------------
-
-SHL2TARGET= $(TARGET2)$(MACAB_MAJOR)
-SHL2OBJS=$(SLO2FILES)
-SHL2STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SALHELPERLIB) \
- $(SALLIB) \
- $(DBTOOLSLIB) \
- $(COMPHELPERLIB) \
- $(MACAB_LIB)
-
-SHL2DEPN=
-SHL2IMPLIB= i$(TARGET2)
-
-SHL2DEF= $(MISC)$/$(SHL2TARGET).def
-
-DEF2NAME= $(SHL2TARGET)
-
-# --- Targets -----------------------------------
-.ELSE # "$(OS)" == "MACOSX"
-dummy:
- @echo Not using Mac OS X - nothing to build
-.ENDIF
-
-.ELSE # "$(GUI)" == "UNX"
-dummy:
- @echo "Nothing to build for GUI $(GUI)"
-.ENDIF
-
-.INCLUDE : $(PRJ)$/target.pmk
-
-
-ALLTAR : $(MISC)/macab1.component
-
-$(MISC)/macab1.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- macab1.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt macab1.component
diff --git a/connectivity/source/drivers/mozab/MCatalog.cxx b/connectivity/source/drivers/mozab/MCatalog.cxx
deleted file mode 100644
index 4cf7492772..0000000000
--- a/connectivity/source/drivers/mozab/MCatalog.cxx
+++ /dev/null
@@ -1,128 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "MCatalog.hxx"
-#include "MConnection.hxx"
-#include "MTables.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <cppuhelper/interfacecontainer.h>
-
-// -------------------------------------------------------------------------
-using namespace connectivity::mozab;
-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 ::cppu;
-
-// -------------------------------------------------------------------------
-OCatalog::OCatalog(OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon)
- ,m_pConnection(_pCon)
- ,m_xMetaData(m_pConnection->getMetaData( ))
-{
-// osl_incrementInterlockedCount( &m_refCount );
-// refreshTables();
-// refreshViews();
-// refreshGroups();
-// refreshUsers();
-// osl_decrementInterlockedCount( &m_refCount );
-}
-// -------------------------------------------------------------------------
-void OCatalog::refreshTables()
-{
- TStringVector aVector;
- Sequence< ::rtl::OUString > aTypes(1);
- aTypes[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%"));
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")),::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")),aTypes);
-
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- ::rtl::OUString aName;
- while(xResult->next())
- {
- aName = xRow->getString(3);
- aVector.push_back(aName);
- }
- }
- if(m_pTables)
- m_pTables->reFill(aVector);
- else
- m_pTables = new OTables(m_xMetaData,*this,m_aMutex,aVector);
-}
-// -------------------------------------------------------------------------
-void OCatalog::refreshViews()
-{
-}
-// -------------------------------------------------------------------------
-void OCatalog::refreshGroups()
-{
-}
-// -------------------------------------------------------------------------
-void OCatalog::refreshUsers()
-{
-}
-// -------------------------------------------------------------------------
-const ::rtl::OUString& OCatalog::getDot()
-{
- static const ::rtl::OUString sDot = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("."));
- return sDot;
-}
-// -----------------------------------------------------------------------------
-
-// XTablesSupplier
-Reference< XNameAccess > SAL_CALL OCatalog::getTables( ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(rBHelper.bDisposed);
-
- try
- {
- if(!m_pTables || m_pConnection->getForceLoadTables())
- refreshTables();
- }
- catch( const RuntimeException& )
- {
- // allowed to leave this method
- throw;
- }
- catch( const Exception& )
- {
- // allowed
- }
-
- return const_cast<OCatalog*>(this)->m_pTables;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MCatalog.hxx b/connectivity/source/drivers/mozab/MCatalog.hxx
deleted file mode 100644
index cc57748fe1..0000000000
--- a/connectivity/source/drivers/mozab/MCatalog.hxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _CONNECTIVITY_MOZAB_CATALOG_HXX_
-#define _CONNECTIVITY_MOZAB_CATALOG_HXX_
-
-#include "connectivity/sdbcx/VCatalog.hxx"
-
-namespace connectivity
-{
- namespace mozab
- {
- // please don't name the class the same name as in an other namespaces
- // some compilers have problems with this task as I noticed on windows
- class OConnection;
- class OCatalog : public connectivity::sdbcx::OCatalog
- {
- OConnection* m_pConnection; // used to get the metadata
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier
-
- public:
- // implementation of the pure virtual methods
- virtual void refreshTables();
- virtual void refreshViews() ;
- virtual void refreshGroups();
- virtual void refreshUsers() ;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTables( ) throw(::com::sun::star::uno::RuntimeException);
- public:
- OCatalog(OConnection* _pCon);
-
- OConnection* getConnection() const { return m_pConnection; }
- sdbcx::OCollection* getPrivateTables() const { return m_pTables;}
- sdbcx::OCollection* getPrivateViews() const { return m_pViews; }
-
- static const ::rtl::OUString& getDot();
- };
- }
-}
-#endif // _CONNECTIVITY_MOZAB_CATALOG_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MColumnAlias.cxx b/connectivity/source/drivers/mozab/MColumnAlias.cxx
deleted file mode 100644
index 7cbd66ae72..0000000000
--- a/connectivity/source/drivers/mozab/MColumnAlias.cxx
+++ /dev/null
@@ -1,195 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <sal/macros.h>
-#include "MColumnAlias.hxx"
-#include "MConnection.hxx"
-#include "MExtConfigAccess.hxx"
-
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-
-#include <tools/diagnose_ex.h>
-
-#include <algorithm>
-#include <functional>
-
-using namespace ::connectivity;
-using namespace ::connectivity::mozab;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
-
-//------------------------------------------------------------------------------
-OColumnAlias::OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
-{
- static const sal_Char* s_pProgrammaticNames[] =
- {
- "FirstName",
- "LastName",
- "DisplayName",
- "NickName",
- "PrimaryEmail",
- "SecondEmail",
- "PreferMailFormat",
- "WorkPhone",
- "HomePhone",
- "FaxNumber",
- "PagerNumber",
- "CellularNumber",
- "HomeAddress",
- "HomeAddress2",
- "HomeCity",
- "HomeState",
- "HomeZipCode",
- "HomeCountry",
- "WorkAddress",
- "WorkAddress2",
- "WorkCity",
- "WorkState",
- "WorkZipCode",
- "WorkCountry",
- "JobTitle",
- "Department",
- "Company",
- "WebPage1",
- "WebPage2",
- "BirthYear",
- "BirthMonth",
- "BirthDay",
- "Custom1",
- "Custom2",
- "Custom3",
- "Custom4",
- "Notes",
- };
-
- for ( size_t i = 0; i < SAL_N_ELEMENTS( s_pProgrammaticNames ); ++i )
- m_aAliasMap[ ::rtl::OUString::createFromAscii( s_pProgrammaticNames[i] ) ] = AliasEntry( s_pProgrammaticNames[i], i );
-
- initialize( _rxORB );
-}
-
-//------------------------------------------------------------------------------
-void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
-{
- // open our driver settings config node
-
- // the config path for our own driver's settings
- Reference< XPropertySet > xDriverNode = createDriverConfigNode( _rxORB );
- if ( xDriverNode.is() )
- {
- try
- {
- //.............................................................
- Reference< XNameAccess > xAliasesNode;
- xDriverNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ColumnAliases")) ) >>= xAliasesNode;
- OSL_ENSURE( xAliasesNode.is(), "OColumnAlias::setAlias: missing the aliases node!" );
-
- // this is a set of string nodes
- Sequence< ::rtl::OUString > aProgrammaticNames;
- if ( xAliasesNode.is() )
- aProgrammaticNames = xAliasesNode->getElementNames();
-
- //.............................................................
- // travel through all the set elements
- const ::rtl::OUString* pProgrammaticNames = aProgrammaticNames.getConstArray();
- const ::rtl::OUString* pProgrammaticNamesEnd = pProgrammaticNames + aProgrammaticNames.getLength();
- ::rtl::OUString sAssignedAlias;
-
- for ( ; pProgrammaticNames < pProgrammaticNamesEnd; ++pProgrammaticNames )
- {
- OSL_VERIFY( xAliasesNode->getByName( *pProgrammaticNames ) >>= sAssignedAlias );
-
- // normalize in case the config data is corrupted
- // (what we really don't need is an empty alias ...)
- if ( 0 == sAssignedAlias.getLength() )
- sAssignedAlias = *pProgrammaticNames;
-
- ::rtl::OString sAsciiProgrammaticName( ::rtl::OUStringToOString( *pProgrammaticNames, RTL_TEXTENCODING_ASCII_US ) );
- //.............................................................
- #if OSL_DEBUG_LEVEL > 0
- bool bFound = false;
- #endif
- for ( AliasMap::iterator search = m_aAliasMap.begin();
- ( search != m_aAliasMap.end() );
- ++search
- )
- {
- if ( search->second.programmaticAsciiName.equals( sAsciiProgrammaticName ) )
- {
- AliasEntry entry( search->second );
- m_aAliasMap.erase( search );
- m_aAliasMap[ sAssignedAlias ] = entry;
-
- #if OSL_DEBUG_LEVEL > 0
- bFound = true;
- #endif
-
- break;
- }
- }
-
- OSL_ENSURE( bFound, "OColumnAlias::setAlias: did not find a programmatic name which exists in the configuration!" );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-}
-
-//------------------------------------------------------------------
-::rtl::OString OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias( const ::rtl::OUString& _rAlias ) const
-{
- AliasMap::const_iterator pos = m_aAliasMap.find( _rAlias );
- if ( pos == m_aAliasMap.end() )
- {
- OSL_FAIL( "OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias: no programmatic name for this alias!" );
- return ::rtl::OUStringToOString( _rAlias, RTL_TEXTENCODING_UTF8 );
- }
- return pos->second.programmaticAsciiName;
-}
-
-//------------------------------------------------------------------
-bool OColumnAlias::isColumnSearchable( const ::rtl::OUString _alias ) const
-{
- ::rtl::OString sProgrammatic = getProgrammaticNameOrFallbackToUTF8Alias( _alias );
-
- return ( !sProgrammatic.equals( "HomeCountry" )
- && !sProgrammatic.equals( "WorkCountry" )
- );
- // for those, we know that they're not searchable in the Mozilla/LDAP implementation.
- // There might be more ...
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MColumnAlias.hxx b/connectivity/source/drivers/mozab/MColumnAlias.hxx
deleted file mode 100644
index 4aa9c07d7f..0000000000
--- a/connectivity/source/drivers/mozab/MColumnAlias.hxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#ifndef _CONNECTIVITY_MAB_COLUMNALIAS_HXX_
-#define _CONNECTIVITY_MAB_COLUMNALIAS_HXX_
-
-#include <unotools/confignode.hxx>
-
-#include <osl/mutex.hxx>
-#include <vector>
-#include <boost/unordered_map.hpp>
-
-namespace connectivity
-{
- namespace mozab
- {
- class OColumnAlias
- {
- public:
- struct AliasEntry
- {
- ::rtl::OString programmaticAsciiName;
- sal_Int32 columnPosition;
-
- AliasEntry()
- :programmaticAsciiName()
- ,columnPosition( 0 )
- {
- }
- AliasEntry( const sal_Char* _programmaticAsciiName, sal_Int32 _columnPosition )
- :programmaticAsciiName( _programmaticAsciiName )
- ,columnPosition( _columnPosition )
- {
- }
- };
- typedef ::boost::unordered_map< ::rtl::OUString, AliasEntry, ::rtl::OUStringHash > AliasMap;
-
- private:
- AliasMap m_aAliasMap;
-
- public:
- OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
-
- inline bool hasAlias( const ::rtl::OUString& _rAlias ) const
- {
- return m_aAliasMap.find( _rAlias ) != m_aAliasMap.end();
- }
- ::rtl::OString getProgrammaticNameOrFallbackToUTF8Alias( const ::rtl::OUString& _rAlias ) const;
-
- inline AliasMap::const_iterator begin() const { return m_aAliasMap.begin(); }
- inline AliasMap::const_iterator end() const { return m_aAliasMap.end(); }
-
- bool isColumnSearchable( const ::rtl::OUString _alias ) const;
-
- private:
- void initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
- };
- }
-}
-#endif // _CONNECTIVITY_MAB_COLUMNALIAS_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MColumns.cxx b/connectivity/source/drivers/mozab/MColumns.cxx
deleted file mode 100644
index 9e81cfdc0b..0000000000
--- a/connectivity/source/drivers/mozab/MColumns.cxx
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "MColumns.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include "MTable.hxx"
-#include "MTables.hxx"
-#include "MCatalog.hxx"
-#include <comphelper/types.hxx>
-#include "connectivity/dbtools.hxx"
-
-using namespace ::comphelper;
-
-
-using namespace connectivity::mozab;
-using namespace connectivity::sdbcx;
-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;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName)
-{
- Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(Any(),
- m_pTable->getSchema(),m_pTable->getTableName(),_rName);
-
- sdbcx::ObjectType xRet = NULL;
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while(xResult->next())
- {
- if(xRow->getString(4) == _rName)
- {
- sal_Int32 nType = xRow->getInt(5);
- ::rtl::OUString sTypeName = xRow->getString(6);
- sal_Int32 nPrec = xRow->getInt(7);
-
- OColumn* pRet = new OColumn(_rName,
- sTypeName,
- xRow->getString(13),
- xRow->getString(12),
- xRow->getInt(11),
- nPrec,
- xRow->getInt(9),
- nType,
- sal_False,sal_False,sal_False,sal_True);
- xRet = pRet;
- break;
- }
- }
- }
-
- return xRet;
-}
-
-// -------------------------------------------------------------------------
-void OColumns::impl_refresh() throw(RuntimeException)
-{
- m_pTable->refreshColumns();
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MColumns.hxx b/connectivity/source/drivers/mozab/MColumns.hxx
deleted file mode 100644
index ffa11ed4af..0000000000
--- a/connectivity/source/drivers/mozab/MColumns.hxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MOZAB_COLUMNS_HXX_
-#define _CONNECTIVITY_MOZAB_COLUMNS_HXX_
-
-#include "connectivity/sdbcx/VCollection.hxx"
-#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-#include "connectivity/sdbcx/IRefreshable.hxx"
-#include "MTable.hxx"
-
-namespace connectivity
-{
- namespace mozab
- {
- class OColumns : public sdbcx::OCollection
- {
- protected:
- OTable* m_pTable;
-
- virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
- virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
- public:
- OColumns( OTable* _pTable,
- ::osl::Mutex& _rMutex,
- const TStringVector &_rVector
- ) : sdbcx::OCollection(*_pTable,sal_True,_rMutex,_rVector)
- ,m_pTable(_pTable)
- {}
- };
- }
-}
-#endif // _CONNECTIVITY_MOZAB_COLUMNS_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MConfigAccess.cxx b/connectivity/source/drivers/mozab/MConfigAccess.cxx
deleted file mode 100644
index 4609b10985..0000000000
--- a/connectivity/source/drivers/mozab/MConfigAccess.cxx
+++ /dev/null
@@ -1,271 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MConfigAccess.hxx"
-#include "MExtConfigAccess.hxx"
-#include "MConnection.hxx"
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
-
-//.........................................................................
-namespace connectivity
-{
- namespace mozab
- {
- //-----------------------------------------------------------------
- Reference< XPropertySet > createDriverConfigNode( Reference< XMultiServiceFactory > _rxORB )
- {
- Reference< XPropertySet > xNode;
- try
- {
- //=============================================================
- // create the config provider
- Reference< XMultiServiceFactory > xConfigProvider(
- _rxORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider" )) ),
- UNO_QUERY
- );
- OSL_ENSURE( xConfigProvider.is(), "createDriverConfigNode: could not create the config provider!" );
-
- if ( xConfigProvider.is() )
- {
- ::rtl::OUString sCompleteNodePath(RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.DataAccess/DriverSettings/" ));
- sCompleteNodePath += OConnection::getDriverImplementationName();
-
- //=========================================================
- // arguments for creating the config access
- Sequence< Any > aArguments(2);
- // the path to the node to open
- aArguments[0] <<= PropertyValue(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("nodepath")),
- 0,
- makeAny( sCompleteNodePath ),
- PropertyState_DIRECT_VALUE
- );
- // the depth: -1 means unlimited
- aArguments[1] <<= PropertyValue(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("depth")),
- 0,
- makeAny( (sal_Int32)-1 ),
- PropertyState_DIRECT_VALUE
- );
-
- //=========================================================
- // create the access
- Reference< XInterface > xAccess = xConfigProvider->createInstanceWithArguments(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess" )),
- aArguments
- );
- OSL_ENSURE( xAccess.is(), "createDriverConfigNode: invalid access returned (should throw an exception instead)!" );
-
- xNode = xNode.query( xAccess );
- }
- }
- catch( const Exception& )
- {
- OSL_FAIL( "createDriverConfigNode: caught an exception while accessing the driver's config node!" );
- }
-
- // outta here
- return xNode;
- }
-
- //-----------------------------------------------------------------
- namespace
- {
- // a private helper to accessing the point where we store the reference
- // to the factory
- Reference< XMultiServiceFactory >& accessFactoryStorage( )
- {
- static Reference< XMultiServiceFactory > xMozabServiceFactory;
- return xMozabServiceFactory;
- }
- }
-
- //-----------------------------------------------------------------
- void setMozabServiceFactory( const Reference< XMultiServiceFactory >& _rxFactory )
- {
- accessFactoryStorage( ) = _rxFactory;
- }
-
- //-----------------------------------------------------------------
- const Reference< XMultiServiceFactory >& getMozabServiceFactory( )
- {
- return accessFactoryStorage( );
- }
-
- //-----------------------------------------------------------------
- ::rtl::OUString getDescription(const sal_Char* sNode,const ::rtl::OUString & sDefault)
- {
- ::rtl::OUString sPreferredName;
- ::rtl::OUString sDescription;
-
- Reference< XMultiServiceFactory > xFactory = getMozabServiceFactory();
- OSL_ENSURE( xFactory.is(), "getPreferredProfileName: invalid service factory!" );
- if ( xFactory.is() )
- {
- try
- {
- Reference< XPropertySet > xDriverNode = createDriverConfigNode( xFactory );
- Reference< XPropertySet > xMozPrefsNode;
- if ( xDriverNode.is() )
- xDriverNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MozillaPreferences" )) ) >>= xMozPrefsNode;
- OSL_ENSURE( xMozPrefsNode.is(), "getPreferredProfileName: could not access the node for the mozilla preferences!" );
- if ( xMozPrefsNode.is() )
- xMozPrefsNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ProfileName" )) ) >>= sPreferredName;
- if ( xMozPrefsNode.is() )
- xMozPrefsNode->getPropertyValue( ::rtl::OUString::createFromAscii(sNode) ) >>= sDescription;
- if (sDescription.getLength() == 0)
- sDescription = sDefault;
- }
- catch( const Exception& )
- {
- OSL_FAIL( "getDescription: caught an exception!" );
- }
- }
- if (sDescription.getLength() == 0)
- sDescription = sDefault;
- return sDescription;
- }
- //-----------------------------------------------------------------
- ::rtl::OUString getPreferredProfileName( )
- {
- ::rtl::OUString sPreferredName;
-
- Reference< XMultiServiceFactory > xFactory = getMozabServiceFactory();
- OSL_ENSURE( xFactory.is(), "getPreferredProfileName: invalid service factory!" );
- if ( xFactory.is() )
- {
- try
- {
- Reference< XPropertySet > xDriverNode = createDriverConfigNode( xFactory );
- Reference< XPropertySet > xMozPrefsNode;
- if ( xDriverNode.is() )
- xDriverNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MozillaPreferences" )) ) >>= xMozPrefsNode;
- OSL_ENSURE( xMozPrefsNode.is(), "getPreferredProfileName: could not access the node for the mozilla preferences!" );
- if ( xMozPrefsNode.is() )
- xMozPrefsNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ProfileName" )) ) >>= sPreferredName;
- }
- catch( const Exception& )
- {
- OSL_FAIL( "getPreferredProfileName: caught an exception!" );
- }
- }
- return sPreferredName;
- }
- }
-}
-
-//.........................................................................
-
-//-------------------------------------------------------------------------
-extern "C" const sal_Unicode* SAL_CALL getUserProfile( void )
-{
- static sal_Bool bReadConfig = sal_False;
- static ::rtl::OUString sUserProfile;
- if ( !bReadConfig )
- {
- sUserProfile = ::connectivity::mozab::getPreferredProfileName( );
- bReadConfig = sal_True;
- }
-
- return sUserProfile.getStr();
-}
-//------------------------------------------------------------------------
-extern "C" const sal_Char* SAL_CALL getPabDescription( void )
-{
- static sal_Bool bReadConfig = sal_False;
- static ::rtl::OUString usPabDescription;
- static ::rtl::OString sPabDescription;
-
- if ( !bReadConfig )
- {
- usPabDescription = ::connectivity::mozab::getDescription(
- "PabDescription" ,
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Personal Address Book" )));
- sPabDescription = ::rtl::OUStringToOString( usPabDescription,
- RTL_TEXTENCODING_UTF8);
- bReadConfig = sal_True;
- }
-
- return sPabDescription.getStr();
-}
-
-//-------------------------------------------------------------------------
-extern "C" const sal_Char* SAL_CALL getHisDescription( void )
-{
- static sal_Bool bReadConfig = sal_False;
- static ::rtl::OUString usHisDescription;
- static ::rtl::OString sHisDescription;
-
- if ( !bReadConfig )
- {
- usHisDescription = ::connectivity::mozab::getDescription(
- "HisDescription" ,
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Collected Addresses" )));
- sHisDescription = ::rtl::OUStringToOString( usHisDescription,
- RTL_TEXTENCODING_UTF8);
- bReadConfig = sal_True;
- }
-
- return sHisDescription.getStr();
-}
-
-//-------------------------------------------------------------------------
-// MConfigAccess was invented to allow non-UNO parts access to the configuration.
-// Unfortunately, configuration access requires a XMultiServiceFactory - which the
-// mozilla side does not have.
-// So we create a "library-local" service factory here: Every need for a service
-// factory can be fullfilled by this factory (similar to the get/setProcessServiceFactory
-// in comphelper).
-// This is halfway valid, as usually, the mozabdrv library is invoked from the mozab library
-// only. The latter contains the driver class (and only this class and nothing more), and
-// the driver class is a singleton. The driver itself is created with a service factory,
-// which (by definition) can and should be used for all subsequent service requests.
-// And this is exactly what we're allowing with the following functions ....
-
-/** _pFactory must point to an XMultiServiceFactory, which must be aquired once
- for purpose of safely transfering it. The callee will release this interface
- when it has stored the pointer somewhere else.
-*/
-extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL setMozabServiceFactory(
- void* _pFactory )
-{
- Reference< XMultiServiceFactory > xFactory = static_cast< XMultiServiceFactory* >( _pFactory );
- ::connectivity::mozab::setMozabServiceFactory( xFactory );
-
- // by definition, the object behind the interface pointer has been acquired once for purpose
- // of safely transporting it
- xFactory->release();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MConfigAccess.hxx b/connectivity/source/drivers/mozab/MConfigAccess.hxx
deleted file mode 100644
index 7b66797a1f..0000000000
--- a/connectivity/source/drivers/mozab/MConfigAccess.hxx
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONNECTIVITY_MOZAB_MCONFIGACCESS_HXX
-
-#include <sal/types.h>
-
-extern "C" const sal_Unicode* SAL_CALL getUserProfile( void );
-
-extern "C" const sal_Char* SAL_CALL getPabDescription( void );
-
-extern "C" const sal_Char* SAL_CALL getHisDescription( void );
-
-#endif // CONNECTIVITY_MOZAB_MCONFIGACCESS_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MConnection.cxx b/connectivity/source/drivers/mozab/MConnection.cxx
deleted file mode 100644
index f7bb24e053..0000000000
--- a/connectivity/source/drivers/mozab/MConnection.cxx
+++ /dev/null
@@ -1,607 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "diagnose_ex.h"
-#include "MConnection.hxx"
-#include "MDatabaseMetaData.hxx"
-#include "MDriver.hxx"
-#include "MColumnAlias.hxx"
-#include "MStatement.hxx"
-#include "MPreparedStatement.hxx"
-
-#include <connectivity/dbcharset.hxx>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/sqlerror.hxx>
-
-#include "resource/mozab_res.hrc"
-#include "resource/common_res.hrc"
-
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/TransactionIsolation.hpp>
-
-#include <comphelper/officeresourcebundle.hxx>
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL OMozabConnection_CreateInstance(
- void* _pDriver)
-{
- return (new connectivity::mozab::OConnection( reinterpret_cast<connectivity::mozab::MozabDriver*>(_pDriver) ));
-}
-
-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;
-using namespace com::sun::star::sdbcx;
-// --------------------------------------------------------------------------------
-
-namespace connectivity { namespace mozab {
-
-// =====================================================================
-// = ConnectionImplData
-// =====================================================================
-struct ConnectionImplData
-{
- ::boost::shared_ptr< ::comphelper::OfficeResourceBundle > pResourceBundle;
-};
-
-// -----------------------------------------------------------------------------
-#ifdef __MINGW32__
-extern "C"
-#endif
-const sal_Char* getSdbcScheme( SdbcScheme _eScheme )
-{
- switch ( _eScheme )
- {
- case SDBC_MOZILLA: return "mozilla";
- case SDBC_THUNDERBIRD: return "thunderbird";
- case SDBC_LDAP: return "ldap";
- case SDBC_OUTLOOK_MAPI: return "outlook";
- case SDBC_OUTLOOK_EXPRESS: return "outlookexp";
- }
- return NULL;
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OConnection::getDriverImplementationName()
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(MOZAB_DRIVER_IMPL_NAME));
-}
-
-// -----------------------------------------------------------------------------
-const sal_Char* getSchemeURI( MozillaScheme _eScheme )
-{
- switch ( _eScheme )
- {
- case SCHEME_MOZILLA : return "moz-abdirectory://";
- case SCHEME_MOZILLA_MDB : return "moz-abmdbdirectory://";
- case SCHEME_LDAP : return "moz-abldapdirectory://";
- case SCHEME_OUTLOOK_MAPI : return "moz-aboutlookdirectory://op/";
- case SCHEME_OUTLOOK_EXPRESS : return "moz-aboutlookdirectory://oe/";
- }
- return NULL;
-}
-
-// -----------------------------------------------------------------------------
-
-OConnection::OConnection(MozabDriver* _pDriver)
- :OSubComponent<OConnection, OConnection_BASE>((::cppu::OWeakObject*)_pDriver, this)
- ,m_pDriver(_pDriver)
- ,m_pImplData( new ConnectionImplData )
- ,m_aColumnAlias( _pDriver->getMSFactory() )
- ,m_nMaxResultRecords( -1 )
- ,m_aNameMapper(NULL)
- ,m_eSDBCAddressType(SDBCAddress::Unknown)
- ,m_bForceLoadTable(false)
-{
- m_pDriver->acquire();
-
-}
-//-----------------------------------------------------------------------------
-OConnection::~OConnection()
-{
- acquire();
- if(!isClosed())
- close();
- m_pDriver->release();
- m_pDriver = NULL;
-}
-//-----------------------------------------------------------------------------
-void SAL_CALL OConnection::release() throw()
-{
- relase_ChildImpl();
-}
-// -----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException)
-{
- OSL_TRACE("IN OConnection::construct()\n" );
- // open file
- setURL(url);
- //
- // Skip 'sdbc:mozab: part of URL
- //
- sal_Int32 nLen = url.indexOf(':');
- nLen = url.indexOf(':',nLen+1);
- OSL_ENSURE( url.copy( 0, nLen ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sdbc:address" ) ), "OConnection::construct: invalid start of the URI - should never have survived XDriver::acceptsURL!" );
-
- ::rtl::OUString aAddrbookURI(url.copy(nLen+1));
- // Get Scheme
- nLen = aAddrbookURI.indexOf(':');
- ::rtl::OUString aAddrbookScheme;
- ::rtl::OUString sAdditionalInfo;
- if ( nLen == -1 )
- {
- // There isn't any subschema: - but could be just subschema
- if ( aAddrbookURI.getLength() > 0 )
- {
- aAddrbookScheme= aAddrbookURI;
- }
- else
- {
- OSL_TRACE( "No subschema given!!!\n");
- throwSQLException( STR_URI_SYNTAX_ERROR, *this );
- }
- }
- else
- {
- aAddrbookScheme = aAddrbookURI.copy(0, nLen);
- sAdditionalInfo = aAddrbookURI.copy( nLen + 1 );
- }
-
- OSL_TRACE("URI = %s\n", ((OUtoCStr(aAddrbookURI)) ? (OUtoCStr(aAddrbookURI)):("NULL")) );
- OSL_TRACE("Scheme = %s\n", ((OUtoCStr(aAddrbookScheme)) ? (OUtoCStr(aAddrbookScheme)):("NULL")) );
-
- //
- // Now we have a URI convert it to a MozillaURI
- //
- // The Mapping being used is:
- //
- // * for Mozilla
- // "sdbc:address:mozilla:" -> abdirectory://
- // * for LDAP
- // "sdbc:address:ldap:" -> abldapdirectory://
- // * for Outlook (using MAPI API)
- // "sdbc:address:outlook:" -> aboutlookdirectory://op/
- // * for windows system address book
- // "sdbc:address:outlookexp:" -> aboutlookdirectory://oe/
- //
- m_sBindDN = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(""));
- m_sPassword = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(""));
- m_bUseSSL = sal_False;
-
- if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_MOZILLA ) ) == 0 ) {
- m_sMozillaURI = rtl::OUString::createFromAscii( getSchemeURI( SCHEME_MOZILLA ) );
- m_eSDBCAddressType = SDBCAddress::Mozilla;
- if(sAdditionalInfo.getLength())
- m_sMozillaProfile = sAdditionalInfo;
- }
- else
- if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_THUNDERBIRD ) ) == 0 ) {
- //Yes. I am sure it is SCHEME_MOZILLA
- m_sMozillaURI = rtl::OUString::createFromAscii( getSchemeURI( SCHEME_MOZILLA ) );
- m_eSDBCAddressType = SDBCAddress::ThunderBird;
- if(sAdditionalInfo.getLength())
- m_sMozillaProfile = sAdditionalInfo;
- }
- else if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_LDAP ) ) == 0 ) {
- rtl::OUString sBaseDN;
- sal_Int32 nPortNumber = -1;
-
- m_sMozillaURI = rtl::OUString::createFromAscii( getSchemeURI( SCHEME_LDAP ) );
- m_eSDBCAddressType = SDBCAddress::LDAP;
-
- if ( !m_sHostName.getLength() )
- {
- // see whether the URI contains a hostname/port
- if ( sAdditionalInfo.getLength() )
- {
- sal_Int32 nPortSeparator = sAdditionalInfo.indexOf( ':' );
- if ( nPortSeparator == -1 )
- m_sHostName = sAdditionalInfo;
- else
- {
- m_sHostName = sAdditionalInfo.copy( 0, nPortSeparator );
- nPortNumber = sAdditionalInfo.copy( nPortSeparator + 1 ).toInt32();
- OSL_ENSURE( nPortNumber != 0, "OConnection::construct: invalid LDAP port number in the URL!" );
- if ( nPortNumber == 0 )
- nPortNumber = -1;
- }
- }
- }
-
- const PropertyValue* pInfo = info.getConstArray();
- const PropertyValue* pInfoEnd = pInfo + info.getLength();
-
- for (; pInfo != pInfoEnd; ++pInfo)
- {
- OSL_TRACE( "info[%d].Name = %s\n", pInfo - info.getConstArray(), OUtoCStr( pInfo->Name ) );
-
- if ( 0 == pInfo->Name.compareToAscii("HostName") )
- {
- pInfo->Value >>= m_sHostName;
- }
- else if ( 0 == pInfo->Name.compareToAscii("BaseDN") )
- {
- pInfo->Value >>= sBaseDN;
- }
- else if ( 0 == pInfo->Name.compareToAscii("user") )
- {
- pInfo->Value >>= m_sBindDN;
- }
- else if ( 0 == pInfo->Name.compareToAscii("password") )
- {
- pInfo->Value >>= m_sPassword;
- }
- else if ( 0 == pInfo->Name.compareToAscii("UseSSL") )
- {
- pInfo->Value >>= m_bUseSSL;
- }
- else if ( 0 == pInfo->Name.compareToAscii("PortNumber") )
- {
- OSL_VERIFY( pInfo->Value >>= nPortNumber );
- }
- else if ( 0 == pInfo->Name.compareToAscii("MaxRowCount") )
- {
- pInfo->Value >>= m_nMaxResultRecords;
- }
- }
-
- if ( m_sHostName.getLength() != 0 ) {
- m_sMozillaURI += m_sHostName;
- }
- else
- throwSQLException( STR_NO_HOSTNAME, *this );
-
- if ( nPortNumber > 0 ) {
- m_sMozillaURI += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(":") );
- m_sMozillaURI += rtl::OUString::valueOf( nPortNumber );
- }
-
- if ( sBaseDN.getLength() != 0 ) {
- m_sMozillaURI += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") );
- m_sMozillaURI += sBaseDN;
- }
- else
- throwSQLException( STR_NO_BASEDN, *this );
-
- // Addition of a fake query to enable the Mozilla LDAP directory to work correctly.
- m_sMozillaURI += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?(or(DisplayName,=,DontDoThisAtHome)))"));
-
- }
- else if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_OUTLOOK_MAPI ) ) == 0 ) {
- m_sMozillaURI = ::rtl::OUString::createFromAscii( getSchemeURI( SCHEME_OUTLOOK_MAPI ) );
- m_eSDBCAddressType = SDBCAddress::Outlook;
- }
- else if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_OUTLOOK_EXPRESS ) ) == 0 ) {
- m_sMozillaURI = rtl::OUString::createFromAscii( getSchemeURI( SCHEME_OUTLOOK_EXPRESS ) );
- m_eSDBCAddressType = SDBCAddress::OutlookExp;
- }
- else
- {
- OSL_TRACE("Invalid subschema given!!!\n");
- throwSQLException( STR_URI_SYNTAX_ERROR, *this );
- }
-
- OSL_TRACE("Moz URI = %s, %s\n", ((OUtoCStr(m_sMozillaURI)) ? (OUtoCStr(m_sMozillaURI)):("NULL")), usesFactory() ? "uses factory" : "no factory");
- OSL_TRACE( "\tOUT OConnection::construct()\n" );
-
- MDatabaseMetaDataHelper _aDbHelper;
-
- // The creation of the nsIAbDirectory i/f for LDAP doesn't actually test
- // the validity of the connection, it's normally delayed until the query
- // is executed, but it's a bit late then to fail...
- if ( isLDAP() )
- {
- if ( !_aDbHelper.testLDAPConnection( this ) )
- {
- OSL_TRACE("testLDAPConnection : FAILED\n" );
- throwSQLException( _aDbHelper.getError(), *this );
- }
- else
- {
- OSL_TRACE("testLDAPConnection : SUCCESS\n" );
- }
- }
-
- // Test connection by getting to get the Table Names
- ::std::vector< ::rtl::OUString > tables;
- ::std::vector< ::rtl::OUString > types;
- if ( !_aDbHelper.getTableStrings( this, tables, types ) )
- {
- throwSQLException( _aDbHelper.getError(), *this );
- }
-
-}
-// XServiceInfo
-// --------------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.mozab.OConnection", "com.sun.star.sdbc.Connection")
-
-// --------------------------------------------------------------------------------
-Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- // create a statement
- // the statement can only be executed once
- Reference< XStatement > xReturn = new OStatement(this);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
- return xReturn;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- OSL_TRACE("OConnection::prepareStatement( %s )", OUtoCStr( _sSql ) );
- // the pre
- // create a statement
- // the statement can only be executed more than once
- OPreparedStatement* pPrepared = new OPreparedStatement(this,_sSql);
- Reference< XPreparedStatement > xReturn = pPrepared;
- pPrepared->lateInit();
-
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
- return xReturn;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException)
-{
- OSL_UNUSED( _sSql );
- ::dbtools::throwFeatureNotImplementedException( "XConnection::prepareCall", *this );
- OSL_TRACE("OConnection::prepareCall( %s )", OUtoCStr( _sSql ) );
- return NULL;
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConnection::nativeSQL( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- // when you need to transform SQL92 to you driver specific you can do it here
- OSL_TRACE("OConnection::nativeSQL( %s )", OUtoCStr( _sSql ) );
-
- return _sSql;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setAutoCommit( sal_Bool /*autoCommit*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setAutoCommit", *this );
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeException)
-{
- // you have to distinguish which if you are in autocommit mode or not
- // at normal case true should be fine here
-
- return sal_True;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException)
-{
- // when you database does support transactions you should commit here
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException)
-{
- // same as commit but for the other case
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- // just simple -> we are close when we are disposed taht means someone called dispose(); (XComponent)
- return OConnection_BASE::rBHelper.bDisposed;
-}
-// --------------------------------------------------------------------------------
-Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- // here we have to create the class with biggest interface
- // The answer is 42 :-)
- Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
- if(!xMetaData.is())
- {
- xMetaData = new ODatabaseMetaData(this); // need the connection because it can return it
- m_xMetaData = xMetaData;
- }
-
- return xMetaData;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setReadOnly( sal_Bool /*readOnly*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setReadOnly", *this );
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- // return if your connection to readonly
- return sal_False;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& /*catalog*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setCatalog", *this );
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConnection::getCatalog( ) throw(SQLException, RuntimeException)
-{
- // return your current catalog
- return ::rtl::OUString();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setTransactionIsolation", *this );
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- // please have a look at @see com.sun.star.sdbc.TransactionIsolation
- return TransactionIsolation::NONE;
-}
-// --------------------------------------------------------------------------------
-Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getTypeMap( ) throw(SQLException, RuntimeException)
-{
- // if your driver has special database types you can return it here
- return NULL;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setTypeMap", *this );
-}
-// --------------------------------------------------------------------------------
-// XCloseable
-void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException)
-{
- // we just dispose us
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- }
- dispose();
-}
-// --------------------------------------------------------------------------------
-// XWarningsSupplier
-Any SAL_CALL OConnection::getWarnings( ) throw(SQLException, RuntimeException)
-{
- // when you collected some warnings -> return it
- return Any();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- // you should clear your collected warnings here
-}
-//------------------------------------------------------------------------------
-void OConnection::disposing()
-{
- // we noticed that we should be destroied in near future so we have to dispose our statements
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_pImplData->pResourceBundle.reset();
-
- OConnection_BASE::disposing();
- if ( m_aNameMapper ) {
- MQuery::FreeNameMapper( m_aNameMapper );
- m_aNameMapper = NULL;
- }
-
- dispose_ChildImpl();
-}
-// -----------------------------------------------------------------------------
-
-Reference< XTablesSupplier > SAL_CALL OConnection::createCatalog()
-{
- OSL_TRACE("IN OConnection::createCatalog()\n" );
- ::osl::MutexGuard aGuard( m_aMutex );
- Reference< XTablesSupplier > xTab = m_xCatalog;
- if(!m_xCatalog.is())
- {
- OCatalog *pCat = new OCatalog(this);
- xTab = pCat;
- m_xCatalog = xTab;
- }
- OSL_TRACE( "\tOUT OConnection::createCatalog()\n" );
- return xTab;
-}
-// -----------------------------------------------------------------------------
-
-MNameMapper* OConnection::getNameMapper ()
-{
- if (m_aNameMapper==NULL)
- m_aNameMapper = MQuery::CreateNameMapper();
-
- return m_aNameMapper;
-}
-
-// -----------------------------------------------------------------------------
-void OConnection::throwSQLException( const ErrorDescriptor& _rError, const Reference< XInterface >& _rxContext )
-{
- if ( _rError.getResId() != 0 )
- {
- OSL_ENSURE( ( _rError.getErrorCondition() == 0 ),
- "OConnection::throwSQLException: unsupported error code combination!" );
-
- ::rtl::OUString sParameter( _rError.getParameter() );
- if ( sParameter.getLength() )
- {
- const ::rtl::OUString sError( getResources().getResourceStringWithSubstitution(
- _rError.getResId(),
- "$1$", sParameter
- ) );
- ::dbtools::throwGenericSQLException( sError, _rxContext );
- OSL_FAIL( "OConnection::throwSQLException: unreachable (1)!" );
- }
-
- throwGenericSQLException( _rError.getResId(), _rxContext );
- OSL_FAIL( "OConnection::throwSQLException: unreachable (2)!" );
- }
-
- if ( _rError.getErrorCondition() != 0 )
- {
- SQLError aErrorHelper( getDriver()->getMSFactory() );
- ::rtl::OUString sParameter( _rError.getParameter() );
- if ( sParameter.getLength() )
- aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext, sParameter );
- else
- aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext);
- OSL_FAIL( "OConnection::throwSQLException: unreachable (3)!" );
- }
-
- throwGenericSQLException( STR_UNSPECIFIED_ERROR, _rxContext );
-}
-
-// -----------------------------------------------------------------------------
-void OConnection::throwSQLException( const sal_uInt16 _nErrorResourceId, const Reference< XInterface >& _rxContext )
-{
- ErrorDescriptor aError;
- aError.setResId( _nErrorResourceId );
- throwSQLException( aError, _rxContext );
-}
-
-} } // namespace connectivity::mozab
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MConnection.hxx b/connectivity/source/drivers/mozab/MConnection.hxx
deleted file mode 100644
index 4ec99a1294..0000000000
--- a/connectivity/source/drivers/mozab/MConnection.hxx
+++ /dev/null
@@ -1,233 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SCONNECTION_HXX
-#define CONNECTIVITY_SCONNECTION_HXX
-
-#include "connectivity/CommonTools.hxx"
-
-#include "MCatalog.hxx"
-#include "MColumnAlias.hxx"
-#include "OSubComponent.hxx"
-#include "TConnection.hxx"
-
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/mozilla/MozillaProductType.hpp>
-#include <com/sun/star/sdbc/SQLWarning.hpp>
-#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-
-#include <cppuhelper/weakref.hxx>
-
-#include <memory>
-
-namespace connectivity
-{
- namespace mozab
- {
-
- class MozabDriver;
- class ODatabaseMetaData;
- class MNameMapper;
- class ErrorDescriptor;
-
- namespace SDBCAddress {
- typedef enum {
- Unknown = 0,
- Mozilla = 1,
- ThunderBird = 2,
- LDAP = 3,
- Outlook = 4,
- OutlookExp = 5
- } sdbc_address_type;
- }
-
- // For the moment, we will connect the Mozilla address book to the Mozilla
- // top-level address book which will display whatever is in the preferences
- // file of Mozilla.
- enum MozillaScheme
- {
- // This one is a base uri which will be completed with the connection data.
- SCHEME_MOZILLA,
- // This one is for mozilla native address book
- SCHEME_MOZILLA_MDB,
- // This one is for LDAP address book
- SCHEME_LDAP,
- // These two uris will be used to obtain directory factories to access all
- // address books of the given type.
- SCHEME_OUTLOOK_MAPI,
- SCHEME_OUTLOOK_EXPRESS
- };
- const sal_Char* getSchemeURI( MozillaScheme _eScheme );
-
- enum SdbcScheme
- {
- SDBC_MOZILLA,
- SDBC_THUNDERBIRD,
- SDBC_LDAP,
- SDBC_OUTLOOK_MAPI,
- SDBC_OUTLOOK_EXPRESS
- };
-#ifdef __MINGW32__
- extern "C"
-#endif
- const sal_Char* getSdbcScheme( SdbcScheme _eScheme );
-
- typedef connectivity::OMetaConnection OConnection_BASE; // implements basics and text encoding
-
- struct ConnectionImplData;
- class OConnection : public OConnection_BASE,
- public connectivity::OSubComponent<OConnection, OConnection_BASE>
- {
- friend class connectivity::OSubComponent<OConnection, OConnection_BASE>;
-
- protected:
- //====================================================================
- // Data attributes
- //====================================================================
- ::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by
- // an operation
- MozabDriver* m_pDriver; // Pointer to the owning
- // driver object
- ::std::auto_ptr< ConnectionImplData > m_pImplData;
- // This is to be able to hold a boost::shared_ptr. If we would hold it as member, it would
- // not compile the mozillasrc directory, since this directory is compiled without RTTI support
- // and boost seems to require RTTI on some platforms.
- // Store Catalog
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog;
- // Start of Additions from the land of mozilla
- OColumnAlias m_aColumnAlias;
- rtl::OUString m_sMozillaURI;
- rtl::OUString m_sMozillaProfile;
- sal_Int32 m_nMaxResultRecords;
- MNameMapper* m_aNameMapper;
- //LDAP only
- rtl::OUString m_sHostName;
- sal_Bool m_bUseSSL;
- rtl::OUString m_sBindDN;
- rtl::OUString m_sUser; // the user name
- rtl::OUString m_sPassword;
-
- SDBCAddress::sdbc_address_type m_eSDBCAddressType;
-
- sal_Bool m_bForceLoadTable;
-
- public:
- virtual void construct( const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException);
- OConnection(MozabDriver* _pDriver);
- virtual ~OConnection();
-
- void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException);
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
- // XInterface
- virtual void SAL_CALL release() throw();
-
- // XServiceInfo
- DECLARE_SERVICE_INFO();
- // XConnection
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XWarningsSupplier
- virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- //
- MozabDriver* getDriver() const { return m_pDriver;}
-
- // Added to enable me to use SQLInterpreter which requires an
- // XNameAccess i/f to access tables.
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL createCatalog();
-
-
- // Additions from the land of mozilla
- rtl::OUString getMozURI() const { return m_sMozillaURI; }
- rtl::OUString getMozProfile() const { return m_sMozillaProfile; }
- void setMozProfile(rtl::OUString &aNewProfile) { m_sMozillaProfile = aNewProfile; }
-
- ::com::sun::star::mozilla::MozillaProductType getProduct()
- {
- if (m_eSDBCAddressType == SDBCAddress::ThunderBird)
- return ::com::sun::star::mozilla::MozillaProductType_Thunderbird;
- return ::com::sun::star::mozilla::MozillaProductType_Mozilla;
- }
-
- // Get Ldap BindDN (user name)
- rtl::OUString getBindDN() const { return m_sBindDN; }
- // Get Ldap Password
- rtl::OUString getPassword() const { return m_sPassword; }
- // Get Ldap Host name
- rtl::OUString getHost() const { return m_sHostName; }
- // Get whether use ssl to connect to ldap
- sal_Bool getUseSSL() const {return m_bUseSSL;}
-
- sal_Bool usesFactory(void) const { return (m_eSDBCAddressType == SDBCAddress::Outlook) || (m_eSDBCAddressType == SDBCAddress::OutlookExp); }
- sal_Bool isLDAP(void) const { return m_eSDBCAddressType == SDBCAddress::LDAP; }
- sal_Bool isThunderbird(void) const { return m_eSDBCAddressType == SDBCAddress::ThunderBird; }
-
- sal_Bool isOutlookExpress() const { return m_eSDBCAddressType == SDBCAddress::OutlookExp;}
- sal_Int32 getMaxResultRecords() const { return m_nMaxResultRecords; }
-
- SDBCAddress::sdbc_address_type getSDBCAddressType() const { return m_eSDBCAddressType;}
-
- const OColumnAlias & getColumnAlias() const { return (m_aColumnAlias); }
-
- static ::rtl::OUString getDriverImplementationName();
-
- MNameMapper* getNameMapper();
- void setForceLoadTables(sal_Bool aForce){ m_bForceLoadTable = aForce;}
- sal_Bool getForceLoadTables() { return m_bForceLoadTable;}
-
- void throwSQLException( const ErrorDescriptor& _rError, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext );
- void throwSQLException( const sal_uInt16 _nErrorResourceId, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext );
-
- private:
- // make this private - clients should use throwSQLException instead
- using OConnection_BASE::throwGenericSQLException;
- };
- }
-}
-#endif // CONNECTIVITY_SCONNECTION_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
deleted file mode 100644
index 161d0bced0..0000000000
--- a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
+++ /dev/null
@@ -1,1033 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "MDatabaseMetaData.hxx"
-#include "FDatabaseMetaDataResultSet.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/TransactionIsolation.hpp>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/FValue.hxx>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/ColumnSearch.hpp>
-#include "resource/common_res.hrc"
-#include <vector>
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-using namespace connectivity::mozab;
-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 connectivity
-{
- namespace mozab
- {
- static sal_Int32 const s_nCOLUMN_SIZE = 256;
- static sal_Int32 const s_nDECIMAL_DIGITS = 0;
- static sal_Int32 const s_nNULLABLE = 1;
- static sal_Int32 const s_nCHAR_OCTET_LENGTH = 65535;
- }
-}
-
-
-ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon)
- : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo())
- ,m_pConnection(_pCon)
-{
- OSL_ENSURE(m_pConnection,"ODatabaseMetaData::ODatabaseMetaData: No connection set!");
- m_pDbMetaDataHelper = new MDatabaseMetaDataHelper();
-}
-// -------------------------------------------------------------------------
-ODatabaseMetaData::~ODatabaseMetaData()
-{
- delete m_pDbMetaDataHelper;
-}
-
-// -------------------------------------------------------------------------
-ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows(
- const ::rtl::OUString& tableNamePattern,
- const ::rtl::OUString& columnNamePattern ) throw(SQLException)
-{
- static ODatabaseMetaDataResultSet::ORows aRows;
- ODatabaseMetaDataResultSet::ORow aRow(19);
- aRows.clear();
-
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ::std::vector< ::rtl::OUString > tables;
- ::std::vector< ::rtl::OUString > types;
- if ( !m_pDbMetaDataHelper->getTableStrings( m_pConnection, tables, types) ) {
- getOwnConnection()->throwSQLException( m_pDbMetaDataHelper->getError(), *this );
- }
-
- // ****************************************************
- // Some entries in a row never change, so set them now
- // ****************************************************
-
- // Catalog
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")));
- // Schema
- aRow[2] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")));
- // DATA_TYPE
- aRow[5] = new ORowSetValueDecorator(static_cast<sal_Int16>(DataType::VARCHAR));
- // TYPE_NAME, not used
- aRow[6] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VARCHAR")));
- // COLUMN_SIZE
- aRow[7] = new ORowSetValueDecorator(s_nCOLUMN_SIZE);
- // BUFFER_LENGTH, not used
- aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
- // DECIMAL_DIGITS.
- aRow[9] = new ORowSetValueDecorator(s_nDECIMAL_DIGITS);
- // NUM_PREC_RADIX
- aRow[10] = new ORowSetValueDecorator((sal_Int32)10);
- // NULLABLE
- aRow[11] = new ORowSetValueDecorator(s_nNULLABLE);
- // REMARKS
- aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue();
- // COULUMN_DEF, not used
- aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
- // SQL_DATA_TYPE, not used
- aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue();
- // SQL_DATETIME_SUB, not used
- aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue();
- // CHAR_OCTET_LENGTH, refer to [5]
- aRow[16] = new ORowSetValueDecorator(s_nCHAR_OCTET_LENGTH);
- // IS_NULLABLE
- aRow[18] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("YES")));
-
- const OColumnAlias& colNames = m_pConnection->getColumnAlias();
-
- // Iterate over all tables
- for(size_t j = 0; j < tables.size(); j++ ) {
- if(match(tableNamePattern, tables[j],'\0')) {
- // TABLE_NAME
- aRow[3] = new ORowSetValueDecorator( tables[j] );
-
- OSL_TRACE( "\t\tTableName = %s;\n",OUtoCStr( tables[j] ));
-
- // Iterate over all collumns in the table.
- for ( OColumnAlias::AliasMap::const_iterator compare = colNames.begin();
- compare != colNames.end();
- ++compare
- )
- {
- if ( match( columnNamePattern, compare->first, '\0' ) )
- {
- OSL_TRACE( "\t\t\tColumnName = %s;\n", OUtoCStr( compare->first ) );
- // COLUMN_NAME
- aRow[4] = new ORowSetValueDecorator( compare->first );
- // ORDINAL_POSITION
- aRow[17] = new ORowSetValueDecorator( static_cast< sal_Int32 >( compare->second.columnPosition ) + 1 );
- aRows.push_back(aRow);
- }
- }
- }
- }
- return( aRows );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( )
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 65535; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 254; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 20; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( )
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
-{
- // We only support a single table
- return 1;
-}
-// -------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aVal;
- return aVal;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
-{
- // normally this is "
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("\""));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aVal;
- return aVal;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_isCatalogAtStart_throw( )
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
-{
- //We support create table
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException)
-{
- return sal_True; // should be supported at least
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException)
-{
- // We allow you to select from any table.
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- //we support insert/update/delete now
- //But we have to set this to return sal_True otherwise the UI will add create "table/edit table"
- //entry to the popup menu. We should avoid them.
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException)
-{
- // Support added for this.
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
-{
- // Any case may be used
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- return m_pConnection->getURL();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)1);
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)0);
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
-{
- return 1;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- return TransactionIsolation::NONE;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 /*setType*/, sal_Int32 /*concurrency*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-// here follow all methods which return a resultset
-// the first methods is an example implementation how to use this resultset
-// of course you could implement it on your and you should do this because
-// the general way is more memory expensive
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
-{
- // there exists no possibility to get table types so we have to check
- static ::rtl::OUString sTableTypes[] =
- {
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TABLE")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VIEW"))
- // Currently we only support a 'TABLE' and 'VIEW' nothing more complex
- //
- // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYSTEM TABLE")),
- // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("GLOBAL TEMPORARY")),
- // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LOCAL TEMPORARY")),
- // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ALIAS")),
- // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYNONYM"))
- };
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes);
- Reference< XResultSet > xRef = pResult;
-
- // here we fill the rows which should be visible when ask for data from the resultset returned here
- const sal_Int32 nSize = sizeof(sTableTypes) / sizeof(::rtl::OUString);
- ODatabaseMetaDataResultSet::ORows aRows;
- for(sal_Int32 i=0;i < nSize;++i)
- {
- ODatabaseMetaDataResultSet::ORow aRow;
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(sTableTypes[i]));
- // bound row
- aRows.push_back(aRow);
- }
- // here we set the rows at the resultset
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( )
-{
- // this returns an empty resultset where the column-names are already set
- // in special the metadata of the resultset already returns the right columns
- ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo);
- Reference< XResultSet > xResultSet = pResultSet;
- static ODatabaseMetaDataResultSet::ORows aRows;
-
- if(aRows.empty())
- {
- ODatabaseMetaDataResultSet::ORow aRow;
- aRow.reserve(19);
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VARCHAR"))));
- aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR));
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)s_nCHAR_OCTET_LENGTH));
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- // aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::CHAR));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)10));
-
- aRows.push_back(aRow);
-
- }
- pResultSet->setRows(aRows);
- return xResultSet;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern,
- const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
-{
- // this returns an empty resultset where the column-names are already set
- // in special the metadata of the resultset already returns the right columns
- ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eColumns);
- Reference< XResultSet > xResultSet = pResultSet;
- pResultSet->setRows( getColumnRows( tableNamePattern, columnNamePattern ));
- return xResultSet;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/,
- const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException)
-{
- // this returns an empty resultset where the column-names are already set
- // in special the metadata of the resultset already returns the right columns
- ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
- Reference< XResultSet > xResultSet = pResultSet;
-
- // ODatabaseMetaDataResultSet::ORows aRows;
- // aRows = m_pDbMetaDataHelper->getTables( m_pConnection, tableNamePattern );
- // pResultSet->setRows( aRows );
- ODatabaseMetaDataResultSet::ORows _rRows;
- if ( !m_pDbMetaDataHelper->getTables( m_pConnection, tableNamePattern, types,_rRows ) ) {
- getOwnConnection()->throwSQLException( m_pDbMetaDataHelper->getError(), *this );
- }
- pResultSet->setRows( _rRows );
-
- return xResultSet;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException)
-{
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTablePrivileges);
- Reference< XResultSet > xRef = NULL;
-
- xRef = pResult;
-
- ::std::vector< ::rtl::OUString > tables;
- ::std::vector< ::rtl::OUString > types;
- if ( !m_pDbMetaDataHelper->getTableStrings( m_pConnection, tables, types ) )
- getOwnConnection()->throwSQLException( m_pDbMetaDataHelper->getError(), *this );
-
- ::connectivity::ODatabaseMetaDataResultSet::ORows aRows;
- ::connectivity::ODatabaseMetaDataResultSet::ORow aRow(8);
- aRows.reserve(8);
- aRow[0] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[1] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[3] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[4] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[5] = new ::connectivity::ORowSetValueDecorator(getUserName());
- aRow[7] = new ::connectivity::ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NO")));
-
-
- // Iterate over all tables
- for(size_t j = 0; j < tables.size(); j++ ) {
- if(match(tableNamePattern, tables[j],'\0'))
- {
- // TABLE_NAME
- aRow[2] = new ORowSetValueDecorator( tables[j] );
-
- OSL_TRACE( "\t\tTableName = %s;\n",OUtoCStr( tables[j] ));
-
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getSelectValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getInsertValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDeleteValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getUpdateValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getCreateValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getReadValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getAlterValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDropValue();
- aRows.push_back(aRow);
- }
- }
- pResult->setRows(aRows);
- return xRef;
-
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx b/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx
deleted file mode 100644
index 89f908367d..0000000000
--- a/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx
+++ /dev/null
@@ -1,207 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SDATABASEMETADATA_HXX
-#define CONNECTIVITY_SDATABASEMETADATA_HXX
-#include "MConnection.hxx"
-#include "mozillasrc/MDatabaseMetaDataHelper.hxx"
-#include "TDatabaseMetaDataBase.hxx"
-
-namespace connectivity
-{
- namespace mozab
- {
- //**************************************************************
- //************ Class: ODatabaseMetaData
- //**************************************************************
-
- class ODatabaseMetaData : public ODatabaseMetaDataBase
- {
- OConnection* m_pConnection;
- MDatabaseMetaDataHelper* m_pDbMetaDataHelper;
-
- ODatabaseMetaDataResultSet::ORows& SAL_CALL getColumnRows( const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw( ::com::sun::star::sdbc::SQLException );
-
- protected:
- virtual ~ODatabaseMetaData();
- public:
-
- inline OConnection* getOwnConnection() const { return m_pConnection; }
-
- ODatabaseMetaData(OConnection* _pCon);
-
- private:
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw();
- // cached database information
- virtual ::rtl::OUString impl_getIdentifierQuoteString_throw( );
- virtual sal_Bool impl_isCatalogAtStart_throw( );
- virtual ::rtl::OUString impl_getCatalogSeparator_throw( );
- virtual sal_Bool impl_supportsCatalogsInTableDefinitions_throw( );
- virtual sal_Bool impl_supportsSchemasInTableDefinitions_throw( ) ;
- virtual sal_Bool impl_supportsCatalogsInDataManipulation_throw( );
- virtual sal_Bool impl_supportsSchemasInDataManipulation_throw( ) ;
- virtual sal_Bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) ;
- virtual sal_Bool impl_supportsAlterTableWithAddColumn_throw( );
- virtual sal_Bool impl_supportsAlterTableWithDropColumn_throw( );
- virtual sal_Int32 impl_getMaxStatements_throw( );
- virtual sal_Int32 impl_getMaxTablesInSelect_throw( );
- virtual sal_Bool impl_storesMixedCaseQuotedIdentifiers_throw( );
-
- // as I mentioned before this interface is really BIG
- // XDatabaseMetaData
- virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getUserName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDriverName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL usesLocalFiles( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsUnion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsUnionAll( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxConnections( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // CONNECTIVITY_SDATABASEMETADATA_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MDriver.cxx b/connectivity/source/drivers/mozab/MDriver.cxx
deleted file mode 100644
index 37d0a74dda..0000000000
--- a/connectivity/source/drivers/mozab/MDriver.cxx
+++ /dev/null
@@ -1,333 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <sal/macros.h>
-#include "MDriver.hxx"
-#include "MConnection.hxx"
-#include "connectivity/dbexception.hxx"
-#include "resource/mozab_res.hrc"
-#include "resource/common_res.hrc"
-
-#include <tools/solar.h>
-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 connectivity::mozab;
-
-namespace connectivity
-{
- namespace mozab
- {
- //------------------------------------------------------------------
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL MozabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
- {
- return *(new MozabDriver( _rxFactory ));
- }
- }
-}
-// --------------------------------------------------------------------------------
-MozabDriver::MozabDriver(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory)
- : ODriver_BASE(m_aMutex), m_xMSFactory( _rxFactory )
- ,m_hModule(NULL)
- ,m_pCreationFunc(NULL)
-{
-}
-// -----------------------------------------------------------------------------
-MozabDriver::~MozabDriver()
-{
-}
-// --------------------------------------------------------------------------------
-void MozabDriver::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- // when driver will be destroied so all our connections have to be destroied as well
- for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
- {
- Reference< XComponent > xComp(i->get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- }
- m_xConnections.clear();
- connectivity::OWeakRefArray().swap(m_xConnections); // this really clears
-
- ODriver_BASE::disposing();
- if(m_hModule)
- {
- m_pCreationFunc = NULL;
- osl_unloadModule(m_hModule);
- m_hModule = NULL;
- }
-}
-
-// static ServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString MozabDriver::getImplementationName_Static( ) throw(RuntimeException)
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(MOZAB_DRIVER_IMPL_NAME));
- // this name is referenced in the configuration and in the mozab.xml
- // Please take care when changing it.
-}
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > MozabDriver::getSupportedServiceNames_Static( ) throw (RuntimeException)
-{
- // which service is supported
- // for more information @see com.sun.star.sdbc.Driver
- Sequence< ::rtl::OUString > aSNS( 1 );
- aSNS[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver"));
- return aSNS;
-}
-
-//------------------------------------------------------------------
-::rtl::OUString SAL_CALL MozabDriver::getImplementationName( ) throw(RuntimeException)
-{
- return getImplementationName_Static();
-}
-
-//------------------------------------------------------------------
-sal_Bool SAL_CALL MozabDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-
-//------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL MozabDriver::getSupportedServiceNames( ) throw(RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-
-// --------------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL MozabDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
-{
- if ( !ensureInit() )
- return NULL;
-
- if ( ! acceptsURL( url ) )
- return NULL;
- // create a new connection with the given properties and append it to our vector
- Reference< XConnection > xCon;
- if (m_pCreationFunc)
- {
- ::osl::MutexGuard aGuard(m_aMutex);
- //We must make sure we create an com.sun.star.mozilla.MozillaBootstrap brfore call any mozilla codes
- Reference<XInterface> xInstance = m_xMSFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
-
- OConnection* pCon = reinterpret_cast<OConnection*>((*m_pCreationFunc)(this));
- xCon = pCon; // important here because otherwise the connection could be deleted inside (refcount goes -> 0)
- pCon->construct(url,info); // late constructor call which can throw exception and allows a correct dtor call when so
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
-
- }
- else
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(
- STR_COULD_NOT_LOAD_LIB,
- "$libname$", ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "mozabdrv" )) )
- ) );
-
- ::dbtools::throwGenericSQLException(sError,*this);
- }
-
- return xCon;
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL MozabDriver::acceptsURL( const ::rtl::OUString& url )
- throw(SQLException, RuntimeException)
-{
- if ( !ensureInit() )
- return sal_False;
-
- // here we have to look if we support this url format
- return impl_classifyURL(url) != Unknown;
-}
-// --------------------------------------------------------------------------------
-Sequence< DriverPropertyInfo > SAL_CALL MozabDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException)
-{
- if ( !ensureInit() )
- return Sequence< DriverPropertyInfo >();
-
- if ( acceptsURL(url) )
- {
- if ( impl_classifyURL(url) != LDAP )
- return Sequence< DriverPropertyInfo >();
-
- ::std::vector< DriverPropertyInfo > aDriverInfo;
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseDN"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Base DN."))
- ,sal_False
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MaxRowCount"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Records (max.)"))
- ,sal_False
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("100"))
- ,Sequence< ::rtl::OUString >())
- );
- return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size());
- }
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- // if you have somthing special to say return it here :-)
- return Sequence< DriverPropertyInfo >();
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL MozabDriver::getMajorVersion( ) throw(RuntimeException)
-{
- return 1; // depends on you
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL MozabDriver::getMinorVersion( ) throw(RuntimeException)
-{
- return 0; // depends on you
-}
-// --------------------------------------------------------------------------------
-EDriverType MozabDriver::impl_classifyURL( const ::rtl::OUString& url )
-{
- // Skip 'sdbc:mozab: part of URL
- //
- sal_Int32 nLen = url.indexOf(':');
- nLen = url.indexOf(':',nLen+1);
- ::rtl::OUString aAddrbookURI(url.copy(nLen+1));
- // Get Scheme
- nLen = aAddrbookURI.indexOf(':');
- ::rtl::OUString aAddrbookScheme;
- if ( nLen == -1 )
- {
- // There isn't any subschema: - but could be just subschema
- if ( aAddrbookURI.getLength() > 0 )
- aAddrbookScheme= aAddrbookURI;
- else if(url == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:")) )
- return Unknown; // TODO check
- else
- return Unknown;
- }
- else
- aAddrbookScheme = aAddrbookURI.copy(0, nLen);
-
- struct __scheme_map
- {
- EDriverType eType;
- const sal_Char* pScheme;
- } aSchemeMap[] =
- {
-#if defined(WNT)
- { Outlook, "outlook" },
- { OutlookExpress, "outlookexp" },
-#endif
- { Mozilla, "mozilla" },
- { ThunderBird, "thunderbird" },
- { LDAP, "ldap" }
- };
-
- for ( size_t i=0; i < SAL_N_ELEMENTS( aSchemeMap ); ++i )
- {
- if ( aAddrbookScheme.compareToAscii( aSchemeMap[i].pScheme ) == 0 )
- return aSchemeMap[i].eType;
- }
-
- return Unknown;
-}
-
-// --------------------------------------------------------------------------------
-namespace
-{
- template< typename FUNCTION >
- void lcl_getFunctionFromModuleOrUnload( oslModule& _rModule, const sal_Char* _pAsciiSymbolName, FUNCTION& _rFunction )
- {
- _rFunction = NULL;
- if ( _rModule )
- {
- const ::rtl::OUString sSymbolName = ::rtl::OUString::createFromAscii( _pAsciiSymbolName );
- _rFunction = (FUNCTION)( osl_getFunctionSymbol( _rModule, sSymbolName.pData ) );
-
- if ( !_rFunction )
- { // did not find the symbol
- OSL_FAIL( ::rtl::OString( "lcl_getFunctionFromModuleOrUnload: could not find the symbol " ) + ::rtl::OString( _pAsciiSymbolName ) );
- osl_unloadModule( _rModule );
- _rModule = NULL;
- }
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-extern "C" { static void SAL_CALL thisModule() {} }
-
-bool MozabDriver::ensureInit()
-{
- if ( m_hModule )
- return true;
-
- OSL_ENSURE(NULL == m_pCreationFunc, "MozabDriver::ensureInit: inconsistence: already have a factory function!");
-
- const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY( "mozabdrv" )));
-
- // load the mozabdrv library
- m_hModule = osl_loadModuleRelative(&thisModule, sModuleName.pData, 0);
- OSL_ENSURE(NULL != m_hModule, "MozabDriver::ensureInit: could not load the mozabdrv library!");
- if ( !m_hModule )
- return false;
-
- OSetMozabServiceFactory pSetFactoryFunc( NULL );
-
- lcl_getFunctionFromModuleOrUnload( m_hModule, "setMozabServiceFactory", pSetFactoryFunc );
- lcl_getFunctionFromModuleOrUnload( m_hModule, "OMozabConnection_CreateInstance", m_pCreationFunc );
-
- if ( !m_hModule )
- // one of the symbols did not exist
- return false;
-
- if ( m_xMSFactory.is() )
- {
- // for purpose of transfer safety, the interface needs to be acuired once
- // (will be release by the callee)
- m_xMSFactory->acquire();
- ( *pSetFactoryFunc )( m_xMSFactory.get() );
- }
-
- return true;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MDriver.hxx b/connectivity/source/drivers/mozab/MDriver.hxx
deleted file mode 100644
index 5684486b39..0000000000
--- a/connectivity/source/drivers/mozab/MDriver.hxx
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SDRIVER_HXX
-#define CONNECTIVITY_SDRIVER_HXX
-
-#include <com/sun/star/sdbc/XDriver.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/compbase2.hxx>
-#include "connectivity/CommonTools.hxx"
-#include <osl/module.h>
-
-
-#define MOZAB_DRIVER_IMPL_NAME "com.sun.star.comp.sdbc.MozabDriver"
-
-namespace connectivity
-{
- namespace mozab
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL MozabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception );
-
- typedef void* (SAL_CALL * OMozabConnection_CreateInstanceFunction)(void* _pDriver );
- typedef void (SAL_CALL * OSetMozabServiceFactory)( void* _pFactory );
- typedef const void* (SAL_CALL * OGetSdbcScheme_Function)( short );
-
-
- typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver,
- ::com::sun::star::lang::XServiceInfo > ODriver_BASE;
-
- enum EDriverType
- {
- Mozilla,
- ThunderBird,
- LDAP,
- Outlook,
- OutlookExpress,
- Unknown
- };
-
- class MozabDriver : public ODriver_BASE
- {
- protected:
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xMSFactory;
-
- ::osl::Mutex m_aMutex; // mutex is need to control member access
- connectivity::OWeakRefArray m_xConnections; // vector containing a list
- // of all the Connection objects
- // for this Driver
- oslModule m_hModule;
- OMozabConnection_CreateInstanceFunction m_pCreationFunc;
- OGetSdbcScheme_Function m_pSchemeFunction;
-
- bool ensureInit();
- virtual ~MozabDriver();
- public:
-
- MozabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
- // XInterface
- static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XDriver
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException);
-
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- & getMSFactory(void) const { return m_xMSFactory; }
-
- private:
- EDriverType impl_classifyURL( const ::rtl::OUString& url );
- };
- }
-
-}
-
-#endif // CONNECTIVITY_SDRIVER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MExtConfigAccess.hxx b/connectivity/source/drivers/mozab/MExtConfigAccess.hxx
deleted file mode 100644
index 94f15db36b..0000000000
--- a/connectivity/source/drivers/mozab/MExtConfigAccess.hxx
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONNECTIVITY_MOZAB_MEXTCONFIGACCESS_HXX
-
-// This is the extended version (for use on the SO side of the driver) of MConfigAccess
-// (which is for use on the mozilla side only)
-
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-namespace connectivity
-{
- namespace mozab
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
- createDriverConfigNode( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB );
- }
-}
-
-#endif // CONNECTIVITY_MOZAB_MEXTCONFIGACCESS_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.cxx b/connectivity/source/drivers/mozab/MPreparedStatement.cxx
deleted file mode 100644
index 6136507a0b..0000000000
--- a/connectivity/source/drivers/mozab/MPreparedStatement.cxx
+++ /dev/null
@@ -1,546 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <stdio.h>
-#include <osl/diagnose.h>
-#include "connectivity/sdbcx/VColumn.hxx"
-#include "MPreparedStatement.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include "MResultSetMetaData.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "connectivity/dbexception.hxx"
-#include "connectivity/dbtools.hxx"
-#include <comphelper/types.hxx>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include "diagnose_ex.h"
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::mozab;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::sdbcx;
-using namespace com::sun::star::container;
-using namespace com::sun::star::io;
-using namespace com::sun::star::util;
-
-IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.mozab.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
-
-
-OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql)
- :OCommonStatement(_pConnection)
- ,m_nNumParams(0)
- ,m_sSqlStatement(sql)
- ,m_bPrepared(sal_False)
- ,m_pResultSet()
-{
-}
-// -----------------------------------------------------------------------------
-OPreparedStatement::~OPreparedStatement()
-{
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::lateInit()
-{
- if ( eSelect != parseSql( m_sSqlStatement ) )
- throw SQLException();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- OCommonStatement::disposing();
-
- m_xMetaData.clear();
- if(m_aParameterRow.is())
- {
- m_aParameterRow->get().clear();
- m_aParameterRow = NULL;
- }
- m_xParamColumns = NULL;
-}
-// -----------------------------------------------------------------------------
-
-OCommonStatement::StatementType OPreparedStatement::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted )
- throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException )
-{
- StatementType eStatementType = OCommonStatement::parseSql( sql, bAdjusted );
- if ( eStatementType != eSelect )
- return eStatementType;
-
- m_xParamColumns = new OSQLColumns();
-
- // describe all parameters need for the resultset
- describeParameter();
-
- Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
- OResultSet::setBoundedColumns( m_aRow, m_xParamColumns, xNames, sal_False, m_xDBMetaData, m_aColMapping );
-
- return eStatementType;
-}
-
-// -----------------------------------------------------------------------------
-void OPreparedStatement::initializeResultSet( OResultSet* _pResult )
-{
- OCommonStatement::initializeResultSet( _pResult );
- _pResult->setParameterColumns( m_xParamColumns );
- _pResult->setParameterRow( m_aParameterRow );
-}
-
-// -----------------------------------------------------------------------------
-void OPreparedStatement::clearCachedResultSet()
-{
- OCommonStatement::clearCachedResultSet();
- m_pResultSet.clear();
- m_xMetaData.clear();
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult )
-{
- OCommonStatement::cacheResultSet( _pResult );
- OSL_PRECOND( m_pResultSet == NULL, "OPreparedStatement::parseSql: you should call clearCachedResultSet before!" );
- m_pResultSet = _pResult;
-}
-
-// -----------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::acquire() throw()
-{
- OCommonStatement::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::release() throw()
-{
- OCommonStatement::release();
-}
-// -----------------------------------------------------------------------------
-Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OCommonStatement::queryInterface(rType);
- if(!aRet.hasValue())
- aRet = OPreparedStatement_BASE::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::comphelper::concatSequences(OPreparedStatement_BASE::getTypes(),OCommonStatement::getTypes());
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- sal_Bool bReadOnly = sal_True;
- if ( m_pResultSet.is() )
- bReadOnly = m_pResultSet->determineReadOnly();
- // if we do not have a result set, then we have not been executed, yet. In this case, assuming readonly=true is
- // okay, /me thinks.
-
- if ( !m_xMetaData.is() )
- m_xMetaData = new OResultSetMetaData( m_pSQLIterator->getSelectColumns(), m_pSQLIterator->getTables().begin()->first ,m_pTable,bReadOnly );
-
- return m_xMetaData;
-}
-
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- Reference< XResultSet> xResult = executeQuery();
- return xResult.is();
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this );
- return 0;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- OSL_TRACE("prepStmt::setString( %s )", OUtoCStr( x ) );
- setParameter( parameterIndex, x );
-}
-// -------------------------------------------------------------------------
-
-Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- return (Reference< XConnection >)m_pConnection;
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- OSL_TRACE("In: OPreparedStatement::executeQuery" );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- // our statement has already been parsed in lateInit, no need to do all this (potentially expensive)
- // stuff again. Just execute.
- return impl_executeCurrentQuery();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 /*parameterIndex*/, sal_Bool /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setBoolean", *this );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::setByte( sal_Int32 /*parameterIndex*/, sal_Int8 /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setByte", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setDate( sal_Int32 /*parameterIndex*/, const Date& /*aData*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setDate", *this );
-}
-// -------------------------------------------------------------------------
-
-
-void SAL_CALL OPreparedStatement::setTime( sal_Int32 /*parameterIndex*/, const Time& /*aVal*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setTime", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 /*parameterIndex*/, const DateTime& /*aVal*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setTimestamp", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setDouble( sal_Int32 /*parameterIndex*/, double /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setDouble", *this );
-}
-
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setFloat( sal_Int32 /*parameterIndex*/, float /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setFloat", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setInt( sal_Int32 /*parameterIndex*/, sal_Int32 /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setInt", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setLong( sal_Int32 /*parameterIndex*/, sal_Int64 /*aVal*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setLong", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- checkAndResizeParameters(parameterIndex);
-
- (m_aParameterRow->get())[parameterIndex].setNull();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setClob", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setBlob", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setArray", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setRef", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 /*parameterIndex*/, const Any& /*x*/, sal_Int32 /*sqlType*/, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setObjectWithInfo", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& /*typeName*/ ) throw(SQLException, RuntimeException)
-{
- setNull(parameterIndex,sqlType);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException)
-{
- ::dbtools::implSetObject(this,parameterIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setShort( sal_Int32 /*parameterIndex*/, sal_Int16 /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setShort", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBytes( sal_Int32 /*parameterIndex*/, const Sequence< sal_Int8 >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setBytes", *this );
-}
-// -------------------------------------------------------------------------
-
-
-void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 /*parameterIndex*/, const Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setCharacterStream", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 /*parameterIndex*/, const Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setBinaryStream", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException)
-{
-}
-// -------------------------------------------------------------------------
-void OPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- break;
- case PROPERTY_ID_USEBOOKMARKS:
- break;
- default:
- OCommonStatement::setFastPropertyValue_NoBroadcast(nHandle,rValue);
- }
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::checkParameterIndex(sal_Int32 _parameterIndex)
-{
- if( !_parameterIndex || _parameterIndex > m_nNumParams)
- ::dbtools::throwInvalidIndexException(*this);
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::checkAndResizeParameters(sal_Int32 parameterIndex)
-{
- ::connectivity::checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- if ( !m_aParameterRow.is() ) {
- m_aParameterRow = new OValueVector();
- m_aParameterRow->get().push_back(sal_Int32(0));
- }
-
- if ((sal_Int32)(m_aParameterRow->get()).size() <= parameterIndex)
- (m_aParameterRow->get()).resize(parameterIndex+1);
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const
-ORowSetValue& x)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkAndResizeParameters(parameterIndex);
-
- OSL_TRACE("setParameter( %d, '%s')", parameterIndex, OUtoCStr(x) );
- (m_aParameterRow->get())[parameterIndex] = x;
-}
-
-//------------------------------------------------------------------
-sal_uInt32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Reference<XPropertySet>& _xCol)
-{
- OSL_UNUSED( pParameter );
- // Nr. of the new added Parameters
- sal_uInt32 nParameter = m_xParamColumns->get().size()+1;
-
- OSL_ENSURE(SQL_ISRULE(pParameter,parameter),"OResultSet::AddParameter: Argument ist kein Parameter");
- OSL_ENSURE(pParameter->count() > 0,"OResultSet: Fehler im Parse Tree");
-#if OSL_DEBUG_LEVEL > 0
- OSQLParseNode * pMark = pParameter->getChild(0);
- OSL_UNUSED( pMark );
-#endif
-
- ::rtl::OUString sParameterName;
-
- // set up Parameter-Column:
- sal_Int32 eType = DataType::VARCHAR;
- sal_uInt32 nPrecision = 255;
- sal_Int32 nScale = 0;
- sal_Int32 nNullable = ColumnValue::NULLABLE;
-
- if (_xCol.is())
- {
- // Type, Precision, Scale ... utilize the selected Columns,
- // then this Column will get the value assigned or with this
- // Column will the value be compared.
- eType = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)));
- nPrecision = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)));
- nScale = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)));
- nNullable = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)));
- _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sParameterName;
- }
-
- Reference<XPropertySet> xParaColumn = new connectivity::sdbcx::OColumn(sParameterName
- ,::rtl::OUString()
- ,::rtl::OUString()
- ,::rtl::OUString()
- ,nNullable
- ,nPrecision
- ,nScale
- ,eType
- ,sal_False
- ,sal_False
- ,sal_False
- ,m_pSQLIterator->isCaseSensitive());
- m_xParamColumns->get().push_back(xParaColumn);
- return nParameter;
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::describeColumn(OSQLParseNode*
-_pParameter,OSQLParseNode* _pNode,const OSQLTable& _xTable)
-{
- Reference<XPropertySet> xProp;
- if(SQL_ISRULE(_pNode,column_ref))
- {
- ::rtl::OUString sColumnName,sTableRange;
- m_pSQLIterator->getColumnRange(_pNode,sColumnName,sTableRange);
- if(sColumnName.getLength())
- {
- Reference<XNameAccess> xNameAccess = _xTable->getColumns();
- if(xNameAccess->hasByName(sColumnName))
- xNameAccess->getByName(sColumnName) >>= xProp;
- AddParameter(_pParameter,xProp);
- }
- }
- // else
- // AddParameter(_pParameter,xProp);
-}
-// -------------------------------------------------------------------------
-void OPreparedStatement::describeParameter()
-{
- ::std::vector< OSQLParseNode*> aParseNodes;
- scanParameter(m_pParseTree,aParseNodes);
- if(aParseNodes.size())
- {
- m_xParamColumns = new OSQLColumns();
- const OSQLTables& xTabs = m_pSQLIterator->getTables();
- if(xTabs.size())
- {
- OSQLTable xTable = xTabs.begin()->second;
- ::std::vector< OSQLParseNode*>::const_iterator aIter =
-aParseNodes.begin();
- for (;aIter != aParseNodes.end();++aIter )
- {
- describeColumn(*aIter,(*aIter)->getParent()->getChild(0),xTable);
- }
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes)
-{
- OSL_ENSURE(pParseNode != NULL,"OResultSet: interner Fehler: ungueltiger ParseNode");
-
- // Parameter Name-Row found?
- if (SQL_ISRULE(pParseNode,parameter))
- {
- OSL_ENSURE(pParseNode->count() >= 1,"OResultSet: Parse Tree fehlerhaft");
- OSL_ENSURE(pParseNode->getChild(0)->getNodeType() == SQL_NODE_PUNCTUATION,"OResultSet: Parse Tree fehlerhaft");
-
- _rParaNodes.push_back(pParseNode);
- // further search isn't necessary
- return;
- }
-
- // Search on in Parse Tree
- for (sal_uInt32 i = 0; i < pParseNode->count(); i++)
- scanParameter(pParseNode->getChild(i),_rParaNodes);
-}
-// -----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL OPreparedStatement::getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return NULL;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OPreparedStatement::getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return 0;
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OPreparedStatement::getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.hxx b/connectivity/source/drivers/mozab/MPreparedStatement.hxx
deleted file mode 100644
index cf2dd1986e..0000000000
--- a/connectivity/source/drivers/mozab/MPreparedStatement.hxx
+++ /dev/null
@@ -1,170 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SPREPAREDSTATEMENT_HXX
-#define CONNECTIVITY_SPREPAREDSTATEMENT_HXX
-
-#include "MResultSet.hxx"
-#include "MStatement.hxx"
-#include <com/sun/star/sdbc/XPreparedStatement.hpp>
-#include <com/sun/star/sdbc/XParameters.hpp>
-#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/sdbc/XMultipleResults.hpp>
-#include <cppuhelper/compbase5.hxx>
-
-namespace connectivity
-{
- namespace mozab
- {
-
- class OBoundParam;
- typedef ::cppu::ImplHelper5< ::com::sun::star::sdbc::XPreparedStatement,
- ::com::sun::star::sdbc::XParameters,
- ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
- ::com::sun::star::sdbc::XMultipleResults,
- ::com::sun::star::lang::XServiceInfo> OPreparedStatement_BASE;
-
- class OPreparedStatement : public OCommonStatement,
- public OPreparedStatement_BASE
- {
- protected:
- struct Parameter
- {
- ::com::sun::star::uno::Any aValue;
- sal_Int32 nDataType;
-
- Parameter(const ::com::sun::star::uno::Any& rValue,
- sal_Int32 rDataType) : aValue(rValue),nDataType(rDataType)
- {
- }
-
- };
-
- ::std::vector< Parameter> m_aParameters;
- //====================================================================
- // Data attributes
- //====================================================================
- sal_Int32 m_nNumParams; // Number of parameter markers
- // for the prepared statement
-
- ::rtl::OUString m_sSqlStatement;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData;
- sal_Bool m_bPrepared;
- ::rtl::Reference< OResultSet > m_pResultSet;
- ::rtl::Reference<connectivity::OSQLColumns> m_xParamColumns; // the parameter columns
- OValueRow m_aParameterRow;
-
-
- void checkParameterIndex(sal_Int32 _parameterIndex);
-
- protected:
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue)
- throw (::com::sun::star::uno::Exception);
- virtual ~OPreparedStatement();
-
- virtual void SAL_CALL disposing();
-
- // OCommonStatement overridables
- virtual StatementType
- parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
- virtual void initializeResultSet( OResultSet* _pResult );
- virtual void clearCachedResultSet();
- virtual void cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult );
-
-
- void checkAndResizeParameters(sal_Int32 parameterIndex);
- void setParameter(sal_Int32 parameterIndex, const ORowSetValue& x);
-
- sal_uInt32 AddParameter(connectivity::OSQLParseNode * pParameter,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol);
- void scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes);
- void describeColumn(OSQLParseNode* _pParameter,OSQLParseNode* _pNode,const OSQLTable& _xTable);
- void describeParameter();
-
- public:
- DECLARE_SERVICE_INFO();
- // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
- OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql);
- void lateInit();
-
- //XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
- //XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XPreparedStatement
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XParameters
- virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XResultSetMetaDataSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XMultipleResults
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- public:
- using OCommonStatement::executeQuery;
- using OCommonStatement::executeUpdate;
- using OCommonStatement::execute;
- protected:
- using OPropertySetHelper::getFastPropertyValue;
- };
- }
-}
-#endif // CONNECTIVITY_SPREPAREDSTATEMENT_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MResultSet.cxx b/connectivity/source/drivers/mozab/MResultSet.cxx
deleted file mode 100644
index 4552b9dc69..0000000000
--- a/connectivity/source/drivers/mozab/MResultSet.cxx
+++ /dev/null
@@ -1,1980 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <comphelper/property.hxx>
-#include <comphelper/sequence.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/extract.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/dbtools.hxx>
-
-#include <TSortIndex.hxx>
-#include <rtl/string.hxx>
-#include <vector>
-#include <algorithm>
-#include "MResultSet.hxx"
-#include "MResultSetMetaData.hxx"
-#include "FDatabaseMetaDataResultSet.hxx"
-#include "resource/mozab_res.hrc"
-#include "resource/common_res.hrc"
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::mozab;
-using namespace ::cppu;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::container;
-using namespace com::sun::star::io;
-using namespace com::sun::star::util;
-
-//------------------------------------------------------------------------------
-// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet");
-::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException) \
-{
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.mozab.ResultSet"));
-}
-// -------------------------------------------------------------------------
- Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw( RuntimeException)
-{
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(2);
- aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet"));
- aSupported[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ResultSet"));
- return aSupported;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-
-// -------------------------------------------------------------------------
-OResultSet::OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< connectivity::OSQLParseTreeIterator >& _pSQLIterator )
- : OResultSet_BASE(m_aMutex)
- ,OPropertySetHelper(OResultSet_BASE::rBHelper)
- ,m_pStatement(pStmt)
- ,m_xStatement(*pStmt)
- ,m_xMetaData(NULL)
- ,m_nRowPos(0)
- ,m_nOldRowPos(0)
- ,m_nFetchSize(0)
- ,m_nResultSetType(ResultSetType::SCROLL_INSENSITIVE)
- ,m_nFetchDirection(FetchDirection::FORWARD)
- ,m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
- ,m_pSQLIterator( _pSQLIterator )
- ,m_pParseTree( _pSQLIterator->getParseTree() )
- ,m_aQuery( pStmt->getOwnConnection()->getColumnAlias() )
- ,m_pTable(NULL)
- ,m_CurrentRowCount(0)
- ,m_nParamIndex(0)
- ,m_bIsAlwaysFalseQuery(sal_False)
- ,m_pKeySet(NULL)
- ,m_nNewRow(0)
- ,m_nUpdatedRow(0)
- ,m_RowStates(0)
- ,m_bIsReadOnly(-1)
-{
-
- m_aQuery.setMaxNrOfReturns(pStmt->getOwnConnection()->getMaxResultRecords());
-}
-// -------------------------------------------------------------------------
-OResultSet::~OResultSet()
-{
-}
-
-// -------------------------------------------------------------------------
-void OResultSet::disposing(void)
-{
- OPropertySetHelper::disposing();
-
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_xStatement.clear();
- m_xMetaData.clear();
- m_pParseTree = NULL;
- m_xColumns = NULL;
- m_xParamColumns = NULL;
- m_pKeySet = NULL;
- if(m_pTable)
- {
- m_pTable->release();
- m_pTable = NULL;
- }
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OPropertySetHelper::queryInterface(rType);
- if(!aRet.hasValue())
- aRet = OResultSet_BASE::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
- Sequence< Type > SAL_CALL OResultSet::getTypes( ) throw( RuntimeException)
-{
- OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
-}
-// -------------------------------------------------------------------------
-void OResultSet::methodEntry()
-{
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- if ( !m_pTable )
- {
- OSL_FAIL( "OResultSet::methodEntry: looks like we're disposed, but how is this possible?" );
- throw DisposedException( ::rtl::OUString(), *this );
- }
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- // find the first column with the name columnName
- Reference< XResultSetMetaData > xMeta = getMetaData();
- sal_Int32 nLen = xMeta->getColumnCount();
- sal_Int32 i = 1;
- for(;i<=nLen;++i)
- if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
- columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
- break;
- return i;
-}
-// -------------------------------------------------------------------------
-Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- m_bWasNull = sal_True;
- return sal_False;
-}
-// -------------------------------------------------------------------------
-
-sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return 0;
-}
-// -------------------------------------------------------------------------
-
-Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return Sequence< sal_Int8 >();
-}
-// -------------------------------------------------------------------------
-
-Date SAL_CALL OResultSet::getDate( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return Date();
-}
-// -------------------------------------------------------------------------
-
-double SAL_CALL OResultSet::getDouble( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return 0.0;
-}
-// -------------------------------------------------------------------------
-
-float SAL_CALL OResultSet::getFloat( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return 0;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return 0;
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- OSL_TRACE("In/Out: OResultSet::getRow, return = %u", m_nRowPos );
- return m_nRowPos;
-}
-// -------------------------------------------------------------------------
-
-sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return sal_Int64();
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- if(!m_xMetaData.is())
- m_xMetaData = new OResultSetMetaData(
- m_pSQLIterator->getSelectColumns(), m_pSQLIterator->getTables().begin()->first ,m_pTable,determineReadOnly());
- return m_xMetaData;
-}
-// -------------------------------------------------------------------------
-Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-
-// -------------------------------------------------------------------------
-
-Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Any SAL_CALL OResultSet::getObject( sal_Int32 /*columnIndex*/, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
- return Any();
-}
-// -------------------------------------------------------------------------
-
-sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-
-void OResultSet::checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException)
-{
- if(columnIndex <= 0 || columnIndex > (sal_Int32)m_xColumns->get().size())
- ::dbtools::throwInvalidIndexException(*this);
-}
-// -------------------------------------------------------------------------
-sal_uInt32 OResultSet::currentRowCount()
-{
- if ( m_bIsAlwaysFalseQuery )
- return 0;
- return m_aQuery.getRealRowCount() - deletedCount();
-}
-
-// -------------------------------------------------------------------------
-
-sal_Bool OResultSet::fetchCurrentRow( ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("fetchCurrentRow, m_nRowPos = %u", m_nRowPos );
- return fetchRow(getCurrentCardNumber());
-}
-
-// -------------------------------------------------------------------------
-sal_Bool OResultSet::pushCard(sal_uInt32 cardNumber) throw(SQLException, RuntimeException)
-{
- if (cardNumber == 0)
- return sal_True;
- // Check whether we are storing the updated row
- if ( (m_aRow->get())[0].isNull() || (sal_Int32)(m_aRow->get())[0] != (sal_Int32)cardNumber )
- return sal_False;
-
- sal_Int32 nCount = m_aColumnNames.getLength();
- m_aQuery.setRowStates(cardNumber,m_RowStates);
- for( sal_Int32 i = 1; i <= nCount; i++ )
- {
- if ( (m_aRow->get())[i].isBound() )
- {
- //
- // Everything in the addressbook is a string!
- //
- if ( !m_aQuery.setRowValue( (m_aRow->get())[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR ))
- {
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
- }
- }
- }
- return sal_True;
-
-}
-// -------------------------------------------------------------------------
-sal_Bool OResultSet::fetchRow(sal_Int32 cardNumber,sal_Bool bForceReload) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("fetchRow, cardNumber = %u", cardNumber );
- if (!bForceReload)
- {
- // Check whether we've already fetched the row...
- if ( !(m_aRow->get())[0].isNull() && (sal_Int32)(m_aRow->get())[0] == (sal_Int32)cardNumber )
- return sal_True;
- //Check whether the old row has been changed
- if (cardNumber == m_nUpdatedRow)
- {
- //write back the changes first
- if (!pushCard(cardNumber)) //error write back the changes
- throw SQLException();
- }
- }
- else
- m_aQuery.resyncRow(cardNumber);
-
- if ( validRow( cardNumber ) == sal_False )
- return sal_False;
-
- (m_aRow->get())[0] = (sal_Int32)cardNumber;
- sal_Int32 nCount = m_aColumnNames.getLength();
- m_RowStates = m_aQuery.getRowStates(cardNumber);
- for( sal_Int32 i = 1; i <= nCount; i++ )
- {
- if ( (m_aRow->get())[i].isBound() )
- {
- //
- // Everything in the addressbook is a string!
- //
- if ( !m_aQuery.getRowValue( (m_aRow->get())[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR ))
- {
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
- }
- }
- }
- return sal_True;
-}
-// -------------------------------------------------------------------------
-
-const ORowSetValue& OResultSet::getValue(sal_Int32 cardNumber, sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- if ( fetchRow( cardNumber ) == sal_False )
- {
- OSL_FAIL("fetchRow() returned False" );
- m_bWasNull = sal_True;
- return *ODatabaseMetaDataResultSet::getEmptyValue();
- }
-
- m_bWasNull = (m_aRow->get())[columnIndex].isNull();
- return (m_aRow->get())[columnIndex];
-
-}
-// -------------------------------------------------------------------------
-
-
-::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- OSL_ENSURE(m_xColumns.is(), "Need the Columns!!");
- OSL_ENSURE(columnIndex <= (sal_Int32)m_xColumns->get().size(), "Trying to access invalid columns number");
- checkIndex( columnIndex );
-
- // If this query was sorted then we should have a valid KeySet, so use it
- return getValue(getCurrentCardNumber(), mapColumn( columnIndex ) );
-
-}
-// -------------------------------------------------------------------------
-
-Time SAL_CALL OResultSet::getTime( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return Time();
-}
-// -------------------------------------------------------------------------
-
-
-DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return DateTime();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- // here you have to implement your movements
- // return true means there is no data
- OSL_TRACE("In/Out: OResultSet::isBeforeFirst" );
- return( m_nRowPos < 1 );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- OSL_TRACE("In/Out: OResultSet::isAfterLast" );
- return m_nRowPos > currentRowCount() && m_aQuery.queryComplete();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- OSL_TRACE("In/Out: OResultSet::isFirst" );
- return m_nRowPos == 1;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- OSL_TRACE("In/Out: OResultSet::isLast" );
- return m_nRowPos == currentRowCount() && m_aQuery.queryComplete();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- // move before the first row so that isBeforeFirst returns false
- OSL_TRACE("In/Out: OResultSet::beforeFirst" );
- if ( first() )
- previous();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("In/Out: OResultSet::afterLast" );
-
- if(last())
- next();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("In/Out: OResultSet::close" );
- dispose();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OResultSet::first" );
- return seekRow( FIRST_POS );
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OResultSet::last" );
- return seekRow( LAST_POS );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OResultSet::absolute" );
- return seekRow( ABSOLUTE_POS, row );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OResultSet::relative" );
- return seekRow( RELATIVE_POS, row );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("In/Out: OResultSet::previous" );
- return seekRow( PRIOR_POS );
-}
-// -------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- OSL_TRACE("In/Out: OResultSet::getStatement" );
- return m_xStatement;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("In/Out: OResultSet::rowDeleted, m_RowStates=%u",m_RowStates );
- return ((m_RowStates & RowStates_Deleted) == RowStates_Deleted) ;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("In/Out: OResultSet::rowInserted,m_RowStates=%u",m_RowStates );
- return ((m_RowStates & RowStates_Inserted) == RowStates_Inserted);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("In/Out: OResultSet::rowUpdated,m_RowStates=%u",m_RowStates );
- return ((m_RowStates & RowStates_Updated) == RowStates_Updated) ;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException)
-{
- return seekRow( NEXT_POS );
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- return m_bWasNull;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::cancel( ) throw(RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("In/Out: OResultSet::cancel" );
-
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OResultSet::clearWarnings" );
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OResultSet::getWarnings" );
- return Any();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OResultSet::refreshRow" );
- if (fetchRow(getCurrentCardNumber(),sal_True)) //force fetch current row will cause we lose all change to the current row
- m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_REFRESH_ROW, *this );
-}
-// -------------------------------------------------------------------------
-IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
-{
- Sequence< Property > aProps(5);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY);
-
- return new OPropertyArrayHelper(aProps);
-}
-// -------------------------------------------------------------------------
-IPropertyArrayHelper & OResultSet::getInfoHelper()
-{
- return *const_cast<OResultSet*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool OResultSet::convertFastPropertyValue(
- Any & /*rConvertedValue*/,
- Any & /*rOldValue*/,
- sal_Int32 nHandle,
- const Any& /*rValue*/ )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- OSL_FAIL( "OResultSet::convertFastPropertyValue: not implemented!" );
- switch(nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw ::com::sun::star::lang::IllegalArgumentException();
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- default:
- ;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-void OResultSet::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& /*rValue*/
- )
- throw (Exception)
-{
- OSL_FAIL( "OResultSet::setFastPropertyValue_NoBroadcast: not implemented!" );
- switch(nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw Exception();
- case PROPERTY_ID_FETCHDIRECTION:
- break;
- case PROPERTY_ID_FETCHSIZE:
- break;
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void OResultSet::getFastPropertyValue(
- Any& rValue,
- sal_Int32 nHandle
- ) const
-{
- switch(nHandle)
- {
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- rValue <<= (sal_Int32)m_nResultSetConcurrency;
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- rValue <<= m_nResultSetType;
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- rValue <<= m_nFetchDirection;
- break;
- case PROPERTY_ID_FETCHSIZE:
- rValue <<= m_nFetchSize;
- break;
- case PROPERTY_ID_ISBOOKMARKABLE:
- const_cast< OResultSet* >( this )->determineReadOnly();
- rValue <<= !m_bIsReadOnly;
- break;
- }
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OResultSet::acquire() throw()
-{
- OResultSet_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OResultSet::release() throw()
-{
- OResultSet_BASE::release();
-}
-// -----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-void OResultSet::initializeRow(OValueRow& _rRow,sal_Int32 _nColumnCount)
-{
- if(!_rRow.is())
- {
- _rRow = new OValueVector(_nColumnCount);
- (_rRow->get())[0].setBound(sal_True);
- ::std::for_each(_rRow->get().begin()+1,_rRow->get().end(),TSetBound(sal_False));
- }
-}
-
-// -------------------------------------------------------------------------
-void OResultSet::parseParameter( const OSQLParseNode* pNode, rtl::OUString& rMatchString )
-{
- OSL_ENSURE(pNode->count() > 0,"Error parsing parameter in Parse Tree");
- OSQLParseNode *pMark = pNode->getChild(0);
-
- // Initialize to empty string
- rMatchString = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(""));
-
- rtl::OUString aParameterName;
- if (SQL_ISPUNCTUATION(pMark,"?")) {
- aParameterName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?"));
- }
- else if (SQL_ISPUNCTUATION(pMark,":")) {
- aParameterName = pNode->getChild(1)->getTokenValue();
- }
- // XXX - Now we know name, what's value????
- m_nParamIndex ++;
- OSL_TRACE("Parameter name [%d]: %s\n", m_nParamIndex,OUtoCStr(aParameterName) );
-
- if ( m_aParameterRow.is() ) {
- OSL_ENSURE( m_nParamIndex < (sal_Int32)m_aParameterRow->get().size() + 1, "More parameters than values found" );
- rMatchString = (m_aParameterRow->get())[(sal_uInt16)m_nParamIndex];
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE("Prop Value : %s\n", OUtoCStr( rMatchString ) );
-#endif
- }
-#if OSL_DEBUG_LEVEL > 0
- else {
- OSL_TRACE("Prop Value : Invalid ParameterRow!\n" );
- }
-#endif
-}
-
-void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree,
- MQueryExpression &queryExpression)
-{
- ::rtl::OUString columnName;
- MQueryOp::cond_type op( MQueryOp::Is );
- ::rtl::OUString matchString;
-
- if ( parseTree == NULL )
- return;
-
- if ( m_pSQLIterator->getParseTree() != NULL ) {
- ::rtl::Reference<OSQLColumns> xColumns = m_pSQLIterator->getParameters();
- if(xColumns.is())
- {
- ::rtl::OUString aTabName,aColName,aParameterName,aParameterValue;
- OSQLColumns::Vector::iterator aIter = xColumns->get().begin();
- sal_Int32 i = 1;
- for(;aIter != xColumns->get().end();++aIter)
- {
- (*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName;
- OSL_TRACE("Prop Column Name : %s\n", OUtoCStr( aColName ) );
- if ( m_aParameterRow.is() ) {
- aParameterValue = (m_aParameterRow->get())[(sal_uInt16)i];
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE("Prop Value : %s\n", OUtoCStr( aParameterValue ) );
-#endif
- }
-#if OSL_DEBUG_LEVEL > 0
- else {
- OSL_TRACE("Prop Value : Invalid ParameterRow!\n" );
- }
-#endif
- i++;
- }
- }
-
- }
-
- if ( SQL_ISRULE(parseTree,where_clause) )
- {
- OSL_TRACE("analyseSQL : Got WHERE clause\n");
- // Reset Parameter Counter
- resetParameters();
- analyseWhereClause( parseTree->getChild( 1 ), queryExpression );
- }
- else if ( parseTree->count() == 3 && // Handle ()'s
- SQL_ISPUNCTUATION(parseTree->getChild(0),"(") &&
- SQL_ISPUNCTUATION(parseTree->getChild(2),")"))
- {
-
- OSL_TRACE("analyseSQL : Got Punctuation ()\n");
- MQueryExpression *subExpression = new MQueryExpression();
- analyseWhereClause( parseTree->getChild( 1 ), *subExpression );
- queryExpression.getExpressions().push_back( subExpression );
- }
- else if ((SQL_ISRULE(parseTree,search_condition) || (SQL_ISRULE(parseTree,boolean_term)))
- && parseTree->count() == 3) // Handle AND/OR
- {
-
- OSL_TRACE("analyseSQL : Got AND/OR clause\n");
-
- // TODO - Need to take care or AND, for now match is always OR
- analyseWhereClause( parseTree->getChild( 0 ), queryExpression );
- analyseWhereClause( parseTree->getChild( 2 ), queryExpression );
-
- if (SQL_ISTOKEN(parseTree->getChild(1),OR)) { // OR-Operator
- queryExpression.setExpressionCondition( MQueryExpression::OR );
- }
- else if (SQL_ISTOKEN(parseTree->getChild(1),AND)) { // AND-Operator
- queryExpression.setExpressionCondition( MQueryExpression::AND );
- }
- else {
- OSL_FAIL("analyseSQL: Error in Parse Tree");
- }
- }
- else if (SQL_ISRULE(parseTree,comparison_predicate))
- {
- OSL_ENSURE(parseTree->count() == 3, "Error parsing COMPARE predicate");
- if (!(SQL_ISRULE(parseTree->getChild(0),column_ref) ||
- parseTree->getChild(2)->getNodeType() == SQL_NODE_STRING ||
- parseTree->getChild(2)->getNodeType() == SQL_NODE_INTNUM ||
- parseTree->getChild(2)->getNodeType() == SQL_NODE_APPROXNUM ||
- SQL_ISTOKEN(parseTree->getChild(2),TRUE) ||
- SQL_ISTOKEN(parseTree->getChild(2),FALSE) ||
- SQL_ISRULE(parseTree->getChild(2),parameter) ||
- // odbc date
- (SQL_ISRULE(parseTree->getChild(2),set_fct_spec) && SQL_ISPUNCTUATION(parseTree->getChild(2)->getChild(0),"{"))))
- {
- m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
- }
-
- OSQLParseNode *pPrec = parseTree->getChild(1);
- if (pPrec->getNodeType() == SQL_NODE_EQUAL)
- op = MQueryOp::Is;
- else if (pPrec->getNodeType() == SQL_NODE_NOTEQUAL)
- op = MQueryOp::IsNot;
-
- ::rtl::OUString sTableRange;
- if(SQL_ISRULE(parseTree->getChild(0),column_ref))
- m_pSQLIterator->getColumnRange(parseTree->getChild(0),columnName,sTableRange);
- else if(parseTree->getChild(0)->isToken())
- columnName = parseTree->getChild(0)->getTokenValue();
-
- if ( SQL_ISRULE(parseTree->getChild(2),parameter) ) {
- parseParameter( parseTree->getChild(2), matchString );
- }
- else {
- matchString = parseTree->getChild(2)->getTokenValue();
- }
-
- if ( columnName.compareToAscii("0") ==0 && op == MQueryOp::Is &&
- matchString.compareToAscii("1") == 0 ) {
- OSL_TRACE("Query always evaluates to FALSE");
- m_bIsAlwaysFalseQuery = sal_True;
- }
- queryExpression.getExpressions().push_back( new MQueryExpressionString( columnName, op, matchString ));
- }
- else if (SQL_ISRULE(parseTree,like_predicate))
- {
- OSL_ENSURE(parseTree->count() == 2, "Error parsing LIKE predicate");
-
- OSL_TRACE("analyseSQL : Got LIKE rule\n");
-
- if ( !(SQL_ISRULE(parseTree->getChild(0), column_ref)) )
- {
- m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_LIKE_COLUMN, *this );
- }
-
-
- OSQLParseNode *pColumn;
- OSQLParseNode *pAtom;
- OSQLParseNode *pOptEscape;
- const OSQLParseNode* pPart2 = parseTree->getChild(1);
- pColumn = parseTree->getChild(0); // Match Item
- pAtom = pPart2->getChild(pPart2->count()-2); // Match String
- pOptEscape = pPart2->getChild(pPart2->count()-1); // Opt Escape Rule
- (void)pOptEscape;
- const bool bNot = SQL_ISTOKEN(pPart2->getChild(0), NOT);
-
- if (!(pAtom->getNodeType() == SQL_NODE_STRING ||
- pAtom->getNodeType() == SQL_NODE_NAME ||
- SQL_ISRULE(pAtom,parameter) ||
- ( pAtom->getChild(0) && pAtom->getChild(0)->getNodeType() == SQL_NODE_NAME ) ||
- ( pAtom->getChild(0) && pAtom->getChild(0)->getNodeType() == SQL_NODE_STRING )
- ) )
- {
- OSL_TRACE("analyseSQL : pAtom->count() = %d\n", pAtom->count() );
-
- m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_LIKE_STRING, *this );
- }
-
- const sal_Unicode WILDCARD = '%';
- const sal_Unicode ALT_WILDCARD = '*';
- const sal_Unicode MATCHCHAR = '_';
-
- ::rtl::OUString sTableRange;
- if(SQL_ISRULE(pColumn,column_ref))
- m_pSQLIterator->getColumnRange(pColumn,columnName,sTableRange);
-
- OSL_TRACE("ColumnName = %s\n", OUtoCStr( columnName ) );
-
- if ( SQL_ISRULE(pAtom,parameter) ) {
- parseParameter( pAtom, matchString );
- // Replace all '*' with '%' : UI Usually does this but not with
- // Parameters for some reason.
- matchString = matchString.replace( ALT_WILDCARD, WILDCARD );
- }
- else
- {
- matchString = pAtom->getTokenValue();
- }
-
- // Determine where '%' character is...
-
- if ( matchString.equals( ::rtl::OUString::valueOf( WILDCARD ) ) )
- {
- // String containing only a '%' and nothing else
- op = MQueryOp::Exists;
- // Will be ignored for Exists case, but clear anyway.
- matchString = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(""));
- }
- else if ( matchString.indexOf ( WILDCARD ) == -1 &&
- matchString.indexOf ( MATCHCHAR ) == -1 )
- {
- // Simple string , eg. "to match"
- if ( bNot )
- op = MQueryOp::DoesNotContain;
- else
- op = MQueryOp::Contains;
- }
- else if ( matchString.indexOf ( WILDCARD ) == 0
- && matchString.lastIndexOf ( WILDCARD ) == matchString.getLength() -1
- && matchString.indexOf ( WILDCARD, 1 ) == matchString.lastIndexOf ( WILDCARD )
- && matchString.indexOf( MATCHCHAR ) == -1
- )
- {
- // Relatively simple "%string%" - ie, contains...
- // Cut '%' from front and rear
- matchString = matchString.replaceAt( 0, 1, rtl::OUString() );
- matchString = matchString.replaceAt( matchString.getLength() -1 , 1, rtl::OUString() );
-
- if (bNot)
- op = MQueryOp::DoesNotContain;
- else
- op = MQueryOp::Contains;
- }
- else if ( bNot )
- {
- // We currently can't handle a 'NOT LIKE' when there are '%' or
- // '_' dispersed throughout
- m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_NOT_LIKE_TOO_COMPLEX, *this );
- }
- else
- {
- if ( (matchString.indexOf ( WILDCARD ) == matchString.lastIndexOf ( WILDCARD ))
- && matchString.indexOf( MATCHCHAR ) == -1
- )
- {
- // One occurrence of '%' - no '_' matches...
- if ( matchString.indexOf ( WILDCARD ) == 0 )
- {
- op = MQueryOp::EndsWith;
- matchString = matchString.replaceAt( 0, 1, rtl::OUString());
- }
- else if ( matchString.indexOf ( WILDCARD ) == matchString.getLength() -1 )
- {
- op = MQueryOp::BeginsWith;
- matchString = matchString.replaceAt( matchString.getLength() -1 , 1, rtl::OUString() );
- }
- else
- {
- sal_Int32 pos = matchString.indexOf ( WILDCARD );
- matchString = matchString.replaceAt( pos, 1,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".*")) );
- op = MQueryOp::RegExp;
- }
-
- }
- else
- {
- // Most Complex, need to use an RE
- sal_Int32 pos = matchString.indexOf ( WILDCARD );
- while ( (pos = matchString.indexOf ( WILDCARD )) != -1 )
- {
- matchString = matchString.replaceAt( pos, 1, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".*")) );
- }
-
- pos = matchString.indexOf ( MATCHCHAR );
- while ( (pos = matchString.indexOf( MATCHCHAR )) != -1 )
- {
- matchString = matchString.replaceAt( pos, 1, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".")) );
- }
-
- op = MQueryOp::RegExp;
- }
- }
-
- queryExpression.getExpressions().push_back( new MQueryExpressionString( columnName, op, matchString ));
- }
- else if (SQL_ISRULE(parseTree,test_for_null))
- {
- OSL_ENSURE(parseTree->count() == 2,"Error in ParseTree");
- const OSQLParseNode* pPart2 = parseTree->getChild(1);
- OSL_ENSURE(SQL_ISTOKEN(pPart2->getChild(0),IS),"Error in ParseTree");
-
- if (!SQL_ISRULE(parseTree->getChild(0),column_ref))
- {
- m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_IS_NULL_COLUMN, *this );
- }
-
- if (SQL_ISTOKEN(pPart2->getChild(1),NOT))
- {
- op = MQueryOp::Exists;
- }
- else
- op = MQueryOp::DoesNotExist;
-
- ::rtl::OUString sTableRange;
- m_pSQLIterator->getColumnRange(parseTree->getChild(0),columnName,sTableRange);
-
- queryExpression.getExpressions().push_back( new MQueryExpressionString( columnName, op ));
- }
- else
- {
- OSL_TRACE( "Unexpected statement!!!" );
-
- m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
- }
-}
-
-
-// -----------------------------------------------------------------------------
-
-void OResultSet::fillRowData()
- throw( ::com::sun::star::sdbc::SQLException )
-{
- OSL_ENSURE( m_pStatement, "Require a statement" );
-
- MQueryExpression queryExpression;
-
- OConnection* xConnection = static_cast<OConnection*>(m_pStatement->getConnection().get());
- m_xColumns = m_pSQLIterator->getSelectColumns();
-
- OSL_ENSURE(m_xColumns.is(), "Need the Columns!!");
-
- OSQLColumns::Vector::const_iterator aIter = m_xColumns->get().begin();
- const ::rtl::OUString sProprtyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
- ::rtl::OUString sName;
- m_aAttributeStrings.clear();
- m_aAttributeStrings.reserve(m_xColumns->get().size());
- for (sal_Int32 i = 1; aIter != m_xColumns->get().end();++aIter, i++)
- {
- (*aIter)->getPropertyValue(sProprtyName) >>= sName;
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE("Query Columns : (%d) %s\n", i, OUtoCStr(sName) );
-#endif
- m_aAttributeStrings.push_back( sName );
- }
-
-
- // Generate Match Conditions for Query
- const OSQLParseNode* pParseTree = m_pSQLIterator->getWhereTree();
-
- // const OSQLParseNode* pParseTree = NULL;
-
- m_bIsAlwaysFalseQuery = sal_False;
- if ( pParseTree != NULL )
- {
- // Extract required info
-
- OSL_TRACE("\tHave a Where Clause\n");
-
- analyseWhereClause( pParseTree, queryExpression );
- }
- else
- {
- OSL_TRACE("\tDon't have a Where Clause\n");
-
- MQueryExpression::ExprVector eVector;
-
- // LDAP does not allow a query without restriction, so we add a dummy
- // for PrimaryEmail
- // For other types we stick to the old behaviour of using
- // card:nsIAbCard.
- OSL_ENSURE(m_pStatement, "Cannot determine Parent Statement");
- ::rtl::OUString aStr;
- if (xConnection->isLDAP())
- aStr = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrimaryEmail"));
- else
- aStr = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("card:nsIAbCard"));
- eVector.push_back( new MQueryExpressionString(aStr, MQueryOp::Exists) );
-
- queryExpression.setExpressions( eVector );
- }
-
- // If the query is a 0=1 then set Row count to 0 and return
- if ( m_bIsAlwaysFalseQuery )
- {
- m_bIsReadOnly = 1;
- return;
- }
-
- m_aQuery.setExpression( queryExpression );
-
- rtl::OUString aStr( m_pTable->getName() );
- m_aQuery.setAddressbook( aStr );
-
- sal_Int32 rv = m_aQuery.executeQuery(xConnection);
- if ( rv == -1 ) {
- m_pStatement->getOwnConnection()->throwSQLException( STR_ERR_EXECUTING_QUERY, *this );
- }
- //determine whether the address book is readonly
- determineReadOnly();
-
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE( "executeQuery returned %d\n", rv );
-
- OSL_TRACE( "\tOUT OResultSet::fillRowData()\n" );
-#endif
-}
-
-// -----------------------------------------------------------------------------
-static sal_Bool matchRow( OValueRow& row1, OValueRow& row2 )
-{
- OValueVector::Vector::iterator row1Iter = row1->get().begin();
- OValueVector::Vector::iterator row2Iter = row2->get().begin();
- for ( ++row1Iter,++row2Iter; // the first column is the bookmark column
- row1Iter != row1->get().end(); ++row1Iter,++row2Iter)
- {
- if ( row1Iter->isBound())
- {
- // Compare values, if at anytime there's a mismatch return false
- if ( !( (*row1Iter) == (*row2Iter) ) )
- return sal_False;
- }
- }
-
- // If we get to here the rows match
- return sal_True;
-}
-sal_Int32 OResultSet::getRowForCardNumber(sal_Int32 nCardNum)
-{
- OSL_TRACE("In/Out: OResultSet::getRowForCardNumber, nCardNum = %u", nCardNum );
-
- if ( m_pKeySet.is() )
- {
- sal_Int32 nPos;
- for(nPos=0;nPos < (sal_Int32)m_pKeySet->get().size();nPos++)
- {
- if (nCardNum == (m_pKeySet->get())[nPos])
- {
- OSL_TRACE("In/Out: OResultSet::getRowForCardNumber, return = %u", nPos+1 );
- return nPos+1;
- }
- }
- }
-
- m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this );
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLException,
- ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- OSL_ENSURE( m_pTable, "Need a Table object");
- if(!m_pTable)
- {
- const OSQLTables& xTabs = m_pSQLIterator->getTables();
- if ((xTabs.begin() == xTabs.end()) || !xTabs.begin()->second.is())
- m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
-
- m_pTable = static_cast< OTable* > ((xTabs.begin()->second).get());
-
- }
-
- m_nRowPos = 0;
-
- fillRowData();
-
- OSL_ENSURE(m_xColumns.is(), "Need the Columns!!");
-
- // sal_Int32 nColumnCount = m_xColumns->size();
- // initializeRow(m_aRow,nColumnCount);
- // initializeRow(m_aEvaluateRow,nColumnCount);
-
- switch( m_pSQLIterator->getStatementType() )
- {
- case SQL_STATEMENT_SELECT:
- {
- if(m_bIsAlwaysFalseQuery) {
- break;
- }
- else if(isCount())
- {
- m_pStatement->getOwnConnection()->throwSQLException( STR_NO_COUNT_SUPPORT, *this );
- }
- else
- {
- sal_Bool bDistinct = sal_False;
- OSQLParseNode *pDistinct = m_pParseTree->getChild(1);
- if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT)
- {
- if(!IsSorted())
- {
- m_aOrderbyColumnNumber.push_back(m_aColMapping[1]);
- m_aOrderbyAscending.push_back(SQL_DESC);
- }
- bDistinct = sal_True;
- }
-
- OSortIndex::TKeyTypeVector eKeyType(m_aOrderbyColumnNumber.size());
- ::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin();
- for ( ::std::vector<sal_Int16>::size_type i = 0; aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i)
- {
- OSL_ENSURE((sal_Int32)m_aRow->get().size() > *aOrderByIter,"Invalid Index");
- switch ((m_aRow->get().begin()+*aOrderByIter)->getTypeKind())
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- eKeyType[i] = SQL_ORDERBYKEY_STRING;
- break;
-
- case DataType::OTHER:
- case DataType::TINYINT:
- case DataType::SMALLINT:
- case DataType::INTEGER:
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- case DataType::REAL:
- case DataType::DOUBLE:
- case DataType::DATE:
- case DataType::TIME:
- case DataType::TIMESTAMP:
- case DataType::BIT:
- eKeyType[i] = SQL_ORDERBYKEY_DOUBLE;
- break;
-
- // Other types aren't implemented (so they are always FALSE)
- default:
- eKeyType[i] = SQL_ORDERBYKEY_NONE;
- OSL_FAIL("MResultSet::executeQuery: Order By Data Type not implemented");
- break;
- }
- }
-
- if (IsSorted())
- {
- // Implement Sorting
-
- // So that we can sort we need to wait until the executed
- // query to the mozilla addressbooks has returned all
- // values.
-
- OSL_TRACE("Query is to be sorted");
- if( ! m_aQuery.queryComplete() )
- if ( !m_aQuery.waitForQueryComplete() )
- {
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
- }
-
- OSL_ENSURE( m_aQuery.queryComplete(), "Query not complete!!");
-
- m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending);
-
- OSL_TRACE("OrderbyColumnNumber->size() = %d",m_aOrderbyColumnNumber.size());
-#if OSL_DEBUG_LEVEL > 0
- for ( ::std::vector<sal_Int32>::size_type i = 0; i < m_aColMapping.size(); i++ )
- OSL_TRACE("Mapped: %d -> %d", i, m_aColMapping[i] );
-#endif
- for ( sal_Int32 nRow = 1; nRow <= m_aQuery.getRowCount(); nRow++ ) {
-
- OKeyValue* pKeyValue = OKeyValue::createKeyValue((nRow));
-
- ::std::vector<sal_Int32>::iterator aIter = m_aOrderbyColumnNumber.begin();
- for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter)
- {
- const ORowSetValue& value = getValue(nRow, *aIter);
-
- OSL_TRACE( "Adding Value: (%d,%d) : %s", nRow, *aIter,OUtoCStr( value ));
-
- pKeyValue->pushKey(new ORowSetValueDecorator(value));
- }
-
- m_pSortIndex->AddKeyValue( pKeyValue );
- }
-
- m_pKeySet = m_pSortIndex->CreateKeySet();
- m_CurrentRowCount = m_pKeySet->get().size();
-#if OSL_DEBUG_LEVEL > 0
- for( OKeySet::Vector::size_type i = 0; i < m_pKeySet->get().size(); i++ )
- OSL_TRACE("Sorted: %d -> %d", i, (m_pKeySet->get())[i] );
-#endif
-
- m_pSortIndex = NULL;
- beforeFirst(); // Go back to start
- }
- else //we always need m_pKeySet now
- m_pKeySet = new OKeySet();
-
- // Handle the DISTINCT case
- if ( bDistinct && m_pKeySet.is() )
- {
- OValueRow aSearchRow = new OValueVector( m_aRow->get().size() );
-
- for( OKeySet::Vector::size_type i = 0; i < m_pKeySet->get().size(); i++ )
- {
- fetchRow( (m_pKeySet->get())[i] ); // Fills m_aRow
- if ( matchRow( m_aRow, aSearchRow ) )
- {
- (m_pKeySet->get())[i] = 0; // Marker for later to be removed
- }
- else
- {
- // They don't match, so it's not a duplicate.
- // Use the current Row as the next one to match against
- *aSearchRow = *m_aRow;
- }
- }
- // Now remove any keys marked with a 0
- m_pKeySet->get().erase(::std::remove_if(m_pKeySet->get().begin(),m_pKeySet->get().end()
- ,::std::bind2nd(::std::equal_to<sal_Int32>(),0))
- ,m_pKeySet->get().end());
-
- }
- }
- } break;
-
- case SQL_STATEMENT_UPDATE:
- case SQL_STATEMENT_DELETE:
- case SQL_STATEMENT_INSERT:
- break;
- default:
- m_pStatement->getOwnConnection()->throwSQLException( STR_STMT_TYPE_NOT_SUPPORTED, *this );
- break;
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void OResultSet::setBoundedColumns(const OValueRow& _rRow,
- const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,
- const Reference<XIndexAccess>& _xNames,
- sal_Bool _bSetColumnMapping,
- const Reference<XDatabaseMetaData>& _xMetaData,
- ::std::vector<sal_Int32>& _rColMapping)
-{
- ::comphelper::UStringMixEqual aCase(_xMetaData->supportsMixedCaseQuotedIdentifiers());
-
- Reference<XPropertySet> xTableColumn;
- ::rtl::OUString sTableColumnName, sSelectColumnRealName;
-
- const ::rtl::OUString sName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
- const ::rtl::OUString sRealName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME);
-
- ::std::vector< ::rtl::OUString> aColumnNames;
- aColumnNames.reserve(_rxColumns->get().size());
- OValueVector::Vector::iterator aRowIter = _rRow->get().begin()+1;
- for (sal_Int32 i=0; // the first column is the bookmark column
- aRowIter != _rRow->get().end();
- ++i, ++aRowIter
- )
- {
- try
- {
- // get the table column and it's name
- _xNames->getByIndex(i) >>= xTableColumn;
- OSL_ENSURE(xTableColumn.is(), "OResultSet::setBoundedColumns: invalid table column!");
- if (xTableColumn.is())
- xTableColumn->getPropertyValue(sName) >>= sTableColumnName;
- else
- sTableColumnName = ::rtl::OUString();
-
- // look if we have such a select column
- // TODO: would like to have a O(log n) search here ...
- sal_Int32 nColumnPos = 0;
- for ( OSQLColumns::Vector::iterator aIter = _rxColumns->get().begin();
- aIter != _rxColumns->get().end();
- ++aIter,++nColumnPos
- )
- {
- if ( nColumnPos < (sal_Int32)aColumnNames.size() )
- sSelectColumnRealName = aColumnNames[nColumnPos];
- else
- {
- if((*aIter)->getPropertySetInfo()->hasPropertyByName(sRealName))
- (*aIter)->getPropertyValue(sRealName) >>= sSelectColumnRealName;
- else
- (*aIter)->getPropertyValue(sName) >>= sSelectColumnRealName;
- aColumnNames.push_back(sSelectColumnRealName);
- }
-
- if (aCase(sTableColumnName, sSelectColumnRealName))
- {
- if(_bSetColumnMapping)
- {
- sal_Int32 nSelectColumnPos = aIter - _rxColumns->get().begin() + 1;
- // the getXXX methods are 1-based ...
- sal_Int32 nTableColumnPos = i + 1;
- // get first table column is the bookmark column
- // ...
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE("Set Col Mapping: %d -> %d", nSelectColumnPos, nTableColumnPos );
-#endif
- _rColMapping[nSelectColumnPos] = nTableColumnPos;
- }
-
- aRowIter->setBound(sal_True);
- aRowIter->setTypeKind(DataType::VARCHAR);
- }
- }
- }
- catch (Exception&)
- {
- OSL_FAIL("OResultSet::setBoundedColumns: caught an Exception!");
- }
- }
-}
-
-
-// -----------------------------------------------------------------------------
-sal_Bool OResultSet::isCount() const
-{
- return (m_pParseTree &&
- m_pParseTree->count() > 2 &&
- SQL_ISRULE(m_pParseTree->getChild(2),scalar_exp_commalist) &&
- SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0),derived_column) &&
- SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0)->getChild(0),general_set_fct) &&
- m_pParseTree->getChild(2)->getChild(0)->getChild(0)->count() == 4
- );
-}
-
-// -----------------------------------------------------------------------------
-//
-// Check for valid row in m_aQuery
-//
-sal_Bool OResultSet::validRow( sal_uInt32 nRow )
-{
- sal_Int32 nNumberOfRecords = m_aQuery.getRealRowCount();
-
- while ( nRow > (sal_uInt32)nNumberOfRecords && !m_aQuery.queryComplete() ) {
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE("validRow: waiting...");
-#endif
- m_aQuery.checkRowAvailable( nRow );
- if ( m_aQuery.hadError() )
- {
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
- }
- nNumberOfRecords = m_aQuery.getRealRowCount();
- }
-
- if (( nRow == 0 ) ||
- ( nRow > (sal_uInt32)nNumberOfRecords && m_aQuery.queryComplete()) ){
- OSL_TRACE("validRow(%u): return False", nRow);
- return sal_False;
- }
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE("validRow(%u): return True", nRow);
-#endif
- return sal_True;
-}
-sal_Bool OResultSet::fillKeySet(sal_Int32 nMaxCardNumber)
-{
- impl_ensureKeySet();
- if (m_CurrentRowCount < nMaxCardNumber)
- {
- sal_Int32 nKeyValue;
- if ( (sal_Int32)m_pKeySet->get().capacity() < nMaxCardNumber )
- m_pKeySet->get().reserve(nMaxCardNumber + 20 );
-
- for (nKeyValue = m_CurrentRowCount+1; nKeyValue <= nMaxCardNumber; nKeyValue ++)
- m_pKeySet->get().push_back( nKeyValue );
- m_CurrentRowCount = nMaxCardNumber;
- }
- return sal_True;
-}
-
-sal_Int32 OResultSet::deletedCount()
-{
- impl_ensureKeySet();
- return m_CurrentRowCount - m_pKeySet->get().size();
-
-}
-// -----------------------------------------------------------------------------
-sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset )
-{
- ResultSetEntryGuard aGuard( *this );
- if ( !m_pKeySet.is() )
- m_pStatement->getOwnConnection()->throwSQLException( STR_ILLEGAL_MOVEMENT, *this );
-
- sal_Int32 nNumberOfRecords = m_aQuery.getRealRowCount();
- sal_Int32 nRetrivedRows = currentRowCount();
- sal_Int32 nCurPos = m_nRowPos;
-
- OSL_TRACE("seekRow: nCurPos = %d", nCurPos );
- switch( pos ) {
- case NEXT_POS:
- OSL_TRACE("seekRow: NEXT");
- nCurPos++;
- break;
- case PRIOR_POS:
- OSL_TRACE("seekRow: PRIOR");
- if ( nCurPos > 0 )
- nCurPos--;
- break;
-
- case FIRST_POS:
- OSL_TRACE("seekRow: FIRST");
- nCurPos = 1;
- break;
-
- case LAST_POS:
- OSL_TRACE("seekRow: LAST");
- nCurPos = nRetrivedRows;
- break;
- case ABSOLUTE_POS:
- OSL_TRACE("seekRow: ABSOLUTE : %d", nOffset);
- nCurPos = nOffset;
- break;
- case RELATIVE_POS:
- OSL_TRACE("seekRow: RELATIVE : %d", nOffset);
- nCurPos += sal_uInt32( nOffset );
- break;
- }
-
- if ( nCurPos <= 0 ) {
- m_nRowPos = 0;
- OSL_TRACE("seekRow: return False, m_nRowPos = %u", m_nRowPos );
- return sal_False;
- }
- sal_Int32 nCurCard = nCurPos;
- if ( nCurPos < (sal_Int32)m_pKeySet->get().size() ) //The requested row is exist in m_pKeySet, so we just use it
- {
- nCurCard = (m_pKeySet->get())[nCurPos-1];
- }
- else //The requested row has not been retrived until now. We should get the right card for it.
- nCurCard = nCurPos + deletedCount();
-
- while ( nCurCard > nNumberOfRecords && !m_aQuery.queryComplete() ) {
- m_aQuery.checkRowAvailable( nCurCard );
- if ( m_aQuery.hadError() )
- {
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
- }
- nNumberOfRecords = m_aQuery.getRealRowCount();
- }
-
- if ( nCurCard > nNumberOfRecords && m_aQuery.queryComplete()) {
- fillKeySet(nNumberOfRecords);
- m_nRowPos = m_pKeySet->get().size() + 1;
- OSL_TRACE("seekRow: return False, m_nRowPos = %u", m_nRowPos );
- return sal_False;
- }
- //Insert new retrived items for later use
- fillKeySet(nNumberOfRecords);
- m_nRowPos = (sal_uInt32)nCurPos;
- OSL_TRACE("seekRow: return True, m_nRowPos = %u", m_nRowPos );
- fetchCurrentRow();
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-void OResultSet::setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMapping)
-{
- m_aColMapping = _aColumnMapping;
-#if OSL_DEBUG_LEVEL > 0
- for ( sal_uInt32 i = 0; i < m_aColMapping.size(); i++ )
- OSL_TRACE("Set Mapped: %d -> %d", i, m_aColMapping[i] );
-#endif
-}
-// -----------------------------------------------------------------------------
-
-::com::sun::star::uno::Any OResultSet::getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- OSL_TRACE("getBookmark, m_nRowPos = %u", m_nRowPos );
- ResultSetEntryGuard aGuard( *this );
- if ( fetchCurrentRow() == sal_False )
- m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
-
- OSL_ENSURE((!m_aRow->isDeleted()),"getBookmark called for deleted row");
- return makeAny((sal_Int32)(m_aRow->get())[0]);
-}
-sal_Bool OResultSet::moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("moveToBookmark, bookmark = %u", comphelper::getINT32(bookmark) );
- sal_Int32 nCardNum = comphelper::getINT32(bookmark);
- m_nRowPos = getRowForCardNumber(nCardNum);
- fetchCurrentRow();
- return sal_True;
-}
-sal_Bool OResultSet::moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("moveRelativeToBookmark, bookmark = %u rows= %u", comphelper::getINT32(bookmark),rows );
- sal_Int32 nCardNum = comphelper::getINT32(bookmark);
- m_nRowPos = getRowForCardNumber(nCardNum);
- return seekRow(RELATIVE_POS,rows );
-}
-sal_Int32 OResultSet::compareBookmarks( const ::com::sun::star::uno::Any& lhs, const ::com::sun::star::uno::Any& rhs ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("compareBookmarks, m_nRowPos = %u", m_nRowPos );
- sal_Int32 nFirst=0;
- sal_Int32 nSecond=0;
- sal_Int32 nResult=0;
-
- if ( !( lhs >>= nFirst ) || !( rhs >>= nSecond ) )
- m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this );
-
- if(nFirst < nSecond)
- nResult = -1;
- else if(nFirst > nSecond)
- nResult = 1;
- else
- nResult = 0;
-
- return nResult;
-}
-sal_Bool OResultSet::hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("hasOrderedBookmarks, m_nRowPos = %u", m_nRowPos );
- return sal_True;
-}
-sal_Int32 OResultSet::hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("hashBookmark, m_nRowPos = %u", m_nRowPos );
- return comphelper::getINT32(bookmark);
-}
-
-sal_Int32 OResultSet::getCurrentCardNumber()
-{
- if ( ( m_nRowPos == 0 ) || !m_pKeySet.is() )
- return 0;
- if (m_pKeySet->get().size() < m_nRowPos)
- return 0;
- return (m_pKeySet->get())[m_nRowPos-1];
-}
-void OResultSet::checkPendingUpdate() throw(SQLException, RuntimeException)
-{
- OSL_TRACE("checkPendingUpdate, m_nRowPos = %u", m_nRowPos );
- const sal_Int32 nCurrentRow = getCurrentCardNumber();
-
- if ((m_nNewRow && nCurrentRow != m_nNewRow)
- || ( m_nUpdatedRow && m_nUpdatedRow != nCurrentRow))
- {
- const ::rtl::OUString sError( m_pStatement->getOwnConnection()->getResources().getResourceStringWithSubstitution(
- STR_COMMIT_ROW,
- "$position$", ::rtl::OUString::valueOf(nCurrentRow)
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
-
-}
-void OResultSet::updateValue(sal_Int32 columnIndex ,const ORowSetValue& x) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("updateValue, m_nRowPos = %u", m_nRowPos );
- ResultSetEntryGuard aGuard( *this );
- if ( fetchCurrentRow() == sal_False )
- m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
-
-
- checkPendingUpdate();
-
- checkIndex(columnIndex );
- columnIndex = mapColumn(columnIndex);
-
- (m_aRow->get())[columnIndex].setBound(sal_True);
- (m_aRow->get())[columnIndex] = x;
- m_nUpdatedRow = getCurrentCardNumber();
- m_RowStates = m_RowStates | RowStates_Updated;
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("updateNull, m_nRowPos = %u", m_nRowPos );
- ResultSetEntryGuard aGuard( *this );
- if ( fetchCurrentRow() == sal_False )
- m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
-
- checkPendingUpdate();
- checkIndex(columnIndex );
- columnIndex = mapColumn(columnIndex);
-
- (m_aRow->get())[columnIndex].setBound(sal_True);
- (m_aRow->get())[columnIndex].setNull();
- m_nUpdatedRow = getCurrentCardNumber();
- m_RowStates = m_RowStates | RowStates_Updated;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateLong( sal_Int32 /*columnIndex*/, sal_Int64 /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateLong", *this );
-}
-// -----------------------------------------------------------------------
-void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- if(!x.is())
- ::dbtools::throwFunctionSequenceException(*this);
-
- Sequence<sal_Int8> aSeq;
- x->readBytes(aSeq,length);
- updateValue(columnIndex,aSeq);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
-{
- updateBinaryStream(columnIndex,x,length);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException)
-{
- if (!::dbtools::implUpdateObject(this, columnIndex, x))
- {
- const ::rtl::OUString sError( m_pStatement->getOwnConnection()->getResources().getResourceStringWithSubstitution(
- STR_COLUMN_NOT_UPDATEABLE,
- "$position$", ::rtl::OUString::valueOf(columnIndex)
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- } // if (!::dbtools::implUpdateObject(this, columnIndex, x))
- }
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException)
-{
- if (!::dbtools::implUpdateObject(this, columnIndex, x))
- {
- const ::rtl::OUString sError( m_pStatement->getOwnConnection()->getResources().getResourceStringWithSubstitution(
- STR_COLUMN_NOT_UPDATEABLE,
- "$position$", ::rtl::OUString::valueOf(columnIndex)
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
-}
-
-// XResultSetUpdate
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("insertRow in, m_nRowPos = %u", m_nRowPos );
- m_RowStates = RowStates_Inserted;
- updateRow();
- m_nOldRowPos = 0;
- m_nNewRow = 0;
- m_aQuery.setRowStates(getCurrentCardNumber(),m_RowStates);
- OSL_TRACE("insertRow out, m_nRowPos = %u", m_nRowPos );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- OSL_TRACE("updateRow in, m_nRowPos = %u", m_nRowPos );
- ResultSetEntryGuard aGuard( *this );
- impl_ensureKeySet();
-
- if (!m_nRowPos || m_pKeySet->get().size() < m_nRowPos )
- m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_ROW_UPDATE, *this );
-
- const sal_Int32 nCurrentCard = getCurrentCardNumber();
-
- if (!pushCard(nCurrentCard))
- {
- m_RowStates = RowStates_Error;
- m_pStatement->getOwnConnection()->throwSQLException( STR_ROW_CAN_NOT_SAVE, *this );
- }
-
- if (!m_aQuery.commitRow(nCurrentCard))
- {
- m_RowStates = RowStates_Error;
- m_nUpdatedRow = 0;
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
- }
-
- m_nUpdatedRow = 0;
- fetchCurrentRow();
- OSL_TRACE("updateRow out, m_nRowPos = %u", m_nRowPos );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- OSL_TRACE("deleteRow, m_nRowPos = %u", m_nRowPos );
- ResultSetEntryGuard aGuard( *this );
- if (rowDeleted())
- m_pStatement->getOwnConnection()->throwSQLException( STR_ROW_ALREADY_DELETED, *this );
-
- const sal_Int32 nCurrentRow = getCurrentCardNumber();
- //fetchRow(nCurrentRow);
- if (!nCurrentRow)
- m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
-
- sal_Bool m_bRowDeleted = ( m_aQuery.deleteRow( nCurrentRow ) > 0 );
- if (!m_bRowDeleted)
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
-
- m_aQuery.setRowStates(nCurrentRow,RowStates_Deleted);
- m_pKeySet->get().erase(m_pKeySet->get().begin() + m_nRowPos -1);
- m_RowStates = RowStates_Deleted;
- OSL_TRACE("deleteRow out, m_nRowPos = %u", m_nRowPos );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("cancelRowUpdates, m_nRowPos = %u", m_nRowPos );
- if (fetchRow(getCurrentCardNumber(),sal_True)) //force fetch current row will cause we lose all change to the current row
- m_pStatement->getOwnConnection()->throwSQLException( STR_CAN_NOT_CANCEL_ROW_UPDATE, *this );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- OSL_TRACE("moveToInsertRow in, m_nRowPos = %u", m_nRowPos );
- ResultSetEntryGuard aGuard( *this );
- m_nOldRowPos = m_nRowPos;
-
- if (!m_nNewRow) //no new row now, insert one
- {
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- checkPendingUpdate();
- if (rowUpdated())
- {
- if (m_nRowPos && !pushCard(getCurrentCardNumber()))
- throw SQLException();
- }
- m_nNewRow = m_aQuery.createNewCard();
- if (!m_nNewRow)
- m_pStatement->getOwnConnection()->throwSQLException( STR_CAN_NOT_CREATE_ROW, *this );
-
- m_RowStates = RowStates_Normal;
- fillKeySet(m_nNewRow);
- }
- else
- m_nUpdatedRow = 0;
-
- m_nRowPos = m_pKeySet->get().size();
- fetchCurrentRow();
- OSL_TRACE("moveToInsertRow out, m_nRowPos = %u", m_nRowPos );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("moveToCurrentRow, m_nRowPos = %u", m_nRowPos );
- if (rowInserted())
- {
- m_nRowPos = m_nOldRowPos;
- fetchCurrentRow();
- }
-}
-
-sal_Bool OResultSet::determineReadOnly()
-{
- if (m_bIsReadOnly == -1)
- {
- OConnection* xConnection = static_cast<OConnection*>(m_pStatement->getConnection().get());
- m_bIsReadOnly = !m_aQuery.isWritable(xConnection) || m_bIsAlwaysFalseQuery;
- }
-
- return m_bIsReadOnly != 0;
-}
-
-void OResultSet::setTable(OTable* _rTable)
-{
- OSL_TRACE("In : setTable");
- m_pTable = _rTable;
- m_pTable->acquire();
- m_xTableColumns = m_pTable->getColumns();
- if(m_xTableColumns.is())
- m_aColumnNames = m_xTableColumns->getElementNames();
- OSL_TRACE("Out : setTable");
-}
-
-void OResultSet::setOrderByColumns(const ::std::vector<sal_Int32>& _aColumnOrderBy)
-{
- m_aOrderbyColumnNumber = _aColumnOrderBy;
-}
-
-void OResultSet::setOrderByAscending(const ::std::vector<TAscendingOrder>& _aOrderbyAsc)
-{
- m_aOrderbyAscending = _aOrderbyAsc;
-}
-Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& /*rows*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XDeleteRows::deleteRows", *this );
- return Sequence< sal_Int32 >();
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MResultSet.hxx b/connectivity/source/drivers/mozab/MResultSet.hxx
deleted file mode 100644
index 7f0f93985d..0000000000
--- a/connectivity/source/drivers/mozab/MResultSet.hxx
+++ /dev/null
@@ -1,369 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SRESULTSET_HXX
-#define CONNECTIVITY_SRESULTSET_HXX
-
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
-#include <com/sun/star/sdbc/XCloseable.hpp>
-#include <com/sun/star/sdbc/XColumnLocate.hpp>
-#include <com/sun/star/util/XCancellable.hpp>
-#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
-#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
-#include <com/sun/star/sdbcx/XRowLocate.hpp>
-#include <com/sun/star/sdbcx/XDeleteRows.hpp>
-#include <com/sun/star/sdbc/XRowUpdate.hpp>
-#include <cppuhelper/compbase12.hxx>
-#include <comphelper/proparrhlp.hxx>
-#include "MStatement.hxx"
-#include "connectivity/CommonTools.hxx"
-#include "connectivity/FValue.hxx"
-#include "connectivity/sqliterator.hxx"
-#include "TSortIndex.hxx"
-#include "mozillasrc/MQuery.hxx"
-
-
-namespace connectivity
-{
- namespace mozab
- {
-
- /*
- ** java_sql_ResultSet
- */
- typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet,
- ::com::sun::star::sdbc::XRow,
- ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
- ::com::sun::star::util::XCancellable,
- ::com::sun::star::sdbc::XWarningsSupplier,
- ::com::sun::star::sdbc::XCloseable,
- ::com::sun::star::sdbc::XColumnLocate,
- ::com::sun::star::sdbc::XResultSetUpdate,
- ::com::sun::star::sdbc::XRowUpdate,
- ::com::sun::star::sdbcx::XRowLocate,
- ::com::sun::star::sdbcx::XDeleteRows,
- ::com::sun::star::lang::XServiceInfo> OResultSet_BASE;
-
-
- typedef sal_Int64 TVoidPtr;
- typedef ::std::allocator< TVoidPtr > TVoidAlloc;
- typedef ::std::vector<TVoidPtr> TVoidVector;
-
- class OResultSet : public comphelper::OBaseMutex,
- public OResultSet_BASE,
- public ::cppu::OPropertySetHelper,
- public ::comphelper::OPropertyArrayUsageHelper<OResultSet>
- {
- protected:
- OCommonStatement* m_pStatement;
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xStatement;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData;
- sal_uInt32 m_nRowPos;
- sal_uInt32 m_nOldRowPos;
- sal_Bool m_bWasNull;
- sal_Int32 m_nFetchSize;
- sal_Int32 m_nResultSetType;
- sal_Int32 m_nFetchDirection;
- sal_Int32 m_nResultSetConcurrency;
-
-
-
- ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator >
- m_pSQLIterator;
- const connectivity::OSQLParseNode* m_pParseTree;
-
- // OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
- // OPropertySetHelper
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
-
- virtual sal_Bool SAL_CALL convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue
- )
- throw (::com::sun::star::uno::Exception);
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle
- ) const;
-
- // you can't delete objects of this type
- virtual ~OResultSet();
- public:
- DECLARE_SERVICE_INFO();
-
- OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator >& _pSQLIterator );
-
-
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *()
- {
- return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(OResultSet_BASE*)this);
- }
-
- // ::cppu::OComponentHelper
- virtual void SAL_CALL disposing(void);
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
- //XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
- // XResultSet
- virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XRow
- virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XResultSetMetaDataSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XCancellable
- virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException);
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XWarningsSupplier
- virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XColumnLocate
- virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XResultSetUpdate
- virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XRowUpdate
- virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XRowLocate
- virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XDeleteRows
- virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
-protected:
- MQuery m_aQuery;
- OTable* m_pTable;
- sal_Int32 m_CurrentRowCount;
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
- m_xTableColumns;
-
- ::std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 everytime
- ::std::vector<sal_Int32> m_aOrderbyColumnNumber;
- ::std::vector<TAscendingOrder> m_aOrderbyAscending;
- ::com::sun::star::uno::Sequence< ::rtl::OUString> m_aColumnNames;
- OValueRow m_aRow;
- OValueRow m_aParameterRow;
- ::std::vector< ::rtl::OUString> m_aAttributeStrings;
- sal_Int32 m_nParamIndex;
- sal_Bool m_bIsAlwaysFalseQuery;
- ::rtl::Reference<OKeySet> m_pKeySet;
- OSortIndex* m_pSortIndex;
- sal_Int32 m_nNewRow; //inserted row
- sal_Int32 m_nUpdatedRow; //updated row
- sal_Int32 m_RowStates;
- sal_Int32 m_bIsReadOnly;
- inline void resetParameters() { m_nParamIndex = 0; }
-
- ::rtl::Reference<connectivity::OSQLColumns> m_xColumns; // this are the select columns
- ::rtl::Reference<connectivity::OSQLColumns> m_xParamColumns;
-
- void parseParameter( const OSQLParseNode* pNode, rtl::OUString& rMatchString );
- void fillRowData() throw( ::com::sun::star::sdbc::SQLException );
- void initializeRow(OValueRow& _rRow,sal_Int32 _nColumnCount);
- void analyseWhereClause( const OSQLParseNode* parseTree,
- MQueryExpression &queryExpression);
-
- sal_Bool isCount() const;
-
- // XXX sal_Bool IsSorted() const { return !m_aOrderbyColumnNumber.empty() && m_aOrderbyColumnNumber[0] != STRING_NOTFOUND ;}
- sal_Bool IsSorted() const { return !m_aOrderbyColumnNumber.empty(); }
-
- enum eRowPosition {
- NEXT_POS, PRIOR_POS, FIRST_POS, LAST_POS, ABSOLUTE_POS, RELATIVE_POS
- };
-
- sal_uInt32 currentRowCount();
-
- sal_Bool fetchRow(sal_Int32 rowIndex,sal_Bool bForceReload=sal_False) throw( ::com::sun::star::sdbc::SQLException,
- ::com::sun::star::uno::RuntimeException);
- sal_Bool fetchCurrentRow() throw( ::com::sun::star::sdbc::SQLException,
- ::com::sun::star::uno::RuntimeException);
- sal_Bool pushCard(sal_uInt32 rowIndex) throw( ::com::sun::star::sdbc::SQLException,
- ::com::sun::star::uno::RuntimeException);
- sal_Bool validRow( sal_uInt32 nRow );
- sal_Bool seekRow( eRowPosition pos, sal_Int32 nOffset = 0 );
- sal_Int32 deletedCount();
- sal_Bool fillKeySet(sal_Int32 nMaxCardNumber); //When we get new rows, fill the m_pKeySet items for them
- sal_Int32 getRowForCardNumber(sal_Int32 nCardNum);
- const ORowSetValue& getValue(sal_Int32 rowIndex, sal_Int32 columnIndex)
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- void updateValue(sal_Int32 columnIndex,const ORowSetValue& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- void checkPendingUpdate() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- sal_Int32 getCurrentCardNumber();
-
-public:
- sal_Bool determineReadOnly();
- // MozAddressbook Specific methods
- void SAL_CALL executeQuery() throw( ::com::sun::star::sdbc::SQLException,
- ::com::sun::star::uno::RuntimeException);
-
- void setTable(OTable* _rTable);
-
- void setParameterRow(const OValueRow& _rParaRow)
- { m_aParameterRow = _rParaRow; }
-
- void setParameterColumns(const ::rtl::Reference<connectivity::OSQLColumns>& _xParamColumns)
- { m_xParamColumns = _xParamColumns; }
-
- void setBindingRow(const OValueRow& _aRow)
- { m_aRow = _aRow; }
-
- void setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMapping);
-
- void setOrderByColumns(const ::std::vector<sal_Int32>& _aColumnOrderBy);
-
- void setOrderByAscending(const ::std::vector<TAscendingOrder>& _aOrderbyAsc);
-
- inline sal_Int32 mapColumn(sal_Int32 column);
-
- void checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException);
-
- static void setBoundedColumns(
- const OValueRow& _rRow,
- const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xNames,
- sal_Bool _bSetColumnMapping,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _xMetaData,
- ::std::vector<sal_Int32>& _rColMapping);
-
- ::osl::Mutex& getMutex() { return m_aMutex; }
- void methodEntry();
-
- private:
- inline void impl_ensureKeySet()
- {
- if ( !m_pKeySet.is() )
- m_pKeySet = new OKeySet();
- }
-
- protected:
- using OPropertySetHelper::getFastPropertyValue;
- };
-
- inline sal_Int32 OResultSet::mapColumn(sal_Int32 column)
- {
- sal_Int32 map = column;
-
- OSL_ENSURE(column > 0, "OResultSet::mapColumn: invalid column index!");
- // the first column (index 0) is for convenience only. The
- // first real select column is no 1.
- if ((column > 0) && (column < (sal_Int32)m_aColMapping.size()))
- map = m_aColMapping[column];
-
- return map;
- }
-
- class ResultSetEntryGuard : public ::osl::MutexGuard
- {
- public:
- ResultSetEntryGuard( OResultSet& _rRS ) : ::osl::MutexGuard( _rRS.getMutex() )
- {
- _rRS.methodEntry();
- }
- };
-
- }
-}
-#endif // CONNECTIVITY_SRESULTSET_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx b/connectivity/source/drivers/mozab/MResultSetMetaData.cxx
deleted file mode 100644
index 3ca9036c33..0000000000
--- a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx
+++ /dev/null
@@ -1,214 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "connectivity/dbexception.hxx"
-#include "connectivity/dbtools.hxx"
-#include <comphelper/types.hxx>
-#include <comphelper/extract.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <tools/diagnose_ex.h>
-#include "MResultSetMetaData.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-
-using namespace connectivity::mozab;
-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 ::dbtools;
-using namespace ::comphelper;
-
-// -------------------------------------------------------------------------
-OResultSetMetaData::~OResultSetMetaData()
-{
- m_xColumns = NULL;
-}
-
-// -----------------------------------------------------------------------------
-void OResultSetMetaData::checkColumnIndex(sal_Int32 column) throw(SQLException, RuntimeException)
-{
- if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->get().size())
- throwInvalidIndexException(*this);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return getPrecision(column);
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return DataType::VARCHAR; // at the moment there exists only this type
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException)
-{
- return (m_xColumns->get()).size();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- checkColumnIndex(column);
-
- ::rtl::OUString sColumnName;
- try
- {
- Reference< XPropertySet > xColumnProps( (m_xColumns->get())[column-1], UNO_QUERY_THROW );
- OSL_VERIFY( xColumnProps->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_NAME ) ) >>= sColumnName );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return sColumnName;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return m_aTableName;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- checkColumnIndex(column);
- return getString((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return getColumnName(column);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- checkColumnIndex(column);
- return getBOOL((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)));
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- checkColumnIndex(column);
- return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)));
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- checkColumnIndex(column);
- return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)));
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- checkColumnIndex(column);
- return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)));
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString sColumnName( getColumnName( column ) );
-
- if ( !m_pTable || !m_pTable->getConnection() )
- {
- OSL_FAIL( "OResultSetMetaData::isSearchable: suspicious: called without table or connection!" );
- return sal_False;
- }
-
- if ( m_pTable->getConnection()->isLDAP() )
- {
- const OColumnAlias& aAliases( m_pTable->getConnection()->getColumnAlias() );
- if ( !aAliases.isColumnSearchable( sColumnName ) )
- return sal_False;
- }
-
- return sal_True;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- checkColumnIndex(column);
- sal_Bool bReadOnly = (m_xColumns->get())[column-1]->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)) &&
- ::cppu::any2bool((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)));
-
- return m_bReadOnly || bReadOnly || m_pTable->isReadOnly();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return !isReadOnly(column);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return !isReadOnly(column);
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MResultSetMetaData.hxx b/connectivity/source/drivers/mozab/MResultSetMetaData.hxx
deleted file mode 100644
index 134089fb40..0000000000
--- a/connectivity/source/drivers/mozab/MResultSetMetaData.hxx
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SRESULSETMETADATA_HXX
-#define CONNECTIVITY_SRESULSETMETADATA_HXX
-
-#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <vector>
-#include <rtl/ref.hxx>
-#include "MConnection.hxx"
-#include "MTable.hxx"
-
-namespace connectivity
-{
- namespace mozab
- {
- //**************************************************************
- //************ Class: ResultSetMetaData
- //**************************************************************
- typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE;
-
- class OResultSetMetaData : public OResultSetMetaData_BASE
- {
- ::rtl::OUString m_aTableName;
- ::rtl::Reference<connectivity::OSQLColumns> m_xColumns;
- OTable* m_pTable;
- sal_Bool m_bReadOnly;
-
- protected:
- virtual ~OResultSetMetaData();
- public:
- // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
- // OResultSetMetaData(OConnection* _pConnection) : m_pConnection(_pConnection){}
- OResultSetMetaData(const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,
- const ::rtl::OUString& _aTableName,OTable* _pTable,sal_Bool aReadOnly
- )
- :m_aTableName(_aTableName)
- ,m_xColumns(_rxColumns)
- ,m_pTable(_pTable)
- ,m_bReadOnly(aReadOnly)
- {}
-
-
- /// Avoid ambigous cast error from the compiler.
- inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw()
- { return this; }
-
- void checkColumnIndex(sal_Int32 column) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // CONNECTIVITY_SRESULSETMETADATA_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MServices.cxx b/connectivity/source/drivers/mozab/MServices.cxx
deleted file mode 100644
index 5e5fc0162a..0000000000
--- a/connectivity/source/drivers/mozab/MServices.cxx
+++ /dev/null
@@ -1,160 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MDriver.hxx"
-#include <cppuhelper/factory.hxx>
-#include <osl/diagnose.h>
-#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
-#include "bootstrap/MMozillaBootstrap.hxx"
-#include <tools/solar.h>
-
-using namespace connectivity::mozab;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::mozilla::XMozillaBootstrap;
-
-typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount* _pTemp
- );
-
-//---------------------------------------------------------------------------------------
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- sal_Char const* pImplementationName
- )
- : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- inline
- sal_Bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
- }
- catch(...)
- {
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-//---------------------------------------------------------------------------------------
-typedef void* (SAL_CALL * OMozillaBootstrap_CreateInstanceFunction)(const Reference< XMultiServiceFactory >& _rxFactory );
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createMozillaBootstrap(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
-{
- const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY( "mozabdrv" )));
-
- // load the dbtools library
- oslModule s_hModule = osl_loadModuleRelative(
- reinterpret_cast< oslGenericFunction >(&createMozillaBootstrap),
- sModuleName.pData, 0);
- OSL_ENSURE(NULL != s_hModule, "MozabDriver::registerClient: could not load the dbtools library!");
- if (NULL != s_hModule)
- {
-
- // get the symbol for the method creating the factory
- const ::rtl::OUString sFactoryCreationFunc = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OMozillaBootstrap_CreateInstance"));
- // reinterpret_cast<OMozabConnection_CreateInstanceFunction> removed GNU C
- OMozillaBootstrap_CreateInstanceFunction s_pCreationFunc = (OMozillaBootstrap_CreateInstanceFunction)osl_getFunctionSymbol(s_hModule, sFactoryCreationFunc.pData);
-
- if (NULL == s_pCreationFunc)
- { // did not find the symbol
- OSL_FAIL("MozabDriver::registerClient: could not find the symbol for creating the factory!");
- osl_unloadModule(s_hModule);
- s_hModule = NULL;
- }
- MozillaBootstrap * pBootstrap = reinterpret_cast<MozillaBootstrap*>((*s_pCreationFunc)(_rxFactory));
- return *pBootstrap;
- }
- return NULL;
-}
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = 0;
- if (pServiceManager)
- {
- OUString aImplName( OUString::createFromAscii( pImplementationName ) );
- ProviderRequest aReq(pServiceManager,pImplementationName);
- if (aImplName.equals( MozabDriver::getImplementationName_Static() ))
- {
- aReq.CREATE_PROVIDER(
- MozabDriver::getImplementationName_Static(),
- MozabDriver::getSupportedServiceNames_Static(),
- MozabDriver_CreateInstance, ::cppu::createSingleFactory);
- }
- else if (aImplName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.mozilla.MozillaBootstrap")) ))
- {
- Sequence< ::rtl::OUString > aSNS( 1 );
- aSNS[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap"));
- aReq.CREATE_PROVIDER(
- aImplName,
- aSNS,
- createMozillaBootstrap, ::cppu::createSingleFactory);
- }
- if(aReq.xRet.is())
- aReq.xRet->acquire();
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MStatement.cxx b/connectivity/source/drivers/mozab/MStatement.cxx
deleted file mode 100644
index d0428c744e..0000000000
--- a/connectivity/source/drivers/mozab/MStatement.cxx
+++ /dev/null
@@ -1,564 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <stdio.h>
-#include <osl/diagnose.h>
-#include <comphelper/property.hxx>
-#include <comphelper/uno3.hxx>
-#include <osl/thread.h>
-#include <tools/diagnose_ex.h>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <comphelper/sequence.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/extract.hxx>
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-#include <com/sun/star/container/XIndexAccess.hpp>
-
-#include <algorithm>
-
-#include "diagnose_ex.h"
-#include "MDriver.hxx"
-#include "MStatement.hxx"
-#include "MConnection.hxx"
-#include "MResultSet.hxx"
-#include "MDatabaseMetaData.hxx"
-#include "resource/mozab_res.hrc"
-#include "resource/common_res.hrc"
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-static ::osl::Mutex m_ThreadMutex;
-
-using namespace ::comphelper;
-using namespace connectivity::mozab;
-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::container;
-using namespace com::sun::star::io;
-using namespace com::sun::star::util;
-//------------------------------------------------------------------------------
-OCommonStatement::OCommonStatement(OConnection* _pConnection )
- :OCommonStatement_IBASE(m_aMutex)
- ,OPropertySetHelper(OCommonStatement_IBASE::rBHelper)
- ,OCommonStatement_SBASE((::cppu::OWeakObject*)_pConnection, this)
- ,m_xDBMetaData(_pConnection->getMetaData())
- ,m_pTable(NULL)
- ,m_pConnection(_pConnection)
- ,m_aParser(_pConnection->getDriver()->getMSFactory())
- ,m_pSQLIterator( new OSQLParseTreeIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL ) )
- ,m_pParseTree(NULL)
- ,rBHelper(OCommonStatement_IBASE::rBHelper)
-{
- m_pConnection->acquire();
- OSL_TRACE("In/Out: OCommonStatement::OCommonStatement" );
-}
-// -----------------------------------------------------------------------------
-OCommonStatement::~OCommonStatement()
-{
-}
-
-//------------------------------------------------------------------------------
-void OCommonStatement::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- clearWarnings();
- clearCachedResultSet();
-
- if (m_pConnection)
- m_pConnection->release();
- m_pConnection = NULL;
-
- m_pSQLIterator->dispose();
-
- dispose_ChildImpl();
- OCommonStatement_IBASE::disposing();
-}
-//-----------------------------------------------------------------------------
-Any SAL_CALL OCommonStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OCommonStatement_IBASE::queryInterface(rType);
- if(!aRet.hasValue())
- aRet = OPropertySetHelper::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OCommonStatement::getTypes( ) throw(RuntimeException)
-{
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
- ::getCppuType( (const Reference< XFastPropertySet > *)0 ),
- ::getCppuType( (const Reference< XPropertySet > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OCommonStatement_IBASE::getTypes());
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OCommonStatement::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- }
- dispose();
-}
-
-
-// -------------------------------------------------------------------------
-void OCommonStatement::createTable( ) throw ( SQLException, RuntimeException )
-{
- if(m_pParseTree)
- {
- ::rtl::Reference<connectivity::OSQLColumns> xCreateColumn;
- if (m_pSQLIterator->getStatementType() == SQL_STATEMENT_CREATE_TABLE)
- {
- const OSQLTables& xTabs = m_pSQLIterator->getTables();
- OSL_ENSURE( !xTabs.empty(), "Need a Table");
- ::rtl::OUString ouTableName=xTabs.begin()->first;
- xCreateColumn = m_pSQLIterator->getCreateColumns();
- OSL_ENSURE(xCreateColumn.is(), "Need the Columns!!");
-
- const OColumnAlias& aColumnAlias = m_pConnection->getColumnAlias();
-
- OSQLColumns::Vector::const_iterator aIter = xCreateColumn->get().begin();
- const ::rtl::OUString sProprtyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
- ::rtl::OUString sName;
- for (sal_Int32 i = 1; aIter != xCreateColumn->get().end();++aIter, i++)
- {
- (*aIter)->getPropertyValue(sProprtyName) >>= sName;
- if ( !aColumnAlias.hasAlias( sName ) )
- {
-
- const ::rtl::OUString sError( getOwnConnection()->getResources().getResourceStringWithSubstitution(
- STR_INVALID_COLUMNNAME,
- "$columnname$", sName
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
- }
- MDatabaseMetaDataHelper _aDbHelper;
- if (!_aDbHelper.NewAddressBook(m_pConnection,ouTableName))
- {
- getOwnConnection()->throwSQLException( _aDbHelper.getError(), *this );
- }
- m_pSQLIterator.reset( new ::connectivity::OSQLParseTreeIterator(
- m_pConnection, m_pConnection->createCatalog()->getTables(), m_aParser, NULL ) );
- }
-
- }
- else
- getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
-}
-// -------------------------------------------------------------------------
-OCommonStatement::StatementType OCommonStatement::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted)
- throw ( SQLException, RuntimeException )
-{
- ::rtl::OUString aErr;
-
- m_pParseTree = m_aParser.parseTree(aErr,sql);
-
-#if OSL_DEBUG_LEVEL > 0
- {
- const char* str = OUtoCStr(sql);
- OSL_UNUSED( str );
- OSL_TRACE("ParseSQL: %s\n", OUtoCStr( sql ) );
- }
-#endif // OSL_DEBUG_LEVEL
-
- if(m_pParseTree)
- {
- m_pSQLIterator->setParseTree(m_pParseTree);
- m_pSQLIterator->traverseAll();
- const OSQLTables& xTabs = m_pSQLIterator->getTables();
- if(xTabs.empty())
- getOwnConnection()->throwSQLException( STR_QUERY_AT_LEAST_ONE_TABLES, *this );
-
-#if OSL_DEBUG_LEVEL > 0
- OSQLTables::const_iterator citer;
- for( citer = xTabs.begin(); citer != xTabs.end(); ++citer ) {
- OSL_TRACE("SELECT Table : %s\n", OUtoCStr(citer->first) );
- }
-#endif
-
- Reference<XIndexAccess> xNames;
- switch(m_pSQLIterator->getStatementType())
- {
- case SQL_STATEMENT_SELECT:
-
- // at this moment we support only one table per select statement
-
- OSL_ENSURE( xTabs.begin() != xTabs.end(), "Need a Table");
-
- m_pTable = static_cast< OTable* > (xTabs.begin()->second.get());
- m_xColNames = m_pTable->getColumns();
- xNames = Reference<XIndexAccess>(m_xColNames,UNO_QUERY);
- // set the binding of the resultrow
- m_aRow = new OValueVector(xNames->getCount());
- (m_aRow->get())[0].setBound(sal_True);
- ::std::for_each(m_aRow->get().begin()+1,m_aRow->get().end(),TSetBound(sal_False));
- // create the column mapping
- createColumnMapping();
-
- analyseSQL();
- return eSelect;
-
- case SQL_STATEMENT_CREATE_TABLE:
- createTable();
- return eCreateTable;
-
- default:
- break;
- }
- }
- else if(!bAdjusted) //Our sql parser does not support a statement like "create table foo"
- // So we append ("E-mail" varchar) to the last of it to make it work
- {
- return parseSql(sql + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("(""E-mail"" caracter)")),sal_True);
- }
-
- getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
- OSL_FAIL( "OCommonStatement::parseSql: unreachable!" );
- return eSelect;
-
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > OCommonStatement::impl_executeCurrentQuery()
-{
- clearCachedResultSet();
-
- ::rtl::Reference< OResultSet > pResult( new OResultSet( this, m_pSQLIterator ) );
- initializeResultSet( pResult.get() );
-
- pResult->executeQuery();
- cacheResultSet( pResult ); // only cache if we survived the execution
-
- return pResult.get();
-
-}
-
-// -------------------------------------------------------------------------
-void OCommonStatement::initializeResultSet( OResultSet* _pResult )
-{
- ENSURE_OR_THROW( _pResult, "invalid result set" );
-
- _pResult->setColumnMapping(m_aColMapping);
- _pResult->setOrderByColumns(m_aOrderbyColumnNumber);
- _pResult->setOrderByAscending(m_aOrderbyAscending);
- _pResult->setBindingRow(m_aRow);
- _pResult->setTable(m_pTable);
-}
-
-// -------------------------------------------------------------------------
-void OCommonStatement::clearCachedResultSet()
-{
- Reference< XResultSet > xResultSet( m_xResultSet.get(), UNO_QUERY );
- if ( !xResultSet.is() )
- return;
-
- try
- {
- Reference< XCloseable > xCloseable( xResultSet, UNO_QUERY_THROW );
- xCloseable->close();
- }
- catch( const DisposedException& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- m_xResultSet = Reference< XResultSet >();
-}
-
-// -------------------------------------------------------------------------
-void OCommonStatement::cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult )
-{
- ENSURE_OR_THROW( _pResult.is(), "invalid result set" );
- m_xResultSet = Reference< XResultSet >( _pResult.get() );
-}
-
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OCommonStatement::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- OSL_TRACE("Statement::execute( %s )", OUtoCStr( sql ) );
-
- Reference< XResultSet > xRS = executeQuery( sql );
- // returns true when a resultset is available
- return xRS.is();
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSet > SAL_CALL OCommonStatement::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_ThreadMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- OSL_TRACE("Statement::executeQuery( %s )", OUtoCStr( sql ) );
-
- // parse the statement
- StatementType eStatementType = parseSql( sql );
- if ( eStatementType != eSelect )
- return NULL;
-
- return impl_executeCurrentQuery();
-}
-// -------------------------------------------------------------------------
-
-Reference< XConnection > SAL_CALL OCommonStatement::getConnection( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- // just return our connection here
- return (Reference< XConnection >)m_pConnection;
-}
-// -----------------------------------------------------------------------------
-Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = ::cppu::queryInterface(rType,static_cast< XServiceInfo*> (this));
- if(!aRet.hasValue())
- aRet = OCommonStatement::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OCommonStatement::executeUpdate( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this );
- return 0;
-
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OCommonStatement::getWarnings( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- return makeAny(m_aLastWarning);
-}
-// -------------------------------------------------------------------------
-
-// -------------------------------------------------------------------------
-void SAL_CALL OCommonStatement::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
-
- m_aLastWarning = SQLWarning();
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OCommonStatement::createArrayHelper( ) const
-{
- // this properties are define by the service resultset
- // they must in alphabetic order
- Sequence< Property > aProps(9);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP0(CURSORNAME, ::rtl::OUString);
- DECL_BOOL_PROP0(ESCAPEPROCESSING);
- DECL_PROP0(FETCHDIRECTION,sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP0(MAXFIELDSIZE,sal_Int32);
- DECL_PROP0(MAXROWS, sal_Int32);
- DECL_PROP0(QUERYTIMEOUT,sal_Int32);
- DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32);
- DECL_PROP0(RESULTSETTYPE,sal_Int32);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & OCommonStatement::getInfoHelper()
-{
- return *const_cast<OCommonStatement*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool OCommonStatement::convertFastPropertyValue(
- Any & /*rConvertedValue*/,
- Any & /*rOldValue*/,
- sal_Int32 /*nHandle*/,
- const Any& /*rValue*/ )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- sal_Bool bConverted = sal_False;
- // here we have to try to convert
- return bConverted;
-}
-// -------------------------------------------------------------------------
-void OCommonStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& /*rValue*/) throw (Exception)
-{
- // set the value to what ever is nescessary
- switch(nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- case PROPERTY_ID_MAXFIELDSIZE:
- case PROPERTY_ID_MAXROWS:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- case PROPERTY_ID_ESCAPEPROCESSING:
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void OCommonStatement::getFastPropertyValue(Any& /*rValue*/,sal_Int32 nHandle) const
-{
- switch(nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- case PROPERTY_ID_MAXFIELDSIZE:
- case PROPERTY_ID_MAXROWS:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- case PROPERTY_ID_ESCAPEPROCESSING:
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement");
-// -----------------------------------------------------------------------------
-void SAL_CALL OCommonStatement::acquire() throw()
-{
- OCommonStatement_IBASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OCommonStatement::release() throw()
-{
- relase_ChildImpl();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement::acquire() throw()
-{
- OCommonStatement::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement::release() throw()
-{
- OCommonStatement::release();
-}
-// -----------------------------------------------------------------------------
-Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OCommonStatement::getPropertySetInfo( ) throw(RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-void OCommonStatement::createColumnMapping()
-{
- size_t i;
-
- // initialize the column index map (mapping select columns to table columns)
- ::rtl::Reference<connectivity::OSQLColumns> xColumns = m_pSQLIterator->getSelectColumns();
- m_aColMapping.resize(xColumns->get().size() + 1);
- for (i=0; i<m_aColMapping.size(); ++i)
- m_aColMapping[i] = i;
-
- Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
- // now check which columns are bound
-#if OSL_DEBUG_LEVEL > 0
- for ( i = 0; i < m_aColMapping.size(); i++ )
- OSL_TRACE("BEFORE Mapped: %d -> %d", i, m_aColMapping[i] );
-#endif
- OResultSet::setBoundedColumns(m_aRow,xColumns,xNames,sal_True,m_xDBMetaData,m_aColMapping);
-#if OSL_DEBUG_LEVEL > 0
- for ( i = 0; i < m_aColMapping.size(); i++ )
- OSL_TRACE("AFTER Mapped: %d -> %d", i, m_aColMapping[i] );
-#endif
-}
-// -----------------------------------------------------------------------------
-
-void OCommonStatement::analyseSQL()
-{
- const OSQLParseNode* pOrderbyClause = m_pSQLIterator->getOrderTree();
- if(pOrderbyClause)
- {
- OSQLParseNode * pOrderingSpecCommalist = pOrderbyClause->getChild(2);
- OSL_ENSURE(SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OResultSet: Fehler im Parse Tree");
-
- for (sal_uInt32 m = 0; m < pOrderingSpecCommalist->count(); m++)
- {
- OSQLParseNode * pOrderingSpec = pOrderingSpecCommalist->getChild(m);
- OSL_ENSURE(SQL_ISRULE(pOrderingSpec,ordering_spec),"OResultSet: Fehler im Parse Tree");
- OSL_ENSURE(pOrderingSpec->count() == 2,"OResultSet: Fehler im Parse Tree");
-
- OSQLParseNode * pColumnRef = pOrderingSpec->getChild(0);
- if(!SQL_ISRULE(pColumnRef,column_ref))
- {
- throw SQLException();
- }
- OSQLParseNode * pAscendingDescending = pOrderingSpec->getChild(1);
- setOrderbyColumn(pColumnRef,pAscendingDescending);
- }
- }
-}
-//------------------------------------------------------------------
-void OCommonStatement::setOrderbyColumn( OSQLParseNode* pColumnRef,
- OSQLParseNode* pAscendingDescending)
-{
- ::rtl::OUString aColumnName;
- if (pColumnRef->count() == 1)
- aColumnName = pColumnRef->getChild(0)->getTokenValue();
- else if (pColumnRef->count() == 3)
- {
- pColumnRef->getChild(2)->parseNodeToStr( aColumnName, getOwnConnection(), NULL, sal_False, sal_False );
- }
- else
- {
- throw SQLException();
- }
-
- Reference<XColumnLocate> xColLocate(m_xColNames,UNO_QUERY);
- if(!xColLocate.is())
- return;
-
- m_aOrderbyColumnNumber.push_back(xColLocate->findColumn(aColumnName));
-
- // Ascending or Descending?
- m_aOrderbyAscending.push_back((SQL_ISTOKEN(pAscendingDescending,DESC)) ? SQL_DESC : SQL_ASC);
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MStatement.hxx b/connectivity/source/drivers/mozab/MStatement.hxx
deleted file mode 100644
index 029615ba00..0000000000
--- a/connectivity/source/drivers/mozab/MStatement.hxx
+++ /dev/null
@@ -1,214 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SSTATEMENT_HXX
-#define CONNECTIVITY_SSTATEMENT_HXX
-
-#include <com/sun/star/sdbc/XStatement.hpp>
-#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
-#include <com/sun/star/sdbc/XBatchExecution.hpp>
-#include <com/sun/star/sdbc/XCloseable.hpp>
-#include <com/sun/star/sdbc/SQLWarning.hpp>
-#include <comphelper/proparrhlp.hxx>
-#include <cppuhelper/compbase3.hxx>
-#include <comphelper/uno3.hxx>
-#include "connectivity/CommonTools.hxx"
-#ifndef INCLUDED_LIST
-#include <list>
-#define INCLUDED_LIST
-#endif
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <comphelper/broadcasthelper.hxx>
-#include "connectivity/sqliterator.hxx"
-#include "connectivity/sqlparse.hxx"
-#include <connectivity/FValue.hxx>
-#include "TSortIndex.hxx"
-#include "MConnection.hxx"
-#include "MTable.hxx"
-
-#include <boost/shared_ptr.hpp>
-
-namespace connectivity
-{
- namespace mozab
- {
- class OResultSet;
-
- typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XStatement,
- ::com::sun::star::sdbc::XWarningsSupplier,
- ::com::sun::star::sdbc::XCloseable> OCommonStatement_IBASE;
-
- //**************************************************************
- //************ Class: OCommonStatement
- // is a base class for the normal statement and for the prepared statement
- //**************************************************************
- class OCommonStatement;
- typedef ::connectivity::OSubComponent< OCommonStatement, OCommonStatement_IBASE > OCommonStatement_SBASE;
-
- class OCommonStatement :public comphelper::OBaseMutex
- ,public OCommonStatement_IBASE
- ,public ::cppu::OPropertySetHelper
- ,public ::comphelper::OPropertyArrayUsageHelper< OCommonStatement >
- ,public OCommonStatement_SBASE
- {
- friend class ::connectivity::OSubComponent< OCommonStatement, OCommonStatement_IBASE >;
-
- private:
- ::com::sun::star::sdbc::SQLWarning m_aLastWarning;
-
- protected:
- ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet > m_xResultSet;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xDBMetaData;
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColNames; // table columns
-
- // for this Statement
-
- ::std::list< ::rtl::OUString> m_aBatchList;
-
- OTable* m_pTable;
- OConnection* m_pConnection; // The owning Connection object
-
- OValueRow m_aRow;
-
- connectivity::OSQLParser m_aParser;
- ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator >
- m_pSQLIterator;
-
- connectivity::OSQLParseNode* m_pParseTree;
-
- ::std::vector<sal_Int32> m_aColMapping;
- ::std::vector<sal_Int32> m_aOrderbyColumnNumber;
- ::std::vector<TAscendingOrder> m_aOrderbyAscending;
-
- ::cppu::OBroadcastHelper& rBHelper;
-
- protected:
-
- // OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
- // OPropertySetHelper
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
- virtual sal_Bool SAL_CALL convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception);
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle) const;
- virtual ~OCommonStatement();
-
- protected:
- //
- // Driver Internal Methods
- //
- enum StatementType { eSelect, eCreateTable };
- /** called to do the parsing of a to-be-executed SQL statement, and set all members as needed
- */
- virtual StatementType
- parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
- /** called to initialize a result set, according to a previously parsed SQL statement
- */
- virtual void initializeResultSet( OResultSet* _pResult );
- /** called when a possible cached instance of our last result set should be cleared
- */
- virtual void clearCachedResultSet();
- /** caches a result set which has just been created by an execution of an SQL statement
- */
- virtual void cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult );
-
-
- /** executes the current query (the one which has been passed to the last parseSql call)
- */
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
- impl_executeCurrentQuery();
-
- void createColumnMapping();
- void analyseSQL();
- void setOrderbyColumn( connectivity::OSQLParseNode* pColumnRef,
- connectivity::OSQLParseNode* pAscendingDescending);
- virtual void createTable( ) throw (
- ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
-
- public:
- // other methods
- OConnection* getOwnConnection() const { return m_pConnection;}
-
- OCommonStatement(OConnection* _pConnection );
- using OCommonStatement_IBASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
-
- // XInterface
- virtual void SAL_CALL release() throw();
- virtual void SAL_CALL acquire() throw();
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- //XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
- // XStatement
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- // XWarningsSupplier
- virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- protected:
- using OPropertySetHelper::getFastPropertyValue;
- };
-
- class OStatement : public OCommonStatement,
- public ::com::sun::star::lang::XServiceInfo
- {
- protected:
- ~OStatement(){}
- public:
- // a constructor, for when the object needs to be returned:
- OStatement( OConnection* _pConnection) : OCommonStatement( _pConnection){}
- DECLARE_SERVICE_INFO();
-
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
- };
- }
-}
-#endif // CONNECTIVITY_SSTATEMENT_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MTable.cxx b/connectivity/source/drivers/mozab/MTable.cxx
deleted file mode 100644
index d122794a64..0000000000
--- a/connectivity/source/drivers/mozab/MTable.cxx
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "MTable.hxx"
-#include "MTables.hxx"
-#include "MColumns.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <comphelper/sequence.hxx>
-#include <comphelper/extract.hxx>
-#include <comphelper/types.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/TKeys.hxx"
-#include "connectivity/TIndexes.hxx"
-#include "MCatalog.hxx"
-
-
-using namespace ::comphelper;
-using namespace connectivity::mozab;
-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;
-
-OTable::OTable( sdbcx::OCollection* _pTables, OConnection* _pConnection)
- :OTable_Base( _pTables, _pConnection, sal_True )
- ,m_pConnection( _pConnection )
-{
- construct();
-}
-// -------------------------------------------------------------------------
-OTable::OTable( sdbcx::OCollection* _pTables, OConnection* _pConnection,
- const ::rtl::OUString& _Name, const ::rtl::OUString& _Type, const ::rtl::OUString& _Description )
- :OTable_Base(_pTables, _pConnection, sal_True, _Name, _Type, _Description )
- ,m_pConnection( _pConnection )
-{
- construct();
-}
-
-//--------------------------------------------------------------------------
-sdbcx::OCollection* OTable::createColumns( const TStringVector& _rNames )
-{
- return new OColumns( this, m_aMutex, _rNames );
-}
-
-//--------------------------------------------------------------------------
-sdbcx::OCollection* OTable::createKeys(const TStringVector& _rNames)
-{
- return new OKeysHelper( this, m_aMutex, _rNames );
-}
-
-//--------------------------------------------------------------------------
-sdbcx::OCollection* OTable::createIndexes(const TStringVector& _rNames)
-{
- return new OIndexesHelper( this, m_aMutex, _rNames );
-}
-
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MTable.hxx b/connectivity/source/drivers/mozab/MTable.hxx
deleted file mode 100644
index 7f1826257f..0000000000
--- a/connectivity/source/drivers/mozab/MTable.hxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MOZAB_TABLE_HXX_
-#define _CONNECTIVITY_MOZAB_TABLE_HXX_
-
-#include "connectivity/TTableHelper.hxx"
-#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-#include "MConnection.hxx"
-
-namespace connectivity
-{
- namespace mozab
- {
- typedef ::connectivity::OTableHelper OTable_Base;
-
- class OTable : public OTable_Base
- {
- OConnection* m_pConnection;
-
- public:
- OTable( sdbcx::OCollection* _pTables, OConnection* _pConnection);
- OTable( sdbcx::OCollection* _pTables,
- OConnection* _pConnection,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description );
-
- OConnection* getConnection() { return m_pConnection;}
-
- sal_Bool isReadOnly() const { return sal_False; }
-
- ::rtl::OUString getTableName() const { return m_Name; }
- ::rtl::OUString getSchema() const { return m_SchemaName; }
-
- // OTableHelper overridables
- virtual sdbcx::OCollection* createColumns( const TStringVector& _rNames );
- virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames);
- virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames);
- private:
- using OTable_Base::getConnection;
- };
- }
-}
-#endif // _CONNECTIVITY_MOZAB_TABLE_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MTables.cxx b/connectivity/source/drivers/mozab/MTables.cxx
deleted file mode 100644
index ebc913845e..0000000000
--- a/connectivity/source/drivers/mozab/MTables.cxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "MTables.hxx"
-#include "MTable.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include "MCatalog.hxx"
-#include "MConnection.hxx"
-#include <comphelper/extract.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/dbexception.hxx"
-#include <cppuhelper/interfacecontainer.h>
-#include <comphelper/types.hxx>
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace ::cppu;
-using namespace connectivity::mozab;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace dbtools;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OTables::createObject(const ::rtl::OUString& _rName)
-{
- ::rtl::OUString aName,aSchema;
- // sal_Int32 nLen = _rName.indexOf('.');
- // aSchema = _rName.copy(0,nLen);
- // aName = _rName.copy(nLen+1);
- aSchema = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%"));
- aName = _rName;
-
- Sequence< ::rtl::OUString > aTypes(1);
- aTypes[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%"));
- // aTypes[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TABLE"));
- // aTypes[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYSTEMTABLE"));
- ::rtl::OUString sEmpty;
-
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),aSchema,aName,aTypes);
-
- sdbcx::ObjectType xRet = NULL;
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- if(xResult->next()) // there can be only one table with this name
- {
- OTable* pRet = new OTable( this, static_cast<OCatalog&>(m_rParent).getConnection(),
- aName,xRow->getString(4),xRow->getString(5));
- xRet = pRet;
- }
- }
- ::comphelper::disposeComponent(xResult);
-
- return xRet;
-}
-// -------------------------------------------------------------------------
-void OTables::impl_refresh( ) throw(RuntimeException)
-{
- static_cast<OCatalog&>(m_rParent).refreshTables();
-}
-// -------------------------------------------------------------------------
-void OTables::disposing(void)
-{
-m_xMetaData.clear();
- OCollection::disposing();
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MTables.hxx b/connectivity/source/drivers/mozab/MTables.hxx
deleted file mode 100644
index 437bbbe6c5..0000000000
--- a/connectivity/source/drivers/mozab/MTables.hxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _CONNECTIVITY_MOZAB_TABLES_HXX_
-#define _CONNECTIVITY_MOZAB_TABLES_HXX_
-
-#include "connectivity/sdbcx/VCollection.hxx"
-#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-namespace connectivity
-{
- namespace mozab
- {
- class OTables : public sdbcx::OCollection
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
- // OCatalog* m_pParent;
- protected:
- virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
- virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
- public:
- OTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
- const TStringVector &_rVector) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector)
- ,m_xMetaData(_rMetaData)
- {}
-
- // only the name is identical to ::cppu::OComponentHelper
- virtual void SAL_CALL disposing(void);
- };
- }
-}
-#endif // _CONNECTIVITY_MOZAB_TABLES_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx
deleted file mode 100644
index c7e19eb0e8..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx
+++ /dev/null
@@ -1,283 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MMozillaBootstrap.hxx"
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::mozilla;
-using namespace connectivity::mozab;
-#include <MNSFolders.hxx>
-#include "MNSProfileDiscover.hxx"
-#ifndef MINIMAL_PROFILEDISCOVER
-# include "MNSProfileManager.hxx"
-# include "MNSRunnable.hxx"
-#endif
-#include <MNSInit.hxx>
-
-static MozillaBootstrap *pMozillaBootstrap=NULL;
-static Reference<XMozillaBootstrap> xMozillaBootstrap;
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL OMozillaBootstrap_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory)
-{
- if (!pMozillaBootstrap)
- {
- pMozillaBootstrap=new connectivity::mozab::MozillaBootstrap( _rxFactory );
- pMozillaBootstrap->Init();
- xMozillaBootstrap = pMozillaBootstrap;
- }
- return pMozillaBootstrap;
-}
-
-// --------------------------------------------------------------------------------
-
-
-// --------------------------------------------------------------------------------
-MozillaBootstrap::MozillaBootstrap(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory)
- : OMozillaBootstrap_BASE(m_aMutex), m_xMSFactory( _rxFactory )
-{
-}
-// -----------------------------------------------------------------------------
-MozillaBootstrap::~MozillaBootstrap()
-{
-}
-// -----------------------------------------------------------------------------
-void MozillaBootstrap::Init()
-{
- sal_Bool aProfileExists=sal_False;
-
-#ifndef MINIMAL_PROFILEDISCOVER
- //This must be call before any mozilla code
- MNS_Init(aProfileExists);
-
- m_ProfileManager = new ProfileManager();
-#else
- (void)aProfileExists; /* avoid warning about unused parameter */
-#endif
- m_ProfileAccess = new ProfileAccess();
- bootupProfile(::com::sun::star::mozilla::MozillaProductType_Mozilla,rtl::OUString());
-}
-
-// --------------------------------------------------------------------------------
-void MozillaBootstrap::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- OMozillaBootstrap_BASE::disposing();
-}
-
-// static ServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString MozillaBootstrap::getImplementationName_Static( ) throw(RuntimeException)
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(MOZAB_MozillaBootstrap_IMPL_NAME));
-}
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > MozillaBootstrap::getSupportedServiceNames_Static( ) throw (RuntimeException)
-{
- // which service is supported
- // for more information @see com.sun.star.mozilla.MozillaBootstrap
- Sequence< ::rtl::OUString > aSNS( 1 );
- aSNS[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap"));
- return aSNS;
-}
-
-//------------------------------------------------------------------
-::rtl::OUString SAL_CALL MozillaBootstrap::getImplementationName( ) throw(RuntimeException)
-{
- return getImplementationName_Static();
-}
-
-//------------------------------------------------------------------
-sal_Bool SAL_CALL MozillaBootstrap::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-
-//------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL MozillaBootstrap::getSupportedServiceNames( ) throw(RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-
-
-// XProfileDiscover
-::sal_Int32 SAL_CALL MozillaBootstrap::getProfileCount( ::com::sun::star::mozilla::MozillaProductType product) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_ProfileAccess->getProfileCount(product);
-}
-::sal_Int32 SAL_CALL MozillaBootstrap::getProfileList( ::com::sun::star::mozilla::MozillaProductType product, ::com::sun::star::uno::Sequence< ::rtl::OUString >& list ) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_ProfileAccess->getProfileList(product,list);
-}
-::rtl::OUString SAL_CALL MozillaBootstrap::getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_ProfileAccess->getDefaultProfile(product);
-}
-::rtl::OUString SAL_CALL MozillaBootstrap::getProfilePath( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_ProfileAccess->getProfilePath(product,profileName);
-}
-::sal_Bool SAL_CALL MozillaBootstrap::isProfileLocked( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_ProfileAccess->isProfileLocked(product,profileName);
-}
-::sal_Bool SAL_CALL MozillaBootstrap::getProfileExists( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_ProfileAccess->getProfileExists(product,profileName);
-}
-
-// XProfileManager
-::sal_Int32 SAL_CALL MozillaBootstrap::bootupProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
-{
-#ifndef MINIMAL_PROFILEDISCOVER
- return m_ProfileManager->bootupProfile(product,profileName);
-#else
- (void)product; /* avoid warning about unused parameter */
- (void)profileName; /* avoid warning about unused parameter */
- return -1;
-#endif
-}
-::sal_Int32 SAL_CALL MozillaBootstrap::shutdownProfile( ) throw (::com::sun::star::uno::RuntimeException)
-{
-#ifndef MINIMAL_PROFILEDISCOVER
- return m_ProfileManager->shutdownProfile();
-#else
- return -1;
-#endif
-}
-::com::sun::star::mozilla::MozillaProductType SAL_CALL MozillaBootstrap::getCurrentProduct( ) throw (::com::sun::star::uno::RuntimeException)
-{
-#ifndef MINIMAL_PROFILEDISCOVER
- return m_ProfileManager->getCurrentProduct();
-#else
- return ::com::sun::star::mozilla::MozillaProductType_Default;
-#endif
-}
-::rtl::OUString SAL_CALL MozillaBootstrap::getCurrentProfile( ) throw (::com::sun::star::uno::RuntimeException)
-{
-#ifndef MINIMAL_PROFILEDISCOVER
- return m_ProfileManager->getCurrentProfile();
-#else
- return ::rtl::OUString();
-#endif
-}
-::sal_Bool SAL_CALL MozillaBootstrap::isCurrentProfileLocked( ) throw (::com::sun::star::uno::RuntimeException)
-{
-#ifndef MINIMAL_PROFILEDISCOVER
- return isProfileLocked(getCurrentProduct(),m_ProfileManager->getCurrentProfile());
-#else
- return true;
-#endif
-}
-::rtl::OUString SAL_CALL MozillaBootstrap::setCurrentProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
-{
-#ifndef MINIMAL_PROFILEDISCOVER
- return m_ProfileManager->setCurrentProfile(product,profileName);
-#else
- (void)product; /* avoid warning about unused parameter */
- (void)profileName; /* avoid warning about unused parameter */
- return ::rtl::OUString();
-#endif
-}
-
-// XProxyRunner
-::sal_Int32 SAL_CALL MozillaBootstrap::Run( const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy >& aCode ) throw (::com::sun::star::uno::RuntimeException)
-{
-#ifndef MINIMAL_PROFILEDISCOVER
- ::rtl::OUString profileName = aCode->getProfileName();
- ::rtl::OUString currProfileName = getCurrentProfile();
- ::com::sun::star::mozilla::MozillaProductType currProduct = getCurrentProduct();
-
- //if client provides a profileName, we will use it
- if (profileName.getLength()
- && ( aCode->getProductType() != currProduct || !profileName.equals(currProfileName)) )
- setCurrentProfile(aCode->getProductType(),profileName);
- MNSRunnable xRunnable;
-
- return xRunnable.StartProxy(aCode);;
-#else
- (void)aCode; /* avoid warning about unused parameter */
- return -1;
-#endif
-}
-
-#ifdef MINIMAL_PROFILEDISCOVER
-#include <cppuhelper/factory.hxx>
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager )
-{
- MozillaBootstrap * pBootstrap = reinterpret_cast<MozillaBootstrap*>(OMozillaBootstrap_CreateInstance(rServiceManager));
- return *pBootstrap;
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = 0;
-
- if (pServiceManager)
- {
- ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplementationName ) );
- Reference< XSingleServiceFactory > xFactory;
- if (aImplName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.mozilla.MozillaBootstrap")) ))
- {
- Sequence< ::rtl::OUString > aSNS( 1 );
- aSNS[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap"));
-
- xFactory = ::cppu::createSingleFactory(
- reinterpret_cast< XMultiServiceFactory* > ( pServiceManager),
- aImplName, createInstance, aSNS );
- }
- if ( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx
deleted file mode 100644
index d605d4bb0a..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SMOZILLABOOTSTRAP_HXX
-#define CONNECTIVITY_SMOZILLABOOTSTRAP_HXX
-
-#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/compbase2.hxx>
-#include <osl/module.h>
-
-
-#define MOZAB_MozillaBootstrap_IMPL_NAME "com.sun.star.comp.mozilla.MozillaBootstrap"
-
-namespace connectivity
-{
- namespace mozab
- {
- typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::mozilla::XMozillaBootstrap,
- ::com::sun::star::lang::XServiceInfo > OMozillaBootstrap_BASE;
- class ProfileAccess;
- class ProfileManager;
- class MozillaBootstrap : public OMozillaBootstrap_BASE
- {
- protected:
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xMSFactory;
-
- ::osl::Mutex m_aMutex; // mutex is need to control member access
- virtual ~MozillaBootstrap();
- protected:
- ProfileAccess * m_ProfileAccess;
- ProfileManager * m_ProfileManager;
- public:
-
- void Init();
- MozillaBootstrap(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
- // XInterface
- static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XMozillaBootstrap
-
- // XProfileDiscover
- virtual ::sal_Int32 SAL_CALL getProfileCount( ::com::sun::star::mozilla::MozillaProductType product) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getProfileList( ::com::sun::star::mozilla::MozillaProductType product, ::com::sun::star::uno::Sequence< ::rtl::OUString >& list ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getProfilePath( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isProfileLocked( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getProfileExists( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
-
- // XProfileManager
- virtual ::sal_Int32 SAL_CALL bootupProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL shutdownProfile( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::mozilla::MozillaProductType SAL_CALL getCurrentProduct( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCurrentProfile( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isCurrentProfileLocked( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL setCurrentProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
-
- // XProxyRunner
- virtual ::sal_Int32 SAL_CALL Run( const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy >& aCode ) throw (::com::sun::star::uno::RuntimeException);
-
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- & getMSFactory(void) const { return m_xMSFactory; }
-
- };
- }
-
-}
-
-#endif // CONNECTIVITY_SMozillaBootstrap_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx
deleted file mode 100644
index 3dd647a9b4..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <MNSFolders.hxx>
-
-#ifdef UNIX
-#include <sys/types.h>
-#include <strings.h>
-#include <string.h>
-#endif // End UNIX
-
-#ifdef WNT
-#include "pre_include_windows.h"
-#include <windows.h>
-#include <stdlib.h>
-#include <shlobj.h>
-#include <objidl.h>
-#include "post_include_windows.h"
-#endif // End WNT
-#include <osl/security.hxx>
-#include <osl/file.hxx>
-#include <osl/thread.h>
-
-using namespace ::com::sun::star::mozilla;
-
-namespace
-{
- // -------------------------------------------------------------------
- static ::rtl::OUString lcl_getUserDataDirectory()
- {
- ::osl::Security aSecurity;
- ::rtl::OUString aConfigPath;
-
- aSecurity.getConfigDir( aConfigPath );
- return aConfigPath + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
- }
-
- // -------------------------------------------------------------------
- static const char* DefaultProductDir[3][3] =
- {
- #if defined(XP_WIN)
- { "Mozilla/SeaMonkey/", NULL, NULL },
- { "Mozilla/Firefox/", NULL, NULL },
- { "Thunderbird/", "Mozilla/Thunderbird/", NULL }
- #elif(MACOSX)
- { "../Mozilla/SeaMonkey/", NULL, NULL },
- { "Firefox/", NULL, NULL },
- { "../Thunderbird/", NULL, NULL }
- #else
- { ".mozilla/seamonkey/", NULL, NULL },
- { ".mozilla/firefox/", NULL, NULL },
- { ".thunderbird/", ".mozilla-thunderbird/", ".mozilla/thunderbird/" }
- #endif
- };
-
- static const char* ProductRootEnvironmentVariable[3] =
- {
- "MOZILLA_PROFILE_ROOT",
- "MOZILLA_FIREFOX_PROFILE_ROOT",
- "MOZILLA_THUNDERBIRD_PROFILE_ROOT",
- };
-
- // -------------------------------------------------------------------
- static ::rtl::OUString lcl_guessProfileRoot( MozillaProductType _product )
- {
- size_t productIndex = _product - 1;
-
- static ::rtl::OUString s_productDirectories[3];
-
- if ( !s_productDirectories[ productIndex ].getLength() )
- {
- ::rtl::OUString sProductPath;
-
- // check whether we have an anevironment variable which helps us
- const char* pProfileByEnv = getenv( ProductRootEnvironmentVariable[ productIndex ] );
- if ( pProfileByEnv )
- {
- sProductPath = ::rtl::OUString( pProfileByEnv, rtl_str_getLength( pProfileByEnv ), osl_getThreadTextEncoding() );
- // asume that this is fine, no further checks
- }
- else
- {
- ::rtl::OUString sProductDirCandidate;
- const char* pProfileRegistry = "profiles.ini";
-
- // check all possible candidates
- for ( size_t i=0; i<3; ++i )
- {
- if ( NULL == DefaultProductDir[ productIndex ][ i ] )
- break;
-
- sProductDirCandidate = lcl_getUserDataDirectory() +
- ::rtl::OUString::createFromAscii( DefaultProductDir[ productIndex ][ i ] );
-
- // check existence
- ::osl::DirectoryItem aRegistryItem;
- ::osl::FileBase::RC result = ::osl::DirectoryItem::get( sProductDirCandidate + ::rtl::OUString::createFromAscii( pProfileRegistry ), aRegistryItem );
- if ( result == ::osl::FileBase::E_None )
- {
- ::osl::FileStatus aStatus( osl_FileStatus_Mask_Validate );
- result = aRegistryItem.getFileStatus( aStatus );
- if ( result == ::osl::FileBase::E_None )
- {
- // the registry file exists
- break;
- }
- }
- }
-
- ::osl::FileBase::getSystemPathFromFileURL( sProductDirCandidate, sProductPath );
- }
-
- s_productDirectories[ productIndex ] = sProductPath;
- }
-
- return s_productDirectories[ productIndex ];
- }
-}
-
-// -----------------------------------------------------------------------
-::rtl::OUString getRegistryDir(MozillaProductType product)
-{
- if (product == MozillaProductType_Default)
- return ::rtl::OUString();
-
- return lcl_guessProfileRoot( product );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx
deleted file mode 100644
index a3a52f68e8..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _MNSFOLDERS_HXX_
-#define _MNSFOLDERS_HXX_
-
-#include <sal/types.h>
-#include <osl/diagnose.h>
-#include <osl/conditn.hxx>
-#include <com/sun/star/mozilla/MozillaProductType.hpp>
-
-#include <rtl/ustring.hxx>
-
-::rtl::OUString getRegistryDir(::com::sun::star::mozilla::MozillaProductType product);
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx
deleted file mode 100644
index b334bf6a85..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <MNSINIParser.hxx>
-#include <rtl/byteseq.hxx>
-
-IniParser::IniParser(OUString const & rIniName) throw(com::sun::star::io::IOException )
-{
- OUString iniUrl;
- if (osl_File_E_None != osl_getFileURLFromSystemPath(rIniName.pData, &iniUrl.pData))
- return;
-
-
-#if OSL_DEBUG_LEVEL > 0
- OString sFile = OUStringToOString(iniUrl, RTL_TEXTENCODING_ASCII_US);
- OSL_TRACE(__FILE__" -- parser() - %s\n", sFile.getStr());
-#endif
- oslFileHandle handle=NULL;
- oslFileError fileError = osl_File_E_INVAL;
- try{
- if (iniUrl.getLength())
- fileError = osl_openFile(iniUrl.pData, &handle, osl_File_OpenFlag_Read);
- }
- catch(::com::sun::star::io::IOException&)
- {
-#if OSL_DEBUG_LEVEL > 0
- OString file_tmp = OUStringToOString(iniUrl, RTL_TEXTENCODING_ASCII_US);
- OSL_TRACE( __FILE__" -- couldn't open file: %s", file_tmp.getStr() );
-#endif
- }
-
- if (osl_File_E_None == fileError)
- {
- rtl::ByteSequence seq;
- sal_uInt64 nSize = 0;
-
- osl_getFileSize(handle, &nSize);
- OUString sectionName( RTL_CONSTASCII_USTRINGPARAM( "no name section" ));
- while (true)
- {
- sal_uInt64 nPos;
- if (osl_File_E_None != osl_getFilePos(handle, &nPos) || nPos >= nSize)
- break;
- if (osl_File_E_None != osl_readLine(handle , (sal_Sequence **) &seq))
- break;
- OString line( (const sal_Char *) seq.getConstArray(), seq.getLength() );
- sal_Int32 nIndex = line.indexOf('=');
- if (nIndex >= 1)
- {
- ini_Section *aSection = &mAllSection[sectionName];
- struct ini_NameValue nameValue;
- nameValue.sName = OStringToOUString(
- line.copy(0,nIndex).trim(), RTL_TEXTENCODING_ASCII_US );
- nameValue.sValue = OStringToOUString(
- line.copy(nIndex+1).trim(), RTL_TEXTENCODING_UTF8 );
-
- aSection->lList.push_back(nameValue);
-
- }
- else
- {
- sal_Int32 nIndexStart = line.indexOf('[');
- sal_Int32 nIndexEnd = line.indexOf(']');
- if ( nIndexEnd > nIndexStart && nIndexStart >=0)
- {
- sectionName = OStringToOUString(
- line.copy(nIndexStart + 1,nIndexEnd - nIndexStart -1).trim(), RTL_TEXTENCODING_ASCII_US );
- if (!sectionName.getLength())
- sectionName = OUString(RTL_CONSTASCII_USTRINGPARAM("no name section"));
-
- ini_Section *aSection = &mAllSection[sectionName];
- aSection->sName = sectionName;
- }
- }
- }
- osl_closeFile(handle);
- }
-#if OSL_DEBUG_LEVEL > 0
- else
- {
- OString file_tmp = OUStringToOString(iniUrl, RTL_TEXTENCODING_ASCII_US);
- OSL_TRACE( __FILE__" -- couldn't open file: %s", file_tmp.getStr() );
- }
-#endif
-}
-#if OSL_DEBUG_LEVEL > 0
-void IniParser::Dump()
-{
- IniSectionMap::iterator iBegin = mAllSection.begin();
- IniSectionMap::iterator iEnd = mAllSection.end();
- for(;iBegin != iEnd;iBegin++)
- {
- ini_Section *aSection = &(*iBegin).second;
- OString sec_name_tmp = OUStringToOString(aSection->sName, RTL_TEXTENCODING_ASCII_US);
- for(NameValueList::iterator itor=aSection->lList.begin();
- itor != aSection->lList.end();
- itor++)
- {
- struct ini_NameValue * aValue = &(*itor);
- OString name_tmp = OUStringToOString(aValue->sName, RTL_TEXTENCODING_ASCII_US);
- OString value_tmp = OUStringToOString(aValue->sValue, RTL_TEXTENCODING_UTF8);
- OSL_TRACE(
- " section=%s name=%s value=%s\n",
- sec_name_tmp.getStr(),
- name_tmp.getStr(),
- value_tmp.getStr() );
-
- }
- }
-
-}
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx
deleted file mode 100644
index 6cab8e3193..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef __MNSINIPARSER_HXX__
-#define __MNSINIPARSER_HXX__
-
-#include <rtl/ustring.hxx>
-#include <com/sun/star/io/IOException.hpp>
-#include <osl/process.h>
-
-#include <map>
-#include <list>
-
-#if OSL_DEBUG_LEVEL > 0
-#include <stdio.h>
-#endif
-
-using ::rtl::OUString;
-using ::rtl::OString;
-
-struct ini_NameValue
-{
- rtl::OUString sName;
- rtl::OUString sValue;
-
- inline ini_NameValue() SAL_THROW( () )
- {}
- inline ini_NameValue(
- OUString const & name, OUString const & value ) SAL_THROW( () )
- : sName( name ),
- sValue( value )
- {}
-};
-
-typedef std::list<
- ini_NameValue
-> NameValueList;
-
-struct ini_Section
-{
- rtl::OUString sName;
- NameValueList lList;
-};
-typedef std::map<rtl::OUString,
- ini_Section
- >IniSectionMap;
-
-
-class IniParser
-{
- IniSectionMap mAllSection;
-public:
- IniSectionMap * getAllSection(){return &mAllSection;};
- IniParser(OUString const & rIniName) throw(com::sun::star::io::IOException );
-#if OSL_DEBUG_LEVEL > 0
- void Dump();
-#endif
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx
deleted file mode 100644
index 1cffe198ba..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx
+++ /dev/null
@@ -1,347 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <MNSInclude.hxx>
-
-#include "mozilla_nsinit.h"
-
-#include <MNSInit.hxx>
-
-#include <sal/types.h>
-#include <osl/diagnose.h>
-#include <osl/conditn.hxx>
-#include <osl/file.hxx>
-#include <rtl/bootstrap.hxx>
-
-#include "MConfigAccess.hxx"
-#include "MNSDeclares.hxx"
-#include <osl/thread.hxx>
-#include <MNSTerminateListener.hxx>
-
-static nsIServiceManager* sServiceManager = nsnull;
-static sal_Int32 sInitCounter = 0;
-static sal_Bool s_bProfilePresentAfterInitialized = sal_False;
-
-static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID);
-static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
-
-static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
-static oslThread m_Mozilla_UI_Thread;
-static PRBool aLive=1;
-static ::osl::Condition m_aUI_Thread_Condition;
-
-#define HACK_AROUND_THREADING_ISSUES
-#define HACK_AROUND_NONREENTRANT_INITXPCOM
-
-#ifdef HACK_AROUND_NONREENTRANT_INITXPCOM
-// XXX hack class to clean up XPCOM when this module is unloaded
-static PRBool sXPCOMInitializedFlag = PR_FALSE;
-#endif
-
-
-extern "C" void NS_SetupRegistry();
-
- const PRUnichar* determineProfile( PRUnichar const* const* _pValidProfiles, const PRUint32 _nValidProfiles )
-{
- // the fallback for the to-be-used user profile: the first profile
- const PRUnichar* pUsedProfile = *_pValidProfiles;
-
- // have a look what the configuration suggests as preferred profile
- // PRUnichar != sal_Unicode in mingw
- const PRUnichar* pPreferredProfile = reinterpret_cast_mingw_only< const PRUnichar* >( getUserProfile( ) );
- if ( pPreferredProfile && *pPreferredProfile )
- {
- PRUnichar const* const* pLoop = _pValidProfiles;
- PRUnichar const* const* pLoopEnd = pLoop + _nValidProfiles;
- for ( ; pLoop != pLoopEnd; ++pLoop )
- {
- // compare the current and the preferred profile
- // (by looping through the characters)
- const PRUnichar* pCurrent = *pLoop;
- const PRUnichar* pPref = pPreferredProfile;
- while ( *pCurrent && ( *pCurrent == *pPref ) ) // testing one of them against 0 is enough because of the second clause
- {
- ++pCurrent;
- ++pPref;
- }
- if ( *pCurrent == *pPref )
- // the are equal
- break;
- }
-
- if ( pLoop != pLoopEnd )
- pUsedProfile = *pLoop;
- return pUsedProfile;
- }
- else
- return NULL;
-}
-
-
-sal_Bool MNS_InitXPCOM(sal_Bool* aProfileExists)
-{
- nsresult rv;
- OSL_TRACE( "IN : MNS_InitXPCOM() \n" );
- // Reentrant calls to this method do nothing except increment a counter
-
-#ifdef HACK_AROUND_NONREENTRANT_INITXPCOM
- // The first time, add another increment so that it'll be left until exit
- // for the final cleanup to happen
- sInitCounter++;
-#endif // HACK_AROUND_NONREENTRANT_INITXPCOM
-
- // Initialise XPCOM
-#ifdef HACK_AROUND_NONREENTRANT_INITXPCOM
- // Can't call NS_InitXPCom more than once or things go boom!
- if (!sXPCOMInitializedFlag)
-#endif
- {
- nsCOMPtr<nsILocalFile> binDir;
- // Note: if path3 construction fails, mozilla will default to using MOZILLA_FIVE_HOME in the NS_InitXPCOM2()
- rtl::OUString path1(
-#if defined WNT
- RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/program")
-#else
- RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/program")
-#endif
- );
- rtl::Bootstrap::expandMacros(path1);
- rtl::OString path2;
- if ((osl::FileBase::getSystemPathFromFileURL(path1, path1) ==
- osl::FileBase::E_None) &&
- path1.convertToString(
- &path2, osl_getThreadTextEncoding(),
- (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
- RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
- {
- nsDependentCString sPath(path2.getStr());
- rv = NS_NewNativeLocalFile(sPath, PR_TRUE, getter_AddRefs(binDir));
- if (NS_FAILED(rv))
- return sal_False;
- }
-
-
-
- // Initialise XPCOM
- NS_InitXPCOM2(&sServiceManager, binDir, NULL);
-
-// if (!sServiceManager)
-// return sal_False;
-
-#ifdef HACK_AROUND_NONREENTRANT_INITXPCOM
- sXPCOMInitializedFlag = PR_TRUE;
-#endif
- }
-
-
- // Create the Event Queue for the UI thread...
- //
- // If an event queue already exists for the thread, then
- // CreateThreadEventQueue(...) will fail...
- // CreateThread0ueue(...) will fail...
- nsCOMPtr<nsIEventQueueService> eventQService(
- do_GetService(NS_EVENTQUEUESERVICE_CONTRACTID, &rv));
- if (NS_FAILED(rv))
- return NS_SUCCEEDED( rv ) ? sal_True : sal_False;
-
- eventQService->CreateThreadEventQueue();
-
-// nsCOMPtr<nsIObserver> mStartupNotifier = do_CreateInstance(NS_APPSTARTUPNOTIFIER_CONTRACTID, &rv);
-// if(NS_FAILED(rv))
-// return rv;
-// mStartupNotifier->Observe(nsnull, APPSTARTUP_TOPIC, nsnull);
-
-#ifdef HACK_AROUND_THREADING_ISSUES
- // XXX force certain objects to be created on the main thread
- nsCOMPtr<nsIStringBundleService> sBundleService;
- sBundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
- if (NS_SUCCEEDED(rv))
- {
- nsCOMPtr<nsIStringBundle> stringBundle;
- const char* propertyURL = "chrome://necko/locale/necko.properties";
- rv = sBundleService->CreateBundle(propertyURL,
- getter_AddRefs(stringBundle));
- }
-#endif
-
- // Need to create a Pref Service
- nsCOMPtr< nsIPref > thePref = do_GetService( kPrefCID, &rv );
- if (NS_SUCCEEDED(rv) )
- {
- OSL_TRACE("Created an nsIPref i/f\n");
- thePref->ReadUserPrefs( nsnull );
- *aProfileExists = sal_True ;
- s_bProfilePresentAfterInitialized = sal_True;
- }
- OSL_TRACE( "OUT : MNS_InitXPCOM() - XPCOM Init\n" );
-
- return sal_True;
-}
-
-void MNS_XPCOM_EventLoop()
-{
- OSL_TRACE( "IN : MNS_XPCOM_EventLoop() \n" );
- nsresult rv;
- nsCOMPtr<nsIEventQueue> eventQ;
- nsCOMPtr<nsIEventQueueService> eventQService;
- rv=nsServiceManager::GetService(kEventQueueServiceCID,
- NS_GET_IID(nsIEventQueueService),
- getter_AddRefs(eventQService));
-
- if (NS_SUCCEEDED(rv))
- {
- rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD , getter_AddRefs(eventQ));
- if (NS_FAILED(rv))
- {
- rv = eventQService->CreateThreadEventQueue();
- if (NS_FAILED(rv))
- return ;
- else
- rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(eventQ));
- }
- }
-
- if (NS_FAILED(rv)) return ;
-
- PLEvent* event = nsnull;
- m_aUI_Thread_Condition.set(); //we are ready to recive event
- do
- {
- rv = eventQ->GetEvent(&event);
- if (NS_FAILED(rv))
- return ;
- if (event)
- eventQ->HandleEvent(event);
- }while ( PR_SUCCESS == PR_Sleep( PR_MillisecondsToInterval(1)) && aLive );
-
- eventQ->ProcessPendingEvents();
- OSL_TRACE( "OUT : MNS_XPCOM_EventLoop() \n" );
-}
-
-extern "C" void MNS_Mozilla_UI_Thread( void *arg )
-{
- aLive=1;
- OSL_TRACE( "IN : MNS_Mozilla_UI_Thread() \n" );
- UI_Thread_ARGS * args = (UI_Thread_ARGS*) arg;
- sal_Bool* aProfileExists=args->bProfileExists;
- delete args;
- args=NULL;
-
- //Init xpcom
- if (!MNS_InitXPCOM(aProfileExists))
- {
- m_aUI_Thread_Condition.set(); // error happened
- return;
- }
-
- //do the mozilla event loop
- MNS_XPCOM_EventLoop();
- //we are interupted
-
- if (sServiceManager)
- {
- NS_RELEASE(sServiceManager);
-
- // Terminate XPCOM & cleanup
-#ifndef HACK_AROUND_NONREENTRANT_INITXPCOM
- NS_ShutdownXPCOM(sServiceManager);
-#endif
- }
-
- m_aUI_Thread_Condition.set(); //release all blocks
-
- OSL_TRACE( "OUT : MNS_Mozilla_UI_Thread() \n" );
-
-}
-
-
-sal_Bool MNS_Init(sal_Bool& aProfileExists)
-{
- aProfileExists = sal_False ;
-
- OSL_TRACE( "IN : MNS_Init() \n" );
- // Reentrant calls to this method do nothing except increment a counter
- sInitCounter++;
- if (sInitCounter > 1) {
- OSL_TRACE( "IN : MNS_Init() wait for xpcom to be initted \n" );
- //wait for xpcom to be initted
- m_aUI_Thread_Condition.wait();
-
- OSL_TRACE( "OUT : MNS_Init() : counter = %d\n", sInitCounter );
- aProfileExists = s_bProfilePresentAfterInitialized;
- return sal_True;
- }
-
- UI_Thread_ARGS * args = new UI_Thread_ARGS;
- args->bProfileExists = &aProfileExists;
-
- m_aUI_Thread_Condition.reset();
- m_Mozilla_UI_Thread=osl_createThread(MNS_Mozilla_UI_Thread,
- (void*)args);
- if (!m_Mozilla_UI_Thread)
- {
- return sal_False;
- }
-
- //wait for xpcom to be initted
- m_aUI_Thread_Condition.wait();
-
- //Add Terminate Listener to XDesktop to get application exit event
- MNSTerminateListener::addTerminateListener();
-
- OSL_TRACE( "OUT : MNS_Init() - First Init\n" );
-
- return sal_True;
-}
-
-sal_Bool MNS_Term(sal_Bool aForce)
-{
- // Reentrant calls to this method do nothing except decrement a counter
- OSL_TRACE( "IN : MNS_Term() \n" );
- if (!aForce && sInitCounter > 1)
- {
- --sInitCounter;
- OSL_TRACE( "OUT : MNS_Term() : counter = %d\n", sInitCounter );
- return sal_True;
- }
- sInitCounter = 0;
-
- aLive=0;
-
- //wait for xpcom to be finished
- TimeValue timeValue = { 1, 0 };
- m_aUI_Thread_Condition.wait(&timeValue);
-
-
- OSL_TRACE( "OUT : MNS_Term() - Final Term\n" );
- return sal_True;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSInit.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSInit.hxx
deleted file mode 100644
index bfc141cc58..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSInit.hxx
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MAB_NS_INIT_HXX_
-#define _CONNECTIVITY_MAB_NS_INIT_HXX_ 1
-#include "MNSDeclares.hxx"
-
-#include <sal/types.h>
-
-sal_Bool MNS_Init(sal_Bool& aProfileExists);
-sal_Bool MNS_Term(sal_Bool aForce=sal_False);
-
-sal_Bool MNS_InitXPCOM(sal_Bool* aProfileExists);
-typedef struct UI_Thread_ARGS
-{
- sal_Bool* bProfileExists;
-}UI_Thread_ARGS;
-void MNS_XPCOM_EventLoop();
-
-#endif // _CONNECTIVITY_MAB_NS_INIT_HXX_ 1
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx
deleted file mode 100644
index a711b42230..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx
+++ /dev/null
@@ -1,635 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MNSProfile.hxx"
-#include "MNSProfileDirServiceProvider.hxx"
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <unotools/processfactory.hxx>
-#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::mozilla;
-
-using ::rtl::OUString;
-
-// Interfaces Needed
-
-static Reference<XMozillaBootstrap> xMozillaBootstrap;
-
-
-static PRInt32 gInstanceCount = 0;
-
-// Profile database to remember which profile has been
-// created with UILocale and contentLocale on profileManager
-static nsProfileDirServiceProvider *gDirServiceProvider = nsnull;
-
-
-
-
-/*
- * Constructor/Destructor
- */
-nsProfile::nsProfile()
-{
- mStartingUp = PR_FALSE;
- mCurrentProfileAvailable = PR_FALSE;
-
- mShutdownProfileToreDownNetwork = PR_FALSE;
-
- mProfileChangeVetoed = PR_FALSE;
- mProfileChangeFailed = PR_FALSE;
- Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory();
- OSL_ENSURE( xFactory.is(), "can't get service factory" );
-
- Reference<XInterface> xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
- xMozillaBootstrap = Reference<XMozillaBootstrap>(xInstance,UNO_QUERY);
-
-
-}
-
-nsProfile::~nsProfile()
-{
-}
-
-
-nsresult
-nsProfile::Init()
-{
- nsresult rv = NS_OK;
- RegisterProfileManager(this);
- if (gInstanceCount++ == 0) {
- rv = NS_NewProfileDirServiceProvider( &gDirServiceProvider);
- if (NS_SUCCEEDED(rv))
- rv = gDirServiceProvider->Register();
- }
- return rv;
-}
-
-/*
- * nsISupports Implementation
- */
-NS_IMPL_THREADSAFE_ADDREF(nsProfile)
-NS_IMPL_THREADSAFE_RELEASE(nsProfile)
-
-NS_INTERFACE_MAP_BEGIN(nsProfile)
- NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIProfile)
- NS_INTERFACE_MAP_ENTRY(nsIProfile)
- NS_INTERFACE_MAP_ENTRY(nsIProfileInternal)
- NS_INTERFACE_MAP_ENTRY(nsIProfileChangeStatus)
- NS_INTERFACE_MAP_ENTRY(nsIFactory)
-NS_INTERFACE_MAP_END
-
-/*
- * nsIProfileChangeStatus Implementation
- */
-
-NS_IMETHODIMP nsProfile::VetoChange()
-{
- mProfileChangeVetoed = PR_TRUE;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsProfile::ChangeFailed()
-{
- mProfileChangeFailed = PR_TRUE;
- return NS_OK;
-}
-/*
- * nsIProfile Implementation
- */
-
-NS_IMETHODIMP nsProfile::GetProfileCount(PRInt32 *numProfiles)
-{
- NS_ENSURE_ARG_POINTER(numProfiles);
-
- *numProfiles = 0;
-
- *numProfiles = xMozillaBootstrap->getProfileCount(xMozillaBootstrap->getCurrentProduct());
- return NS_OK;
-}
-NS_IMETHODIMP nsProfile::GetProfileList(PRUint32 *length, PRUnichar ***profileNames)
-{
- NS_ENSURE_ARG_POINTER(length);
- NS_ENSURE_ARG_POINTER(profileNames);
- *profileNames = nsnull;
-
- ::com::sun::star::uno::Sequence< ::rtl::OUString > list;
-
- *length = xMozillaBootstrap->getProfileList(xMozillaBootstrap->getCurrentProduct(),list);
-
- const OUString * pArray = list.getConstArray();
-
- nsresult rv = NS_OK;
- PRInt32 count = list.getLength();
- PRUnichar **outArray, **next;
-
- next = outArray = (PRUnichar **)nsMemory::Alloc(count * sizeof(PRUnichar *));
- if (!outArray)
- return NS_ERROR_OUT_OF_MEMORY;
-
- for (PRInt32 index=0; index < count; index++)
- {
- *next = (PRUnichar *)nsMemory::Clone(pArray[index].getStr(),(pArray[index].getLength()+1) * sizeof(PRUnichar ));
- if (*next == nsnull)
- {
- rv = NS_ERROR_OUT_OF_MEMORY;
- break;
- }
- next++;
- }
- *profileNames = outArray;
- return rv;
-}
-NS_IMETHODIMP nsProfile::ProfileExists(const PRUnichar *profileName, PRBool *exists)
-{
- NS_ENSURE_ARG_POINTER(profileName);
- NS_ENSURE_ARG_POINTER(exists);
-
- // PRUnichar != sal_Unicode in mingw
- *exists = xMozillaBootstrap->getProfileExists(xMozillaBootstrap->getCurrentProduct(),reinterpret_cast_mingw_only<const sal_Unicode *>(profileName));
- return NS_OK;
-}
-// Returns the name of the current profile i.e., the last used profile
-NS_IMETHODIMP
-nsProfile::GetCurrentProfile(PRUnichar **profileName)
-{
- NS_ENSURE_ARG_POINTER(profileName);
- *profileName = nsnull;
-
- if (mCurrentProfileName.Length())
- *profileName = (PRUnichar *)nsMemory::Clone(mCurrentProfileName.get(),(mCurrentProfileName.Length() + 1) * sizeof(PRUnichar ));
- else
- {
- rtl::OUString profile = xMozillaBootstrap->getDefaultProfile(xMozillaBootstrap->getCurrentProduct());
- *profileName = (PRUnichar *)nsMemory::Clone(profile.getStr(),( profile.getLength() + 1) * sizeof(PRUnichar ));
- SetCurrentProfile(*profileName);
- }
-
- return (*profileName == nsnull) ? NS_ERROR_FAILURE : NS_OK;
-}
-
-NS_IMETHODIMP
-nsProfile::SetCurrentProfile(const PRUnichar * aCurrentProfile)
-{
- NS_ENSURE_ARG(aCurrentProfile);
-
- nsresult rv;
- nsCOMPtr<nsIFile> profileDir;
- PRBool exists;
-
- // Ensure that the profile exists and its directory too.
- rv = GetProfileDir(aCurrentProfile, getter_AddRefs(profileDir));
- if (NS_FAILED(rv)) return rv;
- rv = profileDir->Exists(&exists);
- if (NS_FAILED(rv)) return rv;
- if (!exists) return NS_ERROR_FILE_NOT_FOUND;
-
- PRBool isSwitch = PRBool();
-
- if (mCurrentProfileAvailable)
- {
- nsXPIDLString currProfileName;
- rv = GetCurrentProfile(getter_Copies(currProfileName));
- if (NS_FAILED(rv)) return rv;
- if (nsCRT::strcmp(aCurrentProfile, currProfileName.get()) == 0)
- return NS_OK;
- else
- isSwitch = PR_TRUE;
- }
- else
- isSwitch = PR_FALSE;
-
-
- nsCOMPtr<nsIObserverService> observerService =
- do_GetService("@mozilla.org/observer-service;1", &rv);
- NS_ENSURE_TRUE(observerService, NS_ERROR_FAILURE);
-
- nsISupports *subject = (nsISupports *)((nsIProfile *)this);
- NS_NAMED_LITERAL_STRING(switchString, "switch");
- NS_NAMED_LITERAL_STRING(startupString, "startup");
- const nsAFlatString& context = isSwitch ? switchString : startupString;
-
- if (isSwitch)
- {
- rv = ShutDownCurrentProfile(nsIProfile::SHUTDOWN_PERSIST);
- if (NS_FAILED(rv)) return NS_ERROR_ABORT;
-
- // Phase 1: See if anybody objects to the profile being changed.
- mProfileChangeVetoed = PR_FALSE;
- observerService->NotifyObservers(subject, "profile-approve-change", context.get());
- if (mProfileChangeVetoed)
- return NS_OK;
-
- // Phase 2a: Send the network teardown notification
- observerService->NotifyObservers(subject, "profile-change-net-teardown", context.get());
- mShutdownProfileToreDownNetwork = PR_TRUE;
-
- // Phase 2b: Send the "teardown" notification
- observerService->NotifyObservers(subject, "profile-change-teardown", context.get());
- if (mProfileChangeVetoed)
- {
- // Notify we will not proceed with changing the profile
- observerService->NotifyObservers(subject, "profile-change-teardown-veto", context.get());
-
- // Bring network back online and return
- observerService->NotifyObservers(subject, "profile-change-net-restore", context.get());
- return NS_OK;
- }
-
- // Phase 3: Notify observers of a profile change
- observerService->NotifyObservers(subject, "profile-before-change", context.get());
- if (mProfileChangeFailed)
- return NS_ERROR_ABORT;
-
- }
-
-//
-// // Do the profile switch
- gDirServiceProvider->SetProfileDir(profileDir);
- mCurrentProfileName.Assign(aCurrentProfile);
-// gProfileDataAccess->SetCurrentProfile(aCurrentProfile);
-
- if (NS_FAILED(rv)) return rv;
- mCurrentProfileAvailable = PR_TRUE;
-
- if (!isSwitch)
- {
- // Ensure that the prefs service exists so it can respond to
- // the notifications we're about to send around. It needs to.
- nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
- NS_ASSERTION(NS_SUCCEEDED(rv), "Could not get prefs service");
- }
-
- if (mShutdownProfileToreDownNetwork)
- {
- // Bring network back online
- observerService->NotifyObservers(subject, "profile-change-net-restore", context.get());
- mShutdownProfileToreDownNetwork = PR_FALSE;
- if (mProfileChangeFailed)
- return NS_ERROR_ABORT;
- }
-
- // Phase 4: Notify observers that the profile has changed - Here they respond to new profile
- observerService->NotifyObservers(subject, "profile-do-change", context.get());
- if (mProfileChangeFailed)
- return NS_ERROR_ABORT;
-
- // Phase 5: Now observers can respond to something another observer did in phase 4
- observerService->NotifyObservers(subject, "profile-after-change", context.get());
- if (mProfileChangeFailed)
- return NS_ERROR_ABORT;
-
- // Phase 6: One last notification after the new profile is established
- observerService->NotifyObservers(subject, "profile-initial-state", context.get());
- if (mProfileChangeFailed)
- return NS_ERROR_ABORT;
-
- return NS_OK;
-}
-/* void shutDownCurrentProfile (in unsigned long shutDownType); */
-NS_IMETHODIMP nsProfile::ShutDownCurrentProfile(PRUint32 shutDownType)
-{
- nsresult rv;
-
- // if shutDownType is not a well know value, skip the notifications
- // see DoOnShutdown() in nsAppRunner.cpp for where we use this behaviour to our benefit
- if (shutDownType == (PRUint32)SHUTDOWN_PERSIST || shutDownType == (PRUint32)SHUTDOWN_CLEANSE ) {
- nsCOMPtr<nsIObserverService> observerService =
- do_GetService("@mozilla.org/observer-service;1", &rv);
- NS_ENSURE_TRUE(observerService, NS_ERROR_FAILURE);
-
- nsISupports *subject = (nsISupports *)((nsIProfile *)this);
-
- NS_NAMED_LITERAL_STRING(cleanseString, "shutdown-cleanse");
- NS_NAMED_LITERAL_STRING(persistString, "shutdown-persist");
- const nsAFlatString& context = (shutDownType == (PRUint32)SHUTDOWN_CLEANSE) ? cleanseString : persistString;
-
- // Phase 1: See if anybody objects to the profile being changed.
- mProfileChangeVetoed = PR_FALSE;
- observerService->NotifyObservers(subject, "profile-approve-change", context.get());
- if (mProfileChangeVetoed)
- return NS_OK;
-
- // Phase 2a: Send the network teardown notification
- observerService->NotifyObservers(subject, "profile-change-net-teardown", context.get());
- mShutdownProfileToreDownNetwork = PR_TRUE;
-
- // Phase 2b: Send the "teardown" notification
- observerService->NotifyObservers(subject, "profile-change-teardown", context.get());
-
-
- // Phase 3: Notify observers of a profile change
- observerService->NotifyObservers(subject, "profile-before-change", context.get());
- }
-
-
- gDirServiceProvider->SetProfileDir(nsnull);
- mCurrentProfileAvailable = PR_FALSE;
- mCurrentProfileName.Truncate(0);
-
- return NS_OK;
-}
-/* void createNewProfile (in wstring profileName, in wstring nativeProfileDir, in wstring langcode, in boolean useExistingDir); */
-NS_IMETHODIMP nsProfile::CreateNewProfile(const PRUnichar* /*profileName*/, const PRUnichar* /*nativeProfileDir*/, const PRUnichar* /*langcode*/, PRBool /*useExistingDir*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void renameProfile (in wstring oldName, in wstring newName); */
-NS_IMETHODIMP nsProfile::RenameProfile(const PRUnichar* /*oldName*/, const PRUnichar* /*newName*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void deleteProfile (in wstring name, in boolean canDeleteFiles); */
-NS_IMETHODIMP nsProfile::DeleteProfile(const PRUnichar* /*name*/, PRBool /*canDeleteFiles*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void cloneProfile (in wstring profileName); */
-NS_IMETHODIMP nsProfile::CloneProfile(const PRUnichar* /*profileName*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-//nsIProfileInternal Implementation
-
-/* [noscript] void startupWithArgs (in nsICmdLineService cmdLine, in boolean canInteract); */
-class nsICmdLineService;
-
-NS_IMETHODIMP nsProfile::StartupWithArgs(nsICmdLineService* /*cmdLineArgs*/, PRBool /*canInteract*/)
-{
- Init();
- return NS_OK;
-}
-
-/* [noscript] readonly attribute boolean isStartingUp; */
-NS_IMETHODIMP nsProfile::GetIsStartingUp(PRBool *aIsStartingUp)
-{
- NS_ENSURE_ARG_POINTER(aIsStartingUp);
- *aIsStartingUp = mStartingUp;
- return NS_OK;
-}
-
-/* long get4xProfileCount (); */
-NS_IMETHODIMP nsProfile::Get4xProfileCount(PRInt32* /*_retval*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void getProfileListX (in unsigned long which, out unsigned long length, [array, size_is (length), retval] out wstring profileNames); */
-NS_IMETHODIMP nsProfile::GetProfileListX(PRUint32 /*whichKind*/, PRUint32* /*length*/, PRUnichar*** /*profileNames*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void migrateProfileInfo (); */
-NS_IMETHODIMP nsProfile::MigrateProfileInfo()
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void migrateAllProfiles (); */
-NS_IMETHODIMP nsProfile::MigrateAllProfiles()
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void migrateProfile (in wstring profileName); */
-NS_IMETHODIMP nsProfile::MigrateProfile(const PRUnichar* /*profileName*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void remigrateProfile (in wstring profileName); */
-NS_IMETHODIMP nsProfile::RemigrateProfile(const PRUnichar* /*profileName*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void forgetCurrentProfile (); */
-NS_IMETHODIMP nsProfile::ForgetCurrentProfile()
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void createDefaultProfile (); */
-NS_IMETHODIMP nsProfile::CreateDefaultProfile()
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* nsIFile getProfileDir (in wstring profileName); */
-// Gets the profiles directory for a given profile
-// Sets the given profile to be a current profile
-NS_IMETHODIMP nsProfile::GetProfileDir(const PRUnichar *profileName, nsIFile **profileDir)
-{
- NS_ENSURE_ARG(profileName);
- NS_ENSURE_ARG_POINTER(profileDir);
- *profileDir = nsnull;
-
- nsresult rv = NS_OK;
-
- // PRUnichar != sal_Unicode in mingw
- rtl::OUString path = xMozillaBootstrap->getProfilePath(xMozillaBootstrap->getCurrentProduct(),reinterpret_cast_mingw_only<const sal_Unicode *>(profileName));
-
- nsCOMPtr<nsILocalFile> localFile;
- // PRUnichar != sal_Unicode in mingw
- nsAutoString filePath(reinterpret_cast_mingw_only<const PRUnichar *>(path.getStr()));
-
- rv = NS_NewLocalFile(filePath, PR_TRUE,
- getter_AddRefs(localFile));
- if (localFile && NS_SUCCEEDED(rv))
- return localFile->QueryInterface(NS_GET_IID(nsIFile), (void**)profileDir);
- return rv;
-}
-
-/* wstring getProfilePath (in wstring profileName); */
-NS_IMETHODIMP nsProfile::GetProfilePath(const PRUnichar* /*profileName*/, PRUnichar** /*_retval*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* nsILocalFile getOriginalProfileDir (in wstring profileName); */
-NS_IMETHODIMP nsProfile::GetOriginalProfileDir(const PRUnichar* /*profileName*/, nsILocalFile** /*originalDir*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRInt64 getProfileLastModTime (in wstring profileName); */
-NS_IMETHODIMP nsProfile::GetProfileLastModTime(const PRUnichar* /*profileName*/, PRInt64* /*_retval*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* attribute boolean automigrate; */
-NS_IMETHODIMP nsProfile::GetAutomigrate(PRBool* /*aAutomigrate*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-NS_IMETHODIMP nsProfile::SetAutomigrate(PRBool /*aAutomigrate*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* readonly attribute nsIFile defaultProfileParentDir; */
-NS_IMETHODIMP nsProfile::GetDefaultProfileParentDir(nsIFile** /*aDefaultProfileParentDir*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* readonly attribute wstring firstProfile; */
-NS_IMETHODIMP nsProfile::GetFirstProfile(PRUnichar **profileName)
-{
- NS_ENSURE_ARG_POINTER(profileName);
-
- return GetCurrentProfile(profileName);
-}
-
-/* attribute boolean startWithLastUsedProfile; */
-NS_IMETHODIMP nsProfile::GetStartWithLastUsedProfile(PRBool* /*aStartWithLastUsedProfile*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-NS_IMETHODIMP nsProfile::SetStartWithLastUsedProfile(PRBool /*aStartWithLastUsedProfile*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* [noscript] void updateRegistry (in nsIFile regName); */
-NS_IMETHODIMP nsProfile::UpdateRegistry(nsIFile* /*regName*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* [noscript] void getRegStrings (in wstring profileName, out wstring regString, out wstring regName, out wstring regEmail, out wstring regOption); */
-NS_IMETHODIMP nsProfile::GetRegStrings(const PRUnichar* /*profileName*/, PRUnichar** /*regString*/, PRUnichar** /*regName*/, PRUnichar** /*regEmail*/, PRUnichar** /*regOption*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* [noscript] void setRegStrings (in wstring profileName, in wstring regString, in wstring regName, in wstring regEmail, in wstring regOption); */
-NS_IMETHODIMP nsProfile::SetRegStrings(const PRUnichar* /*profileName*/, const PRUnichar* /*regString*/, const PRUnichar* /*regName*/, const PRUnichar* /*regEmail*/, const PRUnichar* /*regOption*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* [noscript] string isRegStringSet (in wstring profileName); */
-NS_IMETHODIMP nsProfile::IsRegStringSet(const PRUnichar* /*profileName*/, char** /*_retval*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void createNewProfileWithLocales (in wstring profileName, in wstring nativeProfileDir, in wstring UILocale, in wstring contentLocale, in boolean useExistingDir); */
-NS_IMETHODIMP nsProfile::CreateNewProfileWithLocales(const PRUnichar* /*profileName*/, const PRUnichar* /*nativeProfileDir*/, const PRUnichar* /*UILocale*/, const PRUnichar* /*contentLocale*/, PRBool /*useExistingDir*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* boolean isCurrentProfileAvailable (); */
-NS_IMETHODIMP nsProfile::IsCurrentProfileAvailable(PRBool *available)
-{
- NS_ENSURE_ARG_POINTER(available);
-
- *available = mCurrentProfileAvailable;
- return NS_OK;
-}
-
-/* [noscript] void getCurrentProfileDir (out nsIFile profileDir); */
-// Returns the name of the current profile directory
-NS_IMETHODIMP nsProfile::GetCurrentProfileDir(nsIFile **profileDir)
-{
- NS_ENSURE_ARG_POINTER(profileDir);
- nsresult rv;
-
- nsXPIDLString profileName;
- rv = GetCurrentProfile(getter_Copies(profileName));
- if (NS_FAILED(rv)) return rv;
-
- rv = GetProfileDir(profileName, profileDir);
- if (NS_FAILED(rv)) return rv;
-
- return NS_OK;
-}
-
-//Implementation nsIFactory
-NS_IMETHODIMP
-nsProfile::LockFactory(PRBool /*aVal*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsProfile::CreateInstance(nsISupports* aOuter, const nsID& aIID,
- void** aResult)
-{
- if (aOuter)
- return NS_ERROR_NO_AGGREGATION;
- // return this object
- return QueryInterface(aIID, aResult);
-}
-
-//Register profile manager
-#include "nsIComponentManager.h"
-#include "nsIComponentRegistrar.h"
-
-static const nsCID kProfileManagerCID = NS_PROFILE_CID;
-
-#define NS_PROFILE_CONTRACTID \
- "@mozilla.org/profile/manager;1"
-
-nsresult
-nsProfile::RegisterProfileManager(nsIProfile* aProfileService)
-{
- nsCOMPtr<nsIServiceManager> mgr;
- NS_GetServiceManager(getter_AddRefs(mgr));
-
- NS_ASSERTION(mgr, "Not initialized!");
-
- nsCOMPtr<nsIFactory> factory = do_QueryInterface(aProfileService);
- NS_ASSERTION(factory, "Supposed to be an nsIFactory!");
-
- nsCOMPtr<nsIComponentRegistrar> reg (do_QueryInterface(mgr));
- if (!reg)
- return NS_ERROR_NO_INTERFACE;
-
- return reg->RegisterFactory(kProfileManagerCID,
- "Profile Manager",
- NS_PROFILE_CONTRACTID,
- factory);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfile.hxx
deleted file mode 100644
index 37939c4acc..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.hxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "mozilla_nsprofile.h"
-
-#define _MAX_LENGTH 256
-
-class nsProfile: public nsIProfileInternal,
- public nsIProfileChangeStatus,
- public nsIFactory
-{
- NS_DECL_ISUPPORTS
- NS_DECL_NSIPROFILE
- NS_DECL_NSIPROFILEINTERNAL
- NS_DECL_NSIPROFILECHANGESTATUS
- NS_DECL_NSIFACTORY
-
-private:
- PRBool mStartingUp;
- PRBool mProfileChangeVetoed;
- PRBool mProfileChangeFailed;
-
- nsString mCurrentProfileName;
- PRBool mCurrentProfileAvailable;
-
- PRBool mIsContentLocaleSpecified;
- nsCString mContentLocaleName;
-
- PRBool mShutdownProfileToreDownNetwork;
- nsresult Init();
-
-public:
- nsProfile();
- virtual ~nsProfile();
-
-public:
- //We register an factory for Mozilla profile service its CID and CONTRACTID are NS_PROFILE_CID and NS_PROFILE_CONTRACTID
- //After that, we does not need profile.dll/libprofile.so any more. Our profile service are diffrent from the orginal one in
- //these areas:
- //1. We do not lock Mozilla Profile,
- //2. We do not change Mozilla Profile settings. We do not change default profile, do not create new profiles and
- // do not write changes back to profile register
- //3. We support can load both Thunderbird profile and Mozilla profiles
- static nsresult RegisterProfileManager(nsIProfile* aProfileService);
-
-};
-
-extern nsresult ConvertStringToUnicode(nsCString& aCharset, const char* inString, nsAString& outString);
-extern nsresult GetPlatformCharset(nsCString& aCharset);
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.cxx
deleted file mode 100644
index ef6a88917b..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.cxx
+++ /dev/null
@@ -1,243 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#if defined _MSC_VER
- #pragma warning(disable:4710)
-#endif
-
-#include "pre_include_mozilla.h"
-#include "MNSProfileDirServiceProvider.hxx"
-#include "nsIAtom.h"
-#include "nsStaticAtom.h"
-#include "nsILocalFile.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsAppDirectoryServiceDefs.h"
-#include "nsISupportsUtils.h"
-#include "post_include_mozilla.h"
-
-
-
-#define PREFS_FILE_50_NAME NS_LITERAL_CSTRING("prefs.js")
-
-
-nsIAtom* nsProfileDirServiceProvider::sApp_PrefsDirectory50;
-nsIAtom* nsProfileDirServiceProvider::sApp_PreferencesFile50;
-nsIAtom* nsProfileDirServiceProvider::sApp_UserProfileDirectory50;
-
-
-//*****************************************************************************
-// nsProfileDirServiceProvider::nsProfileDirServiceProvider
-//*****************************************************************************
-
-nsProfileDirServiceProvider::nsProfileDirServiceProvider()
-{
-}
-
-
-nsProfileDirServiceProvider::~nsProfileDirServiceProvider()
-{
-}
-
-nsresult
-nsProfileDirServiceProvider::SetProfileDir(nsIFile* aProfileDir)
-{
- if (mProfileDir) {
- PRBool isEqual;
- if (aProfileDir &&
- NS_SUCCEEDED(aProfileDir->Equals(mProfileDir, &isEqual)) && isEqual) {
- NS_WARNING("Setting profile dir to same as current");
- return NS_OK;
- }
- UndefineFileLocations();
- }
- mProfileDir = aProfileDir;
- if (!mProfileDir)
- return NS_OK;
-
- nsresult rv = EnsureProfileFileExists(mProfileDir);
- return rv;
-
-}
-
-nsresult
-nsProfileDirServiceProvider::Register()
-{
- nsCOMPtr<nsIDirectoryService> directoryService =
- do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
- if (!directoryService)
- return NS_ERROR_FAILURE;
- return directoryService->RegisterProvider(this);
-}
-
-nsresult
-nsProfileDirServiceProvider::Shutdown()
-{
- nsCOMPtr<nsIDirectoryService> directoryService =
- do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
- if (!directoryService)
- return NS_ERROR_FAILURE;
- return directoryService->UnregisterProvider(this);
-}
-
-// nsProfileDirServiceProvider::nsISupports
-
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsProfileDirServiceProvider,
- nsIDirectoryServiceProvider)
-
-// nsProfileDirServiceProvider::nsIDirectoryServiceProvider
-
-NS_IMETHODIMP
-nsProfileDirServiceProvider::GetFile(const char *prop, PRBool *persistant, nsIFile **_retval)
-{
- NS_ENSURE_ARG(prop);
- NS_ENSURE_ARG_POINTER(persistant);
- NS_ENSURE_ARG_POINTER(_retval);
-
- if (!mProfileDir)
- return NS_ERROR_FAILURE;
-
- *persistant = PR_TRUE;
- nsIFile* domainDir = mProfileDir;
-
-
- nsCOMPtr<nsIFile> localFile;
- nsresult rv = NS_ERROR_FAILURE;
-
- nsIAtom* inAtom = NS_NewAtom(prop);
- NS_ENSURE_TRUE(inAtom, NS_ERROR_OUT_OF_MEMORY);
-
- if (inAtom == sApp_PrefsDirectory50) {
- rv = domainDir->Clone(getter_AddRefs(localFile));
- }
- else if (inAtom == sApp_PreferencesFile50) {
- rv = domainDir->Clone(getter_AddRefs(localFile));
- if (NS_SUCCEEDED(rv))
- rv = localFile->AppendNative(PREFS_FILE_50_NAME);
- }
- else if (inAtom == sApp_UserProfileDirectory50) {
- rv = domainDir->Clone(getter_AddRefs(localFile));
- }
-
- NS_RELEASE(inAtom);
-
- if (localFile && NS_SUCCEEDED(rv))
- return CallQueryInterface(localFile, _retval);
-
- return rv;
-}
-
-//*****************************************************************************
-// Protected methods
-//*****************************************************************************
-
-nsresult
-nsProfileDirServiceProvider::Initialize()
-{
-
- static const nsStaticAtom provider_atoms[] = {
- { NS_APP_PREFS_50_DIR, &sApp_PrefsDirectory50 },
- { NS_APP_PREFS_50_FILE, &sApp_PreferencesFile50 },
- { NS_APP_USER_PROFILE_50_DIR, &sApp_UserProfileDirectory50 },
- { NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR, nsnull },
- };
-
- // Register our directory atoms
- NS_RegisterStaticAtoms(provider_atoms, NS_ARRAY_LENGTH(provider_atoms));
-
- return NS_OK;
-}
-
-nsresult
-nsProfileDirServiceProvider::EnsureProfileFileExists(nsIFile *aFile)
-{
- nsresult rv;
- PRBool exists;
-
- rv = aFile->Exists(&exists);
- if (NS_FAILED(rv))
- return rv;
- if (exists)
- return NS_OK;
-
- nsCOMPtr<nsIFile> defaultsFile;
-
- // Attempt first to get the localized subdir of the defaults
- rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DEFAULTS_50_DIR, getter_AddRefs(defaultsFile));
- if (NS_FAILED(rv)) {
- // If that has not been defined, use the top level of the defaults
- rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR, getter_AddRefs(defaultsFile));
- if (NS_FAILED(rv))
- return rv;
- }
-
- mProfileDir = defaultsFile;
- return rv;
-}
-
-
-nsresult
-nsProfileDirServiceProvider::UndefineFileLocations()
-{
- nsresult rv;
-
- nsCOMPtr<nsIProperties> directoryService =
- do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
- NS_ENSURE_TRUE(directoryService, NS_ERROR_FAILURE);
-
- (void) directoryService->Undefine(NS_APP_PREFS_50_DIR);
- (void) directoryService->Undefine(NS_APP_PREFS_50_FILE);
- (void) directoryService->Undefine(NS_APP_USER_PROFILE_50_DIR);
-
- return NS_OK;
-}
-
-//*****************************************************************************
-// Global creation function
-//*****************************************************************************
-
-nsresult NS_NewProfileDirServiceProvider(nsProfileDirServiceProvider** aProvider)
-{
- NS_ENSURE_ARG_POINTER(aProvider);
- *aProvider = nsnull;
-
- nsProfileDirServiceProvider *prov = new nsProfileDirServiceProvider();
- if (!prov)
- return NS_ERROR_OUT_OF_MEMORY;
- nsresult rv = prov->Initialize();
- if (NS_FAILED(rv)) {
- delete prov;
- return rv;
- }
- NS_ADDREF(*aProvider = prov);
- return NS_OK;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.hxx
deleted file mode 100644
index 2efe916233..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.hxx
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include "mozilla_nsprofiledirserviceprovider.h"
-
-// Forward Declarations
-class nsIAtom;
-
-// --------------------------------------------------------------------------------------
-// nsProfileDirServiceProvider - The nsIDirectoryServiceProvider implementation used for
-// profile-relative file locations.
-// --------------------------------------------------------------------------------------
-
-class nsProfileDirServiceProvider: public nsIDirectoryServiceProvider
-{
- NS_DECL_ISUPPORTS
- NS_DECL_NSIDIRECTORYSERVICEPROVIDER
-
- friend nsresult NS_NewProfileDirServiceProvider( nsProfileDirServiceProvider**);
-
-public:
-
- virtual nsresult SetProfileDir(nsIFile* aProfileDir);
- virtual nsresult Register();
- virtual nsresult Shutdown();
-
-protected:
- nsProfileDirServiceProvider();
- virtual ~nsProfileDirServiceProvider();
-
- nsresult Initialize();
- nsresult EnsureProfileFileExists(nsIFile* profileDir);
- nsresult UndefineFileLocations();
-
-protected:
-
- // Atoms for file locations
- static nsIAtom* sApp_PrefsDirectory50;
- static nsIAtom* sApp_PreferencesFile50;
- static nsIAtom* sApp_UserProfileDirectory50;
-
- nsCOMPtr<nsIFile> mProfileDir;
-
-};
-
-
-// --------------------------------------------------------------------------------------
-
-/**
- * Global method to create an instance of nsProfileDirServiceProvider
- *
- * @param aNotifyObservers If true, will send out profile startup
- * notifications when the profile directory is set.
- * See nsIProfileChangeStatus.
- */
-
-nsresult NS_NewProfileDirServiceProvider( nsProfileDirServiceProvider** aProvider);
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
deleted file mode 100644
index 2ae687fdc1..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
+++ /dev/null
@@ -1,422 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MNSProfileDiscover.hxx"
-#ifndef MINIMAL_PROFILEDISCOVER
-#include "MNSProfile.hxx"
-
-#include "pratom.h"
-#include "prmem.h"
-#include "plstr.h"
-#include "prenv.h"
-
-#include "nsIEnumerator.h"
-#include "prprf.h"
-#include "nsCOMPtr.h"
-#include "nsIComponentManager.h"
-#include "nsEscape.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsAppDirectoryServiceDefs.h"
-#include "nsILocalFile.h"
-#include "nsReadableUtils.h"
-
-
-#if defined(XP_MAC) || defined(XP_MACOSX)
-#include <Processes.h>
-#include <CFBundle.h>
-#include "nsILocalFileMac.h"
-#endif
-
-#ifdef XP_UNIX
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-#include "prnetdb.h"
-#include "prsystem.h"
-#endif
-
-#ifdef VMS
-#include <rmsdef.h>
-#endif
-
-#include "nsICharsetConverterManager.h"
-#include "nsIPlatformCharset.h"
-
-
-#if defined (XP_UNIX)
-# define USER_ENVIRONMENT_VARIABLE "USER"
-# define LOGNAME_ENVIRONMENT_VARIABLE "LOGNAME"
-# define HOME_ENVIRONMENT_VARIABLE "HOME"
-# define PROFILE_NAME_ENVIRONMENT_VARIABLE "PROFILE_NAME"
-# define PROFILE_HOME_ENVIRONMENT_VARIABLE "PROFILE_HOME"
-# define DEFAULT_UNIX_PROFILE_NAME "default"
-# ifndef XP_MACOSX /* Don't use symlink-based locking on OS X */
-# define USE_SYMLINK_LOCKING
-# endif
-#endif
-
-// IID and CIDs of all the services needed
-static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
-#endif
-
-// Registry Keys
-
-static ::rtl::OUString szProfileSubtreeString( RTL_CONSTASCII_USTRINGPARAM( "Profiles" ));
-static ::rtl::OUString szCurrentProfileString( RTL_CONSTASCII_USTRINGPARAM( "CurrentProfile" ));
-static ::rtl::OUString szDirectoryString( RTL_CONSTASCII_USTRINGPARAM( "directory" ));
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 1024
-#endif
-#include <MNSFolders.hxx>
-#include <MNSINIParser.hxx>
-
-namespace connectivity
-{
- namespace mozab
- {
- ProfileStruct::ProfileStruct(MozillaProductType aProduct,::rtl::OUString aProfileName,
-#ifdef MINIMAL_PROFILEDISCOVER
- const ::rtl::OUString& aProfilePath
-#else
- nsILocalFile * aProfilePath
-#endif
- )
- {
- product=aProduct;
- profileName = aProfileName;
- profilePath = aProfilePath;
- }
- ::rtl::OUString ProfileStruct::getProfilePath()
- {
-#ifdef MINIMAL_PROFILEDISCOVER
- return profilePath;
-#else
- if (profilePath)
- {
- nsAutoString path;
- nsresult rv = profilePath->GetPath(path);
- NS_ENSURE_SUCCESS(rv, ::rtl::OUString());
- // PRUnichar != sal_Unicode in mingw
- return ::rtl::OUString(reinterpret_cast_mingw_only<const sal_Unicode *>(path.get()));
- }
- else
- return ::rtl::OUString();
-#endif
- }
-
- ProfileAccess::~ProfileAccess()
- {
- }
- ProfileAccess::ProfileAccess()
- {
- LoadProductsInfo();
- }
-
- sal_Int32 ProfileAccess::LoadProductsInfo()
- {
- //load SeaMonkey 2 profiles to m_ProductProfileList
- sal_Int32 count = LoadXPToolkitProfiles(MozillaProductType_Mozilla);
-
- //load thunderbird profiles to m_ProductProfileList
- count += LoadXPToolkitProfiles(MozillaProductType_Thunderbird);
-
- //load firefox profiles to m_ProductProfileList
- //firefox profile does not containt address book, but maybe others need them
- count += LoadXPToolkitProfiles(MozillaProductType_Firefox);
- return count;
- }
- //Thunderbird and firefox profiles are saved in profiles.ini
- sal_Int32 ProfileAccess::LoadXPToolkitProfiles(MozillaProductType product)
- {
- sal_Int32 index=product;
- ProductStruct &m_Product = m_ProductProfileList[index];
-
-#ifndef MINIMAL_PROFILEDISCOVER
- nsresult rv;
-#endif
- ::rtl::OUString regDir = getRegistryDir(product);
- ::rtl::OUString profilesIni( regDir );
- profilesIni += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("profiles.ini"));
- IniParser parser( profilesIni );
- IniSectionMap &mAllSection = *(parser.getAllSection());
-
- IniSectionMap::iterator iBegin = mAllSection.begin();
- IniSectionMap::iterator iEnd = mAllSection.end();
- for(;iBegin != iEnd;++iBegin)
- {
- ini_Section *aSection = &(*iBegin).second;
- ::rtl::OUString profileName;
- ::rtl::OUString profilePath;
- ::rtl::OUString sIsRelative;
- ::rtl::OUString sIsDefault;
-
- for(NameValueList::iterator itor=aSection->lList.begin();
- itor != aSection->lList.end();
- ++itor)
- {
- struct ini_NameValue * aValue = &(*itor);
- if (aValue->sName.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name"))))
- {
- profileName = aValue->sValue;
- }
- else if (aValue->sName.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsRelative"))))
- {
- sIsRelative = aValue->sValue;
- }
- else if (aValue->sName.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Path"))))
- {
- profilePath = aValue->sValue;
- }
- else if (aValue->sName.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Default"))))
- {
- sIsDefault = aValue->sValue;
- }
- }
- if (profileName.getLength() != 0 || profilePath.getLength() != 0)
- {
-#ifndef MINIMAL_PROFILEDISCOVER
- sal_Int32 isRelative = 0;
- if (sIsRelative.getLength() != 0)
- {
- isRelative = sIsRelative.toInt32();
- }
-
- nsCOMPtr<nsILocalFile> rootDir;
- rv = NS_NewLocalFile(EmptyString(), PR_TRUE,
- getter_AddRefs(rootDir));
- if (NS_FAILED(rv)) continue;
-
- OString sPath = OUStringToOString(profilePath, RTL_TEXTENCODING_UTF8);
- nsCAutoString filePath(sPath.getStr());
-
- if (isRelative) {
- // PRUnichar != sal_Unicode in mingw
- nsAutoString registryDir( reinterpret_cast_mingw_only<const PRUnichar *>(regDir.getStr()) );
- nsCOMPtr<nsILocalFile> mAppData;
- rv = NS_NewLocalFile(registryDir, PR_TRUE,
- getter_AddRefs(mAppData));
- if (NS_FAILED(rv)) continue;
- rv = rootDir->SetRelativeDescriptor(mAppData, filePath);
- } else {
- rv = rootDir->SetPersistentDescriptor(filePath);
- }
- if (NS_FAILED(rv)) continue;
-#endif
-
- ProfileStruct* profileItem = new ProfileStruct(product,profileName,
-#ifdef MINIMAL_PROFILEDISCOVER
- regDir + profilePath
-#else
- rootDir
-#endif
- );
- m_Product.mProfileList[profileName] = profileItem;
-
- sal_Int32 isDefault = 0;
- if (sIsDefault.getLength() != 0)
- {
- isDefault = sIsDefault.toInt32();
- }
- if (isDefault)
- m_Product.mCurrentProfileName = profileName;
-
- }
-
- }
- return static_cast< ::sal_Int32 >(m_Product.mProfileList.size());
- }
-
- ::rtl::OUString ProfileAccess::getProfilePath( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 index=product;
- ProductStruct &m_Product = m_ProductProfileList[index];
- if (!m_Product.mProfileList.size() || m_Product.mProfileList.find(profileName) == m_Product.mProfileList.end())
- {
- //Profile not found
- return ::rtl::OUString();
- }
- else
- return m_Product.mProfileList[profileName]->getProfilePath();
- }
-
- ::sal_Int32 ProfileAccess::getProfileCount( ::com::sun::star::mozilla::MozillaProductType product) throw (::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 index=product;
- ProductStruct &m_Product = m_ProductProfileList[index];
- return static_cast< ::sal_Int32 >(m_Product.mProfileList.size());
- }
- ::sal_Int32 ProfileAccess::getProfileList( ::com::sun::star::mozilla::MozillaProductType product, ::com::sun::star::uno::Sequence< ::rtl::OUString >& list ) throw (::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 index=product;
- ProductStruct &m_Product = m_ProductProfileList[index];
- list.realloc(static_cast<sal_Int32>(m_Product.mProfileList.size()));
- sal_Int32 i=0;
- for(ProfileList::iterator itor=m_Product.mProfileList.begin();
- itor != m_Product.mProfileList.end();
- itor++)
- {
- ProfileStruct * aProfile = (*itor).second;
- list[i] = aProfile->getProfileName();
- i++;
- }
-
- return static_cast< ::sal_Int32 >(m_Product.mProfileList.size());
- }
-
- ::rtl::OUString ProfileAccess::getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 index=product;
- ProductStruct &m_Product = m_ProductProfileList[index];
- if (m_Product.mCurrentProfileName.getLength() != 0)
- {
- //default profile setted in mozilla registry
- return m_Product.mCurrentProfileName;
- }
- if (m_Product.mProfileList.size() == 0)
- {
- //there are not any profiles
- return ::rtl::OUString();
- }
- ProfileStruct * aProfile = (*m_Product.mProfileList.begin()).second;
- return aProfile->getProfileName();
- }
-#ifndef MINIMAL_PROFILEDISCOVER
- nsresult ProfileAccess::isExistFileOrSymlink(nsILocalFile* aFile,PRBool *bExist)
- {
- nsresult rv;
- nsAutoString path;
- aFile->GetPath(path);
- rv = aFile->Exists(bExist);
- NS_ENSURE_SUCCESS(rv, rv);
- if (!*bExist)
- {
- rv = aFile->IsSymlink(bExist);
- NS_ENSURE_SUCCESS(rv, rv);
- }
- return rv;
- }
- nsresult ProfileAccess::isLockExist(nsILocalFile* aFile)
- {
-#if defined (XP_MACOSX)
- NS_NAMED_LITERAL_STRING(LOCKFILE_NAME, ".parentlock");
- NS_NAMED_LITERAL_STRING(OLD_LOCKFILE_NAME, "parent.lock");
-#elif defined (XP_UNIX)
- NS_ConvertASCIItoUTF16 OLD_LOCKFILE_NAME("lock");
- NS_ConvertASCIItoUTF16 LOCKFILE_NAME(".parentlock");
-#else
- NS_NAMED_LITERAL_STRING(OLD_LOCKFILE_NAME, "parent.lock");
- NS_NAMED_LITERAL_STRING(LOCKFILE_NAME, "parent.lock");
-#endif
-
- nsresult rv;
-
- PRBool isDir;
- rv = aFile->IsDirectory(&isDir);
- NS_ENSURE_SUCCESS(rv, rv);
- if (!isDir)
- return NS_ERROR_FILE_NOT_DIRECTORY;
-
- nsCOMPtr<nsILocalFile> lockFile;
- rv = aFile->Clone((nsIFile **)((void **)getter_AddRefs(lockFile)));
- NS_ENSURE_SUCCESS(rv, rv);
-
- rv = lockFile->Append(LOCKFILE_NAME);
- NS_ENSURE_SUCCESS(rv, rv);
- PRBool nExist=PR_FALSE;
- rv = isExistFileOrSymlink(lockFile,&nExist);
- NS_ENSURE_SUCCESS(rv, rv);
- if (!nExist) // Check OLD_LOCKFILE_NAME
- {
- nsCOMPtr<nsILocalFile> oldlockFile;
- rv = aFile->Clone((nsIFile **)((void **)getter_AddRefs(oldlockFile)));
- NS_ENSURE_SUCCESS(rv, rv);
-
- rv = oldlockFile->Append(OLD_LOCKFILE_NAME);
- NS_ENSURE_SUCCESS(rv, rv);
- rv = isExistFileOrSymlink(oldlockFile,&nExist);
- NS_ENSURE_SUCCESS(rv, rv);
- }
- return nExist;
- }
-
-#endif
- ::sal_Bool ProfileAccess::isProfileLocked( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
- {
-#ifdef MINIMAL_PROFILEDISCOVER
- (void)product; /* avoid warning about unused parameter */
- (void)profileName; /* avoid warning about unused parameter */
- return sal_True;
-#else
- ::rtl::OUString path = getProfilePath(product,profileName);
- if (!path.getLength())
- return sal_True;
-
- // PRUnichar != sal_Unicode in mingw
- nsAutoString filePath(reinterpret_cast_mingw_only<const PRUnichar *>(path.getStr()));
-
- nsresult rv;
- nsCOMPtr<nsILocalFile> localFile;
- rv = NS_NewLocalFile(filePath, PR_TRUE,
- getter_AddRefs(localFile));
- NS_ENSURE_SUCCESS(rv,sal_True);
-
- PRBool exists = PR_FALSE;
- rv = localFile->Exists(&exists);
- NS_ENSURE_SUCCESS(rv, sal_True);
- if (!exists)
- return sal_True;
-
- // If the profile is locked, we return true
- rv = isLockExist(localFile);
- if (rv)
- return sal_True;
- return sal_False;
-#endif
- }
-
- ::sal_Bool ProfileAccess::getProfileExists( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 index=product;
- ProductStruct &m_Product = m_ProductProfileList[index];
- if (!m_Product.mProfileList.size() || m_Product.mProfileList.find(profileName) == m_Product.mProfileList.end())
- {
- return sal_False;
- }
- else
- return sal_True;
- }
- }
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx
deleted file mode 100644
index a99f335479..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx
+++ /dev/null
@@ -1,125 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __MNSProfileDiscover_h___
-#define __MNSProfileDiscover_h___
-
-#ifndef MINIMAL_PROFILEDISCOVER
-#include "mozilla_profile_discover.h"
-#endif
-
-#include <sal/types.h>
-#include <osl/diagnose.h>
-#include <osl/conditn.hxx>
-#include <com/sun/star/mozilla/MozillaProductType.hpp>
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <rtl/ustring.hxx>
-
-#include <vector>
-#include <map>
-
-using namespace com::sun::star::mozilla;
-namespace connectivity
-{
- namespace mozab
- {
- class ProfileStruct;
- }
-}
-typedef ::std::map < ::rtl::OUString, ::connectivity::mozab::ProfileStruct* > ProfileList;
-namespace connectivity
-{
- namespace mozab
- {
- class ProfileStruct
- {
- public:
- ProfileStruct(MozillaProductType aProduct,::rtl::OUString aProfileName,
-#ifdef MINIMAL_PROFILEDISCOVER
- const ::rtl::OUString &aProfilePath
-#else
- nsILocalFile * aProfilePath
-#endif
- );
- MozillaProductType getProductType() { return product;}
- ::rtl::OUString getProfileName(){ return profileName;}
- ::rtl::OUString getProfilePath() ;
-#ifndef MINIMAL_PROFILEDISCOVER
- nsILocalFile *getProfileLocal(){ return profilePath;}
-#endif
- protected:
- MozillaProductType product;
- ::rtl::OUString profileName;
-#ifdef MINIMAL_PROFILEDISCOVER
- ::rtl::OUString profilePath;
-#else
- nsCOMPtr<nsILocalFile> profilePath;
-#endif
- };
-
- class ProductStruct
- {
- public:
- void setCurrentProfile(::rtl::OUString aProfileName){mCurrentProfileName = aProfileName;}
-
- ::rtl::OUString mCurrentProfileName;
-
- ProfileList mProfileList;
- };
-
- //Used to query profiles information
- class ProfileAccess
- {
- public:
-
- virtual ~ProfileAccess();
- ProfileAccess();
- ::rtl::OUString getProfilePath( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
- ::sal_Int32 getProfileCount( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException);
- ::sal_Int32 getProfileList( ::com::sun::star::mozilla::MozillaProductType product, ::com::sun::star::uno::Sequence< ::rtl::OUString >& list ) throw (::com::sun::star::uno::RuntimeException);
- ::rtl::OUString getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException);
- ::sal_Bool SAL_CALL isProfileLocked( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
- ::sal_Bool SAL_CALL getProfileExists( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
- protected:
- ProductStruct m_ProductProfileList[4];
- sal_Int32 LoadProductsInfo();
- sal_Int32 LoadXPToolkitProfiles(MozillaProductType product);
-#ifndef MINIMAL_PROFILEDISCOVER
- //used by isProfileLocked
- nsresult isExistFileOrSymlink(nsILocalFile* aFile,PRBool *bExist);
- nsresult isLockExist(nsILocalFile* aFile);
-#endif
- };
-
- }
-}
-
-#endif // __MNSProfileDiscover_h___
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx
deleted file mode 100644
index 2978c16fa1..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MNSProfileManager.hxx"
-#include "MNSProfile.hxx"
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 1024
-#endif
-#include <MNSFolders.hxx>
-#include <MNSINIParser.hxx>
-
-static ::sal_Int32 nInitCounter=0;
-namespace connectivity
-{
- namespace mozab
- {
-
- ProfileManager::~ProfileManager()
- {
- }
- ProfileManager::ProfileManager()
- :m_CurrentProduct(MozillaProductType_Mozilla)
- ,aProfile(NULL)
- {
- }
- ::sal_Int32 ProfileManager::bootupProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
- {
- if (!aProfile)
- {
- aProfile=new nsProfile();
- aProfile->StartupWithArgs(NULL,sal_False);
- }
-
- setCurrentProfile(product,profileName);
- return ++nInitCounter;
- }
- ::sal_Int32 ProfileManager::shutdownProfile( ) throw (::com::sun::star::uno::RuntimeException)
- {
- return --nInitCounter;
- }
- ::com::sun::star::mozilla::MozillaProductType ProfileManager::getCurrentProduct( ) throw (::com::sun::star::uno::RuntimeException)
- {
- return m_CurrentProduct;
- }
- ::rtl::OUString ProfileManager::getCurrentProfile( ) throw (::com::sun::star::uno::RuntimeException)
- {
- nsresult rv;
- nsCOMPtr<nsIProfile> theProfile(do_GetService(NS_PROFILE_CONTRACTID,&rv));
- if (NS_FAILED(rv)) return ::rtl::OUString();
- nsXPIDLString currentProfileStr;
- //call GetCurrentProfile before call SetCurrentProfile will get the default profile
- rv = theProfile->GetCurrentProfile(getter_Copies(currentProfileStr));
- if (NS_FAILED(rv) || currentProfileStr.get() == nsnull)
- return ::rtl::OUString();
- // PRUnichar != sal_Unicode in mingw
- return ::rtl::OUString(reinterpret_cast_mingw_only<const sal_Unicode *>(currentProfileStr.get()));
- }
- ::rtl::OUString ProfileManager::setCurrentProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
- {
- ::rtl::OUString currentProfile = getCurrentProfile();
- //if profileName not given, then skip and return curernt profile
- if (!profileName.getLength() && m_CurrentProduct == product)
- return currentProfile;
-
- if (m_CurrentProduct == product && profileName.equals(currentProfile))
- return currentProfile;
- //set current product
- m_CurrentProduct = product;
-
- //get profile mozilla profile service
- nsresult rv;
- nsCOMPtr<nsIProfile> theProfile(do_GetService(NS_PROFILE_CONTRACTID,&rv));
- if (NS_FAILED(rv)) return ::rtl::OUString();
-
- // PRUnichar != sal_Unicode in mingw
- const PRUnichar* pUsedProfile = reinterpret_cast_mingw_only<const PRUnichar *>(profileName.getStr());
- //set current profile
- rv = theProfile->SetCurrentProfile( pUsedProfile );
- if (NS_FAILED(rv)) return ::rtl::OUString();
- return currentProfile;
- }
-
-
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.hxx
deleted file mode 100644
index f7ff7e69a1..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.hxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __MNSProfileManager_h___
-#define __MNSProfileManager_h___
-
-#include "mozilla_profilemanager.h"
-
-#include <sal/types.h>
-#include <osl/diagnose.h>
-#include <osl/conditn.hxx>
-#include <com/sun/star/mozilla/MozillaProductType.hpp>
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#include <rtl/ustring.hxx>
-#include <vector>
-#include <map>
-
-using namespace com::sun::star::mozilla;
-class nsProfile;
-namespace connectivity
-{
- namespace mozab
- {
- class ProfileManager
- {
- public:
-
- virtual ~ProfileManager();
- ProfileManager();
-
- ::sal_Int32 SAL_CALL bootupProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) ;
- ::sal_Int32 SAL_CALL shutdownProfile( ) throw (::com::sun::star::uno::RuntimeException) ;
- ::com::sun::star::mozilla::MozillaProductType SAL_CALL getCurrentProduct( ) throw (::com::sun::star::uno::RuntimeException) ;
- ::rtl::OUString SAL_CALL getCurrentProfile( ) throw (::com::sun::star::uno::RuntimeException) ;
- ::rtl::OUString SAL_CALL setCurrentProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) ;
-
- protected:
- ::com::sun::star::mozilla::MozillaProductType m_CurrentProduct;
- nsProfile *aProfile;
- };
-
- }
-}
-
-#endif // __MNSProfileManager_h___
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.cxx
deleted file mode 100644
index 6461215532..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.cxx
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "MNSRunnable.hxx"
-#include "MDatabaseMetaDataHelper.hxx"
-#include "MQuery.hxx"
-#include <osl/mutex.hxx>
-#include <osl/conditn.hxx>
-
-#include "pre_include_mozilla.h"
-#include <nsIProxyObjectManager.h>
-// More Mozilla includes for LDAP Connection Test
-#include "prprf.h"
-#include "nsILDAPURL.h"
-#include "nsILDAPMessage.h"
-#include "nsILDAPMessageListener.h"
-#include "nsILDAPErrors.h"
-#include "nsILDAPConnection.h"
-#include "nsILDAPOperation.h"
-#include "post_include_mozilla.h"
-
-using namespace connectivity::mozab;
-
-/* Implementation file */
-NS_IMPL_ISUPPORTS1(MNSRunnable, nsIRunnable)
-
-static ::osl::Mutex m_aThreadMutex;
-
-nsIRunnable * MNSRunnable::ProxiedObject()
-{
- if (!_ProxiedObject)
- {
-
- nsresult rv = NS_GetProxyForObject(NS_UI_THREAD_EVENTQ,
- NS_GET_IID(nsIRunnable),
- this,
- PROXY_SYNC,
- (void**)&_ProxiedObject);
- (void)rv;
-
- _ProxiedObject->AddRef();
- }
- return _ProxiedObject;
-}
-
-MNSRunnable::MNSRunnable()
-{
- NS_INIT_ISUPPORTS();
- _ProxiedObject=NULL;
-#if OSL_DEBUG_LEVEL > 0
- m_oThreadID = osl_getThreadIdentifier(NULL);
-#endif
- AddRef();
-}
-
-MNSRunnable::~MNSRunnable()
-{
-}
-sal_Int32 MNSRunnable::StartProxy(const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy >& aCode)
-{
- OSL_TRACE( "IN : MNSRunnable::StartProxy() \n" );
- ::osl::MutexGuard aGuard(m_aThreadMutex);
- xCode = aCode;
- return ProxiedObject()->Run();
-}
-
-
-NS_IMETHODIMP MNSRunnable::Run()
-{
- return static_cast<nsresult>(xCode->run());
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.hxx
deleted file mode 100644
index 093e2d157c..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.hxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MAB_MOZAB_RUNNABLE_HXX_
-#define _CONNECTIVITY_MAB_MOZAB_RUNNABLE_HXX_
-#include "MNSDeclares.hxx"
-#include <osl/thread.hxx>
-
-#include <MNSInclude.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/mozilla/XCodeProxy.hpp>
-
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::mozilla;
-
-namespace connectivity
-{
- namespace mozab
- {
- class MNSRunnable : public nsIRunnable
- {
- public:
- nsIRunnable * ProxiedObject();
- MNSRunnable();
- virtual ~MNSRunnable();
- NS_DECL_ISUPPORTS
- NS_DECL_NSIRUNNABLE
-
- public:
- sal_Int32 StartProxy(const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy >& aCode); //Call this to start proxy
-
- private:
- nsIRunnable* _ProxiedObject;
- Reference<XCodeProxy> xCode;
-#if OSL_DEBUG_LEVEL > 0
- oslThreadIdentifier m_oThreadID;
-#endif
- };
- }
-}
-#endif //_CONNECTIVITY_MAB_MOZABHELPER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/makefile.mk b/connectivity/source/drivers/mozab/bootstrap/makefile.mk
deleted file mode 100755
index c4c1d21106..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/makefile.mk
+++ /dev/null
@@ -1,95 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-CALL_CDECL=TRUE
-
-PRJ=..$/..$/..$/..
-PRJINC=..$/..$/..
-PRJNAME=connectivity
-TARGET=mozbootstrap
-
-# --- Settings ----------------------------------
-
-USE_DEFFILE=TRUE
-ENABLE_EXCEPTIONS=TRUE
-VISIBILITY_HIDDEN=TRUE
-
-# --- begin of mozilla specific stuff
-MOZ_LIB=$(SOLARVERSION)$/$(INPATH)$/lib$(UPDMINOREXT)
-MOZ_INC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla
-# --- end of mozilla specific stuff
-
-.INCLUDE : settings.mk
-
-.INCLUDE : $(PRJ)$/version.mk
-
-.INCLUDE : ../makefile_mozab.mk
-
-INCPRE += -I../mozillasrc
-
-# --- Files -------------------------------------
-
-SLOFILES += \
- $(SLO)$/MNSINIParser.obj \
- $(SLO)$/MNSProfileDiscover.obj \
- $(SLO)$/MMozillaBootstrap.obj \
- $(SLO)$/MNSFolders.obj
-
-.IF ( "$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES" ) || ( "$(WITH_MOZILLA)" == "NO" ) || ( "$(OS)" == "MACOSX" )
-CDEFS+=-DMINIMAL_PROFILEDISCOVER
-
-SHL1TARGET=$(TARGET)
-SHL1VERSIONMAP=$(SOLARENV)/src/component.map
-SHL1OBJS=$(SLOFILES)
-SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-DEF1NAME=$(SHL1TARGET)
-
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SALLIB) \
- $(COMPHELPERLIB)
-
-ALLTAR : $(MISC)/mozbootstrap.component
-
-$(MISC)/mozbootstrap.component .ERRREMOVE : \
- $(SOLARENV)/bin/createcomponent.xslt mozbootstrap.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt mozbootstrap.component
-
-.ELSE
-SLOFILES += \
- $(SLO)$/MNSInit.obj \
- $(SLO)$/MNSProfileManager.obj \
- $(SLO)$/MNSRunnable.obj \
- $(SLO)$/MNSProfile.obj \
- $(SLO)$/MNSProfileDirServiceProvider.obj
-.ENDIF
-
-# --- Targets ----------------------------------
-
-.INCLUDE : target.mk
diff --git a/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component b/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component
deleted file mode 100755
index 5da158924a..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.mozilla.MozillaBootstrap">
- <service name="com.sun.star.mozilla.MozillaBootstrap"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsinit.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_nsinit.h
deleted file mode 100755
index e34bc21913..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsinit.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "pre_include_mozilla.h"
-#if defined __GNUC__
- #pragma GCC system_header
-#endif
-
-#include "nsIServiceManager.h"
-#include "nsIEventQueueService.h"
-#include "nsIChromeRegistry.h"
-
-#include "nsIStringBundle.h"
-
-#include "nsIDirectoryService.h"
-#include "nsIProfile.h"
-#include "nsIProfileInternal.h"
-#include "nsIPref.h"
-#include "nsXPIDLString.h"
-
-#include "nsString.h"
-#if defined __SUNPRO_CC
-#pragma disable_warn
- // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again
-#endif
-#include "nsEmbedAPI.h"
-
-#include "nsDirectoryService.h"
-
-#include "post_include_mozilla.h"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofile.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofile.h
deleted file mode 100755
index 4d65bc3cb5..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofile.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "pre_include_mozilla.h"
-#if defined __GNUC__
- #pragma GCC system_header
-#endif
-
-#include "nscore.h"
-#include "nsIPrefService.h"
-#include "nsIPrefBranch.h"
-
-#include "pratom.h"
-#include "prmem.h"
-#include "plstr.h"
-#include "prenv.h"
-
-#include "nsIFactory.h"
-#include "nsIComponentManager.h"
-#include "nsIEnumerator.h"
-#include "nsXPIDLString.h"
-#include "nsEscape.h"
-#include "nsIURL.h"
-
-#include "prprf.h"
-
-#include "nsIProfile.h"
-#include "nsIProfileInternal.h"
-#include "nsIProfileStartupListener.h"
-#include "nsIProfileChangeStatus.h"
-#include "nsCOMPtr.h"
-#include "nsISupports.h"
-#include "nsIRegistry.h"
-#include "nsString.h"
-#if defined __SUNPRO_CC
-#pragma disable_warn
- // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again
-#endif
-#include "nsIInterfaceRequestor.h"
-#include "nsIInterfaceRequestorUtils.h"
-#include "nsIDirectoryService.h"
-#include "nsIFactory.h"
-
-#include "nsIIOService.h"
-#include "nsNetUtil.h"
-#include "nsFileStream.h"
-#include "nsIStreamListener.h"
-#include "nsIServiceManager.h"
-#include "nsCOMPtr.h"
-#include "nsIModule.h"
-#include "nsIGenericFactory.h"
-#include "nsICategoryManager.h"
-#include "nsXPCOM.h"
-#include "nsISupportsPrimitives.h"
-#include "nsIDirectoryService.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsAppDirectoryServiceDefs.h"
-#include "nsIChromeRegistry.h" // chromeReg
-#include "nsIStringBundle.h"
-#include "nsIObserverService.h"
-#include "nsHashtable.h"
-#include "nsIAtom.h"
-#include "nsCRT.h"
-
-#include "post_include_mozilla.h"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofiledirserviceprovider.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofiledirserviceprovider.h
deleted file mode 100755
index 4bb836ed13..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofiledirserviceprovider.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "pre_include_mozilla.h"
-#if defined __GNUC__
- #pragma GCC system_header
-#endif
-
-#include "nsIDirectoryService.h"
-#include "nsILocalFile.h"
-#include "nsString.h"
-#if defined __SUNPRO_CC
-#pragma disable_warn
- // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again
-#endif
-
-#include "post_include_mozilla.h"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_profile_discover.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_profile_discover.h
deleted file mode 100755
index 03198dcab8..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/mozilla_profile_discover.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "pre_include_mozilla.h"
-#if defined __GNUC__
- #pragma GCC system_header
-#endif
-
-#include "nsCOMPtr.h"
-#include "nsISupports.h"
-#include "nsString.h"
-#if defined __SUNPRO_CC
-#pragma disable_warn
- // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again
-#endif
-#include "nsIRegistry.h"
-#include "nsXPIDLString.h"
-#include "nsVoidArray.h"
-#include "nsIFile.h"
-#include "nsILocalFile.h"
-
-#include "post_include_mozilla.h"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_profilemanager.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_profilemanager.h
deleted file mode 100755
index 1579b16947..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/mozilla_profilemanager.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "pre_include_mozilla.h"
-#if defined __GNUC__
- #pragma GCC system_header
-#endif
-
-#include "nsCOMPtr.h"
-#include "nsISupports.h"
-#include "nsString.h"
-#if defined __SUNPRO_CC
-#pragma disable_warn
- // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again
-#endif
-#include "nsIRegistry.h"
-#include "nsXPIDLString.h"
-#include "nsVoidArray.h"
-#include "nsIFile.h"
-#include "nsILocalFile.h"
-
-#include "pratom.h"
-#include "prmem.h"
-#include "plstr.h"
-#include "prenv.h"
-
-#include "nsIEnumerator.h"
-#include "prprf.h"
-#include "nsCOMPtr.h"
-#include "nsIComponentManager.h"
-#include "nsEscape.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsAppDirectoryServiceDefs.h"
-#include "nsILocalFile.h"
-#include "nsReadableUtils.h"
-
-
-#if defined(XP_MAC) || defined(XP_MACOSX)
-#include <Processes.h>
-#include <CFBundle.h>
-#include "nsILocalFileMac.h"
-#endif
-
-#ifdef XP_UNIX
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-#include "prnetdb.h"
-#include "prsystem.h"
-#endif
-
-#ifdef VMS
-#include <rmsdef.h>
-#endif
-
-#include "nsIPlatformCharset.h"
-#include <MNSInit.hxx>
-
-#include "post_include_mozilla.h"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/post_include_windows.h b/connectivity/source/drivers/mozab/bootstrap/post_include_windows.h
deleted file mode 100755
index a33bd622ac..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/post_include_windows.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifdef _MSC_VER
- #pragma warning(pop)
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/pre_include_windows.h b/connectivity/source/drivers/mozab/bootstrap/pre_include_windows.h
deleted file mode 100755
index 792e8a34f4..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/pre_include_windows.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifdef _MSC_VER
- #pragma warning(push,1)
- #pragma warning(disable:4668 4917)
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/exports.dxp b/connectivity/source/drivers/mozab/exports.dxp
deleted file mode 100755
index 7003307892..0000000000
--- a/connectivity/source/drivers/mozab/exports.dxp
+++ /dev/null
@@ -1 +0,0 @@
-component_getFactory
diff --git a/connectivity/source/drivers/mozab/makefile.mk b/connectivity/source/drivers/mozab/makefile.mk
deleted file mode 100755
index cefb6f9fb9..0000000000
--- a/connectivity/source/drivers/mozab/makefile.mk
+++ /dev/null
@@ -1,194 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=mozab
-TARGET2=$(TARGET)drv
-VISIBILITY_HIDDEN=TRUE
-
-.IF ( "$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO" || ( "$(OS)" == "MACOSX" )
-all:
- @echo " Not building the mozilla address book driver"
- @echo " dependency to Mozilla developer snapshots not feasable at the moment"
- @echo " see http://bugzilla.mozilla.org/show_bug.cgi?id=135137"
- @echo " see http://www.mozilla.org/issues/show_bug.cgi?id=91209"
-.ENDIF
-
-# --- begin of mozilla specific stuff
-MOZ_LIB=$(SOLARVERSION)$/$(INPATH)$/lib$(UPDMINOREXT)
-MOZ_INC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla
-
-.IF "$(OS)"=="WNT"
- MOZ_EMBED_LIB := $(shell @-test -f $(MOZ_LIB)$/embed_base_s.lib && echo $(MOZ_LIB)$/embed_base_s.lib )
- MOZ_REG_LIB := $(shell @-test -f $(MOZ_LIB)$/mozreg_s.lib && echo $(MOZ_LIB)$/mozreg_s.lib )
-
- MOZ_EMBED_LIB *:= $(MOZ_LIB)$/baseembed_s.lib
- MOZ_REG_LIB *:= $(MOZ_LIB)$/mozreg.lib
-
- .IF "$(COM)"=="GCC"
- MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lembed_base_s -lnspr4 -lmozreg_s -lxpcom -lxpcom_core
- .ELSE
- LIB += $(MOZ_LIB)
- MOZ_LIB_XPCOM= $(MOZ_EMBED_LIB) $(MOZ_LIB)$/nspr4.lib $(MOZ_REG_LIB) $(MOZ_LIB)$/xpcom.lib $(MOZ_LIB)$/xpcom_core.lib
- .ENDIF
-
-.ELSE "$(OS)"=="WNT"
- MOZ_LIB_XPCOM = -L$(MOZ_LIB) -lnspr4 -lxpcom_core -lmozreg_s -lembed_base_s
-.ENDIF
-# --- end of mozilla specific stuff
-
-USE_DEFFILE=TRUE
-ENABLE_EXCEPTIONS=TRUE
-VISIBILITY_HIDDEN=TRUE
-
-.IF "$(OS)"!="WNT"
-COMPONENT_CONFIG_DATA=$(TARGET)2.xcu
-COMPONENT_CONFIG_SCHEMA=$(TARGET)2.xcs
-.ENDIF
-
-# --- Settings ----------------------------------
-
-.INCLUDE : $(PRJ)$/makefile.pmk
-
-.INCLUDE : $(PRJ)$/version.mk
-
-# --- Files -------------------------------------
-
-SLOFILES=\
- $(SLO)$/MDriver.obj \
- $(SLO)$/MServices.obj
-
-# --- MOZAB BASE Library -----------------------------------
-
-SHL1VERSIONMAP=$(SOLARENV)/src/component.map
-SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SALLIB) \
- $(DBTOOLSLIB)
-
-SHL1DEPN=
-SHL1IMPLIB= i$(TARGET)$(DLLPOSTFIX)
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt \
- $(SLB)$/$(TARGET).lib
-DEFLIB1NAME=$(TARGET)
-
-
-# --- Files -------------------------------------
-MOZSLOFILES=\
- $(SLO)$/MNSInit.obj \
- $(SLO)$/MQueryHelper.obj \
- $(SLO)$/MDatabaseMetaDataHelper.obj \
- $(SLO)$/MQuery.obj \
- $(SLO)$/MTypeConverter.obj \
- $(SLO)$/MNameMapper.obj \
- $(SLO)$/MNSMozabProxy.obj \
- $(SLO)$/MNSTerminateListener.obj \
- $(SLO)$/MMozillaBootstrap.obj \
- $(SLO)$/MNSFolders.obj \
- $(SLO)$/MNSProfileDiscover.obj \
- $(SLO)$/MNSProfileManager.obj \
- $(SLO)$/MNSINIParser.obj \
- $(SLO)$/MNSRunnable.obj \
- $(SLO)$/MNSProfile.obj \
- $(SLO)$/MNSProfileDirServiceProvider.obj \
- $(SLO)$/MLdapAttributeMap.obj
-
-
-SLO2FILES=\
- $(SLO)$/MConfigAccess.obj \
- $(SLO)$/MCatalog.obj \
- $(SLO)$/MColumns.obj \
- $(SLO)$/MTable.obj \
- $(SLO)$/MTables.obj \
- $(SLO)$/MColumnAlias.obj \
- $(SLO)$/MPreparedStatement.obj \
- $(SLO)$/MStatement.obj \
- $(SLO)$/MResultSetMetaData.obj \
- $(SLO)$/MResultSet.obj \
- $(SLO)$/MDatabaseMetaData.obj \
- $(SLO)$/MConnection.obj \
- $(MOZSLOFILES)
-
-DEPOBJFILES=$(SLO2FILES)
-
-# --- MOZAB BASE Library -----------------------------------
-
-SHL2VERSIONMAP= $(TARGET2).map
-SHL2NOCHECK=TRUE
-SHL2TARGET= $(TARGET2)$(DLLPOSTFIX)
-SHL2OBJS=$(SLO2FILES)
-SHL2STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SALLIB) \
- $(SALHELPERLIB) \
- $(DBTOOLSLIB) \
- $(COMPHELPERLIB) \
- $(MOZ_LIB_XPCOM)
-
-.IF "$(GUI)"=="WNT"
- SHL2STDLIBS += \
- $(SHELL32LIB)
-.ENDIF # "$(GUI)"=="WNT"
-
-SHL2DEPN=
-SHL2IMPLIB= i$(TARGET2)
-SHL2DEF= $(MISC)$/$(SHL2TARGET).def
-DEF2NAME= $(SHL2TARGET)
-
-# --- Targets ----------------------------------
-
-.INCLUDE : $(PRJ)$/target.pmk
-
-# --- filter file ------------------------------
-
-$(MISC)$/$(SHL1TARGET).flt: makefile.mk
- @echo ------------------------------
- @echo _TI >$@
- @echo _real >>$@
-
-$(MISC)$/$(SHL2TARGET).flt: makefile.mk
- @echo ------------------------------
- @echo _TI >$@
- @echo _real >>$@
-
-
-ALLTAR : $(MISC)/mozab.component
-
-$(MISC)/mozab.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- mozab.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt mozab.component
diff --git a/connectivity/source/drivers/mozab/makefile_mozab.mk b/connectivity/source/drivers/mozab/makefile_mozab.mk
deleted file mode 100755
index c984f121a2..0000000000
--- a/connectivity/source/drivers/mozab/makefile_mozab.mk
+++ /dev/null
@@ -1,127 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-CDEFS += -DMOZILLA_INTERNAL_API
-
-.IF "$(GUI)"=="UNX"
- .IF "$(COMNAME)"=="sunpro5"
- CFLAGS += -features=tmplife
- #This flag is needed to build mozilla 1.7 code
- .ENDIF # "$(COMNAME)"=="sunpro5"
-.ENDIF
-
-MOZINC = . \
- -I.. \
- -I$(MOZ_INC) \
- -I$(MOZ_INC)$/nspr \
- -I$(MOZ_INC)$/xpcom \
- -I$(MOZ_INC)$/string \
- -I$(MOZ_INC)$/rdf \
- -I$(MOZ_INC)$/msgbase \
- -I$(MOZ_INC)$/addrbook \
- -I$(MOZ_INC)$/mork \
- -I$(MOZ_INC)$/locale \
- -I$(MOZ_INC)$/pref \
- -I$(MOZ_INC)$/mime \
- -I$(MOZ_INC)$/chrome \
- -I$(MOZ_INC)$/necko \
- -I$(MOZ_INC)$/intl \
- -I$(MOZ_INC)$/profile \
- -I$(MOZ_INC)$/embed_base \
- -I$(MOZ_INC)$/mozldap \
- -I$(MOZ_INC)$/uconv \
- -I$(MOZ_INC)$/xpcom_obsolete \
- -I$(MOZ_INC)$/content
-
-.IF "$(GUI)" == "WNT"
- CDEFS += \
- -DMOZILLA_CLIENT \
- -DXP_PC \
- -DXP_WIN \
- -DXP_WIN32 \
- -DOJI \
- -DWIN32 \
- -D_WINDOWS \
- -DMOZ_XUL \
- -DMOZ_REFLOW_PERF \
- -DMOZ_REFLOW_PERF_DSP
- .IF "$(COM)" == "GCC"
- INCPOST += $(MOZINC)
- CFLAGSCXX += \
- -fno-rtti \
- -Wall \
- -Wconversion \
- -Wpointer-arith \
- -Wcast-align \
- -Woverloaded-virtual \
- -Wsynth \
- -Wno-long-long
- .ELSE # .IF "$(COM)" == "GCC"
- INCPRE += $(MOZINC)
- .IF "$(DBG_LEVEL)" != "0"
- .IF "$(CCNUMVER)" >= "001399999999"
- CDEFS += -D_STL_NOFORCE_MANIFEST
- .ENDIF # .IF "$(CCNUMVER)" >= "001399999999"
- .ENDIF # .IF "$(DBG_LEVEL)" != "0"
- .ENDIF # .IF "$(COM)" == "GCC"
-.ENDIF # .IF "$(GUI)" == "WNT"
-
-.IF "$(GUI)" == "UNX"
- INCPOST += $(MOZINC)
- CDEFS+= -DMOZILLA_CLIENT \
- -DXP_UNIX
- .IF "$(OS)" == "LINUX"
- CFLAGS += -fPIC -g
- CDEFS += -DOJI
- CFLAGSCXX += \
- -fno-rtti \
- -Wconversion \
- -Wpointer-arith \
- -Wcast-align \
- -Woverloaded-virtual \
- -Wsynth \
- -Wno-long-long \
- -pthread
- CDEFS += -DTRACING
- .ELIF "$(OS)" == "NETBSD" || "$(OS)" == "MACOSX"
- CFLAGS += -fPIC
- CFLAGSCXX += \
- -fno-rtti \
- -Wconversion \
- -Wpointer-arith \
- -Wcast-align \
- -Woverloaded-virtual \
- -Wsynth \
- -Wno-long-long \
- -Wno-deprecated
- CDEFS += -DTRACING
- .ENDIF # "$(OS)" == "NETBSD" || "$(OS)" == "MACOSX"
-
- SHL1TARGET_NAME=$(TARGET)$(MOZAB_MAJOR)
-
-.ENDIF # "$(GUI)" == "UNX"
-
diff --git a/connectivity/source/drivers/mozab/mozab.component b/connectivity/source/drivers/mozab/mozab.component
deleted file mode 100755
index 70f5da3bfe..0000000000
--- a/connectivity/source/drivers/mozab/mozab.component
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.mozilla.MozillaBootstrap">
- <service name="com.sun.star.mozilla.MozillaBootstrap"/>
- </implementation>
- <implementation name="com.sun.star.comp.sdbc.MozabDriver">
- <service name="com.sun.star.sdbc.Driver"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/mozab/mozab.xcu b/connectivity/source/drivers/mozab/mozab.xcu
deleted file mode 100644
index 638cbeb2c0..0000000000
--- a/connectivity/source/drivers/mozab/mozab.xcu
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="sdbc:address:outlook" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Microsoft Outlook Address Book</value>
- </prop>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:address:outlookexp" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Microsoft Windows Address Book</value>
- </prop>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:address:mozilla:" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">SeaMonkey Address Book</value>
- </prop>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:address:thunderbird:" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Thunderbird Address Book</value>
- </prop>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:address:ldap:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">LDAP Address Book</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="BaseDN" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="MaxRowCount" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:int">
- <value>100</value>
- </prop>
- </node>
- <node oor:name="PortNumber" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:int">
- <value>389</value>
- </prop>
- </node>
- <node oor:name="UseSSL" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/mozab/mozab.xml b/connectivity/source/drivers/mozab/mozab.xml
deleted file mode 100755
index 33e9219a16..0000000000
--- a/connectivity/source/drivers/mozab/mozab.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
-<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
- <module-name> mozabdrv2 </module-name>
- <component-description>
- <Author>Your name</Author>
- <Name>com.sun.star.comp.sdbc.MozabDriver</Name>
- <Description>
- This is the implementation of the sdbc-mozab bridge.
- </Description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service> com.sun.star.sdbc.Driver </supported-service>
- <service-dependency> ... </service-dependency>
- </component-description>
- <component-description>
- <Author>Wind Li</Author>
- <Name>com.sun.star.comp.mozilla.MozillaBootstrap</Name>
- <Description>
- This is the implementation of the MozillaBootstrap for sdbc-mozab bridge and xmlsec.
- </Description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service> com.sun.star.mozilla.MozillaBootstrap</supported-service>
- <service-dependency> ... </service-dependency>
- </component-description>
- <project-build-dependency> cppuhelper </project-build-dependency>
- <project-build-dependency> cppu </project-build-dependency>
- <project-build-dependency> sal </project-build-dependency>
-
- <runtime-module-dependency> cppuhelper </runtime-module-dependency>
- <runtime-module-dependency> cppu1 </runtime-module-dependency>
- <runtime-module-dependency> sal1 </runtime-module-dependency>
-
-
-
- <type> com.sun.star.util.XCancellable </type>
- <type> com.sun.star.util.XNumberFormatter </type>
- <type> com.sun.star.uno.TypeClass </type>
- <type> com.sun.star.uno.XWeak </type>
- <type> com.sun.star.uno.XAggregation </type>
- <type> com.sun.star.beans.XPropertyState </type>
- <type> com.sun.star.beans.XPropertySet </type>
- <type> com.sun.star.beans.PropertyValue </type>
- <type> com.sun.star.beans.XMultiPropertySet </type>
- <type> com.sun.star.beans.XFastPropertySet </type>
- <type> com.sun.star.lang.XTypeProvider </type>
- <type> com.sun.star.lang.EventObject </type>
- <type> com.sun.star.lang.XComponent </type>
- <type> com.sun.star.lang.IllegalArgumentException </type>
- <type> com.sun.star.lang.XMultiServiceFactory </type>
- <type> com.sun.star.java.XJavaThreadRegister_11 </type>
- <type> com.sun.star.java.XJavaVM </type>
- <type> com.sun.star.sdbc.XConnection </type>
- <type> com.sun.star.sdbc.XStatement </type>
- <type> com.sun.star.sdbc.XResultSet </type>
- <type> com.sun.star.sdbc.XResultSetMetaDataSupplier</type>
- <type> com.sun.star.sdbc.XColumnLocate </type>
- <type> com.sun.star.sdbc.XResultSetUpdate </type>
- <type> com.sun.star.sdbc.XWarningsSupplier </type>
- <type> com.sun.star.sdbc.XRowUpdate </type>
- <type> com.sun.star.sdbc.XMultipleResults </type>
- <type> com.sun.star.sdbc.XBatchExecution </type>
- <type> com.sun.star.sdbc.XPreparedBatchExecution </type>
- <type> com.sun.star.sdbc.XParameters </type>
- <type> com.sun.star.sdbc.XOutParameters </type>
- <type> com.sun.star.sdbc.DriverPropertyInfo </type>
- <type> com.sun.star.sdbc.XRow </type>
- <type> com.sun.star.sdb.XColumnUpdate </type>
- <type> com.sun.star.sdb.XColumn </type>
- <type> com.sun.star.sdbc.XResultSetUpdate </type>
- <type> com.sun.star.sdbc.XRowUpdate </type>
- <type> com.sun.star.sdbcx.XRowLocate </type>
- <type> com.sun.star.sdbcx.XDeleteRows </type>
-
-</module-description>
-
-
diff --git a/connectivity/source/drivers/mozab/mozab2.xcu b/connectivity/source/drivers/mozab/mozab2.xcu
deleted file mode 100644
index 18cb3c1eaf..0000000000
--- a/connectivity/source/drivers/mozab/mozab2.xcu
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="sdbc:address:mozilla:" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">SeaMonkey Address Book</value>
- </prop>
- <node oor:name="MetaData">
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:address:thunderbird:" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Thunderbird Address Book</value>
- </prop>
- <node oor:name="MetaData">
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:address:ldap:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">LDAP Address Book</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="BaseDN" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="MaxRowCount" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:int">
- <value>100</value>
- </prop>
- </node>
- <node oor:name="PortNumber" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:int">
- <value>389</value>
- </prop>
- </node>
- <node oor:name="UseSSL" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/mozab/mozabdrv.map b/connectivity/source/drivers/mozab/mozabdrv.map
deleted file mode 100755
index a431a07377..0000000000
--- a/connectivity/source/drivers/mozab/mozabdrv.map
+++ /dev/null
@@ -1,8 +0,0 @@
-UDK_3_0_0 {
- global:
- OMozabConnection_CreateInstance;
- OMozillaBootstrap_CreateInstance;
- setMozabServiceFactory;
- local:
- *;
-};
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
deleted file mode 100644
index 2e08d7754b..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
+++ /dev/null
@@ -1,805 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-// Mozilla includes.
-#include <MNSInclude.hxx>
-
-#include "resource/mozab_res.hrc"
-#include "MDatabaseMetaDataHelper.hxx"
-#include "MTypeConverter.hxx"
-#include "MConfigAccess.hxx"
-#include <connectivity/dbexception.hxx>
-#include <comphelper/uno3.hxx>
-#include <comphelper/sequence.hxx>
-#include <osl/mutex.hxx>
-#include <osl/conditn.hxx>
-
-#include <nsIAbDirFactoryService.h>
-#include <MNSInit.hxx>
-#include <MNameMapper.hxx>
-#include "MNSMozabProxy.hxx"
-#include <MNSDeclares.hxx>
-
-static ::osl::Mutex m_aMetaMutex;
-
-#include <osl/diagnose.h>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/XInterface.hpp>
-#include <com/sun/star/uno/Exception.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/Property.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/XPropertySetInfo.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/sdb/ErrorCondition.hpp>
-#include <unotools/processfactory.hxx>
-#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
-
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-
-static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
-static NS_DEFINE_CID(kAbDirFactoryServiceCID, NS_ABDIRFACTORYSERVICE_CID);
-static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
-
-using namespace connectivity::mozab;
-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::mozilla;
-using namespace com::sun::star::sdb;
-
-namespace connectivity
-{
- namespace mozab
- {
- static const char * const s_pADDRESSBOOKROOTDIR = "moz-abdirectory://";
- }
-}
-
-extern sal_Bool MNS_Init(sal_Bool& aProfileExists);
-
-// -------------------------------------------------------------------------
-MDatabaseMetaDataHelper::MDatabaseMetaDataHelper()
- :m_bProfileExists(sal_False)
-{
- OSL_TRACE( "IN MDatabaseMetaDataHelper::MDatabaseMetaDataHelper()\n" );
-
- OSL_TRACE( "\tOUT MDatabaseMetaDataHelper::MDatabaseMetaDataHelper()\n" );
-
-}
-// -------------------------------------------------------------------------
-MDatabaseMetaDataHelper::~MDatabaseMetaDataHelper()
-{
- m_aTableNames.clear();
- m_aTableTypes.clear();
-
- if (m_bProfileExists)
- {
- Reference<XMozillaBootstrap> xMozillaBootstrap;
- Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory();
- OSL_ENSURE( xFactory.is(), "can't get service factory" );
-
- Reference<XInterface> xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
- xMozillaBootstrap = Reference<XMozillaBootstrap>(xInstance,UNO_QUERY);
- m_bProfileExists = xMozillaBootstrap->shutdownProfile() > 0;
- }
-
- OSL_TRACE( "IN/OUT MDatabaseMetaDataHelper::~MDatabaseMetaDataHelper()\n" );
-}
-
-static nsresult enumSubs(nsISimpleEnumerator * subDirs,nsISupportsArray * array);
-//enum all sub folders
-static nsresult enumSubs(nsIAbDirectory * parentDir,nsISupportsArray * array)
-{
- nsresult rv = NS_OK ;
- nsCOMPtr<nsISimpleEnumerator> subDirectories;
- rv = parentDir->GetChildNodes(getter_AddRefs(subDirectories));
- if (NS_FAILED(rv)) { return rv; }
-
- rv = enumSubs(subDirectories,array);
- return rv;
-}
-
-#include <prmem.h> //need for PR_FREEIF
-static nsresult insertPABDescription()
-{
- nsresult rv = NS_OK ;
- // mozilla loads the descriptions of pab and history from a file named addressbook.properties
- // we never deliver it with OOo,so mozab does not auot load personal addressbook and Collected addresses
- // If we want to deliver addressbook.properties with OOo,we have to deal with hole mozilla chrome mechanism.
- // So I insert the descriptiones as user prefes,they will cover the default value.
-
- //"Personal Address Book" "Collected Addresses" are loaded from officecfg
- nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCAutoString pabPrefName(NS_LITERAL_CSTRING("ldap_2.servers.pab.description"));
-
- sal_Bool bSetted=sal_False;
- char *value = nsnull;
- if (0 == prefs->CopyCharPref(pabPrefName.get(), &value))
- {
- if (!(value == nsnull || value[0] == 0))
- {
- bSetted = sal_True;
- }
- }
- PR_FREEIF (value);
- value=nsnull;
- if (bSetted == sal_True)
- {
- const char* pPabDescription = static_cast< const char* >( getPabDescription( ) );
- rv = prefs->SetCharPref (pabPrefName.get(), pPabDescription);
- NS_ENSURE_SUCCESS(rv, rv);
- }
-
- nsCAutoString hisPrefName(NS_LITERAL_CSTRING("ldap_2.servers.history.description"));
-
- bSetted=sal_False;
- if (0 == prefs->CopyCharPref(hisPrefName.get(), &value))
- {
- if (!(value == nsnull || value[0] == 0))
- {
- bSetted = sal_True;
- }
- }
- PR_FREEIF (value);
- value=nsnull;
- if (bSetted == sal_True)
- {
- const char* pHisDescription = static_cast< const char* >( getHisDescription( ) );
-
- rv = prefs->SetCharPref (hisPrefName.get(), pHisDescription);
- NS_ENSURE_SUCCESS(rv, rv);
- }
- return rv;
-}
-//
-// nsAbDirectoryDataSource
-//
-#define NS_RDF_CONTRACTID "@mozilla.org/rdf"
-#define NS_RDF_DATASOURCE_CONTRACTID NS_RDF_CONTRACTID "/datasource;1"
-#define NS_RDF_DATASOURCE_CONTRACTID_PREFIX NS_RDF_DATASOURCE_CONTRACTID "?name="
-#define NS_ABDIRECTORYDATASOURCE_CONTRACTID \
- NS_RDF_DATASOURCE_CONTRACTID_PREFIX "addressdirectory"
-#define database_uri "@mozilla.org/rdf/datasource;1?name=addressdirectory"
-#define NS_ABDIRECTORYDATASOURCE_CID \
-{ /* 0A79186D-F754-11d2-A2DA-001083003D0C */ \
- 0xa79186d, 0xf754, 0x11d2, \
- {0xa2, 0xda, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
-}
-
-// -------------------------------------------------------------------------
-// Case where we get a parent uri, and need to list its children.
-static nsresult getSubsFromParent(const rtl::OString& aParent, nsIEnumerator **aSubs)
-{
-
- if (aSubs == nsnull) { return NS_ERROR_NULL_POINTER ; }
- *aSubs = nsnull ;
- nsresult retCode = NS_OK ;
- nsCOMPtr<nsISupportsArray> array ;
-
- NS_NewISupportsArray(getter_AddRefs(array)) ;
-
- retCode = insertPABDescription();
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-
- nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &retCode)) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsCOMPtr<nsIRDFResource> rdfResource ;
-
- nsCOMPtr<nsIRDFDataSource> rdfDirectory ;
-
- rtl::OString dir("rdf:addressdirectory");
- retCode = rdfService->GetDataSource(dir.getStr(),getter_AddRefs(rdfDirectory)) ;
-
-
-
- OSL_TRACE("uri: %s\n", aParent.getStr()) ;
- retCode = rdfService->GetResource(nsDependentCString(aParent.getStr(),aParent.getLength()), getter_AddRefs(rdfResource)) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsCOMPtr<nsIAbDirectory> directory = do_QueryInterface(rdfResource, &retCode) ;
- nsCOMPtr<nsISimpleEnumerator> tempEnum ;
-
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- retCode = directory->GetChildNodes(getter_AddRefs(tempEnum)) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-
- PRBool hasMore = PR_TRUE ;
- while (NS_SUCCEEDED(tempEnum->HasMoreElements(&hasMore)) && hasMore) {
- nsCOMPtr<nsIAbDirectory> element ;
- retCode = tempEnum->GetNext(getter_AddRefs(element)) ;
- if (NS_SUCCEEDED(retCode))
- {
- array->AppendElement(element) ;
- enumSubs(element,array);
- }
- }
-
- array->Enumerate(aSubs) ;
- return retCode ;
-}
-
-static nsresult enumSubs(nsISimpleEnumerator * subDirs,nsISupportsArray * array)
-{
- PRBool hasMore = PR_TRUE ;
- nsresult rv = NS_OK ;
- while (NS_SUCCEEDED(subDirs->HasMoreElements(&hasMore)) && hasMore) {
- nsCOMPtr<nsISupports> newDirSupports ;
-
- rv = subDirs->GetNext(getter_AddRefs(newDirSupports)) ;
- NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsIAbDirectory> childDir = do_QueryInterface(newDirSupports, &rv) ;
- NS_ENSURE_SUCCESS(rv, rv);
- array->AppendElement(childDir);
-
- rv = enumSubs(childDir,array);
- }
- return rv;
-}
-
-// Case where we get a factory uri and need to have it build the directories.
-static nsresult getSubsFromFactory(const rtl::OString& aFactory, nsIEnumerator **aSubs)
-{
- if (aSubs == nsnull) { return NS_ERROR_NULL_POINTER ; }
- *aSubs = nsnull ;
- nsresult retCode = NS_OK ;
-
- nsCOMPtr<nsIAbDirFactoryService> dirFactoryService = do_GetService(NS_ABDIRFACTORYSERVICE_CONTRACTID, &retCode);
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsCOMPtr<nsIAbDirFactory> dirFactory ;
-
- retCode = dirFactoryService->GetDirFactory(aFactory.getStr(), getter_AddRefs(dirFactory)) ;
- NS_ENSURE_SUCCESS (retCode, retCode) ;
- nsCOMPtr <nsIAbDirectoryProperties> properties;
- properties = do_CreateInstance(NS_ABDIRECTORYPROPERTIES_CONTRACTID, &retCode);
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-
- retCode = properties->SetURI(aFactory.getStr());
- NS_ENSURE_SUCCESS(retCode,retCode);
-
- nsCOMPtr<nsISimpleEnumerator> subDirs ;
- retCode = dirFactory->CreateDirectory(properties, getter_AddRefs(subDirs));
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsCOMPtr<nsISupportsArray> array ;
-
- NS_NewISupportsArray(getter_AddRefs(array)) ;
- retCode = enumSubs(subDirs,array);
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- array->Enumerate(aSubs) ;
- return retCode ;
-}
-
-// Case where the uri itself is the directory we're looking for.
-static nsresult getSubsFromURI(const rtl::OString& aUri, nsIEnumerator **aSubs)
-{
- if (aSubs == nsnull) { return NS_ERROR_NULL_POINTER ; }
- *aSubs = nsnull ;
- nsresult retCode = NS_OK ;
-
- nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &retCode)) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsCOMPtr<nsIRDFResource> rdfResource ;
-
- retCode = rdfService->GetResource(nsDependentCString(aUri.getStr(),aUri.getLength()), getter_AddRefs(rdfResource)) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- retCode = rdfService->UnregisterResource(rdfResource) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-
- nsCOMPtr<nsIAbDirectory> directory = do_QueryInterface(rdfResource, &retCode) ;
-
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsAutoString nameAB ;
-
- nameAB.AssignWithConversion("LDAP Directory") ;
- directory->SetDirName(nameAB.get()) ;
- nsCOMPtr<nsISupportsArray> array ;
-
- NS_NewISupportsArray(getter_AddRefs(array)) ;
- array->AppendElement(directory) ;
- array->Enumerate(aSubs) ;
- return retCode ;
-}
-
-namespace
-{
- static void lcl_setNoAddressBookFoundError( ErrorDescriptor& _rError, OConnection& _rCon, MozillaProductType _eProductType,
- sal_Bool bGivenURI )
- {
- sal_uInt16 nAddressBookNameRes = 0;
- if ( !bGivenURI && _eProductType == MozillaProductType_Mozilla)
- {
- nAddressBookNameRes = STR_MOZILLA_ADDRESSBOOKS;
- }
- else
- {
- if ( _eProductType == MozillaProductType_Thunderbird )
- {
- nAddressBookNameRes = STR_THUNDERBIRD_ADDRESSBOOKS;
- }
- else
- {
- if ( _rCon.usesFactory() )
- {
- if ( _rCon.isOutlookExpress() )
- {
- nAddressBookNameRes = STR_OE_ADDRESSBOOK;
- }
- else
- {
- nAddressBookNameRes = STR_OUTLOOK_MAPI_ADDRESSBOOK;
- }
- }
- else
- {
- OSL_ENSURE( !_rCon.isLDAP(), "lcl_setNoAddressBookFoundError: not to be called for LDAP connections!" );
- nAddressBookNameRes = STR_MOZILLA_ADDRESSBOOKS;
- }
- }
- }
- _rError.set( 0, ErrorCondition::AB_ADDRESSBOOK_NOT_FOUND, _rCon.getResources().getResourceString( nAddressBookNameRes ) );
- }
-}
-
-nsresult getTableStringsProxied(const sal_Char* sAbURI, sal_Int32 *nDirectoryType,MNameMapper *nmap,
- ::std::vector< ::rtl::OUString >* _rStrings,
- ::std::vector< ::rtl::OUString >* _rTypes,
- sal_Int32* pErrorId )
-{
- if (!sAbURI || !nmap || !_rStrings || !_rTypes || !pErrorId)
- {
- return NS_ERROR_NULL_POINTER;
- }
- OSL_TRACE("Using URI %s to getTables()\n",sAbURI );
-
- // Get the mozilla addressbooks from the base directory.
- nsresult rv = NS_OK;
- nsCOMPtr<nsIEnumerator> subDirectories;
-
- switch(*nDirectoryType)
- {
- case SDBCAddress::Mozilla:
- rv = getSubsFromParent(sAbURI, getter_AddRefs(subDirectories)) ;
- break;
- case SDBCAddress::Outlook:
- case SDBCAddress::OutlookExp:
- rv = getSubsFromFactory(sAbURI, getter_AddRefs(subDirectories)) ;
- break;
- case SDBCAddress::LDAP:
- rv = getSubsFromURI(sAbURI, getter_AddRefs(subDirectories)) ;
- break;
- default:
- rv = getSubsFromParent(sAbURI, getter_AddRefs(subDirectories));
- }
- NS_ENSURE_SUCCESS(rv, rv);
-
- // At this point we have a list containing the nsIAbDirectory we need to map as tables
- rv = subDirectories -> First();
- NS_ENSURE_SUCCESS(rv, rv);
-
- PRUnichar *name = nsnull;
- PRBool bIsMailList = PR_FALSE;
-
- ::rtl::OUString aTableName;
- nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &rv)) ;
- NS_ENSURE_SUCCESS(rv, rv) ;
-
- nmap->reset();
- do {
- nsCOMPtr<nsIAbDirectory> subDirectory;
-
- nsCOMPtr<nsISupports> item;
- rv = subDirectories -> CurrentItem(getter_AddRefs(item));
- if ( NS_FAILED( rv ) )
- {
- *pErrorId = STR_COULD_NOT_RETRIEVE_AB_ENTRY;
- return NS_ERROR_FAILURE;
- }
-
- subDirectory = do_QueryInterface(item, &rv);
-
- subDirectory -> GetIsMailList(&bIsMailList);
- // For now we're not interested in mailing lists.
- rv = subDirectory -> GetDirName(&name);
- if ( NS_FAILED( rv ) ) {
- *pErrorId = STR_COULD_NOT_GET_DIRECTORY_NAME;
- return NS_ERROR_FAILURE;
- }
- MTypeConverter::prUnicharToOUString(name, aTableName);
- OSL_TRACE("TableName = >%s<\n", OUtoCStr( aTableName ) );
-
- ODatabaseMetaDataResultSet::ORow aRow(3);
-
- // Insert table into map
- if ( aTableName.getLength() == 0 )
- aTableName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AddressBook"));
-
- OSL_TRACE("TableName = >%s<\n", OUtoCStr( aTableName ) );
-
- rv = nmap->add( aTableName, subDirectory);
- nsCOMPtr<nsIRDFResource> rdfResource = do_QueryInterface(subDirectory, &rv) ;
- if (!NS_FAILED(rv))
- rdfService->UnregisterResource(rdfResource);
-
- if (!NS_FAILED(rv)) //failed means we have added this directory
- {
- //map mailing lists as views
- _rStrings->push_back( aTableName ); // Table name
- if (!bIsMailList) {
- ::rtl::OUString aTableType(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TABLE")));
- _rTypes->push_back( aTableType ); // Table type
- }
- else
- {
- ::rtl::OUString aTableType(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VIEW")));
- _rTypes->push_back( aTableType ); // Table type
- }
- }
- rv = subDirectories -> Next();
- } while ( rv == NS_OK);
-
- return( NS_OK );
-}
-sal_Bool MDatabaseMetaDataHelper::getTableStrings( OConnection* _pCon,
- ::std::vector< ::rtl::OUString >& _rStrings,
- ::std::vector< ::rtl::OUString >& _rTypes)
-{
- sal_Bool bGivenURI;
- ::rtl::OUString sAbURI;
- ::rtl::OString sAbURIString;
-
- OSL_TRACE( "IN MDatabaseMetaDataHelper::getTableStrings( 0x%08X, %s)\n", _pCon, _pCon->getForceLoadTables()?"True":"False" );
-
- ::osl::MutexGuard aGuard( m_aMetaMutex );
- // Only do the query if we have to - performance degrades otherwise
- if ( ! _pCon->getForceLoadTables() && m_aTableNames.size() > 0 ) {
- _rStrings = m_aTableNames;
- _rTypes = m_aTableTypes;
- return( sal_True );
- }
-
- m_aTableNames.clear();
- m_aTableTypes.clear();
-
- sAbURI = _pCon->getMozURI();
-
- OSL_TRACE("AbURI = %s\n", OUtoCStr( sAbURI ) );
- if ( sAbURI.getLength() == 0 )
- bGivenURI = sal_False;
- else {
- sAbURIString = ::rtl::OUStringToOString( sAbURI,
- RTL_TEXTENCODING_ASCII_US);
- bGivenURI = sal_True;
- }
-
- if ( bGivenURI )
- OSL_TRACE("Using URI %s to getTables()\n", sAbURIString.getStr() );
- else
- OSL_TRACE("Using URI of ROOTDIR to getTables()\n");
-
- // Get the mozilla addressbooks from the base directory.
- nsresult rv = NS_OK;
- nsCOMPtr<nsIEnumerator> subDirectories;
- sal_Int32 nDirectoryType=0;
- m_ProductType = MozillaProductType_Mozilla;
- m_ProfileName = _pCon->getMozProfile();
-
-
- if (_pCon->isThunderbird())
- {
- if (!bGivenURI)
- sAbURIString = s_pADDRESSBOOKROOTDIR;
- nDirectoryType = SDBCAddress::ThunderBird;
- m_ProductType = MozillaProductType_Thunderbird;
- }
- else if (!bGivenURI)
- {
- sAbURIString = s_pADDRESSBOOKROOTDIR;
- nDirectoryType = SDBCAddress::Mozilla;
- }
- else
- {
- if (_pCon->usesFactory())
- {
- nDirectoryType = SDBCAddress::Outlook;
- }
- else
- {
- if (_pCon->isLDAP())
- {
- nDirectoryType = SDBCAddress::LDAP;
- }
- else
- {
- sAbURIString = s_pADDRESSBOOKROOTDIR;
- nDirectoryType = SDBCAddress::Mozilla;
- }
- }
- }
-
- if ( !_pCon->isLDAP() && !m_bProfileExists )
- { // no need to boot up a Mozilla profile for an LDAP connection
- Reference<XMozillaBootstrap> xMozillaBootstrap;
- Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory();
- OSL_ENSURE( xFactory.is(), "can't get service factory" );
- Reference<XInterface> xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
- xMozillaBootstrap = Reference<XMozillaBootstrap>(xInstance,UNO_QUERY);
- m_bProfileExists = sal_False;
- //If there are no profiles for this product
- //Or the given profile name does not found
- //We will reaise a "No Addressbook Directories Exist" error
- if ( xMozillaBootstrap->getProfileCount(m_ProductType) == 0 ||
- ( m_ProfileName.getLength() && !(xMozillaBootstrap->getProfilePath(m_ProductType,m_ProfileName).getLength())))
- m_bProfileExists = sal_False;
- else
- if (xMozillaBootstrap->bootupProfile(m_ProductType,m_ProfileName) > 0)
- m_bProfileExists = sal_True;
-
- }
- if ( !m_bProfileExists
- && !_pCon->isLDAP()
- && ( ( nDirectoryType == SDBCAddress::Mozilla )
- || ( nDirectoryType == SDBCAddress::ThunderBird )
- )
- )
- {
- lcl_setNoAddressBookFoundError( m_aError, *_pCon, m_ProductType, bGivenURI );
- return sal_False;
- }
-
- MNameMapper *nmap = _pCon->getNameMapper();
- nmap->reset();
-
- sal_Int32 nErrorResourceId( 0 );
-
- MNSMozabProxy xMProxy;
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_GET_TABLE_STRINGS;
- args.argCount = 6;
- args.arg1 = (void*)sAbURIString.getStr();
- args.arg2 = (void*)&nDirectoryType;
- args.arg3 = (void*)nmap;
- args.arg4 = (void*)&m_aTableNames;
- args.arg5 = (void*)&m_aTableTypes;
- args.arg6 = (void*)&nErrorResourceId;
- rv = xMProxy.StartProxy(&args,m_ProductType,m_ProfileName);
- m_aError.setResId( static_cast<sal_uInt16>(nErrorResourceId) );
-
- if (NS_FAILED(rv))
- {
- if ( nErrorResourceId == 0 )
- m_aError.setResId( STR_UNSPECIFIED_ERROR );
- return sal_False;
- }
- OSL_TRACE( "\tOUT MDatabaseMetaDataHelper::getTableStrings()\n" );
- _rStrings = m_aTableNames;
- _rTypes = m_aTableTypes;
-
- _pCon->setForceLoadTables(sal_False);
- return( sal_True );
-}
-
-sal_Bool MDatabaseMetaDataHelper::getTables( OConnection* _pCon,
- const ::rtl::OUString& tableNamePattern,
- const Sequence< ::rtl::OUString >& types,
- ODatabaseMetaDataResultSet::ORows& _rRows)
-{
-
- static ODatabaseMetaDataResultSet::ORows aRows;
-
- OSL_TRACE( "IN MDatabaseMetaDataHelper::getTables()\n" );
- ::osl::MutexGuard aGuard( m_aMetaMutex );
-
- ODatabaseMetaDataResultSet::ORows().swap(aRows); // this makes real clear where memory is freed as well
- aRows.clear();
-
- ::std::vector< ::rtl::OUString > tables;
- ::std::vector< ::rtl::OUString > tabletypes;
- ::rtl::OUString matchAny = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%"));;
-
- if ( !getTableStrings( _pCon, tables,tabletypes ) )
- return sal_False;
-
- for ( size_t i = 0; i < tables.size(); i++ ) {
- ODatabaseMetaDataResultSet::ORow aRow(3);
-
- ::rtl::OUString aTableName = tables[i];
- ::rtl::OUString aTableType = tabletypes[i];
- OSL_TRACE("TableName = >%s<\n", OUtoCStr( aTableName ) );
-
-
- // return tables to caller
- if (match( tableNamePattern, aTableName, '\0' ) &&
- ( 0 == types.getLength() || //types is null or types include aTableType or types include "%"
- 0 != ::comphelper::findValue( types, aTableType, sal_True ).getLength() ||
- 0 != ::comphelper::findValue( types, matchAny, sal_True ).getLength())) {
- if ( aTableName.getLength() == 0 ) {
- aTableName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AddressBook"));
- }
-
- OSL_TRACE( "TableName = %s ; TableType = %s\n", OUtoCStr(aTableName), OUtoCStr(aTableType) );
-
- aRow.push_back( new ORowSetValueDecorator( aTableName ) ); // Table name
- aRow.push_back( new ORowSetValueDecorator( aTableType ) ); // Table type
- aRow.push_back( ODatabaseMetaDataResultSet::getEmptyValue() ); // Remarks
- aRows.push_back(aRow);
- }
- }
-
- OSL_TRACE( "\tOUT MDatabaseMetaDataHelper::getTables()\n" );
- _rRows = aRows;
- return(sal_True);
-}
-
-
-sal_Bool
-MDatabaseMetaDataHelper::testLDAPConnection( OConnection* _pCon )
-{
- const sal_Unicode QUERY_CHAR = '?';
- const sal_Char* MOZ_SCHEMA = "moz-abldapdirectory://";
- const sal_Char* LDAP_SCHEMA = "ldap://";
-
- rtl::OString sAbURI;
- rtl::OUString sAbBindDN;
- rtl::OUString sAbPassword;
- sal_Bool useSSL = _pCon->getUseSSL();
-
- nsresult rv(0);
-
- sAbURI = OUStringToOString( _pCon->getMozURI(), RTL_TEXTENCODING_ASCII_US );
- sAbBindDN = _pCon->getBindDN();
- sAbPassword = _pCon->getPassword();
-
-
- sal_Int32 pos = sAbURI.indexOf( MOZ_SCHEMA );
- if ( pos != -1 ) {
- sAbURI = sAbURI.replaceAt (pos, rtl_str_getLength( MOZ_SCHEMA ), ::rtl::OString(LDAP_SCHEMA) );
- }
-
- pos = sAbURI.indexOf( QUERY_CHAR );
- if ( pos != -1 ) {
- sal_Int32 len = sAbURI.getLength();
- sAbURI = sAbURI.replaceAt( pos, len - pos, ::rtl::OString("") );
- }
- const sal_Unicode* bindDN=nsnull;
- if (sAbBindDN.getLength() != 0)
- {
- bindDN = sAbBindDN.getStr();
- }
-
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_TESTLDAP_INIT_LDAP;
- args.argCount = 4;
- args.arg1 = (void*)sAbURI.getStr();
- args.arg2 = (void*)bindDN;
- args.arg3 = (void*)sAbPassword.getStr();
- args.arg4 = (void*)&useSSL;
-
- MNSMozabProxy xMProxy;
- rv = xMProxy.StartProxy( &args, m_ProductType, ::rtl::OUString() );
- if ( NS_SUCCEEDED( rv ) ) //Init LDAP,pass OUString() to StarProxy to ignore profile switch
- {
- args.funcIndex = ProxiedFunc::FUNC_TESTLDAP_IS_LDAP_CONNECTED;
- TimeValue timeValue = { 1, 0 }; // 1 * 30 Seconds timeout
- sal_Int32 times=0;
- while ( times++ < 30 )
- {
- rv = xMProxy.StartProxy( &args, m_ProductType, ::rtl::OUString() );
- if ( NS_SUCCEEDED( rv ) )
- // connected successfully
- break;
-
- if ( rv == (nsresult)PR_NOT_CONNECTED_ERROR )
- // connection failed
- break;
-
- // not yet decided - continue waiting
- osl_waitThread( &timeValue );
- }
- }
- m_aError.setResId( STR_COULD_NOT_CONNECT_LDAP );
- return NS_SUCCEEDED( rv ) ? sal_True : sal_False;
-}
-
-sal_Bool MDatabaseMetaDataHelper::NewAddressBook(OConnection* _pCon,const ::rtl::OUString & aTableName)
-{
- sal_Bool bIsMozillaAB;
-
- bIsMozillaAB = !_pCon->usesFactory() && ! _pCon->isLDAP();
-
- if ( !bIsMozillaAB )
- {
- m_aError.setResId( STR_NO_TABLE_CREATION_SUPPORT );
- return sal_False;
- }
- else
- OSL_TRACE("Create table\n");
-
- // Get the mozilla addressbooks from the base directory.
- nsresult rv = NS_OK;
-
- MNSMozabProxy xMProxy;
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_NEW_ADDRESS_BOOK;
- args.argCount = 1;
- args.arg1 = (void*)&aTableName;
- rv = xMProxy.StartProxy(&args,m_ProductType,m_ProfileName);
-
- _pCon->setForceLoadTables(sal_True); //force reload table next time
- if (rv == NS_ERROR_FILE_IS_LOCKED)
- {
- m_aError.setResId( STR_MOZILLA_IS_RUNNING );
- }
- else if (NS_FAILED(rv))
- {
- m_aError.set( STR_COULD_NOT_CREATE_ADDRESSBOOK, 0, ::rtl::OUString::valueOf( sal_Int32(rv), 16 ) );
- }
- OSL_TRACE( "OUT MDatabaseMetaDataHelper::NewAddressBook()\n" );
- return( NS_SUCCEEDED(rv) ? sal_True : sal_False );
-}
-nsresult NewAddressBook(const ::rtl::OUString * aName)
-{
- if (isProfileLocked(NULL))
- return NS_ERROR_FILE_IS_LOCKED;
- nsresult rv;
- nsCOMPtr<nsIAbDirectoryProperties> aProperties = do_CreateInstance(NS_ABDIRECTORYPROPERTIES_CONTRACTID, &rv);
- NS_ENSURE_ARG_POINTER(aProperties);
- const ::rtl::OUString& uName = *aName;
- nsString nsName;
- MTypeConverter::ouStringToNsString(uName,nsName);
- aProperties->SetDescription(nsName);
-
- nsCOMPtr<nsIRDFService> rdfService = do_GetService (kRDFServiceCID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsIRDFResource> parentResource;
- rv = rdfService->GetResource(NS_LITERAL_CSTRING(kAllDirectoryRoot), getter_AddRefs(parentResource));
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsIAbDirectory> parentDir = do_QueryInterface(parentResource, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- rv = parentDir->CreateNewDirectory(aProperties);
- return rv;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx
deleted file mode 100644
index 103903ac36..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MAB_DATABASEMETADATAHELPER_HXX_
-#define _CONNECTIVITY_MAB_DATABASEMETADATAHELPER_HXX_
-
-#include "MErrorResource.hxx"
-#include <comphelper/proparrhlp.hxx>
-#include <comphelper/propertycontainer.hxx>
-#include "FDatabaseMetaDataResultSet.hxx"
-
-#include <MConnection.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/mozilla/MozillaProductType.hpp>
-
-namespace connectivity
-{
- namespace mozab
- {
- class MDatabaseMetaDataHelper
- {
- private:
- sal_Bool m_bProfileExists ;
- ::std::vector< ::rtl::OUString > m_aTableNames;
- ::std::vector< ::rtl::OUString > m_aTableTypes;
- ::com::sun::star::mozilla::MozillaProductType m_ProductType;
- ::rtl::OUString m_ProfileName;
- ErrorDescriptor m_aError;
-
- public:
- MDatabaseMetaDataHelper();
- ~MDatabaseMetaDataHelper();
-
- //
- sal_Bool getTableStrings( OConnection* _pCon,
- ::std::vector< ::rtl::OUString >& _rStrings,
- ::std::vector< ::rtl::OUString >& _rTypes);
-
- sal_Bool getTables( OConnection* _pCon,
- const ::rtl::OUString& tableNamePattern,
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types,
- ODatabaseMetaDataResultSet::ORows& _rRows);
- sal_Bool testLDAPConnection( OConnection* _pCon );
- sal_Bool NewAddressBook( OConnection* _pCon,const ::rtl::OUString & aTableName);
-
- inline const ErrorDescriptor& getError() const { return m_aError; }
- };
- }
-
-}
-#endif // _CONNECTIVITY_MAB_DATABASEMETADATAHELPER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx b/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx
deleted file mode 100644
index d6bfe02b23..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONNECITIVITY_MOZAB_ERROR_RESOURCE_HXX
-#define CONNECITIVITY_MOZAB_ERROR_RESOURCE_HXX
-
-#include <rtl/ustring.hxx>
-
-namespace connectivity
-{
- namespace mozab
- {
- class ErrorDescriptor
- {
- private:
- sal_uInt16 m_nErrorResourceId;
- sal_Int32 m_nErrorCondition;
- ::rtl::OUString m_sParameter;
-
- public:
- ErrorDescriptor()
- :m_nErrorResourceId(0)
- ,m_nErrorCondition(0)
- ,m_sParameter()
- {
- }
-
- inline void set( const sal_uInt16 _nErrorResourceId, const sal_Int32 _nErrorCondition, const ::rtl::OUString& _rParam )
- {
- m_nErrorResourceId = _nErrorResourceId;
- m_nErrorCondition = _nErrorCondition;
- m_sParameter = _rParam;
- }
- inline void setResId( const sal_uInt16 _nErrorResourceId )
- {
- m_nErrorResourceId = _nErrorResourceId;
- }
- inline void reset()
- {
- m_nErrorResourceId = 0;
- m_nErrorCondition = 0;
- }
-
- inline sal_uInt16 getResId() const { return m_nErrorResourceId; }
- inline sal_Int32 getErrorCondition() const { return m_nErrorCondition; }
- inline const ::rtl::OUString& getParameter() const { return m_sParameter; }
-
- inline bool is() const { return ( m_nErrorResourceId != 0 ) || ( m_nErrorCondition != 0 ); }
- };
- }
-}
-
-#endif // CONNECITIVITY_MOZAB_ERROR_RESOURCE_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx
deleted file mode 100644
index 02f580a0f2..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx
+++ /dev/null
@@ -1,453 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <rtl/strbuf.hxx>
- // keep this include at the beginning. Some of the other includes seems to inject a symbol "l" into the
- // global namespace, which leads to a compiler warning in strbuf.hxx, about some parameters named "l"
- // hiding objects "in an outer scope".
-
-#include "MLdapAttributeMap.hxx"
-#include "MTypeConverter.hxx"
-#include "MQueryHelper.hxx"
-
-#include <tools/diagnose_ex.h>
-
-#include <boost/unordered_map.hpp>
-
-//........................................................................
-namespace connectivity { namespace mozab {
-//........................................................................
-
- //====================================================================
- //= helper
- //====================================================================
- namespace
- {
- typedef nsresult (NS_STDCALL nsIAbCard::*CardPropertyGetter)( PRUnichar** aFirstName );
- typedef nsresult (NS_STDCALL nsIAbCard::*CardPropertySetter)( const PRUnichar* aFirstName );
- struct CardPropertyData
- {
- const sal_Char* pLDAPAttributeList;
- CardPropertyGetter PropGetter;
- CardPropertySetter PropSetter;
-
- CardPropertyData()
- :pLDAPAttributeList( NULL )
- ,PropGetter( NULL )
- ,PropSetter( NULL )
- {
- }
- CardPropertyData( const sal_Char* _pLDAPAttributeList, CardPropertyGetter _PropGetter, CardPropertySetter _PropSetter )
- :pLDAPAttributeList( _pLDAPAttributeList )
- ,PropGetter( _PropGetter )
- ,PropSetter( _PropSetter )
- {
- }
- };
-
- typedef ::boost::unordered_map< ::rtl::OString, CardPropertyData, ::rtl::OStringHash > MapPropertiesToAttributes;
-
- #define DEF_CARD_ACCESS( PropertyName ) \
- &nsIAbCard::Get##PropertyName, &nsIAbCard::Set##PropertyName
-
- static const MapPropertiesToAttributes& lcl_getPropertyMap()
- {
- static MapPropertiesToAttributes aMap;
- if ( aMap.empty() )
- {
- struct MapEntry
- {
- const sal_Char* pAsciiPropertyName;
- const sal_Char* pAsciiAttrributeList;
- CardPropertyGetter PropGetter;
- CardPropertySetter PropSetter;
- };
- const MapEntry aEntries[] = {
- { "FirstName", "givenname", DEF_CARD_ACCESS( FirstName ) },
- { "LastName", "sn,surnname", DEF_CARD_ACCESS( LastName ) },
- { "DisplayName", "cn,commonname,displayname", DEF_CARD_ACCESS( DisplayName ) },
- { "NickName", "xmozillanickname", DEF_CARD_ACCESS( NickName ) },
- { "PrimaryEmail", "mail", DEF_CARD_ACCESS( PrimaryEmail ) },
- { "SecondEmail", "xmozillasecondemail", DEF_CARD_ACCESS( SecondEmail ) },
- { "WorkPhone", "telephonenumber", DEF_CARD_ACCESS( WorkPhone ) },
- { "HomePhone", "homephone", DEF_CARD_ACCESS( HomePhone ) },
- { "FaxNumber", "fax,facsimiletelephonenumber", DEF_CARD_ACCESS( FaxNumber ) },
- { "PagerNumber", "pager,pagerphone", DEF_CARD_ACCESS( PagerNumber ) },
- { "CellularNumber", "mobile,cellphone,carphone", DEF_CARD_ACCESS( CellularNumber ) },
- { "HomeAddress", "homepostaladdress,mozillaHomeStreet", DEF_CARD_ACCESS( HomeAddress ) },
- { "HomeAddress2", "mozillaHomeStreet2", DEF_CARD_ACCESS( HomeAddress2 ) },
- { "HomeCity", "homelocality,mozillaHomeLocalityName", DEF_CARD_ACCESS( HomeCity ) },
- { "HomeState", "homeregion,mozillaHomeState", DEF_CARD_ACCESS( HomeState ) },
- { "HomeZipCode", "homepostalcode,mozillaHomePostalCode", DEF_CARD_ACCESS( HomeZipCode ) },
- { "HomeCountry", "homecountryname,mozillaHomeCountryName", DEF_CARD_ACCESS( HomeCountry ) },
- { "WorkAddress", "postofficebox,streetaddress,streetaddress1", DEF_CARD_ACCESS( WorkAddress ) },
- { "WorkAddress2", "streetaddress2", DEF_CARD_ACCESS( WorkAddress2 ) },
- { "WorkCity", "l,locality", DEF_CARD_ACCESS( WorkCity ) },
- { "WorkState", "st,region", DEF_CARD_ACCESS( WorkState ) },
- { "WorkZipCode", "postalcode,zip", DEF_CARD_ACCESS( WorkZipCode ) },
- { "WorkCountry", "countryname", DEF_CARD_ACCESS( WorkCountry ) },
- { "JobTitle", "title", DEF_CARD_ACCESS( JobTitle ) },
- { "Department", "ou,orgunit,department,departmentnumber", DEF_CARD_ACCESS( Department ) },
- { "Company", "o,company", DEF_CARD_ACCESS( Company ) },
- { "WebPage1", "workurl", DEF_CARD_ACCESS( WebPage1 ) },
- { "WebPage2", "homeurl", DEF_CARD_ACCESS( WebPage2 ) },
- { "BirthYear", "birthyear", DEF_CARD_ACCESS( BirthYear ) },
- { "BirthMonth", "birthmonth", DEF_CARD_ACCESS( BirthMonth ) },
- { "BirthYear", "birthday", DEF_CARD_ACCESS( BirthDay ) },
- { "Custom1", "custom1", DEF_CARD_ACCESS( Custom1 ) },
- { "Custom2", "custom2", DEF_CARD_ACCESS( Custom2 ) },
- { "Custom3", "custom3", DEF_CARD_ACCESS( Custom3 ) },
- { "Custom4", "custom4", DEF_CARD_ACCESS( Custom4 ) },
- { "Notes", "notes,description", DEF_CARD_ACCESS( Notes ) },
- { "PreferMailFormat", "xmozillausehtmlmail", NULL, NULL },
- { NULL, NULL, NULL, NULL }
- };
- const MapEntry* loop = aEntries;
- while ( loop->pAsciiPropertyName )
- {
- aMap[ ::rtl::OString( loop->pAsciiPropertyName ) ] =
- CardPropertyData( loop->pAsciiAttrributeList, loop->PropGetter, loop->PropSetter );
- ++loop;
- }
- }
- return aMap;
- }
- }
-
- //====================================================================
- //= AttributeMap_Data
- //====================================================================
- struct AttributeMap_Data
- {
- };
-
- //====================================================================
- //= MLdapAttributeMap
- //====================================================================
- // -------------------------------------------------------------------
- MLdapAttributeMap::MLdapAttributeMap()
- :m_pData( new AttributeMap_Data )
- {
- }
-
- // -------------------------------------------------------------------
- MLdapAttributeMap::~MLdapAttributeMap()
- {
- }
-
- // -------------------------------------------------------------------
- NS_IMPL_THREADSAFE_ISUPPORTS1( MLdapAttributeMap, nsIAbLDAPAttributeMap )
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::GetAttributeList(const nsACString & aProperty, nsACString & _retval)
- {
- ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
-
- const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
- MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
-
- if ( pos == rPropertyMap.end() )
- {
- _retval.SetIsVoid( PR_TRUE );
- }
- else
- {
- MTypeConverter::asciiToNsACString( pos->second.pLDAPAttributeList, _retval );
- }
-
- return NS_OK;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::GetAttributes(const nsACString & aProperty, PRUint32* aCount, char*** aAttrs)
- {
- OSL_FAIL( "MLdapAttributeMap::GetAttributes: not implemented!" );
- (void)aProperty;
- (void)aCount;
- (void)aAttrs;
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::GetFirstAttribute(const nsACString & aProperty, nsACString & _retval)
- {
- ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
-
- const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
- MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
-
- if ( pos == rPropertyMap.end() )
- {
- _retval.SetIsVoid( PR_TRUE );
- }
- else
- {
- sal_Int32 tokenPos(0);
- ::rtl::OString sAttributeList( pos->second.pLDAPAttributeList );
- MTypeConverter::asciiToNsACString( sAttributeList.getToken( 0, ',', tokenPos ).getStr(), _retval );
- }
-
- return NS_OK;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::SetAttributeList(const nsACString & aProperty, const nsACString & aAttributeList, PRBool allowInconsistencies)
- {
- OSL_FAIL( "MLdapAttributeMap::SetAttributeList: not implemented!" );
- (void)aProperty;
- (void)aAttributeList;
- (void)allowInconsistencies;
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::GetProperty(const nsACString & aAttribute, nsACString & _retval)
- {
- OSL_FAIL( "MLdapAttributeMap::GetProperty: not implemented!" );
- (void)aAttribute;
- (void)_retval;
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::GetAllCardAttributes(nsACString & _retval)
- {
- const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
-
- ::rtl::OStringBuffer aAllAttributes;
- for ( MapPropertiesToAttributes::const_iterator loop = rPropertyMap.begin();
- loop != rPropertyMap.end();
- ++loop
- )
- {
- aAllAttributes.append( loop->second.pLDAPAttributeList );
- if ( loop != rPropertyMap.end() )
- aAllAttributes.append( ',' );
- }
-
- MTypeConverter::asciiToNsACString( aAllAttributes.getStr(), _retval );
- return NS_OK;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::CheckState(void)
- {
- // we do not allow modifying the map, so we're always in a valid state
- return NS_OK;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::SetFromPrefs(const nsACString & aPrefBranchName)
- {
- OSL_FAIL( "MLdapAttributeMap::SetFromPrefs: not implemented!" );
- (void)aPrefBranchName;
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::SetCardPropertiesFromLDAPMessage(nsILDAPMessage* aMessage, nsIAbCard* aCard)
- {
- NS_ENSURE_ARG_POINTER( aMessage );
- NS_ENSURE_ARG_POINTER( aCard );
-
- // in case that's not present in the LDAP message: set the "preferred mail format" to "none"
- aCard->SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
-
- const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
- for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
- prop != rPropertyMap.end();
- ++prop
- )
- {
- // split the list of attributes for the current property
- ::rtl::OString sAttributeList( prop->second.pLDAPAttributeList );
- ::rtl::OString sAttribute;
-
- sal_Int32 tokenPos = 0;
- while ( tokenPos != -1 )
- {
- sAttribute = sAttributeList.getToken( 0, ',', tokenPos );
-
- // retrieve the values for the current attribute
- PRUint32 valueCount = 0;
- PRUnichar** values = NULL;
- nsresult rv = aMessage->GetValues( sAttribute.getStr(), &valueCount, &values );
- if ( NS_FAILED( rv ) )
- // try the next attribute
- continue;
-
- if ( valueCount )
- {
- CardPropertySetter propSetter = prop->second.PropSetter;
- OSL_ENSURE( propSetter,
- "MLdapAttributeMap::SetCardPropertiesFromLDAPMessage: "
- "unexpected: could retrieve an attribute value, but have no setter for it!" );
- if ( propSetter )
- {
- (aCard->*propSetter)( values[0] );
- }
-
- // we're done with this property - no need to handle the remaining attributes which
- // map to it
- break;
- }
- }
- }
- return NS_OK;
- }
-
- // -------------------------------------------------------------------
- namespace
- {
- struct PreferMailFormatType
- {
- const sal_Char* description;
- PRUint32 formatType;
-
- PreferMailFormatType()
- :description( NULL )
- ,formatType( nsIAbPreferMailFormat::unknown )
- {
- }
-
- PreferMailFormatType( const sal_Char* _description, PRUint32 _formatType )
- :description( _description )
- ,formatType( _formatType )
- {
- }
- };
-
- static const PreferMailFormatType* lcl_getMailFormatTypes()
- {
- static const PreferMailFormatType aMailFormatTypes[] =
- {
- PreferMailFormatType( "text/plain", nsIAbPreferMailFormat::plaintext ),
- PreferMailFormatType( "text/html", nsIAbPreferMailFormat::html ),
- PreferMailFormatType( "unknown", nsIAbPreferMailFormat::unknown ),
- PreferMailFormatType()
- };
- return aMailFormatTypes;
- }
- }
-
- // -------------------------------------------------------------------
- void MLdapAttributeMap::fillCardFromResult( nsIAbCard& _card, const MQueryHelperResultEntry& _result )
- {
- _card.SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
-
- ::rtl::OUString resultValue;
-
- const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
- for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
- prop != rPropertyMap.end();
- ++prop
- )
- {
- resultValue = _result.getValue( prop->first );
-
- CardPropertySetter propSetter = prop->second.PropSetter;
- if ( propSetter )
- {
- // PRUnichar != sal_Unicode in mingw
- (_card.*propSetter)( reinterpret_cast_mingw_only<const PRUnichar *>(resultValue.getStr()) );
- }
- else
- {
- if ( prop->first.equals( "PreferMailFormat" ) )
- {
- unsigned int format = nsIAbPreferMailFormat::unknown;
- const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes();
- while ( pMailFormatType->description )
- {
- if ( resultValue.equalsAscii( pMailFormatType->description ) )
- {
- format = pMailFormatType->formatType;
- break;
- }
- ++pMailFormatType;
- }
- _card.SetPreferMailFormat(format);
- }
- else
- OSL_FAIL( "MLdapAttributeMap::fillCardFromResult: unexpected property without default setters!" );
- }
- }
- }
-
- // -------------------------------------------------------------------
- void MLdapAttributeMap::fillResultFromCard( MQueryHelperResultEntry& _result, nsIAbCard& _card )
- {
- nsXPIDLString value;
- ::rtl::OUString resultValue;
-
- const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
- for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
- prop != rPropertyMap.end();
- ++prop
- )
- {
- CardPropertyGetter propGetter = prop->second.PropGetter;
- if ( propGetter )
- {
- (_card.*propGetter)( getter_Copies( value ) );
-
- nsAutoString temp( value );
- MTypeConverter::nsStringToOUString( temp, resultValue );
- }
- else
- {
- if ( prop->first.equals( "PreferMailFormat" ) )
- {
- unsigned int format = nsIAbPreferMailFormat::unknown;
- _card.GetPreferMailFormat( &format );
- const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes();
- while ( pMailFormatType->description )
- {
- if ( format == pMailFormatType->formatType )
- {
- resultValue = ::rtl::OUString::createFromAscii( pMailFormatType->description );
- break;
- }
- ++pMailFormatType;
- }
- }
- else
- OSL_FAIL( "MLdapAttributeMap::fillResultFromCard: unexpected property without default getters!" );
- }
-
- _result.insert( prop->first, resultValue );
- }
- }
-
-//........................................................................
-} } // namespace connectivity::mozab
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx
deleted file mode 100644
index 54461bfc22..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-#ifndef CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
-#define CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
-
-#include <MNSInclude.hxx>
-
-#include <memory>
-
-//........................................................................
-namespace connectivity { namespace mozab {
-//........................................................................
-
- struct AttributeMap_Data;
- class MQueryHelperResultEntry;
-
- //====================================================================
- //= class MLdapAttributeMap
- //====================================================================
- /** implements the nsIAbLDAPAttributeMap interface
-
- Somewhere between Mozilla 1.7.5 and SeaMonkey 1.1.12, the LDAP address book
- implementation was changed to take the attribute mapping (from LDAP attributes
- to address book properties) not directly from the preferences. Instead, this mapping
- is now delivered by a dedicated implementation (supporting the nsIAbLDAPAttributeMap
- interface).
-
- */
- class MLdapAttributeMap : public nsIAbLDAPAttributeMap
- {
- public:
- MLdapAttributeMap();
-
- NS_DECL_ISUPPORTS
- NS_DECL_NSIABLDAPATTRIBUTEMAP
-
- static void fillCardFromResult( nsIAbCard& _card, const MQueryHelperResultEntry& _result );
- static void fillResultFromCard( MQueryHelperResultEntry& _result, nsIAbCard& _card );
-
- protected:
- virtual ~MLdapAttributeMap();
-
- private:
- ::std::auto_ptr< AttributeMap_Data > m_pData;
- };
-
-//........................................................................
-} } // namespace connectivity::mozab
-//........................................................................
-
-#endif // CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSDeclares.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSDeclares.hxx
deleted file mode 100644
index de53040895..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSDeclares.hxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MAB_NS_DECLARES_HXX_
-#define _CONNECTIVITY_MAB_NS_DECLARES_HXX_
-
-#include <sal/types.h>
-
-
-const sal_Int32 RowStates_Normal = 0;
-const sal_Int32 RowStates_Inserted = 1;
-const sal_Int32 RowStates_Updated = 2;
-const sal_Int32 RowStates_Deleted = 4;
-const sal_Int32 RowStates_Error = 32;
-
-namespace connectivity{
- namespace mozab{
- class OConnection;
- }
-}
-sal_Bool isProfileLocked(connectivity::mozab::OConnection* _pCon);
-
-class nsIAbDirectory;
-sal_Int32 getDirectoryType(const nsIAbDirectory* directory);
-
-
-#endif // _CONNECTIVITY_MAB_NS_DECLARES_HXX_ 1
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx
deleted file mode 100644
index 4dd1c511f1..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _CONNECTIVITY_MAB_NS_INCLUDE_HXX_
-#define _CONNECTIVITY_MAB_NS_INCLUDE_HXX_ 1
-
-//
-// Only include Mozilla include files once and using this file...
-//
-
-// moved this here and in first position due to "long l;" unxsoli4 warning
-#include <rtl/ustrbuf.hxx>
-
-#include "pre_include_mozilla.h"
-#if defined __GNUC__
- #pragma GCC system_header
-#endif
-
-#include <nsDebug.h>
-
-#include <nsCOMPtr.h>
-#include <nsISupportsArray.h>
-#include <nsString.h>
-
-#if defined __SUNPRO_CC
-#pragma disable_warn
- // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again
-#endif
-#include <nsMemory.h>
-#include <prtypes.h>
-#include <nsRDFCID.h>
-#include <nsXPIDLString.h>
-#include <nsIRDFService.h>
-#include <nsIRDFResource.h>
-#include <nsReadableUtils.h>
-#include <msgCore.h>
-#include <nsIServiceManager.h>
-#include <nsIAbCard.h>
-#include <nsAbBaseCID.h>
-#include <nsAbAddressCollecter.h>
-#include <nsIPref.h>
-#include <nsIAddrBookSession.h>
-#include <nsIMsgHeaderParser.h>
-#include <nsIAddrBookSession.h>
-#include <nsIAbDirectory.h>
-#include <nsAbDirectoryQuery.h>
-#include <nsIAbDirectoryQuery.h>
-#include <nsIAbDirectoryQueryProxy.h>
-#include <nsIAbDirFactory.h>
-#include <nsIRunnable.h>
-#include <nsIAbLDAPAttributeMap.h>
-#include <nsILDAPMessage.h>
-
-#include <prerr.h>
-
-#include "post_include_mozilla.h"
-
-#endif // _CONNECTIVITY_MAB_NS_INCLUDE_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx
deleted file mode 100644
index 02cdcea1fe..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx
+++ /dev/null
@@ -1,407 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "MNSMozabProxy.hxx"
-
-#include "resource/mozab_res.hrc"
-#include "MDatabaseMetaDataHelper.hxx"
-#include "MQuery.hxx"
-#include <osl/mutex.hxx>
-#include <osl/conditn.hxx>
-
-#include "pre_include_mozilla.h"
-#include <nsIProxyObjectManager.h>
-// More Mozilla includes for LDAP Connection Test
-#include "prprf.h"
-#include "nsILDAPURL.h"
-#include "nsILDAPMessage.h"
-#include "nsILDAPMessageListener.h"
-#include "nsILDAPErrors.h"
-#include "nsILDAPConnection.h"
-#include "nsILDAPOperation.h"
-#include "post_include_mozilla.h"
-#include "MQuery.hxx"
-#include <MQueryHelper.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <unotools/processfactory.hxx>
-#include "com/sun/star/mozilla/XProxyRunner.hpp"
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::mozilla;
-
-
-#define TYPEASSERT(value,type) if (value != type) return !NS_OK;
-
-using namespace connectivity::mozab;
-
-/* Implementation file */
-
-static ::osl::Mutex m_aThreadMutex;
-extern nsresult NewAddressBook(const ::rtl::OUString * aName);
-
-
-MNSMozabProxy::MNSMozabProxy()
-{
- m_Args = NULL;
-#if OSL_DEBUG_LEVEL > 0
- m_oThreadID = osl_getThreadIdentifier(NULL);
-#endif
- acquire();
-}
-
-MNSMozabProxy::~MNSMozabProxy()
-{
-}
-
-sal_Int32 MNSMozabProxy::StartProxy(RunArgs * args,::com::sun::star::mozilla::MozillaProductType aProduct,const ::rtl::OUString &aProfile)
-{
- OSL_TRACE( "IN : MNSMozabProxy::StartProxy() \n" );
- ::osl::MutexGuard aGuard(m_aThreadMutex);
- m_Product = aProduct;
- m_Profile = aProfile;
- m_Args = args;
- if (!xRunner.is())
- {
- Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory();
- OSL_ENSURE( xFactory.is(), "can't get service factory" );
- ::com::sun::star::uno::Reference<XInterface> xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
- xRunner = ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XProxyRunner >(xInstance,UNO_QUERY);
- }
- const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy > aCode(this);
- return xRunner->Run(aCode);
-}
-
-extern nsresult getTableStringsProxied(const sal_Char* sAbURI, sal_Int32 *nDirectoryType,MNameMapper *nmap,
- ::std::vector< ::rtl::OUString >* _rStrings,
- ::std::vector< ::rtl::OUString >* _rTypes,
- sal_Int32* pErrorId );
-
-::com::sun::star::mozilla::MozillaProductType SAL_CALL MNSMozabProxy::getProductType( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_Product;
-}
-::rtl::OUString SAL_CALL MNSMozabProxy::getProfileName( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_Profile;
-}
-
-sal_Int32 SAL_CALL MNSMozabProxy::run( ) throw (::com::sun::star::uno::RuntimeException)
-{
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE( "IN : MNSMozabProxy::Run() Caller thread :%4d \n" , m_oThreadID );
-#else
- OSL_TRACE( "IN : MNSMozabProxy::Run() \n" );
-#endif
- nsresult rv = NS_ERROR_INVALID_ARG;
- if (m_Args == NULL)
- return NS_ERROR_INVALID_ARG;
- switch(m_Args->funcIndex)
- {
- case ProxiedFunc::FUNC_TESTLDAP_INIT_LDAP:
- case ProxiedFunc::FUNC_TESTLDAP_IS_LDAP_CONNECTED:
- case ProxiedFunc::FUNC_TESTLDAP_RELEASE_RESOURCE:
- rv = testLDAPConnection();
- break;
- case ProxiedFunc::FUNC_GET_TABLE_STRINGS:
- rv = getTableStringsProxied((const sal_Char*)m_Args->arg1,
- (sal_Int32 *)m_Args->arg2,
- (MNameMapper *)m_Args->arg3,
- (::std::vector< ::rtl::OUString >*)m_Args->arg4,
- (::std::vector< ::rtl::OUString >*)m_Args->arg5,
- (sal_Int32 *)m_Args->arg6);
- break;
- case ProxiedFunc::FUNC_EXECUTE_QUERY:
- if (m_Args->arg1 && m_Args->arg2)
- {
- rv = ((MQuery*)m_Args->arg1)->executeQueryProxied((OConnection*)m_Args->arg2);
- }
- break;
- case ProxiedFunc::FUNC_QUERYHELPER_CREATE_NEW_CARD:
- case ProxiedFunc::FUNC_QUERYHELPER_DELETE_CARD:
- case ProxiedFunc::FUNC_QUERYHELPER_COMMIT_CARD:
- case ProxiedFunc::FUNC_QUERYHELPER_RESYNC_CARD:
- if (m_Args->arg1)
- {
- rv = QueryHelperStub();
- }
- break;
- case ProxiedFunc::FUNC_NEW_ADDRESS_BOOK:
- if (m_Args->arg1)
- {
- rv = NewAddressBook((const ::rtl::OUString*)m_Args->arg1 );
- }
- break;
- default:
- return NS_ERROR_INVALID_ARG;
- }
- return rv;
-}
-
-nsresult MNSMozabProxy::QueryHelperStub()
-{
- nsresult rv = NS_ERROR_INVALID_ARG;
- MQueryHelper * mHelper=(MQueryHelper*) m_Args->arg1;
- switch(m_Args->funcIndex)
- {
- case ProxiedFunc::FUNC_QUERYHELPER_CREATE_NEW_CARD:
- if (m_Args->arg2 ) //m_Args->arg2 used to return cord number
- {
- *((sal_Int32*)m_Args->arg2) = mHelper->createNewCard();
- rv = NS_OK;
- }
- break;
- case ProxiedFunc::FUNC_QUERYHELPER_DELETE_CARD:
- if (m_Args->arg2 && m_Args->arg3 ) //m_Args->arg2 used to get the cord number
- {
- rv = mHelper->deleteCard(*((sal_Int32*)m_Args->arg2),(nsIAbDirectory*)m_Args->arg3);
- }
- break;
- case ProxiedFunc::FUNC_QUERYHELPER_COMMIT_CARD:
- if (m_Args->arg2 && m_Args->arg3 ) //m_Args->arg2 used to get the cord number
- {
- rv = mHelper->commitCard(*((sal_Int32*)m_Args->arg2),(nsIAbDirectory*)m_Args->arg3);
- }
- break;
- case ProxiedFunc::FUNC_QUERYHELPER_RESYNC_CARD:
- if (m_Args->arg2) //m_Args->arg2 used to get the cord number
- {
- rv = mHelper->resyncRow(*((sal_Int32*)m_Args->arg2));
- }
- break;
- default:
- break;
- }
- return rv;
-}
-//-------------------------------------------------------------------
-
-#define NS_LDAPCONNECTION_CONTRACTID "@mozilla.org/network/ldap-connection;1"
-#define NS_LDAPOPERATION_CONTRACTID "@mozilla.org/network/ldap-operation;1"
-#define NS_LDAPMESSAGE_CONTRACTID "@mozilla.org/network/ldap-message;1"
-#define NS_LDAPURL_CONTRACTID "@mozilla.org/network/ldap-url;1"
-
-namespace connectivity {
- namespace mozab {
- class MLDAPMessageListener : public nsILDAPMessageListener
- {
- NS_DECL_ISUPPORTS
- NS_DECL_NSILDAPMESSAGELISTENER
-
- MLDAPMessageListener();
- virtual ~MLDAPMessageListener();
-
- sal_Bool initialized() const;
- sal_Bool goodConnection() const { return initialized() && m_GoodConnection; }
-
- protected:
-
- ::osl::Mutex m_aMutex;
- ::osl::Condition m_aCondition;
-
- sal_Bool m_IsComplete;
- sal_Bool m_GoodConnection;
-
- void setConnectionStatus( sal_Bool _good );
- };
- }
-}
-
-NS_IMPL_THREADSAFE_ISUPPORTS1(MLDAPMessageListener, nsILDAPMessageListener)
-
-MLDAPMessageListener::MLDAPMessageListener()
- : mRefCnt( 0 )
- , m_IsComplete( sal_False )
- , m_GoodConnection( sal_False )
-{
- m_aCondition.reset();
-}
-
-MLDAPMessageListener::~MLDAPMessageListener()
-{
-}
-
-sal_Bool MLDAPMessageListener::initialized() const
-{
- return const_cast< MLDAPMessageListener* >( this )->m_aCondition.check();
-}
-
-void MLDAPMessageListener::setConnectionStatus( sal_Bool _good )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- m_IsComplete = sal_True;
- m_GoodConnection = _good;
-
- m_aCondition.set();
-}
-
-NS_IMETHODIMP MLDAPMessageListener::OnLDAPInit(nsILDAPConnection* /*aConn*/, nsresult aStatus )
-{
- setConnectionStatus( NS_SUCCEEDED( aStatus ) ? sal_True : sal_False );
- return aStatus;
-}
-
-NS_IMETHODIMP MLDAPMessageListener::OnLDAPMessage( nsILDAPMessage* aMessage )
-{
- nsresult rv;
-
- PRInt32 messageType;
- rv = aMessage->GetType(&messageType);
- NS_ENSURE_SUCCESS(rv, rv);
- PRInt32 errCode;
- switch (messageType)
- {
- case nsILDAPMessage::RES_BIND:
- rv = aMessage->GetErrorCode(&errCode);
- // if the login failed
- if (errCode != (PRInt32)nsILDAPErrors::SUCCESS) {
- setConnectionStatus( sal_False );
- }
- else
- setConnectionStatus( sal_True );
- break;
- case nsILDAPMessage::RES_SEARCH_RESULT:
- setConnectionStatus( sal_True );
- break;
- default:
- break;
- }
-
- return NS_OK;
-}
-
-//-------------------------------------------------------------------
-
-nsresult
-MNSMozabProxy::testLDAPConnection( )
-{
- nsresult rv=NS_ERROR_INVALID_ARG;
- switch(m_Args->funcIndex)
- {
- case ProxiedFunc::FUNC_TESTLDAP_INIT_LDAP:
- if (m_Args->arg1 && m_Args->arg4 )
- {
- rv = InitLDAP((sal_Char*)m_Args->arg1,(sal_Unicode*)m_Args->arg2,(sal_Unicode*)m_Args->arg3,(sal_Bool*)m_Args->arg4);
- }
- break;
- case ProxiedFunc::FUNC_TESTLDAP_IS_LDAP_CONNECTED:
- if (m_Args->arg5)
- {
- const MLDAPMessageListener* pListener( static_cast< const MLDAPMessageListener* >( m_Args->arg5 ) );
- if ( pListener->initialized() )
- rv = pListener->goodConnection() ? 0 : (nsresult)PR_NOT_CONNECTED_ERROR;
- else
- rv = (nsresult)PR_CONNECT_TIMEOUT_ERROR;
- }
- break;
- case ProxiedFunc::FUNC_TESTLDAP_RELEASE_RESOURCE:
- if (m_Args->arg5)
- {
- ((MLDAPMessageListener*)m_Args->arg5)->Release();
- delete (MLDAPMessageListener*)m_Args->arg5;
- m_Args->arg5 = NULL;
- rv = 0;
- }
- break;
- default:
- return NS_ERROR_INVALID_ARG;
- }
- return rv;
-}
-nsresult
-MNSMozabProxy::InitLDAP(sal_Char* sUri, sal_Unicode* sBindDN, sal_Unicode* pPasswd,sal_Bool * nUseSSL)
-{
- sal_Bool useSSL = *nUseSSL;
- nsresult rv;
-
- nsCOMPtr<nsILDAPURL> url;
- url = do_CreateInstance(NS_LDAPURL_CONTRACTID, &rv);
- if ( NS_FAILED(rv) )
- return NS_ERROR_INVALID_ARG;
-
- rv = url->SetSpec( nsDependentCString(sUri) );
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCAutoString host;
- rv = url->GetAsciiHost(host);
- NS_ENSURE_SUCCESS(rv, rv);
-
- PRInt32 port;
- rv = url->GetPort(&port);
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCString dn;
- rv = url->GetDn(dn);
- NS_ENSURE_SUCCESS(rv, rv);
-
-
-
- // Get the ldap connection
- nsCOMPtr<nsILDAPConnection> ldapConnection;
- ldapConnection = do_CreateInstance(NS_LDAPCONNECTION_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- MLDAPMessageListener* messageListener =
- new MLDAPMessageListener ( );
- if (messageListener == NULL)
- return NS_ERROR_INVALID_ARG;
-
- messageListener->AddRef();
-
- nsCAutoString nsBind;
- // PRUnichar != sal_Unicode in mingw
- nsBind.AssignWithConversion(reinterpret_cast_mingw_only<const PRUnichar *>(sBindDN));
-
- // Now lets initialize the LDAP connection properly.
- rv = ldapConnection->Init(host.get(), port, useSSL, nsBind,
- messageListener,NULL,nsILDAPConnection::VERSION3);
- // Initiate the LDAP operation
- nsCOMPtr<nsILDAPOperation> ldapOperation =
- do_CreateInstance(NS_LDAPOPERATION_CONTRACTID, &rv);
-
- rv = ldapOperation->Init(ldapConnection, messageListener, nsnull);
- if (NS_FAILED(rv))
- return NS_ERROR_UNEXPECTED; // this should never happen
-
- if ( pPasswd && *pPasswd )
- {
- nsCAutoString nsPassword;
- // PRUnichar != sal_Unicode in mingw
- nsPassword.AssignWithConversion(reinterpret_cast_mingw_only<const PRUnichar *>(pPasswd));
- rv = ldapOperation->SimpleBind(nsPassword);
- }
-
- if (NS_SUCCEEDED(rv))
- m_Args->arg5 = messageListener;
- return rv;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.hxx
deleted file mode 100644
index 85d6337381..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.hxx
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MAB_MOZABHELPER_HXX_
-#define _CONNECTIVITY_MAB_MOZABHELPER_HXX_
-#include "MNSDeclares.hxx"
-#include <osl/thread.hxx>
-
-#include <MNSInclude.hxx>
-#include <cppuhelper/compbase1.hxx>
-#include <com/sun/star/mozilla/XCodeProxy.hpp>
-#include "com/sun/star/mozilla/XProxyRunner.hdl"
-
-namespace connectivity
-{
- namespace mozab
- {
- namespace ProxiedFunc
- {
- enum
- {
- FUNC_TESTLDAP_INIT_LDAP=1,
- FUNC_TESTLDAP_IS_LDAP_CONNECTED,
- FUNC_TESTLDAP_RELEASE_RESOURCE,
- FUNC_GET_TABLE_STRINGS,
- FUNC_EXECUTE_QUERY,
- FUNC_QUERYHELPER_CREATE_NEW_CARD,
- FUNC_QUERYHELPER_DELETE_CARD,
- FUNC_QUERYHELPER_COMMIT_CARD,
- FUNC_QUERYHELPER_RESYNC_CARD,
- FUNC_NEW_ADDRESS_BOOK
- };
- }
-
- struct RunArgs
- {
- sal_Int32 funcIndex; //Function Index
- sal_Int32 argCount; //parameter count
- void * arg1;
- void * arg2;
- void * arg3;
- void * arg4;
- void * arg5;
- void * arg6;
- RunArgs()
- {
- arg1 = NULL;
- arg2 = NULL;
- arg3 = NULL;
- arg4 = NULL;
- arg5 = NULL;
- arg6 = NULL;
- }
- };
- typedef RunArgs RunArgs;
- typedef ::cppu::WeakImplHelper1< ::com::sun::star::mozilla::XCodeProxy > MNSMozabProxy_BASE;
-
-
- class MNSMozabProxy : public MNSMozabProxy_BASE
- {
- public:
- MNSMozabProxy();
- virtual ~MNSMozabProxy();
-
- //XCodeProxy
- virtual sal_Int32 SAL_CALL run( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::mozilla::MozillaProductType SAL_CALL getProductType( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getProfileName( ) throw (::com::sun::star::uno::RuntimeException);
-
- public:
- sal_Int32 StartProxy(RunArgs * args,::com::sun::star::mozilla::MozillaProductType aProduct,const ::rtl::OUString &aProfile); //Call this to start proxy
-
- protected:
- nsresult testLDAPConnection();
- nsresult InitLDAP(sal_Char* sUri, sal_Unicode* sBindDN, sal_Unicode* sPasswd,sal_Bool * nUseSSL);
- nsresult QueryHelperStub();
- private:
- ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XProxyRunner > xRunner;
-
- RunArgs * m_Args;
- ::com::sun::star::mozilla::MozillaProductType m_Product;
- ::rtl::OUString m_Profile;
-#if OSL_DEBUG_LEVEL > 0
- oslThreadIdentifier m_oThreadID;
-#endif
- };
- }
-}
-#endif //_CONNECTIVITY_MAB_MOZABHELPER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx
deleted file mode 100644
index 6c2a2f5bc2..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <MNSTerminateListener.hxx>
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/frame/XDesktop.hpp>
-#include <MNSInit.hxx>
-
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::frame;
-::com::sun::star::uno::Reference< ::com::sun::star::frame::XTerminateListener> MNSTerminateListener::mxTerminateListener = new MNSTerminateListener();
-
-// -----------------------------------------
-// - MNSTerminateListener -
-// -----------------------------------------
-
-MNSTerminateListener::MNSTerminateListener( )
-{
-}
-
-// -----------------------------------------------------------------------------
-
-MNSTerminateListener::~MNSTerminateListener()
-{
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL MNSTerminateListener::disposing( const EventObject& /*Source*/ ) throw( RuntimeException )
-{
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL MNSTerminateListener::queryTermination( const EventObject& /*aEvent*/ ) throw( TerminationVetoException, RuntimeException )
-{
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL MNSTerminateListener::notifyTermination( const EventObject& /*aEvent*/ ) throw( RuntimeException )
-{
- MNS_Term(sal_True); //Force XPCOM to shutdown
-}
-
-void MNSTerminateListener::addTerminateListener()
-{
- Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() );
-
- if( xFact.is() )
- {
- Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), UNO_QUERY );
-
- if( xDesktop.is() )
- xDesktop->addTerminateListener(mxTerminateListener);
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.hxx
deleted file mode 100644
index 16a27c7702..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.hxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _MNSTERMINATELISTENER_HXX
-#define _MNSTERMINATELISTENER_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/frame/XTerminateListener.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-
-//class to implement the XTerminateListener interface
-class MNSTerminateListener : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XTerminateListener >
-{
-
-private:
-
- // XEventListener
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException );
-
- // XTerminateListener
- virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException );
- virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::uno::RuntimeException );
-
-
-public:
- MNSTerminateListener();
- virtual ~MNSTerminateListener();
-public:
- static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTerminateListener> mxTerminateListener;
- static void addTerminateListener();
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx
deleted file mode 100644
index 38310179d7..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx
+++ /dev/null
@@ -1,143 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-
-#include <MNameMapper.hxx>
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-
-using namespace connectivity::mozab;
-
-bool
-MNameMapper::ltstr::operator()( const ::rtl::OUString &s1, const ::rtl::OUString &s2) const
-{
- return s1.compareTo(s2) < 0;
-}
-
-MNameMapper::MNameMapper()
-{
- mDirMap = new MNameMapper::dirMap;
- mUriMap = new MNameMapper::uriMap;
-}
-MNameMapper::~MNameMapper()
-{
- clear();
-}
-
-void MNameMapper::reset()
-{
- clear();
- mDirMap = new MNameMapper::dirMap;
- mUriMap = new MNameMapper::uriMap;
-}
-void MNameMapper::clear()
-{
- if ( mUriMap != NULL ) {
- delete mUriMap;
- }
- if ( mDirMap != NULL ) {
- MNameMapper::dirMap::iterator iter;
- for (iter = mDirMap -> begin(); iter != mDirMap -> end(); ++iter) {
- NS_IF_RELEASE(((*iter).second));
- }
- delete mDirMap;
- }
-}
-const char * getURI(const nsIAbDirectory* directory)
-{
- nsresult retCode;
- nsCOMPtr<nsIRDFResource> rdfResource = do_QueryInterface((nsISupports *)directory, &retCode) ;
- if (NS_FAILED(retCode)) { return NULL; }
- const char * uri;
- retCode=rdfResource->GetValueConst(&uri);
- if (NS_FAILED(retCode)) { return NULL; }
- return uri;
-}
-
-// May modify the name passed in so that it's unique
-nsresult
-MNameMapper::add( ::rtl::OUString& str, nsIAbDirectory* abook )
-{
- MNameMapper::dirMap::iterator iter;
-
- OSL_TRACE( "IN MNameMapper::add()\n" );
-
- if ( abook == NULL ) {
- OSL_TRACE( "\tOUT MNameMapper::add() called with null abook\n" );
- return NS_ERROR_NULL_POINTER;
- }
-
- ::rtl::OUString ouUri=::rtl::OUString::createFromAscii(getURI(abook));
- if ( mUriMap->find (ouUri) != mUriMap->end() ) //There's already an entry with same uri
- {
- return NS_ERROR_FILE_NOT_FOUND;
- }
- mUriMap->insert( MNameMapper::uriMap::value_type( ouUri, abook ) );
-
- ::rtl::OUString tempStr=str;
- long count =1;
- while ( mDirMap->find( tempStr ) != mDirMap->end() ) {
-
- tempStr = str + ::rtl::OUString::valueOf(count);;
- count ++;
- }
- str = tempStr;
- NS_IF_ADDREF(abook);
- mDirMap->insert( MNameMapper::dirMap::value_type( str, abook ) );
- OSL_TRACE( "\tOUT MNameMapper::add()\n" );
- return 0;
-}
-
-bool
-MNameMapper::getDir( const ::rtl::OUString& str, nsIAbDirectory* *abook )
-{
- MNameMapper::dirMap::iterator iter;
-
- OSL_TRACE( "IN MNameMapper::getDir( %s )\n", OUtoCStr(str)?OUtoCStr(str):"NULL" );
-
- if ( (iter = mDirMap->find( str )) != mDirMap->end() ) {
- *abook = (*iter).second;
- NS_IF_ADDREF(*abook);
- } else {
- *abook = NULL;
- }
-
- OSL_TRACE( "\tOUT MNameMapper::getDir() : %s\n", (*abook)?"True":"False" );
-
- return( (*abook) != NULL );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.hxx
deleted file mode 100644
index 46651383c4..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.hxx
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MAB_NAMEMAPPER_HXX_
-#define _CONNECTIVITY_MAB_NAMEMAPPER_HXX_ 1
-
-#include <map>
-
-// Mozilla includes
-#include <MNSInclude.hxx>
-
-// Star Includes
-#include <rtl/ustring.hxx>
-
-namespace connectivity
-{
- namespace mozab
- {
- class MNameMapper
- {
- private:
-
- struct ltstr
- {
- bool operator()( const ::rtl::OUString &s1, const ::rtl::OUString &s2) const;
- };
-
-
- typedef ::std::multimap< ::rtl::OUString, nsIAbDirectory *, ltstr > dirMap;
- typedef ::std::multimap< ::rtl::OUString, nsIAbDirectory *, ltstr > uriMap;
-
- static MNameMapper *instance;
- dirMap *mDirMap;
- uriMap *mUriMap;
-
- //clear dirs
- void clear();
-
- public:
- static MNameMapper* getInstance();
-
- MNameMapper();
- ~MNameMapper();
-
- // May modify the name passed in so that it's unique
- nsresult add( ::rtl::OUString& str, nsIAbDirectory* abook );
-
- //reset dirs
- void reset();
-
- // Get the directory corresponding to str
- bool getDir( const ::rtl::OUString& str, nsIAbDirectory* *abook );
-
- };
-
- }
-}
-
-#endif //_CONNECTIVITY_MAB_NAMEMAPPER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
deleted file mode 100644
index 1e09198a87..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
+++ /dev/null
@@ -1,826 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <MQueryHelper.hxx>
-#include <MNameMapper.hxx>
-#include <MConnection.hxx>
-#include <connectivity/dbexception.hxx>
-#include "MQuery.hxx"
-#include "MLdapAttributeMap.hxx"
-#include "MTypeConverter.hxx"
-#include "MNSMozabProxy.hxx"
-#include <com/sun/star/uno/Reference.hxx>
-#include <unotools/processfactory.hxx>
-#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
-static NS_DEFINE_CID(kAbDirectoryQueryArgumentsCID, NS_ABDIRECTORYQUERYARGUMENTS_CID);
-static NS_DEFINE_CID(kBooleanConditionStringCID, NS_BOOLEANCONDITIONSTRING_CID);
-static NS_DEFINE_CID(kBooleanExpressionCID, NS_BOOLEANEXPRESSION_CID);
-static NS_DEFINE_CID(kAbDirectoryQueryProxyCID, NS_ABDIRECTORYQUERYPROXY_CID);
-static NS_DEFINE_CID(kAbLDAPAttributeMap, NS_IABLDAPATTRIBUTEMAP_IID);
-
-using namespace connectivity::mozab;
-using namespace connectivity;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbc;
-using namespace connectivity;
-
-// -------------------------------------------------------------------------
-// Used to store an nsIAbDirectoryQuery member without the need to use Mozilla
-// types in the MQuery.hxx file.
-//
-namespace connectivity {
- namespace mozab {
- struct MQueryDirectory {
- nsCOMPtr<nsIAbDirectory> directory;
- nsCOMPtr<nsIAbDirectoryQuery> directoryQuery;
- PRInt32 contextId;
- MQueryDirectory() : contextId(-1) {}
- };
- }
-}
-
-// -------------------------------------------------------------------------
-/*
-MQuery::MQuery()
-{
- OSL_TRACE( "IN MQuery::MQuery()\n" );
-
- construct();
-#if OSL_DEBUG_LEVEL > 0
- m_oThreadID = osl_getThreadIdentifier(NULL);
-#endif
-
- OSL_TRACE( "\tOUT MQuery::MQuery()\n" );
-}
-*/
-// -------------------------------------------------------------------------
-MQuery::MQuery( const OColumnAlias& _ca )
- :m_rColumnAlias( _ca )
-{
- OSL_TRACE( "IN MQuery::MQuery( ca )\n" );
-
- construct();
-
-#if OSL_DEBUG_LEVEL > 0
- m_oThreadID = osl_getThreadIdentifier(NULL);
-#endif
-
- OSL_TRACE( "\tOUT MQuery::MQuery( ca )\n" );
-}
-// -------------------------------------------------------------------------
-MQuery::~MQuery()
-{
- OSL_TRACE("IN MQuery::~MQuery()\n");
-
- // MQueryHelper is reference counted, so we need to decrement the
- // count here.
- //
- if ( m_aQueryDirectory->contextId != -1 && m_aQueryDirectory->directoryQuery !=
- NULL )
- m_aQueryDirectory->directoryQuery->StopQuery(m_aQueryDirectory->contextId);
-
- if ( m_aQueryDirectory )
- delete m_aQueryDirectory;
-
- NS_IF_RELEASE( m_aQueryHelper);
-
- OSL_TRACE("\tOUT MQuery::~MQuery()\n");
-}
-// -----------------------------------------------------------------------------
-void MQuery::construct()
-{
- // Set default values. (For now just as a reminder).
- m_aError.reset();
- m_bQuerySubDirs = sal_True; // LDAP Queryies require this to be set!
- m_nMaxNrOfReturns = -1; // Unlimited number of returns.
-
- m_aQueryDirectory = new MQueryDirectory();
- // MQueryHelper is reference counted, so we need to add to the
- // count here to prevent accidental deletion else where...
- //
- m_aQueryHelper = new MQueryHelper();
- NS_IF_ADDREF( m_aQueryHelper);
-}
-// -------------------------------------------------------------------------
-void MQuery::setAddressbook(::rtl::OUString &ab)
-{
- OSL_TRACE("IN MQuery::setAddressbook()\n");
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_aAddressbook = ab;
-
- OSL_TRACE("\tOUT MQuery::setAddressbook()\n");
-}
-// -------------------------------------------------------------------------
-::rtl::OUString MQuery::getAddressbook() const
-{
- OSL_TRACE("IN MQuery::getAddressbook()\n");
-
- OSL_TRACE("\tOUT MQuery::getAddressbook()\n");
-
- return(m_aAddressbook);
-}
-// -------------------------------------------------------------------------
-void MQuery::setMaxNrOfReturns(const sal_Int32 mnr)
-{
- OSL_TRACE( "IN MQuery::setMaxNrOfReturns()\n" );
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_nMaxNrOfReturns = mnr;
- OSL_TRACE("\tOUT MQuery::setMaxNrOfReturns()\n" );
-}
-// -------------------------------------------------------------------------
-sal_Int32 MQuery::getMaxNrOfReturns() const
-{
- OSL_TRACE("IN MQuery::getMaxNrOfReturns()\n");
-
- OSL_TRACE("\tOUT MQuery::getMaxNrOfReturns()\n");
-
- return(m_nMaxNrOfReturns);
-}
-// -------------------------------------------------------------------------
-void MQuery::setQuerySubDirs(sal_Bool &qsd)
-{
- OSL_TRACE("IN MQuery::setQuerySubDirs()\n");
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_bQuerySubDirs = qsd;
- OSL_TRACE("\tOUT MQuery::setQuerySubDirs()\n");
-}
-// -------------------------------------------------------------------------
-sal_Bool MQuery::getQuerySubDirs() const
-{
- OSL_TRACE("IN MQuery::getQuerySubDirs()\n");
-
- OSL_TRACE("\tOUT MQuery::getQuerySubDirs()\n");
-
- return(m_bQuerySubDirs);
-}
-// -------------------------------------------------------------------------
-void MQuery::setExpression( MQueryExpression &_expr )
-{
- OSL_TRACE("IN MQuery::setExpression()\n");
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_aExpr = _expr;
-
- OSL_TRACE("\tOUT MQuery::setExpression()\n");
-}
-// -------------------------------------------------------------------------
-static sal_Int32 generateExpression( MQuery* _aQuery, MQueryExpression* _aExpr,
- nsIAbBooleanExpression* queryExpression )
-{
- nsresult rv; // Store return values.
- // Array that holds all matchItems, to be passed to DoQuery().
- nsCOMPtr<nsISupportsArray> matchItems;
- NS_NewISupportsArray(getter_AddRefs(matchItems));
-
- // Add every individual boolString to matchItems array.
- nsString matchValue;
- // Initialise the matchItems container.
- MQueryExpression::ExprVector::iterator evIter;
- for( evIter = _aExpr->getExpressions().begin();
- evIter != _aExpr->getExpressions().end();
- ++evIter )
- {
- if ( (*evIter)->isStringExpr() ) {
- nsCOMPtr<nsIAbBooleanConditionString> boolString = do_CreateInstance (kBooleanConditionStringCID, &rv);
- NS_ENSURE_SUCCESS( rv, rv );
-
- MQueryExpressionString* evStr = static_cast<MQueryExpressionString*> (*evIter);
-
- // Set the 'name' property of the boolString.
- // Check if it's an alias first...
- rtl::OString attrName = _aQuery->getColumnAlias().getProgrammaticNameOrFallbackToUTF8Alias( evStr->getName() );
- boolString->SetName( strdup( attrName.getStr() ) );
- OSL_TRACE("Name = %s ;", attrName.getStr() );
- // Set the 'matchType' property of the boolString. Check for equal length.
- sal_Bool requiresValue = sal_True;
- switch(evStr->getCond()) {
- case MQueryOp::Exists:
- OSL_TRACE("MQueryOp::Exists; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::Exists);
- requiresValue = sal_False;
- break;
- case MQueryOp::DoesNotExist:
- OSL_TRACE("MQueryOp::DoesNotExist; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::DoesNotExist);
- requiresValue = sal_False;
- break;
- case MQueryOp::Contains:
- OSL_TRACE("MQueryOp::Contains; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::Contains);
- break;
- case MQueryOp::DoesNotContain:
- OSL_TRACE("MQueryOp::DoesNotContain; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::DoesNotContain);
- break;
- case MQueryOp::Is:
- OSL_TRACE("MQueryOp::Is; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::Is);
- break;
- case MQueryOp::IsNot:
- OSL_TRACE("MQueryOp::IsNot; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::IsNot);
- break;
- case MQueryOp::BeginsWith:
- OSL_TRACE("MQueryOp::BeginsWith; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::BeginsWith);
- break;
- case MQueryOp::EndsWith:
- OSL_TRACE("MQueryOp::EndsWith; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::EndsWith);
- break;
- case MQueryOp::SoundsLike:
- OSL_TRACE("MQueryOp::SoundsLike; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::SoundsLike);
- break;
- case MQueryOp::RegExp:
- OSL_TRACE("MQueryOp::RegExp; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::RegExp);
- break;
- default:
- OSL_TRACE("(default) MQueryOp::Is; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::Is);
- break;
- }
- // Set the 'matchValue' property of the boolString. Value returned in unicode.
- if ( requiresValue )
- {
- OSL_TRACE("Value = %s \n", OUtoCStr( evStr->getValue() ) );
- MTypeConverter::ouStringToNsString( evStr->getValue(), matchValue);
- boolString->SetValue(matchValue.get ());
- }
- // Add the individual boolString to the container of matchItems.
- matchItems->AppendElement(boolString);
- }
- else if ( (*evIter)->isExpr() ) {
- nsCOMPtr< nsIAbBooleanExpression > subQueryExpr = do_CreateInstance( kBooleanExpressionCID , &rv);
- NS_ENSURE_SUCCESS( rv, rv );
- rv = generateExpression( _aQuery, static_cast< MQueryExpression* >(*evIter),
- subQueryExpr );
- NS_ENSURE_SUCCESS( rv, rv );
- matchItems->AppendElement(subQueryExpr);
- }
- else {
- // Should never see this...
- OSL_FAIL("Unknown Expression Type!");
- return( NS_ERROR_UNEXPECTED );
- }
- }
-
- queryExpression->SetExpressions(matchItems);
- if ( _aExpr->getExpressionCondition() == MQueryExpression::AND )
- queryExpression->SetOperation(nsIAbBooleanOperationTypes::AND);
- else
- queryExpression->SetOperation(nsIAbBooleanOperationTypes::OR);
-
- return( NS_OK );
-}
-sal_uInt32 MQuery::InsertLoginInfo(OConnection* _pCon)
-{
- nsresult rv; // Store return values.
-
- rtl::OUString nameAB = _pCon->getHost().replace('.','_');
- rtl::OUString bindDN = _pCon->getBindDN();
- rtl::OUString password = _pCon->getPassword();
- sal_Bool useSSL = _pCon->getUseSSL();
-
- nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- // create the ldap maxHits entry for the preferences file.
- // Note: maxHits is applicable to LDAP only in mozilla.
- nsCAutoString prefName(NS_LITERAL_CSTRING("ldap_2.servers."));
- const char *pAddressBook = MTypeConverter::ouStringToCCharStringAscii(nameAB.getStr());
- prefName.Append(pAddressBook);
-
- if (bindDN.getLength())
- {
- nsCAutoString bindPrefName=prefName;
- bindPrefName.Append(NS_LITERAL_CSTRING(".auth.dn"));
- rv = prefs->SetCharPref (bindPrefName.get(),
- MTypeConverter::ouStringToCCharStringAscii( bindDN.getStr() ) );
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCAutoString pwdPrefName=prefName;
- pwdPrefName.Append(NS_LITERAL_CSTRING(".auth.pwd"));
- rv = prefs->SetCharPref (pwdPrefName.get(),
- MTypeConverter::ouStringToCCharStringAscii( password.getStr() ) );
- NS_ENSURE_SUCCESS(rv, rv);
- }
- if (useSSL)
- {
- nsCAutoString sslPrefName=prefName;
- sslPrefName.Append(NS_LITERAL_CSTRING(".UseSSL"));
- rv = prefs->SetBoolPref (sslPrefName.get(),useSSL);
- NS_ENSURE_SUCCESS(rv, rv);
- }
- return rv;
-}
-
-//determine whether current profile is locked,any error will lead to return true
-sal_Bool isProfileLocked(OConnection* _pCon)
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XMozillaBootstrap > xMozillaBootstrap;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
- OSL_ENSURE( xFactory.is(), "can't get service factory" );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
- xMozillaBootstrap = ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XMozillaBootstrap >(xInstance,::com::sun::star::uno::UNO_QUERY);
- if (_pCon)
- return xMozillaBootstrap->isProfileLocked(_pCon->getProduct(),_pCon->getMozProfile());
- else
- return xMozillaBootstrap->isCurrentProfileLocked();
-}
-
-
-// -------------------------------------------------------------------------
-sal_Int32 getDirectoryType(const nsIAbDirectory* directory)
-{
- nsresult retCode;
- nsCOMPtr<nsIRDFResource> rdfResource = do_QueryInterface((nsISupports *)directory, &retCode) ;
- if (NS_FAILED(retCode)) { return SDBCAddress::Unknown; }
- const char * uri;
- retCode=rdfResource->GetValueConst(&uri);
- if (NS_FAILED(retCode)) { return SDBCAddress::Unknown; }
- const sal_Char *sUriPrefix = ::connectivity::mozab::getSchemeURI( ::connectivity::mozab::SCHEME_LDAP );
- if (strncmp(uri,sUriPrefix,strlen(sUriPrefix)) == 0)
- {
- return SDBCAddress::LDAP;
- }
- sUriPrefix = ::connectivity::mozab::getSchemeURI( ::connectivity::mozab::SCHEME_MOZILLA );
- if (strncmp(uri,sUriPrefix,strlen(sUriPrefix)) == 0)
- {
- return SDBCAddress::Mozilla;
- }
- sUriPrefix = ::connectivity::mozab::getSchemeURI( ::connectivity::mozab::SCHEME_MOZILLA_MDB );
- if (strncmp(uri,sUriPrefix,strlen(sUriPrefix)) == 0)
- {
- return SDBCAddress::Mozilla;
- }
- sUriPrefix = ::connectivity::mozab::getSchemeURI( ::connectivity::mozab::SCHEME_OUTLOOK_EXPRESS );
- if (strncmp(uri,sUriPrefix,strlen(sUriPrefix)) == 0)
- {
- return SDBCAddress::OutlookExp;
- }
- sUriPrefix = ::connectivity::mozab::getSchemeURI( ::connectivity::mozab::SCHEME_OUTLOOK_MAPI );
- if (strncmp(uri,sUriPrefix,strlen(sUriPrefix)) == 0)
- {
- return SDBCAddress::Outlook;
- }
- return SDBCAddress::Unknown;
-
-}
-// -------------------------------------------------------------------------
-sal_Bool isForceQueryProxyUsed(const nsIAbDirectory* directory)
-{
- sal_Int32 nType = getDirectoryType(directory);
- if (nType == SDBCAddress::Outlook || nType == SDBCAddress::OutlookExp)
- return sal_True;
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 MQuery::commitRow(const sal_Int32 rowIndex)
-{
- if (!m_aQueryHelper || !m_aQueryDirectory || !m_aQueryDirectory->directoryQuery)
- return sal_False;
- MNSMozabProxy xMProxy;
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_QUERYHELPER_COMMIT_CARD;
- args.argCount = 3;
- args.arg1 = (void*)m_aQueryHelper;
- args.arg2 = (void*)&rowIndex;
- args.arg3 = (void*)m_aQueryDirectory->directory;
- nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile);
- m_aError = m_aQueryHelper->getError();
- return rv;
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 MQuery::deleteRow(const sal_Int32 rowIndex)
-{
- if (!m_aQueryHelper || !m_aQueryDirectory || !m_aQueryDirectory->directoryQuery)
- return sal_False;
- MNSMozabProxy xMProxy;
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_QUERYHELPER_DELETE_CARD;
- args.argCount = 3;
- args.arg1 = (void*)m_aQueryHelper;
- args.arg2 = (void*)&rowIndex;
- args.arg3 = (void*)m_aQueryDirectory->directory;
- nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile);
- m_aError = m_aQueryHelper->getError();
- return rv;
-
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 MQuery::executeQuery(OConnection* _pCon)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- OSL_TRACE("IN MQuery::executeQuery()\n");
- m_Product = _pCon->getProduct();
- m_Profile = _pCon->getMozProfile();
-
- nsresult rv;
- MNSMozabProxy xMProxy;
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_EXECUTE_QUERY;
- args.argCount = 2;
- args.arg1 = (void*)this;
- args.arg2 = (void*)_pCon;
- rv = xMProxy.StartProxy(&args,m_Product,m_Profile);
- return rv;
-}
-// -------------------------------------------------------------------------
-sal_Int32 MQuery::executeQueryProxied(OConnection* _pCon)
-{
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE("IN MQuery::executeQueryProxied() Caller thread: %4d \n", m_oThreadID);
-#endif
-
- nsresult rv; // Store return values.
- // MTypeConverter aTypeConverter;
- // Create a nsIAbDirectory object to initialise the nsIAbDirectoryQuery object.
- nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &rv)) ;
- if (NS_FAILED(rv))
- return(-1);
-
- nsCOMPtr<nsIAbDirectory> directory;
- MNameMapper *nmap = _pCon->getNameMapper();
-
-
- if ( nmap->getDir( m_aAddressbook, getter_AddRefs( directory ) ) == sal_False )
- return( -1 );
-
-
- //insert ldap bind info to mozilla profile(in memery,none saved),so we can use it in mozilla part codes
- if (_pCon->isLDAP())
- {
- rv = InsertLoginInfo(_pCon);
- NS_ENSURE_SUCCESS(rv, rv);
-
- }
- // Since Outlook Express and Outlook in OCL mode support a very limited query capability,
- // we use the following bool to judge whether we need bypass any use of a DirectoryQuery
- // interface and instead force the use of the QueryProxy.
- sal_Bool forceQueryProxyUse = isForceQueryProxyUsed(directory);
-
- m_aQueryDirectory->directory = directory;
- // Initialize directory in cases of LDAP and Mozilla
- if (!forceQueryProxyUse) m_aQueryDirectory->directoryQuery = do_QueryInterface(directory, &rv);
-
- if ( NS_FAILED(rv) || forceQueryProxyUse)
- {
- // Create a nsIAbDirectoryQuery object which eventually will execute
- // the query by calling DoQuery().
- nsCOMPtr< nsIAbDirectoryQueryProxy > directoryQueryProxy = do_CreateInstance( kAbDirectoryQueryProxyCID, &rv);
-
- // Need to turn this off for anything using the Query Proxy since it
- // treats Mailing Lists as directories!
-
- m_bQuerySubDirs = sal_False;
-
- rv = directoryQueryProxy->Initiate (directory);
- NS_ENSURE_SUCCESS(rv, rv);
-
- m_aQueryDirectory->directoryQuery = do_QueryInterface (directoryQueryProxy, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
- OSL_TRACE("Using the directoryQueryProxy\n");
- }
-#if OSL_DEBUG_LEVEL > 0
- else
- OSL_TRACE("Not using a Query Proxy, Query i/f supported by directory\n");
-#endif /* OSL_DEBUG_LEVEL */
-
- /*
- // The problem here is that an LDAP Address Book may exist as
- // a Mozilla Address Book. So we need to limit the number of
- // records returned by the Server:
- // 1. Determine if this is an LDAP Address Book
- // [LDAP overrides the default operations(write|read|search) of all types with search only].
- // 2. Determine if the limit is already set by us.
- // 3. Use the mozilla preferences to see if this value is set.
- // 4. Use value or else default to 100.
- */
- PRBool isWriteable;
- rv = directory->GetOperations (&isWriteable);
- NS_ENSURE_SUCCESS(rv, rv);
- if (!(isWriteable & nsIAbDirectory::opWrite))
- {
- if(m_nMaxNrOfReturns == -1)
- {
- // Determine if the limit maxHits has been set in the mozilla preferences
- // if set, then use the value otherwise default to 100
- nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- // create the ldap maxHits entry for the preferences file.
- // Note: maxHits is applicable to LDAP only in mozilla.
- nsCAutoString prefName(NS_LITERAL_CSTRING("ldap_2.servers."));
- const char *pAddressBook = MTypeConverter::ouStringToCCharStringAscii(m_aAddressbook);
- prefName.Append(pAddressBook);
- prefName.Append(NS_LITERAL_CSTRING(".maxHits"));
-
- PRInt32 maxHits;
- rv = prefs->GetIntPref(prefName.get(), &maxHits);
- if (NS_FAILED(rv))
- m_nMaxNrOfReturns = 100;
- else
- m_nMaxNrOfReturns = maxHits;
- }
- }
-
-
- nsCOMPtr< nsIAbBooleanExpression > queryExpression = do_CreateInstance( kBooleanExpressionCID , &rv);
- NS_ENSURE_SUCCESS( rv, rv );
- rv = generateExpression( this, &m_aExpr, queryExpression );
- NS_ENSURE_SUCCESS( rv, rv );
-
- // Use the nsIAbCard to return the card properties.
- const char *returnProperties[] = {"card:nsIAbCard"};
- PRInt32 count=1;
-
- nsCOMPtr< nsIAbDirectoryQueryArguments > arguments = do_CreateInstance( kAbDirectoryQueryArgumentsCID, &rv);
- NS_ENSURE_SUCCESS( rv, rv );
-
- rv = arguments->SetExpression(queryExpression);
- NS_ENSURE_SUCCESS( rv, rv );
-
- rv = arguments->SetReturnProperties(count, returnProperties);
- NS_ENSURE_SUCCESS( rv, rv );
-
- rv = arguments->SetQuerySubDirectories(m_bQuerySubDirs);
- NS_ENSURE_SUCCESS( rv, rv );
-
- nsCOMPtr< nsIAbLDAPAttributeMap > attributeMap( new MLdapAttributeMap );
- rv = arguments->SetTypeSpecificArg( attributeMap );
- NS_ENSURE_SUCCESS( rv, rv );
-
- // Execute the query.
- OSL_TRACE( "****** calling DoQuery\n");
-
- m_aError.reset();
-
- m_aQueryHelper->reset();
-
- rv = m_aQueryDirectory->directoryQuery->DoQuery(arguments, m_aQueryHelper, m_nMaxNrOfReturns, -1, &m_aQueryDirectory->contextId);
-
-
- if (NS_FAILED(rv)) {
- m_aQueryDirectory->contextId = -1;
- OSL_TRACE( "****** DoQuery failed\n");
- OSL_TRACE("\tOUT MQuery::executeQueryProxied()\n");
- m_aQueryHelper->notifyQueryError() ;
- return(-1);
- }
-#if OSL_DEBUG_LEVEL > 0
- else {
- OSL_TRACE( "****** DoQuery succeeded \n");
- }
-#endif
-
- OSL_TRACE("\tOUT MQuery::executeQueryProxied()\n");
-
- return(0);
-}
-
-// -------------------------------------------------------------------------
-//
-//
-// If the query executed is being done asynchronously then this may return
-// -1 as the count, ie. it's undetermined.
-//
-sal_Int32
-MQuery::getRowCount()
-{
- return( m_aQueryHelper->getResultCount() );
-}
-
-// -------------------------------------------------------------------------
-//
-//
-// As opposed to getRowCount() this returns the actual number of rows fetched
-// so far (if is an async query)
-//
-sal_uInt32
-MQuery::getRealRowCount()
-{
- return( m_aQueryHelper->getRealCount() );
-}
-
-//
-// If the query executed is being done asynchronously then this may be
-// false
-//
-sal_Bool
-MQuery::queryComplete( void )
-{
- return( hadError() || m_aQueryHelper->queryComplete() );
-}
-
-sal_Bool
-MQuery::waitForQueryComplete( void )
-{
- if( m_aQueryHelper->waitForQueryComplete( ) )
- return sal_True;
- m_aError = m_aQueryHelper->getError();
- return( sal_False );
-}
-
-// -------------------------------------------------------------------------
-
-sal_Bool
-MQuery::checkRowAvailable( sal_Int32 nDBRow )
-{
- while( !queryComplete() && m_aQueryHelper->getRealCount() <= (sal_uInt32)nDBRow )
- if ( !m_aQueryHelper->waitForRow( nDBRow ) ) {
- m_aError = m_aQueryHelper->getError();
- return( sal_False );
- }
-
- return( getRowCount() > nDBRow );
-}
-// -------------------------------------------------------------------------
-sal_Bool
-MQuery::setRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString& aDBColumnName, sal_Int32 nType ) const
-{
- MQueryHelperResultEntry* xResEntry = m_aQueryHelper->getByIndex( nDBRow );
-
- OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL");
- if (xResEntry == NULL )
- {
- const_cast< MQuery* >( this )->m_aError = m_aQueryHelper->getError();
- return sal_False;
- }
- switch ( nType )
- {
- case DataType::VARCHAR:
- xResEntry->setValue( m_rColumnAlias.getProgrammaticNameOrFallbackToUTF8Alias( aDBColumnName ), rValue.getString() );
- break;
- default:
- OSL_FAIL( "invalid data type!" );
- break;
- }
-
- return sal_True;
-}
-
-// -------------------------------------------------------------------------
-sal_Bool
-MQuery::getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString& aDBColumnName, sal_Int32 nType ) const
-{
- MQueryHelperResultEntry* xResEntry = m_aQueryHelper->getByIndex( nDBRow );
-
- OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL");
- if (xResEntry == NULL )
- {
- const_cast< MQuery* >( this )->m_aError = m_aQueryHelper->getError();
- rValue.setNull();
- return sal_False;
- }
- switch ( nType )
- {
- case DataType::VARCHAR:
- rValue = xResEntry->getValue( m_rColumnAlias.getProgrammaticNameOrFallbackToUTF8Alias( aDBColumnName ) );
- break;
-
- default:
- rValue.setNull();
- break;
- }
-
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Int32
-MQuery::getRowStates(sal_Int32 nDBRow)
-{
- MQueryHelperResultEntry* xResEntry = m_aQueryHelper->getByIndex( nDBRow );
-
- OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL");
- if (xResEntry == NULL )
- {
- m_aError = m_aQueryHelper->getError();
- return RowStates_Error;
- }
- return xResEntry->getRowStates();
-}
-sal_Bool
-MQuery::setRowStates(sal_Int32 nDBRow,sal_Int32 aState)
-{
- MQueryHelperResultEntry* xResEntry = m_aQueryHelper->getByIndex( nDBRow );
-
- OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL");
- if (xResEntry == NULL )
- {
- m_aError = m_aQueryHelper->getError();
- return sal_False;
- }
- return xResEntry->setRowStates(aState);
-}
-
-sal_Bool
-MQuery::resyncRow(sal_Int32 nDBRow)
-{
- MNSMozabProxy xMProxy;
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_QUERYHELPER_RESYNC_CARD;
- args.argCount = 2;
- args.arg1 = (void*)m_aQueryHelper;
- args.arg2 = (void*)&nDBRow;
- nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile);
- m_aError = m_aQueryHelper->getError();
- return NS_SUCCEEDED( rv ) ? sal_True : sal_False;
-}
-
-sal_Int32
-MQuery::createNewCard()
-{
- sal_Int32 nNumber = 0;
- MNSMozabProxy xMProxy;
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_QUERYHELPER_CREATE_NEW_CARD;
- args.argCount = 2;
- args.arg1 = (void*)m_aQueryHelper;
- args.arg2 = (void*)&nNumber;
- nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile);
-
- m_aError = m_aQueryHelper->getError();
- NS_ENSURE_SUCCESS(rv,0);
- return nNumber;
-}
-// -------------------------------------------------------------------------
-
-MNameMapper*
-MQuery::CreateNameMapper()
-{
- return( new MNameMapper() );
-}
-
-// -------------------------------------------------------------------------
-void
-MQuery::FreeNameMapper( MNameMapper* _ptr )
-{
- delete _ptr;
-}
-// -------------------------------------------------------------------------
-sal_Bool MQuery::isWritable(OConnection* _pCon)
-{
- if ( !m_aQueryDirectory )
- return sal_False;
-
- nsresult rv; // Store return values.
- nsCOMPtr<nsIAbDirectory> directory = do_QueryInterface(m_aQueryDirectory->directory, &rv);;
- if (NS_FAILED(rv))
- return sal_False;
- if (getDirectoryType(directory) == SDBCAddress::Mozilla && isProfileLocked(_pCon))
- return sal_False;
-
- PRBool isWriteable;
- rv = directory->GetOperations (&isWriteable);
- if (NS_FAILED(rv))
- return sal_False;
- sal_Bool bWritable = ( isWriteable & nsIAbDirectory::opWrite ) == nsIAbDirectory::opWrite;
- return bWritable;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
deleted file mode 100644
index 0495bf3cd6..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
+++ /dev/null
@@ -1,282 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#ifndef _CONNECTIVITY_MAB_QUERY_HXX_
-#define _CONNECTIVITY_MAB_QUERY_HXX_
-
-#include "MColumnAlias.hxx"
-#include "MErrorResource.hxx"
-#include <connectivity/FValue.hxx>
-#include "MNSDeclares.hxx"
-#include <osl/thread.hxx>
-#include <com/sun/star/mozilla/MozillaProductType.hpp>
-
-namespace connectivity
-{
- namespace mozab
- {
-
- class MQueryHelper;
- struct MQueryDirectory;
-
- namespace MQueryOp {
- typedef enum {
- Exists = 0,
- DoesNotExist = 1,
- Contains = 2,
- DoesNotContain = 3,
- Is = 4,
- IsNot = 5,
- BeginsWith = 6,
- EndsWith = 7,
- SoundsLike = 8,
- RegExp = 9
- } cond_type;
- }
-
- class MQueryExpressionBase {
- public:
- typedef enum {
- Unknown,
- StringExpr,
- Expr
- } node_type;
-
- protected:
- node_type m_eNodeType;
-
- MQueryExpressionBase() : m_eNodeType( Unknown ) {}
- MQueryExpressionBase( node_type _eNodeType ) : m_eNodeType( _eNodeType ) {}
-
- public:
- sal_Bool isUnknown( ) const { return m_eNodeType == Unknown; }
- sal_Bool isStringExpr( ) const { return m_eNodeType == StringExpr; }
- sal_Bool isExpr( ) const { return m_eNodeType == Expr; }
- };
-
- class MQueryExpressionString : public MQueryExpressionBase {
- protected:
- ::rtl::OUString m_aName; // LHS
- MQueryOp::cond_type m_aBooleanCondition;
- ::rtl::OUString m_aValue; // RHS
-
- public:
-
- MQueryExpressionString( ::rtl::OUString& lhs,
- MQueryOp::cond_type cond,
- ::rtl::OUString rhs )
- : MQueryExpressionBase( MQueryExpressionBase::StringExpr )
- , m_aName( lhs )
- , m_aBooleanCondition( cond )
- , m_aValue( rhs )
- {
- }
-
- MQueryExpressionString( ::rtl::OUString& lhs,
- MQueryOp::cond_type cond )
- : MQueryExpressionBase( MQueryExpressionBase::StringExpr )
- , m_aName( lhs )
- , m_aBooleanCondition( cond )
- , m_aValue( ::rtl::OUString() )
- {
- }
-
- const ::rtl::OUString& getName() const { return m_aName; }
- MQueryOp::cond_type getCond() const { return m_aBooleanCondition; }
- const ::rtl::OUString& getValue() const { return m_aValue; }
- };
-
- class MQuery;
-
- class MQueryExpression : public MQueryExpressionBase
- {
- friend class MQuery;
-
- public:
- typedef ::std::vector< MQueryExpressionBase* > ExprVector;
-
- typedef enum {
- AND,
- OR
- } bool_cond;
-
- void setExpressions( ExprVector& _exprVector )
- { m_aExprVector = _exprVector; }
-
- // All expressions on a peer level use same condition operator
- void setExpressionCondition( bool_cond _cond )
- { m_aExprCondType = _cond; }
-
- ExprVector& getExpressions( )
- { return m_aExprVector; }
-
- // All expressions on a peer level use same condition operator
- bool_cond getExpressionCondition( ) const
- { return m_aExprCondType; }
-
- MQueryExpression() : MQueryExpressionBase( MQueryExpressionBase::Expr ),
- m_aExprCondType( OR )
- { m_aExprVector.clear(); }
-
-
- protected:
- ExprVector m_aExprVector;
- bool_cond m_aExprCondType;
-
- };
-
-
- class MQuery
- {
- /*
- * A query resultset with a maximum limit of
- * m_nMaxNrOfReturns return items, is created from
- * the following SQL statement:
- *
- * -------------------------------------------------
- * SELECT m_aAttributes FROM m_aAddressbook
- * WHERE m_aMatchItems SQL_OPR m_aMatchValue
- * -------------------------------------------------
- *
- * We are\are not, depending on boolean m_bQuerySubDirs,
- * interested in querying the sub-directories of the
- * addressbook directory, if any.
- *
- * SQL_OPR:
- * m_aSqlOppr contains the SQL operations for every
- * attribute in m_aAttributes.
- * This member must be initialised together with
- * m_aAttributes.
- *
- * The SQL operations defined for 'SQL_OPR' are:
- * matchExists = 0,
- * matchDoesNotExist = 1,
- * matchContains = 2,
- * matchDoesNotContain = 3,
- * matchIs = 4,
- * matchIsNot = 5,
- * matchBeginsWith = 6,
- * matchEndsWith = 7,
- * matchSoundsLike = 8,
- * matchRegExp = 9.
- * There must be mapping to one of these values.
- *
- * The following members MUST be initialised before
- * a query is executed:
- * m_Attributes, m_aMapAttrOppr, m_aAddressbook,
- * m_aMatchItems and m_aMatchValue.
- *
- * m_bQuerySubDirs and m_nMaxNrReturns are set to a
- * default value in the constructor which can be
- * overridden. If (element of) m_aSqlOppr is not set,
- * the default SQL operation is 'matchIs'.
- *
- */
- private:
- MQueryDirectory *m_aQueryDirectory;
- MQueryHelper *m_aQueryHelper;
- ::rtl::OUString m_aAddressbook;
- sal_Int32 m_nMaxNrOfReturns;
- sal_Bool m_bQuerySubDirs;
- MQueryExpression m_aExpr;
- const OColumnAlias& m_rColumnAlias;
- ::com::sun::star::mozilla::MozillaProductType
- m_Product;
- ::rtl::OUString m_Profile;
- ErrorDescriptor m_aError;
-
- void construct();
- protected:
- ::osl::Mutex m_aMutex;
-#if OSL_DEBUG_LEVEL > 0
- oslThreadIdentifier m_oThreadID;
-#endif
-
- public:
- /*
- * - Contains accessors to the members of this class.
- * - executeQuery() initiates a non-blocking query.
- */
- sal_Int32 executeQuery(OConnection* _pCon);
- sal_Int32 executeQueryProxied(OConnection* _pCon); //Used only by MNSMozabProxy
-
- sal_Int32 createNewCard(); //return Row count number
- sal_Int32 deleteRow(const sal_Int32 rowIndex);
- sal_Int32 commitRow(const sal_Int32 rowIndex);
- sal_Bool resyncRow(sal_Int32 nDBRow);
-
- sal_Bool isWritable(OConnection* _pCon);
-
- sal_uInt32 InsertLoginInfo(OConnection* _pCon);
-
- void setAddressbook( ::rtl::OUString&);
- ::rtl::OUString getAddressbook(void) const;
-
- const OColumnAlias& getColumnAlias() const { return m_rColumnAlias; }
-
- void setExpression( MQueryExpression &_expr );
-
- void setMaxNrOfReturns( const sal_Int32);
- sal_Int32 getMaxNrOfReturns(void) const;
-
- void setQuerySubDirs( sal_Bool&);
- sal_Bool getQuerySubDirs(void) const;
-
- sal_Int32 getRowCount( void );
- sal_uInt32 getRealRowCount( void );
- sal_Bool queryComplete( void );
- sal_Bool waitForQueryComplete( void );
- sal_Bool checkRowAvailable( sal_Int32 nDBRow );
- sal_Bool getRowValue( connectivity::ORowSetValue& rValue,
- sal_Int32 nDBRow,
- const rtl::OUString& aDBColumnName,
- sal_Int32 nType ) const;
- sal_Bool setRowValue( connectivity::ORowSetValue& rValue,
- sal_Int32 nDBRow,
- const rtl::OUString& aDBColumnName,
- sal_Int32 nType ) const;
- sal_Int32 getRowStates(sal_Int32 nDBRow);
- sal_Bool setRowStates(sal_Int32 nDBRow,sal_Int32 aState);
-
- bool hadError() const { return m_aError.is(); }
- inline const ErrorDescriptor& getError() const { return m_aError; }
-
- public:
-// MQuery();
- MQuery( const OColumnAlias& _ca );
- virtual ~MQuery();
- static MNameMapper* CreateNameMapper();
- static void FreeNameMapper( MNameMapper* _ptr );
- };
- }
-}
-
-#endif // _CONNECTIVITY_MAB_QUERY_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx
deleted file mode 100644
index 4ea4daf8fa..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx
+++ /dev/null
@@ -1,637 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MQueryHelper.hxx"
-#include "MTypeConverter.hxx"
-#include "MConnection.hxx"
-#include "MNSDeclares.hxx"
-#include "MLdapAttributeMap.hxx"
-
-#include <connectivity/dbexception.hxx>
-
-#include "resource/mozab_res.hrc"
-
-using namespace connectivity::mozab;
-
-
-NS_IMPL_THREADSAFE_ISUPPORTS1(connectivity::mozab::MQueryHelper,nsIAbDirectoryQueryResultListener)
-
-//
-// class MQueryHelperResultEntry
-//
-
-
-MQueryHelperResultEntry::MQueryHelperResultEntry()
-{
- m_Card = NULL;
- m_RowStates = 0;
-}
-
-MQueryHelperResultEntry::~MQueryHelperResultEntry()
-{
- OSL_TRACE("IN MQueryHelperResultEntry::~MQueryHelperResultEntry()\n");
- OSL_TRACE("OUT MQueryHelperResultEntry::~MQueryHelperResultEntry()\n");
-
-}
-void
-MQueryHelperResultEntry::setCard(nsIAbCard *card)
-{
- m_Card = card;
-}
-nsIAbCard *
-MQueryHelperResultEntry::getCard()
-{
- return m_Card;
-}
-void MQueryHelperResultEntry::insert( const rtl::OString &key, rtl::OUString &value )
-{
- m_Fields[ key ] = value;
-}
-
-rtl::OUString MQueryHelperResultEntry::getValue( const rtl::OString &key ) const
-{
- FieldMap::const_iterator iter = m_Fields.find( key );
- if ( iter == m_Fields.end() )
- {
- return rtl::OUString();
- }
- else
- {
- return iter->second;
- }
-}
-
-void MQueryHelperResultEntry::setValue( const rtl::OString &key, const rtl::OUString & rValue)
-{
- m_Fields[ key ] = rValue;
-}
-//
-// class MQueryHelper
-//
-MQueryHelper::MQueryHelper()
- :m_nIndex( 0 )
- ,m_bHasMore( sal_True )
- ,m_bAtEnd( sal_False )
- ,m_bErrorCondition( sal_False )
- ,m_bQueryComplete( sal_False )
- ,mRefCnt( 0 ) // NSISUPPORTS - Initialize RefCnt to 0
-{
- m_aResults.clear();
-#if OSL_DEBUG_LEVEL > 0
- m_oThreadID = osl_getThreadIdentifier(NULL);
-#endif
-}
-
-MQueryHelper::~MQueryHelper()
-{
- OSL_TRACE("IN MQueryHelper::~MQueryHelper()\n");
- clear_results();
- OSL_TRACE("OUT MQueryHelper::~MQueryHelper()\n");
-}
-
-void
-MQueryHelper::append(MQueryHelperResultEntry* resEnt )
-{
- if ( resEnt != NULL ) {
- m_aResults.push_back( resEnt );
- m_bAtEnd = sal_False;
- }
-}
-
-void
-MQueryHelper::clear_results()
-{
- resultsArray::iterator iter = m_aResults.begin();
- while ( iter != m_aResults.end() ) {
- delete (*iter);
- ++iter;
- }
- m_aResults.clear();
-}
-
-void
-MQueryHelper::rewind()
-{
- m_nIndex = 0;
-}
-
-void
-MQueryHelper::reset()
-{
- m_nIndex = 0;
- m_bHasMore = sal_True;
- m_bQueryComplete = sal_False;
- m_bAtEnd = sal_False;
- m_bErrorCondition = sal_False;
- clear_results();
-}
-
-void
-MQueryHelper::clearResultOrComplete()
-{
- // Don't use a Mutex, it should be called by a method already holding it.
- OSL_TRACE("In/Out : clearResultOrComplete()");
- m_aCondition.reset();
-}
-
-void
-MQueryHelper::notifyResultOrComplete()
-{
- OSL_TRACE("In/Out : notifyResultOrComplete()");
- m_aCondition.set();
-}
-
-sal_Bool
-MQueryHelper::waitForResultOrComplete( )
-{
- TimeValue timeValue = { 1, 0 }; // 20 Seconds 0 NanoSecond timeout
- sal_Int32 times=0;
- osl::Condition::Result rv = ::osl::Condition::result_ok;
-
- OSL_TRACE("In : waitForResultOrComplete()");
- // Can't hold mutex or condition would never get set...
- while( (m_aCondition.check() == sal_False || rv == ::osl::Condition::result_error) && times < 20) {
- rv = m_aCondition.wait( &timeValue );
- times ++;
- }
- if (times >= 20 && rv == ::osl::Condition::result_timeout ) {
- OSL_TRACE("waitForResultOrComplete() : Timeout!");
- m_aError.setResId( STR_TIMEOUT_WAITING );
- return sal_False;
- }
-
- if ( isError() ) {
- OSL_TRACE("waitForResultOrComplete() : Error returned!");
- m_aError.setResId( STR_ERR_EXECUTING_QUERY );
- return sal_False;
- }
- m_aError.reset();
- OSL_TRACE(" Out : waitForResultOrComplete()");
- return sal_True;
-}
-
-
-MQueryHelperResultEntry*
-MQueryHelper::next( )
-{
- MQueryHelperResultEntry* result;
- sal_Int32 index;
-
- m_aMutex.acquire();
- index = m_nIndex;
- m_aMutex.release();
-
- result = getByIndex( index + 1) ; // Add 1 as Row is numbered from 1 to N
-
- if ( result ) {
- m_aMutex.acquire();
- m_nIndex++;
- m_aMutex.release();
- }
-
- return( result );
-}
-
-MQueryHelperResultEntry*
-MQueryHelper::getByIndex( sal_uInt32 nRow )
-{
- // Row numbers are from 1 to N, need to ensure this, and then
- // substract 1
- if ( nRow < 1 ) {
- return( NULL );
- }
-
- do {
- // Obtain the Mutex - don't use a guard as we want to be able to release
- // and acquire again...
- m_aMutex.acquire();
- if ( nRow > m_aResults.size() )
- {
- if ( m_bQueryComplete )
- {
- m_bAtEnd = sal_True;
- m_aMutex.release();
- return( NULL );
- }
- else
- {
- clearResultOrComplete();
- m_aMutex.release();
- if ( !waitForResultOrComplete( ) )
- return( NULL );
- }
- }
- else
- {
- m_aMutex.release();
- return( m_aResults[ nRow -1 ] );
- }
- } while ( sal_True );
-}
-
-sal_Bool
-MQueryHelper::hasMore() const
-{
- return m_bHasMore;
-}
-
-sal_Bool
-MQueryHelper::atEnd() const
-{
- return m_bAtEnd;
-}
-
-sal_Bool
-MQueryHelper::isError() const
-{
- return m_bErrorCondition;
-}
-
-sal_Bool
-MQueryHelper::queryComplete() const
-{
- return m_bQueryComplete;
-}
-
-sal_Bool
-MQueryHelper::waitForQueryComplete( )
-{
- m_aMutex.acquire();
-
- OSL_TRACE("In : waitForQueryComplete()");
- if ( ! m_bQueryComplete ) {
- do
- {
- m_aMutex.release();
- clearResultOrComplete();
- if ( !waitForResultOrComplete( ) )
- return( sal_False );
- m_aMutex.acquire();
- }
- while ( !m_bQueryComplete );
- }
-
- m_aMutex.release();
- OSL_TRACE("Out : waitForQueryComplete()");
- return( sal_True );
-}
-
-sal_Bool
-MQueryHelper::waitForRow( sal_Int32 rowNum )
-{
- m_aMutex.acquire();
- do
- {
- m_aMutex.release();
- clearResultOrComplete();
- if ( !waitForResultOrComplete() )
- return( sal_False );
- m_aMutex.acquire();
- }
- while ( !m_bQueryComplete && m_aResults.size() < (size_t)rowNum );
-
- m_aMutex.release();
- return( sal_True );
-}
-
-// -------------------------------------------------------------------------
-
-sal_Int32
-MQueryHelper::getResultCount() const
-{
- OSL_TRACE( "IN MQueryHelper::getResultCount()" );
- if ( !m_bQueryComplete )
- {
- OSL_TRACE( "\tOUT MQueryHelper::getResultCount() = -1\n");
- return -1;
- }
- else
- {
- OSL_TRACE( "\tOUT MQueryHelper::getResultCount() = %d\n", m_aResults.size() );
- return static_cast<sal_Int32>(m_aResults.size());
- }
-}
-
-// -------------------------------------------------------------------------
-
-sal_uInt32
-MQueryHelper::getRealCount() const
-{
- OSL_TRACE( "IN/OUT MQueryHelper::getRealCount() = %d\n", m_aResults.size() );
- return static_cast<sal_Int32>(m_aResults.size());
-}
-
-// -------------------------------------------------------------------------
-NS_IMETHODIMP MQueryHelper::OnQueryItem(nsIAbDirectoryQueryResult *result)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE( "IN MQueryHelper::OnQueryItem() Caller thread: %4d \n",m_oThreadID );
-#endif
- nsresult rv;
- PRInt32 resultType;
-
- if ( result == NULL ) {
- OSL_TRACE("\tresult ptr is NULL\n");
- return NS_OK;
- }
-
- // Get return status of executeQuery() call.
- rv = result -> GetType(&resultType);
- NS_ENSURE_SUCCESS(rv, rv);
-
- // Check for errors of the executeQuery() call.
- switch ( resultType ) {
- case nsIAbDirectoryQueryResult::queryResultError:
- OSL_TRACE("\tresultType == nsIAbDirectoryQueryResult::queryResultError\n");
- m_bQueryComplete = sal_True;
- m_bErrorCondition = sal_True;
- notifyResultOrComplete();
- return NS_OK;
- case nsIAbDirectoryQueryResult::queryResultStopped:
- OSL_TRACE("\tresultType == nsIAbDirectoryQueryResult::queryResultStopped\n");
- m_bQueryComplete = sal_True;
- notifyResultOrComplete();
- return NS_OK;
- case nsIAbDirectoryQueryResult::queryResultComplete:
- OSL_TRACE("\tresultType == nsIAbDirectoryQueryResult::queryResultComplete\n");
- m_bQueryComplete = sal_True;
- notifyResultOrComplete();
- return NS_OK;
- case nsIAbDirectoryQueryResult::queryResultMatch:
- OSL_TRACE("IN MQueryHelper::OnQueryItem --> queryResultMatch\n");
- // Don't return, continues onto rest of method.
- break;
- default:
- OSL_TRACE("\t******** Unexpected : resultType\n");
- m_bQueryComplete = sal_True;
- return NS_OK;
- }
-
- // Initialise an array that holds the resultset of the query.
- nsCOMPtr<nsISupportsArray> properties;
- rv = result -> GetResult(getter_AddRefs (properties));
- NS_ENSURE_SUCCESS(rv, rv);
-
-
- nsCOMPtr<nsISupports> item;
- rv = properties -> GetElementAt(0, getter_AddRefs(item));
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsIAbDirectoryQueryPropertyValue> property(do_QueryInterface(item, &rv));
- NS_ENSURE_SUCCESS(rv, rv);
-
- char *name;
- rv = property -> GetName(&name);
- NS_ENSURE_SUCCESS(rv, rv);
- if ( !strcmp(name,"card:nsIAbCard") )
- {
- nsCOMPtr<nsISupports> cardSupports;
- property->GetValueISupports (getter_AddRefs (cardSupports));
- nsCOMPtr<nsIAbCard> card(do_QueryInterface(cardSupports, &rv));
- NS_ENSURE_SUCCESS(rv, rv);
-
- getCardValues(card);
- }
- nsMemory::Free(name);
-
- OSL_TRACE( "\tOUT MQueryHelper::OnQueryItem()\n" );
-
- notifyResultOrComplete();
-
- return(NS_OK);
-}
-
-// -----------------------------------------------------------------------------
-void MQueryHelper::notifyQueryError()
-{
- m_bQueryComplete = sal_True ;
- notifyResultOrComplete() ;
-}
-
-const char * getAddrURI(const nsIAbDirectory* directory)
-{
- nsresult retCode;
- nsCOMPtr<nsIRDFResource> rdfResource = do_QueryInterface((nsISupports *)directory, &retCode) ;
- if (NS_FAILED(retCode)) { return NULL; }
- const char * uri;
- retCode=rdfResource->GetValueConst(&uri);
- if (NS_FAILED(retCode)) { return NULL; }
- return uri;
- }
-
-#define ENSURE_GETUPDATECARD(x) \
- if (NS_FAILED(retCode)) \
- { \
- OSL_TRACE( x ); \
- return card; \
- }
-static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
-
-//Some address book does not support query uri on card
-//In this case, we can't resync the cards, we just return the old cards
-nsIAbCard * getUpdatedCard( nsIAbCard* card)
-{
- OSL_ENSURE(card != NULL, "getUpdatedCard for NULL");
- nsresult retCode;
- nsCOMPtr<nsIRDFResource> rdfResource = do_QueryInterface((nsISupports *)card, &retCode) ;
- ENSURE_GETUPDATECARD( "IN getUpdatedCard: Card does not support nsIRDFResource\n" );
-
- const char * uri;
- retCode=rdfResource->GetValueConst(&uri);
- ENSURE_GETUPDATECARD( "IN getUpdatedCard: Card does not has a uri\n" );
-
- nsCOMPtr<nsIRDFService> rdfService (do_GetService(kRDFServiceCID, &retCode)) ;
- ENSURE_GETUPDATECARD( "IN getUpdatedCard: Card does not has a uri\n" );
-
- nsCOMPtr<nsIRDFResource> rdfCard;
-
- retCode = rdfService->GetResource(nsDependentCString(uri), getter_AddRefs(rdfCard)) ;
- ENSURE_GETUPDATECARD( "IN getUpdatedCard: Can not get the updated card\n" );
-
- nsCOMPtr<nsIAbCard> aNewCard=do_QueryInterface((nsISupports *)rdfCard, &retCode);
- ENSURE_GETUPDATECARD( "IN getUpdatedCard: Error in get new card\n" );
-
- return aNewCard;
- }
-
-#define ENSURE_MOZAB_PROFILE_NOT_LOOKED(directory) \
- if (getDirectoryType(directory) == SDBCAddress::Mozilla && isProfileLocked(NULL)) \
- { \
- m_aError.setResId( STR_MOZILLA_IS_RUNNIG_NO_CHANGES ); \
- return sal_False; \
- }
-
-sal_Int32 MQueryHelper::commitCard(const sal_Int32 rowIndex,nsIAbDirectory * directory)
-{
- ENSURE_MOZAB_PROFILE_NOT_LOOKED(directory);
-
- MQueryHelperResultEntry *resEntry = getByIndex(rowIndex);
- if (!resEntry)
- {
- return sal_False;
- }
- nsIAbCard *card=resEntry->getCard();
- if (!card)
- {
- return sal_False;
- }
- nsresult rv;
- PRBool hasCard;
- rv = directory->HasCard(card,&hasCard);
- if (setCardValues(rowIndex) != sal_True)
- return sal_False;
-
- if (!NS_FAILED(rv) && hasCard)
- {
- rv = card->EditCardToDatabase(getAddrURI(directory));
- }
- else
- {
- nsIAbCard *addedCard=NULL;
- rv = directory->AddCard(card,&addedCard);
- if (!NS_FAILED(rv))
- resEntry->setCard(addedCard);
- }
- //We return NS_ERROR_FILE_ACCESS_DENIED in the case the mozillaAB has been changed out side of our process
- if (rv == NS_ERROR_FILE_ACCESS_DENIED )
- m_aError.setResId( STR_FOREIGN_PROCESS_CHANGED_AB );
-
- return !(NS_FAILED(rv));
-}
-
-sal_Int32 MQueryHelper::deleteCard(const sal_Int32 rowIndex,nsIAbDirectory * directory)
-{
- ENSURE_MOZAB_PROFILE_NOT_LOOKED(directory);
- MQueryHelperResultEntry *resEntry = getByIndex(rowIndex);
- if (!resEntry)
- {
- return sal_False;
- }
- nsIAbCard *card=resEntry->getCard();
- if (!card)
- {
- return sal_False;
- }
- nsresult rv;
- PRBool hasCard;
- if (resEntry->getRowStates() == RowStates_Inserted)
- {
- rv = 0;
- hasCard = sal_True;
- }
- else
- rv = directory->HasCard(card,&hasCard);
-
- if (!NS_FAILED(rv) && hasCard)
- {
- nsCOMPtr <nsISupportsArray> cardsToDelete;
- rv = NS_NewISupportsArray(getter_AddRefs(cardsToDelete));
- if (NS_SUCCEEDED(rv))
- {
- nsCOMPtr<nsISupports> supports = do_QueryInterface(card, &rv);
- if (NS_SUCCEEDED(rv))
- {
- rv = cardsToDelete->AppendElement(supports);
- if (NS_SUCCEEDED(rv))
- rv = directory->DeleteCards(cardsToDelete);
- }
- }
- }
-
- if (NS_SUCCEEDED(rv))
- resEntry->setRowStates(RowStates_Deleted);
- //We return NS_ERROR_FILE_ACCESS_DENIED in the case the mozillaAB has been changed out side of our process
- if (rv == NS_ERROR_FILE_ACCESS_DENIED )
- m_aError.setResId( STR_FOREIGN_PROCESS_CHANGED_AB );
- return !(NS_FAILED(rv));
-}
-
-sal_Bool MQueryHelper::setCardValues(const sal_Int32 rowIndex)
-{
- MQueryHelperResultEntry *resEntry = getByIndex(rowIndex);
- if (!resEntry)
- {
- m_aError.setResId( STR_CANT_FIND_ROW );
- return sal_False;
- }
- nsIAbCard *card=resEntry->getCard();
- if (!card)
- {
- m_aError.setResId( STR_CANT_FIND_CARD_FOR_ROW );
- return sal_False;
- }
-
- MLdapAttributeMap::fillCardFromResult( *card, *resEntry );
- return sal_True;
-}
-
-void MQueryHelper::getCardValues(nsIAbCard *card,sal_Int32 rowIndex)
-{
- MQueryHelperResultEntry *resEntry;
- if (rowIndex>0)
- {
- resEntry = getByIndex(rowIndex);
- }
- else
- resEntry = new MQueryHelperResultEntry();
-
- MLdapAttributeMap::fillResultFromCard( *resEntry, *card );
- resEntry->setCard(card);
- if (!rowIndex)
- append( resEntry );
-}
-sal_Bool MQueryHelper::resyncRow(sal_Int32 rowIndex)
-{
-
- MQueryHelperResultEntry *resEntry = getByIndex(rowIndex);
- if (!resEntry)
- {
- m_aError.setResId( STR_CANT_FIND_ROW );
- return sal_False;
- }
- nsIAbCard *card=resEntry->getCard();
- card = getUpdatedCard(card);
- getCardValues(card,rowIndex);
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Int32 MQueryHelper::createNewCard()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- nsresult rv;
- nsCOMPtr <nsIAbCard> card = do_CreateInstance(NS_ABCARDPROPERTY_CONTRACTID, &rv);
- //set default values
- getCardValues(card);
- return static_cast<sal_Int32>(m_aResults.size());
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx
deleted file mode 100644
index 3d81453f06..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx
+++ /dev/null
@@ -1,137 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MAB_QUERYHELPER_HXX_
-#define _CONNECTIVITY_MAB_QUERYHELPER_HXX_
-
-#include <MNSInclude.hxx>
-#include "MErrorResource.hxx"
-#include <sal/types.h>
-#include <rtl/ustring.hxx>
-#include <osl/mutex.hxx>
-#include <osl/conditn.hxx>
-#include <comphelper/stl_types.hxx>
-#include <osl/thread.hxx>
-
-#include <boost/unordered_map.hpp>
-
-namespace connectivity
-{
- namespace mozab
- {
- class MQueryHelperResultEntry
- {
- private:
- typedef ::boost::unordered_map< ::rtl::OString, ::rtl::OUString, ::rtl::OStringHash > FieldMap;
-
- mutable ::osl::Mutex m_aMutex;
- FieldMap m_Fields;
- nsCOMPtr<nsIAbCard> m_Card;
- sal_Int32 m_RowStates;
-
- public:
- MQueryHelperResultEntry();
- ~MQueryHelperResultEntry();
-
- void insert( const rtl::OString &key, rtl::OUString &value );
- rtl::OUString getValue( const rtl::OString &key ) const;
- void setValue( const rtl::OString &key, const rtl::OUString & rValue);
-
- void setCard(nsIAbCard *card);
- nsIAbCard *getCard();
- sal_Bool setRowStates(sal_Int32 state){m_RowStates = state; return sal_True;};
- sal_Int32 getRowStates() const { return m_RowStates;};
- };
-
- class MQueryHelper : public nsIAbDirectoryQueryResultListener
- {
- private:
- typedef std::vector< MQueryHelperResultEntry* > resultsArray;
-
- mutable ::osl::Mutex m_aMutex;
- ::osl::Condition m_aCondition;
- resultsArray m_aResults;
- sal_Int32 m_nIndex;
- sal_Bool m_bHasMore;
- sal_Bool m_bAtEnd;
- sal_Bool m_bErrorCondition;
- sal_Bool m_bQueryComplete;
- ErrorDescriptor m_aError;
-
- void append(MQueryHelperResultEntry* resEnt );
-
- void clear_results();
-
- void clearResultOrComplete();
- void notifyResultOrComplete();
- sal_Bool waitForResultOrComplete( );
- void getCardValues(nsIAbCard *card,sal_Int32 rowIndex=0);
-#if OSL_DEBUG_LEVEL > 0
- oslThreadIdentifier m_oThreadID;
-#endif
-
- public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIABDIRECTORYQUERYRESULTLISTENER
-
- MQueryHelper();
- virtual ~MQueryHelper();
-
- void reset();
- void rewind();
-
- MQueryHelperResultEntry* next( );
-
- MQueryHelperResultEntry* getByIndex( sal_uInt32 nRow );
-
- const ErrorDescriptor& getError() const { return m_aError; }
-
- sal_Bool isError() const;
- sal_Bool hasMore() const;
- sal_Bool atEnd() const;
-
- sal_Bool queryComplete() const;
-
- sal_Bool waitForQueryComplete( );
- sal_Bool waitForRow( sal_Int32 rowNum );
-
- sal_Int32 getResultCount() const;
- sal_uInt32 getRealCount() const;
- sal_Int32 createNewCard(); //return Row count number
- sal_Bool resyncRow(sal_Int32 rowIndex);
-
- void notifyQueryError() ;
- sal_Bool setCardValues(const sal_Int32 rowIndex);
- sal_Int32 commitCard(const sal_Int32 rowIndex, nsIAbDirectory * directory);
- sal_Int32 deleteCard(const sal_Int32 rowIndex, nsIAbDirectory * directory);
- };
- }
-}
-#endif // _CONNECTIVITY_MAB_QUERYHELPER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx
deleted file mode 100644
index 42517f5515..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <MNSInclude.hxx>
-#include "MTypeConverter.hxx"
-#include <ucbhelper/content.hxx>
-
-using namespace connectivity::mozab;
-
-// -------------------------------------------------------------------------
-void MTypeConverter::ouStringToNsString(::rtl::OUString const &ous, nsString &nss)
-{
- // Convert to ::rtl::OString (utf-8 encoding).
- ::rtl::OString os(rtl::OUStringToOString(ous, RTL_TEXTENCODING_UTF8));
-
- const char *cs = os.getStr();
- PRUint32 csLen = os.getLength();
-
- NS_ConvertUTF8toUCS2 mozString(cs, csLen);
- //const PRUnichar* uniMozString = (const PRUnichar*) mozString;
- nss = mozString; // temp.
-}
-// -------------------------------------------------------------------------
-::rtl::OUString MTypeConverter::nsACStringToOUString( const nsACString& _source )
-{
- const char* buffer = _source.BeginReading();
- const char* bufferEnd = _source.EndReading();
- return ::rtl::OUString( buffer, static_cast<sal_Int32>(bufferEnd - buffer), RTL_TEXTENCODING_ASCII_US );
-}
-// -------------------------------------------------------------------------
-::rtl::OString MTypeConverter::nsACStringToOString( const nsACString& _source )
-{
- const char* buffer = _source.BeginReading();
- const char* bufferEnd = _source.EndReading();
- return ::rtl::OString( buffer, static_cast<sal_Int32>(bufferEnd - buffer) );
-}
-// -------------------------------------------------------------------------
-void MTypeConverter::asciiOUStringToNsACString( const ::rtl::OUString& _asciiString, nsACString& _dest )
-{
- ::rtl::OString sAsciiVersion( _asciiString.getStr(), _asciiString.getLength(), RTL_TEXTENCODING_ASCII_US );
- asciiToNsACString( sAsciiVersion.getStr(), _dest );
-}
-// -------------------------------------------------------------------------
-void MTypeConverter::asciiToNsACString( const sal_Char* _asciiString, nsACString& _dest )
-{
- _dest.Truncate();
- _dest.AppendASCII( _asciiString );
-}
-// -------------------------------------------------------------------------
-void MTypeConverter::nsStringToOUString(nsString const &nss, ::rtl::OUString &ous)
-{
- // Get clone of buffer.
- PRUnichar *uc = ToNewUnicode(nss);
- sal_Int32 nssLen = nss.Length();
-
- // TODO check if this is ok.
- // PRUnichar != sal_Unicode in mingw
- ::rtl::OUString _ous(reinterpret_cast_mingw_only<sal_Unicode *>(uc), nssLen);
- ous = _ous;
-
- nsMemory::Free(uc);
-}
-// -------------------------------------------------------------------------
-void MTypeConverter::prUnicharToOUString(PRUnichar const *pru, ::rtl::OUString &ous)
-{
- // TODO, specify length.
- // PRUnichar != sal_Unicode in mingw
- ::rtl::OUString _ous(reinterpret_cast_mingw_only<const sal_Unicode *>(pru));
- ous = _ous;
-}
-// -------------------------------------------------------------------------
-char *MTypeConverter::ouStringToCCharStringUtf8(::rtl::OUString const &ous)
-{
- // Convert to ::rtl::OString,
- ::rtl::OString os(rtl::OUStringToOString(ous, RTL_TEXTENCODING_UTF8));
-
- const char *cs = os.getStr();
-
- return(strdup(cs));
-}
-// -------------------------------------------------------------------------
-char *MTypeConverter::ouStringToCCharStringAscii(::rtl::OUString const &ous)
-{
- // Convert ::rtl::OUString to ::rtl::OString,
- ::rtl::OString os(rtl::OUStringToOString(ous, RTL_TEXTENCODING_ASCII_US));
-
- return(strdup(os.getStr()));
-}
-// -------------------------------------------------------------------------
-char *MTypeConverter::nsStringToCCharStringAscii(nsString const &nss)
-{
- char cs[1024];
- nss.ToCString(cs, 1024);
-
- return(strdup(cs));
-}
-// -------------------------------------------------------------------------
-::std::string MTypeConverter::ouStringToStlString(::rtl::OUString const &ous)
-{
- // Convert ::rtl::OUString to ::rtl::OString.
- ::rtl::OString os(rtl::OUStringToOString(ous,RTL_TEXTENCODING_ASCII_US));
- return( ::std::string(os.getStr()));
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx
deleted file mode 100644
index 55c1246d43..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#ifndef _CONNECTIVITY_MAB_TYPECONVERTER_HXX_
-#define _CONNECTIVITY_MAB_TYPECONVERTER_HXX_
-
-#include <rtl/ustring.hxx>
-
-#include<string>
-
-namespace connectivity
-{
- namespace mozab
- {
- class MTypeConverter
- {
- public:
- static void ouStringToNsString(const ::rtl::OUString&, nsString&);
- static void nsStringToOUString(const nsString&, ::rtl::OUString&);
- static void prUnicharToOUString(const PRUnichar*, ::rtl::OUString&);
- // Use free() for the following 3 calls.
- static char *ouStringToCCharStringAscii(const ::rtl::OUString&);
- static char *nsStringToCCharStringAscii(const nsString&);
- static char *ouStringToCCharStringUtf8(const ::rtl::OUString&);
- // Convert to stl-string.
- static ::std::string ouStringToStlString(const ::rtl::OUString&);
- static ::std::string nsStringToStlString(const nsString&);
-
- static ::rtl::OUString nsACStringToOUString( const nsACString& _source );
- static ::rtl::OString nsACStringToOString( const nsACString& _source );
- static void asciiOUStringToNsACString( const ::rtl::OUString& _asciiString, nsACString& _dest );
- static void asciiToNsACString( const sal_Char* _asciiString, nsACString& _dest );
-
- private:
- MTypeConverter() {};
- };
- }
-}
-
-#endif // _CONNECTIVITY_MAB_TYPECONVERTER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
deleted file mode 100755
index 810be9bcb4..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
+++ /dev/null
@@ -1,77 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-CALL_CDECL=TRUE
-
-#mozilla specific stuff.
-MOZ_LIB=$(SOLARVERSION)$/$(INPATH)$/lib$(UPDMINOREXT)
-MOZ_INC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla
-#End of mozilla specific stuff.
-
-PRJ=..$/..$/..$/..
-PRJINC=..$/..$/..
-PRJNAME=connectivity
-TARGET=mozabsrc
-
-# --- Settings ----------------------------------
-
-USE_DEFFILE=TRUE
-ENABLE_EXCEPTIONS=TRUE
-VISIBILITY_HIDDEN=TRUE
-
-.INCLUDE : settings.mk
-
-.IF ("$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO"
-dummy:
- @echo " Not building the mozillasrc stuff in LibreOffice build"
- @echo " dependency to Mozilla developer snapshots not feasable at the moment"
- @echo " see http://bugzilla.mozilla.org/show_bug.cgi?id=135137"
-.ELSE
-
-.INCLUDE : $(PRJ)$/version.mk
-
-.INCLUDE : ../makefile_mozab.mk
-
-INCPRE += -I../bootstrap
-
-# --- Files -------------------------------------
-
-SLOFILES = \
- $(SLO)$/MQueryHelper.obj \
- $(SLO)$/MDatabaseMetaDataHelper.obj \
- $(SLO)$/MQuery.obj \
- $(SLO)$/MTypeConverter.obj \
- $(SLO)$/MNameMapper.obj \
- $(SLO)$/MNSMozabProxy.obj \
- $(SLO)$/MNSTerminateListener.obj \
- $(SLO)$/MLdapAttributeMap.obj \
-
-.ENDIF
-
-# --- Targets ----------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/connectivity/source/drivers/mozab/post_include_mozilla.h b/connectivity/source/drivers/mozab/post_include_mozilla.h
deleted file mode 100755
index cf365e1008..0000000000
--- a/connectivity/source/drivers/mozab/post_include_mozilla.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#if defined __SUNPRO_CC
-#pragma enable_warn
-#elif defined _MSC_VER
-#pragma warning(pop)
-#endif
-
-#ifdef MOZ_BOOL
-# undef BOOL
-# undef Bool
-#endif
-
-#ifdef DEBUG_WAS_DEFINED
- #define DEBUG DEBUG_WAS_DEFINED
-#endif
-
-#ifdef _DEBUG_WAS_DEFINED
- #define _DEBUG _DEBUG_WAS_DEFINED
-#endif
-
-#ifndef _CONNECTIVITY_MOZILLA_REINTERPRET_CAST_MINGW_ONLY_
-#define _CONNECTIVITY_MOZILLA_REINTERPRET_CAST_MINGW_ONLY_
-
-#ifdef __cplusplus
-#ifdef __MINGW32__
-template<class T1, class T2> T1 inline reinterpret_cast_mingw_only(T2 p) { return reinterpret_cast<T1>(p); }
-#else
-template<class T1, class T2> T1 inline reinterpret_cast_mingw_only(T2 p) { return p; }
-#endif
-#endif
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/pre_include_mozilla.h b/connectivity/source/drivers/mozab/pre_include_mozilla.h
deleted file mode 100755
index e518d820dc..0000000000
--- a/connectivity/source/drivers/mozab/pre_include_mozilla.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// Turn off DEBUG Assertions
-#ifdef _DEBUG
- #define _DEBUG_WAS_DEFINED _DEBUG
- #ifndef MOZILLA_ENABLE_DEBUG
- #undef _DEBUG
- #endif
-#else
- #undef _DEBUG_WAS_DEFINED
- #ifdef MOZILLA_ENABLE_DEBUG
- #define _DEBUG 1
- #endif
-#endif
-
-// and turn off the additional virtual methods which are part of some interfaces when compiled
-// with debug
-#ifdef DEBUG
- #define DEBUG_WAS_DEFINED DEBUG
- #ifndef MOZILLA_ENABLE_DEBUG
- #undef DEBUG
- #endif
-#else
- #undef DEBUG_WAS_DEFINED
- #ifdef MOZILLA_ENABLE_DEBUG
- #define DEBUG 1
- #endif
-#endif
-
-#if defined __GNUC__
- #pragma GCC system_header
-#elif defined __SUNPRO_CC
- #pragma disable_warn
-#elif defined _MSC_VER
- #pragma warning(push, 1)
- #pragma warning(disable:4946 4710)
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/YCatalog.cxx b/connectivity/source/drivers/mysql/YCatalog.cxx
deleted file mode 100644
index 3aeff3344a..0000000000
--- a/connectivity/source/drivers/mysql/YCatalog.cxx
+++ /dev/null
@@ -1,176 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "mysql/YCatalog.hxx"
-#include "mysql/YUsers.hxx"
-#include "mysql/YTables.hxx"
-#include "mysql/YViews.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <comphelper/types.hxx>
-
-
-// -------------------------------------------------------------------------
-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)
- ,m_xConnection(_xConnection)
-{
-}
-// -----------------------------------------------------------------------------
-void OMySQLCatalog::refreshObjects(const Sequence< ::rtl::OUString >& _sKindOfObject,TStringVector& _rNames)
-{
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),
- _sKindOfObject);
- fillNames(xResult,_rNames);
-}
-// -------------------------------------------------------------------------
-void OMySQLCatalog::refreshTables()
-{
- TStringVector aVector;
- static const ::rtl::OUString s_sTableTypeView(RTL_CONSTASCII_USTRINGPARAM("VIEW"));
- static const ::rtl::OUString s_sTableTypeTable(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
- static const ::rtl::OUString s_sAll(RTL_CONSTASCII_USTRINGPARAM("%"));
-
- Sequence< ::rtl::OUString > sTableTypes(3);
- sTableTypes[0] = s_sTableTypeView;
- sTableTypes[1] = s_sTableTypeTable;
- sTableTypes[2] = s_sAll; // just to be sure to include anything else ....
-
- refreshObjects(sTableTypes,aVector);
-
- if ( m_pTables )
- m_pTables->reFill(aVector);
- else
- m_pTables = new OTables(m_xMetaData,*this,m_aMutex,aVector);
-}
-// -------------------------------------------------------------------------
-void OMySQLCatalog::refreshViews()
-{
- Sequence< ::rtl::OUString > aTypes(1);
- aTypes[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW"));
-
-/*
- sal_Bool bSupportsViews = sal_False;
- try
- {
- Reference<XResultSet> xRes = m_xMetaData->getTableTypes();
- Reference<XRow> xRow(xRes,UNO_QUERY);
- while ( !bSupportsViews && xRow.is() && xRes->next() )
- {
- ::rtl::OUString sTableType( xRow->getString( 1 ) );
- bSupportsViews = sTableType.equalsIgnoreAsciiCase( aTypes[0] );
- }
- }
- catch(const SQLException&)
- {
- }
-*/
- // let's simply assume the server is new enough to support views. Current drivers
- // as of this writing might not return the proper information in getTableTypes, so
- // don't rely on it.
- // during #73245# / 2007-10-26 / frank.schoenheit@sun.com
- bool bSupportsViews = sal_True;
-
- TStringVector aVector;
- if ( bSupportsViews )
- refreshObjects(aTypes,aVector);
-
- if ( m_pViews )
- m_pViews->reFill(aVector);
- else
- m_pViews = new OViews(m_xMetaData,*this,m_aMutex,aVector);
-}
-// -------------------------------------------------------------------------
-void OMySQLCatalog::refreshGroups()
-{
-}
-// -------------------------------------------------------------------------
-void OMySQLCatalog::refreshUsers()
-{
- TStringVector aVector;
- Reference< XStatement > xStmt = m_xConnection->createStatement( );
- Reference< XResultSet > xResult = xStmt->executeQuery(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("select User from mysql.user group by User")));
- if ( xResult.is() )
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- TString2IntMap aMap;
- while( xResult->next() )
- aVector.push_back(xRow->getString(1));
- ::comphelper::disposeComponent(xResult);
- }
- ::comphelper::disposeComponent(xStmt);
-
- if(m_pUsers)
- m_pUsers->reFill(aVector);
- else
- m_pUsers = new OUsers(*this,m_aMutex,aVector,m_xConnection,this);
-}
-// -----------------------------------------------------------------------------
-Any SAL_CALL OMySQLCatalog::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- if ( rType == ::getCppuType((const Reference<XGroupsSupplier>*)0) )
- return Any();
-
-
- return OCatalog::queryInterface(rType);
-}
-// -----------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OMySQLCatalog::getTypes( ) throw(RuntimeException)
-{
- Sequence< Type > aTypes = OCatalog::getTypes();
- ::std::vector<Type> aOwnTypes;
- aOwnTypes.reserve(aTypes.getLength());
- const Type* pBegin = aTypes.getConstArray();
- const Type* pEnd = pBegin + aTypes.getLength();
- for(;pBegin != pEnd;++pBegin)
- {
- if ( !(*pBegin == ::getCppuType((const Reference<XGroupsSupplier>*)0)))
- {
- aOwnTypes.push_back(*pBegin);
- }
- }
- const Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
- return Sequence< Type >(pTypes, aOwnTypes.size());
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/YColumns.cxx b/connectivity/source/drivers/mysql/YColumns.cxx
deleted file mode 100644
index effe4d3653..0000000000
--- a/connectivity/source/drivers/mysql/YColumns.cxx
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "mysql/YColumns.hxx"
-#include "TConnection.hxx"
-
-
-using namespace ::comphelper;
-using namespace connectivity::mysql;
-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
- ,sal_Bool _bCase
- ,::osl::Mutex& _rMutex
- ,const TStringVector &_rVector
- ,sal_Bool _bUseHardRef
- ) : OColumnsHelper(_rParent,_bCase,_rMutex,_rVector,_bUseHardRef)
-{
-}
-// -----------------------------------------------------------------------------
-Reference< XPropertySet > OMySQLColumns::createDescriptor()
-{
- return new OMySQLColumn(sal_True);
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-OMySQLColumn::OMySQLColumn( sal_Bool _bCase)
- : connectivity::sdbcx::OColumn( _bCase )
-{
- construct();
-}
-// -------------------------------------------------------------------------
-void OMySQLColumn::construct()
-{
- m_sAutoIncrement = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("auto_increment"));
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_AUTOINCREMENTCREATION),PROPERTY_ID_AUTOINCREMENTCREATION,0,&m_sAutoIncrement, ::getCppuType(&m_sAutoIncrement));
-}
-// -----------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OMySQLColumn::createArrayHelper( sal_Int32 /*_nId*/ ) const
-{
- return doCreateArrayHelper();
-}
-// -----------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & SAL_CALL OMySQLColumn::getInfoHelper()
-{
- return *OMySQLColumn_PROP::getArrayHelper(isNew() ? 1 : 0);
-}
-// -----------------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL OMySQLColumn::getSupportedServiceNames( ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(1);
- aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.Column"));
-
- return aSupported;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/YDriver.cxx b/connectivity/source/drivers/mysql/YDriver.cxx
deleted file mode 100644
index 40b1e171a2..0000000000
--- a/connectivity/source/drivers/mysql/YDriver.cxx
+++ /dev/null
@@ -1,484 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "mysql/YDriver.hxx"
-#include "mysql/YCatalog.hxx"
-#include <osl/diagnose.h>
-#include <comphelper/namedvaluecollection.hxx>
-#include "connectivity/dbexception.hxx"
-#include <connectivity/dbcharset.hxx>
-#include <com/sun/star/sdbc/XDriverAccess.hpp>
-#include "TConnection.hxx"
-#include "resource/common_res.hrc"
-#include "resource/sharedresources.hxx"
-
-//........................................................................
-namespace connectivity
-{
-//........................................................................
- using namespace mysql;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::sdbcx;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::lang;
-
- namespace mysql
- {
- Reference< XInterface > SAL_CALL ODriverDelegator_CreateInstance(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFac) throw( Exception )
- {
- return *(new ODriverDelegator(_rxFac));
- }
- }
-
-
- //====================================================================
- //= ODriverDelegator
- //====================================================================
- //--------------------------------------------------------------------
- ODriverDelegator::ODriverDelegator(const Reference< XMultiServiceFactory >& _rxFactory)
- : ODriverDelegator_BASE(m_aMutex)
- ,m_xFactory(_rxFactory)
- ,m_eDriverType(D_ODBC)
- {
- }
-
- //--------------------------------------------------------------------
- ODriverDelegator::~ODriverDelegator()
- {
- try
- {
- ::comphelper::disposeComponent(m_xODBCDriver);
- ::comphelper::disposeComponent(m_xNativeDriver);
- TJDBCDrivers::iterator aIter = m_aJdbcDrivers.begin();
- TJDBCDrivers::iterator aEnd = m_aJdbcDrivers.end();
- for ( ;aIter != aEnd;++aIter )
- ::comphelper::disposeComponent(aIter->second);
- }
- catch(const Exception&)
- {
- }
- }
-
- // --------------------------------------------------------------------------------
- void ODriverDelegator::disposing()
- {
- ::osl::MutexGuard aGuard(m_aMutex);
-
-
- for (TWeakPairVector::iterator i = m_aConnections.begin(); m_aConnections.end() != i; ++i)
- {
- Reference<XInterface > xTemp = i->first.get();
- ::comphelper::disposeComponent(xTemp);
- }
- m_aConnections.clear();
- TWeakPairVector().swap(m_aConnections);
-
- ODriverDelegator_BASE::disposing();
- }
-
- namespace
- {
- sal_Bool isOdbcUrl(const ::rtl::OUString& _sUrl)
- {
- return _sUrl.copy(0,16).equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdbc:mysql:odbc:"));
- }
- //--------------------------------------------------------------------
- sal_Bool isNativeUrl(const ::rtl::OUString& _sUrl)
- {
- return (!_sUrl.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:mysqlc:")), sizeof("sdbc:mysql:mysqlc:")-1));
- }
- //--------------------------------------------------------------------
- T_DRIVERTYPE lcl_getDriverType(const ::rtl::OUString& _sUrl)
- {
- T_DRIVERTYPE eRet = D_JDBC;
- if ( isOdbcUrl(_sUrl ) )
- eRet = D_ODBC;
- else if ( isNativeUrl(_sUrl ) )
- eRet = D_NATIVE;
- return eRet;
- }
- //--------------------------------------------------------------------
- ::rtl::OUString transformUrl(const ::rtl::OUString& _sUrl)
- {
- ::rtl::OUString sNewUrl = _sUrl.copy(11);
- if ( isOdbcUrl( _sUrl ) )
- sNewUrl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:")) + sNewUrl;
- else if ( isNativeUrl( _sUrl ) )
- sNewUrl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:")) + sNewUrl;
- else
- {
- sNewUrl = sNewUrl.copy(5);
-
- ::rtl::OUString sTempUrl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("jdbc:mysql://"));
-
- sTempUrl += sNewUrl;
- sNewUrl = sTempUrl;
- }
- return sNewUrl;
- }
- //--------------------------------------------------------------------
- Reference< XDriver > lcl_loadDriver(const Reference< XMultiServiceFactory >& _rxFactory,const ::rtl::OUString& _sUrl)
- {
- Reference<XDriverAccess> xDriverAccess(_rxFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.DriverManager")) ),UNO_QUERY);
- OSL_ENSURE(xDriverAccess.is(),"Could not load driver manager!");
- Reference< XDriver > xDriver;
- if ( xDriverAccess.is() )
- xDriver = xDriverAccess->getDriverByURL(_sUrl);
- return xDriver;
- }
- //--------------------------------------------------------------------
- Sequence< PropertyValue > lcl_convertProperties(T_DRIVERTYPE _eType,const Sequence< PropertyValue >& info,const ::rtl::OUString& _sUrl)
- {
- ::std::vector<PropertyValue> aProps;
- const PropertyValue* pSupported = info.getConstArray();
- const PropertyValue* pEnd = pSupported + info.getLength();
-
- aProps.reserve(info.getLength() + 5);
- for (;pSupported != pEnd; ++pSupported)
- {
- aProps.push_back( *pSupported );
- }
-
- if ( _eType == D_ODBC )
- {
- aProps.push_back( PropertyValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Silent"))
- ,0
- ,makeAny(sal_True)
- ,PropertyState_DIRECT_VALUE) );
- aProps.push_back( PropertyValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PreventGetVersionColumns"))
- ,0
- ,makeAny(sal_True)
- ,PropertyState_DIRECT_VALUE) );
- }
- else if ( _eType == D_JDBC )
- {
- aProps.push_back( PropertyValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass"))
- ,0
- ,makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.mysql.jdbc.Driver")))
- ,PropertyState_DIRECT_VALUE) );
- }
- else
- {
- aProps.push_back( PropertyValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PublicConnectionURL"))
- ,0
- ,makeAny(_sUrl)
- ,PropertyState_DIRECT_VALUE) );
- }
- aProps.push_back( PropertyValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsAutoRetrievingEnabled"))
- ,0
- ,makeAny(sal_True)
- ,PropertyState_DIRECT_VALUE) );
- aProps.push_back( PropertyValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoRetrievingStatement"))
- ,0
- ,makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT LAST_INSERT_ID()")))
- ,PropertyState_DIRECT_VALUE) );
- aProps.push_back( PropertyValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParameterNameSubstitution"))
- ,0
- ,makeAny(sal_True)
- ,PropertyState_DIRECT_VALUE) );
- PropertyValue* pProps = aProps.empty() ? 0 : &aProps[0];
- return Sequence< PropertyValue >(pProps, aProps.size());
- }
- }
- //--------------------------------------------------------------------
- Reference< XDriver > ODriverDelegator::loadDriver( const ::rtl::OUString& url, const Sequence< PropertyValue >& info )
- {
- Reference< XDriver > xDriver;
- const ::rtl::OUString sCuttedUrl = transformUrl(url);
- const T_DRIVERTYPE eType = lcl_getDriverType( url );
- if ( eType == D_ODBC )
- {
- if ( !m_xODBCDriver.is() )
- m_xODBCDriver = lcl_loadDriver(m_xFactory,sCuttedUrl);
- xDriver = m_xODBCDriver;
- } // if ( bIsODBC )
- else if ( eType == D_NATIVE )
- {
- if ( !m_xNativeDriver.is() )
- m_xNativeDriver = lcl_loadDriver(m_xFactory,sCuttedUrl);
- xDriver = m_xNativeDriver;
- }
- else
- {
- ::comphelper::NamedValueCollection aSettings( info );
- ::rtl::OUString sDriverClass(RTL_CONSTASCII_USTRINGPARAM("com.mysql.jdbc.Driver"));
- sDriverClass = aSettings.getOrDefault( "JavaDriverClass", sDriverClass );
-
- TJDBCDrivers::iterator aFind = m_aJdbcDrivers.find(sDriverClass);
- if ( aFind == m_aJdbcDrivers.end() )
- aFind = m_aJdbcDrivers.insert(TJDBCDrivers::value_type(sDriverClass,lcl_loadDriver(m_xFactory,sCuttedUrl))).first;
- xDriver = aFind->second;
- }
-
- return xDriver;
- }
-
- //--------------------------------------------------------------------
- Reference< XConnection > SAL_CALL ODriverDelegator::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw (SQLException, RuntimeException)
- {
- Reference< XConnection > xConnection;
- if ( acceptsURL(url) )
- {
- Reference< XDriver > xDriver;
- xDriver = loadDriver(url,info);
- if ( xDriver.is() )
- {
- ::rtl::OUString sCuttedUrl = transformUrl(url);
- const T_DRIVERTYPE eType = lcl_getDriverType( url );
- Sequence< PropertyValue > aConvertedProperties = lcl_convertProperties(eType,info,url);
- if ( eType == D_JDBC )
- {
- ::comphelper::NamedValueCollection aSettings( info );
- ::rtl::OUString sIanaName = aSettings.getOrDefault( "CharSet", ::rtl::OUString() );
- if ( sIanaName.getLength() )
- {
- ::dbtools::OCharsetMap aLookupIanaName;
- ::dbtools::OCharsetMap::const_iterator aLookup = aLookupIanaName.find(sIanaName, ::dbtools::OCharsetMap::IANA());
- if (aLookup != aLookupIanaName.end() )
- {
- ::rtl::OUString sAdd;
- if ( RTL_TEXTENCODING_UTF8 == (*aLookup).getEncoding() )
- {
- static const ::rtl::OUString s_sCharSetOp(RTL_CONSTASCII_USTRINGPARAM("useUnicode=true&"));
- if ( !sCuttedUrl.matchIgnoreAsciiCase(s_sCharSetOp) )
- {
- sAdd = s_sCharSetOp;
- } // if ( !sCuttedUrl.matchIgnoreAsciiCase(s_sCharSetOp) )
- } // if ( RTL_TEXTENCODING_UTF8 == (*aLookup).getEncoding() )
- if ( sCuttedUrl.indexOf('?') == -1 )
- sCuttedUrl += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("?"));
- else
- sCuttedUrl += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("&"));
- sCuttedUrl += sAdd;
- sCuttedUrl += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("characterEncoding="));
- sCuttedUrl += sIanaName;
- }
- }
- } // if ( !bIsODBC )
-
- xConnection = xDriver->connect( sCuttedUrl, aConvertedProperties );
- if ( xConnection.is() )
- {
- OMetaConnection* pMetaConnection = NULL;
- // now we have to set the URL to get the correct answer for metadata()->getURL()
- Reference< XUnoTunnel> xTunnel(xConnection,UNO_QUERY);
- if ( xTunnel.is() )
- {
- pMetaConnection = reinterpret_cast<OMetaConnection*>(xTunnel->getSomething( OMetaConnection::getUnoTunnelImplementationId() ));
- if ( pMetaConnection )
- pMetaConnection->setURL(url);
- }
- m_aConnections.push_back(TWeakPair(WeakReferenceHelper(xConnection),TWeakConnectionPair(WeakReferenceHelper(),pMetaConnection)));
- }
- }
- }
- return xConnection;
- }
-
- //--------------------------------------------------------------------
- sal_Bool SAL_CALL ODriverDelegator::acceptsURL( const ::rtl::OUString& url ) throw (SQLException, RuntimeException)
- {
- Sequence< PropertyValue > info;
-
- sal_Bool bOK = url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "sdbc:mysql:odbc:" ) )
- || url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "sdbc:mysql:jdbc:" ) )
- || ( url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "sdbc:mysql:mysqlc:" ) )
- && loadDriver( url, info ).is()
- );
- return bOK;
- }
-
- //--------------------------------------------------------------------
- Sequence< DriverPropertyInfo > SAL_CALL ODriverDelegator::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw (SQLException, RuntimeException)
- {
- ::std::vector< DriverPropertyInfo > aDriverInfo;
- if ( !acceptsURL(url) )
- return Sequence< DriverPropertyInfo >();
-
- Sequence< ::rtl::OUString > aBoolean(2);
- aBoolean[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"));
- aBoolean[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1"));
-
-
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet of the database."))
- ,sal_False
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SuppressVersionColumns"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Display version columns (when available)."))
- ,sal_False
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0"))
- ,aBoolean)
- );
- const T_DRIVERTYPE eType = lcl_getDriverType( url );
- if ( eType == D_JDBC )
- {
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The JDBC driver class name."))
- ,sal_True
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.mysql.jdbc.Driver"))
- ,Sequence< ::rtl::OUString >())
- );
- }
-
- return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size());
- }
-
- //--------------------------------------------------------------------
- sal_Int32 SAL_CALL ODriverDelegator::getMajorVersion( ) throw (RuntimeException)
- {
- return 1;
- }
-
- //--------------------------------------------------------------------
- sal_Int32 SAL_CALL ODriverDelegator::getMinorVersion( ) throw (RuntimeException)
- {
- return 0;
- }
-
- //--------------------------------------------------------------------
- Reference< XTablesSupplier > SAL_CALL ODriverDelegator::getDataDefinitionByConnection( const Reference< XConnection >& connection ) throw (SQLException, RuntimeException)
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODriverDelegator_BASE::rBHelper.bDisposed);
-
- Reference< XTablesSupplier > xTab;
- Reference< XUnoTunnel> xTunnel(connection,UNO_QUERY);
- if ( xTunnel.is() )
- {
- OMetaConnection* pConnection = reinterpret_cast<OMetaConnection*>(xTunnel->getSomething( OMetaConnection::getUnoTunnelImplementationId() ));
- if ( pConnection )
- {
- TWeakPairVector::iterator aEnd = m_aConnections.end();
- for (TWeakPairVector::iterator i = m_aConnections.begin(); aEnd != i; ++i)
- {
- if ( i->second.second == pConnection )
- {
- xTab = Reference< XTablesSupplier >(i->second.first.get().get(),UNO_QUERY);
- if ( !xTab.is() )
- {
- xTab = new OMySQLCatalog(connection);
- i->second.first = WeakReferenceHelper(xTab);
- }
- break;
- }
- }
- }
- } // if ( xTunnel.is() )
- if ( !xTab.is() )
- {
- TWeakPairVector::iterator aEnd = m_aConnections.end();
- for (TWeakPairVector::iterator i = m_aConnections.begin(); aEnd != i; ++i)
- {
- Reference< XConnection > xTemp(i->first.get(),UNO_QUERY);
- if ( xTemp == connection )
- {
- xTab = Reference< XTablesSupplier >(i->second.first.get().get(),UNO_QUERY);
- if ( !xTab.is() )
- {
- xTab = new OMySQLCatalog(connection);
- i->second.first = WeakReferenceHelper(xTab);
- }
- break;
- }
- }
- }
- return xTab;
- }
-
- //--------------------------------------------------------------------
- Reference< XTablesSupplier > SAL_CALL ODriverDelegator::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw (SQLException, RuntimeException)
- {
- if ( ! acceptsURL(url) )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- } // if ( ! acceptsURL(url) )
-
- return getDataDefinitionByConnection(connect(url,info));
- }
-
- // XServiceInfo
- // --------------------------------------------------------------------------------
- //------------------------------------------------------------------------------
- rtl::OUString ODriverDelegator::getImplementationName_Static( ) throw(RuntimeException)
- {
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.drivers.MySQL.Driver"));
- }
- //------------------------------------------------------------------------------
- Sequence< ::rtl::OUString > ODriverDelegator::getSupportedServiceNames_Static( ) throw (RuntimeException)
- {
- Sequence< ::rtl::OUString > aSNS( 2 );
- aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver"));
- aSNS[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.Driver"));
- return aSNS;
- }
- //------------------------------------------------------------------
- ::rtl::OUString SAL_CALL ODriverDelegator::getImplementationName( ) throw(RuntimeException)
- {
- return getImplementationName_Static();
- }
-
- //------------------------------------------------------------------
- sal_Bool SAL_CALL ODriverDelegator::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
- {
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
- }
- //------------------------------------------------------------------
- Sequence< ::rtl::OUString > SAL_CALL ODriverDelegator::getSupportedServiceNames( ) throw(RuntimeException)
- {
- return getSupportedServiceNames_Static();
- }
- //------------------------------------------------------------------
-//........................................................................
-} // namespace connectivity
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/YTable.cxx b/connectivity/source/drivers/mysql/YTable.cxx
deleted file mode 100644
index a9c97aaeea..0000000000
--- a/connectivity/source/drivers/mysql/YTable.cxx
+++ /dev/null
@@ -1,387 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "mysql/YTable.hxx"
-#include "mysql/YTables.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#include <comphelper/property.hxx>
-#include <comphelper/extract.hxx>
-#include <comphelper/types.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-#include "connectivity/TKeys.hxx"
-#include "connectivity/TIndexes.hxx"
-#include "connectivity/TColumnsHelper.hxx"
-#include "mysql/YCatalog.hxx"
-#include "mysql/YColumns.hxx"
-#include "TConnection.hxx"
-
-
-using namespace ::comphelper;
-using namespace connectivity::mysql;
-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;
-namespace connectivity
-{
- namespace mysql
- {
- class OMySQLKeysHelper : public OKeysHelper
- {
- protected:
- // -----------------------------------------------------------------------------
- virtual ::rtl::OUString getDropForeignKey() const
- {
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DROP FOREIGN KEY "));
- }
- public:
- OMySQLKeysHelper( OTableHelper* _pTable,
- ::osl::Mutex& _rMutex,
- const TStringVector& _rVector
- ) : OKeysHelper(_pTable,_rMutex,_rVector){}
-
- };
- }
-}
-
-OMySQLTable::OMySQLTable( sdbcx::OCollection* _pTables,
- const Reference< XConnection >& _xConnection)
- :OTableHelper(_pTables,_xConnection,sal_True)
-{
- // we create a new table here, so we should have all the rights or ;-)
- m_nPrivileges = Privilege::DROP |
- Privilege::REFERENCE |
- Privilege::ALTER |
- Privilege::CREATE |
- Privilege::READ |
- Privilege::DELETE |
- Privilege::UPDATE |
- Privilege::INSERT |
- Privilege::SELECT;
- construct();
-}
-// -------------------------------------------------------------------------
-OMySQLTable::OMySQLTable( sdbcx::OCollection* _pTables,
- const Reference< XConnection >& _xConnection,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description ,
- const ::rtl::OUString& _SchemaName,
- const ::rtl::OUString& _CatalogName,
- sal_Int32 _nPrivileges
- ) : OTableHelper( _pTables,
- _xConnection,
- sal_True,
- _Name,
- _Type,
- _Description,
- _SchemaName,
- _CatalogName)
- , m_nPrivileges(_nPrivileges)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-void OMySQLTable::construct()
-{
- OTableHelper::construct();
- if ( !isNew() )
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRIVILEGES), PROPERTY_ID_PRIVILEGES,PropertyAttribute::READONLY,&m_nPrivileges, ::getCppuType(&m_nPrivileges));
-}
-// -----------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OMySQLTable::createArrayHelper( sal_Int32 /*_nId*/ ) const
-{
- return doCreateArrayHelper();
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & OMySQLTable::getInfoHelper()
-{
- return *static_cast<OMySQLTable_PROP*>(const_cast<OMySQLTable*>(this))->getArrayHelper(isNew() ? 1 : 0);
-}
-// -----------------------------------------------------------------------------
-sdbcx::OCollection* OMySQLTable::createColumns(const TStringVector& _rNames)
-{
- OMySQLColumns* pColumns = new OMySQLColumns(*this,sal_True,m_aMutex,_rNames);
- pColumns->setParent(this);
- return pColumns;
-}
-// -----------------------------------------------------------------------------
-sdbcx::OCollection* OMySQLTable::createKeys(const TStringVector& _rNames)
-{
- return new OMySQLKeysHelper(this,m_aMutex,_rNames);
-}
-// -----------------------------------------------------------------------------
-sdbcx::OCollection* OMySQLTable::createIndexes(const TStringVector& _rNames)
-{
- return new OIndexesHelper(this,m_aMutex,_rNames);
-}
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OMySQLTable::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OMySQLTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
-{
- return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : OTable_TYPEDEF::getSomething(rId);
-}
-// -------------------------------------------------------------------------
-// XAlterTable
-void SAL_CALL OMySQLTable::alterColumnByName( const ::rtl::OUString& colName, const Reference< XPropertySet >& descriptor ) throw(SQLException, NoSuchElementException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(
-#ifdef GCC
- ::connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed
-#else
- rBHelper.bDisposed
-#endif
- );
-
- if ( m_pColumns && !m_pColumns->hasByName(colName) )
- throw NoSuchElementException(colName,*this);
-
-
- if ( !isNew() )
- {
- // first we have to check what should be altered
- Reference<XPropertySet> xProp;
- m_pColumns->getByName(colName) >>= xProp;
- // first check the types
- sal_Int32 nOldType = 0,nNewType = 0,nOldPrec = 0,nNewPrec = 0,nOldScale = 0,nNewScale = 0;
-
- ::dbtools::OPropertyMap& rProp = OMetaConnection::getPropMap();
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPE)) >>= nOldType;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPE)) >>= nNewType;
- // and precsions and scale
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_PRECISION)) >>= nOldPrec;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_PRECISION))>>= nNewPrec;
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_SCALE)) >>= nOldScale;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_SCALE)) >>= nNewScale;
- // second: check the "is nullable" value
- sal_Int32 nOldNullable = 0,nNewNullable = 0;
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nOldNullable;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nNewNullable;
-
- // check also the auto_increment
- sal_Bool bOldAutoIncrement = sal_False,bAutoIncrement = sal_False;
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)) >>= bOldAutoIncrement;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)) >>= bAutoIncrement;
- bool bColumnNameChanged = false;
- ::rtl::OUString sOldDesc,sNewDesc;
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_DESCRIPTION)) >>= sOldDesc;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_DESCRIPTION)) >>= sNewDesc;
-
- if ( nOldType != nNewType
- || nOldPrec != nNewPrec
- || nOldScale != nNewScale
- || nNewNullable != nOldNullable
- || bOldAutoIncrement != bAutoIncrement
- || sOldDesc != sNewDesc )
- {
- // special handling because they change dthe type names to distinguish
- // if a column should be an auto_incmrement one
- if ( bOldAutoIncrement != bAutoIncrement )
- {
- ::rtl::OUString sTypeName;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPENAME)) >>= sTypeName;
-
- static ::rtl::OUString s_sAutoIncrement(RTL_CONSTASCII_USTRINGPARAM("auto_increment"));
- if ( bAutoIncrement )
- {
- if ( sTypeName.indexOf(s_sAutoIncrement) == -1 )
- {
- sTypeName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "));
- sTypeName += s_sAutoIncrement;
- }
- }
- else
- {
- sal_Int32 nIndex = 0;
- if ( sTypeName.getLength() && (nIndex = sTypeName.indexOf(s_sAutoIncrement)) != -1 )
- {
- sTypeName = sTypeName.copy(0,nIndex);
- descriptor->setPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPENAME),makeAny(sTypeName));
- }
- }
- }
- alterColumnType(nNewType,colName,descriptor);
- bColumnNameChanged = true;
- }
-
- // third: check the default values
- ::rtl::OUString sNewDefault,sOldDefault;
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_DEFAULTVALUE)) >>= sOldDefault;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_DEFAULTVALUE)) >>= sNewDefault;
-
- if(sOldDefault.getLength())
- {
- dropDefaultValue(colName);
- if(sNewDefault.getLength() && sOldDefault != sNewDefault)
- alterDefaultValue(sNewDefault,colName);
- }
- else if(!sOldDefault.getLength() && sNewDefault.getLength())
- alterDefaultValue(sNewDefault,colName);
-
- // now we should look if the name of the column changed
- ::rtl::OUString sNewColumnName;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_NAME)) >>= sNewColumnName;
- if ( !sNewColumnName.equalsIgnoreAsciiCase(colName) && !bColumnNameChanged )
- {
- ::rtl::OUString sSql = getAlterTableColumnPart();
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" CHANGE "));
- const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( );
- sSql += ::dbtools::quoteName(sQuote,colName);
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "));
- sSql += OTables::adjustSQL(::dbtools::createStandardColumnPart(descriptor,getConnection(),static_cast<OTables*>(m_pTables),getTypeCreatePattern()));
- executeStatement(sSql);
- }
- m_pColumns->refresh();
- }
- else
- {
- if(m_pColumns)
- {
- m_pColumns->dropByName(colName);
- m_pColumns->appendByDescriptor(descriptor);
- }
- }
-
-}
-// -----------------------------------------------------------------------------
-void OMySQLTable::alterColumnType(sal_Int32 nNewType,const ::rtl::OUString& _rColName, const Reference<XPropertySet>& _xDescriptor)
-{
- ::rtl::OUString sSql = getAlterTableColumnPart();
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" CHANGE "));
- const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( );
- sSql += ::dbtools::quoteName(sQuote,_rColName);
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "));
-
- OColumn* pColumn = new OColumn(sal_True);
- Reference<XPropertySet> xProp = pColumn;
- ::comphelper::copyProperties(_xDescriptor,xProp);
- xProp->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),makeAny(nNewType));
-
- sSql += OTables::adjustSQL(::dbtools::createStandardColumnPart(xProp,getConnection(),static_cast<OTables*>(m_pTables),getTypeCreatePattern()));
- executeStatement(sSql);
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OMySQLTable::getTypeCreatePattern() const
-{
- static const ::rtl::OUString s_sCreatePattern(RTL_CONSTASCII_USTRINGPARAM("(M,D)"));
- return s_sCreatePattern;
-}
-// -----------------------------------------------------------------------------
-void OMySQLTable::alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName)
-{
- ::rtl::OUString sSql = getAlterTableColumnPart();
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ALTER "));
-
- const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( );
- sSql += ::dbtools::quoteName(sQuote,_rColName);
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" SET DEFAULT '")) + _sNewDefault;
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'"));
-
- executeStatement(sSql);
-}
-// -----------------------------------------------------------------------------
-void OMySQLTable::dropDefaultValue(const ::rtl::OUString& _rColName)
-{
- ::rtl::OUString sSql = getAlterTableColumnPart();
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ALTER "));
-
- const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( );
- sSql += ::dbtools::quoteName(sQuote,_rColName);
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DROP DEFAULT"));
-
- executeStatement(sSql);
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OMySQLTable::getAlterTableColumnPart()
-{
- ::rtl::OUString sSql( RTL_CONSTASCII_USTRINGPARAM( "ALTER TABLE " ));
- const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( );
-
- ::rtl::OUString sComposedName(
- ::dbtools::composeTableName( getMetaData(), m_CatalogName, m_SchemaName, m_Name, sal_True, ::dbtools::eInTableDefinitions ) );
- sSql += sComposedName;
-
- return sSql;
-}
-// -----------------------------------------------------------------------------
-void OMySQLTable::executeStatement(const ::rtl::OUString& _rStatement )
-{
- ::rtl::OUString sSQL = _rStatement;
- if(sSQL.lastIndexOf(',') == (sSQL.getLength()-1))
- sSQL = sSQL.replaceAt(sSQL.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")));
-
- Reference< XStatement > xStmt = getConnection()->createStatement( );
- if ( xStmt.is() )
- {
- xStmt->execute(sSQL);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OMySQLTable::getRenameStart() const
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RENAME TABLE "));
-}
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/YTables.cxx b/connectivity/source/drivers/mysql/YTables.cxx
deleted file mode 100644
index aac4f5c3f3..0000000000
--- a/connectivity/source/drivers/mysql/YTables.cxx
+++ /dev/null
@@ -1,246 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "mysql/YTables.hxx"
-#include "mysql/YViews.hxx"
-#include "mysql/YTable.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include "mysql/YCatalog.hxx"
-#include <comphelper/extract.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/dbexception.hxx"
-#include <cppuhelper/interfacecontainer.h>
-#include <comphelper/types.hxx>
-#include "TConnection.hxx"
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace ::cppu;
-using namespace connectivity::mysql;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace dbtools;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OTables::createObject(const ::rtl::OUString& _rName)
-{
- ::rtl::OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(m_xMetaData,_rName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
-
- static const ::rtl::OUString s_sTableTypeView(RTL_CONSTASCII_USTRINGPARAM("VIEW"));
- static const ::rtl::OUString s_sTableTypeTable(RTL_CONSTASCII_USTRINGPARAM("TABLE"));
- static const ::rtl::OUString s_sAll(RTL_CONSTASCII_USTRINGPARAM("%"));
-
- Sequence< ::rtl::OUString > sTableTypes(3);
- sTableTypes[0] = s_sTableTypeView;
- sTableTypes[1] = s_sTableTypeTable;
- sTableTypes[2] = s_sAll; // just to be sure to include anything else ....
-
- Any aCatalog;
- if ( sCatalog.getLength() )
- aCatalog <<= sCatalog;
- Reference< XResultSet > xResult = m_xMetaData->getTables(aCatalog,sSchema,sTable,sTableTypes);
-
- sdbcx::ObjectType xRet = NULL;
- if ( xResult.is() )
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- if ( xResult->next() ) // there can be only one table with this name
- {
-// Reference<XStatement> xStmt = m_xConnection->createStatement();
-// if ( xStmt.is() )
-// {
-// Reference< XResultSet > xPrivRes = xStmt->executeQuery();
-// Reference< XRow > xPrivRow(xPrivRes,UNO_QUERY);
-// while ( xPrivRes.is() && xPrivRes->next() )
-// {
-// if ( xPrivRow->getString(1) )
-// {
-// }
-// }
-// }
- sal_Int32 nPrivileges = Privilege::DROP |
- Privilege::REFERENCE |
- Privilege::ALTER |
- Privilege::CREATE |
- Privilege::READ |
- Privilege::DELETE |
- Privilege::UPDATE |
- Privilege::INSERT |
- Privilege::SELECT;
-
- OMySQLTable* pRet = new OMySQLTable( this
- ,static_cast<OMySQLCatalog&>(m_rParent).getConnection()
- ,sTable
- ,xRow->getString(4)
- ,xRow->getString(5)
- ,sSchema
- ,sCatalog
- ,nPrivileges);
- xRet = pRet;
- }
- ::comphelper::disposeComponent(xResult);
- }
-
- return xRet;
-}
-// -------------------------------------------------------------------------
-void OTables::impl_refresh( ) throw(RuntimeException)
-{
- static_cast<OMySQLCatalog&>(m_rParent).refreshTables();
-}
-// -------------------------------------------------------------------------
-void OTables::disposing(void)
-{
-m_xMetaData.clear();
- OCollection::disposing();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OTables::createDescriptor()
-{
- return new OMySQLTable(this,static_cast<OMySQLCatalog&>(m_rParent).getConnection());
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OTables::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- createTable(descriptor);
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName)
-{
- Reference< XInterface > xObject( getObject( _nPos ) );
- sal_Bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject );
- if (!bIsNew)
- {
- Reference< XConnection > xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
-
-
- ::rtl::OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(m_xMetaData,_sElementName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
-
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP " ));
-
- Reference<XPropertySet> xProp(xObject,UNO_QUERY);
- sal_Bool bIsView = xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW"));
- if(bIsView) // here we have a view
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW "));
- else
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE "));
-
- ::rtl::OUString sComposedName(
- ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sTable, sal_True, ::dbtools::eInDataManipulation ) );
- aSql += sComposedName;
- Reference< XStatement > xStmt = xConnection->createStatement( );
- if ( xStmt.is() )
- {
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
- // if no exception was thrown we must delete it from the views
- if ( bIsView )
- {
- OViews* pViews = static_cast<OViews*>(static_cast<OMySQLCatalog&>(m_rParent).getPrivateViews());
- if ( pViews && pViews->hasByName(_sElementName) )
- pViews->dropByNameImpl(_sElementName);
- }
- }
-}
-// -------------------------------------------------------------------------
-::rtl::OUString OTables::adjustSQL(const ::rtl::OUString& _sSql)
-{
- ::rtl::OUString sSQL = _sSql;
- static const ::rtl::OUString s_sUNSIGNED(RTL_CONSTASCII_USTRINGPARAM("UNSIGNED"));
- sal_Int32 nIndex = sSQL.indexOf(s_sUNSIGNED);
- while(nIndex != -1 )
- {
- sal_Int32 nParen = sSQL.indexOf(')',nIndex);
- sal_Int32 nPos = nIndex + s_sUNSIGNED.getLength();
- ::rtl::OUString sNewUnsigned( sSQL.copy(nPos,nParen - nPos + 1));
- sSQL = sSQL.replaceAt(nIndex,s_sUNSIGNED.getLength()+sNewUnsigned.getLength(),sNewUnsigned + s_sUNSIGNED);
- nIndex = sSQL.indexOf(s_sUNSIGNED,nIndex + s_sUNSIGNED.getLength()+sNewUnsigned.getLength());
- }
- return sSQL;
-}
-// -------------------------------------------------------------------------
-void OTables::createTable( const Reference< XPropertySet >& descriptor )
-{
- const Reference< XConnection > xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
- static const ::rtl::OUString s_sCreatePattern(RTL_CONSTASCII_USTRINGPARAM("(M,D)"));
- const ::rtl::OUString aSql = adjustSQL(::dbtools::createSqlCreateTableStatement(descriptor,xConnection,this,s_sCreatePattern));
- Reference< XStatement > xStmt = xConnection->createStatement( );
- if ( xStmt.is() )
- {
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-void OTables::appendNew(const ::rtl::OUString& _rsNewTable)
-{
- insertElement(_rsNewTable,NULL);
-
- // notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any());
- OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners);
- while (aListenerLoop.hasMoreElements())
- static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent);
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OTables::getNameForObject(const sdbcx::ObjectType& _xObject)
-{
- OSL_ENSURE(_xObject.is(),"OTables::getNameForObject: Object is NULL!");
- return ::dbtools::composeTableName( m_xMetaData, _xObject, ::dbtools::eInDataManipulation, false, false, false );
-}
-// -----------------------------------------------------------------------------
-void OTables::addComment(const Reference< XPropertySet >& descriptor,::rtl::OUStringBuffer& _rOut)
-{
- ::rtl::OUString sDesc;
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION)) >>= sDesc;
- if ( sDesc.getLength() )
- {
- _rOut.appendAscii(" COMMENT '");
- _rOut.append(sDesc);
- _rOut.appendAscii("'");
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/YUser.cxx b/connectivity/source/drivers/mysql/YUser.cxx
deleted file mode 100644
index 50949d5cab..0000000000
--- a/connectivity/source/drivers/mysql/YUser.cxx
+++ /dev/null
@@ -1,352 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "mysql/YUser.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/dbexception.hxx"
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#include <com/sun/star/sdbcx/PrivilegeObject.hpp>
-#include "TConnection.hxx"
-#include "resource/common_res.hrc"
-
-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;
-// -------------------------------------------------------------------------
-OMySQLUser::OMySQLUser( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection) : connectivity::sdbcx::OUser(sal_True)
- ,m_xConnection(_xConnection)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-OMySQLUser::OMySQLUser( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
- const ::rtl::OUString& _Name
- ) : connectivity::sdbcx::OUser(_Name,sal_True)
- ,m_xConnection(_xConnection)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-void OMySQLUser::refreshGroups()
-{
-}
-// -------------------------------------------------------------------------
-OUserExtend::OUserExtend( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection) : OMySQLUser(_xConnection)
-{
- construct();
-}
-// -------------------------------------------------------------------------
-typedef connectivity::sdbcx::OUser OUser_TYPEDEF;
-void OUserExtend::construct()
-{
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), PROPERTY_ID_PASSWORD,0,&m_Password,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
-}
-// -----------------------------------------------------------------------------
-cppu::IPropertyArrayHelper* OUserExtend::createArrayHelper() const
-{
- Sequence< 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 OMySQLUser::getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
-
- sal_Int32 nRights,nRightsWithGrant;
- findPrivilegesAndGrantPrivileges(objName,objType,nRights,nRightsWithGrant);
- return nRights;
-}
-// -----------------------------------------------------------------------------
-void OMySQLUser::findPrivilegesAndGrantPrivileges(const ::rtl::OUString& objName, sal_Int32 objType,sal_Int32& nRights,sal_Int32& nRightsWithGrant) throw(SQLException, RuntimeException)
-{
- nRightsWithGrant = nRights = 0;
- // first we need to create the sql stmt to select the privs
- Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
- ::rtl::OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(xMeta,objName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
- Reference<XResultSet> xRes;
- switch(objType)
- {
- case PrivilegeObject::TABLE:
- case PrivilegeObject::VIEW:
- {
- Any aCatalog;
- if ( sCatalog.getLength() )
- aCatalog <<= sCatalog;
- xRes = xMeta->getTablePrivileges(aCatalog,sSchema,sTable);
- }
- break;
-
- case PrivilegeObject::COLUMN:
- {
- Any aCatalog;
- if ( sCatalog.getLength() )
- aCatalog <<= sCatalog;
- xRes = xMeta->getColumnPrivileges(aCatalog,sSchema,sTable,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")));
- }
- break;
- }
-
- if ( xRes.is() )
- {
- static const ::rtl::OUString sSELECT( RTL_CONSTASCII_USTRINGPARAM( "SELECT" ));
- static const ::rtl::OUString sINSERT( RTL_CONSTASCII_USTRINGPARAM( "INSERT" ));
- static const ::rtl::OUString sUPDATE( RTL_CONSTASCII_USTRINGPARAM( "UPDATE" ));
- static const ::rtl::OUString sDELETE( RTL_CONSTASCII_USTRINGPARAM( "DELETE" ));
- static const ::rtl::OUString sREAD( RTL_CONSTASCII_USTRINGPARAM( "READ" ));
- static const ::rtl::OUString sCREATE( RTL_CONSTASCII_USTRINGPARAM( "CREATE" ));
- static const ::rtl::OUString sALTER( RTL_CONSTASCII_USTRINGPARAM( "ALTER" ));
- static const ::rtl::OUString sREFERENCE( RTL_CONSTASCII_USTRINGPARAM( "REFERENCE" ));
- static const ::rtl::OUString sDROP( RTL_CONSTASCII_USTRINGPARAM( "DROP" ));
- static const ::rtl::OUString sYes( RTL_CONSTASCII_USTRINGPARAM( "YES" ));
-
- nRightsWithGrant = nRights = 0;
-
- Reference<XRow> xCurrentRow(xRes,UNO_QUERY);
- while( xCurrentRow.is() && xRes->next() )
- {
- ::rtl::OUString sGrantee = xCurrentRow->getString(5);
- ::rtl::OUString sPrivilege = xCurrentRow->getString(6);
- ::rtl::OUString sGrantable = xCurrentRow->getString(7);
-
- if (!m_Name.equalsIgnoreAsciiCase(sGrantee))
- continue;
-
- if (sPrivilege.equalsIgnoreAsciiCase(sSELECT))
- {
- nRights |= Privilege::SELECT;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::SELECT;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sINSERT))
- {
- nRights |= Privilege::INSERT;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::INSERT;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sUPDATE))
- {
- nRights |= Privilege::UPDATE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::UPDATE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sDELETE))
- {
- nRights |= Privilege::DELETE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::DELETE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sREAD))
- {
- nRights |= Privilege::READ;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::READ;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sCREATE))
- {
- nRights |= Privilege::CREATE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::CREATE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sALTER))
- {
- nRights |= Privilege::ALTER;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::ALTER;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sREFERENCE))
- {
- nRights |= Privilege::REFERENCE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::REFERENCE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase(sDROP))
- {
- nRights |= Privilege::DROP;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::DROP;
- }
- }
- ::comphelper::disposeComponent(xRes);
- }
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OMySQLUser::getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
-
- sal_Int32 nRights,nRightsWithGrant;
- findPrivilegesAndGrantPrivileges(objName,objType,nRights,nRightsWithGrant);
- return nRightsWithGrant;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OMySQLUser::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException)
-{
- if ( objType != PrivilegeObject::TABLE )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(STR_PRIVILEGE_NOT_GRANTED));
- ::dbtools::throwGenericSQLException(sError,*this);
- } // if ( objType != PrivilegeObject::TABLE )
-
- ::osl::MutexGuard aGuard(m_aMutex);
-
- ::rtl::OUString sPrivs = getPrivilegeString(objPrivileges);
- if(sPrivs.getLength())
- {
- ::rtl::OUString sGrant;
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GRANT "));
- sGrant += sPrivs;
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON "));
- Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
- sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation);
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" TO "));
- sGrant += m_Name;
-
- Reference<XStatement> xStmt = m_xConnection->createStatement();
- if(xStmt.is())
- xStmt->execute(sGrant);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OMySQLUser::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException)
-{
- if ( objType != PrivilegeObject::TABLE )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(STR_PRIVILEGE_NOT_REVOKED));
- ::dbtools::throwGenericSQLException(sError,*this);
- }
-
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
- ::rtl::OUString sPrivs = getPrivilegeString(objPrivileges);
- if(sPrivs.getLength())
- {
- ::rtl::OUString sGrant;
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REVOKE "));
- sGrant += sPrivs;
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON "));
- Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
- sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation);
- sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FROM "));
- sGrant += m_Name;
-
- Reference<XStatement> xStmt = m_xConnection->createStatement();
- if(xStmt.is())
- xStmt->execute(sGrant);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-// XUser
-void SAL_CALL OMySQLUser::changePassword( const ::rtl::OUString& /*oldPassword*/, const ::rtl::OUString& newPassword ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
- ::rtl::OUString sAlterPwd;
- sAlterPwd = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SET PASSWORD FOR "));
- sAlterPwd += m_Name;
- sAlterPwd += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("@\"%\" = PASSWORD('")) ;
- sAlterPwd += newPassword;
- sAlterPwd += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("')")) ;
-
-
- Reference<XStatement> xStmt = m_xConnection->createStatement();
- if ( xStmt.is() )
- {
- xStmt->execute(sAlterPwd);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OMySQLUser::getPrivilegeString(sal_Int32 nRights) const
-{
- ::rtl::OUString sPrivs;
- if((nRights & Privilege::INSERT) == Privilege::INSERT)
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INSERT"));
-
- if((nRights & Privilege::DELETE) == Privilege::DELETE)
- {
- if(sPrivs.getLength())
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DELETE"));
- }
-
- if((nRights & Privilege::UPDATE) == Privilege::UPDATE)
- {
- if(sPrivs.getLength())
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UPDATE"));
- }
-
- if((nRights & Privilege::ALTER) == Privilege::ALTER)
- {
- if(sPrivs.getLength())
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALTER"));
- }
-
- if((nRights & Privilege::SELECT) == Privilege::SELECT)
- {
- if(sPrivs.getLength())
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT"));
- }
-
- if((nRights & Privilege::REFERENCE) == Privilege::REFERENCE)
- {
- if(sPrivs.getLength())
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REFERENCES"));
- }
-
- return sPrivs;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/YUsers.cxx b/connectivity/source/drivers/mysql/YUsers.cxx
deleted file mode 100644
index 17b46179c9..0000000000
--- a/connectivity/source/drivers/mysql/YUsers.cxx
+++ /dev/null
@@ -1,120 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "mysql/YUsers.hxx"
-#include "mysql/YUser.hxx"
-#include "mysql/YTable.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include "connectivity/sdbcx/IRefreshable.hxx"
-#include <comphelper/types.hxx>
-#include "connectivity/dbexception.hxx"
-#include "connectivity/dbtools.hxx"
-#include "TConnection.hxx"
-
-using namespace ::comphelper;
-using namespace connectivity;
-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;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-OUsers::OUsers( ::cppu::OWeakObject& _rParent,
- ::osl::Mutex& _rMutex,
- const TStringVector &_rVector,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
- connectivity::sdbcx::IRefreshableUsers* _pParent)
- : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector)
- ,m_xConnection(_xConnection)
- ,m_pParent(_pParent)
-{
-}
-// -----------------------------------------------------------------------------
-
-sdbcx::ObjectType OUsers::createObject(const ::rtl::OUString& _rName)
-{
- return new OMySQLUser(m_xConnection,_rName);
-}
-// -------------------------------------------------------------------------
-void OUsers::impl_refresh() throw(RuntimeException)
-{
- m_pParent->refreshUsers();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OUsers::createDescriptor()
-{
- OUserExtend* pNew = new OUserExtend(m_xConnection);
- return pNew;
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OUsers::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "GRANT USAGE ON * TO " ));
- ::rtl::OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString( );
- ::rtl::OUString sUserName( _rForName );
- aSql += ::dbtools::quoteName(aQuote,sUserName)
- + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" @\"%\" "));
- ::rtl::OUString sPassword;
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)) >>= sPassword;
- if ( sPassword.getLength() )
- {
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IDENTIFIED BY '"));
- aSql += sPassword;
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'"));
- }
-
- Reference< XStatement > xStmt = m_xConnection->createStatement( );
- if(xStmt.is())
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
-
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OUsers::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName)
-{
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "REVOKE ALL ON * FROM " ));
- ::rtl::OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString( );
- aSql += ::dbtools::quoteName(aQuote,_sElementName);
-
- Reference< XStatement > xStmt = m_xConnection->createStatement( );
- if(xStmt.is())
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
-}
-
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/YViews.cxx b/connectivity/source/drivers/mysql/YViews.cxx
deleted file mode 100644
index 8184a7af1d..0000000000
--- a/connectivity/source/drivers/mysql/YViews.cxx
+++ /dev/null
@@ -1,165 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "mysql/YViews.hxx"
-#include "mysql/YTables.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include <com/sun/star/sdbcx/CheckOption.hpp>
-#include "mysql/YCatalog.hxx"
-#include <comphelper/extract.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/dbexception.hxx"
-#include <cppuhelper/interfacecontainer.h>
-#include "connectivity/sdbcx/VView.hxx"
-#include <comphelper/types.hxx>
-#include "TConnection.hxx"
-
-using namespace ::comphelper;
-
-using namespace ::cppu;
-using namespace connectivity;
-using namespace connectivity::mysql;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace dbtools;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OViews::createObject(const ::rtl::OUString& _rName)
-{
- ::rtl::OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(m_xMetaData,
- _rName,
- sCatalog,
- sSchema,
- sTable,
- ::dbtools::eInDataManipulation);
- return new ::connectivity::sdbcx::OView(isCaseSensitive(),
- sTable,
- m_xMetaData,
- 0,
- ::rtl::OUString(),
- sSchema,
- sCatalog
- );
-}
-// -------------------------------------------------------------------------
-void OViews::impl_refresh( ) throw(RuntimeException)
-{
- static_cast<OMySQLCatalog&>(m_rParent).refreshTables();
-}
-// -------------------------------------------------------------------------
-void OViews::disposing(void)
-{
-m_xMetaData.clear();
- OCollection::disposing();
-}
-// -------------------------------------------------------------------------
-Reference< XPropertySet > OViews::createDescriptor()
-{
- Reference<XConnection> xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
- connectivity::sdbcx::OView* pNew = new connectivity::sdbcx::OView(sal_True,xConnection->getMetaData());
- return pNew;
-}
-// -------------------------------------------------------------------------
-// XAppend
-sdbcx::ObjectType OViews::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- createView(descriptor);
- return createObject( _rForName );
-}
-// -------------------------------------------------------------------------
-// XDrop
-void OViews::dropObject(sal_Int32 _nPos,const ::rtl::OUString /*_sElementName*/)
-{
- if ( m_bInDrop )
- return;
-
- Reference< XInterface > xObject( getObject( _nPos ) );
- sal_Bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject );
- if (!bIsNew)
- {
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP VIEW" ));
-
- Reference<XPropertySet> xProp(xObject,UNO_QUERY);
- aSql += ::dbtools::composeTableName( m_xMetaData, xProp, ::dbtools::eInTableDefinitions, false, false, true );
-
- Reference<XConnection> xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
- Reference< XStatement > xStmt = xConnection->createStatement( );
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-// -----------------------------------------------------------------------------
-void OViews::dropByNameImpl(const ::rtl::OUString& elementName)
-{
- m_bInDrop = sal_True;
- OCollection_TYPE::dropByName(elementName);
- m_bInDrop = sal_False;
-}
-// -----------------------------------------------------------------------------
-void OViews::createView( const Reference< XPropertySet >& descriptor )
-{
- Reference<XConnection> xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
-
- ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE VIEW " ));
- ::rtl::OUString aQuote = xConnection->getMetaData()->getIdentifierQuoteString( );
- ::rtl::OUString sSchema,sCommand;
-
- aSql += ::dbtools::composeTableName( m_xMetaData, descriptor, ::dbtools::eInTableDefinitions, false, false, true );
-
- aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" AS "));
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND)) >>= sCommand;
- aSql += sCommand;
-
- Reference< XStatement > xStmt = xConnection->createStatement( );
- if ( xStmt.is() )
- {
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
-
- // insert the new view also in the tables collection
- OTables* pTables = static_cast<OTables*>(static_cast<OMySQLCatalog&>(m_rParent).getPrivateTables());
- if ( pTables )
- {
- ::rtl::OUString sName = ::dbtools::composeTableName( m_xMetaData, descriptor, ::dbtools::eInDataManipulation, false, false, false );
- pTables->appendNew(sName);
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/Yservices.cxx b/connectivity/source/drivers/mysql/Yservices.cxx
deleted file mode 100644
index f875abac30..0000000000
--- a/connectivity/source/drivers/mysql/Yservices.cxx
+++ /dev/null
@@ -1,115 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "mysql/YDriver.hxx"
-#include <cppuhelper/factory.hxx>
-
-using namespace connectivity::mysql;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount* _pT
- );
-
-//---------------------------------------------------------------------------------------
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- sal_Char const* pImplementationName
- )
- : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- inline
- sal_Bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
- }
- catch(...)
- {
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = 0;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- ODriverDelegator::getImplementationName_Static(),
- ODriverDelegator::getSupportedServiceNames_Static(),
- ODriverDelegator_CreateInstance, ::cppu::createSingleFactory)
- ;
-
- if(aReq.xRet.is())
- aReq.xRet->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/exports.dxp b/connectivity/source/drivers/mysql/exports.dxp
deleted file mode 100755
index 7003307892..0000000000
--- a/connectivity/source/drivers/mysql/exports.dxp
+++ /dev/null
@@ -1 +0,0 @@
-component_getFactory
diff --git a/connectivity/source/drivers/mysql/makefile.mk b/connectivity/source/drivers/mysql/makefile.mk
deleted file mode 100755
index 453f4b652f..0000000000
--- a/connectivity/source/drivers/mysql/makefile.mk
+++ /dev/null
@@ -1,92 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=mysql
-
-ENABLE_EXCEPTIONS=TRUE
-VISIBILITY_HIDDEN=TRUE
-
-# --- Settings ----------------------------------
-.IF "$(DBGUTIL_OJ)"!=""
-ENVCFLAGS+=/FR$(SLO)$/
-.ENDIF
-
-.INCLUDE : $(PRJ)$/makefile.pmk
-.INCLUDE : $(PRJ)$/version.mk
-
-
-# --- Files -------------------------------------
-
-SLOFILES=\
- $(SLO)$/YDriver.obj \
- $(SLO)$/YTables.obj \
- $(SLO)$/YTable.obj \
- $(SLO)$/YViews.obj \
- $(SLO)$/YCatalog.obj \
- $(SLO)$/YColumns.obj \
- $(SLO)$/YUser.obj \
- $(SLO)$/YUsers.obj \
- $(SLO)$/Yservices.obj
-
-SHL1VERSIONMAP=$(SOLARENV)/src/component.map
-
-# --- Library -----------------------------------
-
-SHL1TARGET= $(MYSQL_TARGET)$(DLLPOSTFIX)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SALLIB) \
- $(DBTOOLSLIB) \
- $(COMPHELPERLIB)
-
-
-SHL1DEPN=
-SHL1IMPLIB= i$(MYSQL_TARGET)
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
-
-# --- Targets ----------------------------------
-
-.INCLUDE : $(PRJ)$/target.pmk
-
-
-
-ALLTAR : $(MISC)/mysql.component
-
-$(MISC)/mysql.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- mysql.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt mysql.component
diff --git a/connectivity/source/drivers/mysql/mysql.component b/connectivity/source/drivers/mysql/mysql.component
deleted file mode 100755
index ced2297fa0..0000000000
--- a/connectivity/source/drivers/mysql/mysql.component
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="org.openoffice.comp.drivers.MySQL.Driver">
- <service name="com.sun.star.sdbc.Driver"/>
- <service name="com.sun.star.sdbcx.Driver"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/mysql/mysql.xcu b/connectivity/source/drivers/mysql/mysql.xcu
deleted file mode 100644
index 16e3c82031..0000000000
--- a/connectivity/source/drivers/mysql/mysql.xcu
+++ /dev/null
@@ -1,258 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="sdbc:mysql:jdbc:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>org.openoffice.comp.drivers.MySQL.Driver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">MySQL (JDBC)</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="CharSet" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="JavaDriverClass" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>com.mysql.jdbc.Driver</value>
- </prop>
- </node>
- <node oor:name="AddIndexAppendix" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="DisplayVersionColumns" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseDOSLineEnds" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="BooleanComparisonMode" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FormsCheckRequiredFields" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseJava" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- <node oor:name="SupportsColumnDescription" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:mysql:odbc:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>org.openoffice.comp.drivers.MySQL.Driver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">MySQL (ODBC)</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="CharSet" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="AddIndexAppendix" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="DisplayVersionColumns" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseDOSLineEnds" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="BooleanComparisonMode" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FormsCheckRequiredFields" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:mysql:mysqlc:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>org.openoffice.comp.drivers.MySQL.Driver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">MySQL (Native)</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="CharSet" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="LocalSocket" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="NamedPipe" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="AddIndexAppendix" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="DisplayVersionColumns" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseDOSLineEnds" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="BooleanComparisonMode" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FormsCheckRequiredFields" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- <node oor:name="SupportsColumnDescription" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/mysql/mysql.xml b/connectivity/source/drivers/mysql/mysql.xml
deleted file mode 100755
index 93cb83d0ab..0000000000
--- a/connectivity/source/drivers/mysql/mysql.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<!DOCTYPE module-description PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
-<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
- <module-name>odbc</module-name>
- <component-description>
- <author>Ocke Janssen</author>
- <name>org.openoffice.comp.drivers.MySQL.Driver</name>
- <description>
- This is the implementation of the MySQL driver.
- </description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service>com.sun.star.sdbc.Driver</supported-service>
- <supported-service>com.sun.star.sdbcx.Driver</supported-service>
- </component-description>
- <project-build-dependency>cppuhelper</project-build-dependency>
- <project-build-dependency>cppu</project-build-dependency>
- <project-build-dependency>sal</project-build-dependency>
- <runtime-module-dependency>cppuhelper</runtime-module-dependency>
- <runtime-module-dependency>cppu</runtime-module-dependency>
- <runtime-module-dependency>sal</runtime-module-dependency>
- <runtime-module-dependency>dbtools</runtime-module-dependency>
- <runtime-module-dependency>comphelper</runtime-module-dependency>
-</module-description>
-
-
diff --git a/connectivity/source/drivers/odbc/OFunctions.cxx b/connectivity/source/drivers/odbc/OFunctions.cxx
deleted file mode 100644
index 13454de964..0000000000
--- a/connectivity/source/drivers/odbc/OFunctions.cxx
+++ /dev/null
@@ -1,249 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-//--------------------------------------------------------------------------
-#include "odbc/OFunctions.hxx"
-#include <osl/process.h>
-
-// Implib-Definitionen fuer ODBC-DLL/shared library:
-
-namespace connectivity
-{
- T3SQLAllocHandle pODBC3SQLAllocHandle;
-T3SQLConnect pODBC3SQLConnect;
-T3SQLDriverConnect pODBC3SQLDriverConnect;
-T3SQLBrowseConnect pODBC3SQLBrowseConnect;
-T3SQLDataSources pODBC3SQLDataSources;
-T3SQLDrivers pODBC3SQLDrivers;
-T3SQLGetInfo pODBC3SQLGetInfo;
-T3SQLGetFunctions pODBC3SQLGetFunctions;
-T3SQLGetTypeInfo pODBC3SQLGetTypeInfo;
-T3SQLSetConnectAttr pODBC3SQLSetConnectAttr;
-T3SQLGetConnectAttr pODBC3SQLGetConnectAttr;
-T3SQLSetEnvAttr pODBC3SQLSetEnvAttr;
-T3SQLGetEnvAttr pODBC3SQLGetEnvAttr;
-T3SQLSetStmtAttr pODBC3SQLSetStmtAttr;
-T3SQLGetStmtAttr pODBC3SQLGetStmtAttr;
-T3SQLPrepare pODBC3SQLPrepare;
-T3SQLBindParameter pODBC3SQLBindParameter;
-T3SQLSetCursorName pODBC3SQLSetCursorName;
-T3SQLExecute pODBC3SQLExecute;
-T3SQLExecDirect pODBC3SQLExecDirect;
-T3SQLDescribeParam pODBC3SQLDescribeParam;
-T3SQLNumParams pODBC3SQLNumParams;
-T3SQLParamData pODBC3SQLParamData;
-T3SQLPutData pODBC3SQLPutData;
-T3SQLRowCount pODBC3SQLRowCount;
-T3SQLNumResultCols pODBC3SQLNumResultCols;
-T3SQLDescribeCol pODBC3SQLDescribeCol;
-T3SQLColAttribute pODBC3SQLColAttribute;
-T3SQLBindCol pODBC3SQLBindCol;
-T3SQLFetch pODBC3SQLFetch;
-T3SQLFetchScroll pODBC3SQLFetchScroll;
-T3SQLGetData pODBC3SQLGetData;
-T3SQLSetPos pODBC3SQLSetPos;
-T3SQLBulkOperations pODBC3SQLBulkOperations;
-T3SQLMoreResults pODBC3SQLMoreResults;
-T3SQLGetDiagRec pODBC3SQLGetDiagRec;
-T3SQLColumnPrivileges pODBC3SQLColumnPrivileges;
-T3SQLColumns pODBC3SQLColumns;
-T3SQLForeignKeys pODBC3SQLForeignKeys;
-T3SQLPrimaryKeys pODBC3SQLPrimaryKeys;
-T3SQLProcedureColumns pODBC3SQLProcedureColumns;
-T3SQLProcedures pODBC3SQLProcedures;
-T3SQLSpecialColumns pODBC3SQLSpecialColumns;
-T3SQLStatistics pODBC3SQLStatistics;
-T3SQLTablePrivileges pODBC3SQLTablePrivileges;
-T3SQLTables pODBC3SQLTables;
-T3SQLFreeStmt pODBC3SQLFreeStmt;
-T3SQLCloseCursor pODBC3SQLCloseCursor;
-T3SQLCancel pODBC3SQLCancel;
-T3SQLEndTran pODBC3SQLEndTran;
-T3SQLDisconnect pODBC3SQLDisconnect;
-T3SQLFreeHandle pODBC3SQLFreeHandle;
-T3SQLGetCursorName pODBC3SQLGetCursorName;
-T3SQLNativeSql pODBC3SQLNativeSql;
-
-sal_Bool LoadFunctions(oslModule pODBCso);
-// -------------------------------------------------------------------------
-// Take care of Dynamicly loading of the DLL/shared lib and Addresses:
-// Returns sal_True at success
-sal_Bool LoadLibrary_ODBC3(::rtl::OUString &_rPath)
-{
- static sal_Bool bLoaded = sal_False;
- static oslModule pODBCso = NULL;
-
- if (bLoaded)
- return sal_True;
-#ifdef WNT
- _rPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODBC32.DLL"));
-#endif
-#ifdef UNX
- #ifdef MACOSX
- _rPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("libiodbc.dylib"));
- #else
- _rPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("libodbc.so.1"));
- pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
- if ( !pODBCso )
- _rPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("libodbc.so"));
- #endif /* MACOSX */
-#endif
-
- if ( !pODBCso )
- pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW );
- if( !pODBCso)
- return sal_False;
-
- return bLoaded = LoadFunctions(pODBCso);
-}
-// -------------------------------------------------------------------------
-
-sal_Bool LoadFunctions(oslModule pODBCso)
-{
-
- if( ( pODBC3SQLAllocHandle = (T3SQLAllocHandle)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLAllocHandle")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLConnect = (T3SQLConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLConnect")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLDriverConnect = (T3SQLDriverConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDriverConnect")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLBrowseConnect = (T3SQLBrowseConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBrowseConnect")).pData )) == NULL )
- return sal_False;
- if(( pODBC3SQLDataSources = (T3SQLDataSources)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDataSources")).pData )) == NULL )
- return sal_False;
- if(( pODBC3SQLDrivers = (T3SQLDrivers)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDrivers")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetInfo = (T3SQLGetInfo)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetInfo")).pData )) == NULL )
- return sal_False;
- if(( pODBC3SQLGetFunctions = (T3SQLGetFunctions)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetFunctions")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetTypeInfo = (T3SQLGetTypeInfo)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetTypeInfo")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLSetConnectAttr = (T3SQLSetConnectAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetConnectAttr")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetConnectAttr = (T3SQLGetConnectAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetConnectAttr")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLSetEnvAttr = (T3SQLSetEnvAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetEnvAttr")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetEnvAttr = (T3SQLGetEnvAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetEnvAttr")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLSetStmtAttr = (T3SQLSetStmtAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetStmtAttr")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetStmtAttr = (T3SQLGetStmtAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetStmtAttr")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLPrepare = (T3SQLPrepare)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLPrepare")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLBindParameter = (T3SQLBindParameter)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBindParameter")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLSetCursorName = (T3SQLSetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetCursorName")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLExecute = (T3SQLExecute)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLExecute")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLExecDirect = (T3SQLExecDirect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLExecDirect")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLDescribeParam = (T3SQLDescribeParam)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDescribeParam")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLNumParams = (T3SQLNumParams)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNumParams")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLParamData = (T3SQLParamData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLParamData")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLPutData = (T3SQLPutData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLPutData")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLRowCount = (T3SQLRowCount)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLRowCount")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLNumResultCols = (T3SQLNumResultCols)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNumResultCols")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLDescribeCol = (T3SQLDescribeCol)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDescribeCol")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLColAttribute = (T3SQLColAttribute)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLColAttribute")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLBindCol = (T3SQLBindCol)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBindCol")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLFetch = (T3SQLFetch)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFetch")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLFetchScroll = (T3SQLFetchScroll)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFetchScroll")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetData = (T3SQLGetData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetData")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLSetPos = (T3SQLSetPos)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetPos")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLBulkOperations = (T3SQLBulkOperations)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBulkOperations")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLMoreResults = (T3SQLMoreResults)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLMoreResults")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetDiagRec = (T3SQLGetDiagRec)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetDiagRec")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLColumnPrivileges = (T3SQLColumnPrivileges)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLColumnPrivileges")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLColumns = (T3SQLColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLColumns")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLForeignKeys = (T3SQLForeignKeys)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLForeignKeys")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLPrimaryKeys = (T3SQLPrimaryKeys)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLPrimaryKeys")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLProcedureColumns = (T3SQLProcedureColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLProcedureColumns")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLProcedures = (T3SQLProcedures)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLProcedures")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLSpecialColumns = (T3SQLSpecialColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSpecialColumns")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLStatistics = (T3SQLStatistics)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLStatistics")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLTablePrivileges = (T3SQLTablePrivileges)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLTablePrivileges")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLTables = (T3SQLTables)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLTables")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLFreeStmt = (T3SQLFreeStmt)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFreeStmt")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLCloseCursor = (T3SQLCloseCursor)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLCloseCursor")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLCancel = (T3SQLCancel)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLCancel")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLEndTran = (T3SQLEndTran)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLEndTran")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLDisconnect = (T3SQLDisconnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDisconnect")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLFreeHandle = (T3SQLFreeHandle)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFreeHandle")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLGetCursorName = (T3SQLGetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetCursorName")).pData )) == NULL )
- return sal_False;
- if( ( pODBC3SQLNativeSql = (T3SQLNativeSql)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNativeSql")).pData )) == NULL )
- return sal_False;
-
- return sal_True;
-}
-// -------------------------------------------------------------------------
-
-}
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbc/ORealDriver.cxx b/connectivity/source/drivers/odbc/ORealDriver.cxx
deleted file mode 100644
index 12b3b42973..0000000000
--- a/connectivity/source/drivers/odbc/ORealDriver.cxx
+++ /dev/null
@@ -1,371 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ORealDriver.hxx"
-#include "odbc/ODriver.hxx"
-#include "odbc/OTools.hxx"
-#include "odbc/OFunctions.hxx"
-#include "diagnose_ex.h"
-
-namespace connectivity
-{
- sal_Bool LoadFunctions(oslModule pODBCso);
- sal_Bool LoadLibrary_ODBC3(::rtl::OUString &_rPath);
- // extern declaration of the function pointer
- extern T3SQLAllocHandle pODBC3SQLAllocHandle;
- extern T3SQLConnect pODBC3SQLConnect;
- extern T3SQLDriverConnect pODBC3SQLDriverConnect;
- extern T3SQLBrowseConnect pODBC3SQLBrowseConnect;
- extern T3SQLDataSources pODBC3SQLDataSources;
- extern T3SQLDrivers pODBC3SQLDrivers;
- extern T3SQLGetInfo pODBC3SQLGetInfo;
- extern T3SQLGetFunctions pODBC3SQLGetFunctions;
- extern T3SQLGetTypeInfo pODBC3SQLGetTypeInfo;
- extern T3SQLSetConnectAttr pODBC3SQLSetConnectAttr;
- extern T3SQLGetConnectAttr pODBC3SQLGetConnectAttr;
- extern T3SQLSetEnvAttr pODBC3SQLSetEnvAttr;
- extern T3SQLGetEnvAttr pODBC3SQLGetEnvAttr;
- extern T3SQLSetStmtAttr pODBC3SQLSetStmtAttr;
- extern T3SQLGetStmtAttr pODBC3SQLGetStmtAttr;
- //extern T3SQLSetDescField pODBC3SQLSetDescField;
- //extern T3SQLGetDescField pODBC3SQLGetDescField;
- //extern T3SQLGetDescRec pODBC3SQLGetDescRec;
- //extern T3SQLSetDescRec pODBC3SQLSetDescRec;
- extern T3SQLPrepare pODBC3SQLPrepare;
- extern T3SQLBindParameter pODBC3SQLBindParameter;
- //extern T3SQLGetCursorName pODBC3SQLGetCursorName;
- extern T3SQLSetCursorName pODBC3SQLSetCursorName;
- extern T3SQLExecute pODBC3SQLExecute;
- extern T3SQLExecDirect pODBC3SQLExecDirect;
- //extern T3SQLNativeSql pODBC3SQLNativeSql;
- extern T3SQLDescribeParam pODBC3SQLDescribeParam;
- extern T3SQLNumParams pODBC3SQLNumParams;
- extern T3SQLParamData pODBC3SQLParamData;
- extern T3SQLPutData pODBC3SQLPutData;
- extern T3SQLRowCount pODBC3SQLRowCount;
- extern T3SQLNumResultCols pODBC3SQLNumResultCols;
- extern T3SQLDescribeCol pODBC3SQLDescribeCol;
- extern T3SQLColAttribute pODBC3SQLColAttribute;
- extern T3SQLBindCol pODBC3SQLBindCol;
- extern T3SQLFetch pODBC3SQLFetch;
- extern T3SQLFetchScroll pODBC3SQLFetchScroll;
- extern T3SQLGetData pODBC3SQLGetData;
- extern T3SQLSetPos pODBC3SQLSetPos;
- extern T3SQLBulkOperations pODBC3SQLBulkOperations;
- extern T3SQLMoreResults pODBC3SQLMoreResults;
- //extern T3SQLGetDiagField pODBC3SQLGetDiagField;
- extern T3SQLGetDiagRec pODBC3SQLGetDiagRec;
- extern T3SQLColumnPrivileges pODBC3SQLColumnPrivileges;
- extern T3SQLColumns pODBC3SQLColumns;
- extern T3SQLForeignKeys pODBC3SQLForeignKeys;
- extern T3SQLPrimaryKeys pODBC3SQLPrimaryKeys;
- extern T3SQLProcedureColumns pODBC3SQLProcedureColumns;
- extern T3SQLProcedures pODBC3SQLProcedures;
- extern T3SQLSpecialColumns pODBC3SQLSpecialColumns;
- extern T3SQLStatistics pODBC3SQLStatistics;
- extern T3SQLTablePrivileges pODBC3SQLTablePrivileges;
- extern T3SQLTables pODBC3SQLTables;
- extern T3SQLFreeStmt pODBC3SQLFreeStmt;
- extern T3SQLCloseCursor pODBC3SQLCloseCursor;
- extern T3SQLCancel pODBC3SQLCancel;
- extern T3SQLEndTran pODBC3SQLEndTran;
- extern T3SQLDisconnect pODBC3SQLDisconnect;
- extern T3SQLFreeHandle pODBC3SQLFreeHandle;
- extern T3SQLGetCursorName pODBC3SQLGetCursorName;
- extern T3SQLNativeSql pODBC3SQLNativeSql;
-
-
- namespace odbc
- {
- class ORealObdcDriver : public ODBCDriver
- {
- protected:
- virtual oslGenericFunction getOdbcFunction(sal_Int32 _nIndex) const;
- virtual SQLHANDLE EnvironmentHandle(::rtl::OUString &_rPath);
- public:
- ORealObdcDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) : ODBCDriver(_rxFactory) {}
- };
-
- //------------------------------------------------------------------
-oslGenericFunction ORealObdcDriver::getOdbcFunction(sal_Int32 _nIndex) const
-{
- oslGenericFunction pFunction = NULL;
- switch(_nIndex)
- {
- case ODBC3SQLAllocHandle:
- pFunction = (oslGenericFunction)pODBC3SQLAllocHandle;
- break;
- case ODBC3SQLConnect:
- pFunction = (oslGenericFunction)pODBC3SQLConnect;
- break;
- case ODBC3SQLDriverConnect:
- pFunction = (oslGenericFunction)pODBC3SQLDriverConnect;
- break;
- case ODBC3SQLBrowseConnect:
- pFunction = (oslGenericFunction)pODBC3SQLBrowseConnect;
- break;
- case ODBC3SQLDataSources:
- pFunction = (oslGenericFunction)pODBC3SQLDataSources;
- break;
- case ODBC3SQLDrivers:
- pFunction = (oslGenericFunction)pODBC3SQLDrivers;
- break;
- case ODBC3SQLGetInfo:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetInfo;
- break;
- case ODBC3SQLGetFunctions:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetFunctions;
- break;
- case ODBC3SQLGetTypeInfo:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetTypeInfo;
- break;
- case ODBC3SQLSetConnectAttr:
-
- pFunction = (oslGenericFunction)pODBC3SQLSetConnectAttr;
- break;
- case ODBC3SQLGetConnectAttr:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetConnectAttr;
- break;
- case ODBC3SQLSetEnvAttr:
-
- pFunction = (oslGenericFunction)pODBC3SQLSetEnvAttr;
- break;
- case ODBC3SQLGetEnvAttr:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetEnvAttr;
- break;
- case ODBC3SQLSetStmtAttr:
-
- pFunction = (oslGenericFunction)pODBC3SQLSetStmtAttr;
- break;
- case ODBC3SQLGetStmtAttr:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetStmtAttr;
- break;
- case ODBC3SQLPrepare:
-
- pFunction = (oslGenericFunction)pODBC3SQLPrepare;
- break;
- case ODBC3SQLBindParameter:
-
- pFunction = (oslGenericFunction)pODBC3SQLBindParameter;
- break;
- case ODBC3SQLSetCursorName:
-
- pFunction = (oslGenericFunction)pODBC3SQLSetCursorName;
- break;
- case ODBC3SQLExecute:
-
- pFunction = (oslGenericFunction)pODBC3SQLExecute;
- break;
- case ODBC3SQLExecDirect:
-
- pFunction = (oslGenericFunction)pODBC3SQLExecDirect;
- break;
- case ODBC3SQLDescribeParam:
-
- pFunction = (oslGenericFunction)pODBC3SQLDescribeParam;
- break;
- case ODBC3SQLNumParams:
-
- pFunction = (oslGenericFunction)pODBC3SQLNumParams;
- break;
- case ODBC3SQLParamData:
-
- pFunction = (oslGenericFunction)pODBC3SQLParamData;
- break;
- case ODBC3SQLPutData:
-
- pFunction = (oslGenericFunction)pODBC3SQLPutData;
- break;
- case ODBC3SQLRowCount:
-
- pFunction = (oslGenericFunction)pODBC3SQLRowCount;
- break;
- case ODBC3SQLNumResultCols:
-
- pFunction = (oslGenericFunction)pODBC3SQLNumResultCols;
- break;
- case ODBC3SQLDescribeCol:
-
- pFunction = (oslGenericFunction)pODBC3SQLDescribeCol;
- break;
- case ODBC3SQLColAttribute:
-
- pFunction = (oslGenericFunction)pODBC3SQLColAttribute;
- break;
- case ODBC3SQLBindCol:
-
- pFunction = (oslGenericFunction)pODBC3SQLBindCol;
- break;
- case ODBC3SQLFetch:
-
- pFunction = (oslGenericFunction)pODBC3SQLFetch;
- break;
- case ODBC3SQLFetchScroll:
-
- pFunction = (oslGenericFunction)pODBC3SQLFetchScroll;
- break;
- case ODBC3SQLGetData:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetData;
- break;
- case ODBC3SQLSetPos:
-
- pFunction = (oslGenericFunction)pODBC3SQLSetPos;
- break;
- case ODBC3SQLBulkOperations:
-
- pFunction = (oslGenericFunction)pODBC3SQLBulkOperations;
- break;
- case ODBC3SQLMoreResults:
-
- pFunction = (oslGenericFunction)pODBC3SQLMoreResults;
- break;
- case ODBC3SQLGetDiagRec:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetDiagRec;
- break;
- case ODBC3SQLColumnPrivileges:
-
- pFunction = (oslGenericFunction)pODBC3SQLColumnPrivileges;
- break;
- case ODBC3SQLColumns:
-
- pFunction = (oslGenericFunction)pODBC3SQLColumns;
- break;
- case ODBC3SQLForeignKeys:
-
- pFunction = (oslGenericFunction)pODBC3SQLForeignKeys;
- break;
- case ODBC3SQLPrimaryKeys:
-
- pFunction = (oslGenericFunction)pODBC3SQLPrimaryKeys;
- break;
- case ODBC3SQLProcedureColumns:
-
- pFunction = (oslGenericFunction)pODBC3SQLProcedureColumns;
- break;
- case ODBC3SQLProcedures:
-
- pFunction = (oslGenericFunction)pODBC3SQLProcedures;
- break;
- case ODBC3SQLSpecialColumns:
-
- pFunction = (oslGenericFunction)pODBC3SQLSpecialColumns;
- break;
- case ODBC3SQLStatistics:
-
- pFunction = (oslGenericFunction)pODBC3SQLStatistics;
- break;
- case ODBC3SQLTablePrivileges:
-
- pFunction = (oslGenericFunction)pODBC3SQLTablePrivileges;
- break;
- case ODBC3SQLTables:
-
- pFunction = (oslGenericFunction)pODBC3SQLTables;
- break;
- case ODBC3SQLFreeStmt:
-
- pFunction = (oslGenericFunction)pODBC3SQLFreeStmt;
- break;
- case ODBC3SQLCloseCursor:
-
- pFunction = (oslGenericFunction)pODBC3SQLCloseCursor;
- break;
- case ODBC3SQLCancel:
-
- pFunction = (oslGenericFunction)pODBC3SQLCancel;
- break;
- case ODBC3SQLEndTran:
-
- pFunction = (oslGenericFunction)pODBC3SQLEndTran;
- break;
- case ODBC3SQLDisconnect:
-
- pFunction = (oslGenericFunction)pODBC3SQLDisconnect;
- break;
- case ODBC3SQLFreeHandle:
-
- pFunction = (oslGenericFunction)pODBC3SQLFreeHandle;
- break;
- case ODBC3SQLGetCursorName:
-
- pFunction = (oslGenericFunction)pODBC3SQLGetCursorName;
- break;
- case ODBC3SQLNativeSql:
-
- pFunction = (oslGenericFunction)pODBC3SQLNativeSql;
- break;
- default:
- OSL_FAIL("Function unknown!");
- }
- return pFunction;
-}
-
-//------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ODBCDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
-{
- return *(new ORealObdcDriver(_rxFactory));
-}
-// -----------------------------------------------------------------------------
-// ODBC Environment (common for all Connections):
-SQLHANDLE ORealObdcDriver::EnvironmentHandle(::rtl::OUString &_rPath)
-{
- // Is (for this instance) already a Enviroment made?
- if (!m_pDriverHandle)
- {
- SQLHANDLE h = SQL_NULL_HANDLE;
- // allocate Environment
-
- // load ODBC-DLL now:
- if (!LoadLibrary_ODBC3(_rPath) || N3SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&h) != SQL_SUCCESS)
- return SQL_NULL_HANDLE;
-
- // Save in global Structure
- m_pDriverHandle = h;
- SQLRETURN nError = N3SQLSetEnvAttr(h, SQL_ATTR_ODBC_VERSION,(SQLPOINTER) SQL_OV_ODBC3, SQL_IS_UINTEGER);
- OSL_UNUSED( nError );
- //N3SQLSetEnvAttr(h, SQL_ATTR_CONNECTION_POOLING,(SQLPOINTER) SQL_CP_ONE_PER_HENV, SQL_IS_INTEGER);
- }
-
- return m_pDriverHandle;
-}
-// -----------------------------------------------------------------------------
-
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbc/ORealDriver.hxx b/connectivity/source/drivers/odbc/ORealDriver.hxx
deleted file mode 100644
index 9b1939335a..0000000000
--- a/connectivity/source/drivers/odbc/ORealDriver.hxx
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_ODBC_OREALDRIVER_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_ODBC_OREALDRIVER_HXX
-
-#include "sal/config.h"
-
-#include "com/sun/star/uno/Exception.hpp"
-#include "com/sun/star/uno/Reference.hxx"
-
-namespace com { namespace sun { namespace star {
- namespace lang { class XMultiServiceFactory; }
- namespace uno { class XInterface; }
-} } }
-
-namespace connectivity { namespace odbc {
-
-com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
-ODBCDriver_CreateInstance(
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
- const & factory)
- throw (com::sun::star::uno::Exception);
-
-} }
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbc/makefile.mk b/connectivity/source/drivers/odbc/makefile.mk
deleted file mode 100755
index 6d701b87c5..0000000000
--- a/connectivity/source/drivers/odbc/makefile.mk
+++ /dev/null
@@ -1,87 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=odbc
-
-ENABLE_EXCEPTIONS=TRUE
-VISIBILITY_HIDDEN=TRUE
-USE_DEFFILE=TRUE
-LDUMP=ldump2.exe
-
-# --- Settings ----------------------------------
-
-.IF "$(DBGUTIL_OJ)"!=""
-ENVCFLAGS+=/FR$(SLO)$/
-.ENDIF
-
-.INCLUDE : $(PRJ)$/makefile.pmk
-.INCLUDE : $(PRJ)$/version.mk
-
-.IF "$(SYSTEM_ODBC_HEADERS)" == "YES"
-CFLAGS+=-DSYSTEM_ODBC_HEADERS
-.ENDIF
-
-# --- ODBC Library -----------------------------------
-# --- Files -------------------------------------
-
-SLOFILES=\
- $(SLO)$/oservices.obj \
- $(SLO)$/ORealDriver.obj \
- $(SLO)$/OFunctions.obj
-
-# --- ODBC Library -----------------------------------
-
-SHL1TARGET= $(ODBC_TARGET)$(DLLPOSTFIX)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(ODBCBASELIB) \
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(SALLIB) \
- $(SALHELPERLIB)
-
-SHL1IMPLIB= i$(ODBC_TARGET)
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-SHL1VERSIONMAP=$(SOLARENV)/src/component.map
-
-# --- Targets ----------------------------------
-
-.INCLUDE : $(PRJ)$/target.pmk
-
-ALLTAR : $(MISC)/odbc.component
-
-$(MISC)/odbc.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- odbc.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt odbc.component
diff --git a/connectivity/source/drivers/odbc/odbc.component b/connectivity/source/drivers/odbc/odbc.component
deleted file mode 100755
index d4e6bc127d..0000000000
--- a/connectivity/source/drivers/odbc/odbc.component
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.sdbc.ODBCDriver">
- <service name="com.sun.star.sdbc.Driver"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/odbc/odbc.xcu b/connectivity/source/drivers/odbc/odbc.xcu
deleted file mode 100644
index b664b38977..0000000000
--- a/connectivity/source/drivers/odbc/odbc.xcu
+++ /dev/null
@@ -1,180 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="sdbc:odbc:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.ODBCDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">ODBC</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="CharSet" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="SystemDriverSettings" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="UseCatalog" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- <node oor:name="AutoIncrementCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="AutoRetrievingStatement" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="IsAutoRetrievingEnabled" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- <node oor:name="AddIndexAppendix" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="GeneratedValues" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="AppendTableAliasInSelect" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseBracketedOuterJoinSyntax" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="ParameterNameSubstitution" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="DisplayVersionColumns" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseCatalogInSelect" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseSchemaInSelect" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseIndexDirectionKeyword" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseDOSLineEnds" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="BooleanComparisonMode" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FormsCheckRequiredFields" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="PrimaryKeySupport" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="RespectDriverResultSetType" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/odbc/odbc.xml b/connectivity/source/drivers/odbc/odbc.xml
deleted file mode 100755
index eae2d3f3e1..0000000000
--- a/connectivity/source/drivers/odbc/odbc.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<!DOCTYPE module-description PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
-<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
- <module-name>odbc</module-name>
- <component-description>
- <author>Ocke Janssen</author>
- <name>com.sun.star.comp.sdbc.ODBCDriver</name>
- <description>
- This is the implementation of the sdbc-odbc bridge.
- </description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service>com.sun.star.sdbc.Driver</supported-service>
- </component-description>
- <project-build-dependency>cppuhelper</project-build-dependency>
- <project-build-dependency>cppu</project-build-dependency>
- <project-build-dependency>sal</project-build-dependency>
- <runtime-module-dependency>cppuhelper</runtime-module-dependency>
- <runtime-module-dependency>cppu</runtime-module-dependency>
- <runtime-module-dependency>sal</runtime-module-dependency>
- <runtime-module-dependency>dbtools</runtime-module-dependency>
- <runtime-module-dependency>comphelper</runtime-module-dependency>
-</module-description>
-
-
diff --git a/connectivity/source/drivers/odbc/oservices.cxx b/connectivity/source/drivers/odbc/oservices.cxx
deleted file mode 100644
index b35877b7fa..0000000000
--- a/connectivity/source/drivers/odbc/oservices.cxx
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "ORealDriver.hxx"
-#include "odbc/ODriver.hxx"
-#include <cppuhelper/factory.hxx>
-
-using namespace connectivity::odbc;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount* _pTemp
- );
-
-//---------------------------------------------------------------------------------------
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- sal_Char const* pImplementationName
- )
- : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- inline
- sal_Bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
- }
- catch(...)
- {
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = 0;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- ODBCDriver::getImplementationName_Static(),
- ODBCDriver::getSupportedServiceNames_Static(),
- ODBCDriver_CreateInstance, ::cppu::createSingleFactory)
- ;
-
- if(aReq.xRet.is())
- aReq.xRet->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/OConnection.cxx b/connectivity/source/drivers/odbcbase/OConnection.cxx
deleted file mode 100644
index 3a9a50dbb8..0000000000
--- a/connectivity/source/drivers/odbcbase/OConnection.cxx
+++ /dev/null
@@ -1,672 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "odbc/OTools.hxx"
-#include "odbc/OConnection.hxx"
-#include "odbc/ODatabaseMetaData.hxx"
-#include "odbc/OFunctions.hxx"
-#include "odbc/ODriver.hxx"
-#include "odbc/OStatement.hxx"
-#include "odbc/OPreparedStatement.hxx"
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <connectivity/dbcharset.hxx>
-#include <connectivity/FValue.hxx>
-#include <comphelper/extract.hxx>
-#include "diagnose_ex.h"
-#include <connectivity/dbexception.hxx>
-
-#include <string.h>
-
-using namespace connectivity::odbc;
-using namespace connectivity;
-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;
-// --------------------------------------------------------------------------------
-OConnection::OConnection(const SQLHANDLE _pDriverHandle,ODBCDriver* _pDriver)
- : OSubComponent<OConnection, OConnection_BASE>((::cppu::OWeakObject*)_pDriver, this)
- ,m_pDriver(_pDriver)
- ,m_pDriverHandleCopy(_pDriverHandle)
- ,m_nStatementCount(0)
- ,m_bClosed(sal_True)
- ,m_bUseCatalog(sal_False)
- ,m_bUseOldDateFormat(sal_False)
- ,m_bParameterSubstitution(sal_False)
- ,m_bIgnoreDriverPrivileges(sal_False)
- ,m_bPreventGetVersionColumns(sal_False)
- ,m_bReadOnly(sal_True)
-{
- m_pDriver->acquire();
-}
-//-----------------------------------------------------------------------------
-OConnection::~OConnection()
-{
- if(!isClosed( ))
- close();
-
- if ( SQL_NULL_HANDLE != m_aConnectionHandle )
- N3SQLFreeHandle( SQL_HANDLE_DBC, m_aConnectionHandle );
- m_aConnectionHandle = SQL_NULL_HANDLE;
-
- m_pDriver->release();
- m_pDriver = NULL;
-}
-//-----------------------------------------------------------------------------
-void SAL_CALL OConnection::release() throw()
-{
- relase_ChildImpl();
-}
-// -----------------------------------------------------------------------------
-oslGenericFunction OConnection::getOdbcFunction(sal_Int32 _nIndex) const
-{
- OSL_ENSURE(m_pDriver,"OConnection::getOdbcFunction: m_pDriver is null!");
- return m_pDriver->getOdbcFunction(_nIndex);
-}
-//-----------------------------------------------------------------------------
-SQLRETURN OConnection::OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int32 nTimeOut, sal_Bool bSilent)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if (m_aConnectionHandle == SQL_NULL_HANDLE)
- return -1;
-
- SQLRETURN nSQLRETURN = 0;
- SDB_ODBC_CHAR szConnStrOut[4096];
- SDB_ODBC_CHAR szConnStrIn[2048];
- SQLSMALLINT cbConnStrOut;
- memset(szConnStrOut,'\0',4096);
- memset(szConnStrIn,'\0',2048);
- ::rtl::OString aConStr(::rtl::OUStringToOString(aConnectStr,getTextEncoding()));
- memcpy(szConnStrIn, (SDB_ODBC_CHAR*) aConStr.getStr(), ::std::min<sal_Int32>((sal_Int32)2048,aConStr.getLength()));
-
-#ifndef MACOSX
- N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,(SQLPOINTER)(sal_IntPtr)nTimeOut,SQL_IS_UINTEGER);
- // Verbindung aufbauen
-#endif
-
-#ifdef LINUX
- OSL_UNUSED( bSilent );
- nSQLRETURN = N3SQLDriverConnect(m_aConnectionHandle,
- NULL,
- szConnStrIn,
- (SQLSMALLINT) ::std::min((sal_Int32)2048,aConStr.getLength()),
- szConnStrOut,
- (SQLSMALLINT) (sizeof(szConnStrOut)/sizeof(SDB_ODBC_CHAR)) -1,
- &cbConnStrOut,
- SQL_DRIVER_NOPROMPT);
- if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA || SQL_SUCCESS_WITH_INFO == nSQLRETURN)
- return nSQLRETURN;
-#else
-
- SQLUSMALLINT nSilent = bSilent ? SQL_DRIVER_NOPROMPT : SQL_DRIVER_COMPLETE;
- nSQLRETURN = N3SQLDriverConnect(m_aConnectionHandle,
- NULL,
- szConnStrIn,
- (SQLSMALLINT) ::std::min<sal_Int32>((sal_Int32)2048,aConStr.getLength()),
- szConnStrOut,
- (SQLSMALLINT) sizeof szConnStrOut,
- &cbConnStrOut,
- nSilent);
- if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA)
- return nSQLRETURN;
-
- m_bClosed = sal_False;
-
-#endif //LINUX
-
- try
- {
- ::rtl::OUString aVal;
- OTools::GetInfo(this,m_aConnectionHandle,SQL_DATA_SOURCE_READ_ONLY,aVal,*this,getTextEncoding());
- m_bReadOnly = !aVal.compareToAscii("Y");
- }
- catch(Exception&)
- {
- m_bReadOnly = sal_True;
- }
- try
- {
- ::rtl::OUString sVersion;
- OTools::GetInfo(this,m_aConnectionHandle,SQL_DRIVER_ODBC_VER,sVersion,*this,getTextEncoding());
- m_bUseOldDateFormat = sVersion == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("02.50")) || sVersion == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("02.00"));
- }
- catch(Exception&)
- {
- }
-
-
- // autocoomit ist immer default
-
- if (!m_bReadOnly)
- N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_AUTOCOMMIT,(SQLPOINTER)SQL_AUTOCOMMIT_ON,SQL_IS_INTEGER);
-
- return nSQLRETURN;
-}
-//-----------------------------------------------------------------------------
-SQLRETURN OConnection::Construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException)
-{
- m_aConnectionHandle = SQL_NULL_HANDLE;
- m_sURL = url;
- setConnectionInfo(info);
-
- // Connection allozieren
- N3SQLAllocHandle(SQL_HANDLE_DBC,m_pDriverHandleCopy,&m_aConnectionHandle);
- if(m_aConnectionHandle == SQL_NULL_HANDLE)
- throw SQLException();
-
- sal_Int32 nLen = url.indexOf(':');
- nLen = url.indexOf(':',nLen+1);
- ::rtl::OUString aDSN(RTL_CONSTASCII_USTRINGPARAM("DSN=")), aUID, aPWD, aSysDrvSettings;
- aDSN += url.copy(nLen+1);
-
- const char* pUser = "user";
- const char* pTimeout = "Timeout";
- const char* pSilent = "Silent";
- const char* pPwd = "password";
- const char* pUseCatalog = "UseCatalog";
- const char* pSysDrv = "SystemDriverSettings";
- const char* pCharSet = "CharSet";
- const char* pParaName = "ParameterNameSubstitution";
- const char* pPrivName = "IgnoreDriverPrivileges";
- const char* pVerColName = "PreventGetVersionColumns"; // #i60273#
- const char* pRetrieving = "IsAutoRetrievingEnabled";
- const char* pRetriStmt = "AutoRetrievingStatement";
-
- sal_Int32 nTimeout = 20;
- sal_Bool bSilent = sal_True;
- const PropertyValue *pBegin = info.getConstArray();
- const PropertyValue *pEnd = pBegin + info.getLength();
- for(;pBegin != pEnd;++pBegin)
- {
- if(!pBegin->Name.compareToAscii(pTimeout))
- OSL_VERIFY( pBegin->Value >>= nTimeout );
- else if(!pBegin->Name.compareToAscii(pSilent))
- OSL_VERIFY( pBegin->Value >>= bSilent );
- else if(!pBegin->Name.compareToAscii(pPrivName))
- OSL_VERIFY( pBegin->Value >>= m_bIgnoreDriverPrivileges );
- else if(!pBegin->Name.compareToAscii(pVerColName))
- OSL_VERIFY( pBegin->Value >>= m_bPreventGetVersionColumns );
- else if(!pBegin->Name.compareToAscii(pParaName))
- OSL_VERIFY( pBegin->Value >>= m_bParameterSubstitution );
- else if(!pBegin->Name.compareToAscii(pRetrieving))
- {
- sal_Bool bAutoRetrievingEnabled = sal_False;
- OSL_VERIFY( pBegin->Value >>= bAutoRetrievingEnabled );
- enableAutoRetrievingEnabled(bAutoRetrievingEnabled);
- }
- else if(!pBegin->Name.compareToAscii(pRetriStmt))
- {
- ::rtl::OUString sGeneratedValueStatement;
- OSL_VERIFY( pBegin->Value >>= sGeneratedValueStatement );
- setAutoRetrievingStatement(sGeneratedValueStatement);
- }
- else if(!pBegin->Name.compareToAscii(pUser))
- {
- OSL_VERIFY( pBegin->Value >>= aUID );
- aDSN = aDSN + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(";UID=")) + aUID;
- }
- else if(!pBegin->Name.compareToAscii(pPwd))
- {
- OSL_VERIFY( pBegin->Value >>= aPWD );
- aDSN = aDSN + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(";PWD=")) + aPWD;
- }
- else if(!pBegin->Name.compareToAscii(pUseCatalog))
- {
- OSL_VERIFY( pBegin->Value >>= m_bUseCatalog );
- }
- else if(!pBegin->Name.compareToAscii(pSysDrv))
- {
- OSL_VERIFY( pBegin->Value >>= aSysDrvSettings );
- aDSN += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(";"));
- aDSN += aSysDrvSettings;
- }
- else if(0 == pBegin->Name.compareToAscii(pCharSet))
- {
- ::rtl::OUString sIanaName;
- OSL_VERIFY( pBegin->Value >>= sIanaName );
-
- ::dbtools::OCharsetMap aLookupIanaName;
- ::dbtools::OCharsetMap::const_iterator aLookup = aLookupIanaName.find(sIanaName, ::dbtools::OCharsetMap::IANA());
- if (aLookup != aLookupIanaName.end())
- m_nTextEncoding = (*aLookup).getEncoding();
- else
- m_nTextEncoding = RTL_TEXTENCODING_DONTKNOW;
- if(m_nTextEncoding == RTL_TEXTENCODING_DONTKNOW)
- m_nTextEncoding = osl_getThreadTextEncoding();
- }
- }
- m_sUser = aUID;
-
- SQLRETURN nSQLRETURN = OpenConnection(aDSN,nTimeout, bSilent);
- if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA)
- {
- OTools::ThrowException(this,nSQLRETURN,m_aConnectionHandle,SQL_HANDLE_DBC,*this,sal_False);
- }
- return nSQLRETURN;
-}
-// XServiceInfo
-// --------------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.odbc.OConnection", "com.sun.star.sdbc.Connection")
-
-// --------------------------------------------------------------------------------
-Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- Reference< XStatement > xReturn = new OStatement(this);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
- return xReturn;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- Reference< XPreparedStatement > xReturn = new OPreparedStatement(this,sql);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
- return xReturn;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::prepareCall", *this );
- return NULL;
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConnection::nativeSQL( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ::rtl::OString aSql(::rtl::OUStringToOString(sql.getStr(),getTextEncoding()));
- char pOut[2048];
- SQLINTEGER nOutLen;
- OTools::ThrowException(this,N3SQLNativeSql(m_aConnectionHandle,(SDB_ODBC_CHAR*)aSql.getStr(),aSql.getLength(),(SDB_ODBC_CHAR*)pOut,sizeof pOut - 1,&nOutLen),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
- return ::rtl::OUString(pOut,nOutLen,getTextEncoding());
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- OTools::ThrowException(this,N3SQLSetConnectAttr(m_aConnectionHandle,
- SQL_ATTR_AUTOCOMMIT,
- (SQLPOINTER)((autoCommit) ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF) ,SQL_IS_INTEGER),
- m_aConnectionHandle,SQL_HANDLE_DBC,*this);
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- sal_uInt32 nOption = 0;
- OTools::ThrowException(this,N3SQLGetConnectAttr(m_aConnectionHandle,
- SQL_ATTR_AUTOCOMMIT, &nOption,0,0),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
- return nOption == SQL_AUTOCOMMIT_ON ;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- OTools::ThrowException(this,N3SQLEndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_COMMIT),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- OTools::ThrowException(this,N3SQLEndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_ROLLBACK),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- return OConnection_BASE::rBHelper.bDisposed;
-}
-// --------------------------------------------------------------------------------
-Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
- if(!xMetaData.is())
- {
- xMetaData = new ODatabaseMetaData(m_aConnectionHandle,this);
- m_xMetaData = xMetaData;
- }
-
- return xMetaData;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- OTools::ThrowException(this,
- N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_ACCESS_MODE,reinterpret_cast< SQLPOINTER >( readOnly ),SQL_IS_INTEGER),
- m_aConnectionHandle,SQL_HANDLE_DBC,*this);
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::isReadOnly() throw(SQLException, RuntimeException)
-{
- // const member which will initialized only once
- return m_bReadOnly;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- ::rtl::OString aCat(::rtl::OUStringToOString(catalog.getStr(),getTextEncoding()));
- OTools::ThrowException(this,
- N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_CURRENT_CATALOG,(SDB_ODBC_CHAR*)aCat.getStr(),SQL_NTS),
- m_aConnectionHandle,SQL_HANDLE_DBC,*this);
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConnection::getCatalog( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- sal_Int32 nValueLen;
- char pCat[1024];
- OTools::ThrowException(this,
- N3SQLGetConnectAttr(m_aConnectionHandle,SQL_ATTR_CURRENT_CATALOG,(SDB_ODBC_CHAR*)pCat,(sizeof pCat)-1,&nValueLen),
- m_aConnectionHandle,SQL_HANDLE_DBC,*this);
-
- return ::rtl::OUString(pCat,nValueLen,getTextEncoding());
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- OTools::ThrowException(this,N3SQLSetConnectAttr(m_aConnectionHandle,
- SQL_ATTR_TXN_ISOLATION,
- (SQLPOINTER)(sal_IntPtr)level,SQL_IS_INTEGER),
- m_aConnectionHandle,SQL_HANDLE_DBC,*this);
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- sal_Int32 nTxn = 0;
- SQLINTEGER nValueLen;
- OTools::ThrowException(this,
- N3SQLGetConnectAttr(m_aConnectionHandle,SQL_ATTR_TXN_ISOLATION,&nTxn,sizeof nTxn,&nValueLen),
- m_aConnectionHandle,SQL_HANDLE_DBC,*this);
- return nTxn;
-}
-// --------------------------------------------------------------------------------
-Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getTypeMap( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
-
- return NULL;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setTypeMap", *this );
-}
-// --------------------------------------------------------------------------------
-// XCloseable
-void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- }
- dispose();
-}
-// --------------------------------------------------------------------------------
-// XWarningsSupplier
-Any SAL_CALL OConnection::getWarnings( ) throw(SQLException, RuntimeException)
-{
- return Any();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeException)
-{
-}
-//--------------------------------------------------------------------
-void OConnection::buildTypeInfo() throw( SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- Reference< XResultSet> xRs = getMetaData ()->getTypeInfo ();
- if(xRs.is())
- {
- Reference< XRow> xRow(xRs,UNO_QUERY);
- // Information for a single SQL type
-
- ::connectivity::ORowSetValue aValue;
- ::std::vector<sal_Int32> aTypes;
- Reference<XResultSetMetaData> xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(xRs,UNO_QUERY)->getMetaData();
- sal_Int32 nCount = xResultSetMetaData->getColumnCount();
- // Loop on the result set until we reach end of file
- while (xRs->next ())
- {
- OTypeInfo aInfo;
- sal_Int32 nPos = 1;
- if ( aTypes.empty() )
- {
- if ( nCount < 1 )
- nCount = 18;
- aTypes.reserve(nCount+1);
- aTypes.push_back(-1);
- for (sal_Int32 j = 1; j <= nCount ; ++j)
- aTypes.push_back(xResultSetMetaData->getColumnType(j));
- }
-
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.aTypeName = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.nType = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.nPrecision = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.aLiteralPrefix = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.aLiteralSuffix = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.aCreateParams = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.bNullable = (sal_Int32)aValue == ColumnValue::NULLABLE;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.bCaseSensitive = (sal_Bool)aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.nSearchType = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.bUnsigned = (sal_Bool)aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.bCurrency = (sal_Bool)aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.bAutoIncrement = (sal_Bool)aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.aLocalTypeName = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.nMinimumScale = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.nMaximumScale = aValue;
- if ( nCount >= 18 )
- {
- nPos = 18;
- aValue.fill(nPos,aTypes[nPos],xRow);
- aInfo.nNumPrecRadix = aValue;
- }
-
- // check if values are less than zero like it happens in a oracle jdbc driver
- if( aInfo.nPrecision < 0)
- aInfo.nPrecision = 0;
- if( aInfo.nMinimumScale < 0)
- aInfo.nMinimumScale = 0;
- if( aInfo.nMaximumScale < 0)
- aInfo.nMaximumScale = 0;
- if( aInfo.nNumPrecRadix < 0)
- aInfo.nNumPrecRadix = 10;
-
- // Now that we have the type info, save it
- // in the Hashtable if we don't already have an
- // entry for this SQL type.
-
- m_aTypeInfo.push_back(aInfo);
- }
-
- // Close the result set/statement.
-
- Reference< XCloseable> xClose(xRs,UNO_QUERY);
- if(xClose.is())
- xClose->close();
- }
-}
-//------------------------------------------------------------------------------
-void OConnection::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- OConnection_BASE::disposing();
-
- for (::std::map< SQLHANDLE,OConnection*>::iterator aConIter = m_aConnections.begin();aConIter != m_aConnections.end();++aConIter )
- aConIter->second->dispose();
-
- ::std::map< SQLHANDLE,OConnection*>().swap(m_aConnections);
-
- if(!m_bClosed)
- N3SQLDisconnect(m_aConnectionHandle);
- m_bClosed = sal_True;
-
- dispose_ChildImpl();
-}
-// -----------------------------------------------------------------------------
-OConnection* OConnection::cloneConnection()
-{
- return new OConnection(m_pDriverHandleCopy,m_pDriver);
-}
-// -----------------------------------------------------------------------------
-SQLHANDLE OConnection::createStatementHandle()
-{
- OConnection* pConnectionTemp = this;
- sal_Bool bNew = sal_False;
- try
- {
- sal_Int32 nMaxStatements = getMetaData()->getMaxStatements();
- if(nMaxStatements && nMaxStatements <= m_nStatementCount)
- {
- OConnection* pConnection = cloneConnection();
- pConnection->acquire();
- pConnection->Construct(m_sURL,getConnectionInfo());
- pConnectionTemp = pConnection;
- bNew = sal_True;
- }
- }
- catch(SQLException&)
- {
- }
-
- SQLHANDLE aStatementHandle = SQL_NULL_HANDLE;
- SQLRETURN nRetcode = N3SQLAllocHandle(SQL_HANDLE_STMT,pConnectionTemp->getConnection(),&aStatementHandle);
- OSL_UNUSED( nRetcode );
- ++m_nStatementCount;
- if(bNew)
- m_aConnections.insert(::std::map< SQLHANDLE,OConnection*>::value_type(aStatementHandle,pConnectionTemp));
-
- return aStatementHandle;
-
-}
-// -----------------------------------------------------------------------------
-void OConnection::freeStatementHandle(SQLHANDLE& _pHandle)
-{
- ::std::map< SQLHANDLE,OConnection*>::iterator aFind = m_aConnections.find(_pHandle);
-
- N3SQLFreeStmt(_pHandle,SQL_RESET_PARAMS);
- N3SQLFreeStmt(_pHandle,SQL_UNBIND);
- N3SQLFreeStmt(_pHandle,SQL_CLOSE);
- N3SQLFreeHandle(SQL_HANDLE_STMT,_pHandle);
-
- _pHandle = SQL_NULL_HANDLE;
-
- if(aFind != m_aConnections.end())
- {
- aFind->second->dispose();
- m_aConnections.erase(aFind);
- }
- --m_nStatementCount;
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx
deleted file mode 100644
index c374447c6f..0000000000
--- a/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx
+++ /dev/null
@@ -1,1744 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "odbc/ODatabaseMetaData.hxx"
-#include "odbc/OTools.hxx"
-#include "odbc/ODatabaseMetaDataResultSet.hxx"
-#include "FDatabaseMetaDataResultSet.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include "odbc/OFunctiondefs.hxx"
-#include "stdio.h"
-#include "TPrivilegesResultSet.hxx"
-#include <connectivity/dbexception.hxx>
-#include <rtl/ustrbuf.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)
- : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo())
- ,m_aConnectionHandle(_pHandle)
- ,m_pConnection(_pCon)
- ,m_bUseCatalog(sal_True)
- ,m_bOdbc3(sal_True)
-{
- OSL_ENSURE(m_pConnection,"ODatabaseMetaData::ODatabaseMetaData: No connection set!");
- if(!m_pConnection->isCatalogUsed())
- {
- osl_incrementInterlockedCount( &m_refCount );
- try
- {
- m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable());
- ::rtl::OUString sVersion = getDriverVersion();
- m_bOdbc3 = sVersion != ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("02.50")) && sVersion != ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("02.00"));
- }
- catch(SQLException& )
- { // doesn't matter here
- }
- osl_decrementInterlockedCount( &m_refCount );
- }
-}
-// -------------------------------------------------------------------------
-ODatabaseMetaData::~ODatabaseMetaData()
-{
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( )
-{
- Reference< XResultSet > xRef;
- try
- {
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- xRef = pResult;
- pResult->openTypeInfo();
- }
- catch(SQLException&)
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
- }
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException)
-{
- Reference< XResultSet > xRef;
- if(!m_bUseCatalog)
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCatalogs);
- }
- else
- {
- try
- {
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- xRef = pResult;
- pResult->openCatalogs();
- }
- catch(SQLException&)
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCatalogs);
- }
- }
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( )
-{
- ::rtl::OUString aVal;
- if ( m_bUseCatalog )
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_NAME_SEPARATOR,aVal,*this,m_pConnection->getTextEncoding());
-
- return aVal;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException)
-{
- Reference< XResultSet > xRef;
- try
- {
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- xRef = pResult;
- pResult->openSchemas();
- }
- catch(SQLException&)
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eSchemas);
- }
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
- const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
-{
- Reference< XResultSet > xRef;
- try
- {
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- xRef = pResult;
- pResult->openColumnPrivileges(m_bUseCatalog ? catalog : Any(),schema,table,columnNamePattern);
- }
- catch(SQLException&)
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumnPrivileges);
- }
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
- const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern,
- const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
-{
- Reference< XResultSet > xRef;
- try
- {
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- xRef = pResult;
- pResult->openColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,columnNamePattern);
- }
- catch(SQLException&)
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
- }
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
- const Any& catalog, const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException)
-{
- Reference< XResultSet > xRef;
- try
- {
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- xRef = pResult;
- pResult->openTables(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,types);
- }
- catch(SQLException&)
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
- }
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
- const Any& catalog, const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
-{
- Reference< XResultSet > xRef;
- try
- {
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- xRef = pResult;
- pResult->openProcedureColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern,columnNamePattern);
- }
- catch(SQLException&)
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eProcedureColumns);
- }
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
- const Any& catalog, const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException)
-{
- Reference< XResultSet > xRef;
- try
- {
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- xRef = pResult;
- pResult->openProcedures(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern);
- }
- catch(SQLException&)
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eProcedures);
- }
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
-{
- Reference< XResultSet > xRef;
- bool bSuccess = false;
- try
- {
- if ( !m_pConnection->preventGetVersionColumns() )
- {
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- xRef = pResult;
- pResult->openVersionColumns(m_bUseCatalog ? catalog : Any(),schema,table);
- bSuccess = true;
- }
- }
- catch(SQLException&)
- {
- }
-
- if ( !bSuccess )
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
- }
-
- return xRef;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_BINARY_LITERAL_LEN,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_ROW_SIZE,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CATALOG_NAME_LEN,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CHAR_LITERAL_LEN,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMN_NAME_LEN,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_INDEX,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CURSOR_NAME_LEN,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_DRIVER_CONNECTIONS/*SQL_ACTIVE_CONNECTIONS*/,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_TABLE,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_STATEMENT_LEN,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_TABLE_NAME_LEN,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_TABLES_IN_SELECT,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
-{
- Reference< XResultSet > xRef;
- try
- {
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- xRef = pResult;
- pResult->openExportedKeys(m_bUseCatalog ? catalog : Any(),schema,table);
- }
- catch(SQLException&)
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eExportedKeys);
- }
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
-{
- Reference< XResultSet > xRef;
- try
- {
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- xRef = pResult;
- pResult->openImportedKeys(m_bUseCatalog ? catalog : Any(),schema,table);
- }
- catch(SQLException&)
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eImportedKeys);
- }
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
-{
- Reference< XResultSet > xRef;
- try
- {
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- xRef = pResult;
- pResult->openPrimaryKeys(m_bUseCatalog ? catalog : Any(),schema,table);
- }
- catch(SQLException&)
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::ePrimaryKeys);
- }
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
- sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException)
-{
- Reference< XResultSet > xRef;
- try
- {
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- xRef = pResult;
- pResult->openIndexInfo(m_bUseCatalog ? catalog : Any(),schema,table,unique,approximate);
- }
- catch(SQLException&)
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eIndexInfo);
- }
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
- const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope,
- sal_Bool nullable ) throw(SQLException, RuntimeException)
-{
- Reference< XResultSet > xRef;
- try
- {
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- xRef = pResult;
- pResult->openBestRowIdentifier(m_bUseCatalog ? catalog : Any(),schema,table,scope,nullable);
- }
- catch(SQLException&)
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eBestRowIdentifier);
- }
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
- const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException)
-{
- if ( m_pConnection->isIgnoreDriverPrivilegesEnabled() )
- {
- return new OResultSetPrivileges(this,catalog,schemaPattern,tableNamePattern);
- }
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- Reference< XResultSet > xRef = pResult;
- pResult->openTablePrivileges(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
- const Any& primaryCatalog, const ::rtl::OUString& primarySchema,
- const ::rtl::OUString& primaryTable, const Any& foreignCatalog,
- const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException)
-{
- Reference< XResultSet > xRef;
- try
- {
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
- xRef = pResult;
- pResult->openForeignKeys(m_bUseCatalog ? primaryCatalog : Any(),primarySchema.toChar() == '%' ? &primarySchema : NULL,&primaryTable,
- m_bUseCatalog ? foreignCatalog : Any(), foreignSchema.toChar() == '%' ? &foreignSchema : NULL,&foreignTable);
- }
- catch(SQLException&)
- {
- xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCrossReference);
- }
- return xRef;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aVal;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_ROW_SIZE_INCLUDES_LONG,aVal,*this,m_pConnection->getTextEncoding());
- return aVal.toChar() == 'Y';
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
- return nValue == SQL_IC_LOWER;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
- return nValue == SQL_IC_LOWER;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
- return nValue == SQL_IC_MIXED;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
- return nValue == SQL_IC_MIXED;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
- return nValue == SQL_IC_UPPER;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
- return nValue == SQL_IC_UPPER;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ALTER_TABLE,nValue,*this);
- return (nValue & SQL_AT_ADD_COLUMN) == SQL_AT_ADD_COLUMN;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ALTER_TABLE,nValue,*this);
- return ((nValue & SQL_AT_DROP_COLUMN) == SQL_AT_DROP_COLUMN) ||
- ((nValue & SQL_AT_DROP_COLUMN_CASCADE) == SQL_AT_DROP_COLUMN_CASCADE) ||
- ((nValue & SQL_AT_DROP_COLUMN_RESTRICT) == SQL_AT_DROP_COLUMN_RESTRICT);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_INDEX_SIZE,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NON_NULLABLE_COLUMNS,nValue,*this);
- return nValue == SQL_NNC_NON_NULL;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aVal;
- if(m_bUseCatalog)
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_TERM,aVal,*this,m_pConnection->getTextEncoding());
- return aVal;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
-{
- ::rtl::OUString aVal;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_QUOTE_CHAR,aVal,*this,m_pConnection->getTextEncoding());
- return aVal;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aVal;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SPECIAL_CHARACTERS,aVal,*this,m_pConnection->getTextEncoding());
- return aVal;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
- return nValue != SQL_CN_NONE;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_isCatalogAtStart_throw( )
-{
- SQLUSMALLINT nValue=0;
- if ( m_bUseCatalog )
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_LOCATION,nValue,*this);
- return nValue == SQL_CL_START;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
- return nValue == SQL_TC_DDL_IGNORE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
- return nValue == SQL_TC_DDL_COMMIT;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
- return nValue == SQL_TC_DML;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
- return nValue == SQL_TC_ALL;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
- return (nValue & SQL_CA1_POS_DELETE) == SQL_CA1_POS_DELETE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
- return (nValue & SQL_CA1_POS_UPDATE) == SQL_CA1_POS_UPDATE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_ROLLBACK_BEHAVIOR,nValue,*this);
- return nValue == SQL_CB_PRESERVE || nValue == SQL_CB_CLOSE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_COMMIT_BEHAVIOR,nValue,*this);
- return nValue == SQL_CB_PRESERVE || nValue == SQL_CB_CLOSE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_COMMIT_BEHAVIOR,nValue,*this);
- return nValue == SQL_CB_PRESERVE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_ROLLBACK_BEHAVIOR,nValue,*this);
- return nValue == SQL_CB_PRESERVE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_ISOLATION_OPTION,nValue,*this);
- return (nValue & static_cast<SQLUINTEGER>(level)) == static_cast<SQLUINTEGER>(level);
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
- return (nValue & SQL_SU_DML_STATEMENTS) == SQL_SU_DML_STATEMENTS;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
- return nValue == SQL_SC_SQL92_FULL;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
- return nValue == SQL_SC_SQL92_ENTRY;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aStr;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_INTEGRITY,aStr,*this,m_pConnection->getTextEncoding());
- return aStr.toChar() == 'Y';
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
- return (nValue & SQL_SU_INDEX_DEFINITION) == SQL_SU_INDEX_DEFINITION;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
- return (nValue & SQL_SU_TABLE_DEFINITION) == SQL_SU_TABLE_DEFINITION;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
-{
- SQLUINTEGER nValue=0;
- if(m_bUseCatalog)
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
- return (nValue & SQL_CU_TABLE_DEFINITION) == SQL_CU_TABLE_DEFINITION;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue=0;
- if(m_bUseCatalog)
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
- return (nValue & SQL_CU_INDEX_DEFINITION) == SQL_CU_INDEX_DEFINITION;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
-{
- SQLUINTEGER nValue=0;
- if(m_bUseCatalog)
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
- return (nValue & SQL_CU_DML_STATEMENTS) == SQL_CU_DML_STATEMENTS;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_OJ_CAPABILITIES,nValue,*this);
- return ((nValue & (SQL_OJ_FULL|SQL_OJ_LEFT|SQL_OJ_RIGHT|SQL_OJ_NESTED|SQL_OJ_NOT_ORDERED|SQL_OJ_ALL_COMPARISON_OPS|SQL_OJ_INNER)) != 0);
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
-{
-
- // there exists no possibility to get table types so we have to check
- static ::rtl::OUString sTableTypes[] =
- {
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYSTEM TABLE")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GLOBAL TEMPORARY")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LOCAL TEMPORARY")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALIAS")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYNONYM"))
- };
- sal_Int32 nSize = sizeof(sTableTypes) / sizeof(::rtl::OUString);
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
- Reference< XResultSet > xRef = pResult;
- SQLUINTEGER nValue = 0;
- try
- {
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CREATE_VIEW,nValue,*this);
- }
- catch(const Exception&)
- {
- }
- sal_Bool bViewsSupported = (nValue & SQL_CV_CREATE_VIEW) == SQL_CV_CREATE_VIEW;
-
- ::connectivity::ODatabaseMetaDataResultSet::ORows aRows;
- for(sal_Int32 i=0;i < nSize;++i)
- {
- if( !bViewsSupported && i == 1)
- continue; // no views supported
- ::connectivity::ODatabaseMetaDataResultSet::ORow aRow;
- aRow.push_back(::connectivity::ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ::connectivity::ORowSetValueDecorator(sTableTypes[i]));
- aRows.push_back(aRow);
- }
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( )
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CONCURRENT_ACTIVITIES,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_PROCEDURE_NAME_LEN,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_SCHEMA_NAME_LEN,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
- return nValue != SQL_TC_NONE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ACCESSIBLE_PROCEDURES,aValue,*this,m_pConnection->getTextEncoding());
- return aValue.toChar() == 'Y';
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_PROCEDURES,aValue,*this,m_pConnection->getTextEncoding());
- return aValue.toChar() == 'Y';
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
- return (nValue & SQL_CA1_POSITIONED_UPDATE) == SQL_CA1_POSITIONED_UPDATE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ACCESSIBLE_TABLES,aValue,*this,m_pConnection->getTextEncoding());
- return aValue.toChar() == 'Y';
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- return m_pConnection->isReadOnly();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_FILE_USAGE,nValue,*this);
- return nValue == SQL_FILE_CATALOG;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_FILE_USAGE,nValue,*this);
- return nValue == SQL_FILE_TABLE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_FUNCTIONS,nValue,*this);
- return (nValue & SQL_FN_CVT_CONVERT) == SQL_FN_CVT_CONVERT;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONCAT_NULL_BEHAVIOR,nValue,*this);
- return nValue == SQL_CB_NULL;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_COLUMN_ALIAS,aValue,*this,m_pConnection->getTextEncoding());
- return aValue.toChar() == 'Y';
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
- return nValue != SQL_CN_NONE;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(SQLException, RuntimeException)
-{
- if(fromType == toType)
- return sal_True;
-
- SQLUINTEGER nValue=0;
- switch(fromType)
- {
- case DataType::BIT:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_BIT,nValue,*this);
- break;
- case DataType::TINYINT:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TINYINT,nValue,*this);
- break;
- case DataType::SMALLINT:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_SMALLINT,nValue,*this);
- break;
- case DataType::INTEGER:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_INTEGER,nValue,*this);
- break;
- case DataType::BIGINT:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_BIGINT,nValue,*this);
- break;
- case DataType::FLOAT:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_FLOAT,nValue,*this);
- break;
- case DataType::REAL:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_REAL,nValue,*this);
- break;
- case DataType::DOUBLE:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DOUBLE,nValue,*this);
- break;
- case DataType::NUMERIC:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_NUMERIC,nValue,*this);
- break;
- case DataType::DECIMAL:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DECIMAL,nValue,*this);
- break;
- case DataType::CHAR:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_CHAR,nValue,*this);
- break;
- case DataType::VARCHAR:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_VARCHAR,nValue,*this);
- break;
- case DataType::LONGVARCHAR:
- case DataType::CLOB:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_LONGVARCHAR,nValue,*this);
- break;
- case DataType::DATE:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DATE,nValue,*this);
- break;
- case DataType::TIME:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TIME,nValue,*this);
- break;
- case DataType::TIMESTAMP:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TIMESTAMP,nValue,*this);
- break;
- case DataType::BINARY:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_BINARY,nValue,*this);
- break;
- case DataType::VARBINARY:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_VARBINARY,nValue,*this);
- break;
- case DataType::LONGVARBINARY:
- case DataType::BLOB:
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_LONGVARBINARY,nValue,*this);
- break;
- case DataType::SQLNULL:
- // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
- break;
- case DataType::OTHER:
- // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
- break;
- case DataType::OBJECT:
- // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
- break;
- case DataType::DISTINCT:
- // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
- break;
- case DataType::STRUCT:
- // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
- break;
- case DataType::ARRAY:
- // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
- break;
- case DataType::REF:
- // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
- break;
- }
- sal_Bool bConvert = sal_False;
- switch(toType)
- {
- case DataType::BIT:
- bConvert = (nValue & SQL_CVT_BIT) == SQL_CVT_BIT;
- break;
- case DataType::TINYINT:
- bConvert = (nValue & SQL_CVT_TINYINT) == SQL_CVT_TINYINT;
- break;
- case DataType::SMALLINT:
- bConvert = (nValue & SQL_CVT_SMALLINT) == SQL_CVT_SMALLINT;
- break;
- case DataType::INTEGER:
- bConvert = (nValue & SQL_CVT_INTEGER) == SQL_CVT_INTEGER;
- break;
- case DataType::BIGINT:
- bConvert = (nValue & SQL_CVT_BIGINT) == SQL_CVT_BIGINT;
- break;
- case DataType::FLOAT:
- bConvert = (nValue & SQL_CVT_FLOAT) == SQL_CVT_FLOAT;
- break;
- case DataType::REAL:
- bConvert = (nValue & SQL_CVT_REAL) == SQL_CVT_REAL;
- break;
- case DataType::DOUBLE:
- bConvert = (nValue & SQL_CVT_DOUBLE) == SQL_CVT_DOUBLE;
- break;
- case DataType::NUMERIC:
- bConvert = (nValue & SQL_CVT_NUMERIC) == SQL_CVT_NUMERIC;
- break;
- case DataType::DECIMAL:
- bConvert = (nValue & SQL_CVT_DECIMAL) == SQL_CVT_DECIMAL;
- break;
- case DataType::CHAR:
- bConvert = (nValue & SQL_CVT_CHAR) == SQL_CVT_CHAR;
- break;
- case DataType::VARCHAR:
- bConvert = (nValue & SQL_CVT_VARCHAR) == SQL_CVT_VARCHAR;
- break;
- case DataType::LONGVARCHAR:
- case DataType::CLOB:
- bConvert = (nValue & SQL_CVT_LONGVARCHAR) == SQL_CVT_LONGVARCHAR;
- break;
- case DataType::DATE:
- bConvert = (nValue & SQL_CVT_DATE) == SQL_CVT_DATE;
- break;
- case DataType::TIME:
- bConvert = (nValue & SQL_CVT_TIME) == SQL_CVT_TIME;
- break;
- case DataType::TIMESTAMP:
- bConvert = (nValue & SQL_CVT_TIMESTAMP) == SQL_CVT_TIMESTAMP;
- break;
- case DataType::BINARY:
- bConvert = (nValue & SQL_CVT_BINARY) == SQL_CVT_BINARY;
- break;
- case DataType::VARBINARY:
- bConvert = (nValue & SQL_CVT_VARBINARY) == SQL_CVT_VARBINARY;
- break;
- case DataType::LONGVARBINARY:
- case DataType::BLOB:
- bConvert = (nValue & SQL_CVT_LONGVARBINARY) == SQL_CVT_LONGVARBINARY;
- break;
- }
-
- return bConvert;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_EXPRESSIONS_IN_ORDERBY,aValue,*this,m_pConnection->getTextEncoding());
- return aValue.toChar() == 'Y';
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_GROUP_BY,nValue,*this);
- return nValue != SQL_GB_NOT_SUPPORTED;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_GROUP_BY,nValue,*this);
- return nValue != SQL_GB_GROUP_BY_CONTAINS_SELECT;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_GROUP_BY,nValue,*this);
- return nValue == SQL_GB_NO_RELATION;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MULTIPLE_ACTIVE_TXN,aValue,*this,m_pConnection->getTextEncoding());
- return aValue.toChar() == 'Y';
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MULT_RESULT_SETS,aValue,*this,m_pConnection->getTextEncoding());
- return aValue.toChar() == 'Y';
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_LIKE_ESCAPE_CLAUSE,aValue,*this,m_pConnection->getTextEncoding());
- return aValue.toChar() == 'Y';
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ORDER_BY_COLUMNS_IN_SELECT,aValue,*this,m_pConnection->getTextEncoding());
- return aValue.toChar() == 'N';
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_UNION,nValue,*this);
- return (nValue & SQL_U_UNION) == SQL_U_UNION;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_UNION,nValue,*this);
- return (nValue & SQL_U_UNION_ALL) == SQL_U_UNION_ALL;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
- return nValue == SQL_IC_MIXED;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
- return nValue == SQL_IC_MIXED;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
- return nValue == SQL_NC_END;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
- return nValue == SQL_NC_START;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
- return nValue == SQL_NC_HIGH;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
- return nValue == SQL_NC_LOW;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
- return (nValue & SQL_SU_PROCEDURE_INVOCATION) == SQL_SU_PROCEDURE_INVOCATION;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
- return (nValue & SQL_SU_PRIVILEGE_DEFINITION) == SQL_SU_PRIVILEGE_DEFINITION;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue=0;
- if(m_bUseCatalog)
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
- return (nValue & SQL_CU_PROCEDURE_INVOCATION) == SQL_CU_PROCEDURE_INVOCATION;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue=0;
- if(m_bUseCatalog)
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
- return (nValue & SQL_CU_PRIVILEGE_DEFINITION) == SQL_CU_PRIVILEGE_DEFINITION;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
- return (nValue & SQL_SQ_CORRELATED_SUBQUERIES) == SQL_SQ_CORRELATED_SUBQUERIES;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
- return (nValue & SQL_SQ_COMPARISON) == SQL_SQ_COMPARISON;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
- return (nValue & SQL_SQ_EXISTS) == SQL_SQ_EXISTS;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
- return (nValue & SQL_SQ_IN) == SQL_SQ_IN;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
- return (nValue & SQL_SQ_QUANTIFIED) == SQL_SQ_QUANTIFIED;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
- return nValue == SQL_SC_SQL92_INTERMEDIATE;
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString ODatabaseMetaData::getURLImpl()
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DATA_SOURCE_NAME,aValue,*this,m_pConnection->getTextEncoding());
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue = m_pConnection->getURL();
- if ( !aValue.getLength() )
- {
- aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:odbc:"));
- aValue += getURLImpl();
- }
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_USER_NAME,aValue,*this,m_pConnection->getTextEncoding());
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_NAME,aValue,*this,m_pConnection->getTextEncoding());
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_ODBC_VER,aValue,*this,m_pConnection->getTextEncoding());
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DBMS_NAME,aValue,*this,m_pConnection->getTextEncoding());
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_PROCEDURE_TERM,aValue,*this,m_pConnection->getTextEncoding());
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_TERM,aValue,*this,m_pConnection->getTextEncoding());
- return aValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
- return aValue.copy(0,aValue.indexOf('.')).toInt32();
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
- return aValue.copy(0,aValue.lastIndexOf('.')).toInt32();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_KEYWORDS,aValue,*this,m_pConnection->getTextEncoding());
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SEARCH_PATTERN_ESCAPE,aValue,*this,m_pConnection->getTextEncoding());
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- ::rtl::OUStringBuffer aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_STRING_FUNCTIONS,nValue,*this);
- if(nValue & SQL_FN_STR_ASCII)
- aValue.appendAscii("ASCII,");
- if(nValue & SQL_FN_STR_BIT_LENGTH)
- aValue.appendAscii("BIT_LENGTH,");
- if(nValue & SQL_FN_STR_CHAR)
- aValue.appendAscii("CHAR,");
- if(nValue & SQL_FN_STR_CHAR_LENGTH)
- aValue.appendAscii("CHAR_LENGTH,");
- if(nValue & SQL_FN_STR_CHARACTER_LENGTH)
- aValue.appendAscii("CHARACTER_LENGTH,");
- if(nValue & SQL_FN_STR_CONCAT)
- aValue.appendAscii("CONCAT,");
- if(nValue & SQL_FN_STR_DIFFERENCE)
- aValue.appendAscii("DIFFERENCE,");
- if(nValue & SQL_FN_STR_INSERT)
- aValue.appendAscii("INSERT,");
- if(nValue & SQL_FN_STR_LCASE)
- aValue.appendAscii("LCASE,");
- if(nValue & SQL_FN_STR_LEFT)
- aValue.appendAscii("LEFT,");
- if(nValue & SQL_FN_STR_LENGTH)
- aValue.appendAscii("LENGTH,");
- if(nValue & SQL_FN_STR_LOCATE)
- aValue.appendAscii("LOCATE,");
- if(nValue & SQL_FN_STR_LOCATE_2)
- aValue.appendAscii("LOCATE_2,");
- if(nValue & SQL_FN_STR_LTRIM)
- aValue.appendAscii("LTRIM,");
- if(nValue & SQL_FN_STR_OCTET_LENGTH)
- aValue.appendAscii("OCTET_LENGTH,");
- if(nValue & SQL_FN_STR_POSITION)
- aValue.appendAscii("POSITION,");
- if(nValue & SQL_FN_STR_REPEAT)
- aValue.appendAscii("REPEAT,");
- if(nValue & SQL_FN_STR_REPLACE)
- aValue.appendAscii("REPLACE,");
- if(nValue & SQL_FN_STR_RIGHT)
- aValue.appendAscii("RIGHT,");
- if(nValue & SQL_FN_STR_RTRIM)
- aValue.appendAscii("RTRIM,");
- if(nValue & SQL_FN_STR_SOUNDEX)
- aValue.appendAscii("SOUNDEX,");
- if(nValue & SQL_FN_STR_SPACE)
- aValue.appendAscii("SPACE,");
- if(nValue & SQL_FN_STR_SUBSTRING)
- aValue.appendAscii("SUBSTRING,");
- if(nValue & SQL_FN_STR_UCASE)
- aValue.appendAscii("UCASE,");
-
-
- if ( aValue.getLength() )
- aValue.setLength(aValue.getLength()-1);
-
- return aValue.makeStringAndClear();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- ::rtl::OUStringBuffer aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TIMEDATE_FUNCTIONS,nValue,*this);
-
- if(nValue & SQL_FN_TD_CURRENT_DATE)
- aValue.appendAscii("CURRENT_DATE,");
- if(nValue & SQL_FN_TD_CURRENT_TIME)
- aValue.appendAscii("CURRENT_TIME,");
- if(nValue & SQL_FN_TD_CURRENT_TIMESTAMP)
- aValue.appendAscii("CURRENT_TIMESTAMP,");
- if(nValue & SQL_FN_TD_CURDATE)
- aValue.appendAscii("CURDATE,");
- if(nValue & SQL_FN_TD_CURTIME)
- aValue.appendAscii("CURTIME,");
- if(nValue & SQL_FN_TD_DAYNAME)
- aValue.appendAscii("DAYNAME,");
- if(nValue & SQL_FN_TD_DAYOFMONTH)
- aValue.appendAscii("DAYOFMONTH,");
- if(nValue & SQL_FN_TD_DAYOFWEEK)
- aValue.appendAscii("DAYOFWEEK,");
- if(nValue & SQL_FN_TD_DAYOFYEAR)
- aValue.appendAscii("DAYOFYEAR,");
- if(nValue & SQL_FN_TD_EXTRACT)
- aValue.appendAscii("EXTRACT,");
- if(nValue & SQL_FN_TD_HOUR)
- aValue.appendAscii("HOUR,");
- if(nValue & SQL_FN_TD_MINUTE)
- aValue.appendAscii("MINUTE,");
- if(nValue & SQL_FN_TD_MONTH)
- aValue.appendAscii("MONTH,");
- if(nValue & SQL_FN_TD_MONTHNAME)
- aValue.appendAscii("MONTHNAME,");
- if(nValue & SQL_FN_TD_NOW)
- aValue.appendAscii("NOW,");
- if(nValue & SQL_FN_TD_QUARTER)
- aValue.appendAscii("QUARTER,");
- if(nValue & SQL_FN_TD_SECOND)
- aValue.appendAscii("SECOND,");
- if(nValue & SQL_FN_TD_TIMESTAMPADD)
- aValue.appendAscii("TIMESTAMPADD,");
- if(nValue & SQL_FN_TD_TIMESTAMPDIFF)
- aValue.appendAscii("TIMESTAMPDIFF,");
- if(nValue & SQL_FN_TD_WEEK)
- aValue.appendAscii("WEEK,");
- if(nValue & SQL_FN_TD_YEAR)
- aValue.appendAscii("YEAR,");
-
- if ( aValue.getLength() )
- aValue.setLength(aValue.getLength()-1);
-
- return aValue.makeStringAndClear();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- ::rtl::OUStringBuffer aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SYSTEM_FUNCTIONS,nValue,*this);
-
- if(nValue & SQL_FN_SYS_DBNAME)
- aValue.appendAscii("DBNAME,");
- if(nValue & SQL_FN_SYS_IFNULL)
- aValue.appendAscii("IFNULL,");
- if(nValue & SQL_FN_SYS_USERNAME)
- aValue.appendAscii("USERNAME,");
-
- if ( aValue.getLength() )
- aValue.setLength(aValue.getLength()-1);
-
- return aValue.makeStringAndClear();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- ::rtl::OUStringBuffer aValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NUMERIC_FUNCTIONS,nValue,*this);
-
- if(nValue & SQL_FN_NUM_ABS)
- aValue.appendAscii("ABS,");
- if(nValue & SQL_FN_NUM_ACOS)
- aValue.appendAscii("ACOS,");
- if(nValue & SQL_FN_NUM_ASIN)
- aValue.appendAscii("ASIN,");
- if(nValue & SQL_FN_NUM_ATAN)
- aValue.appendAscii("ATAN,");
- if(nValue & SQL_FN_NUM_ATAN2)
- aValue.appendAscii("ATAN2,");
- if(nValue & SQL_FN_NUM_CEILING)
- aValue.appendAscii("CEILING,");
- if(nValue & SQL_FN_NUM_COS)
- aValue.appendAscii("COS,");
- if(nValue & SQL_FN_NUM_COT)
- aValue.appendAscii("COT,");
- if(nValue & SQL_FN_NUM_DEGREES)
- aValue.appendAscii("DEGREES,");
- if(nValue & SQL_FN_NUM_EXP)
- aValue.appendAscii("EXP,");
- if(nValue & SQL_FN_NUM_FLOOR)
- aValue.appendAscii("FLOOR,");
- if(nValue & SQL_FN_NUM_LOG)
- aValue.appendAscii("LOGF,");
- if(nValue & SQL_FN_NUM_LOG10)
- aValue.appendAscii("LOG10,");
- if(nValue & SQL_FN_NUM_MOD)
- aValue.appendAscii("MOD,");
- if(nValue & SQL_FN_NUM_PI)
- aValue.appendAscii("PI,");
- if(nValue & SQL_FN_NUM_POWER)
- aValue.appendAscii("POWER,");
- if(nValue & SQL_FN_NUM_RADIANS)
- aValue.appendAscii("RADIANS,");
- if(nValue & SQL_FN_NUM_RAND)
- aValue.appendAscii("RAND,");
- if(nValue & SQL_FN_NUM_ROUND)
- aValue.appendAscii("ROUND,");
- if(nValue & SQL_FN_NUM_SIGN)
- aValue.appendAscii("SIGN,");
- if(nValue & SQL_FN_NUM_SIN)
- aValue.appendAscii("SIN,");
- if(nValue & SQL_FN_NUM_SQRT)
- aValue.appendAscii("SQRT,");
- if(nValue & SQL_FN_NUM_TAN)
- aValue.appendAscii("TAN,");
- if(nValue & SQL_FN_NUM_TRUNCATE)
- aValue.appendAscii("TRUNCATE,");
-
- if ( aValue.getLength() )
- aValue.setLength(aValue.getLength()-1);
-
- return aValue.makeStringAndClear();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- if(m_bOdbc3)
- {
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this);
- return nValue == SQL_OIC_LEVEL2;
- }
- else
- {
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this);
- return nValue == SQL_OAC_LEVEL2;
- }
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- if(m_bOdbc3)
- {
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this);
- return nValue == SQL_OIC_CORE || nValue == SQL_OIC_LEVEL2 || nValue == SQL_OIC_LEVEL1;
- }
- else
- {
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this);
- return nValue == SQL_OSC_CORE || nValue == SQL_OAC_LEVEL1 || nValue == SQL_OAC_LEVEL2;
- }
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- if(m_bOdbc3)
- {
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this);
- return nValue == SQL_OIC_LEVEL1 || nValue == SQL_OIC_LEVEL2;
- }
- else
- {
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this);
- return nValue == SQL_OAC_LEVEL1 || nValue == SQL_OAC_LEVEL2;
- }
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_OJ_CAPABILITIES,nValue,*this);
- return (nValue & SQL_OJ_FULL) == SQL_OJ_FULL;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return supportsFullOuterJoins( );
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_GROUP_BY,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_ORDER_BY,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_SELECT,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
-{
- SQLUSMALLINT nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_USER_NAME_LEN,nValue,*this);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_SENSITIVITY,nValue,*this);
- return (nValue & static_cast<SQLUINTEGER>(setType)) == static_cast<SQLUINTEGER>(setType);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
- switch(setType)
- {
- default:
- case ResultSetType::FORWARD_ONLY:
- nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
- break;
- case ResultSetType::SCROLL_INSENSITIVE:
- nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
- break;
- case ResultSetType::SCROLL_SENSITIVE:
- nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
- break;
- }
-
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
- sal_Bool bRet = sal_False;
- switch(concurrency)
- {
- case ResultSetConcurrency::READ_ONLY:
- bRet = (nValue & SQL_CA2_READ_ONLY_CONCURRENCY) == SQL_CA2_READ_ONLY_CONCURRENCY;
- break;
- case ResultSetConcurrency::UPDATABLE:
- bRet = (nValue & SQL_CA2_OPT_VALUES_CONCURRENCY) == SQL_CA2_OPT_VALUES_CONCURRENCY;
- break;
- }
- return bRet;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
- switch(setType)
- {
- default:
- case ResultSetType::FORWARD_ONLY:
- nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
- break;
- case ResultSetType::SCROLL_INSENSITIVE:
- nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
- break;
- case ResultSetType::SCROLL_SENSITIVE:
- nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
- break;
- }
-
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
- return (nValue & SQL_CA2_SENSITIVITY_UPDATES) == SQL_CA2_SENSITIVITY_UPDATES;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
- switch(setType)
- {
- default:
- case ResultSetType::FORWARD_ONLY:
- nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
- break;
- case ResultSetType::SCROLL_INSENSITIVE:
- nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
- break;
- case ResultSetType::SCROLL_SENSITIVE:
- nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
- break;
- }
-
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
- return (nValue & SQL_CA2_SENSITIVITY_DELETIONS) != SQL_CA2_SENSITIVITY_DELETIONS;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- SQLUINTEGER nValue;
- SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
- switch(setType)
- {
- default:
- case ResultSetType::FORWARD_ONLY:
- nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
- break;
- case ResultSetType::SCROLL_INSENSITIVE:
- nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
- break;
- case ResultSetType::SCROLL_SENSITIVE:
- nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
- break;
- }
-
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
- return (nValue & SQL_CA2_SENSITIVITY_ADDITIONS) == SQL_CA2_SENSITIVITY_ADDITIONS;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- return ownUpdatesAreVisible(setType);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- return ownDeletesAreVisible(setType);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
-{
- return ownInsertsAreVisible(setType);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
deleted file mode 100644
index 4a6062acc6..0000000000
--- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
+++ /dev/null
@@ -1,1340 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "TConnection.hxx"
-
-#include "odbc/ODatabaseMetaDataResultSet.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbc/ProcedureResult.hpp>
-#include <com/sun/star/sdbc/IndexType.hpp>
-#include <comphelper/property.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include "odbc/OResultSetMetaData.hxx"
-#include "odbc/OTools.hxx"
-#include <comphelper/types.hxx>
-#include "FDatabaseMetaDataResultSetMetaData.hxx"
-#include <connectivity/dbexception.hxx>
-
-using namespace ::comphelper;
-
-
-using namespace connectivity::odbc;
-using namespace cppu;
-//------------------------------------------------------------------------------
-using namespace ::com::sun::star::lang;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::util;
-
-// -------------------------------------------------------------------------
-ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet(OConnection* _pConnection)
- :ODatabaseMetaDataResultSet_BASE(m_aMutex)
- ,OPropertySetHelper(ODatabaseMetaDataResultSet_BASE::rBHelper)
-
- ,m_aStatementHandle(_pConnection->createStatementHandle())
- ,m_aStatement(NULL)
- ,m_xMetaData(NULL)
- ,m_pRowStatusArray(NULL)
- ,m_pConnection(_pConnection)
- ,m_nTextEncoding(_pConnection->getTextEncoding())
- ,m_nRowPos(-1)
- ,m_nLastColumnPos(0)
- ,m_nDriverColumnCount(0)
- ,m_nCurrentFetchState(0)
- ,m_bWasNull(sal_True)
- ,m_bEOF(sal_False)
- ,m_bFreeHandle(sal_False)
-{
- OSL_ENSURE(m_pConnection,"ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet: No parent set!");
- osl_incrementInterlockedCount( &m_refCount );
- m_pConnection->acquire();
- m_pRowStatusArray = new SQLUSMALLINT[1]; // the default value
- osl_decrementInterlockedCount( &m_refCount );
- // allocBuffer();
-}
-
-// -------------------------------------------------------------------------
-ODatabaseMetaDataResultSet::~ODatabaseMetaDataResultSet()
-{
- OSL_ENSURE(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed,"Object wasn't disposed!");
- if(!ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed)
- {
- osl_incrementInterlockedCount( &m_refCount );
- dispose();
- }
- delete [] m_pRowStatusArray;
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::disposing(void)
-{
- OPropertySetHelper::disposing();
-
- ::osl::MutexGuard aGuard(m_aMutex);
- if(m_bFreeHandle)
- m_pConnection->freeStatementHandle(m_aStatementHandle);
-
- m_aStatement = NULL;
-m_xMetaData.clear();
- m_pConnection->release();
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL ODatabaseMetaDataResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OPropertySetHelper::queryInterface(rType);
- return aRet.hasValue() ? aRet : ODatabaseMetaDataResultSet_BASE::queryInterface(rType);
-}
-// -----------------------------------------------------------------------------
-Reference< XPropertySetInfo > SAL_CALL ODatabaseMetaDataResultSet::getPropertySetInfo( ) throw(RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL ODatabaseMetaDataResultSet::acquire() throw()
-{
- ODatabaseMetaDataResultSet_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL ODatabaseMetaDataResultSet::release() throw()
-{
- ODatabaseMetaDataResultSet_BASE::release();
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL ODatabaseMetaDataResultSet::getTypes( ) throw(RuntimeException)
-{
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
- ::getCppuType( (const Reference< XFastPropertySet > *)0 ),
- ::getCppuType( (const Reference< XPropertySet > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),ODatabaseMetaDataResultSet_BASE::getTypes());
-}
-// -----------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaDataResultSet::mapColumn (sal_Int32 column)
-{
- sal_Int32 map = column;
-
- if (!m_aColMapping.empty())
- {
- // Validate column number
- map = m_aColMapping[column];
- }
-
- return map;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- Reference< XResultSetMetaData > xMeta = getMetaData();
- sal_Int32 nLen = xMeta->getColumnCount();
- sal_Int32 i = 1;
- for(;i<=nLen;++i)
- if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
- columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
- break;
- return i;
-}
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getBinaryStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getBinaryStream", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getCharacterStream", *this );
- return NULL;
-}
-
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
- columnIndex = mapColumn(columnIndex);
-
- sal_Bool bRet = sal_False;
- if(columnIndex <= m_nDriverColumnCount)
- {
- sal_Int32 nType = getMetaData()->getColumnType(columnIndex);
- switch(nType)
- {
- case DataType::BIT:
- {
- sal_Int8 nValue = 0;
- OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_BIT,m_bWasNull,**this,&nValue,sizeof nValue);
- bRet = nValue != 0;
- }
- break;
- default:
- bRet = getInt(columnIndex) != 0;
- }
- }
- return bRet;
-}
-// -------------------------------------------------------------------------
-
-sal_Int8 SAL_CALL ODatabaseMetaDataResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- columnIndex = mapColumn(columnIndex);
- sal_Int8 nVal = 0;
- if(columnIndex <= m_nDriverColumnCount)
- {
- OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_TINYINT,m_bWasNull,**this,&nVal,sizeof nVal);
-
- ::std::map<sal_Int32, ::connectivity::TInt2IntMap >::iterator aValueRangeIter;
- if ( !m_aValueRange.empty() && (aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
- return sal_Int8((*aValueRangeIter).second[(sal_Int32)nVal]);
- }
- else
- m_bWasNull = sal_True;
- return nVal;
-}
-// -------------------------------------------------------------------------
-
-Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- columnIndex = mapColumn(columnIndex);
- if(columnIndex <= m_nDriverColumnCount)
- {
- sal_Int32 nType = getMetaData()->getColumnType(columnIndex);
- switch(nType)
- {
- case DataType::VARCHAR:
- case DataType::LONGVARCHAR:
- {
- ::rtl::OUString aRet = OTools::getStringValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_BINARY,m_bWasNull,**this,m_nTextEncoding);
- return Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(aRet.getStr()),sizeof(sal_Unicode)*aRet.getLength());
- }
- }
- return OTools::getBytesValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_BINARY,m_bWasNull,**this);
- }
- else
- m_bWasNull = sal_True;
- return Sequence<sal_Int8>();
-}
-// -------------------------------------------------------------------------
-
-::com::sun::star::util::Date SAL_CALL ODatabaseMetaDataResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- columnIndex = mapColumn(columnIndex);
- if(columnIndex <= m_nDriverColumnCount)
- {
- DATE_STRUCT aDate;
- aDate.day = 0;
- aDate.month = 0;
- aDate.year = 0;
- OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_DATE : SQL_C_TYPE_DATE,m_bWasNull,**this,&aDate,sizeof aDate);
- return Date(aDate.day,aDate.month,aDate.year);
- }
- else
- m_bWasNull = sal_True;
- return Date();
-}
-// -------------------------------------------------------------------------
-
-double SAL_CALL ODatabaseMetaDataResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- columnIndex = mapColumn(columnIndex);
- double nValue(0.0);
- if(columnIndex <= m_nDriverColumnCount)
- OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_DOUBLE,m_bWasNull,**this,&nValue,sizeof nValue);
- else
- m_bWasNull = sal_True;
- return nValue;
-}
-// -------------------------------------------------------------------------
-
-float SAL_CALL ODatabaseMetaDataResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- columnIndex = mapColumn(columnIndex);
- float nVal(0);
- if(columnIndex <= m_nDriverColumnCount)
- OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_FLOAT,m_bWasNull,**this,&nVal,sizeof nVal);
- else
- m_bWasNull = sal_True;
- return nVal;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- columnIndex = mapColumn(columnIndex);
- sal_Int32 nVal = 0;
- if(columnIndex <= m_nDriverColumnCount)
- {
- OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_LONG,m_bWasNull,**this,&nVal,sizeof nVal);
-
- ::std::map<sal_Int32, ::connectivity::TInt2IntMap >::iterator aValueRangeIter;
- if ( !m_aValueRange.empty() && (aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
- return (*aValueRangeIter).second[(sal_Int32)nVal];
- }
- else
- m_bWasNull = sal_True;
- return nVal;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getRow( ) throw(SQLException, RuntimeException)
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-
-sal_Int64 SAL_CALL ODatabaseMetaDataResultSet::getLong( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getLong", *this );
- return 0;
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSetMetaData > SAL_CALL ODatabaseMetaDataResultSet::getMetaData( ) throw(SQLException, RuntimeException)
-{
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
- return m_xMetaData.is() ? m_xMetaData : (m_xMetaData = new OResultSetMetaData(m_pConnection,m_aStatementHandle));
-}
-// -------------------------------------------------------------------------
-Reference< XArray > SAL_CALL ODatabaseMetaDataResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getArray", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XClob > SAL_CALL ODatabaseMetaDataResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getClob", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL ODatabaseMetaDataResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getBlob", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Reference< XRef > SAL_CALL ODatabaseMetaDataResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getRef", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Any SAL_CALL ODatabaseMetaDataResultSet::getObject( sal_Int32 /*columnIndex*/, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getObject", *this );
- return Any();
-}
-// -------------------------------------------------------------------------
-
-sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
- columnIndex = mapColumn(columnIndex);
- sal_Int16 nVal = 0;
- if(columnIndex <= m_nDriverColumnCount)
- {
- OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_SHORT,m_bWasNull,**this,&nVal,sizeof nVal);
-
- ::std::map<sal_Int32, ::connectivity::TInt2IntMap >::iterator aValueRangeIter;
- if ( !m_aValueRange.empty() && (aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
- return sal_Int16((*aValueRangeIter).second[(sal_Int32)nVal]);
- }
- else
- m_bWasNull = sal_True;
- return nVal;
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL ODatabaseMetaDataResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- columnIndex = mapColumn(columnIndex);
- ::rtl::OUString aVal;
- if(columnIndex <= m_nDriverColumnCount)
- aVal = OTools::getStringValue(m_pConnection,m_aStatementHandle,columnIndex,impl_getColumnType_nothrow(columnIndex),m_bWasNull,**this,m_nTextEncoding);
- else
- m_bWasNull = sal_True;
-
- return aVal;
-}
-
-// -------------------------------------------------------------------------
-
-
-::com::sun::star::util::Time SAL_CALL ODatabaseMetaDataResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- columnIndex = mapColumn(columnIndex);
- TIME_STRUCT aTime={0,0,0};
- if(columnIndex <= m_nDriverColumnCount)
- OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIME : SQL_C_TYPE_TIME,m_bWasNull,**this,&aTime,sizeof aTime);
- else
- m_bWasNull = sal_True;
- return Time(0,aTime.second,aTime.minute,aTime.hour);
-}
-// -------------------------------------------------------------------------
-
-
-::com::sun::star::util::DateTime SAL_CALL ODatabaseMetaDataResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- columnIndex = mapColumn(columnIndex);
- TIMESTAMP_STRUCT aTime={0,0,0,0,0,0,0};
- if(columnIndex <= m_nDriverColumnCount)
- OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIMESTAMP : SQL_C_TYPE_TIMESTAMP,m_bWasNull,**this,&aTime,sizeof aTime);
- else
- m_bWasNull = sal_True;
- return DateTime((sal_uInt16)aTime.fraction*1000,aTime.second,aTime.minute,aTime.hour,aTime.day,aTime.month,aTime.year);
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isAfterLast( ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- return m_nCurrentFetchState == SQL_NO_DATA;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isFirst( ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- return m_nRowPos == 1;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isLast( ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- return m_bEOF && m_nCurrentFetchState != SQL_NO_DATA;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL ODatabaseMetaDataResultSet::beforeFirst( ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- if(first())
- previous();
- m_nCurrentFetchState = SQL_SUCCESS;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL ODatabaseMetaDataResultSet::afterLast( ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- if(last())
- next();
- m_bEOF = sal_True;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL ODatabaseMetaDataResultSet::close( ) throw(SQLException, RuntimeException)
-{
- {
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
- }
- dispose();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::first( ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_FIRST,0);
- OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- sal_Bool bRet = ( m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO );
- if( bRet )
- m_nRowPos = 1;
- return bRet;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::last( ) throw(SQLException, RuntimeException)
-{
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed );
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_LAST,0);
- OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- // here I know definitely that I stand on the last record
- return (m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_ABSOLUTE,row);
- OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
- if(bRet)
- m_nRowPos = row;
- return bRet;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,row);
- OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
- if(bRet)
- m_nRowPos += row;
- return bRet;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::previous( ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0);
- OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
- if(bRet)
- --m_nRowPos;
- return bRet;
-}
-// -------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL ODatabaseMetaDataResultSet::getStatement( ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowDeleted( ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- return m_pRowStatusArray[0] == SQL_ROW_DELETED;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowInserted( ) throw(SQLException, RuntimeException)
-{
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- return m_pRowStatusArray[0] == SQL_ROW_ADDED;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowUpdated( ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- return m_pRowStatusArray[0] == SQL_ROW_UPDATED;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- return m_nRowPos == 0;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::next( ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- // m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_NEXT,0);
- m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle);
- OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- return m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL ODatabaseMetaDataResultSet::wasNull( ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- return m_bWasNull;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL ODatabaseMetaDataResultSet::refreshRow( ) throw(SQLException, RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL ODatabaseMetaDataResultSet::cancel( ) throw(RuntimeException)
-{
-
- checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- OTools::ThrowException(m_pConnection,N3SQLCancel(m_aStatementHandle),m_aStatementHandle,SQL_HANDLE_STMT,*this);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL ODatabaseMetaDataResultSet::clearWarnings( ) throw(SQLException, RuntimeException)
-{
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL ODatabaseMetaDataResultSet::getWarnings( ) throw(SQLException, RuntimeException)
-{
- return Any();
-}
-//------------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaDataResultSet::getResultSetConcurrency() const throw(SQLException, RuntimeException)
-{
- return ResultSetConcurrency::READ_ONLY;
-}
-//------------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaDataResultSet::getResultSetType() const throw(SQLException, RuntimeException)
-{
- return ResultSetType::FORWARD_ONLY;
-}
-//------------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaDataResultSet::getFetchDirection() const throw(SQLException, RuntimeException)
-{
- return FetchDirection::FORWARD;
-}
-//------------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaDataResultSet::getFetchSize() const throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue=1;
- return nValue;
-}
-//------------------------------------------------------------------------------
-::rtl::OUString ODatabaseMetaDataResultSet::getCursorName() const throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* ODatabaseMetaDataResultSet::createArrayHelper( ) const
-{
-
- Sequence< com::sun::star::beans::Property > aProps(5);
- com::sun::star::beans::Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP0(CURSORNAME, ::rtl::OUString);
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32);
- DECL_PROP0(RESULTSETTYPE, sal_Int32);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & ODatabaseMetaDataResultSet::getInfoHelper()
-{
- return *const_cast<ODatabaseMetaDataResultSet*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaDataResultSet::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw ::com::sun::star::lang::IllegalArgumentException();
- case PROPERTY_ID_FETCHDIRECTION:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection());
- case PROPERTY_ID_FETCHSIZE:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize());
- default:
- ;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& /*rValue*/ ) throw (Exception)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- throw Exception();
- default:
- OSL_FAIL("setFastPropertyValue_NoBroadcast: Illegal handle value!");
- }
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
-{
- switch(nHandle)
- {
- case PROPERTY_ID_CURSORNAME:
- rValue <<= getCursorName();
- break;
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- rValue <<= getResultSetConcurrency();
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- rValue <<= getResultSetType();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- rValue <<= getFetchDirection();
- break;
- case PROPERTY_ID_FETCHSIZE:
- rValue <<= getFetchSize();
- break;
- }
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openTypeInfo() throw(SQLException, RuntimeException)
-{
- TInt2IntMap aMap;
- aMap[SQL_BIT] = DataType::BIT;
- aMap[SQL_TINYINT] = DataType::TINYINT;
- aMap[SQL_SMALLINT] = DataType::SMALLINT;
- aMap[SQL_INTEGER] = DataType::INTEGER;
- aMap[SQL_FLOAT] = DataType::FLOAT;
- aMap[SQL_REAL] = DataType::REAL;
- aMap[SQL_DOUBLE] = DataType::DOUBLE;
- aMap[SQL_BIGINT] = DataType::BIGINT;
-
- aMap[SQL_CHAR] = DataType::CHAR;
- aMap[SQL_WCHAR] = DataType::CHAR;
- aMap[SQL_VARCHAR] = DataType::VARCHAR;
- aMap[SQL_WVARCHAR] = DataType::VARCHAR;
- aMap[SQL_LONGVARCHAR] = DataType::LONGVARCHAR;
- aMap[SQL_WLONGVARCHAR] = DataType::LONGVARCHAR;
-
- aMap[SQL_TYPE_DATE] = DataType::DATE;
- aMap[SQL_DATE] = DataType::DATE;
- aMap[SQL_TYPE_TIME] = DataType::TIME;
- aMap[SQL_TIME] = DataType::TIME;
- aMap[SQL_TYPE_TIMESTAMP] = DataType::TIMESTAMP;
- aMap[SQL_TIMESTAMP] = DataType::TIMESTAMP;
-
- aMap[SQL_DECIMAL] = DataType::DECIMAL;
- aMap[SQL_NUMERIC] = DataType::NUMERIC;
-
- aMap[SQL_BINARY] = DataType::BINARY;
- aMap[SQL_VARBINARY] = DataType::VARBINARY;
- aMap[SQL_LONGVARBINARY] = DataType::LONGVARBINARY;
-
- aMap[SQL_GUID] = DataType::VARBINARY;
-
-
- m_aValueRange[2] = aMap;
-
- OTools::ThrowException(m_pConnection,N3SQLGetTypeInfo(m_aStatementHandle, SQL_ALL_TYPES),m_aStatementHandle,SQL_HANDLE_STMT,*this);
- checkColumnCount();
-}
-//-----------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openTables(const Any& catalog, const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& tableNamePattern,
- const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException)
-{
- m_bFreeHandle = sal_True;
- ::rtl::OString aPKQ,aPKO,aPKN,aCOL;
- const ::rtl::OUString *pSchemaPat = NULL;
-
- if(schemaPattern.toChar() != '%')
- pSchemaPat = &schemaPattern;
- else
- pSchemaPat = NULL;
-
- if ( catalog.hasValue() )
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding);
- aPKN = ::rtl::OUStringToOString(tableNamePattern,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,
- *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL,
- *pPKN = aPKN.getStr();
-
-
- const char *pCOL = NULL;
- const char* pComma = ",";
- const ::rtl::OUString* pBegin = types.getConstArray();
- const ::rtl::OUString* pEnd = pBegin + types.getLength();
- for(;pBegin != pEnd;++pBegin)
- {
- aCOL += ::rtl::OUStringToOString(*pBegin,m_nTextEncoding);
- aCOL += pComma;
- }
- if ( aCOL.getLength() )
- {
- aCOL = aCOL.replaceAt(aCOL.getLength()-1,1,pComma);
- pCOL = aCOL.getStr();
- }
- else
- pCOL = SQL_ALL_TABLE_TYPES;
-
- SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
- (SDB_ODBC_CHAR *) pPKQ, (catalog.hasValue() && aPKQ.getLength()) ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pPKO, pPKO ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pPKN, SQL_NTS,
- (SDB_ODBC_CHAR *) pCOL, pCOL ? SQL_NTS : 0);
- OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- checkColumnCount();
-
-}
-//-----------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openTablesTypes( ) throw(SQLException, RuntimeException)
-{
- m_bFreeHandle = sal_True;
- SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
- 0,0,
- 0,0,
- 0,0,
- (SDB_ODBC_CHAR *) SQL_ALL_TABLE_TYPES,SQL_NTS);
- OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
-
- m_aColMapping.clear();
- m_aColMapping.push_back(-1);
- m_aColMapping.push_back(4);
- m_xMetaData = new OResultSetMetaData(m_pConnection,m_aStatementHandle,m_aColMapping);
- checkColumnCount();
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openCatalogs() throw(SQLException, RuntimeException)
-{
- m_bFreeHandle = sal_True;
- SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
- (SDB_ODBC_CHAR *) SQL_ALL_CATALOGS,SQL_NTS,
- (SDB_ODBC_CHAR *) "",SQL_NTS,
- (SDB_ODBC_CHAR *) "",SQL_NTS,
- (SDB_ODBC_CHAR *) "",SQL_NTS);
-
- OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
-
- m_aColMapping.clear();
- m_aColMapping.push_back(-1);
- m_aColMapping.push_back(1);
- m_xMetaData = new OResultSetMetaData(m_pConnection,m_aStatementHandle,m_aColMapping);
- checkColumnCount();
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openSchemas() throw(SQLException, RuntimeException)
-{
- m_bFreeHandle = sal_True;
- SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
- (SDB_ODBC_CHAR *) "",SQL_NTS,
- (SDB_ODBC_CHAR *) SQL_ALL_SCHEMAS,SQL_NTS,
- (SDB_ODBC_CHAR *) "",SQL_NTS,
- (SDB_ODBC_CHAR *) "",SQL_NTS);
- OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
-
- m_aColMapping.clear();
- m_aColMapping.push_back(-1);
- m_aColMapping.push_back(2);
- m_xMetaData = new OResultSetMetaData(m_pConnection,m_aStatementHandle,m_aColMapping);
- checkColumnCount();
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openColumnPrivileges( const Any& catalog, const ::rtl::OUString& schema,
- const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern )
- throw(SQLException, RuntimeException)
-{
- const ::rtl::OUString *pSchemaPat = NULL;
-
- if(schema.toChar() != '%')
- pSchemaPat = &schema;
- else
- pSchemaPat = NULL;
-
- m_bFreeHandle = sal_True;
- ::rtl::OString aPKQ,aPKO,aPKN,aCOL;
-
- if ( catalog.hasValue() )
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = ::rtl::OUStringToOString(schema,m_nTextEncoding);
- aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding);
- aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,
- *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL,
- *pPKN = aPKN.getStr(),
- *pCOL = aCOL.getStr();
-
-
- SQLRETURN nRetcode = N3SQLColumnPrivileges(m_aStatementHandle,
- (SDB_ODBC_CHAR *) pPKQ, (catalog.hasValue() && aPKQ.getLength()) ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pPKO, pPKO ? SQL_NTS : 0 ,
- (SDB_ODBC_CHAR *) pPKN, SQL_NTS,
- (SDB_ODBC_CHAR *) pCOL, SQL_NTS);
- OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
-
- checkColumnCount();
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openColumns( const Any& catalog, const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern )
- throw(SQLException, RuntimeException)
-{
- const ::rtl::OUString *pSchemaPat = NULL;
-
- if(schemaPattern.toChar() != '%')
- pSchemaPat = &schemaPattern;
- else
- pSchemaPat = NULL;
-
- m_bFreeHandle = sal_True;
- ::rtl::OString aPKQ,aPKO,aPKN,aCOL;
- if ( catalog.hasValue() )
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding);
- aPKN = ::rtl::OUStringToOString(tableNamePattern,m_nTextEncoding);
- aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,
- *pPKO = pSchemaPat && pSchemaPat->getLength() && pSchemaPat->getLength() ? aPKO.getStr() : NULL,
- *pPKN = aPKN.getStr(),
- *pCOL = aCOL.getStr();
-
-
- SQLRETURN nRetcode = N3SQLColumns(m_aStatementHandle,
- (SDB_ODBC_CHAR *) pPKQ, (catalog.hasValue() && aPKQ.getLength()) ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pPKO, pPKO ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pPKN, SQL_NTS,
- (SDB_ODBC_CHAR *) pCOL, SQL_NTS);
-
- OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- TInt2IntMap aMap;
- aMap[SQL_BIT] = DataType::BIT;
- aMap[SQL_TINYINT] = DataType::TINYINT;
- aMap[SQL_SMALLINT] = DataType::SMALLINT;
- aMap[SQL_INTEGER] = DataType::INTEGER;
- aMap[SQL_FLOAT] = DataType::FLOAT;
- aMap[SQL_REAL] = DataType::REAL;
- aMap[SQL_DOUBLE] = DataType::DOUBLE;
- aMap[SQL_BIGINT] = DataType::BIGINT;
-
- aMap[SQL_CHAR] = DataType::CHAR;
- aMap[SQL_WCHAR] = DataType::CHAR;
- aMap[SQL_VARCHAR] = DataType::VARCHAR;
- aMap[SQL_WVARCHAR] = DataType::VARCHAR;
- aMap[SQL_LONGVARCHAR] = DataType::LONGVARCHAR;
- aMap[SQL_WLONGVARCHAR] = DataType::LONGVARCHAR;
-
- aMap[SQL_TYPE_DATE] = DataType::DATE;
- aMap[SQL_DATE] = DataType::DATE;
- aMap[SQL_TYPE_TIME] = DataType::TIME;
- aMap[SQL_TIME] = DataType::TIME;
- aMap[SQL_TYPE_TIMESTAMP] = DataType::TIMESTAMP;
- aMap[SQL_TIMESTAMP] = DataType::TIMESTAMP;
-
- aMap[SQL_DECIMAL] = DataType::DECIMAL;
- aMap[SQL_NUMERIC] = DataType::NUMERIC;
-
- aMap[SQL_BINARY] = DataType::BINARY;
- aMap[SQL_VARBINARY] = DataType::VARBINARY;
- aMap[SQL_LONGVARBINARY] = DataType::LONGVARBINARY;
-
- aMap[SQL_GUID] = DataType::VARBINARY;
-
- m_aValueRange[5] = aMap;
- checkColumnCount();
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openProcedureColumns( const Any& catalog, const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& procedureNamePattern,const ::rtl::OUString& columnNamePattern )
- throw(SQLException, RuntimeException)
-{
- const ::rtl::OUString *pSchemaPat = NULL;
-
- if(schemaPattern.toChar() != '%')
- pSchemaPat = &schemaPattern;
- else
- pSchemaPat = NULL;
-
- m_bFreeHandle = sal_True;
- ::rtl::OString aPKQ,aPKO,aPKN,aCOL;
- if ( catalog.hasValue() )
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding);
- aPKN = ::rtl::OUStringToOString(procedureNamePattern,m_nTextEncoding);
- aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,
- *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL,
- *pPKN = aPKN.getStr(),
- *pCOL = aCOL.getStr();
-
-
- SQLRETURN nRetcode = N3SQLProcedureColumns(m_aStatementHandle,
- (SDB_ODBC_CHAR *) pPKQ, (catalog.hasValue() && aPKQ.getLength()) ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pPKO, pPKO ? SQL_NTS : 0 ,
- (SDB_ODBC_CHAR *) pPKN, SQL_NTS,
- (SDB_ODBC_CHAR *) pCOL, SQL_NTS);
-
- OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- checkColumnCount();
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openProcedures(const Any& catalog, const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& procedureNamePattern)
- throw(SQLException, RuntimeException)
-{
- const ::rtl::OUString *pSchemaPat = NULL;
-
- if(schemaPattern.toChar() != '%')
- pSchemaPat = &schemaPattern;
- else
- pSchemaPat = NULL;
-
- m_bFreeHandle = sal_True;
- ::rtl::OString aPKQ,aPKO,aPKN,aCOL;
-
- if ( catalog.hasValue() )
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding);
- aPKN = ::rtl::OUStringToOString(procedureNamePattern,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,
- *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL,
- *pPKN = aPKN.getStr();
-
-
- SQLRETURN nRetcode = N3SQLProcedures(m_aStatementHandle,
- (SDB_ODBC_CHAR *) pPKQ, (catalog.hasValue() && aPKQ.getLength()) ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pPKO, pPKO ? SQL_NTS : 0 ,
- (SDB_ODBC_CHAR *) pPKN, SQL_NTS);
- OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- checkColumnCount();
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openSpecialColumns(sal_Bool _bRowVer,const Any& catalog, const ::rtl::OUString& schema,
- const ::rtl::OUString& table,sal_Int32 scope, sal_Bool nullable )
- throw(SQLException, RuntimeException)
-{
- const ::rtl::OUString *pSchemaPat = NULL;
-
- if(schema.toChar() != '%')
- pSchemaPat = &schema;
- else
- pSchemaPat = NULL;
-
- m_bFreeHandle = sal_True;
- ::rtl::OString aPKQ,aPKO,aPKN,aCOL;
- if ( catalog.hasValue() )
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = ::rtl::OUStringToOString(schema,m_nTextEncoding);
- aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,
- *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL,
- *pPKN = aPKN.getStr();
-
-
- SQLRETURN nRetcode = N3SQLSpecialColumns(m_aStatementHandle,_bRowVer ? SQL_ROWVER : SQL_BEST_ROWID,
- (SDB_ODBC_CHAR *) pPKQ, (catalog.hasValue() && aPKQ.getLength()) ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pPKO, pPKO ? SQL_NTS : 0 ,
- (SDB_ODBC_CHAR *) pPKN, SQL_NTS,
- (SQLSMALLINT)scope,
- nullable ? SQL_NULLABLE : SQL_NO_NULLS);
- OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- checkColumnCount();
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openVersionColumns(const Any& catalog, const ::rtl::OUString& schema,
- const ::rtl::OUString& table) throw(SQLException, RuntimeException)
-{
- openSpecialColumns(sal_True,catalog,schema,table,SQL_SCOPE_TRANSACTION,sal_False);
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openBestRowIdentifier( const Any& catalog, const ::rtl::OUString& schema,
- const ::rtl::OUString& table,sal_Int32 scope,sal_Bool nullable ) throw(SQLException, RuntimeException)
-{
- openSpecialColumns(sal_False,catalog,schema,table,scope,nullable);
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openForeignKeys( const Any& catalog, const ::rtl::OUString* schema,
- const ::rtl::OUString* table,
- const Any& catalog2, const ::rtl::OUString* schema2,
- const ::rtl::OUString* table2) throw(SQLException, RuntimeException)
-{
- m_bFreeHandle = sal_True;
-
- ::rtl::OString aPKQ,aPKO,aPKN, aFKQ, aFKO, aFKN;
- if ( catalog.hasValue() )
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- if ( catalog2.hasValue() )
- aFKQ = ::rtl::OUStringToOString(comphelper::getString(catalog2),m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,
- *pPKO = schema && schema->getLength() ? ::rtl::OUStringToOString(*schema,m_nTextEncoding).getStr() : NULL,
- *pPKN = table ? (aPKN = ::rtl::OUStringToOString(*table,m_nTextEncoding)).getStr(): NULL,
- *pFKQ = catalog2.hasValue() && aFKQ.getLength() ? aFKQ.getStr() : NULL,
- *pFKO = schema2 && schema2->getLength() ? (aFKO = ::rtl::OUStringToOString(*schema2,m_nTextEncoding)).getStr() : NULL,
- *pFKN = table2 ? (aFKN = ::rtl::OUStringToOString(*table2,m_nTextEncoding)).getStr() : NULL;
-
-
- SQLRETURN nRetcode = N3SQLForeignKeys(m_aStatementHandle,
- (SDB_ODBC_CHAR *) pPKQ, (catalog.hasValue() && aPKQ.getLength()) ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pPKO, pPKO ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pPKN, pPKN ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pFKQ, (catalog2.hasValue() && aFKQ.getLength()) ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pFKO, pFKO ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pFKN, SQL_NTS
- );
- OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- checkColumnCount();
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openImportedKeys(const Any& catalog, const ::rtl::OUString& schema,
- const ::rtl::OUString& table) throw(SQLException, RuntimeException)
-{
-
- openForeignKeys(Any(),NULL,NULL,catalog,!schema.compareToAscii("%") ? &schema : NULL,&table);
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openExportedKeys(const Any& catalog, const ::rtl::OUString& schema,
- const ::rtl::OUString& table) throw(SQLException, RuntimeException)
-{
- openForeignKeys(catalog,!schema.compareToAscii("%") ? &schema : NULL,&table,Any(),NULL,NULL);
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openPrimaryKeys(const Any& catalog, const ::rtl::OUString& schema,
- const ::rtl::OUString& table) throw(SQLException, RuntimeException)
-{
- const ::rtl::OUString *pSchemaPat = NULL;
-
- if(schema.toChar() != '%')
- pSchemaPat = &schema;
- else
- pSchemaPat = NULL;
-
- m_bFreeHandle = sal_True;
- ::rtl::OString aPKQ,aPKO,aPKN,aCOL;
-
- if ( catalog.hasValue() )
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = ::rtl::OUStringToOString(schema,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,
- *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL,
- *pPKN = (aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding)).getStr();
-
-
- SQLRETURN nRetcode = N3SQLPrimaryKeys(m_aStatementHandle,
- (SDB_ODBC_CHAR *) pPKQ, (catalog.hasValue() && aPKQ.getLength()) ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pPKO, pPKO ? SQL_NTS : 0 ,
- (SDB_ODBC_CHAR *) pPKN, SQL_NTS);
- OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- checkColumnCount();
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openTablePrivileges(const Any& catalog, const ::rtl::OUString& schemaPattern,
- const ::rtl::OUString& tableNamePattern) throw(SQLException, RuntimeException)
-{
- const ::rtl::OUString *pSchemaPat = NULL;
-
- if(schemaPattern.toChar() != '%')
- pSchemaPat = &schemaPattern;
- else
- pSchemaPat = NULL;
-
- m_bFreeHandle = sal_True;
- ::rtl::OString aPKQ,aPKO,aPKN;
-
- if ( catalog.hasValue() )
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,
- *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL,
- *pPKN = (aPKN = ::rtl::OUStringToOString(tableNamePattern,m_nTextEncoding)).getStr();
-
-
- SQLRETURN nRetcode = N3SQLTablePrivileges(m_aStatementHandle,
- (SDB_ODBC_CHAR *) pPKQ, (catalog.hasValue() && aPKQ.getLength()) ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pPKO, pPKO ? SQL_NTS : 0 ,
- (SDB_ODBC_CHAR *) pPKN, SQL_NTS);
- OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- checkColumnCount();
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::openIndexInfo( const Any& catalog, const ::rtl::OUString& schema,
- const ::rtl::OUString& table,sal_Bool unique,sal_Bool approximate )
- throw(SQLException, RuntimeException)
-{
- const ::rtl::OUString *pSchemaPat = NULL;
-
- if(schema.toChar() != '%')
- pSchemaPat = &schema;
- else
- pSchemaPat = NULL;
-
- m_bFreeHandle = sal_True;
- ::rtl::OString aPKQ,aPKO,aPKN;
-
- if ( catalog.hasValue() )
- aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
- aPKO = ::rtl::OUStringToOString(schema,m_nTextEncoding);
-
- const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL,
- *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL,
- *pPKN = (aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding)).getStr();
-
-
- SQLRETURN nRetcode = N3SQLStatistics(m_aStatementHandle,
- (SDB_ODBC_CHAR *) pPKQ, (catalog.hasValue() && aPKQ.getLength()) ? SQL_NTS : 0,
- (SDB_ODBC_CHAR *) pPKO, pPKO ? SQL_NTS : 0 ,
- (SDB_ODBC_CHAR *) pPKN, SQL_NTS,
- unique ? SQL_INDEX_UNIQUE : SQL_INDEX_ALL,
- approximate);
- OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- checkColumnCount();
-}
-// -------------------------------------------------------------------------
-void ODatabaseMetaDataResultSet::checkColumnCount()
-{
- sal_Int16 nNumResultCols=0;
- OTools::ThrowException(m_pConnection,N3SQLNumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this);
- m_nDriverColumnCount = nNumResultCols;
-}
-// -----------------------------------------------------------------------------
-
-SWORD ODatabaseMetaDataResultSet::impl_getColumnType_nothrow(sal_Int32 columnIndex)
-{
- ::std::map<sal_Int32,SWORD>::iterator aFind = m_aODBCColumnTypes.find(columnIndex);
- if ( aFind == m_aODBCColumnTypes.end() )
- aFind = m_aODBCColumnTypes.insert(::std::map<sal_Int32,SWORD>::value_type(columnIndex,OResultSetMetaData::getColumnODBCType(m_pConnection,m_aStatementHandle,*this,columnIndex))).first;
- return aFind->second;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/ODriver.cxx b/connectivity/source/drivers/odbcbase/ODriver.cxx
deleted file mode 100644
index 7be1cf3bba..0000000000
--- a/connectivity/source/drivers/odbcbase/ODriver.cxx
+++ /dev/null
@@ -1,231 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "odbc/ODriver.hxx"
-#include "odbc/OConnection.hxx"
-#include "odbc/OFunctions.hxx"
-#include "odbc/OTools.hxx"
-#include "connectivity/dbexception.hxx"
-#include "resource/common_res.hrc"
-#include "resource/sharedresources.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;
-// --------------------------------------------------------------------------------
-ODBCDriver::ODBCDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory)
- :ODriver_BASE(m_aMutex)
- ,m_xORB(_rxFactory)
- ,m_pDriverHandle(SQL_NULL_HANDLE)
-{
-}
-// --------------------------------------------------------------------------------
-void ODBCDriver::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
-
- for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
- {
- Reference< XComponent > xComp(i->get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- }
- m_xConnections.clear();
-
- ODriver_BASE::disposing();
-}
-
-// static ServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString ODBCDriver::getImplementationName_Static( ) throw(RuntimeException)
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sdbc.ODBCDriver"));
- // this name is referenced in the configuration and in the odbc.xml
- // Please take care when changing it.
-}
-
-typedef Sequence< ::rtl::OUString > SS;
-//------------------------------------------------------------------------------
-SS ODBCDriver::getSupportedServiceNames_Static( ) throw (RuntimeException)
-{
- SS aSNS( 1 );
- aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver"));
- return aSNS;
-}
-
-//------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODBCDriver::getImplementationName( ) throw(RuntimeException)
-{
- return getImplementationName_Static();
-}
-
-//------------------------------------------------------------------
-sal_Bool SAL_CALL ODBCDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
-{
- SS aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-
-//------------------------------------------------------------------
-SS SAL_CALL ODBCDriver::getSupportedServiceNames( ) throw(RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-
-// --------------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL ODBCDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
-{
- if ( ! acceptsURL(url) )
- return NULL;
-
- if(!m_pDriverHandle)
- {
- ::rtl::OUString aPath;
- if(!EnvironmentHandle(aPath))
- throw SQLException(aPath,*this,::rtl::OUString(),1000,Any());
- }
- OConnection* pCon = new OConnection(m_pDriverHandle,this);
- Reference< XConnection > xCon = pCon;
- pCon->Construct(url,info);
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
-
- return xCon;
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL ODBCDriver::acceptsURL( const ::rtl::OUString& url )
- throw(SQLException, RuntimeException)
-{
- return (!url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:odbc:")),10));
-}
-// --------------------------------------------------------------------------------
-Sequence< DriverPropertyInfo > SAL_CALL ODBCDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException)
-{
- if ( acceptsURL(url) )
- {
- ::std::vector< DriverPropertyInfo > aDriverInfo;
-
- Sequence< ::rtl::OUString > aBooleanValues(2);
- aBooleanValues[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) );
- aBooleanValues[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
-
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet of the database."))
- ,sal_False
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseCatalog"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Use catalog for file-based databases."))
- ,sal_False
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) )
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SystemDriverSettings"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Driver settings."))
- ,sal_False
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParameterNameSubstitution"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Change named parameters with '?'."))
- ,sal_False
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) )
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreDriverPrivileges"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Ignore the privileges from the database driver."))
- ,sal_False
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) )
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsAutoRetrievingEnabled"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Retrieve generated values."))
- ,sal_False
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) )
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoRetrievingStatement"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Auto-increment statement."))
- ,sal_False
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GenerateASBeforeCorrelationName"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Generate AS before table correlation names."))
- ,sal_False
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) )
- ,aBooleanValues)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EscapeDateTime"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Escape date time format."))
- ,sal_False
- ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) )
- ,aBooleanValues)
- );
-
- return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size());
- }
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- return Sequence< DriverPropertyInfo >();
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODBCDriver::getMajorVersion( ) throw(RuntimeException)
-{
- return 1;
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODBCDriver::getMinorVersion( ) throw(RuntimeException)
-{
- return 0;
-}
-// --------------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx
deleted file mode 100644
index 233e95cca0..0000000000
--- a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx
+++ /dev/null
@@ -1,978 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <stdio.h>
-#include <string.h>
-#include <osl/diagnose.h>
-#include "diagnose_ex.h"
-#include "odbc/OPreparedStatement.hxx"
-#include "odbc/OBoundParam.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include "odbc/OTools.hxx"
-#include "odbc/ODriver.hxx"
-#include "odbc/OResultSet.hxx"
-#include "odbc/OResultSetMetaData.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "connectivity/dbtools.hxx"
-#include <comphelper/types.hxx>
-#include "connectivity/FValue.hxx"
-#include "resource/common_res.hrc"
-#include "connectivity/sqlparse.hxx"
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::odbc;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::sdbcx;
-using namespace com::sun::star::container;
-using namespace com::sun::star::io;
-using namespace com::sun::star::util;
-
-IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.OPreparedStatement","com.sun.star.sdbc.PreparedStatement");
-
-
-OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql)
- :OStatement_BASE2(_pConnection)
- ,numParams(0)
- ,boundParams(NULL)
- ,m_bPrepared(sal_False)
-{
- m_sSqlStatement = sql;
- try
- {
- if(_pConnection->isParameterSubstitutionEnabled())
- {
- OSQLParser aParser(_pConnection->getDriver()->getORB());
- ::rtl::OUString sErrorMessage;
- ::rtl::OUString sNewSql;
- ::std::auto_ptr<OSQLParseNode> pNode( aParser.parseTree(sErrorMessage,sql) );
- if ( pNode.get() )
- { // special handling for parameters
- OSQLParseNode::substituteParameterNames(pNode.get());
- pNode->parseNodeToStr( sNewSql, _pConnection );
- m_sSqlStatement = sNewSql;
- }
- }
- }
- catch(Exception&)
- {
- }
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::acquire() throw()
-{
- OStatement_BASE2::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::release() throw()
-{
- OStatement_BASE2::release();
-}
-// -----------------------------------------------------------------------------
-Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OStatement_BASE2::queryInterface(rType);
- return aRet.hasValue() ? aRet : OPreparedStatement_BASE::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::comphelper::concatSequences(OPreparedStatement_BASE::getTypes(),OStatement_BASE2::getTypes());
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- prepareStatement();
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- if(!m_xMetaData.is())
- m_xMetaData = new OResultSetMetaData(getOwnConnection(),m_aStatementHandle);
- return m_xMetaData;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- // Close/clear our result set
- clearMyResultSet ();
-
- // Reset last warning message
-
- try {
- clearWarnings ();
- OStatement_BASE2::close();
- FreeParams();
- }
- catch (SQLException &) {
- // If we get an error, ignore
- }
-
- // Remove this Statement object from the Connection object's
- // list
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- sal_Bool needData = sal_False;
-
- // Reset warnings
-
- clearWarnings ();
-
- // Reset the statement handle, warning and saved Resultset
-
- reset();
-
- // Call SQLExecute
- prepareStatement();
-
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- try
- {
- SQLRETURN nReturn = N3SQLExecute(m_aStatementHandle);
-
- OTools::ThrowException(m_pConnection,nReturn,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- needData = nReturn == SQL_NEED_DATA;
-
- // Now loop while more data is needed (i.e. a data-at-
- // execution parameter was given). For each parameter
- // that needs data, put the data from the input stream.
-
- while (needData) {
-
- // Get the parameter number that requires data
-
- sal_Int32* paramIndex = 0;
- nReturn = N3SQLParamData(m_aStatementHandle,(SQLPOINTER*)&paramIndex);
-
- // If the parameter index is -1, there is no
- // more data required
-
- if ( !paramIndex || ( *paramIndex == -1 ) )
- needData = sal_False;
- else
- {
- // Now we have the proper parameter
- // index, get the data from the input
- // stream and do a SQLPutData
- putParamData (*paramIndex);
- }
- }
-
- }
- catch (const SQLWarning&)
- {
- }
-
- // Now loop while more data is needed (i.e. a data-at-
- // execution parameter was given). For each parameter
- // that needs data, put the data from the input stream.
-
- while (needData) {
-
- // Get the parameter number that requires data
-
- sal_Int32* paramIndex = 0;
- N3SQLParamData (m_aStatementHandle,(SQLPOINTER*)&paramIndex);
-
- // If the parameter index is -1, there is no more
- // data required
-
- if (*paramIndex == -1) {
- needData = sal_False;
- }
- else {
- // Now we have the proper parameter index,
- // get the data from the input stream
- // and do a SQLPutData
- putParamData(*paramIndex);
- }
- }
-
- // Now determine if there is a result set associated with
- // the SQL statement that was executed. Get the column
- // count, and if it is not zero, there is a result set.
-
-
- return getColumnCount() > 0;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- sal_Int32 numRows = -1;
-
- prepareStatement();
- // Execute the statement. If execute returns sal_False, a
- // row count exists.
-
- if (!execute())
- numRows = getUpdateCount ();
- else
- {
- // No update count was produced (a ResultSet was). Raise
- // an exception
- m_pConnection->throwGenericSQLException(STR_NO_ROWCOUNT,*this);
- }
- return numRows;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
-{
- ::rtl::OString aString(::rtl::OUStringToOString(x,getOwnConnection()->getTextEncoding()));
- setParameter(parameterIndex,DataType::CHAR,aString.getLength(),(void*)&x);
-}
-// -------------------------------------------------------------------------
-
-Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- return (Reference< XConnection >)m_pConnection;
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- Reference< XResultSet > rs = NULL;
-
- prepareStatement();
-
- if (execute())
- rs = getResultSet(sal_False);
- else
- {
- // No ResultSet was produced. Raise an exception
- m_pConnection->throwGenericSQLException(STR_NO_RESULTSET,*this);
- }
- return rs;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- sal_Int32 value = 0;
-
- // If the parameter is sal_True, set the value to 1
- if (x) {
- value = 1;
- }
-
- // Set the parameter as if it were an integer
- setInt (parameterIndex, value);
-}
-// -------------------------------------------------------------------------
-void OPreparedStatement::setParameter(sal_Int32 parameterIndex,sal_Int32 _nType,sal_Int32 _nSize,void* _pData)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- prepareStatement();
- // Allocate a buffer to be used in binding. This will be
- // a 'permanent' buffer that the bridge will fill in with
- // the bound data in native format.
-
-
- checkParameterIndex(parameterIndex);
- sal_Int32 nRealSize = _nSize;
- SQLSMALLINT fSqlType = static_cast<SQLSMALLINT>(OTools::jdbcTypeToOdbc(_nType));
- switch(fSqlType)
- {
- case SQL_CHAR:
- case SQL_VARCHAR:
- case SQL_DECIMAL:
- case SQL_NUMERIC:
- ++nRealSize;
- break;
- case SQL_BINARY:
- case SQL_VARBINARY:
- nRealSize=1; //dummy buffer, binary data isn't copied
- break;
- default:
- break;
- }
-
- sal_Int8* bindBuf = allocBindBuf(parameterIndex, nRealSize);
-
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- OTools::bindParameter( m_pConnection,
- m_aStatementHandle,
- parameterIndex,
- bindBuf,
- getLengthBuf(parameterIndex),
- fSqlType,
- sal_False,
- m_pConnection->useOldDateFormat(),
- _pData,
- (Reference <XInterface>)*this,
- getOwnConnection()->getTextEncoding());
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,DataType::TINYINT,sizeof(sal_Int8),&x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& aData ) throw(SQLException, RuntimeException)
-{
- DATE_STRUCT x = OTools::DateToOdbcDate(aData);
- setParameter(parameterIndex,DataType::DATE,sizeof(DATE_STRUCT),&x);
-}
-// -------------------------------------------------------------------------
-
-
-void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& aVal ) throw(SQLException, RuntimeException)
-{
- TIME_STRUCT x = OTools::TimeToOdbcTime(aVal);
- setParameter(parameterIndex,DataType::TIME,sizeof(TIME_STRUCT),&x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& aVal ) throw(SQLException, RuntimeException)
-{
- TIMESTAMP_STRUCT x = OTools::DateTimeToTimestamp(aVal);
- setParameter(parameterIndex,DataType::TIMESTAMP,sizeof(TIMESTAMP_STRUCT),&x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,DataType::DOUBLE,sizeof(double),&x);
-}
-
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,DataType::FLOAT,sizeof(float),&x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,DataType::INTEGER,sizeof(sal_Int32),&x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(SQLException, RuntimeException)
-{
- try
- {
- setParameter(parameterIndex,DataType::BIGINT,sizeof(sal_Int64),&x);
- }
- catch(SQLException&)
- {
- setString(parameterIndex,ORowSetValue(x));
- }
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- prepareStatement();
- // Get the buffer needed for the length
- checkParameterIndex(parameterIndex);
-
- sal_Int8* lenBuf = getLengthBuf (parameterIndex);
- *(SQLLEN*)lenBuf = SQL_NULL_DATA;
-
-
- SQLLEN prec = 0;
- SQLULEN nColumnSize = 0;
- if (sqlType == SQL_CHAR || sqlType == SQL_VARCHAR || sqlType == SQL_LONGVARCHAR)
- {
- prec = 1;
- nColumnSize = 1;
- }
-
- SQLSMALLINT fCType = 0;
- SQLSMALLINT fSqlType = 0;
-
- SQLSMALLINT nDecimalDigits = 0;
- OTools::getBindTypes( sal_False,
- m_pConnection->useOldDateFormat(),
- (SQLSMALLINT)sqlType,
- fCType,
- fSqlType);
-
- SQLRETURN nReturn = N3SQLBindParameter( m_aStatementHandle,
- (SQLUSMALLINT)parameterIndex,
- (SQLSMALLINT)SQL_PARAM_INPUT,
- fCType,
- fSqlType,
- nColumnSize,
- nDecimalDigits,
- NULL,
- prec,
- (SQLLEN*)lenBuf
- );
- OTools::ThrowException(m_pConnection,nReturn,m_aStatementHandle,SQL_HANDLE_STMT,*this);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x ) throw(SQLException, RuntimeException)
-{
- if ( x.is() )
- setStream(parameterIndex, x->getCharacterStream(), (SQLLEN)x->length(), DataType::LONGVARCHAR);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x ) throw(SQLException, RuntimeException)
-{
- if ( x.is() )
- setStream(parameterIndex, x->getBinaryStream(), (SQLLEN)x->length(), DataType::LONGVARCHAR);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setArray", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XParameters::setRef", *this );
-}
-// -------------------------------------------------------------------------
-void OPreparedStatement::setDecimal( sal_Int32 parameterIndex, const ::rtl::OUString& x )
-{
- ::rtl::OString aString(::rtl::OUStringToOString(x,getOwnConnection()->getTextEncoding()));
- setParameter(parameterIndex,DataType::DECIMAL,aString.getLength(),(void*)&x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException)
-{
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
- prepareStatement();
- // For each known SQL Type, call the appropriate
- // set routine
-
- switch (sqlType)
- {
- case DataType::VARCHAR:
- case DataType::LONGVARCHAR:
- if(x.hasValue())
- {
- ::rtl::OUString sStr;
- x >>= sStr;
- ::rtl::OString aString(::rtl::OUStringToOString(sStr,getOwnConnection()->getTextEncoding()));
- setParameter(parameterIndex,sqlType,aString.getLength(),&aString);
- }
- else
- setNull(parameterIndex,sqlType);
- break;
- case DataType::DECIMAL:
- {
- ORowSetValue aValue;
- aValue.fill(x);
- setDecimal(parameterIndex,aValue);
- }
- break;
- case DataType::NUMERIC:
- {
- ORowSetValue aValue;
- aValue.fill(x);
- setString(parameterIndex,aValue);
- }
- break;
- default:
- ::dbtools::setObjectWithInfo(this,parameterIndex,x,sqlType,scale);
- }
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& /*typeName*/ ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- setNull(parameterIndex,sqlType);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException)
-{
- if (!::dbtools::implSetObject(this, parameterIndex, x))
- { // there is no other setXXX call which can handle the value in x
- throw SQLException();
- }
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,DataType::SMALLINT,sizeof(sal_Int16),&x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
-{
- setParameter(parameterIndex,DataType::BINARY,x.getLength(),(void*)&x);
- boundParams[parameterIndex-1].setSequence(x); // this assures that the sequence stays alive
-}
-// -------------------------------------------------------------------------
-
-
-void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
-{
- setStream(parameterIndex, x, length, DataType::LONGVARCHAR);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
-{
- setStream(parameterIndex, x, length, DataType::LONGVARBINARY);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException)
-{
- prepareStatement();
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- SQLRETURN nRet = N3SQLFreeStmt (m_aStatementHandle, SQL_RESET_PARAMS);
- nRet = N3SQLFreeStmt (m_aStatementHandle, SQL_UNBIND);
- OSL_UNUSED(nRet);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::clearBatch( ) throw(SQLException, RuntimeException)
-{
- // clearParameters( );
- // m_aBatchList.erase();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::addBatch( ) throw(SQLException, RuntimeException)
-{
-}
-// -------------------------------------------------------------------------
-
-Sequence< sal_Int32 > SAL_CALL OPreparedStatement::executeBatch( ) throw(SQLException, RuntimeException)
-{
- return Sequence< sal_Int32 > ();
-}
-// -------------------------------------------------------------------------
-
-//====================================================================
-// methods
-//====================================================================
-
-//--------------------------------------------------------------------
-// initBoundParam
-// Initialize the bound parameter objects
-//--------------------------------------------------------------------
-
-void OPreparedStatement::initBoundParam () throw(SQLException)
-{
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- // Get the number of parameters
- numParams = 0;
- N3SQLNumParams (m_aStatementHandle,&numParams);
-
- // There are parameter markers, allocate the bound
- // parameter objects
-
- if (numParams > 0)
- {
- // Allocate an array of bound parameter objects
-
- boundParams = new OBoundParam[numParams];
-
- // Allocate and initialize each bound parameter
-
- for (sal_Int32 i = 0; i < numParams; i++)
- {
- boundParams[i] = OBoundParam();
- boundParams[i].initialize ();
- }
- }
-}
-// -------------------------------------------------------------------------
-
-//--------------------------------------------------------------------
-// allocBindBuf
-// Allocate storage for the permanent data buffer for the bound
-// parameter.
-//--------------------------------------------------------------------
-
-sal_Int8* OPreparedStatement::allocBindBuf( sal_Int32 index,sal_Int32 bufLen)
-{
- sal_Int8* b = NULL;
-
- // Sanity check the parameter number
-
- if ((index >= 1) &&
- (index <= numParams) && bufLen > 0 )
- {
- b = boundParams[index - 1].allocBindDataBuffer(bufLen);
- }
-
- return b;
-}
-// -------------------------------------------------------------------------
-
-//--------------------------------------------------------------------
-// getDataBuf
-// Gets the data buffer for the given parameter index
-//--------------------------------------------------------------------
-
-sal_Int8* OPreparedStatement::getDataBuf (sal_Int32 index)
-{
- sal_Int8* b = NULL;
-
- // Sanity check the parameter number
-
- if ((index >= 1) &&
- (index <= numParams))
- {
- b = boundParams[index - 1].getBindDataBuffer ();
- }
-
- return b;
-}
-// -------------------------------------------------------------------------
-
-//--------------------------------------------------------------------
-// getLengthBuf
-// Gets the length buffer for the given parameter index
-//--------------------------------------------------------------------
-
-sal_Int8* OPreparedStatement::getLengthBuf (sal_Int32 index)
-{
- sal_Int8* b = NULL;
-
- // Sanity check the parameter number
-
- if ((index >= 1) &&
- (index <= numParams))
- {
- b = boundParams[index - 1].getBindLengthBuffer ();
- }
-
- return b;
-}
-// -------------------------------------------------------------------------
-
-//--------------------------------------------------------------------
-// getParamLength
-// Returns the length of the given parameter number. When each
-// parameter was bound, a 4-sal_Int8 buffer was given to hold the
-// length (stored in native format). Get the buffer, convert the
-// buffer from native format, and return it. If the length is -1,
-// the column is considered to be NULL.
-//--------------------------------------------------------------------
-
-sal_Int32 OPreparedStatement::getParamLength ( sal_Int32 index)
-{
- sal_Int32 paramLen = SQL_NULL_DATA;
-
- // Sanity check the parameter number
-
- if ((index >= 1) &&
- (index <= numParams)) {
-
- // Now get the length of the parameter from the
- // bound param array. -1 is returned if it is NULL.
- long n = 0;
- memcpy (&n, boundParams[index -1].getBindLengthBuffer (), sizeof (n));
- paramLen = n;
- }
- return paramLen;
-}
-// -------------------------------------------------------------------------
-
-//--------------------------------------------------------------------
-// putParamData
-// Puts parameter data from a previously bound input stream. The
-// input stream was bound using SQL_LEN_DATA_AT_EXEC.
-//--------------------------------------------------------------------
-
-void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException)
-{
- // Sanity check the parameter index
- if ((index < 1) ||
- (index > numParams))
- {
- return;
- }
-
- // We'll transfer up to MAX_PUT_DATA_LENGTH at a time
- Sequence< sal_Int8 > buf( MAX_PUT_DATA_LENGTH );
-
- // Get the information about the input stream
-
- Reference< XInputStream> inputStream = boundParams[index - 1].getInputStream ();
- if ( !inputStream.is() )
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(STR_NO_INPUTSTREAM));
- throw SQLException (sError, *this,::rtl::OUString(),0,Any());
- }
-
- sal_Int32 maxBytesLeft = boundParams[index - 1].getInputStreamLen ();
-
- // Loop while more data from the input stream
- sal_Int32 haveRead = 0;
- try
- {
-
- do
- {
- sal_Int32 toReadThisRound = ::std::min( MAX_PUT_DATA_LENGTH, maxBytesLeft );
-
- // Read some data from the input stream
- haveRead = inputStream->readBytes( buf, toReadThisRound );
- OSL_ENSURE( haveRead == buf.getLength(), "OPreparedStatement::putParamData: inconsistency!" );
-
- if ( !haveRead )
- // no more data in the stream - the given stream length was a maximum which could not be
- // fulfilled by the stream
- break;
-
- // Put the data
- OSL_ENSURE( m_aStatementHandle, "OPreparedStatement::putParamData: StatementHandle is null!" );
- N3SQLPutData ( m_aStatementHandle, buf.getArray(), buf.getLength() );
-
- // decrement the number of bytes still needed
- maxBytesLeft -= haveRead;
- }
- while ( maxBytesLeft > 0 );
- }
- catch (const IOException& ex)
- {
-
- // If an I/O exception was generated, turn
- // it into a SQLException
-
- throw SQLException(ex.Message,*this,::rtl::OUString(),0,Any());
- }
-}
-// -------------------------------------------------------------------------
-//--------------------------------------------------------------------
-// getPrecision
-// Given a SQL type, return the maximum precision for the column.
-// Returns -1 if not known
-//--------------------------------------------------------------------
-
-sal_Int32 OPreparedStatement::getPrecision ( sal_Int32 sqlType)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- sal_Int32 prec = -1;
- const TTypeInfoVector& rTypeInfo = m_pConnection->getTypeInfo();
- if ( !rTypeInfo.empty() )
- {
- m_pConnection->buildTypeInfo();
- }
-
- if ( !rTypeInfo.empty() )
- {
- OTypeInfo aInfo;
- aInfo.nType = (sal_Int16)sqlType;
- TTypeInfoVector::const_iterator aIter = ::std::find(rTypeInfo.begin(),rTypeInfo.end(),aInfo);
- if(aIter != rTypeInfo.end())
- prec = (*aIter).nPrecision;
- }
- return prec;
-}
-
-//--------------------------------------------------------------------
-// setStream
-// Sets an input stream as a parameter, using the given SQL type
-//--------------------------------------------------------------------
-
-void OPreparedStatement::setStream(
- sal_Int32 ParameterIndex,
- const Reference< XInputStream>& x,
- SQLLEN length,
- sal_Int32 SQLtype)
- throw(SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- prepareStatement();
-
- checkParameterIndex(ParameterIndex);
- // Get the buffer needed for the length
-
- sal_Int8* lenBuf = getLengthBuf(ParameterIndex);
-
- // Allocate a new buffer for the parameter data. This buffer
- // will be returned by SQLParamData (it is set to the parameter
- // number, a 4-sal_Int8 integer)
-
- sal_Int8* dataBuf = allocBindBuf (ParameterIndex, 4);
-
- // Bind the parameter with SQL_LEN_DATA_AT_EXEC
- SQLSMALLINT Ctype = SQL_C_CHAR;
- SQLLEN atExec = SQL_LEN_DATA_AT_EXEC (length);
- memcpy (dataBuf, &ParameterIndex, sizeof(ParameterIndex));
- memcpy (lenBuf, &atExec, sizeof (atExec));
-
- if ((SQLtype == SQL_BINARY) || (SQLtype == SQL_VARBINARY) || (SQLtype == SQL_LONGVARBINARY))
- Ctype = SQL_C_BINARY;
-
-
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- N3SQLBindParameter(m_aStatementHandle,
- (SQLUSMALLINT)ParameterIndex,
- (SQLUSMALLINT)SQL_PARAM_INPUT,
- Ctype,
- (SQLSMALLINT)SQLtype,
- (SQLULEN)length,
- 0,
- dataBuf,
- sizeof(ParameterIndex),
- (SQLLEN*)lenBuf);
-
- // Save the input stream
- boundParams[ParameterIndex - 1].setInputStream (x, length);
-}
-// -------------------------------------------------------------------------
-
-// -------------------------------------------------------------------------
-
-void OPreparedStatement::FreeParams()
-{
- numParams = 0;
- delete [] boundParams;
- boundParams = NULL;
-}
-// -------------------------------------------------------------------------
-void OPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
-{
- try
- {
- switch(nHandle)
- {
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- if(!isPrepared())
- setResultSetConcurrency(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- if(!isPrepared())
- setResultSetType(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- if(!isPrepared())
- setFetchDirection(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_USEBOOKMARKS:
- if(!isPrepared())
- setUsingBookmarks(comphelper::getBOOL(rValue));
- break;
- default:
- OStatement_Base::setFastPropertyValue_NoBroadcast(nHandle,rValue);
- }
- }
- catch(const SQLException&)
- {
- // throw Exception(e.Message,*this);
- }
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::prepareStatement()
-{
- if(!isPrepared())
- {
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- ::rtl::OString aSql(::rtl::OUStringToOString(m_sSqlStatement,getOwnConnection()->getTextEncoding()));
- SQLRETURN nReturn = N3SQLPrepare(m_aStatementHandle,(SDB_ODBC_CHAR *) aSql.getStr(),aSql.getLength());
- OTools::ThrowException(m_pConnection,nReturn,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- m_bPrepared = sal_True;
- initBoundParam();
- }
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::checkParameterIndex(sal_Int32 _parameterIndex)
-{
- if( !_parameterIndex || _parameterIndex > numParams)
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(STR_WRONG_PARAM_INDEX,
- "$pos$", ::rtl::OUString::valueOf(_parameterIndex),
- "$count$", ::rtl::OUString::valueOf((sal_Int32)numParams)
- ));
- SQLException aNext(sError,*this, ::rtl::OUString(),0,Any());
-
- ::dbtools::throwInvalidIndexException(*this,makeAny(aNext));
- }
-}
-// -----------------------------------------------------------------------------
-OResultSet* OPreparedStatement::createResulSet()
-{
- OResultSet* pReturn = new OResultSet(m_aStatementHandle,this);
- pReturn->setMetaData(getMetaData());
- return pReturn;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx b/connectivity/source/drivers/odbcbase/OResultSet.cxx
deleted file mode 100644
index 32917e67bb..0000000000
--- a/connectivity/source/drivers/odbcbase/OResultSet.cxx
+++ /dev/null
@@ -1,1768 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "odbc/OResultSet.hxx"
-#include "odbc/OTools.hxx"
-#include "odbc/OResultSetMetaData.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/sdbcx/CompareBookmark.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <comphelper/property.hxx>
-#include <comphelper/sequence.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/extract.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <comphelper/types.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/dbexception.hxx"
-#include "diagnose_ex.h"
-#include <rtl/logfile.hxx>
-
-#include <o3tl/compat_functional.hxx>
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::odbc;
-using namespace cppu;
-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;
-
-#define ODBC_SQL_NOT_DEFINED 99UL
-
-//------------------------------------------------------------------------------
-// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet");
-::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException)
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.odbc.ResultSet"));
-}
-// -------------------------------------------------------------------------
- Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw( RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(2);
- aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet"));
- aSupported[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ResultSet"));
- return aSupported;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-
-// -------------------------------------------------------------------------
-OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) : OResultSet_BASE(m_aMutex)
- ,OPropertySetHelper(OResultSet_BASE::rBHelper)
- ,m_aStatementHandle(_pStatementHandle)
- ,m_aConnectionHandle(pStmt->getConnectionHandle())
- ,m_pStatement(pStmt)
- ,m_pSkipDeletedSet(NULL)
- ,m_xStatement(*pStmt)
- ,m_xMetaData(NULL)
- ,m_pRowStatusArray( NULL )
- ,m_nTextEncoding(pStmt->getOwnConnection()->getTextEncoding())
- ,m_nRowPos(0)
- ,m_nLastColumnPos(0)
- ,m_nUseBookmarks(ODBC_SQL_NOT_DEFINED)
- ,m_nCurrentFetchState(0)
- ,m_bWasNull(sal_True)
- ,m_bEOF(sal_True)
- ,m_bLastRecord(sal_False)
- ,m_bFreeHandle(sal_False)
- ,m_bInserting(sal_False)
- ,m_bFetchData(sal_True)
- ,m_bRowInserted(sal_False)
- ,m_bRowDeleted(sal_False)
- ,m_bUseFetchScroll(sal_False)
-{
- osl_incrementInterlockedCount( &m_refCount );
- try
- {
- m_pRowStatusArray = new SQLUSMALLINT[1]; // the default value
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER);
- }
- catch(const Exception&)
- { // we don't want our result destroy here
- }
- SQLINTEGER nCurType = 0;
- try
- {
- N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,&nCurType,SQL_IS_UINTEGER,0);
- SQLUINTEGER nValueLen = m_pStatement->getCursorProperties(nCurType,sal_False);
- if( (nValueLen & SQL_CA2_SENSITIVITY_DELETIONS) != SQL_CA2_SENSITIVITY_DELETIONS ||
- (nValueLen & SQL_CA2_CRC_EXACT) != SQL_CA2_CRC_EXACT)
- m_pSkipDeletedSet = new OSkipDeletedSet(this);
- }
- catch(const Exception&)
- { // we don't want our result destroy here
- }
- try
- {
- SQLUINTEGER nValueLen = 0;
- OTools::GetInfo(m_pStatement->getOwnConnection(),m_aConnectionHandle,SQL_GETDATA_EXTENSIONS,nValueLen,NULL);
- m_bFetchData = !((SQL_GD_ANY_ORDER & nValueLen) == SQL_GD_ANY_ORDER && nCurType != SQL_CURSOR_FORWARD_ONLY);
- }
- catch(const Exception&)
- { // we don't want our result destroy here
- m_bFetchData = sal_True;
- }
- try
- {
- if ( getOdbcFunction(ODBC3SQLGetFunctions) )
- {
- SQLUSMALLINT nSupported = 0;
- m_bUseFetchScroll = ( N3SQLGetFunctions(m_aConnectionHandle,SQL_API_SQLFETCHSCROLL,&nSupported) == SQL_SUCCESS && nSupported == 1 );
- }
- }
- catch(const Exception&)
- {
- m_bUseFetchScroll = sal_False;
- }
-
- osl_decrementInterlockedCount( &m_refCount );
-}
-// -------------------------------------------------------------------------
-OResultSet::~OResultSet()
-{
- delete [] m_pRowStatusArray;
- delete m_pSkipDeletedSet;
-}
-// -----------------------------------------------------------------------------
-void OResultSet::construct()
-{
- osl_incrementInterlockedCount( &m_refCount );
- allocBuffer();
- osl_decrementInterlockedCount( &m_refCount );
-}
-// -------------------------------------------------------------------------
-void OResultSet::disposing(void)
-{
- SQLRETURN nRet = N3SQLCloseCursor(m_aStatementHandle);
- OSL_UNUSED( nRet );
- OPropertySetHelper::disposing();
-
- ::osl::MutexGuard aGuard(m_aMutex);
- if(!m_aBindVector.empty())
- releaseBuffer();
- if(m_bFreeHandle)
- m_pStatement->getOwnConnection()->freeStatementHandle(m_aStatementHandle);
-
-m_xStatement.clear();
-m_xMetaData.clear();
-}
-// -------------------------------------------------------------------------
-SQLRETURN OResultSet::unbind(sal_Bool _bUnbindHandle)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::unbind" );
- SQLRETURN nRet = 0;
- if ( _bUnbindHandle )
- nRet = N3SQLFreeStmt(m_aStatementHandle,SQL_UNBIND);
-
- if ( m_aBindVector.size() > 1 )
- {
- TVoidVector::iterator pValue = m_aBindVector.begin() + 1;
- TVoidVector::iterator pEnd = m_aBindVector.end();
- for(; pValue != pEnd; ++pValue)
- {
- switch (pValue->second)
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- delete static_cast< ::rtl::OString* >(reinterpret_cast< void * >(pValue->first));
- break;
- case DataType::BIGINT:
- delete static_cast< sal_Int64* >(reinterpret_cast< void * >(pValue->first));
- break;
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- delete static_cast< ::rtl::OString* >(reinterpret_cast< void * >(pValue->first));
- break;
- case DataType::REAL:
- case DataType::DOUBLE:
- delete static_cast< double* >(reinterpret_cast< void * >(pValue->first));
- break;
- case DataType::LONGVARCHAR:
- case DataType::CLOB:
- delete [] static_cast< char* >(reinterpret_cast< void * >(pValue->first));
- break;
- case DataType::LONGVARBINARY:
- case DataType::BLOB:
- delete [] static_cast< char* >(reinterpret_cast< void * >(pValue->first));
- break;
- case DataType::DATE:
- delete static_cast< DATE_STRUCT* >(reinterpret_cast< void * >(pValue->first));
- break;
- case DataType::TIME:
- delete static_cast< TIME_STRUCT* >(reinterpret_cast< void * >(pValue->first));
- break;
- case DataType::TIMESTAMP:
- delete static_cast< TIMESTAMP_STRUCT* >(reinterpret_cast< void * >(pValue->first));
- break;
- case DataType::BIT:
- case DataType::TINYINT:
- delete static_cast< sal_Int8* >(reinterpret_cast< void * >(pValue->first));
- break;
- case DataType::SMALLINT:
- delete static_cast< sal_Int16* >(reinterpret_cast< void * >(pValue->first));
- break;
- case DataType::INTEGER:
- delete static_cast< sal_Int32* >(reinterpret_cast< void * >(pValue->first));
- break;
- case DataType::FLOAT:
- delete static_cast< float* >(reinterpret_cast< void * >(pValue->first));
- break;
- case DataType::BINARY:
- case DataType::VARBINARY:
- delete static_cast< sal_Int8* >(reinterpret_cast< void * >(pValue->first));
- break;
- }
- }
- m_aBindVector.clear();
- m_aBindVector.push_back(TVoidPtr(0,0)); // the first is reserved for the bookmark
- }
- return nRet;
-}
-// -------------------------------------------------------------------------
-TVoidPtr OResultSet::allocBindColumn(sal_Int32 _nType,sal_Int32 _nColumnIndex)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::allocBindColumn" );
- TVoidPtr aPair;
- switch (_nType)
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new ::rtl::OString()),_nType);
- break;
- case DataType::BIGINT:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new sal_Int64(0)),_nType);
- break;
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new ::rtl::OString()),_nType);
- break;
- case DataType::REAL:
- case DataType::DOUBLE:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new double(0.0)),_nType);
- break;
- case DataType::LONGVARCHAR:
- case DataType::CLOB:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new char[2]),_nType); // dient nur zum auffinden
- break;
- case DataType::LONGVARBINARY:
- case DataType::BLOB:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new char[2]),_nType); // dient nur zum auffinden
- break;
- case DataType::DATE:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new DATE_STRUCT),_nType);
- break;
- case DataType::TIME:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new TIME_STRUCT),_nType);
- break;
- case DataType::TIMESTAMP:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new TIMESTAMP_STRUCT),_nType);
- break;
- case DataType::BIT:
- case DataType::TINYINT:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new sal_Int8(0)),_nType);
- break;
- case DataType::SMALLINT:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new sal_Int16(0)),_nType);
- break;
- case DataType::INTEGER:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new sal_Int32(0)),_nType);
- break;
- case DataType::FLOAT:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new float(0)),_nType);
- break;
- case DataType::BINARY:
- case DataType::VARBINARY:
- aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new sal_Int8[m_aRow[_nColumnIndex].getSequence().getLength()]),_nType);
- break;
- default:
- OSL_FAIL("Unknown type");
- aPair = TVoidPtr(0,_nType);
- }
- return aPair;
-}
-// -------------------------------------------------------------------------
-void OResultSet::allocBuffer()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::allocBuffer" );
- Reference< XResultSetMetaData > xMeta = getMetaData();
- sal_Int32 nLen = xMeta->getColumnCount();
-
- m_aBindVector.reserve(nLen+1);
- m_aBindVector.push_back(TVoidPtr(0,0)); // the first is reserved for the bookmark
- m_aRow.resize(nLen+1);
-
- for(sal_Int32 i = 1;i<=nLen;++i)
- {
- sal_Int32 nType = xMeta->getColumnType(i);
- m_aRow[i].setTypeKind( nType );
- }
- m_aLengthVector.resize(nLen + 1);
-}
-// -------------------------------------------------------------------------
-void OResultSet::releaseBuffer()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::releaseBuffer" );
- unbind(sal_False);
- m_aLengthVector.clear();
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OPropertySetHelper::queryInterface(rType);
- return aRet.hasValue() ? aRet : OResultSet_BASE::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
- Sequence< Type > SAL_CALL OResultSet::getTypes( ) throw( RuntimeException)
-{
- OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::findColumn" );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- ::osl::MutexGuard aGuard( m_aMutex );
-
- Reference< XResultSetMetaData > xMeta = getMetaData();
- sal_Int32 nLen = xMeta->getColumnCount();
- sal_Int32 i = 1;
- for(;i<=nLen;++i)
- if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
- columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
- break;
- return i;
-}
-// -------------------------------------------------------------------------
-Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- // TODO use getBytes instead of
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- // TODO use getBytes instead of
- return NULL;
-}
-// -----------------------------------------------------------------------------
-const ORowSetValue& OResultSet::getValue(sal_Int32 _nColumnIndex,SQLSMALLINT _nType,void* _pValue,SQLINTEGER _rSize)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::getValue" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- if(m_bFetchData)
- {
- if(_nColumnIndex > m_nLastColumnPos)
- fillRow(_nColumnIndex);
- return m_aRow[_nColumnIndex];
- }
- else
- OTools::getValue(m_pStatement->getOwnConnection(),m_aStatementHandle,_nColumnIndex,_nType,m_bWasNull,**this,_pValue,_rSize);
-
- return m_aEmptyValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- sal_Int8 nVal(0);
- const ORowSetValue& aValue = getValue(columnIndex,SQL_C_BIT,&nVal,sizeof nVal);
- return (&aValue == &m_aEmptyValue) ? (sal_Bool)nVal : (sal_Bool)aValue;
-}
-// -------------------------------------------------------------------------
-
-sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- sal_Int8 nRet(0);
- const ORowSetValue& aValue = getValue(columnIndex,SQL_C_TINYINT,&nRet,sizeof nRet);
- return (&aValue == &m_aEmptyValue) ? nRet : (sal_Int8)aValue;
-}
-// -------------------------------------------------------------------------
-
-Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::getBytes" );
-
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- ::osl::MutexGuard aGuard( m_aMutex );
-
-
- if(m_bFetchData)
- {
- if(columnIndex > m_nLastColumnPos)
- fillRow(columnIndex);
- Sequence< sal_Int8 > nRet;
- switch(m_aRow[columnIndex].getTypeKind())
- {
- case DataType::BINARY:
- case DataType::VARBINARY:
- case DataType::LONGVARBINARY:
- nRet = m_aRow[columnIndex];
- break;
- default:
- {
- ::rtl::OUString sRet;
- sRet = m_aRow[columnIndex].getString();
- nRet = Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(sRet.getStr()),sizeof(sal_Unicode)*sRet.getLength());
- }
- }
- return nRet;
- }
-
- const SWORD nColumnType = impl_getColumnType_nothrow(columnIndex);
-
- switch(nColumnType)
- {
- case SQL_WVARCHAR:
- case SQL_WCHAR:
- case SQL_WLONGVARCHAR:
- case SQL_VARCHAR:
- case SQL_CHAR:
- case SQL_LONGVARCHAR:
- {
- ::rtl::OUString aRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,nColumnType,m_bWasNull,**this,m_nTextEncoding);
- return Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(aRet.getStr()),sizeof(sal_Unicode)*aRet.getLength());
- }
- default:
- ;
- }
- return OTools::getBytesValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,SQL_C_BINARY,m_bWasNull,**this);
-}
-// -------------------------------------------------------------------------
-
-Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::getDate" );
- DATE_STRUCT aDate;
- aDate.day = 0;
- aDate.month = 0;
- aDate.year = 0;
-
- const ORowSetValue& aValue = getValue( columnIndex,
- m_pStatement->getOwnConnection()->useOldDateFormat() ? SQL_C_DATE : SQL_C_TYPE_DATE,
- &aDate,sizeof aDate);
- return (&aValue == &m_aEmptyValue) ? Date(aDate.day,aDate.month,aDate.year) : (Date)aValue;
-}
-// -------------------------------------------------------------------------
-
-double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- double nRet(0);
- const ORowSetValue& aValue = getValue(columnIndex,SQL_C_DOUBLE,&nRet,sizeof nRet);
- return (&aValue == &m_aEmptyValue) ? nRet : (double)aValue;
-}
-// -------------------------------------------------------------------------
-
-float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- float nRet(0);
- const ORowSetValue& aValue = getValue(columnIndex,SQL_C_FLOAT,&nRet,sizeof nRet);
- return (&aValue == &m_aEmptyValue) ? nRet : (float)aValue;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nRet(0);
- const ORowSetValue& aValue = getValue(columnIndex,SQL_C_LONG,&nRet,sizeof nRet);
- return (&aValue == &m_aEmptyValue) ? nRet : (sal_Int32)aValue;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return m_pSkipDeletedSet ? m_pSkipDeletedSet->getMappedPosition(getDriverPos()) : getDriverPos();
-}
-// -------------------------------------------------------------------------
-
-sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- sal_Int64 nRet(0);
- try
- {
- const ORowSetValue& aValue = getValue(columnIndex,SQL_C_SBIGINT,&nRet,sizeof nRet);
- return (&aValue == &m_aEmptyValue) ? nRet : (sal_Int64)aValue;
- }
- catch(const SQLException&)
- {
- nRet = getString(columnIndex).toInt64();
- }
- return nRet;
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::getMetaData" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- if(!m_xMetaData.is())
- m_xMetaData = new OResultSetMetaData(m_pStatement->getOwnConnection(),m_aStatementHandle);
- return m_xMetaData;
-}
-// -------------------------------------------------------------------------
-Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getArray", *this );
- return NULL;
-}
-
-// -------------------------------------------------------------------------
-
-Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getClob", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getBlob", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRow::getRef", *this );
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::getObject" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- fillRow(columnIndex);
- return m_aRow[columnIndex].makeAny();
-}
-// -------------------------------------------------------------------------
-
-sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- sal_Int16 nRet(0);
- const ORowSetValue& aValue = getValue(columnIndex,SQL_C_SHORT,&nRet,sizeof nRet);
- return (&aValue == &m_aEmptyValue) ? nRet : (sal_Int16)aValue;
-}
-// -------------------------------------------------------------------------
-
-
-::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::getString" );
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ::rtl::OUString nRet;
- if ( m_bFetchData )
- nRet = getValue(columnIndex,0,NULL,0);
- else
- {
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- const SWORD nColumnType = impl_getColumnType_nothrow(columnIndex);
- nRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,nColumnType,m_bWasNull,**this,m_nTextEncoding);
- }
- return nRet;
-}
-// -------------------------------------------------------------------------
-
-Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::getTime" );
- TIME_STRUCT aTime={0,0,0};
- const ORowSetValue& aValue = getValue(columnIndex,
- m_pStatement->getOwnConnection()->useOldDateFormat() ? SQL_C_TIME : SQL_C_TYPE_TIME,
- &aTime,sizeof aTime);
- return (&aValue == &m_aEmptyValue) ? Time(0,aTime.second,aTime.minute,aTime.hour) : (Time)aValue;
-}
-// -------------------------------------------------------------------------
-
-
-DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::getTimestamp" );
- TIMESTAMP_STRUCT aTime={0,0,0,0,0,0,0};
- const ORowSetValue& aValue = getValue(columnIndex,
- m_pStatement->getOwnConnection()->useOldDateFormat() ? SQL_C_TIMESTAMP : SQL_C_TYPE_TIMESTAMP,
- &aTime,sizeof aTime);
- return (&aValue == &m_aEmptyValue)
- ?
- DateTime(static_cast<sal_uInt16>(aTime.fraction*1000),aTime.second,aTime.minute,aTime.hour,aTime.day,aTime.month,aTime.year)
- :
- (DateTime)aValue;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return m_nRowPos == 0;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return m_nRowPos != 0 && m_nCurrentFetchState == SQL_NO_DATA;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return m_nRowPos == 1;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return m_bEOF && m_nCurrentFetchState != SQL_NO_DATA;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::beforeFirst" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- if(first())
- previous();
- m_nCurrentFetchState = SQL_SUCCESS;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::afterLast" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- if(last())
- next();
- m_bEOF = sal_True;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- }
- dispose();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::first" );
- return moveImpl(IResultSetHelper::FIRST,0,sal_True);
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::last" );
- return moveImpl(IResultSetHelper::LAST,0,sal_True);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::absolute" );
- return moveImpl(IResultSetHelper::ABSOLUTE,row,sal_True);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::relative" );
- return moveImpl(IResultSetHelper::RELATIVE,row,sal_True);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::previous" );
- return moveImpl(IResultSetHelper::PRIOR,0,sal_True);
-}
-// -------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return m_xStatement;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::rowDeleted() throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::rowDeleted" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- sal_Bool bRet = m_bRowDeleted;
- m_bRowDeleted = sal_False;
-
- return bRet;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::rowInserted" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- sal_Bool bInserted = m_bRowInserted;
- m_bRowInserted = sal_False;
-
- return bInserted;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::rowUpdated" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return m_pRowStatusArray[0] == SQL_ROW_UPDATED;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::next" );
- return moveImpl(IResultSetHelper::NEXT,1,sal_True);
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::wasNull" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- return m_bFetchData ? m_aRow[m_nLastColumnPos].isNull() : m_bWasNull;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::cancel( ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- OTools::ThrowException(m_pStatement->getOwnConnection(),N3SQLCancel(m_aStatementHandle),m_aStatementHandle,SQL_HANDLE_STMT,*this);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException)
-{
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException)
-{
- return Any();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::insertRow" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- SQLLEN nMaxLen = 20;
- SQLLEN nRealLen = 0;
- Sequence<sal_Int8> aBookmark(nMaxLen);
-
- SQLRETURN nRet = N3SQLBindCol(m_aStatementHandle,
- 0,
- SQL_C_VARBOOKMARK,
- aBookmark.getArray(),
- nMaxLen,
- &nRealLen
- );
- // Sequence<sal_Int8> aRealBookmark(nMaxLen);
-
- sal_Bool bPositionByBookmark = ( NULL != getOdbcFunction( ODBC3SQLBulkOperations ) );
- if ( bPositionByBookmark )
- {
- nRet = N3SQLBulkOperations( m_aStatementHandle, SQL_ADD );
- fillNeededData( nRet );
- }
- else
- {
- if(isBeforeFirst())
- next(); // must be done
- nRet = N3SQLSetPos( m_aStatementHandle, 1, SQL_ADD, SQL_LOCK_NO_CHANGE );
- fillNeededData( nRet );
- }
- try
- {
- OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- }
- catch(const SQLException&)
- {
- nRet = unbind();
- throw;
- }
-
-
- if ( bPositionByBookmark )
- {
- nRet = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_FETCH_BOOKMARK_PTR,aBookmark.getArray(),SQL_IS_POINTER); // SQL_LEN_BINARY_ATTR(aBookmark.getLength())
-
- nRet = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,0);
- }
- else
- nRet = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,0); // OJ 06.03.2004
- // sometimes we got an error but we are not interested in anymore #106047# OJ
- // OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- nRet = unbind();
- OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
-
- if(m_pSkipDeletedSet)
- {
- aBookmark.realloc(nRealLen);
- if(moveToBookmark(makeAny(aBookmark)))
- {
- sal_Int32 nRowPos = getDriverPos();
- if ( -1 == m_nRowPos )
- {
- nRowPos = m_aPosToBookmarks.size() + 1;
- }
- if ( nRowPos == m_nRowPos )
- ++nRowPos;
- m_nRowPos = nRowPos;
- m_pSkipDeletedSet->insertNewPosition(nRowPos);
- m_aPosToBookmarks[aBookmark] = nRowPos;
- }
- }
- m_bRowInserted = sal_True;
-
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::updateRow" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- SQLRETURN nRet;
-
- sal_Bool bPositionByBookmark = ( NULL != getOdbcFunction( ODBC3SQLBulkOperations ) );
- if ( bPositionByBookmark )
- {
- SQLLEN nRealLen = 0;
- nRet = N3SQLBindCol(m_aStatementHandle,
- 0,
- SQL_C_VARBOOKMARK,
- m_aBookmark.getArray(),
- m_aBookmark.getLength(),
- &nRealLen
- );
- fillNeededData(nRet = N3SQLBulkOperations(m_aStatementHandle, SQL_UPDATE_BY_BOOKMARK));
- }
- else
- fillNeededData(nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE));
- OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- // now unbind all columns so we can fetch all columns again with SQLGetData
- nRet = unbind();
- OSL_ENSURE(nRet == SQL_SUCCESS,"Could not unbind the columns!");
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::deleteRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::deleteRow" );
- SQLRETURN nRet = SQL_SUCCESS;
- sal_Int32 nPos = getDriverPos();
- nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_DELETE,SQL_LOCK_NO_CHANGE);
- OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
-
- m_bRowDeleted = ( m_pRowStatusArray[0] == SQL_ROW_DELETED );
- if ( m_bRowDeleted )
- {
- TBookmarkPosMap::iterator aIter = m_aPosToBookmarks.begin();
- TBookmarkPosMap::iterator aEnd = m_aPosToBookmarks.end();
- for (; aIter != aEnd; ++aIter)
- {
- if ( aIter->second == nPos )
- {
- m_aPosToBookmarks.erase(aIter);
- break;
- }
- }
- }
- if ( m_pSkipDeletedSet )
- m_pSkipDeletedSet->deletePosition(nPos);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException)
-{
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::moveToInsertRow" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_nLastColumnPos = 0;
- // first unbound all columns
- OSL_VERIFY_EQUALS( unbind(), SQL_SUCCESS, "Could not unbind columns!" );
- // SQLRETURN nRet = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE ,(SQLPOINTER)1,SQL_IS_INTEGER);
- m_bInserting = sal_True;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException)
-{
- m_nLastColumnPos = 0;
-}
-// -------------------------------------------------------------------------
-void OResultSet::updateValue(sal_Int32 columnIndex,SQLSMALLINT _nType,void* _pValue) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::updateValue" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- m_aBindVector.push_back(allocBindColumn(OTools::MapOdbcType2Jdbc(_nType),columnIndex));
- void* pData = reinterpret_cast<void*>(m_aBindVector.rbegin()->first);
- OSL_ENSURE(pData != NULL,"Data for update is NULL!");
- OTools::bindValue( m_pStatement->getOwnConnection(),
- m_aStatementHandle,
- columnIndex,
- _nType,
- 0,
- _pValue,
- pData,
- &m_aLengthVector[columnIndex],
- **this,
- m_nTextEncoding,
- m_pStatement->getOwnConnection()->useOldDateFormat());
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- m_aBindVector.push_back(allocBindColumn(DataType::CHAR,columnIndex));
- void* pData = reinterpret_cast<void*>(m_aBindVector.rbegin()->first);
- OTools::bindValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,SQL_CHAR,0,(sal_Int8*)NULL,pData,&m_aLengthVector[columnIndex],**this,m_nTextEncoding,m_pStatement->getOwnConnection()->useOldDateFormat());
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,SQL_BIT,&x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,SQL_CHAR,&x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,SQL_TINYINT,&x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,SQL_INTEGER,&x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateLong( sal_Int32 /*columnIndex*/, sal_Int64 /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRowUpdate::updateLong", *this );
-}
-// -----------------------------------------------------------------------
-void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,SQL_REAL,&x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,SQL_DOUBLE,&x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nType = m_aRow[columnIndex].getTypeKind();
- SQLSMALLINT nOdbcType = static_cast<SQLSMALLINT>(OTools::jdbcTypeToOdbc(nType));
- m_aRow[columnIndex] = x;
- m_aRow[columnIndex].setTypeKind(nType); // OJ: otherwise longvarchar will be recognized by fillNeededData
- updateValue(columnIndex,nOdbcType,(void*)&x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nType = m_aRow[columnIndex].getTypeKind();
- SQLSMALLINT nOdbcType = static_cast<SQLSMALLINT>(OTools::jdbcTypeToOdbc(nType));
- m_aRow[columnIndex] = x;
- m_aRow[columnIndex].setTypeKind(nType); // OJ: otherwise longvarbinary will be recognized by fillNeededData
- updateValue(columnIndex,nOdbcType,(void*)&x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const Date& x ) throw(SQLException, RuntimeException)
-{
- DATE_STRUCT aVal = OTools::DateToOdbcDate(x);
- updateValue(columnIndex,SQL_DATE,&aVal);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const Time& x ) throw(SQLException, RuntimeException)
-{
- TIME_STRUCT aVal = OTools::TimeToOdbcTime(x);
- updateValue(columnIndex,SQL_TIME,&aVal);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const DateTime& x ) throw(SQLException, RuntimeException)
-{
- TIMESTAMP_STRUCT aVal = OTools::DateTimeToTimestamp(x);
- updateValue(columnIndex,SQL_TIMESTAMP,&aVal);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
-{
- if(!x.is())
- ::dbtools::throwFunctionSequenceException(*this);
-
- Sequence<sal_Int8> aSeq;
- x->readBytes(aSeq,length);
- updateBytes(columnIndex,aSeq);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
-{
- updateBinaryStream(columnIndex,x,length);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::refreshRow" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- // SQLRETURN nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_REFRESH,SQL_LOCK_NO_CHANGE);
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,0);
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException)
-{
- if (!::dbtools::implUpdateObject(this, columnIndex, x))
- throw SQLException();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException)
-{
- if (!::dbtools::implUpdateObject(this, columnIndex, x))
- throw SQLException();
-}
-// -------------------------------------------------------------------------
-// XRowLocate
-Any SAL_CALL OResultSet::getBookmark( ) throw( SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::getBookmark" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- TBookmarkPosMap::iterator aFind = ::std::find_if(m_aPosToBookmarks.begin(),m_aPosToBookmarks.end(),
- ::o3tl::compose1(::std::bind2nd(::std::equal_to<sal_Int32>(),m_nRowPos),::o3tl::select2nd<TBookmarkPosMap::value_type>()));
-
- if ( aFind == m_aPosToBookmarks.end() )
- {
- if ( m_nUseBookmarks == ODBC_SQL_NOT_DEFINED )
- {
- RTL_LOGFILE_CONTEXT_TRACE( aLogger, "SQLGetStmtAttr" );
- m_nUseBookmarks = SQL_UB_OFF;
- SQLRETURN nRet = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_USE_BOOKMARKS,&m_nUseBookmarks,SQL_IS_UINTEGER,NULL);
- OSL_UNUSED( nRet );
- }
- if(m_nUseBookmarks == SQL_UB_OFF)
- throw SQLException();
-
- m_aBookmark = OTools::getBytesValue(m_pStatement->getOwnConnection(),m_aStatementHandle,0,SQL_C_VARBOOKMARK,m_bWasNull,**this);
- m_aPosToBookmarks[m_aBookmark] = m_nRowPos;
- OSL_ENSURE(m_aBookmark.getLength(),"Invalid bookmark from length 0!");
- }
- else
- m_aBookmark = aFind->first;
- return makeAny(m_aBookmark);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) throw( SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::moveToBookmark" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- m_nLastColumnPos = 0;
- bookmark >>= m_aBookmark;
- OSL_ENSURE(m_aBookmark.getLength(),"Invalid bookmark from length 0!");
- if(m_aBookmark.getLength())
- {
- SQLRETURN nReturn = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_FETCH_BOOKMARK_PTR,m_aBookmark.getArray(),SQL_IS_POINTER); // SQL_LEN_BINARY_ATTR(aBookmark.getLength())
- OSL_UNUSED( nReturn );
-
- if ( SQL_INVALID_HANDLE != nReturn && SQL_ERROR != nReturn )
- {
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,0);
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- TBookmarkPosMap::iterator aFind = m_aPosToBookmarks.find(m_aBookmark);
- if(aFind != m_aPosToBookmarks.end())
- m_nRowPos = aFind->second;
- else
- m_nRowPos = -1;
- return m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
- }
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::moveRelativeToBookmark" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
- m_nLastColumnPos = 0;
- bookmark >>= m_aBookmark;
- SQLRETURN nReturn = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_FETCH_BOOKMARK_PTR,m_aBookmark.getArray(),SQL_IS_POINTER);
- OSL_UNUSED( nReturn );
-
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,rows);
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- return m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSet::compareBookmarks( const Any& lhs, const Any& rhs ) throw( SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::compareBookmarks" );
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- return (lhs == rhs) ? CompareBookmark::EQUAL : CompareBookmark::NOT_EQUAL;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSet::hashBookmark( const Any& /*bookmark*/ ) throw( SQLException, RuntimeException)
-{
- ::dbtools::throwFunctionNotSupportedException( "XRowLocate::hashBookmark", *this );
- return 0;
-}
-// -------------------------------------------------------------------------
-// XDeleteRows
-Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& rows ) throw( SQLException, RuntimeException)
-{
- Sequence< sal_Int32 > aRet(rows.getLength());
- sal_Int32 *pRet = aRet.getArray();
-
- const Any *pBegin = rows.getConstArray();
- const Any *pEnd = pBegin + rows.getLength();
-
- for(;pBegin != pEnd;++pBegin,++pRet)
- {
- try
- {
- if(moveToBookmark(*pBegin))
- {
- deleteRow();
- *pRet = 1;
- }
- }
- catch(const SQLException&)
- {
- *pRet = 0;
- }
- }
- return aRet;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::getResultSetConcurrency() const
-{
- sal_uInt32 nValue = 0;
- SQLRETURN nReturn = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CONCURRENCY,&nValue,SQL_IS_UINTEGER,0);
- OSL_UNUSED( nReturn );
- if(SQL_CONCUR_READ_ONLY == nValue)
- nValue = ResultSetConcurrency::READ_ONLY;
- else
- nValue = ResultSetConcurrency::UPDATABLE;
-
- return nValue;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::getResultSetType() const
-{
- sal_uInt32 nValue = 0;
- N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_SENSITIVITY,&nValue,SQL_IS_UINTEGER,0);
- if(SQL_SENSITIVE == nValue)
- nValue = ResultSetType::SCROLL_SENSITIVE;
- else if(SQL_INSENSITIVE == nValue)
- nValue = ResultSetType::SCROLL_INSENSITIVE;
- else
- {
- SQLINTEGER nCurType = 0;
- N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,&nCurType,SQL_IS_UINTEGER,0);
- if(SQL_CURSOR_KEYSET_DRIVEN == nCurType)
- nValue = ResultSetType::SCROLL_SENSITIVE;
- else if(SQL_CURSOR_STATIC == nCurType)
- nValue = ResultSetType::SCROLL_INSENSITIVE;
- else if(SQL_CURSOR_FORWARD_ONLY == nCurType)
- nValue = ResultSetType::FORWARD_ONLY;
- else if(SQL_CURSOR_DYNAMIC == nCurType)
- nValue = ResultSetType::SCROLL_SENSITIVE;
- }
- return nValue;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::getFetchDirection() const
-{
- return FetchDirection::FORWARD;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::getFetchSize() const
-{
- sal_uInt32 nValue = 0;
- N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,&nValue,SQL_IS_UINTEGER,0);
- return nValue;
-}
-//------------------------------------------------------------------------------
-::rtl::OUString OResultSet::getCursorName() const
-{
- SQLCHAR pName[258];
- SQLSMALLINT nRealLen = 0;
- N3SQLGetCursorName(m_aStatementHandle,(SQLCHAR*)pName,256,&nRealLen);
- return ::rtl::OUString::createFromAscii((const char*)pName);
-}
-// -------------------------------------------------------------------------
-sal_Bool OResultSet::isBookmarkable() const
-{
- if(!m_aConnectionHandle)
- return sal_False;
-
- sal_uInt32 nValue = 0;
- N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,&nValue,SQL_IS_UINTEGER,0);
-
- sal_Int32 nAttr = 0;
- try
- {
- switch(nValue)
- {
- case SQL_CURSOR_FORWARD_ONLY:
- return sal_False;
- case SQL_CURSOR_STATIC:
- OTools::GetInfo(m_pStatement->getOwnConnection(),m_aConnectionHandle,SQL_STATIC_CURSOR_ATTRIBUTES1,nAttr,NULL);
- break;
- case SQL_CURSOR_KEYSET_DRIVEN:
- OTools::GetInfo(m_pStatement->getOwnConnection(),m_aConnectionHandle,SQL_KEYSET_CURSOR_ATTRIBUTES1,nAttr,NULL);
- break;
- case SQL_CURSOR_DYNAMIC:
- OTools::GetInfo(m_pStatement->getOwnConnection(),m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nAttr,NULL);
- break;
- }
- }
- catch(const Exception&)
- {
- return sal_False;
- }
-
- if ( m_nUseBookmarks == ODBC_SQL_NOT_DEFINED )
- {
- m_nUseBookmarks = SQL_UB_OFF;
- SQLRETURN nRet = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_USE_BOOKMARKS,&m_nUseBookmarks,SQL_IS_UINTEGER,NULL);
- OSL_UNUSED( nRet );
- }
-
- return (m_nUseBookmarks != SQL_UB_OFF) && (nAttr & SQL_CA1_BOOKMARK) == SQL_CA1_BOOKMARK;
-}
-//------------------------------------------------------------------------------
-void OResultSet::setFetchDirection(sal_Int32 _par0)
-{
- OSL_ENSURE(_par0>0,"Illegal fetch direction!");
- if ( _par0 > 0 )
- {
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
- }
-}
-//------------------------------------------------------------------------------
-void OResultSet::setFetchSize(sal_Int32 _par0)
-{
- OSL_ENSURE(_par0>0,"Illegal fetch size!");
- if ( _par0 > 0 )
- {
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
- delete [] m_pRowStatusArray;
-
- m_pRowStatusArray = new SQLUSMALLINT[_par0];
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER);
- }
-}
-// -------------------------------------------------------------------------
-IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
-{
- Sequence< Property > aProps(6);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY);
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY);
-
- return new OPropertyArrayHelper(aProps);
-}
-// -------------------------------------------------------------------------
-IPropertyArrayHelper & OResultSet::getInfoHelper()
-{
- return *const_cast<OResultSet*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool OResultSet::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw ::com::sun::star::lang::IllegalArgumentException();
- case PROPERTY_ID_FETCHDIRECTION:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection());
- case PROPERTY_ID_FETCHSIZE:
- return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize());
- default:
- ;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-void OResultSet::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& rValue
- )
- throw (Exception)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw Exception();
- case PROPERTY_ID_FETCHDIRECTION:
- setFetchDirection(getINT32(rValue));
- break;
- case PROPERTY_ID_FETCHSIZE:
- setFetchSize(getINT32(rValue));
- break;
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void OResultSet::getFastPropertyValue(
- Any& rValue,
- sal_Int32 nHandle
- ) const
-{
- switch(nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- rValue = bool2any(isBookmarkable());
- break;
- case PROPERTY_ID_CURSORNAME:
- rValue <<= getCursorName();
- break;
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- rValue <<= getResultSetConcurrency();
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- rValue <<= getResultSetType();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- rValue <<= getFetchDirection();
- break;
- case PROPERTY_ID_FETCHSIZE:
- rValue <<= getFetchSize();
- break;
- }
-}
-// -------------------------------------------------------------------------
-void OResultSet::fillRow(sal_Int32 _nToColumn)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::fillRow" );
- if((sal_Int32)m_aRow.size() <= _nToColumn)
- {
- m_aRow.resize(_nToColumn+1);
- m_aRow[_nToColumn].setBound(sal_True);
- }
- m_bFetchData = sal_False;
-
- sal_Int32 nColumn = m_nLastColumnPos + 1;
- TDataRow::iterator pColumn = m_aRow.begin() + nColumn;
- TDataRow::iterator pColumnEnd = m_aRow.begin() + _nToColumn + 1;
-
- for (; pColumn < pColumnEnd; ++nColumn, ++pColumn)
- {
- const sal_Int32 nType = pColumn->getTypeKind();
- switch (nType)
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- case DataType::LONGVARCHAR:
- case DataType::CLOB:
- {
- const SWORD nColumnType = impl_getColumnType_nothrow(nColumn);
- *pColumn = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,nColumn,nColumnType,m_bWasNull,**this,m_nTextEncoding);
- }
- break;
- case DataType::BIGINT:
- *pColumn = getLong(nColumn);
- break;
- case DataType::REAL:
- case DataType::DOUBLE:
- *pColumn = getDouble(nColumn);
- break;
- case DataType::LONGVARBINARY:
- case DataType::BLOB:
- *pColumn = getBytes(nColumn);
- break;
- case DataType::DATE:
- *pColumn = getDate(nColumn);
- break;
- case DataType::TIME:
- *pColumn = getTime(nColumn);
- break;
- case DataType::TIMESTAMP:
- *pColumn = getTimestamp(nColumn);
- break;
- case DataType::BIT:
- *pColumn = getBoolean(nColumn);
- break;
- case DataType::TINYINT:
- *pColumn = getByte(nColumn);
- break;
- case DataType::SMALLINT:
- *pColumn = getShort(nColumn);
- break;
- case DataType::INTEGER:
- *pColumn = getInt(nColumn);
- break;
- case DataType::FLOAT:
- *pColumn = getFloat(nColumn);
- break;
- case DataType::BINARY:
- case DataType::VARBINARY:
- *pColumn = getBytes(nColumn);
- break;
- }
-
- if ( m_bWasNull )
- pColumn->setNull();
- if(nType != pColumn->getTypeKind())
- {
- pColumn->setTypeKind(nType);
- }
- }
- m_nLastColumnPos = _nToColumn;
- m_bFetchData = sal_True;
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OResultSet::acquire() throw()
-{
- OResultSet_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OResultSet::release() throw()
-{
- OResultSet_BASE::release();
-}
-// -----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-sal_Bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool /*_bRetrieveData*/)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::move" );
- SQLSMALLINT nFetchOrientation = SQL_FETCH_NEXT;
- switch(_eCursorPosition)
- {
- case IResultSetHelper::NEXT:
- nFetchOrientation = SQL_FETCH_NEXT;
- break;
- case IResultSetHelper::PRIOR:
- nFetchOrientation = SQL_FETCH_PRIOR;
- break;
- case IResultSetHelper::FIRST:
- nFetchOrientation = SQL_FETCH_FIRST;
- break;
- case IResultSetHelper::LAST:
- nFetchOrientation = SQL_FETCH_LAST;
- break;
- case IResultSetHelper::RELATIVE:
- nFetchOrientation = SQL_FETCH_RELATIVE;
- break;
- case IResultSetHelper::ABSOLUTE:
- nFetchOrientation = SQL_FETCH_ABSOLUTE;
- break;
- case IResultSetHelper::BOOKMARK: // special case here because we are only called with position numbers
- {
- TBookmarkPosMap::iterator aIter = m_aPosToBookmarks.begin();
- TBookmarkPosMap::iterator aEnd = m_aPosToBookmarks.end();
- for (; aIter != aEnd; ++aIter)
- {
- if ( aIter->second == _nOffset )
- return moveToBookmark(makeAny(aIter->first));
- }
- OSL_FAIL("Bookmark not found!");
- }
- return sal_False;
- }
-
- m_bEOF = sal_False;
- m_nLastColumnPos = 0;
-
- SQLRETURN nOldFetchStatus = m_nCurrentFetchState;
- if ( !m_bUseFetchScroll && _eCursorPosition == IResultSetHelper::NEXT )
- m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle);
- else
- m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,nFetchOrientation,_nOffset);
-
- OSL_TRACE( __FILE__": OSkipDeletedSet::OResultSet::move(%d,%d), FetchState = %d",nFetchOrientation,_nOffset,m_nCurrentFetchState);
- OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
-
- const bool bSuccess = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
- if ( bSuccess )
- {
- switch(_eCursorPosition)
- {
- case IResultSetHelper::NEXT:
- ++m_nRowPos;
- break;
- case IResultSetHelper::PRIOR:
- --m_nRowPos;
- break;
- case IResultSetHelper::FIRST:
- m_nRowPos = 1;
- break;
- case IResultSetHelper::LAST:
- m_bEOF = sal_True;
- break;
- case IResultSetHelper::RELATIVE:
- m_nRowPos += _nOffset;
- break;
- case IResultSetHelper::ABSOLUTE:
- case IResultSetHelper::BOOKMARK: // special case here because we are only called with position numbers
- m_nRowPos = _nOffset;
- break;
- } // switch(_eCursorPosition)
- if ( m_nUseBookmarks == ODBC_SQL_NOT_DEFINED )
- {
- RTL_LOGFILE_CONTEXT_TRACE( aLogger, "SQLGetStmtAttr" );
- m_nUseBookmarks = SQL_UB_OFF;
- SQLRETURN nRet = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_USE_BOOKMARKS,&m_nUseBookmarks,SQL_IS_UINTEGER,NULL);
- OSL_UNUSED( nRet );
- }
- if ( m_nUseBookmarks != SQL_UB_OFF )
- {
- RTL_LOGFILE_CONTEXT_TRACE( aLogger, "OTools::getBytesValue" );
- m_aBookmark = OTools::getBytesValue(m_pStatement->getOwnConnection(),m_aStatementHandle,0,SQL_C_VARBOOKMARK,m_bWasNull,**this);
- m_aPosToBookmarks[m_aBookmark] = m_nRowPos;
- OSL_ENSURE(m_aBookmark.getLength(),"Invalid bookmark from length 0!");
- }
- }
- else if ( IResultSetHelper::PRIOR == _eCursorPosition && m_nCurrentFetchState == SQL_NO_DATA )
- m_nRowPos = 0;
- else if(IResultSetHelper::NEXT == _eCursorPosition && m_nCurrentFetchState == SQL_NO_DATA && nOldFetchStatus != SQL_NO_DATA)
- ++m_nRowPos;
-
- return bSuccess;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 OResultSet::getDriverPos() const
-{
- sal_Int32 nValue = 0;
- SQLRETURN nRet = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_NUMBER,&nValue,SQL_IS_UINTEGER,0);
- OSL_UNUSED( nRet );
- OSL_TRACE( __FILE__": OResultSet::getDriverPos() = Ret = %d, RowNum = %d, RowPos = %d",nRet,nValue , m_nRowPos);
- return nValue ? nValue : m_nRowPos;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OResultSet::deletedVisible() const
-{
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OResultSet::isRowDeleted() const
-{
- return m_pRowStatusArray[0] == SQL_ROW_DELETED;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OResultSet::moveImpl(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return (m_pSkipDeletedSet != NULL)
- ? m_pSkipDeletedSet->skipDeleted(_eCursorPosition,_nOffset,_bRetrieveData)
- : move(_eCursorPosition,_nOffset,_bRetrieveData);
-}
-// -----------------------------------------------------------------------------
-void OResultSet::fillNeededData(SQLRETURN _nRet)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSet::fillNeededData" );
- SQLRETURN nRet = _nRet;
- if( nRet == SQL_NEED_DATA)
- {
- void* pColumnIndex = 0;
- nRet = N3SQLParamData(m_aStatementHandle,&pColumnIndex);
-
- do
- {
- if (nRet != SQL_SUCCESS && nRet != SQL_SUCCESS_WITH_INFO && nRet != SQL_NEED_DATA)
- break;
-
- sal_IntPtr nColumnIndex ( reinterpret_cast<sal_IntPtr>(pColumnIndex));
- Sequence< sal_Int8 > aSeq;
- switch(m_aRow[nColumnIndex].getTypeKind())
- {
- case DataType::BINARY:
- case DataType::VARBINARY:
- case DataType::LONGVARBINARY:
- case DataType::BLOB:
- aSeq = m_aRow[nColumnIndex];
- N3SQLPutData (m_aStatementHandle, aSeq.getArray(), aSeq.getLength());
- break;
- case SQL_WLONGVARCHAR:
- {
- ::rtl::OUString sRet;
- sRet = m_aRow[nColumnIndex].getString();
- nRet = N3SQLPutData (m_aStatementHandle, (SQLPOINTER)sRet.getStr(), sizeof(sal_Unicode)*sRet.getLength());
- break;
- }
- case DataType::LONGVARCHAR:
- case DataType::CLOB:
- {
- ::rtl::OUString sRet;
- sRet = m_aRow[nColumnIndex].getString();
- ::rtl::OString aString(::rtl::OUStringToOString(sRet,m_nTextEncoding));
- nRet = N3SQLPutData (m_aStatementHandle, (SQLPOINTER)aString.getStr(), aString.getLength());
- break;
- }
- default:
- OSL_FAIL("Not supported at the moment!");
- }
- nRet = N3SQLParamData(m_aStatementHandle,&pColumnIndex);
- }
- while (nRet == SQL_NEED_DATA);
- }
-}
-// -----------------------------------------------------------------------------
-SWORD OResultSet::impl_getColumnType_nothrow(sal_Int32 columnIndex)
-{
- ::std::map<sal_Int32,SWORD>::iterator aFind = m_aODBCColumnTypes.find(columnIndex);
- if ( aFind == m_aODBCColumnTypes.end() )
- aFind = m_aODBCColumnTypes.insert(::std::map<sal_Int32,SWORD>::value_type(columnIndex,OResultSetMetaData::getColumnODBCType(m_pStatement->getOwnConnection(),m_aStatementHandle,*this,columnIndex))).first;
- return aFind->second;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx b/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx
deleted file mode 100644
index a534a7e560..0000000000
--- a/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx
+++ /dev/null
@@ -1,318 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "odbc/OResultSetMetaData.hxx"
-#include "odbc/OTools.hxx"
-#include <rtl/logfile.hxx>
-
-using namespace connectivity::odbc;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::sdbc;
-
-// -------------------------------------------------------------------------
-OResultSetMetaData::~OResultSetMetaData()
-{
-}
-// -------------------------------------------------------------------------
-::rtl::OUString OResultSetMetaData::getCharColAttrib(sal_Int32 _column,sal_Int32 ident) throw(SQLException, RuntimeException)
-{
- sal_Int32 column = _column;
- if(_column <(sal_Int32) m_vMapping.size()) // use mapping
- column = m_vMapping[_column];
-
- SQLSMALLINT BUFFER_LEN = 128;
- char *pName = new char[BUFFER_LEN+1];
- SQLSMALLINT nRealLen=0;
- SQLRETURN nRet = N3SQLColAttribute(m_aStatementHandle,
- (SQLUSMALLINT)column,
- (SQLUSMALLINT)ident,
- (SQLPOINTER)pName,
- BUFFER_LEN,
- &nRealLen,
- NULL
- );
- ::rtl::OUString sValue;
- if ( nRet == SQL_SUCCESS )
- {
- if ( nRealLen < 0 )
- nRealLen = BUFFER_LEN;
- sValue = ::rtl::OUString(pName,nRealLen,m_pConnection->getTextEncoding());
- }
- delete [] pName;
- OTools::ThrowException(m_pConnection,nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- if(nRealLen > BUFFER_LEN)
- {
- pName = new char[nRealLen+1];
- nRet = N3SQLColAttribute(m_aStatementHandle,
- (SQLUSMALLINT)column,
- (SQLUSMALLINT)ident,
- (SQLPOINTER)pName,
- nRealLen,
- &nRealLen,
- NULL
- );
- if ( nRet == SQL_SUCCESS && nRealLen > 0)
- sValue = ::rtl::OUString(pName,nRealLen,m_pConnection->getTextEncoding());
- delete [] pName;
- OTools::ThrowException(m_pConnection,nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
- }
-
- return sValue;
-}
-// -------------------------------------------------------------------------
-SQLLEN OResultSetMetaData::getNumColAttrib(OConnection* _pConnection
- ,SQLHANDLE _aStatementHandle
- ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface
- ,sal_Int32 _column
- ,sal_Int32 _ident) throw(SQLException, RuntimeException)
-{
- SQLLEN nValue=0;
- OTools::ThrowException(_pConnection,(*(T3SQLColAttribute)_pConnection->getOdbcFunction(ODBC3SQLColAttribute))(_aStatementHandle,
- (SQLUSMALLINT)_column,
- (SQLUSMALLINT)_ident,
- NULL,
- 0,
- NULL,
- &nValue),_aStatementHandle,SQL_HANDLE_STMT,_xInterface);
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 OResultSetMetaData::getNumColAttrib(sal_Int32 _column,sal_Int32 ident) throw(SQLException, RuntimeException)
-{
- sal_Int32 column = _column;
- if(_column < (sal_Int32)m_vMapping.size()) // use mapping
- column = m_vMapping[_column];
-
- return getNumColAttrib(m_pConnection,m_aStatementHandle,*this,column,ident);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return getNumColAttrib(column,SQL_DESC_DISPLAY_SIZE);
-}
-// -------------------------------------------------------------------------
-SQLSMALLINT OResultSetMetaData::getColumnODBCType(OConnection* _pConnection
- ,SQLHANDLE _aStatementHandle
- ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface
- ,sal_Int32 column)
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- SQLSMALLINT nType = 0;
- try
- {
- nType = (SQLSMALLINT)getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column,SQL_DESC_CONCISE_TYPE);
- if(nType == SQL_UNKNOWN_TYPE)
- nType = (SQLSMALLINT)getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column, SQL_DESC_TYPE);
- }
- catch(SQLException& ) // in this case we have an odbc 2.0 driver
- {
- nType = (SQLSMALLINT)getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column,SQL_DESC_CONCISE_TYPE );
- }
-
- return nType;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- ::std::map<sal_Int32,sal_Int32>::iterator aFind = m_aColumnTypes.find(column);
- if ( aFind == m_aColumnTypes.end() )
- {
- sal_Int32 nType = 0;
- if(!m_bUseODBC2Types)
- {
- try
- {
- nType = getNumColAttrib(column,SQL_DESC_CONCISE_TYPE);
- if(nType == SQL_UNKNOWN_TYPE)
- nType = getNumColAttrib(column, SQL_DESC_TYPE);
- nType = OTools::MapOdbcType2Jdbc(nType);
- }
- catch(SQLException& ) // in this case we have an odbc 2.0 driver
- {
- m_bUseODBC2Types = sal_True;
- nType = OTools::MapOdbcType2Jdbc(getNumColAttrib(column,SQL_DESC_CONCISE_TYPE ));
- }
- }
- else
- nType = OTools::MapOdbcType2Jdbc(getNumColAttrib(column,SQL_DESC_CONCISE_TYPE ));
- aFind = m_aColumnTypes.insert(::std::map<sal_Int32,sal_Int32>::value_type(column,nType)).first;
- }
-
-
- return aFind->second;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException)
-{
- if(m_nColCount != -1)
- return m_nColCount;
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnCount" );
- sal_Int16 nNumResultCols=0;
- OTools::ThrowException(m_pConnection,N3SQLNumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this);
- return m_nColCount = nNumResultCols;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return getNumColAttrib(column,SQL_DESC_CASE_SENSITIVE) == SQL_TRUE;
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return getCharColAttrib(column,SQL_DESC_SCHEMA_NAME);
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return getCharColAttrib(column,SQL_DESC_NAME);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return getCharColAttrib(column,SQL_DESC_TABLE_NAME);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return getCharColAttrib(column,SQL_DESC_CATALOG_NAME);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnTypeName" );
- return getCharColAttrib(column,SQL_DESC_TYPE_NAME);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnLabel" );
- return getCharColAttrib(column,SQL_DESC_LABEL);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnServiceName" );
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return getNumColAttrib(column,SQL_DESC_FIXED_PREC_SCALE) == SQL_TRUE;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return getNumColAttrib(column,SQL_DESC_AUTO_UNIQUE_VALUE) == SQL_TRUE;
-}
-// -------------------------------------------------------------------------
-
-
-sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::isSigned" );
- return getNumColAttrib(column,SQL_DESC_UNSIGNED) == SQL_FALSE;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::getPrecision" );
- sal_Int32 nType = 0;
- try
- {
- nType = getNumColAttrib(column,SQL_DESC_PRECISION);
- }
- catch(const SQLException& ) // in this case we have an odbc 2.0 driver
- {
- m_bUseODBC2Types = sal_True;
- nType = getNumColAttrib(column,SQL_COLUMN_PRECISION );
- }
- return nType;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::getScale" );
- sal_Int32 nType = 0;
- try
- {
- nType = getNumColAttrib(column,SQL_DESC_SCALE);
- }
- catch(const SQLException& ) // in this case we have an odbc 2.0 driver
- {
- m_bUseODBC2Types = sal_True;
- nType = getNumColAttrib(column,SQL_COLUMN_SCALE );
- }
- return nType;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::isNullable" );
- return getNumColAttrib(column,SQL_DESC_NULLABLE);
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::isSearchable" );
- return getNumColAttrib(column,SQL_DESC_SEARCHABLE) != SQL_PRED_NONE;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::isReadOnly" );
- return getNumColAttrib(column,SQL_DESC_UPDATABLE) == SQL_ATTR_READONLY;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::isDefinitelyWritable" );
- return getNumColAttrib(column,SQL_DESC_UPDATABLE) == SQL_ATTR_WRITE;
-;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::isWritable" );
- return getNumColAttrib(column,SQL_DESC_UPDATABLE) == SQL_ATTR_WRITE;
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/OStatement.cxx b/connectivity/source/drivers/odbcbase/OStatement.cxx
deleted file mode 100644
index 93676093cc..0000000000
--- a/connectivity/source/drivers/odbcbase/OStatement.cxx
+++ /dev/null
@@ -1,1162 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <stdio.h>
-#include <osl/diagnose.h>
-#include "odbc/OStatement.hxx"
-#include "odbc/OConnection.hxx"
-#include "odbc/OResultSet.hxx"
-#include <comphelper/property.hxx>
-#include "odbc/OTools.hxx"
-#include <comphelper/uno3.hxx>
-#include <osl/thread.h>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <comphelper/sequence.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/extract.hxx>
-#include <comphelper/types.hxx>
-#include "diagnose_ex.h"
-#include <algorithm>
-#include "resource/common_res.hrc"
-#include "connectivity/dbexception.hxx"
-
-using namespace ::comphelper;
-
-#define THROW_SQL(x) \
- OTools::ThrowException(m_pConnection,x,m_aStatementHandle,SQL_HANDLE_STMT,*this)
-
-#if OSL_DEBUG_LEVEL > 1
-#define DEBUG_THROW \
- try \
- { \
- THROW_SQL(nRetCode); \
- } \
- catch(const SQLException&) \
- { \
- OSL_FAIL("Exception in odbc caught"); \
- }
-#endif
-
-
-
-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;
-//------------------------------------------------------------------------------
-OStatement_Base::OStatement_Base(OConnection* _pConnection )
- :OStatement_BASE(m_aMutex)
- ,OPropertySetHelper(OStatement_BASE::rBHelper)
- ,m_pConnection(_pConnection)
- ,m_aStatementHandle(SQL_NULL_HANDLE)
- ,m_pRowStatusArray(0)
- ,rBHelper(OStatement_BASE::rBHelper)
-{
- osl_incrementInterlockedCount( &m_refCount );
- m_pConnection->acquire();
- m_aStatementHandle = m_pConnection->createStatementHandle();
-
- //setMaxFieldSize(0);
- // Don't do this. By ODBC spec, "0" is the default for the SQL_ATTR_MAX_LENGTH attribute. We once introduced
- // this line since an PostgreSQL ODBC driver had a default other than 0. However, current drivers (at least 8.3
- // and later) have a proper default of 0, so there should be no need anymore.
- // On the other hand, the NotesSQL driver (IBM's ODBC driver for the Lotus Notes series) wrongly interprets
- // "0" as "0", whereas the ODBC spec says it should in fact mean "unlimited".
- // So, removing this line seems to be the best option for now.
- // If we ever again encounter a ODBC driver which needs this option, then we should introduce a data source
- // setting for it, instead of unconditionally doing it.
-
- osl_decrementInterlockedCount( &m_refCount );
-}
-// -----------------------------------------------------------------------------
-OStatement_Base::~OStatement_Base()
-{
- OSL_ENSURE(!m_aStatementHandle,"Sohould ne null here!");
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::disposeResultSet()
-{
- // free the cursor if alive
- Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- m_xResultSet = Reference< XResultSet>();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::disposing(void)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- disposeResultSet();
- ::comphelper::disposeComponent(m_xGeneratedStatement);
-
- OSL_ENSURE(m_aStatementHandle,"OStatement_BASE2::disposing: StatementHandle is null!");
- if (m_pConnection)
- {
- m_pConnection->freeStatementHandle(m_aStatementHandle);
- m_pConnection->release();
- m_pConnection = NULL;
- }
- OSL_ENSURE(!m_aStatementHandle,"Sohould ne null here!");
-
- OStatement_BASE::disposing();
-}
-//------------------------------------------------------------------------------
-void OStatement_BASE2::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- dispose_ChildImpl();
- OStatement_Base::disposing();
-}
-//-----------------------------------------------------------------------------
-void SAL_CALL OStatement_BASE2::release() throw()
-{
- relase_ChildImpl();
-}
-//-----------------------------------------------------------------------------
-Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- if ( m_pConnection && !m_pConnection->isAutoRetrievingEnabled() && rType == ::getCppuType( (const Reference< XGeneratedResultSet > *)0 ) )
- return Any();
- Any aRet = OStatement_BASE::queryInterface(rType);
- return aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException)
-{
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
- ::getCppuType( (const Reference< XFastPropertySet > *)0 ),
- ::getCppuType( (const Reference< XPropertySet > *)0 ));
- Sequence< Type > aOldTypes = OStatement_BASE::getTypes();
- if ( m_pConnection && !m_pConnection->isAutoRetrievingEnabled() )
- {
- ::std::remove(aOldTypes.getArray(),aOldTypes.getArray() + aOldTypes.getLength(),
- ::getCppuType( (const Reference< XGeneratedResultSet > *)0 ));
- aOldTypes.realloc(aOldTypes.getLength() - 1);
- }
-
- return ::comphelper::concatSequences(aTypes.getTypes(),aOldTypes);
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL OStatement_Base::getGeneratedValues( ) throw (SQLException, RuntimeException)
-{
- OSL_ENSURE( m_pConnection && m_pConnection->isAutoRetrievingEnabled(),"Illegal call here. isAutoRetrievingEnabled is false!");
- Reference< XResultSet > xRes;
- if ( m_pConnection )
- {
- ::rtl::OUString sStmt = m_pConnection->getTransformedGeneratedStatement(m_sSqlStatement);
- if ( sStmt.getLength() )
- {
- ::comphelper::disposeComponent(m_xGeneratedStatement);
- m_xGeneratedStatement = m_pConnection->createStatement();
- xRes = m_xGeneratedStatement->executeQuery(sStmt);
- }
- }
- return xRes;
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- OTools::ThrowException(m_pConnection,N3SQLCancel(m_aStatementHandle),m_aStatementHandle,SQL_HANDLE_STMT,*this);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- }
- dispose();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OStatement::clearBatch( ) throw(SQLException, RuntimeException)
-{
-
-}
-// -------------------------------------------------------------------------
-
-void OStatement_Base::reset() throw (SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- clearWarnings ();
-
- if (m_xResultSet.get().is())
- {
- clearMyResultSet();
- }
- if(m_aStatementHandle)
- {
- THROW_SQL(N3SQLFreeStmt(m_aStatementHandle, SQL_CLOSE));
- }
-}
-//--------------------------------------------------------------------
-// clearMyResultSet
-// If a ResultSet was created for this Statement, close it
-//--------------------------------------------------------------------
-
-void OStatement_Base::clearMyResultSet () throw (SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- try
- {
- Reference<XCloseable> xCloseable;
- if ( ::comphelper::query_interface( m_xResultSet.get(), xCloseable ) )
- xCloseable->close();
- }
- catch( const DisposedException& ) { }
-
- m_xResultSet = Reference< XResultSet >();
-}
-//--------------------------------------------------------------------
-SQLLEN OStatement_Base::getRowCount () throw( SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- SQLLEN numRows = 0;
-
- try {
- THROW_SQL(N3SQLRowCount(m_aStatementHandle,&numRows));
- }
- catch (const SQLException&)
- {
- }
- return numRows;
-}
-//--------------------------------------------------------------------
-// lockIfNecessary
-// If the given SQL statement contains a 'FOR UPDATE' clause, change
-// the concurrency to lock so that the row can then be updated. Returns
-// true if the concurrency has been changed
-//--------------------------------------------------------------------
-
-sal_Bool OStatement_Base::lockIfNecessary (const ::rtl::OUString& sql) throw( SQLException)
-{
- sal_Bool rc = sal_False;
-
- // First, convert the statement to upper case
-
- ::rtl::OUString sqlStatement = sql.toAsciiUpperCase ();
-
- // Now, look for the FOR UPDATE keywords. If there is any extra white
- // space between the FOR and UPDATE, this will fail.
-
- sal_Int32 index = sqlStatement.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FOR UPDATE")));
-
- // We found it. Change our concurrency level to ensure that the
- // row can be updated.
-
- if (index > 0)
- {
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- try
- {
- SQLINTEGER nLock = SQL_CONCUR_LOCK;
- THROW_SQL(N3SQLSetStmtAttr(m_aStatementHandle, SQL_CONCURRENCY,(SQLPOINTER)(sal_IntPtr)nLock,SQL_IS_UINTEGER));
- }
- catch (const SQLWarning& warn)
- {
- // Catch any warnings and place on the warning stack
- setWarning (warn);
- }
- rc = sal_True;
- }
-
- return rc;
-}
-//--------------------------------------------------------------------
-// setWarning
-// Sets the warning
-//--------------------------------------------------------------------
-
-void OStatement_Base::setWarning (const SQLWarning &ex) throw( SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- m_aLastWarning = ex;
-}
-
-//--------------------------------------------------------------------
-// getColumnCount
-// Return the number of columns in the ResultSet
-//--------------------------------------------------------------------
-
-sal_Int32 OStatement_Base::getColumnCount () throw( SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- sal_Int16 numCols = 0;
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
-
- try {
- THROW_SQL(N3SQLNumResultCols(m_aStatementHandle,&numCols));
- }
- catch (const SQLException&)
- {
- }
- return numCols;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- m_sSqlStatement = sql;
-
-
- ::rtl::OString aSql(::rtl::OUStringToOString(sql,getOwnConnection()->getTextEncoding()));
-
- sal_Bool hasResultSet = sal_False;
- SQLWarning aWarning;
-
- // Reset the statement handle and warning
-
- reset();
-
- // Check for a 'FOR UPDATE' statement. If present, change
- // the concurrency to lock
-
- lockIfNecessary (sql);
-
- // Call SQLExecDirect
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
-
- try {
- THROW_SQL(N3SQLExecDirect(m_aStatementHandle, (SDB_ODBC_CHAR*)aSql.getStr(),aSql.getLength()));
- }
- catch (const SQLWarning& ex) {
-
- // Save pointer to warning and save with ResultSet
- // object once it is created.
-
- aWarning = ex;
- }
-
- // Now determine if there is a result set associated with
- // the SQL statement that was executed. Get the column
- // count, and if it is not zero, there is a result set.
-
- if (getColumnCount () > 0)
- {
- hasResultSet = sal_True;
- }
-
- return hasResultSet;
-}
-//--------------------------------------------------------------------
-// getResultSet
-// getResultSet returns the current result as a ResultSet. It
-// returns NULL if the current result is not a ResultSet.
-//--------------------------------------------------------------------
-Reference< XResultSet > OStatement_Base::getResultSet (sal_Bool checkCount) throw( SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- if (m_xResultSet.get().is()) // if resultset already retrieved,
- {
- // throw exception to avoid sequence error
- ::dbtools::throwFunctionSequenceException(*this,Any());
- }
-
- OResultSet* pRs = NULL;
- sal_Int32 numCols = 1;
-
- // If we already know we have result columns, checkCount
- // is false. This is an optimization to prevent unneeded
- // calls to getColumnCount
-
- if (checkCount)
- numCols = getColumnCount ();
-
- // Only return a result set if there are result columns
-
- if (numCols > 0)
- {
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- pRs = createResulSet();
- pRs->construct();
-
- // Save a copy of our last result set
- // Changed to save copy at getResultSet.
- //m_xResultSet = rs;
- }
- else
- clearMyResultSet ();
-
- return pRs;
-}
-//--------------------------------------------------------------------
-// getStmtOption
-// Invoke SQLGetStmtOption with the given option.
-//--------------------------------------------------------------------
-
-sal_Int32 OStatement_Base::getStmtOption (short fOption) const
-{
- sal_Int32 result = 0;
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- N3SQLGetStmtAttr(m_aStatementHandle, fOption,&result,SQL_IS_INTEGER,NULL);
- return result;
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- Reference< XResultSet > xRS = NULL;
-
- // Execute the statement. If execute returns true, a result
- // set exists.
-
- if (execute (sql))
- {
- xRS = getResultSet (sal_False);
- m_xResultSet = xRS;
- }
- else
- {
- // No ResultSet was produced. Raise an exception
- m_pConnection->throwGenericSQLException(STR_NO_RESULTSET,*this);
- }
- return xRS;
-}
-// -------------------------------------------------------------------------
-
-Reference< XConnection > SAL_CALL OStatement_Base::getConnection( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- return (Reference< XConnection >)m_pConnection;
-}
-// -------------------------------------------------------------------------
-
-Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this));
- return aRet.hasValue() ? aRet : OStatement_Base::queryInterface(rType);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OStatement::addBatch( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- m_aBatchList.push_back(sql);
-}
-// -------------------------------------------------------------------------
-Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- ::rtl::OString aBatchSql;
- sal_Int32 nLen = 0;
- for(::std::list< ::rtl::OUString>::const_iterator i=m_aBatchList.begin();i != m_aBatchList.end();++i,++nLen)
- {
- aBatchSql += ::rtl::OUStringToOString(*i,getOwnConnection()->getTextEncoding());
- aBatchSql += ";";
- }
-
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- THROW_SQL(N3SQLExecDirect(m_aStatementHandle, (SDB_ODBC_CHAR*)aBatchSql.getStr(),aBatchSql.getLength()));
-
- Sequence< sal_Int32 > aRet(nLen);
- sal_Int32* pArray = aRet.getArray();
- for(sal_Int32 j=0;j<nLen;++j)
- {
- SQLRETURN nError = N3SQLMoreResults(m_aStatementHandle);
- if(nError == SQL_SUCCESS)
- {
- SQLLEN nRowCount=0;
- N3SQLRowCount(m_aStatementHandle,&nRowCount);
- pArray[j] = nRowCount;
- }
- }
- return aRet;
-}
-// -------------------------------------------------------------------------
-
-
-sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- sal_Int32 numRows = -1;
-
- // Execute the statement. If execute returns false, a
- // row count exists.
-
- if (!execute (sql)) {
- numRows = getUpdateCount();
- }
- else {
-
- // No update count was produced (a ResultSet was). Raise
- // an exception
-
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(STR_NO_ROWCOUNT));
- throw SQLException (sError, *this,::rtl::OUString(),0,Any());
- }
- return numRows;
-
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- m_xResultSet = getResultSet(sal_True);
- return m_xResultSet;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OStatement_Base::getUpdateCount( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- sal_Int32 rowCount = -1;
-
- // Only return a row count for SQL statements that did not
- // return a result set.
-
- if (getColumnCount () == 0)
- rowCount = getRowCount ();
-
- return rowCount;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OStatement_Base::getMoreResults( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- SQLWarning warning;
- sal_Bool hasResultSet = sal_False;
-
- // clear previous warnings
-
- clearWarnings ();
-
- // Call SQLMoreResults
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
-
- try {
- hasResultSet = N3SQLMoreResults(m_aStatementHandle) == SQL_SUCCESS;
- }
- catch (const SQLWarning &ex) {
-
- // Save pointer to warning and save with ResultSet
- // object once it is created.
-
- warning = ex;
- }
-
- // There are more results (it may not be a result set, though)
-
- if (hasResultSet)
- {
-
- // Now determine if there is a result set associated
- // with the SQL statement that was executed. Get the
- // column count, and if it is zero, there is not a
- // result set.
-
- if (getColumnCount () == 0)
- hasResultSet = sal_False;
- }
-
- // Set the warning for the statement, if one was generated
-
- setWarning (warning);
-
- // Return the result set indicator
-
- return hasResultSet;
-}
-// -------------------------------------------------------------------------
-
-// -------------------------------------------------------------------------
-Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- return makeAny(m_aLastWarning);
-}
-// -------------------------------------------------------------------------
-
-// -------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- m_aLastWarning = SQLWarning();
-}
-// -------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-sal_Int32 OStatement_Base::getQueryTimeOut() const
-{
- return getStmtOption(SQL_ATTR_QUERY_TIMEOUT);
-}
-//------------------------------------------------------------------------------
-sal_Int32 OStatement_Base::getMaxRows() const
-{
- return getStmtOption(SQL_ATTR_MAX_ROWS);
-}
-//------------------------------------------------------------------------------
-sal_Int32 OStatement_Base::getResultSetConcurrency() const
-{
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- sal_uInt32 nValue;
- SQLRETURN nRetCode = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CONCURRENCY,&nValue,SQL_IS_UINTEGER,0);
- OSL_UNUSED( nRetCode );
- if(nValue == SQL_CONCUR_READ_ONLY)
- nValue = ResultSetConcurrency::READ_ONLY;
- else
- nValue = ResultSetConcurrency::UPDATABLE;
- return nValue;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OStatement_Base::getResultSetType() const
-{
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- sal_uInt32 nValue = SQL_CURSOR_FORWARD_ONLY;
- SQLRETURN nRetCode = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_SENSITIVITY,&nValue,SQL_IS_UINTEGER,0);
- nRetCode = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,&nValue,SQL_IS_UINTEGER,0);
- OSL_UNUSED( nRetCode );
- switch(nValue)
- {
- case SQL_CURSOR_FORWARD_ONLY:
- nValue = ResultSetType::FORWARD_ONLY;
- break;
- case SQL_CURSOR_KEYSET_DRIVEN:
- case SQL_CURSOR_STATIC:
- nValue = ResultSetType::SCROLL_INSENSITIVE;
- break;
- case SQL_CURSOR_DYNAMIC:
- nValue = ResultSetType::SCROLL_SENSITIVE;
- break;
- }
-
- return nValue;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OStatement_Base::getFetchDirection() const
-{
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- sal_uInt32 nValue = 0;
- SQLRETURN nRetCode = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_SCROLLABLE,&nValue,SQL_IS_UINTEGER,0);
- OSL_UNUSED( nRetCode );
-
- switch(nValue)
- {
- case SQL_SCROLLABLE:
- nValue = FetchDirection::REVERSE;
- break;
- default:
- nValue = FetchDirection::FORWARD;
- break;
- }
-
- return nValue;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OStatement_Base::getFetchSize() const
-{
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- sal_uInt32 nValue;
- SQLRETURN nRetCode = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,&nValue,SQL_IS_UINTEGER,0);
- OSL_UNUSED( nRetCode );
- return nValue;
-}
-//------------------------------------------------------------------------------
-sal_Int32 OStatement_Base::getMaxFieldSize() const
-{
- return getStmtOption(SQL_ATTR_MAX_LENGTH);
-}
-//------------------------------------------------------------------------------
-::rtl::OUString OStatement_Base::getCursorName() const
-{
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- SQLCHAR pName[258];
- SQLSMALLINT nRealLen = 0;
- SQLRETURN nRetCode = N3SQLGetCursorName(m_aStatementHandle,(SQLCHAR*)pName,256,&nRealLen);
- OSL_UNUSED( nRetCode );
- return ::rtl::OUString::createFromAscii((const char*)pName);
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setQueryTimeOut(sal_Int32 seconds)
-{
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_QUERY_TIMEOUT,(SQLPOINTER)(sal_IntPtr)seconds,SQL_IS_UINTEGER);
- OSL_UNUSED( nRetCode );
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setMaxRows(sal_Int32 _par0)
-{
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_MAX_ROWS, (SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
- OSL_UNUSED( nRetCode );
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setResultSetConcurrency(sal_Int32 _par0)
-{
- SQLINTEGER nSet;
- if(_par0 == ResultSetConcurrency::READ_ONLY)
- nSet = SQL_CONCUR_READ_ONLY;
- else
- nSet = SQL_CONCUR_VALUES;
-
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CONCURRENCY,(SQLPOINTER)(sal_IntPtr)nSet,SQL_IS_UINTEGER);
-
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setResultSetType(sal_Int32 _par0)
-{
-
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_ROW_BIND_TYPE,(SQLPOINTER)SQL_BIND_BY_COLUMN,SQL_IS_UINTEGER);
- OSL_UNUSED( nRetCode );
-
- sal_Bool bUseBookmark = isUsingBookmarks();
- SQLUINTEGER nSet( SQL_UNSPECIFIED );
- switch(_par0)
- {
- case ResultSetType::FORWARD_ONLY:
- nSet = SQL_UNSPECIFIED;
- break;
- case ResultSetType::SCROLL_INSENSITIVE:
- nSet = SQL_INSENSITIVE;
- N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)SQL_CURSOR_KEYSET_DRIVEN,SQL_IS_UINTEGER);
- break;
- case ResultSetType::SCROLL_SENSITIVE:
- if(bUseBookmark)
- {
- SQLUINTEGER nCurProp = getCursorProperties(SQL_CURSOR_DYNAMIC,sal_True);
- if((nCurProp & SQL_CA1_BOOKMARK) != SQL_CA1_BOOKMARK) // check if bookmark for this type isn't supported
- { // we have to test the next one
- nCurProp = getCursorProperties(SQL_CURSOR_KEYSET_DRIVEN,sal_True);
- sal_Bool bNotBookmarks = ((nCurProp & SQL_CA1_BOOKMARK) != SQL_CA1_BOOKMARK);
- nCurProp = getCursorProperties(SQL_CURSOR_KEYSET_DRIVEN,sal_False);
- nSet = SQL_CURSOR_KEYSET_DRIVEN;
- if( bNotBookmarks ||
- ((nCurProp & SQL_CA2_SENSITIVITY_DELETIONS) != SQL_CA2_SENSITIVITY_DELETIONS) ||
- ((nCurProp & SQL_CA2_SENSITIVITY_ADDITIONS) != SQL_CA2_SENSITIVITY_ADDITIONS))
- {
- // bookmarks for keyset isn't supported so reset bookmark setting
- setUsingBookmarks(sal_False);
- nSet = SQL_CURSOR_DYNAMIC;
- }
- }
- else
- nSet = SQL_CURSOR_DYNAMIC;
- }
- else
- nSet = SQL_CURSOR_DYNAMIC;
- if(N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)(sal_uIntPtr)nSet,SQL_IS_UINTEGER) != SQL_SUCCESS)
- {
- nSet = SQL_CURSOR_KEYSET_DRIVEN;
- N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)(sal_uIntPtr)nSet,SQL_IS_UINTEGER);
- }
- nSet = SQL_SENSITIVE;
- break;
- default:
- OSL_FAIL( "OStatement_Base::setResultSetType: invalid result set type!" );
- break;
- }
-
-
- N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CURSOR_SENSITIVITY,(SQLPOINTER)(sal_uIntPtr)nSet,SQL_IS_UINTEGER);
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setEscapeProcessing( const sal_Bool _bEscapeProc )
-{
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- SQLUINTEGER nEscapeProc( _bEscapeProc ? SQL_NOSCAN_OFF : SQL_NOSCAN_ON );
- SQLRETURN nRetCode = N3SQLSetStmtAttr( m_aStatementHandle, SQL_ATTR_NOSCAN, (SQLPOINTER)(sal_uIntPtr)nEscapeProc, SQL_IS_UINTEGER );
- (void)nRetCode;
-}
-
-//------------------------------------------------------------------------------
-void OStatement_Base::setFetchDirection(sal_Int32 _par0)
-{
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- sal_IntPtr nCursType = 0;
- SQLRETURN nRetCode = SQL_SUCCESS;
- if(_par0 == FetchDirection::FORWARD)
- {
- nCursType = SQL_NONSCROLLABLE;
- nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_SCROLLABLE,(SQLPOINTER)nCursType,SQL_IS_UINTEGER);
- }
- else if(_par0 == FetchDirection::REVERSE)
- {
- nCursType = SQL_SCROLLABLE;
- nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_SCROLLABLE,(SQLPOINTER)nCursType,SQL_IS_UINTEGER);
- }
- OSL_UNUSED( nRetCode );
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setFetchSize(sal_Int32 _par0)
-{
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- OSL_ENSURE(_par0>0,"Illegal fetch size!");
- if ( _par0 > 0 )
- {
- SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
-
- delete m_pRowStatusArray;
- m_pRowStatusArray = new SQLUSMALLINT[_par0];
- nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER);
- OSL_UNUSED( nRetCode );
- }
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setMaxFieldSize(sal_Int32 _par0)
-{
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_MAX_LENGTH,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER);
-}
-//------------------------------------------------------------------------------
-void OStatement_Base::setCursorName(const ::rtl::OUString &_par0)
-{
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- ::rtl::OString aName(::rtl::OUStringToOString(_par0,getOwnConnection()->getTextEncoding()));
- N3SQLSetCursorName(m_aStatementHandle,(SDB_ODBC_CHAR*)aName.getStr(),(SQLSMALLINT)aName.getLength());
-}
-// -------------------------------------------------------------------------
-sal_Bool OStatement_Base::isUsingBookmarks() const
-{
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- sal_uInt32 nValue = SQL_UB_OFF;
- SQLRETURN nRetCode = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_USE_BOOKMARKS,&nValue,SQL_IS_UINTEGER,NULL);
- OSL_UNUSED( nRetCode );
- return nValue != SQL_UB_OFF;
-}
-// -------------------------------------------------------------------------
-sal_Bool OStatement_Base::getEscapeProcessing() const
-{
- OSL_ENSURE( m_aStatementHandle, "StatementHandle is null!" );
- sal_uInt32 nValue = SQL_NOSCAN_OFF;
- SQLRETURN nRetCode = N3SQLGetStmtAttr( m_aStatementHandle, SQL_ATTR_NOSCAN, &nValue, SQL_IS_UINTEGER, NULL );
- (void)nRetCode;
- return nValue == SQL_NOSCAN_OFF;
-}
-// -------------------------------------------------------------------------
-void OStatement_Base::setUsingBookmarks(sal_Bool _bUseBookmark)
-{
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- sal_uIntPtr nValue = _bUseBookmark ? SQL_UB_VARIABLE : SQL_UB_OFF;
- SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_USE_BOOKMARKS,(SQLPOINTER)nValue,SQL_IS_UINTEGER);
- OSL_UNUSED( nRetCode );
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const
-{
- Sequence< Property > aProps(10);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP0(CURSORNAME, ::rtl::OUString);
- DECL_BOOL_PROP0(ESCAPEPROCESSING);
- DECL_PROP0(FETCHDIRECTION,sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP0(MAXFIELDSIZE,sal_Int32);
- DECL_PROP0(MAXROWS, sal_Int32);
- DECL_PROP0(QUERYTIMEOUT,sal_Int32);
- DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32);
- DECL_PROP0(RESULTSETTYPE,sal_Int32);
- DECL_BOOL_PROP0(USEBOOKMARKS);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper()
-{
- return *const_cast<OStatement_Base*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool OStatement_Base::convertFastPropertyValue(
- Any & rConvertedValue,
- Any & rOldValue,
- sal_Int32 nHandle,
- const Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- sal_Bool bConverted = sal_False;
- try
- {
- switch(nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getQueryTimeOut());
- break;
-
- case PROPERTY_ID_MAXFIELDSIZE:
- bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxFieldSize());
- break;
-
- case PROPERTY_ID_MAXROWS:
- bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxRows());
- break;
-
- case PROPERTY_ID_CURSORNAME:
- bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getCursorName());
- break;
-
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetConcurrency());
- break;
-
- case PROPERTY_ID_RESULTSETTYPE:
- bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetType());
- break;
-
- case PROPERTY_ID_FETCHDIRECTION:
- bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection());
- break;
-
- case PROPERTY_ID_FETCHSIZE:
- bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize());
- break;
-
- case PROPERTY_ID_USEBOOKMARKS:
- bConverted = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, isUsingBookmarks());
- break;
-
- case PROPERTY_ID_ESCAPEPROCESSING:
- bConverted = ::comphelper::tryPropertyValue( rConvertedValue, rOldValue, rValue, getEscapeProcessing() );
- break;
-
- }
- }
- catch(const SQLException&)
- {
- // throw Exception(e.Message,*this);
- }
- return bConverted;
-}
-// -------------------------------------------------------------------------
-void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
-{
- try
- {
- switch(nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- setQueryTimeOut(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_MAXFIELDSIZE:
- setMaxFieldSize(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_MAXROWS:
- setMaxRows(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_CURSORNAME:
- setCursorName(comphelper::getString(rValue));
- break;
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- setResultSetConcurrency(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- setResultSetType(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- setFetchDirection(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_FETCHSIZE:
- setFetchSize(comphelper::getINT32(rValue));
- break;
- case PROPERTY_ID_USEBOOKMARKS:
- setUsingBookmarks(comphelper::getBOOL(rValue));
- break;
- case PROPERTY_ID_ESCAPEPROCESSING:
- setEscapeProcessing( ::comphelper::getBOOL( rValue ) );
- break;
- default:
- OSL_FAIL( "OStatement_Base::setFastPropertyValue_NoBroadcast: what property?" );
- break;
- }
- }
- catch(const SQLException& )
- {
- // throw Exception(e.Message,*this);
- }
-}
-// -------------------------------------------------------------------------
-void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
-{
- switch(nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- rValue <<= getQueryTimeOut();
- break;
- case PROPERTY_ID_MAXFIELDSIZE:
- rValue <<= getMaxFieldSize();
- break;
- case PROPERTY_ID_MAXROWS:
- rValue <<= getMaxRows();
- break;
- case PROPERTY_ID_CURSORNAME:
- rValue <<= getCursorName();
- break;
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- rValue <<= getResultSetConcurrency();
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- rValue <<= getResultSetType();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- rValue <<= getFetchDirection();
- break;
- case PROPERTY_ID_FETCHSIZE:
- rValue <<= getFetchSize();
- break;
- case PROPERTY_ID_USEBOOKMARKS:
- rValue <<= isUsingBookmarks();
- break;
- case PROPERTY_ID_ESCAPEPROCESSING:
- rValue <<= getEscapeProcessing();
- break;
- default:
- OSL_FAIL( "OStatement_Base::getFastPropertyValue: what property?" );
- break;
- }
-}
-// -------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement");
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::acquire() throw()
-{
- OStatement_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::release() throw()
-{
- OStatement_BASE::release();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement::acquire() throw()
-{
- OStatement_BASE2::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement::release() throw()
-{
- OStatement_BASE2::release();
-}
-// -----------------------------------------------------------------------------
-OResultSet* OStatement_Base::createResulSet()
-{
- return new OResultSet(m_aStatementHandle,this);
-}
-// -----------------------------------------------------------------------------
-Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-SQLUINTEGER OStatement_Base::getCursorProperties(SQLINTEGER _nCursorType,sal_Bool bFirst)
-{
- SQLUINTEGER nValueLen = 0;
- try
- {
- SQLUSMALLINT nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
- if(SQL_CURSOR_KEYSET_DRIVEN == _nCursorType)
- nAskFor = bFirst ? SQL_KEYSET_CURSOR_ATTRIBUTES1 : SQL_KEYSET_CURSOR_ATTRIBUTES2;
- else if(SQL_CURSOR_STATIC == _nCursorType)
- nAskFor = bFirst ? SQL_STATIC_CURSOR_ATTRIBUTES1 : SQL_STATIC_CURSOR_ATTRIBUTES2;
- else if(SQL_CURSOR_FORWARD_ONLY == _nCursorType)
- nAskFor = bFirst ? SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1 : SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
- else if(SQL_CURSOR_DYNAMIC == _nCursorType)
- nAskFor = bFirst ? SQL_DYNAMIC_CURSOR_ATTRIBUTES1 : SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
-
-
- OTools::GetInfo(getOwnConnection(),getConnectionHandle(),nAskFor,nValueLen,NULL);
- }
- catch(const Exception&)
- { // we don't want our result destroy here
- nValueLen = 0;
- }
- return nValueLen;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/OTools.cxx b/connectivity/source/drivers/odbcbase/OTools.cxx
deleted file mode 100644
index 8c816a5fb6..0000000000
--- a/connectivity/source/drivers/odbcbase/OTools.cxx
+++ /dev/null
@@ -1,908 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "odbc/OTools.hxx"
-#include "odbc/OFunctions.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <osl/diagnose.h>
-#include "odbc/OConnection.hxx"
-#include "diagnose_ex.h"
-#include <rtl/logfile.hxx>
-#include <rtl/ustrbuf.hxx>
-
-
-#include <string.h>
-#include <string>
-#include <algorithm>
-
-using namespace connectivity::odbc;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::util;
-
-void OTools::getValue( OConnection* _pConnection,
- SQLHANDLE _aStatementHandle,
- sal_Int32 columnIndex,
- SQLSMALLINT _nType,
- sal_Bool &_bWasNull,
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
- void* _pValue,
- SQLLEN _nSize) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::getValue" );
- SQLLEN pcbValue = SQL_NULL_DATA;
- OTools::ThrowException(_pConnection,
- (*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle,
- (SQLUSMALLINT)columnIndex,
- _nType,
- _pValue,
- _nSize,
- &pcbValue),
- _aStatementHandle,SQL_HANDLE_STMT,_xInterface,sal_False);
- _bWasNull = pcbValue == SQL_NULL_DATA;
-}
-// -----------------------------------------------------------------------------
-void OTools::bindParameter( OConnection* _pConnection,
- SQLHANDLE _hStmt,
- sal_Int32 nPos,
- sal_Int8*& pDataBuffer,
- sal_Int8* pLenBuffer,
- SQLSMALLINT _nODBCtype,
- sal_Bool _bUseWChar,
- sal_Bool _bUseOldTimeDate,
- const void* _pValue,
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
- rtl_TextEncoding _nTextEncoding)
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::bindParameter" );
- SQLRETURN nRetcode;
- SQLSMALLINT fSqlType;
- SQLSMALLINT fCType;
- SQLLEN nMaxLen = 0;
- SQLLEN* pLen = (SQLLEN*)pLenBuffer;
- SQLULEN nColumnSize=0;
- SQLSMALLINT nDecimalDigits=0;
-
- OTools::getBindTypes(_bUseWChar,_bUseOldTimeDate,_nODBCtype,fCType,fSqlType);
-
- OTools::bindData(_nODBCtype,_bUseWChar,pDataBuffer,pLen,_pValue,_nTextEncoding,nColumnSize);
- if ((nColumnSize == 0) && (fSqlType == SQL_CHAR || fSqlType == SQL_VARCHAR || fSqlType == SQL_LONGVARCHAR))
- nColumnSize = 1;
-
- if(fSqlType == SQL_LONGVARCHAR || fSqlType == SQL_LONGVARBINARY)
- memcpy(pDataBuffer,&nPos,sizeof(nPos));
-
- nRetcode = (*(T3SQLBindParameter)_pConnection->getOdbcFunction(ODBC3SQLBindParameter))(_hStmt,
- (SQLUSMALLINT)nPos,
- SQL_PARAM_INPUT,
- fCType,
- fSqlType,
- nColumnSize,
- nDecimalDigits,
- pDataBuffer,
- nMaxLen,
- pLen);
-
- OTools::ThrowException(_pConnection,nRetcode,_hStmt,SQL_HANDLE_STMT,_xInterface);
-}
-// -----------------------------------------------------------------------------
-void OTools::bindData( SQLSMALLINT _nOdbcType,
- sal_Bool _bUseWChar,
- sal_Int8 *&_pData,
- SQLLEN*& pLen,
- const void* _pValue,
- rtl_TextEncoding _nTextEncoding,
- SQLULEN& _nColumnSize)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::bindData" );
- _nColumnSize = 0;
-
- switch (_nOdbcType)
- {
- case SQL_CHAR:
- case SQL_VARCHAR:
- case SQL_DECIMAL:
- if(_bUseWChar)
- {
- *pLen = SQL_NTS;
- ::rtl::OUString sStr(*(::rtl::OUString*)_pValue);
- _nColumnSize = sStr.getLength();
- *((rtl::OUString*)_pData) = sStr;
-
- // Pointer on Char*
- _pData = (sal_Int8*)((rtl::OUString*)_pData)->getStr();
- }
- else
- {
- ::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,_nTextEncoding));
- *pLen = SQL_NTS;
- _nColumnSize = aString.getLength();
- memcpy(_pData,aString.getStr(),aString.getLength());
- ((sal_Int8*)_pData)[aString.getLength()] = '\0';
- }
- break;
-
- case SQL_BIGINT:
- *((sal_Int64*)_pData) = *(sal_Int64*)_pValue;
- *pLen = sizeof(sal_Int64);
- _nColumnSize = *pLen;
- break;
-
- case SQL_NUMERIC:
- if(_bUseWChar)
- {
- ::rtl::OUString aString = rtl::OUString::valueOf(*(double*)_pValue);
- _nColumnSize = aString.getLength();
- *pLen = _nColumnSize;
- *((rtl::OUString*)_pData) = aString;
- // Pointer on Char*
- _pData = (sal_Int8*)((rtl::OUString*)_pData)->getStr();
- }
- else
- {
- ::rtl::OString aString = ::rtl::OString::valueOf(*(double*)_pValue);
- _nColumnSize = aString.getLength();
- *pLen = _nColumnSize;
- memcpy(_pData,aString.getStr(),aString.getLength());
- ((sal_Int8*)_pData)[_nColumnSize] = '\0';
- } break;
- case SQL_BIT:
- case SQL_TINYINT:
- *((sal_Int8*)_pData) = *(sal_Int8*)_pValue;
- *pLen = sizeof(sal_Int8);
- break;
-
- case SQL_SMALLINT:
- *((sal_Int16*)_pData) = *(sal_Int16*)_pValue;
- *pLen = sizeof(sal_Int16);
- break;
- case SQL_INTEGER:
- *((sal_Int32*)_pData) = *(sal_Int32*)_pValue;
- *pLen = sizeof(sal_Int32);
- break;
- case SQL_FLOAT:
- *((float*)_pData) = *(float*)_pValue;
- *pLen = sizeof(float);
- break;
- case SQL_REAL:
- case SQL_DOUBLE:
- *((double*)_pData) = *(double*)_pValue;
- *pLen = sizeof(double);
- break;
- case SQL_BINARY:
- case SQL_VARBINARY:
- {
- const ::com::sun::star::uno::Sequence< sal_Int8 >* pSeq = static_cast< const ::com::sun::star::uno::Sequence< sal_Int8 >* >(_pValue);
- OSL_ENSURE(pSeq,"OTools::bindData: Sequence is null!");
-
- if(pSeq)
- {
- _pData = (sal_Int8*)pSeq->getConstArray();
- *pLen = pSeq->getLength();
- }
- }
- break;
- case SQL_LONGVARBINARY:
- {
- sal_Int32 nLen = 0;
- nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength();
- *pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen);
- }
- break;
- case SQL_LONGVARCHAR:
- {
- sal_Int32 nLen = 0;
- if(_bUseWChar)
- nLen = sizeof(sal_Unicode) * ((::rtl::OUString*)_pValue)->getLength();
- else
- {
- ::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,_nTextEncoding));
- nLen = aString.getLength();
- }
- *pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen);
- } break;
- case SQL_DATE:
- *(DATE_STRUCT*)_pData = *(DATE_STRUCT*)_pValue;
- *pLen = (SQLLEN)sizeof(DATE_STRUCT);
- _nColumnSize = 10;
- break;
- case SQL_TIME:
- *(TIME_STRUCT*)_pData = *(TIME_STRUCT*)_pValue;
- *pLen = (SQLLEN)sizeof(TIME_STRUCT);
- _nColumnSize = 8;
- break;
- case SQL_TIMESTAMP:
- *(TIMESTAMP_STRUCT*)_pData = *(TIMESTAMP_STRUCT*)_pValue;
- *pLen = (SQLLEN)sizeof(TIMESTAMP_STRUCT);
- _nColumnSize = 19;
- break;
- }
-}
-// -------------------------------------------------------------------------
-void OTools::bindValue( OConnection* _pConnection,
- SQLHANDLE _aStatementHandle,
- sal_Int32 columnIndex,
- SQLSMALLINT _nType,
- SQLSMALLINT _nMaxLen,
- const void* _pValue,
- void* _pData,
- SQLLEN *pLen,
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
- rtl_TextEncoding _nTextEncoding,
- sal_Bool _bUseOldTimeDate) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::bindValue" );
- SQLRETURN nRetcode;
- SQLSMALLINT fSqlType;
- SQLSMALLINT fCType;
- SQLLEN nMaxLen = _nMaxLen;
-
- OTools::getBindTypes( sal_False,
- _bUseOldTimeDate,
- _nType,
- fCType,
- fSqlType);
-
- if (columnIndex != 0 && !_pValue)
- {
- *pLen = SQL_NULL_DATA;
- nRetcode = (*(T3SQLBindCol)_pConnection->getOdbcFunction(ODBC3SQLBindCol))(_aStatementHandle,
- (SQLUSMALLINT)columnIndex,
- fCType,
- _pData,
- nMaxLen,
- pLen
- );
- }
- else
- {
- try
- {
- switch (_nType)
- {
- case SQL_CHAR:
- case SQL_VARCHAR:
- {
- ::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,_nTextEncoding));
- *pLen = SQL_NTS;
- *((::rtl::OString*)_pData) = aString;
- _nMaxLen = (SQLSMALLINT)aString.getLength();
-
- // Pointer on Char*
- _pData = (void*)aString.getStr();
- } break;
- case SQL_BIGINT:
- *((sal_Int64*)_pData) = *(sal_Int64*)_pValue;
- *pLen = sizeof(sal_Int64);
- break;
- case SQL_DECIMAL:
- case SQL_NUMERIC:
- {
- ::rtl::OString aString = ::rtl::OString::valueOf(*(double*)_pValue);
- _nMaxLen = (SQLSMALLINT)aString.getLength();
- *pLen = _nMaxLen;
- *((::rtl::OString*)_pData) = aString;
- // Pointer on Char*
- _pData = (void*)((::rtl::OString*)_pData)->getStr();
- } break;
- case SQL_BIT:
- case SQL_TINYINT:
- *((sal_Int8*)_pData) = *(sal_Int8*)_pValue;
- *pLen = sizeof(sal_Int8);
- break;
-
- case SQL_SMALLINT:
- *((sal_Int16*)_pData) = *(sal_Int16*)_pValue;
- *pLen = sizeof(sal_Int16);
- break;
- case SQL_INTEGER:
- *((sal_Int32*)_pData) = *(sal_Int32*)_pValue;
- *pLen = sizeof(sal_Int32);
- break;
- case SQL_FLOAT:
- *((float*)_pData) = *(float*)_pValue;
- *pLen = sizeof(float);
- break;
- case SQL_REAL:
- case SQL_DOUBLE:
- *((double*)_pData) = *(double*)_pValue;
- *pLen = sizeof(double);
- break;
- case SQL_BINARY:
- case SQL_VARBINARY:
- {
- _pData = (void*)((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getConstArray();
- *pLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength();
- } break;
- case SQL_LONGVARBINARY:
- {
- _pData = (void*)(sal_IntPtr)(columnIndex);
- sal_Int32 nLen = 0;
- nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength();
- *pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen);
- }
- break;
- case SQL_LONGVARCHAR:
- {
- _pData = (void*)(sal_IntPtr)(columnIndex);
- sal_Int32 nLen = 0;
- nLen = ((::rtl::OUString*)_pValue)->getLength();
- *pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen);
- } break;
- case SQL_DATE:
- *pLen = sizeof(DATE_STRUCT);
- *((DATE_STRUCT*)_pData) = *(DATE_STRUCT*)_pValue;
- break;
- case SQL_TIME:
- *pLen = sizeof(TIME_STRUCT);
- *((TIME_STRUCT*)_pData) = *(TIME_STRUCT*)_pValue;
- break;
- case SQL_TIMESTAMP:
- *pLen = sizeof(TIMESTAMP_STRUCT);
- *((TIMESTAMP_STRUCT*)_pData) = *(TIMESTAMP_STRUCT*)_pValue;
- break;
- }
- }
- catch ( ... )
- {
- }
-
- nRetcode = (*(T3SQLBindCol)_pConnection->getOdbcFunction(ODBC3SQLBindCol))(_aStatementHandle,
- (SQLUSMALLINT)columnIndex,
- fCType,
- _pData,
- nMaxLen,
- pLen
- );
- }
-
- OTools::ThrowException(_pConnection,nRetcode,_aStatementHandle,SQL_HANDLE_STMT,_xInterface);
-}
-// -----------------------------------------------------------------------------
-void OTools::ThrowException(OConnection* _pConnection,
- SQLRETURN _rRetCode,
- SQLHANDLE _pContext,
- SQLSMALLINT _nHandleType,
- const Reference< XInterface >& _xInterface,
- sal_Bool _bNoFound,
- rtl_TextEncoding _nTextEncoding) throw(SQLException)
-{
- switch(_rRetCode)
- {
- case SQL_NEED_DATA:
- case SQL_STILL_EXECUTING:
- case SQL_SUCCESS:
-
- case SQL_SUCCESS_WITH_INFO:
- return;
- case SQL_NO_DATA_FOUND:
- if(_bNoFound)
- return; // no need to throw a exception
- case SQL_ERROR: break;
-
-
- case SQL_INVALID_HANDLE: OSL_FAIL("SdbODBC3_SetStatus: SQL_INVALID_HANDLE");
- throw SQLException();
- }
-
- // Additional Information on the latest ODBC-functioncall available
- // SQLError provides this Information.
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::ThrowException" );
-
- SDB_ODBC_CHAR szSqlState[5];
- SQLINTEGER pfNativeError;
- SDB_ODBC_CHAR szErrorMessage[SQL_MAX_MESSAGE_LENGTH];
- szErrorMessage[0] = '\0';
- SQLSMALLINT pcbErrorMsg = 0;
-
- // Information for latest operation:
- // when hstmt != SQL_NULL_HSTMT is (Used from SetStatus in SdbCursor, SdbTable, ...),
- // then the status of the latest statments will be fetched, without the Status of the last
- // Statments of this connection [what in this case will probably be the same, but the Reference
- // Manual isn't totally clear in this...].
- // corresponding for hdbc.
- SQLRETURN n = (*(T3SQLGetDiagRec)_pConnection->getOdbcFunction(ODBC3SQLGetDiagRec))(_nHandleType,_pContext,1,
- szSqlState,
- &pfNativeError,
- szErrorMessage,sizeof szErrorMessage - 1,&pcbErrorMsg);
- OSL_UNUSED( n );
- OSL_ENSURE(n != SQL_INVALID_HANDLE,"SdbODBC3_SetStatus: SQLError returned SQL_INVALID_HANDLE");
- OSL_ENSURE(n == SQL_SUCCESS || n == SQL_SUCCESS_WITH_INFO || n == SQL_NO_DATA_FOUND || n == SQL_ERROR,"SdbODBC3_SetStatus: SQLError failed");
-
- // For the Return Code of SQLError see ODBC 2.0 Programmer's Reference Page 287ff
- throw SQLException( ::rtl::OUString((char *)szErrorMessage,pcbErrorMsg,_nTextEncoding),
- _xInterface,
- ::rtl::OUString((char *)szSqlState,5,_nTextEncoding),
- pfNativeError,
- Any()
- );
-
-}
-// -------------------------------------------------------------------------
-Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
- SQLHANDLE _aStatementHandle,
- sal_Int32 columnIndex,
- SQLSMALLINT _fSqlType,
- sal_Bool &_bWasNull,
- const Reference< XInterface >& _xInterface) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::getBytesValue" );
- char aCharArray[2048];
- // First try to fetch the data with the little Buffer:
- SQLLEN nMaxLen = sizeof aCharArray - 1;
- // GETDATA(SQL_C_CHAR,aCharArray,nMaxLen);
- SQLLEN pcbValue = 0;
- OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle,
- (SQLUSMALLINT)columnIndex,
- _fSqlType,
- (SQLPOINTER)aCharArray,
- nMaxLen,
- &pcbValue),
- _aStatementHandle,SQL_HANDLE_STMT,_xInterface);
-
- _bWasNull = pcbValue == SQL_NULL_DATA;
- if(_bWasNull)
- return Sequence<sal_Int8>();
-
- SQLINTEGER nBytes = pcbValue != SQL_NO_TOTAL ? std::min(pcbValue, nMaxLen) : nMaxLen;
- if ( ((pcbValue == SQL_NO_TOTAL) || pcbValue > nMaxLen) && aCharArray[nBytes-1] == 0 && nBytes > 0 )
- --nBytes;
- Sequence<sal_Int8> aData((sal_Int8*)aCharArray, nBytes);
-
- // It is about Binariy Data, a String, that for StarView is to long or
- // the driver kan't predict the length of the data - as well as save the
- // MemoryStream.
- while ((pcbValue == SQL_NO_TOTAL) || pcbValue > nMaxLen)
- {
- // At Strings the Buffer won't be completly used
- // (The last Byte is always a NULL-Byte, however it won't be counted with pcbValue)
- if (pcbValue != SQL_NO_TOTAL && (pcbValue - nMaxLen) < nMaxLen)
- nBytes = pcbValue - nMaxLen;
- else
- nBytes = nMaxLen;
-
- // While there is a "truncation"-Warning, proceed with fetching Data.
- OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle,
- (SQLUSMALLINT)columnIndex,
- SQL_C_BINARY,
- &aCharArray,
- (SQLINTEGER)nBytes,
- &pcbValue),
- _aStatementHandle,SQL_HANDLE_STMT,_xInterface);
- sal_Int32 nLen = aData.getLength();
- aData.realloc(nLen + nBytes);
- memcpy(aData.getArray() + nLen, aCharArray, nBytes);
- }
- return aData;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString OTools::getStringValue(OConnection* _pConnection,
- SQLHANDLE _aStatementHandle,
- sal_Int32 columnIndex,
- SQLSMALLINT _fSqlType,
- sal_Bool &_bWasNull,
- const Reference< XInterface >& _xInterface,
- rtl_TextEncoding _nTextEncoding) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::getStringValue" );
- ::rtl::OUStringBuffer aData;
- switch(_fSqlType)
- {
- case SQL_WVARCHAR:
- case SQL_WCHAR:
- case SQL_WLONGVARCHAR:
- {
- sal_Unicode waCharArray[2048];
- // read the unicode data
- SQLLEN nMaxLen = (sizeof(waCharArray) / sizeof(sal_Unicode)) - 1;
-
- SQLLEN pcbValue=0;
- OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle,
- (SQLUSMALLINT)columnIndex,
- SQL_C_WCHAR,
- &waCharArray,
- (SQLLEN)nMaxLen*sizeof(sal_Unicode),
- &pcbValue),
- _aStatementHandle,SQL_HANDLE_STMT,_xInterface);
- _bWasNull = pcbValue == SQL_NULL_DATA;
- if(_bWasNull)
- return ::rtl::OUString();
- // at failure the GETDATA-Makro will stop with returning,
- // at NULL with break!
- SQLLEN nRealSize = 0;
- if ( pcbValue > -1 )
- nRealSize = pcbValue / sizeof(sal_Unicode);
- SQLLEN nLen = pcbValue != SQL_NO_TOTAL ? std::min(nRealSize, nMaxLen) : (nMaxLen-1);
- waCharArray[nLen] = 0;
- aData.append(waCharArray,nLen);
-
- // It is about Binariy Data, a String, that for StarView is to long or
- // the driver kan't predict the length of the data - as well as save the
- // MemoryStream.
- while ((pcbValue == SQL_NO_TOTAL ) || nLen > nMaxLen)
- {
- // At Strings the Buffer won't be completly used
- // (The last Byte is always a NULL-Byte, however it won't be counted with pcbValue)
- if (pcbValue != SQL_NO_TOTAL && (pcbValue - nMaxLen) < nMaxLen)
- nLen = pcbValue - nMaxLen;
- else
- nLen = nMaxLen;
-
- // While there is a "truncation"-Warning, proceed with fetching Data.
- OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle,
- (SQLUSMALLINT)columnIndex,
- SQL_C_WCHAR,
- &waCharArray,
- (SQLLEN)nLen+1,
- &pcbValue),
- _aStatementHandle,SQL_HANDLE_STMT,_xInterface);
- nRealSize = 0;
- if ( pcbValue > -1 )
- nRealSize = pcbValue / sizeof(sal_Unicode);
- nLen = pcbValue != SQL_NO_TOTAL ? std::min(nRealSize, nMaxLen) : (nMaxLen-1);
- waCharArray[nLen] = 0;
-
- aData.append(::rtl::OUString(waCharArray));
- }
- }
- break;
- default:
- {
- char aCharArray[2048];
- // First try to fetch the data with the little Buffer:
- SQLLEN nMaxLen = sizeof aCharArray - 1;
- SQLLEN pcbValue = 0;
- OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle,
- (SQLUSMALLINT)columnIndex,
- SQL_C_CHAR,
- &aCharArray,
- nMaxLen,
- &pcbValue),
- _aStatementHandle,SQL_HANDLE_STMT,_xInterface);
- _bWasNull = pcbValue == SQL_NULL_DATA;
- if(_bWasNull)
- return ::rtl::OUString();
-
- SQLLEN nLen = pcbValue != SQL_NO_TOTAL ? std::min(pcbValue, nMaxLen) : (nMaxLen-1);
- aCharArray[nLen] = 0;
- if ( ((pcbValue == SQL_NO_TOTAL) || pcbValue > nMaxLen) && aCharArray[nLen-1] == 0 && nLen > 0 )
- --nLen;
- aData.append(::rtl::OUString((const sal_Char*)aCharArray,nLen, _nTextEncoding));
-
- // It is about Binariy Data, a String, that for StarView is to long or
- // the driver kan't predict the length of the data - as well as save the
- // MemoryStream.
- while ((pcbValue == SQL_NO_TOTAL) || pcbValue > nMaxLen)
- {
- // While there is a "truncation"-Warning, proceed with fetching Data.
- OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle,
- (SQLUSMALLINT)columnIndex,
- SQL_C_CHAR,
- &aCharArray,
- (SQLINTEGER)nMaxLen,
- &pcbValue),
- _aStatementHandle,SQL_HANDLE_STMT,_xInterface);
- nLen = pcbValue != SQL_NO_TOTAL ? std::min(pcbValue, nMaxLen) : (nMaxLen-1);
- if ( ((pcbValue == SQL_NO_TOTAL) || pcbValue > nMaxLen) && aCharArray[nLen-1] == 0 && nLen > 0 )
- --nLen;
- aCharArray[nLen] = 0;
-
- aData.append(::rtl::OUString((const sal_Char*)aCharArray,nLen,_nTextEncoding));
- }
-
- }
- }
-
- return aData.makeStringAndClear();
-}
-// -------------------------------------------------------------------------
-void OTools::GetInfo(OConnection* _pConnection,
- SQLHANDLE _aConnectionHandle,
- SQLUSMALLINT _nInfo,
- ::rtl::OUString &_rValue,
- const Reference< XInterface >& _xInterface,
- rtl_TextEncoding _nTextEncoding) throw(SQLException, RuntimeException)
-{
- char aValue[512];
- SQLSMALLINT nValueLen=0;
- OTools::ThrowException(_pConnection,
- (*(T3SQLGetInfo)_pConnection->getOdbcFunction(ODBC3SQLGetInfo))(_aConnectionHandle,_nInfo,aValue,(sizeof aValue)-1,&nValueLen),
- _aConnectionHandle,SQL_HANDLE_DBC,_xInterface);
-
- _rValue = ::rtl::OUString(aValue,nValueLen,_nTextEncoding);
-}
-// -------------------------------------------------------------------------
-void OTools::GetInfo(OConnection* _pConnection,
- SQLHANDLE _aConnectionHandle,
- SQLUSMALLINT _nInfo,
- sal_Int32 &_rValue,
- const Reference< XInterface >& _xInterface) throw(SQLException, RuntimeException)
-{
- SQLSMALLINT nValueLen;
- _rValue = 0; // in case the driver uses only 16 of the 32 bits (as it does, for example, for SQL_CATALOG_LOCATION)
- OTools::ThrowException(_pConnection,
- (*(T3SQLGetInfo)_pConnection->getOdbcFunction(ODBC3SQLGetInfo))(_aConnectionHandle,_nInfo,&_rValue,sizeof _rValue,&nValueLen),
- _aConnectionHandle,SQL_HANDLE_DBC,_xInterface);
-}
-// -------------------------------------------------------------------------
-void OTools::GetInfo(OConnection* _pConnection,
- SQLHANDLE _aConnectionHandle,
- SQLUSMALLINT _nInfo,
- SQLUINTEGER &_rValue,
- const Reference< XInterface >& _xInterface) throw(SQLException, RuntimeException)
-{
- SQLSMALLINT nValueLen;
- _rValue = 0; // in case the driver uses only 16 of the 32 bits (as it does, for example, for SQL_CATALOG_LOCATION)
- OTools::ThrowException(_pConnection,
- (*(T3SQLGetInfo)_pConnection->getOdbcFunction(ODBC3SQLGetInfo))(_aConnectionHandle,_nInfo,&_rValue,sizeof _rValue,&nValueLen),
- _aConnectionHandle,SQL_HANDLE_DBC,_xInterface);
-}
-// -------------------------------------------------------------------------
-void OTools::GetInfo(OConnection* _pConnection,
- SQLHANDLE _aConnectionHandle,
- SQLUSMALLINT _nInfo,
- SQLUSMALLINT &_rValue,
- const Reference< XInterface >& _xInterface) throw(SQLException, RuntimeException)
-{
- SQLSMALLINT nValueLen;
- _rValue = 0; // in case the driver uses only 16 of the 32 bits (as it does, for example, for SQL_CATALOG_LOCATION)
- OTools::ThrowException(_pConnection,
- (*(T3SQLGetInfo)_pConnection->getOdbcFunction(ODBC3SQLGetInfo))(_aConnectionHandle,_nInfo,&_rValue,sizeof _rValue,&nValueLen),
- _aConnectionHandle,SQL_HANDLE_DBC,_xInterface);
-}
-// -------------------------------------------------------------------------
-void OTools::GetInfo(OConnection* _pConnection,
- SQLHANDLE _aConnectionHandle,
- SQLUSMALLINT _nInfo,
- sal_Bool &_rValue,
- const Reference< XInterface >& _xInterface) throw(SQLException, RuntimeException)
-{
- SQLSMALLINT nValueLen;
- OTools::ThrowException(_pConnection,
- (*(T3SQLGetInfo)_pConnection->getOdbcFunction(ODBC3SQLGetInfo))(_aConnectionHandle,_nInfo,&_rValue,sizeof _rValue,&nValueLen),
- _aConnectionHandle,SQL_HANDLE_DBC,_xInterface);
-}
-// -------------------------------------------------------------------------
-sal_Int32 OTools::MapOdbcType2Jdbc(sal_Int32 _nType)
-{
- sal_Int32 nValue = DataType::VARCHAR;
- switch(_nType)
- {
- case SQL_BIT:
- nValue = DataType::BIT;
- break;
- case SQL_TINYINT:
- nValue = DataType::TINYINT;
- break;
- case SQL_SMALLINT:
- nValue = DataType::SMALLINT;
- break;
- case SQL_INTEGER:
- nValue = DataType::INTEGER;
- break;
- case SQL_BIGINT:
- nValue = DataType::BIGINT;
- break;
- case SQL_FLOAT:
- nValue = DataType::FLOAT;
- break;
- case SQL_REAL:
- nValue = DataType::REAL;
- break;
- case SQL_DOUBLE:
- nValue = DataType::DOUBLE;
- break;
- case SQL_NUMERIC:
- nValue = DataType::NUMERIC;
- break;
- case SQL_DECIMAL:
- nValue = DataType::DECIMAL;
- break;
- case SQL_WCHAR:
- case SQL_CHAR:
- nValue = DataType::CHAR;
- break;
- case SQL_WVARCHAR:
- case SQL_VARCHAR:
- nValue = DataType::VARCHAR;
- break;
- case SQL_WLONGVARCHAR:
- case SQL_LONGVARCHAR:
- nValue = DataType::LONGVARCHAR;
- break;
- case SQL_TYPE_DATE:
- case SQL_DATE:
- nValue = DataType::DATE;
- break;
- case SQL_TYPE_TIME:
- case SQL_TIME:
- nValue = DataType::TIME;
- break;
- case SQL_TYPE_TIMESTAMP:
- case SQL_TIMESTAMP:
- nValue = DataType::TIMESTAMP;
- break;
- case SQL_BINARY:
- nValue = DataType::BINARY;
- break;
- case SQL_VARBINARY:
- case SQL_GUID:
- nValue = DataType::VARBINARY;
- break;
- case SQL_LONGVARBINARY:
- nValue = DataType::LONGVARBINARY;
- break;
- default:
- OSL_ASSERT(!"Invalid type");
- }
- return nValue;
-}
-//--------------------------------------------------------------------
-// jdbcTypeToOdbc
-// Convert the JDBC SQL type to the correct ODBC type
-//--------------------------------------------------------------------
-sal_Int32 OTools::jdbcTypeToOdbc(sal_Int32 jdbcType)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::jdbcTypeToOdbc" );
- // For the most part, JDBC types match ODBC types. We'll
- // just convert the ones that we know are different
-
- sal_Int32 odbcType = jdbcType;
-
- switch (jdbcType)
- {
- case DataType::DATE:
- odbcType = SQL_DATE;
- break;
- case DataType::TIME:
- odbcType = SQL_TIME;
- break;
- case DataType::TIMESTAMP:
- odbcType = SQL_TIMESTAMP;
- break;
- }
-
- return odbcType;
-}
-//-----------------------------------------------------------------------------
-void OTools::getBindTypes(sal_Bool _bUseWChar,
- sal_Bool _bUseOldTimeDate,
- SQLSMALLINT _nOdbcType,
- SQLSMALLINT& fCType,
- SQLSMALLINT& fSqlType
- )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::getBindTypes" );
- switch(_nOdbcType)
- {
- case SQL_CHAR: if(_bUseWChar)
- {
- fCType = SQL_C_WCHAR;
- fSqlType = SQL_WCHAR;
- }
- else
- {
- fCType = SQL_C_CHAR;
- fSqlType = SQL_CHAR;
- }
- break;
- case SQL_VARCHAR: if(_bUseWChar)
- {
- fCType = SQL_C_WCHAR;
- fSqlType = SQL_WVARCHAR;
- }
- else
- {
- fCType = SQL_C_CHAR;
- fSqlType = SQL_VARCHAR;
- }
- break;
- case SQL_LONGVARCHAR: if(_bUseWChar)
- {
- fCType = SQL_C_WCHAR;
- fSqlType = SQL_WLONGVARCHAR;
- }
- else
- {
- fCType = SQL_C_CHAR;
- fSqlType = SQL_LONGVARCHAR;
- }
- break;
- case SQL_DECIMAL: fCType = _bUseWChar ? SQL_C_WCHAR : SQL_C_CHAR;
- fSqlType = SQL_DECIMAL; break;
- case SQL_NUMERIC: fCType = _bUseWChar ? SQL_C_WCHAR : SQL_C_CHAR;
- fSqlType = SQL_NUMERIC; break;
- case SQL_BIT: fCType = SQL_C_TINYINT;
- fSqlType = SQL_INTEGER; break;
- case SQL_TINYINT: fCType = SQL_C_TINYINT;
- fSqlType = SQL_TINYINT; break;
- case SQL_SMALLINT: fCType = SQL_C_SHORT;
- fSqlType = SQL_SMALLINT; break;
- case SQL_INTEGER: fCType = SQL_C_LONG;
- fSqlType = SQL_INTEGER; break;
- case SQL_BIGINT: fCType = SQL_C_SBIGINT;
- fSqlType = SQL_BIGINT; break;
- case SQL_FLOAT: fCType = SQL_C_FLOAT;
- fSqlType = SQL_FLOAT; break;
- case SQL_REAL: fCType = SQL_C_DOUBLE;
- fSqlType = SQL_REAL; break;
- case SQL_DOUBLE: fCType = SQL_C_DOUBLE;
- fSqlType = SQL_DOUBLE; break;
- case SQL_BINARY: fCType = SQL_C_BINARY;
- fSqlType = SQL_BINARY; break;
- case SQL_VARBINARY:
- fCType = SQL_C_BINARY;
- fSqlType = SQL_VARBINARY; break;
- case SQL_LONGVARBINARY: fCType = SQL_C_BINARY;
- fSqlType = SQL_LONGVARBINARY; break;
- case SQL_DATE:
- if(_bUseOldTimeDate)
- {
- fCType = SQL_C_DATE;
- fSqlType = SQL_DATE;
- }
- else
- {
- fCType = SQL_C_TYPE_DATE;
- fSqlType = SQL_TYPE_DATE;
- }
- break;
- case SQL_TIME:
- if(_bUseOldTimeDate)
- {
- fCType = SQL_C_TIME;
- fSqlType = SQL_TIME;
- }
- else
- {
- fCType = SQL_C_TYPE_TIME;
- fSqlType = SQL_TYPE_TIME;
- }
- break;
- case SQL_TIMESTAMP:
- if(_bUseOldTimeDate)
- {
- fCType = SQL_C_TIMESTAMP;
- fSqlType = SQL_TIMESTAMP;
- }
- else
- {
- fCType = SQL_C_TYPE_TIMESTAMP;
- fSqlType = SQL_TYPE_TIMESTAMP;
- }
- break;
- default: fCType = SQL_C_BINARY;
- fSqlType = SQL_LONGVARBINARY; break;
- }
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/makefile.mk b/connectivity/source/drivers/odbcbase/makefile.mk
deleted file mode 100755
index 85e96ea857..0000000000
--- a/connectivity/source/drivers/odbcbase/makefile.mk
+++ /dev/null
@@ -1,90 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=odbcbase
-
-ENABLE_EXCEPTIONS=TRUE
-VISIBILITY_HIDDEN=TRUE
-
-# --- Settings ----------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/version.mk
-
-CDEFS += -DOOO_DLLIMPLEMENTATION_ODBCBASE
-
-.IF "$(SYSTEM_ODBC_HEADERS)" == "YES"
-CFLAGS+=-DSYSTEM_ODBC_HEADERS
-.ENDIF
-
-# --- Files -------------------------------------
-
-SLOFILES=\
- $(SLO)$/OPreparedStatement.obj \
- $(SLO)$/OStatement.obj \
- $(SLO)$/OResultSetMetaData.obj \
- $(SLO)$/OResultSet.obj \
- $(SLO)$/OTools.obj \
- $(SLO)$/ODatabaseMetaDataResultSet.obj \
- $(SLO)$/ODatabaseMetaData.obj \
- $(SLO)$/ODriver.obj \
- $(SLO)$/OConnection.obj
-
-# --- ODBC BASE Library -----------------------------------
-
-SHL1TARGET= $(ODBC2_TARGET)$(DLLPOSTFIX)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(DBTOOLSLIB) \
- $(COMPHELPERLIB) \
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(SALLIB) \
- $(SALHELPERLIB)
-
-SHL1DEPN=
-SHL1IMPLIB= i$(ODBC2_TARGET)
-SHL1USE_EXPORTS=name
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt \
- $(SLB)$/$(TARGET).lib
-DEFLIB1NAME=$(TARGET)
-
-# --- Targets ----------------------------------
-
-.INCLUDE : target.mk
-
-# --- filter file ------------------------------
-
-$(MISC)$/$(SHL1TARGET).flt: makefile.mk
- @echo CLEAR_THE_FILE > $@