File indexing completed on 2025-08-03 08:22:06
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 #include "ODBCResultSetMetaData.h"
0039 #include "ODBCResultSet.h"
0040 #include <RDBC/odbc++/resultsetmetadata.h>
0041
0042 using namespace odbc;
0043
0044 ClassImpQ(ODBCResultSetMetaData)
0045
0046
0047
0048 ODBCResultSetMetaData::ODBCResultSetMetaData( TSQLResultSet* rs,void* imp ):
0049 TSQLResultSetMetaData(rs,imp)
0050 {
0051
0052
0053 fResultSet = rs;
0054 }
0055
0056
0057 ODBCResultSetMetaData::~ODBCResultSetMetaData()
0058 {
0059
0060
0061 fResultSet = 0;
0062
0063 fImp = 0;
0064
0065 try {
0066
0067
0068 } catch(odbc::SQLException& e) {
0069 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0070 ODBCXX_STRING_CSTR(e.getSQLState()),
0071 e.getErrorCode()) );
0072 }
0073 }
0074
0075
0076 Int_t ODBCResultSetMetaData::GetColumnCount()
0077 {
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087 Int_t return_value = 0;
0088
0089 if(!fImp) { Destroyed(); return return_value; }
0090 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0091
0092 try {
0093 return_value = imp->getColumnCount();
0094 } catch(odbc::SQLException& e) {
0095 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0096 ODBCXX_STRING_CSTR(e.getSQLState()),
0097 e.getErrorCode()) );
0098 return 0;
0099 }
0100 return return_value;
0101 }
0102
0103
0104 Bool_t ODBCResultSetMetaData::IsAutoIncrement( Int_t column )
0105 {
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122 Bool_t return_value = kFALSE;
0123
0124 if(!fImp) { Destroyed(); return return_value; }
0125 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0126
0127 try {
0128 return_value = imp->isAutoIncrement(column);
0129 } catch(odbc::SQLException& e) {
0130 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0131 ODBCXX_STRING_CSTR(e.getSQLState()),
0132 e.getErrorCode()) );
0133 return kFALSE;
0134 }
0135 return return_value;
0136 }
0137
0138
0139 Bool_t ODBCResultSetMetaData::IsCaseSensitive( Int_t column )
0140 {
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151 Bool_t return_value = kFALSE;
0152
0153 if(!fImp) { Destroyed(); return return_value; }
0154 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0155
0156 try {
0157 return_value = imp->isCaseSensitive(column);
0158 } catch(odbc::SQLException& e) {
0159 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0160 ODBCXX_STRING_CSTR(e.getSQLState()),
0161 e.getErrorCode()) );
0162 return kFALSE;
0163 }
0164 return return_value;
0165 }
0166
0167
0168 Bool_t ODBCResultSetMetaData::IsSearchable( Int_t column )
0169 {
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179 Bool_t return_value = kFALSE;
0180
0181 if(!fImp) { Destroyed(); return return_value; }
0182 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0183
0184 try {
0185 return_value = imp->isSearchable(column);
0186 } catch(odbc::SQLException& e) {
0187 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0188 ODBCXX_STRING_CSTR(e.getSQLState()),
0189 e.getErrorCode()) );
0190 return kFALSE;
0191 }
0192 return return_value;
0193 }
0194
0195
0196 Bool_t ODBCResultSetMetaData::IsCurrency( Int_t column )
0197 {
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208 Bool_t return_value = kFALSE;
0209
0210 if(!fImp) { Destroyed(); return return_value; }
0211 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0212
0213 try {
0214 return_value = imp->isCurrency(column);
0215 } catch(odbc::SQLException& e) {
0216 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0217 ODBCXX_STRING_CSTR(e.getSQLState()),
0218 e.getErrorCode()) );
0219 return kFALSE;
0220 }
0221 return return_value;
0222 }
0223
0224
0225 Bool_t ODBCResultSetMetaData::IsNullable( Int_t column )
0226 {
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238 Bool_t return_value = kFALSE;
0239
0240 if(!fImp) { Destroyed(); return return_value; }
0241 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0242
0243 try {
0244 return_value = imp->isNullable(column);
0245 } catch(odbc::SQLException& e) {
0246 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0247 ODBCXX_STRING_CSTR(e.getSQLState()),
0248 e.getErrorCode()) );
0249 return kFALSE;
0250 }
0251 return return_value;
0252 }
0253
0254
0255 Bool_t ODBCResultSetMetaData::IsSigned( Int_t column )
0256 {
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266 Bool_t return_value = kFALSE;
0267
0268 if(!fImp) { Destroyed(); return return_value; }
0269 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0270
0271 try {
0272 return_value = imp->isSigned(column);
0273 } catch(odbc::SQLException& e) {
0274 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0275 ODBCXX_STRING_CSTR(e.getSQLState()),
0276 e.getErrorCode()) );
0277 return kFALSE;
0278 }
0279 return return_value;
0280 }
0281
0282
0283 Int_t ODBCResultSetMetaData::GetColumnDisplaySize( Int_t column )
0284 {
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295 Int_t return_value = 0;
0296
0297 if(!fImp) { Destroyed(); return return_value; }
0298 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0299
0300 try {
0301 return_value = imp->getColumnDisplaySize(column);
0302 } catch(odbc::SQLException& e) {
0303 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0304 ODBCXX_STRING_CSTR(e.getSQLState()),
0305 e.getErrorCode()) );
0306 return 0;
0307 }
0308 return return_value;
0309 }
0310
0311
0312 TString ODBCResultSetMetaData::GetColumnLabel( Int_t column )
0313 {
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324 TString str;
0325
0326 if(!fImp) { Destroyed(); return str; }
0327 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0328
0329 try {
0330 str = ODBCXX_STRING_CSTR( imp->getColumnLabel(column) );
0331 } catch(odbc::SQLException& e) {
0332 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0333 ODBCXX_STRING_CSTR(e.getSQLState()),
0334 e.getErrorCode()) );
0335 return "";
0336 }
0337 return str;
0338 }
0339
0340
0341 TString ODBCResultSetMetaData::GetColumnName( Int_t column )
0342 {
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352 TString str;
0353
0354 if(!fImp) { Destroyed(); return str; }
0355 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0356
0357 try {
0358 str = ODBCXX_STRING_CSTR( imp->getColumnName(column) );
0359 } catch(odbc::SQLException& e) {
0360 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0361 ODBCXX_STRING_CSTR(e.getSQLState()),
0362 e.getErrorCode()) );
0363 return "";
0364 }
0365 return str;
0366 }
0367
0368
0369 TString ODBCResultSetMetaData::GetSchemaName( Int_t column )
0370 {
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380 TString str;
0381
0382 if(!fImp) { Destroyed(); return str; }
0383 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0384
0385 try {
0386 str = ODBCXX_STRING_CSTR( imp->getSchemaName(column) );
0387 } catch(odbc::SQLException& e) {
0388 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0389 ODBCXX_STRING_CSTR(e.getSQLState()),
0390 e.getErrorCode()) );
0391 return "";
0392 }
0393 return str;
0394 }
0395
0396
0397 Int_t ODBCResultSetMetaData::GetPrecision( Int_t column )
0398 {
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408 Int_t return_value = 0;
0409
0410 if(!fImp) { Destroyed(); return return_value; }
0411 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0412
0413 try {
0414 return_value = imp->getPrecision(column);
0415 } catch(odbc::SQLException& e) {
0416 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0417 ODBCXX_STRING_CSTR(e.getSQLState()),
0418 e.getErrorCode()) );
0419 return 0;
0420 }
0421 return return_value;
0422 }
0423
0424
0425 Int_t ODBCResultSetMetaData::GetScale( Int_t column )
0426 {
0427
0428
0429
0430
0431
0432
0433
0434
0435
0436 Int_t return_value = 0;
0437
0438 if(!fImp) { Destroyed(); return return_value; }
0439 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0440
0441 try {
0442 return_value = imp->getScale(column);
0443 } catch(odbc::SQLException& e) {
0444 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0445 ODBCXX_STRING_CSTR(e.getSQLState()),
0446 e.getErrorCode()) );
0447 return 0;
0448 }
0449 return return_value;
0450 }
0451
0452
0453 TString ODBCResultSetMetaData::GetTableName( Int_t column )
0454 {
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464 TString str;
0465
0466 if(!fImp) { Destroyed(); return str; }
0467 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0468
0469 try {
0470 str = ODBCXX_STRING_CSTR( imp->getTableName(column) );
0471 } catch(odbc::SQLException& e) {
0472 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0473 ODBCXX_STRING_CSTR(e.getSQLState()),
0474 e.getErrorCode()) );
0475 return "";
0476 }
0477 return str;
0478 }
0479
0480
0481 TString ODBCResultSetMetaData::GetCatalogName( Int_t column )
0482 {
0483
0484
0485
0486
0487
0488
0489
0490
0491
0492 TString str;
0493
0494 if(!fImp) { Destroyed(); return str; }
0495 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0496
0497 try {
0498 str = ODBCXX_STRING_CSTR( imp->getCatalogName(column) );
0499 } catch(odbc::SQLException& e) {
0500 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0501 ODBCXX_STRING_CSTR(e.getSQLState()),
0502 e.getErrorCode()) );
0503 return "";
0504 }
0505 return str;
0506 }
0507
0508
0509 Int_t ODBCResultSetMetaData::GetColumnType( Int_t column )
0510 {
0511
0512
0513
0514
0515
0516
0517
0518
0519
0520
0521
0522
0523
0524
0525
0526
0527
0528
0529
0530
0531
0532
0533
0534
0535
0536
0537
0538
0539
0540
0541
0542
0543
0544
0545
0546
0547 Int_t return_value = 0;
0548
0549 if(!fImp) { Destroyed(); return return_value; }
0550 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0551
0552 try {
0553 return_value = imp->getColumnType(column);
0554 } catch(odbc::SQLException& e) {
0555 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0556 ODBCXX_STRING_CSTR(e.getSQLState()),
0557 e.getErrorCode()) );
0558 return 0;
0559 }
0560 return return_value;
0561 }
0562
0563
0564 TString ODBCResultSetMetaData::GetColumnTypeName( Int_t column )
0565 {
0566
0567
0568
0569
0570
0571
0572
0573
0574
0575
0576
0577
0578 TString str;
0579
0580 if(!fImp) { Destroyed(); return str; }
0581 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0582
0583 try {
0584 str = ODBCXX_STRING_CSTR( imp->getColumnTypeName(column) );
0585 } catch(odbc::SQLException& e) {
0586 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0587 ODBCXX_STRING_CSTR(e.getSQLState()),
0588 e.getErrorCode()) );
0589 return "";
0590 }
0591 return str;
0592 }
0593
0594
0595 Bool_t ODBCResultSetMetaData::IsReadOnly( Int_t column )
0596 {
0597
0598
0599
0600
0601
0602
0603
0604
0605
0606 Bool_t return_value = kTRUE;
0607
0608 if(!fImp) { Destroyed(); return return_value; }
0609 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0610
0611 try {
0612 return_value = imp->isReadOnly(column);
0613 } catch(odbc::SQLException& e) {
0614 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0615 ODBCXX_STRING_CSTR(e.getSQLState()),
0616 e.getErrorCode()) );
0617 return kTRUE;
0618 }
0619 return return_value;
0620 }
0621
0622
0623 Bool_t ODBCResultSetMetaData::IsWritable( Int_t column )
0624 {
0625
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635 Bool_t return_value = kFALSE;
0636
0637 if(!fImp) { Destroyed(); return return_value; }
0638 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0639
0640 try {
0641 return_value = imp->isWritable(column);
0642 } catch(odbc::SQLException& e) {
0643 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0644 ODBCXX_STRING_CSTR(e.getSQLState()),
0645 e.getErrorCode()) );
0646 return kFALSE;
0647 }
0648 return return_value;
0649 }
0650
0651
0652 Bool_t ODBCResultSetMetaData::IsDefinitelyWritable( Int_t column )
0653 {
0654
0655
0656
0657
0658
0659
0660
0661
0662
0663 Bool_t return_value = kFALSE;
0664
0665 if(!fImp) { Destroyed(); return return_value; }
0666 odbc::ResultSetMetaData* imp = (odbc::ResultSetMetaData*)fImp;
0667
0668 try {
0669 return_value = imp->isDefinitelyWritable(column);
0670 } catch(odbc::SQLException& e) {
0671 Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0672 ODBCXX_STRING_CSTR(e.getSQLState()),
0673 e.getErrorCode()) );
0674 return kFALSE;
0675 }
0676 return return_value;
0677 }