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
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073 #include <RDBC/TSQL.h>
0074 #include <TClass.h>
0075
0076 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,0)
0077 #include <TList.h>
0078 #endif
0079
0080 ClassImpQ(TSQL)
0081 ClassImp(TSQLException)
0082
0083
0084 void TSQLException::Print(Option_t * ) const
0085 {
0086
0087
0088 printf( "%s %s %d\n",
0089 GetMessage().Data(),
0090 GetSQLState().Data(),
0091 GetErrorCode() );
0092 }
0093
0094
0095
0096 TSQL::TSQL(void* imp):TQObject()
0097 {
0098
0099
0100 fWarnings = new TList();
0101 fImp = imp;
0102 }
0103
0104
0105 TSQL::~TSQL()
0106 {
0107
0108
0109 ClearWarnings();
0110 delete fWarnings;
0111 }
0112
0113
0114 void TSQL::Throw( TSQLException* e )
0115 {
0116
0117
0118
0119
0120 if(gDebug) {
0121 printf("%s:\t",IsA()->GetName());
0122 e->Print();
0123 }
0124
0125 fWarnings->Add(e);
0126 e->AddReference();
0127 Emit("Throw(TSQLException*)",(long)e);
0128 }
0129
0130
0131 void TSQL::ClearWarnings()
0132 {
0133
0134
0135 fWarnings->Delete();
0136 }
0137
0138
0139 Bool_t TSQL::SetHandler(const TString& handler)
0140 {
0141
0142
0143 Bool_t failed = kFALSE;
0144
0145 UnsetHandler();
0146
0147 failed |= !TQObject::Connect("TSQL","Throw(TSQLException*)",
0148 (const Text_t *)0,(void*)0,handler.Data());
0149 failed |= !TQObject::Connect("TSQLCallableStatement","Throw(TSQLException*)",
0150 (const Text_t *)0,(void*)0,handler.Data());
0151 failed |= !TQObject::Connect("TSQLConnection","Throw(TSQLException*)",
0152 (const Text_t *)0,(void*)0,handler.Data());
0153 failed |= !TQObject::Connect("TSQLDatabaseMetaData","Throw(TSQLException*)",
0154 (const Text_t *)0,(void*)0,handler.Data());
0155 failed |= !TQObject::Connect("TSQLDriverManager","Throw(TSQLException*)",
0156 (const Text_t *)0,(void*)0,handler.Data());
0157 failed |= !TQObject::Connect("TSQLPreparedStatement","Throw(TSQLException*)",
0158 (const Text_t *)0,(void*)0,handler.Data());
0159 failed |= !TQObject::Connect("TSQLResultSet","Throw(TSQLException*)",
0160 (const Text_t *)0,(void*)0,handler.Data());
0161 failed |= !TQObject::Connect("TSQLResultSetMetaData","Throw(TSQLException*)",
0162 (const Text_t *)0,(void*)0,handler.Data());
0163 failed |= !TQObject::Connect("TSQLStatement","Throw(TSQLException*)",
0164 (const Text_t *)0,(void*)0,handler.Data());
0165
0166 return !failed;
0167 }
0168
0169
0170 Bool_t TSQL::UnsetHandler(const TString& handler)
0171 {
0172
0173
0174 const Text_t* slot;
0175 Bool_t failed = kFALSE;
0176
0177 if(handler.IsNull()) {
0178 slot = 0;
0179 } else {
0180 slot = handler.Data();
0181 }
0182
0183 failed |= !TQObject::Disconnect( "TSQL",
0184 "Throw(TSQLException*)",0,slot );
0185 failed |= !TQObject::Disconnect( "TSQLCallableStatement",
0186 "Throw(TSQLException*)",0,slot );
0187 failed |= !TQObject::Disconnect( "TSQLConnection",
0188 "Throw(TSQLException*)",0,slot );
0189 failed |= !TQObject::Disconnect( "TSQLDatabaseMetaData",
0190 "Throw(TSQLException*)",0,slot );
0191 failed |= !TQObject::Disconnect( "TSQLDriverManager",
0192 "Throw(TSQLException*)",0,slot );
0193 failed |= !TQObject::Disconnect( "TSQLPreparedStatement",
0194 "Throw(TSQLException*)",0,slot );
0195 failed |= !TQObject::Disconnect( "TSQLResultSet",
0196 "Throw(TSQLException*)",0,slot );
0197 failed |= !TQObject::Disconnect( "TSQLResultSetMetaData",
0198 "Throw(TSQLException*)",0,slot );
0199 failed |= !TQObject::Disconnect( "TSQLStatement",
0200 "Throw(TSQLException*)",0,slot );
0201 return !failed;
0202 }
0203