Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:22:04

0001 // $Id: ODBCCallableStatement.cxx,v 1.2 2007/02/28 21:33:39 phnxbld Exp $
0002 //*-- Author : Valeriy Onuchin 14/02/2000 
0003 //
0004 
0005 /**************************************************************************
0006 
0007    ROOT wrappers of libodbc++ library
0008     
0009    Copyright (C) 1999-2000 Manush Dodunekov <manush@stendahls.net>
0010    
0011    This library is free software; you can redistribute it and/or
0012    modify it under the terms of the GNU Library General Public
0013    License as published by the Free Software Foundation; either
0014    version 2 of the License, or (at your option) any later version.
0015    
0016    This library is distributed in the hope that it will be useful,
0017    but WITHOUT ANY WARRANTY; without even the implied warranty of
0018    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0019    Library General Public License for more details.
0020    
0021    You should have received a copy of the GNU Library General Public License
0022    along with this library; see the file COPYING.  If not, write to
0023    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0024    Boston, MA 02111-1307, USA.
0025 
0026 **************************************************************************/
0027 
0028 /////////////////////////////////////////////////////////////////////
0029 //
0030 // A TSQLCallableStatement extends the functionality of a 
0031 // TSQLPreparedStatement, by allowing output parameters.
0032 //
0033 // The ODBC escapes for calling stored procedures and functions 
0034 // should be used. A procedure call is prepared like this:
0035 //
0036 // TSQLCallableStatement* cstmt = 
0037 //             con->PrepareCall("{call my_procedure(?,?,?)}");
0038 //
0039 // 
0040 // And for a function call (a procedure that returns a value), the
0041 // following syntax should be used:
0042 //
0043 // TSQLCallableStatement* cstmt=
0044 //                   con->PrepareCall("{?=call my_function(?,?)}"); 
0045 // 
0046 // All parameters in a TSQLCallableStatement  are treated
0047 // as input/output parameters, unless they are registered as
0048 // output-only parameters with registerOutParameter(). Note that
0049 // output-only parameters must be registered with their proper
0050 // SQL type prior to executing a TSQLCallableStatement.
0051 //
0052 // The interface used to execute SQL stored procedures. It provides a
0053 // stored procedure SQL escape that allows stored procedures to be 
0054 // called in a standard way for all RDBMSs. This escape syntax has 
0055 // one form that includes a result parameter and one that does not. 
0056 // If used, the result parameter must be registered as an OUT parameter.
0057 //  The other parameters can be used for input, output or both. 
0058 ///
0059 // Parameters are referred to sequentially, by number. 
0060 // The first parameter is 1. 
0061 //
0062 //        {?= call ?procedure-name?[?arg1?,?arg2?, ...]}
0063 //        {call ?procedure-name?[?arg1?,?arg2?, ...]}
0064 //      
0065 // IN parameter values are set using the set methods inherited from
0066 // TSQLPreparedStatement. The type of all OUT parameters must be 
0067 // registered prior to executing the stored procedure; their values
0068 // are retrieved after execution via the get methods provided here. 
0069 //
0070 // A TSQLCallableStatement can return one TSQLResultSet or multiple 
0071 // TSQLResultSet objets. Multiple TSQLResultSet objects are handled 
0072 // using operations inherited from TSQLStatement. 
0073 //
0074 // For maximum portability, a call's TSQLResultSet objects and update 
0075 // counts should be processed prior to getting the values of output 
0076 // parameters. 
0077 //
0078 // See also: 
0079 //     TSQLConnection::PrepareCall(TString), TSQLResultSet
0080 //     TSQLStatement TSQLPreparedStatement 
0081 //
0082 // Note: 
0083 //       - Callable statments not supported by MySQL.
0084 //       - I failed to use with OpenLink ODBC driver to Oracle
0085 //
0086 /////////////////////////////////////////////////////////////////////
0087 
0088 #include <sstream>
0089 #include "ODBCCallableStatement.h"
0090 #include <RDBC/odbc++/statement.h>
0091 #include <RDBC/odbc++/preparedstatement.h>
0092 #include <RDBC/odbc++/callablestatement.h>
0093 #include <iostream>
0094 #include "ODBCResultSet.h"
0095 #include <RDBC/odbc++/resultset.h>
0096 #include <TList.h>
0097 
0098 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,0)
0099 #include <TBufferFile.h>
0100 #endif
0101 
0102 
0103 using namespace odbc;
0104 
0105 ClassImpQ(ODBCCallableStatement)
0106 
0107   /////////////////////////////////////////////////////////////////////
0108   //___________________________________________________________________
0109   ODBCCallableStatement::ODBCCallableStatement(TSQLConnection* con,void* imp):
0110     TSQLCallableStatement(con,imp)
0111    
0112 {
0113   // ctor
0114 }
0115 
0116 //___________________________________________________________________
0117 ODBCCallableStatement::~ODBCCallableStatement()
0118 {
0119   // dtor
0120 
0121   odbc::CallableStatement* imp = (odbc::CallableStatement*)fImp;
0122  
0123   try { 
0124     if(imp) delete  imp;   
0125   } catch(odbc::SQLException& e) {
0126     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0127                   ODBCXX_STRING_CSTR(e.getSQLState()),
0128                   e.getErrorCode()) );
0129   }
0130 
0131   // implementation part of fCurrentResult is deleted with statement
0132   if(fCurrentResult) ((ODBCResultSet*)fCurrentResult)->fImp = 0;
0133   fImp = 0;
0134 }
0135 
0136 //___________________________________________________________________
0137 void ODBCCallableStatement::RegisterOutParameter(Int_t parameterIndex,
0138                                                  Int_t sqlType)
0139 {
0140   //  Registers the OUT parameter in ordinal position parameterIndex to
0141   //  the type sqlType. All OUT parameters must be registered before
0142   //  a stored procedure is executed. 
0143   //
0144   //  The type specified by sqlType for an OUT parameter determines
0145   //  the  type that must be used in the get method to read the value
0146   //  of that parameter. 
0147   //
0148   //  Parameters:
0149   //
0150   //      parameterIndex - the first parameter is 1, 
0151   //                       the second is 2, and so on
0152   //      sqlType - the type code defined by ESQLTypes (see TSQLTypes.h)
0153   //                If the parameter is of type kNumeric, 
0154   //                the version of registerOutParameter that 
0155   //                accepts a scale value should be used.
0156   //  Throws:
0157   //      TSQLException - if a database access error occurs
0158   //  See Also: 
0159   //      TSQLTypes.h 
0160   //
0161   // enum ESQLTypes { 
0162   //       kBIGINT = -5,
0163   //       kBINARY = -2,
0164   //       kBIT = -7,
0165   //       kCHAR = 1,
0166   // #ifdef ODBC_VER_LESS_30 
0167   //       kDATE = 9,
0168   //       kTIME = 10,
0169   //       kTIMESTAMP = 11,
0170   // #endif     
0171   //       kDATE = 91,
0172   //       kTIME = 92,
0173   //       kTIMESTAMP = 93,
0174   //       kSMALLINT = 5,
0175   //       kDECIMAL = 3,
0176   //       kDOUBLE = 8,
0177   //       kFLOAT = 6,
0178   //       kINTEGER = 4,
0179   //       kLONGVARBINARY = -4,
0180   //       kLONGVARCHAR = -1,
0181   //       kNUMERIC = 2,
0182   //       kREAL = 7,
0183   //       kTINYINT = -6,
0184   //       kVARBINARY = -3,
0185   //       kVARCHAR  = 12 
0186   // };
0187 
0188   if(!fImp) { Destroyed(); return; } 
0189   odbc::CallableStatement* stmt=(odbc::CallableStatement*)fImp; 
0190       
0191   try {   
0192     stmt->registerOutParameter( parameterIndex,sqlType );
0193 
0194   } catch(odbc::SQLException& e) {
0195     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0196                   ODBCXX_STRING_CSTR(e.getSQLState()),
0197                   e.getErrorCode()) );
0198   }
0199 }
0200 
0201 //___________________________________________________________________
0202 void ODBCCallableStatement::RegisterOutParameter(Int_t parameterIndex,
0203                                                  Int_t sqlType,
0204                                                  Int_t scale)
0205 {
0206   //  Registers the parameter in ordinal position parameterIndex to be
0207   //  of type sqlType. This method must be called before a stored
0208   //  procedure is executed. 
0209   //
0210   //  The type specified by sqlType for an OUT parameter determines
0211   //  the  type that must be used in the get method to read the value
0212   //  of that parameter. 
0213   //
0214   //  This version of registerOutParameter should be used when the
0215   //  parameter is of type kNUMERIC.
0216   //  
0217   //  Parameters:
0218   //     parameterIndex -  the first parameter is 1, 
0219   //                       the second is 2, and so on
0220   //     sqlType -  SQL type code defined in TSQLTypes.h
0221   //     scale -    the desired number of digits to the right of the
0222   //                decimal point. It must be greater than or equal 
0223   //                to zero.
0224   //  Throws:
0225   //      TSQLException - if a database access error occurs
0226   //  See Also: 
0227   //      TSQLTypes.h
0228   //
0229   // enum ESQLTypes { 
0230   //       kBIGINT = -5,
0231   //       kBINARY = -2,
0232   //       kBIT = -7,
0233   //       kCHAR = 1,
0234   // #ifdef ODBC_VER_LESS_30 
0235   //       kDATE = 9,
0236   //       kTIME = 10,
0237   //       kTIMESTAMP = 11,
0238   // #endif     
0239   //       kDATE = 91,
0240   //       kTIME = 92,
0241   //       kTIMESTAMP = 93,
0242   //       kSMALLINT = 5,
0243   //       kDECIMAL = 3,
0244   //       kDOUBLE = 8,
0245   //       kFLOAT = 6,
0246   //       kINTEGER = 4,
0247   //       kLONGVARBINARY = -4,
0248   //       kLONGVARCHAR = -1,
0249   //       kNUMERIC = 2,
0250   //       kREAL = 7,
0251   //       kTINYINT = -6,
0252   //       kVARBINARY = -3,
0253   //       kVARCHAR  = 12 
0254   // };
0255 
0256   if(!fImp) { Destroyed(); return; } 
0257   odbc::CallableStatement* stmt=(odbc::CallableStatement*)fImp; 
0258       
0259   try {
0260     stmt->registerOutParameter( parameterIndex,sqlType,scale );
0261 
0262   } catch(odbc::SQLException& e) {
0263     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0264                   ODBCXX_STRING_CSTR(e.getSQLState()),
0265                   e.getErrorCode()) );
0266   }
0267 }
0268 
0269 //___________________________________________________________________
0270 Bool_t ODBCCallableStatement::WasNull()
0271 {
0272   // Indicates whether or not the last OUT parameter read had 
0273   // the value of SQL NULL. Note that this method should be 
0274   // called only after calling the get method; otherwise, there 
0275   // is no value to use in determining whether it is null or not.
0276   //  
0277   //  Returns:
0278   //      kTRUE if the last parameter read was SQL NULL; 
0279   //      kFALSE otherwise.
0280   //  Throws:
0281   //      TSQLException - if a database access error occurs
0282 
0283   Bool_t return_value = kFALSE;
0284    
0285   if(!fImp) { Destroyed(); return return_value; } 
0286   odbc::CallableStatement* stmt=(odbc::CallableStatement*)fImp; 
0287    
0288   try {
0289     return_value = stmt->wasNull();
0290 
0291   } catch(odbc::SQLException& e) {
0292     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0293                   ODBCXX_STRING_CSTR(e.getSQLState()),
0294                   e.getErrorCode()) );
0295     return kFALSE;
0296   }   
0297   return return_value;
0298 }
0299 
0300 //___________________________________________________________________
0301 TString ODBCCallableStatement::GetString( Int_t parameterIndex )
0302 {
0303   // Retrieves the value of a  parameter as a TString. 
0304   //
0305   // For the fixed-length type kCHAR, the TString object returned 
0306   // has exactly the same value the kCHAR value had in the database,
0307   // including any padding added by the database.
0308   //
0309   //  Parameters:
0310   //      parameterIndex - the first parameter is 1, 
0311   //                       the second is 2,  and so on
0312   //  Returns:
0313   //      the parameter value. If the value is SQL NULL, 
0314   //                           the result is null.
0315   //  Throws:
0316   //      TSQLException - if a database access error occurs
0317    
0318   TString str;
0319    
0320   if(!fImp) { Destroyed(); return str; } 
0321   odbc::CallableStatement* stmt=(odbc::CallableStatement*)fImp; 
0322    
0323   try {
0324     ODBCXX_STRING s = stmt->getString(parameterIndex);
0325     str = ODBCXX_STRING_CSTR(s);
0326 
0327   } catch(odbc::SQLException& e) {
0328     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0329                   ODBCXX_STRING_CSTR(e.getSQLState()),
0330                   e.getErrorCode()) );
0331     return "";
0332   }      
0333   return str;
0334 }
0335 
0336 //___________________________________________________________________
0337 Bool_t ODBCCallableStatement::GetBoolean( Int_t parameterIndex )
0338 {
0339   //  Gets the value of a parameter as a Bool_t 
0340   //  
0341   //  Parameters:
0342   //       parameterIndex -  the first parameter is 1, 
0343   //                         the second is 2, and so on
0344   //  Returns:
0345   //       the parameter value. If the value is SQL NULL, 
0346   //       the result is kFALSE.
0347   //  Throws:
0348   //      TSQLException - if a database access error occurs
0349 
0350   Bool_t return_value = kFALSE;
0351    
0352   if(!fImp) { Destroyed(); return return_value; } 
0353   odbc::CallableStatement* stmt=(odbc::CallableStatement*)fImp; 
0354    
0355   try {
0356     return_value = stmt->getBoolean(parameterIndex);
0357 
0358   } catch(odbc::SQLException& e) {
0359     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0360                   ODBCXX_STRING_CSTR(e.getSQLState()),
0361                   e.getErrorCode()) );
0362     return kFALSE;
0363   }
0364   return return_value;
0365 }
0366 
0367 //___________________________________________________________________
0368 Char_t ODBCCallableStatement::GetByte( Int_t parameterIndex )
0369 {
0370   // Gets the value of a parameter as a byte .
0371   //
0372   //  Parameters:
0373   //      parameterIndex - the first parameter is 1, 
0374   //                       the second is 2, and so on
0375   //  Returns:
0376   //      the parameter value. If the value is SQL NULL, 
0377   //      the result is 0.
0378   //  Throws:
0379   //      TSQLException - if a database access error occurs
0380    
0381   Char_t return_value = 0;
0382    
0383   if(!fImp) { Destroyed(); return return_value; } 
0384   odbc::CallableStatement* stmt=(odbc::CallableStatement*)fImp; 
0385     
0386   try {
0387     return_value = stmt->getByte(parameterIndex);
0388 
0389   } catch(odbc::SQLException& e) {
0390     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0391                   ODBCXX_STRING_CSTR(e.getSQLState()),
0392                   e.getErrorCode()) );
0393     return 0;
0394   }   
0395   return return_value;
0396 }
0397 
0398 //___________________________________________________________________
0399 Short_t ODBCCallableStatement::GetShort( Int_t parameterIndex )
0400 {
0401   // Gets the value of a parameter as a Short_t .
0402   //  
0403   //  Parameters:
0404   //       parameterIndex - the first parameter is 1, 
0405   //                        the second is 2, and so on
0406   //  Returns:
0407   //       the parameter value. If the value is SQL NULL, 
0408   //       the result is 0.
0409   //   Throws:
0410   //       TSQLException - if a database access error occurs
0411 
0412   Short_t return_value = 0;
0413    
0414   if(!fImp) { Destroyed(); return return_value; } 
0415   odbc::CallableStatement* stmt=(odbc::CallableStatement*)fImp; 
0416    
0417   try {
0418     return_value = stmt->getShort(parameterIndex);
0419 
0420   } catch(odbc::SQLException& e) {
0421     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0422                   ODBCXX_STRING_CSTR(e.getSQLState()),
0423                   e.getErrorCode()) );
0424     return 0;
0425   }
0426   return return_value;
0427 }
0428 
0429 //___________________________________________________________________
0430 Int_t ODBCCallableStatement::GetInt( Int_t parameterIndex )
0431 {
0432   // Gets the value of a parameter as an Int_t .
0433   //
0434   //  Parameters:
0435   //       parameterIndex -  the first parameter is 1, the second is 2,
0436   //                         and so on
0437   //  Returns:
0438   //       the parameter value. If the value is SQL NULL, 
0439   //       the result is 0.
0440   //  Throws:
0441   //       TSQLException - if a database access error occurs
0442 
0443   Int_t return_value = 0;
0444    
0445   if(!fImp) { Destroyed(); return return_value; } 
0446   odbc::CallableStatement* stmt=(odbc::CallableStatement*)fImp; 
0447 
0448   try {
0449     return_value = stmt->getInt(parameterIndex);
0450 
0451   } catch(odbc::SQLException& e) {
0452     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0453                   ODBCXX_STRING_CSTR(e.getSQLState()),
0454                   e.getErrorCode()) );
0455     return 0;
0456   }   
0457   return return_value;
0458 }
0459 
0460 //___________________________________________________________________
0461 Long_t ODBCCallableStatement::GetLong( Int_t parameterIndex )
0462 {
0463   // Gets the value of a parameter as a Long_t .
0464   //
0465   //  Parameters:
0466   //       parameterIndex - the first parameter is 1, 
0467   //                       the second is 2, and so on
0468   //  Returns:
0469   //       the parameter value. If the value is SQL NULL, 
0470   //       the result is 0.
0471   //  Throws:
0472   //       TSQLException - if a database access error occurs
0473 
0474   Long_t return_value = 0;
0475 
0476   if(!fImp) { Destroyed(); return return_value; } 
0477   odbc::CallableStatement* stmt=(odbc::CallableStatement*)fImp; 
0478    
0479   try {
0480     return_value = stmt->getLong(parameterIndex);
0481 
0482   } catch(odbc::SQLException& e) {
0483     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0484                   ODBCXX_STRING_CSTR(e.getSQLState()),
0485                   e.getErrorCode()) );
0486     return 0;
0487   }   
0488   return return_value;
0489 }
0490 
0491 //___________________________________________________________________
0492 Float_t ODBCCallableStatement::GetFloat( Int_t parameterIndex )
0493 {
0494   // Gets the value of a parameter as a Float_t .
0495   //
0496   // Parameters:
0497   //       parameterIndex - the first parameter is 1, 
0498   //                       the second is 2, and so on
0499   //  Returns:
0500   //       the parameter value. If the value is SQL NULL, 
0501   //       the result is 0.
0502   //  Throws:
0503   //       TSQLException - if a database access error occurs
0504 
0505   Float_t return_value = 0;
0506 
0507   if(!fImp) { Destroyed(); return return_value; } 
0508   odbc::CallableStatement* stmt=(odbc::CallableStatement*)fImp; 
0509    
0510   try {
0511     return_value = stmt->getFloat(parameterIndex);
0512 
0513   } catch(odbc::SQLException& e) {
0514     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0515                   ODBCXX_STRING_CSTR(e.getSQLState()),
0516                   e.getErrorCode()) );
0517     return 0;
0518   }   
0519   return return_value;
0520 }
0521 
0522 //___________________________________________________________________
0523 Double_t ODBCCallableStatement::GetDouble( Int_t parameterIndex )
0524 {
0525   // Gets the value of a parameter as a Double_t .
0526   //
0527   //  Parameters:
0528   //       parameterIndex - the first parameter is 1, 
0529   //                       the second is 2, and so on
0530   //  Returns:
0531   //       the parameter value. If the value is SQL NULL, 
0532   //       the result is 0.
0533   //  Throws:
0534   //       TSQLException - if a database access error occurs
0535 
0536   Double_t return_value = 0;
0537 
0538   if(!fImp) { Destroyed(); return return_value; } 
0539   odbc::CallableStatement* stmt=(odbc::CallableStatement*)fImp; 
0540    
0541   try {
0542     return_value = stmt->getDouble(parameterIndex);
0543 
0544   } catch(odbc::SQLException& e) {
0545     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0546                   ODBCXX_STRING_CSTR(e.getSQLState()),
0547                   e.getErrorCode()) );
0548     return 0;
0549   }   
0550   return return_value;
0551 }
0552 
0553 //___________________________________________________________________
0554 TArrayC ODBCCallableStatement::GetBytes( Int_t parameterIndex )
0555 {
0556   // Gets the value of a parameter as an array of byte values.
0557   //
0558   //  Parameters:
0559   //       parameterIndex -  the first parameter is 1, 
0560   //                         the second is 2, and so on
0561   //  Returns:
0562   //       the parameter value. If the value is SQL NULL, 
0563   //       the result is null.
0564   //  Throws:
0565   //       TSQLException - if a database access error occurs
0566 
0567   TArrayC array;
0568    
0569   if(!fImp) { Destroyed(); return array; } 
0570   odbc::CallableStatement* stmt=(odbc::CallableStatement*)fImp; 
0571    
0572   try { 
0573     ODBCXX_BYTES b = stmt->getBytes(parameterIndex);
0574       
0575     array.Set( (Int_t)ODBCXX_BYTES_SIZE(b),
0576            (Char_t*)ODBCXX_BYTES_DATA(b) );
0577    
0578   } catch(odbc::SQLException& e) {
0579     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0580                   ODBCXX_STRING_CSTR(e.getSQLState()),
0581                   e.getErrorCode()) );
0582     return TArrayC();
0583   }
0584   return array;
0585 }
0586 
0587 //___________________________________________________________________
0588 TSQLDate ODBCCallableStatement::GetDate( Int_t parameterIndex )
0589 {
0590   //  Gets the value of a parameter as a TSQLDate object.
0591   //
0592   //  Parameters:
0593   //       parameterIndex -  the first parameter is 1, 
0594   //                         the second is 2, and so on
0595   //  Returns:
0596   //       the parameter value. If the value is SQL NULL, 
0597   //       the result is null.
0598   //  Throws:
0599   //       TSQLException - if a database access error occurs
0600 
0601   TSQLDate return_value;
0602    
0603   if(!fImp) { Destroyed(); return return_value; } 
0604   odbc::CallableStatement* stmt=(odbc::CallableStatement*)fImp; 
0605 
0606   try {
0607     odbc::Date dt = stmt->getDate(parameterIndex);
0608 
0609     return_value = TSQLDate( dt.getYear(),
0610                  dt.getMonth(),
0611                  dt.getDay() );
0612 
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 TSQLDate();
0618   }
0619   return return_value;
0620 }
0621 
0622 //___________________________________________________________________
0623 TSQLTime ODBCCallableStatement::GetTime( Int_t parameterIndex )
0624 {
0625   // Get the value of a parameter as a TSQLTime object.
0626   // 
0627   // Parameters:
0628   //      parameterIndex -  the first parameter is 1, 
0629   //                        the second is 2, and so on
0630   // Returns:
0631   //      the parameter value. If the value is SQL NULL, 
0632   //      the result is null.
0633   // Throws:
0634   //      TSQLException - if a database access error occurs
0635 
0636   TSQLTime return_value;
0637    
0638   if(!fImp) { Destroyed(); return return_value; } 
0639   odbc::CallableStatement* stmt=(odbc::CallableStatement*)fImp; 
0640    
0641   try {
0642     odbc::Time tm = stmt->getTime(parameterIndex);
0643 
0644     return_value = TSQLTime( tm.getHour(),
0645                  tm.getMinute(),
0646                  tm.getSecond() );
0647 
0648   } catch(odbc::SQLException& e) {
0649     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0650                   ODBCXX_STRING_CSTR(e.getSQLState()),
0651                   e.getErrorCode()) );
0652     return TSQLTime();
0653   }
0654   return return_value;
0655 }
0656 
0657 //___________________________________________________________________
0658 TSQLTimestamp ODBCCallableStatement::GetTimestamp( Int_t parameterIndex )
0659 {
0660   // Gets the value of a parameter as a TSQLTimestamp object.
0661   //  
0662   // Parameters:
0663   //      parameterIndex -  the first parameter is 1, 
0664   //                        the second is 2, and so on
0665   // Returns:
0666   //      the parameter value. If the value is SQL NULL, 
0667   //      the result is null.
0668   // Throws:
0669   //      TSQLException - if a database access error occurs
0670    
0671   TSQLTimestamp return_value;
0672    
0673   if(!fImp) { Destroyed(); return return_value; } 
0674   odbc::CallableStatement* stmt=(odbc::CallableStatement*)fImp; 
0675    
0676   try {
0677     odbc::Timestamp tmstmp = stmt->getTimestamp(parameterIndex);
0678 
0679     return_value = TSQLTimestamp( tmstmp.getYear(),
0680                   tmstmp.getMonth(),
0681                   tmstmp.getDay(), 
0682                   tmstmp.getHour(),
0683                   tmstmp.getMinute(),
0684                   tmstmp.getSecond(),
0685                   tmstmp.getNanos() );
0686 
0687   } catch(odbc::SQLException& e) {
0688     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0689                   ODBCXX_STRING_CSTR(e.getSQLState()),
0690                   e.getErrorCode()) );
0691     return TSQLTimestamp();
0692   }
0693   return return_value;
0694 }
0695 
0696 ///////////////// include from ODBCPreparedStatement.cxx /////////////
0697 //___________________________________________________________________
0698 void ODBCCallableStatement::SetNull( Int_t parameterIndex,Int_t sqlType )
0699 {
0700   // Sets the designated parameter to SQL NULL. 
0701   //
0702   //   Note: You must specify the parameter's SQL type.
0703   //
0704   //   Parameters:
0705   //          parameterIndex - the first parameter is 1, 
0706   //                           the second is 2, ...
0707   //          sqlType - the SQL type code defined in TSQLTypes
0708   //   Throws:
0709   //          TSQLException - if a database access error occurs
0710    
0711   if(!fImp) { Destroyed();   return; } 
0712   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
0713      
0714   try {
0715     imp->setNull(parameterIndex,sqlType);
0716 
0717   } catch(odbc::SQLException& e) {
0718     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0719                   ODBCXX_STRING_CSTR(e.getSQLState()),
0720                   e.getErrorCode()) );
0721   }
0722 }
0723 
0724 //___________________________________________________________________
0725 void ODBCCallableStatement::SetBoolean( Int_t parameterIndex,Bool_t x )
0726 {
0727   // Sets the designated parameter to a Bool_t value. The
0728   // driver converts this to an SQL BIT value when it sends it to
0729   // the database.
0730   //
0731   //   Parameters:
0732   //         parameterIndex - the first parameter is 1, 
0733   //                          the second is 2, ...
0734   //         x - the parameter value
0735   //   Throws:
0736   //         TSQLException - if a database access error occurs
0737    
0738   if(!fImp) { Destroyed();   return; } 
0739   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
0740    
0741   try {
0742     imp->setBoolean(parameterIndex,x); 
0743 
0744   } catch(odbc::SQLException& e) {
0745     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0746                   ODBCXX_STRING_CSTR(e.getSQLState()),
0747                   e.getErrorCode()) );
0748   }
0749 }
0750 
0751 //___________________________________________________________________
0752 void ODBCCallableStatement::SetByte( Int_t parameterIndex,Char_t x )
0753 {
0754   // Sets the designated parameter to a  byte value. The
0755   // driver converts this to an SQL TINYINT value when it sends
0756   // it to the database.
0757   //
0758   //   Parameters:
0759   //         parameterIndex - the first parameter is 1, 
0760   //                          the second is 2, ...
0761   //         x - the parameter value
0762   //   Throws:
0763   //         TSQLException - if a database access error occurs
0764    
0765   if(!fImp) { Destroyed();   return; } 
0766   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
0767    
0768   try {   
0769     imp->setByte(parameterIndex,x); 
0770 
0771   } catch(odbc::SQLException& e) {
0772     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0773                   ODBCXX_STRING_CSTR(e.getSQLState()),
0774                   e.getErrorCode()) );
0775   }
0776 }
0777 
0778 //___________________________________________________________________
0779 void ODBCCallableStatement::SetShort( Int_t parameterIndex,Short_t x )
0780 {
0781   // Sets the designated parameter to a  short value. The
0782   //   driver converts this to an SQL SMALLINT value when it sends
0783   //   it to the database.
0784   //
0785   //   Parameters:
0786   //         parameterIndex - the first parameter is 1, 
0787   //                            the second is 2, ...
0788   //         x - the parameter value
0789   //   Throws:
0790   //         TSQLException - if a database access error occurs
0791 
0792   if(!fImp) { Destroyed();   return; } 
0793   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
0794    
0795   try {
0796     imp->setShort(parameterIndex,x);
0797 
0798   } catch(odbc::SQLException& e) {
0799     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0800                   ODBCXX_STRING_CSTR(e.getSQLState()),
0801                   e.getErrorCode()) );
0802   }
0803 }
0804 
0805 //___________________________________________________________________
0806 void ODBCCallableStatement::SetInt( Int_t parameterIndex,Int_t x )
0807 {
0808   // Sets the designated parameter to a  int value. The
0809   // driver converts this to an SQL INTEGER value when it sends
0810   // it to the database.
0811   //
0812   //   Parameters:
0813   //         parameterIndex - the first parameter is 1, 
0814   //                          the second is 2, ...
0815   //         x - the parameter value
0816   //   Throws:
0817   //         TSQLException - if a database access error occurs
0818    
0819   if(!fImp) { Destroyed();   return; } 
0820   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
0821    
0822   try {
0823     imp->setInt(parameterIndex,x);
0824 
0825   } catch(odbc::SQLException& e) {
0826     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0827                   ODBCXX_STRING_CSTR(e.getSQLState()),
0828                   e.getErrorCode()) );
0829   }
0830 }
0831 
0832 //___________________________________________________________________
0833 void ODBCCallableStatement::SetLong( Int_t parameterIndex,Long_t x )
0834 {
0835   // Sets the designated parameter to a  long value. The
0836   // driver converts this to an SQL BIGINT value when it sends it
0837   // to the database.
0838   //
0839   //   Parameters:
0840   //         parameterIndex - the first parameter is 1, 
0841   //                          the second is 2, ...
0842   //         x - the parameter value
0843   //   Throws:
0844   //         TSQLException - if a database access error occurs
0845    
0846   if(!fImp) { Destroyed();   return; } 
0847   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
0848    
0849   try {
0850     imp->setLong(parameterIndex,x);
0851 
0852   } catch(odbc::SQLException& e) {
0853     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0854                   ODBCXX_STRING_CSTR(e.getSQLState()),
0855                   e.getErrorCode()) );
0856   }
0857 }
0858 
0859 //___________________________________________________________________
0860 void ODBCCallableStatement::SetFloat( Int_t parameterIndex,Float_t x )
0861 {
0862   // Sets the designated parameter to a  float value. The
0863   // driver converts this to an SQL FLOAT value when it sends it
0864   // to the database.
0865   //
0866   //   Parameters:
0867   //         parameterIndex - the first parameter is 1, 
0868   //                          the second is 2, ...
0869   //         x - the parameter value
0870   //   Throws:
0871   //         TSQLException - if a database access error occurs
0872    
0873   if(!fImp) { Destroyed();   return; } 
0874   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
0875    
0876   try {
0877     imp->setFloat(parameterIndex,x);
0878 
0879   } catch(odbc::SQLException& e) {
0880     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0881                   ODBCXX_STRING_CSTR(e.getSQLState()),
0882                   e.getErrorCode()) );
0883   }
0884 }
0885 
0886 //___________________________________________________________________
0887 void ODBCCallableStatement::SetDouble( Int_t parameterIndex,Double_t x )
0888 {
0889   // Sets the designated parameter to a  double value. The
0890   // driver converts this to an SQL DOUBLE value when it sends it
0891   // to the database.
0892   //
0893   //   Parameters:
0894   //         parameterIndex - the first parameter is 1, 
0895   //                          the second is 2, ...
0896   //         x - the parameter value
0897   //   Throws:
0898   //         TSQLException - if a database access error occurs
0899    
0900   if(!fImp) { Destroyed();   return; } 
0901   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
0902    
0903   try {
0904     imp->setDouble(parameterIndex,x);
0905 
0906   } catch(odbc::SQLException& e) {
0907     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0908                   ODBCXX_STRING_CSTR(e.getSQLState()),
0909                   e.getErrorCode()) );
0910   }
0911 }
0912 
0913 //___________________________________________________________________
0914 void ODBCCallableStatement::SetString( Int_t parameterIndex, 
0915                                        const TString& x )
0916 {
0917   //  Sets the designated parameter to a  TString value. The
0918   //  driver converts this to an SQL VARCHAR or LONGVARCHAR value
0919   //  (depending on the argument's size relative to the driver's
0920   //  limits on VARCHARs) when it sends it to the database.
0921   //
0922   //   Parameters:
0923   //         parameterIndex - the first parameter is 1, 
0924   //                          the second is 2, ...
0925   //         x - the parameter value
0926   //   Throws:
0927   //         TSQLException - if a database access error occurs
0928    
0929   if(!fImp) { Destroyed();   return; } 
0930   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
0931    
0932   try {
0933     imp->setString( parameterIndex, ODBCXX_STRING_C(x.Data()) );
0934 
0935   } catch(odbc::SQLException& e) {
0936     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0937                   ODBCXX_STRING_CSTR(e.getSQLState()),
0938                   e.getErrorCode()) );
0939   }
0940 }
0941 
0942 //___________________________________________________________________
0943 void ODBCCallableStatement::SetBytes( Int_t parameterIndex,
0944                                       const TArrayC& x )
0945 {
0946   // Sets the designated parameter to a  array of bytes. The
0947   // driver converts this to an SQL VARBINARY or LONGVARBINARY
0948   // (depending on the argument's size relative to the driver's
0949   // limits on VARBINARYs) when it sends it to the database.
0950   //
0951   //   Parameters:
0952   //         parameterIndex - the first parameter is 1, 
0953   //                          the second is 2, ...
0954   //         x - the parameter value
0955   //   Throws:
0956   //         TSQLException - if a database access error occurs
0957 
0958   if(!fImp) { Destroyed();   return; } 
0959   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
0960    
0961   try {
0962     imp->setBytes( parameterIndex,
0963            ODBCXX_BYTES_C(x.GetArray(),x.GetSize()) );
0964 
0965   } catch(odbc::SQLException& e) {
0966     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0967                   ODBCXX_STRING_CSTR(e.getSQLState()),
0968                   e.getErrorCode()) );
0969   }
0970 }
0971 
0972 //___________________________________________________________________
0973 void ODBCCallableStatement::SetDate( Int_t parameterIndex,
0974                                      const TSQLDate& x )
0975 {
0976   //  Sets the designated parameter to a TSQLDate value. The
0977   //  driver converts this to an SQL DATE value when it sends it
0978   //  to the database.
0979   //
0980   //   Parameters:
0981   //         parameterIndex - the first parameter is 1, 
0982   //                          the second is 2, ...
0983   //         x - the parameter value
0984   //   Throws:
0985   //         TSQLException - if a database access error occurs
0986    
0987   if(!fImp) { Destroyed();   return; } 
0988   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
0989    
0990   try {
0991     odbc::Date dt( x.GetYear(),
0992            x.GetMonth(),
0993            x.GetDay() );
0994 
0995     imp->setDate(parameterIndex,dt);
0996 
0997   } catch(odbc::SQLException& e) {
0998     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
0999                   ODBCXX_STRING_CSTR(e.getSQLState()),
1000                   e.getErrorCode()) );
1001   }
1002 }
1003 
1004 //___________________________________________________________________
1005 void ODBCCallableStatement::SetTime( Int_t parameterIndex,
1006                                      const TSQLTime& x )
1007 {
1008   // Sets the designated parameter to a TSQLTime value. The
1009   // driver converts this to an SQL TIME value when it sends it
1010   // to the database.
1011   //
1012   //   Parameters:
1013   //         parameterIndex - the first parameter is 1, 
1014   //                          the second is 2, ...
1015   //         x - the parameter value
1016   //   Throws:
1017   //         TSQLException - if a database access error occurs
1018    
1019   if(!fImp) { Destroyed();   return; } 
1020   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
1021    
1022   try {
1023     odbc::Time tm( x.GetHour(),
1024            x.GetMinute(),
1025            x.GetSecond() );
1026 
1027     imp->setTime(parameterIndex,tm);
1028 
1029   } catch(odbc::SQLException& e) {
1030     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1031                   ODBCXX_STRING_CSTR(e.getSQLState()),
1032                   e.getErrorCode()) );
1033   }
1034 }
1035 
1036 //___________________________________________________________________
1037 void ODBCCallableStatement::SetTimestamp( Int_t parameterIndex,
1038                                           const TSQLTimestamp& x )
1039 {
1040   // Sets the designated parameter to a TSQLTimestamp value.
1041   // The driver converts this to an SQL TIMESTAMP value when it
1042   // sends it to the database.
1043   //
1044   //   Parameters:
1045   //         parameterIndex - the first parameter is 1,
1046   //                          the second is 2, ...
1047   //         x - the parameter value
1048   //   Throws:
1049   //         TSQLException - if a database access error occurs
1050    
1051   if(!fImp) { Destroyed();   return; } 
1052   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
1053    
1054   try {
1055     odbc::Timestamp tmstmp( x.GetYear(),
1056                 x.GetMonth(),
1057                 x.GetDay(),
1058                 x.GetHour(),
1059                 x.GetMinute(),
1060                 x.GetSecond(),
1061                 x.GetNanos() );
1062 
1063     imp->setTimestamp(parameterIndex,tmstmp);
1064 
1065   } catch(odbc::SQLException& e) {
1066     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1067                   ODBCXX_STRING_CSTR(e.getSQLState()),
1068                   e.getErrorCode()) );
1069   }
1070 }
1071 
1072 //___________________________________________________________________
1073 void ODBCCallableStatement::SetAsciiStream( Int_t parameterIndex,
1074                                             TBuffer* x,
1075                                             Int_t length )
1076 {
1077   // Sets the designated parameter to the given input stream,
1078   // which will have the specified number of bytes. When a very
1079   // large ASCII value is input to a LONGVARCHAR parameter, it
1080   // may be more practical to send it via a TBuffer
1081   // will read the data from the stream as needed, until it
1082   // reaches end-of-file. The  driver will do any necessary
1083   // conversion from ASCII to the database char format. 
1084   //
1085   //    Parameters:
1086   //          parameterIndex - the first parameter is 1, 
1087   //                           the second is 2, ...
1088   //          x - the  input stream that contains the ASCII
1089   //              parameter value
1090   //          length - the number of bytes in the stream,
1091   //                   total size of buffer is by default. 
1092   //    Throws:
1093   //          TSQLException - if a database access error occurs
1094 
1095   if(!fImp) { Destroyed();   return; } 
1096   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
1097    
1098   try {
1099     Int_t xl = x->BufferSize()>length ? length : x->BufferSize();
1100     std::istringstream* s = new std::istringstream( x->Buffer() ); 
1101     imp->setAsciiStream( parameterIndex,(std::istream*)s,xl ); 
1102 
1103   } catch(odbc::SQLException& e) {
1104     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1105                   ODBCXX_STRING_CSTR(e.getSQLState()),
1106                   e.getErrorCode()) );
1107   }
1108 }
1109 
1110 //___________________________________________________________________
1111 void ODBCCallableStatement::SetBinaryStream( Int_t parameterIndex,
1112                                              TBuffer* x,
1113                                              Int_t length )
1114 {
1115   // Sets the designated parameter to the given input stream,
1116   // which will have the specified number of bytes. When a very
1117   // large binary value is input to a LONGVARBINARY parameter, it
1118   // may be more practical to send it via a TBuffer.
1119   // will read the data from the stream as needed, until it
1120   // reaches end-of-file. 
1121   //
1122   //   Parameters:
1123   //         parameterIndex - the first parameter is 1, 
1124   //                          the second is 2, ...
1125   //         x - the input tream which contains the binary
1126   //                  parameter value
1127   //         length - the number of bytes in the stream
1128   //                   total size of buffer is by default. 
1129   //   Throws:
1130   //         TSQLException - if a database access error occurs
1131 
1132   if(!fImp) { Destroyed();   return; } 
1133   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
1134    
1135   try {
1136     Int_t xl = x->BufferSize()>length ? length : x->BufferSize();
1137     std::string a(x->Buffer(),xl);
1138     std::istream* s = new std::istringstream(a);
1139     imp->setBinaryStream( parameterIndex,s,xl );
1140 
1141   } catch(odbc::SQLException& e) {
1142     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1143                   ODBCXX_STRING_CSTR(e.getSQLState()),
1144                   e.getErrorCode()) );
1145   }
1146 }
1147 
1148 //___________________________________________________________________
1149 void ODBCCallableStatement::SetObject( Int_t parameterIndex,TObject* x )
1150 {
1151   // Sets the designated parameter to the given ROOT object
1152   //
1153   //   Parameters:
1154   //         parameterIndex - the first parameter is 1, 
1155   //                          the second is 2, ...
1156   //         x - the ROOT object
1157   //   Throws:
1158   //         TSQLException - if a database access error occurs
1159 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,0)
1160   TBuffer *b = new TBufferFile(TBuffer::kWrite);
1161 #else
1162   TBuffer *b = new TBuffer(TBuffer::kWrite);
1163 #endif
1164   b->WriteObject(x);
1165   SetBinaryStream(parameterIndex,b,b->BufferSize());
1166   b->DetachBuffer();
1167   delete b;
1168 }
1169 
1170 //___________________________________________________________________
1171 void ODBCCallableStatement::ClearParameters()
1172 {
1173   // Clears the current parameter values immediately. 
1174   //
1175   //  In general, parameter values remain in force for repeated
1176   //  use of a TSQLStatement. Setting a parameter value 
1177   //  automatically clears its previous value. However, in some 
1178   //  cases it is useful to immediately release the resources used 
1179   //  by the current parameter values; this can be done by calling
1180   //  ClearParameters().
1181   //   
1182   //   Throws:
1183   //         TSQLException - if a database access error occurs
1184    
1185   if(!fImp) { Destroyed();   return; } 
1186   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
1187    
1188   try {
1189     imp->clearParameters();
1190 
1191   } catch(odbc::SQLException& e) {
1192     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1193                   ODBCXX_STRING_CSTR(e.getSQLState()),
1194                   e.getErrorCode()) );
1195   }
1196 }
1197 
1198 ////////////////// include from ODBCStatement.cxx ///////////////////
1199 //___________________________________________________________________
1200 TSQLResultSet* ODBCCallableStatement::ExecuteQuery( const TString& sql )
1201 {
1202   // Executes a SQL statement that returns a single TSQLResultSet
1203   //
1204   // This method also implicitly closes current TSQLResultSet 
1205   //
1206   // Returns:
1207   //       a TSLResultSet that contains the data produced by the query; 
1208   //       NULL - in case of error
1209   //
1210   //   Throws:
1211   //       TSQLException - if a database access error occurs
1212 
1213   if(!fImp) { Destroyed(); return 0; }
1214   odbc::Statement* stmt = (odbc::Statement*)fImp;
1215   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;  
1216   odbc::ResultSet* rs = 0; 
1217   ClearWarnings();
1218 
1219   if(fCurrentResult)  delete fCurrentResult;
1220 
1221   try {
1222     if(!sql.IsNull()) {
1223       rs = stmt->executeQuery(ODBCXX_STRING_C(sql.Data()));
1224     } else {
1225       rs = imp->executeQuery();
1226     } 
1227   } catch(odbc::SQLException& e) {
1228     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1229                   ODBCXX_STRING_CSTR(e.getSQLState()),
1230                   e.getErrorCode()) );
1231     if(rs) delete rs;
1232     fCurrentResult = 0;
1233     return 0;
1234   }
1235    
1236   return fCurrentResult = new ODBCResultSet(this,(void*)rs);;
1237 }
1238 
1239 //___________________________________________________________________
1240 Bool_t ODBCCallableStatement::Execute( const TString& sql )
1241 {
1242   // Executes a SQL statement that may return multiple results.
1243   // Under some (uncommon) situations a single SQL statement may 
1244   // return multiple result sets and/or update counts. Normally you 
1245   // can ignore this unless you are (1) executing a stored
1246   // procedure that you know may return multiple results or (2) you 
1247   // are dynamically executing an unknown SQL string. The methods 
1248   // execute, GetMoreResults(), GetResultSet(), and GetUpdateCount()
1249   // let you navigate through multiple results.
1250   //  The execute method executes a SQL statement and indicates the 
1251   // form of the first result. You can then use GetResultSet() or
1252   // GetUpdateCount() to retrieve the result, and GetMoreResults() 
1253   // to move to any subsequent result(s).
1254   //
1255   // Parameters:
1256   //          sql - any SQL statement
1257   // Returns:
1258   //          kTRUE if the next result is a TSQLResultSet; 
1259   //          kFALSE if it is an update count or there are no more
1260   //          results
1261   // Throws:
1262   //            TSQLException - if a database access error occurs
1263   // See Also: 
1264   //       GetResultSet(), GetUpdateCount(), GetMoreResults()
1265   
1266   if(!fImp) { Destroyed(); return kFALSE; }
1267 
1268   Bool_t return_value = kFALSE;
1269   ClearWarnings();
1270   odbc::Statement* stmt = (odbc::Statement*)fImp;
1271   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
1272  
1273   try {
1274     if(!sql.IsNull()) {
1275       return_value = (Bool_t)stmt->execute(ODBCXX_STRING_C(sql.Data()));
1276     } else {
1277       return_value = (Bool_t)imp->execute();
1278     } 
1279   } catch(odbc::SQLException& e) {
1280     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1281                   ODBCXX_STRING_CSTR(e.getSQLState()),
1282                   e.getErrorCode()) );
1283     return_value = kFALSE;
1284   }
1285   return return_value;
1286 }
1287 
1288 //___________________________________________________________________
1289 Int_t ODBCCallableStatement::ExecuteUpdate( const TString& sql )
1290 {
1291   // Executes an SQL INSERT, UPDATE or DELETE statement. 
1292   // In addition, SQL statements that return nothing, 
1293   // such as SQL DDL statements, can be executed.
1294   //
1295   //  Parameters:
1296   //      sql - a SQL INSERT, UPDATE or DELETE statement or 
1297   //            a SQL statement that  returns nothing
1298   //
1299   //  Returns:
1300   //      either the row count for INSERT, UPDATE or DELETE or 
1301   //      0 for SQL statements that return nothing
1302   //  Throws:
1303   //      TSQLException - if a database access error occurs
1304    
1305   if(!fImp) { Destroyed(); return 0; }
1306 
1307   Int_t return_value = 0;
1308   ClearWarnings();
1309   odbc::Statement* stmt = (odbc::Statement*)fImp;
1310   odbc::PreparedStatement* imp = (odbc::PreparedStatement*)fImp;
1311 
1312   try {
1313     if(!sql.IsNull()) {
1314       return_value = (Bool_t)stmt->executeUpdate(ODBCXX_STRING_C(sql.Data()));
1315     } else {
1316       return_value = (Bool_t)imp->executeUpdate();
1317     } 
1318   } catch(odbc::SQLException& e) {
1319     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1320                   ODBCXX_STRING_CSTR(e.getSQLState()),
1321                   e.getErrorCode()) );
1322     return_value = 0;
1323   }
1324   return return_value;
1325 }
1326 
1327 //___________________________________________________________________
1328 TSQLResultSet* ODBCCallableStatement::GetResultSet()
1329 {
1330   // Returns the current result as a TSQLResultSet object. 
1331   // This method should be called only once per result.
1332   //
1333   // This method also implicitly closes any current TSQLResultSet 
1334   //   
1335   // Returns:
1336   //       the current result as a TSQLResultSet; null if the result 
1337   //       is an update count or there are no more results
1338   // Throws:
1339   //       TSQLException - if a database access error occurs
1340   // See Also: 
1341   //       Execute(const TString&)
1342    
1343   if(!fImp) { Destroyed(); return 0; }
1344   odbc::ResultSet* rs = 0;
1345   odbc::Statement* stmt = (odbc::Statement*)fImp;
1346 
1347   if(fCurrentResult)  delete fCurrentResult;
1348 
1349   try {     
1350     rs = stmt->getResultSet(); 
1351   } catch(odbc::SQLException& e) {
1352     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1353                   ODBCXX_STRING_CSTR(e.getSQLState()),
1354                   e.getErrorCode()) );
1355     if(rs) delete rs;
1356     fCurrentResult = 0;
1357     return 0;
1358   }
1359 
1360   return fCurrentResult = new ODBCResultSet(this,(void*)rs); 
1361 }   
1362 
1363 //___________________________________________________________________
1364 Int_t ODBCCallableStatement::GetUpdateCount()
1365 {
1366   // Returns the current result as an update count; 
1367   // if there are no more results, -1 is returned.
1368   // This method should be called only once per result.
1369   //
1370   // Returns:
1371   //       the current result as an update count; -1 if it is a 
1372   //       TSQLResultSet or there are no more results
1373   // Throws:
1374   //       TSQLException - if a database access error occurs
1375   // See Also: 
1376   //       Execute(const TString&)
1377    
1378   if(!fImp) { Destroyed(); return 0; }
1379 
1380   Int_t return_value = 0;
1381   odbc::Statement* stmt = (odbc::Statement*)fImp;
1382       
1383   try {
1384     return_value = stmt->getUpdateCount();
1385   } catch(odbc::SQLException& e) {
1386     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1387                   ODBCXX_STRING_CSTR(e.getSQLState()),
1388                   e.getErrorCode()) );
1389     return  0;
1390   }
1391   return return_value;
1392 }
1393 
1394 //___________________________________________________________________
1395 Bool_t ODBCCallableStatement::GetMoreResults()
1396 {
1397   // Moves to a ODBCStatement's next result. It returns kTRUE if 
1398   // this result is a TSQLResultSet. 
1399   // 
1400   // There are no more results when 
1401   //       (!GetMoreResults() && (GetUpdateCount() == -1)
1402   //
1403   // Returns:
1404   //    kTRUE if the next result is a TSQLResultSet; 
1405   //    kFALSE if it is an update count or there are no more results
1406   //
1407   // Throws:
1408   //       TSQLException - if a database access error occurs
1409   // See Also: 
1410   //       Execute(const TString&)
1411 
1412   Bool_t return_value = kFALSE;
1413    
1414   if(!fImp) { Destroyed(); return return_value; }
1415   odbc::Statement* stmt = (odbc::Statement*)fImp;
1416       
1417   try {
1418     return_value = (Bool_t)stmt->getMoreResults();      
1419   } catch(odbc::SQLException& e) {
1420     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1421                   ODBCXX_STRING_CSTR(e.getSQLState()),
1422                   e.getErrorCode()) );
1423     return  kFALSE;
1424   }
1425   return return_value;
1426 }
1427 
1428 //___________________________________________________________________
1429 Int_t ODBCCallableStatement::GetMaxFieldSize()
1430 {
1431   // Returns the maximum number of bytes allowed for any column 
1432   // value. This limit is the maximum number of bytes that can be
1433   // returned for any column value. The limit applies only to 
1434   // kBINARY, kVARBINARY, kLONGVARBINARY, kCHAR, kVARCHAR, and 
1435   // kLONGVARCHAR columns (see TSQLTypes.h). If the limit is exceeded, 
1436   // the excess data  is silently discarded.
1437   //
1438   // Returns:
1439   //    the current max column size limit; zero means unlimited
1440   // Throws:
1441   //    TSQLException - if a database access error occurs
1442 
1443   if(!fImp) { Destroyed(); return 0; }
1444 
1445   Int_t return_value = 0;
1446   odbc::Statement* stmt = (odbc::Statement*)fImp;
1447    
1448   try {
1449     return_value = stmt->getMaxFieldSize();
1450   } catch(odbc::SQLException& e) {
1451     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1452                   ODBCXX_STRING_CSTR(e.getSQLState()),
1453                   e.getErrorCode()) );
1454     return 0;
1455   }
1456   return return_value;
1457 }
1458 
1459 //___________________________________________________________________
1460 void ODBCCallableStatement::SetMaxFieldSize( Int_t max )
1461 {
1462   // Sets the limit for the maximum number of bytes in a column to 
1463   // the given number of bytes. This is the maximum number of bytes 
1464   // that can be returned for any column value. This limit applies 
1465   // only to kBINARY, kVARBINARY, kLONGVARBINARY, kCHAR, kVARCHAR,
1466   // and kLONGVARCHAR fields (see TSQLTypes.h) . If the limit is exceeded, 
1467   // the excess  data is silently discarded. For maximum portability, 
1468   // use values greater than 256.
1469   //
1470   // Parameters:
1471   //       max - the new max column size limit; zero means unlimited
1472   // Throws:
1473   //       TSQLException - if a database access error occurs
1474    
1475   if(!fImp) { Destroyed(); return; }
1476   odbc::Statement* stmt = (odbc::Statement*)fImp;
1477    
1478   try {
1479     stmt->setMaxFieldSize(max);   
1480   } catch(odbc::SQLException& e) {
1481     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1482                   ODBCXX_STRING_CSTR(e.getSQLState()),
1483                   e.getErrorCode()) );
1484   }
1485 }
1486 
1487 //___________________________________________________________________
1488 Int_t ODBCCallableStatement::GetMaxRows()
1489 {
1490   // Retrieves the maximum number of rows that a TSQLResultSet can 
1491   // contain. If the limit is exceeded, the excess rows are silently 
1492   // dropped.
1493   //
1494   // Returns:
1495   //       the current max row limit; zero means unlimited
1496   // Throws:
1497   //       TSQLException - if a database access error occurs
1498 
1499   if(!fImp) { Destroyed(); return 0; }
1500 
1501   Int_t return_value = 0;
1502   odbc::Statement* stmt = (odbc::Statement*)fImp;
1503    
1504   try {
1505     return_value = stmt->getMaxRows();
1506   } catch(odbc::SQLException& e) {
1507     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1508                   ODBCXX_STRING_CSTR(e.getSQLState()),
1509                   e.getErrorCode()) );
1510     return 0;
1511   }
1512   return return_value;
1513 }
1514 
1515 //___________________________________________________________________
1516 void ODBCCallableStatement::SetMaxRows( Int_t max )
1517 {
1518   // Sets the limit for the maximum number of rows that any 
1519   // TSQLResultSet can contain to the given number. If the limit is 
1520   // exceeded, the excess rows are silently dropped.
1521   //
1522   // Parameters:
1523   //       max - the new max rows limit; zero means unlimited
1524   // Throws:
1525   //       TSQLException - if a database access error occurs
1526    
1527   if(!fImp) { Destroyed(); return; }
1528   odbc::Statement* stmt = (odbc::Statement*)fImp;
1529    
1530   try {
1531     stmt->setMaxRows(max);  
1532   } catch(odbc::SQLException& e) {
1533     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1534                   ODBCXX_STRING_CSTR(e.getSQLState()),
1535                   e.getErrorCode()) );
1536   }
1537 }
1538 
1539 //___________________________________________________________________
1540 void ODBCCallableStatement::SetEscapeProcessing( Bool_t enable )
1541 {
1542   // Sets escape processing on or off. If escape scanning is on 
1543   // (the default), the driver will do escape substitution before 
1544   // sending the SQL to the database.
1545   // 
1546   // Note:
1547   //    Since prepared statements have usually been parsed prior to 
1548   //    making this call, disabling escape processing for prepared 
1549   //    statements will have no effect.
1550   //
1551   // Parameters:
1552   //       enable - kTRUE to enable; kFALSE to disable
1553   // Throws:
1554   //       TSQLException - if a database access error occurs
1555    
1556   if(!fImp) { Destroyed(); return; }
1557   odbc::Statement* stmt = (odbc::Statement*)fImp;
1558    
1559   try {
1560     stmt->setEscapeProcessing(enable);
1561   } catch(odbc::SQLException& e) {
1562     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1563                   ODBCXX_STRING_CSTR(e.getSQLState()),
1564                   e.getErrorCode()) );
1565   }
1566 }
1567 
1568 //___________________________________________________________________
1569 Bool_t ODBCCallableStatement::GetEscapeProcessing()
1570 {
1571   //  Returns if escape processing is on or off. 
1572   // If escape scanning is on (the default), the driver will do escape 
1573   // substitution before  sending the SQL to the database.
1574   // 
1575   // Note:
1576   //    Since prepared statements have usually been parsed prior to 
1577   //    making this call, disabling escape processing for prepared 
1578   //    statements will have no effect.
1579   //
1580   // Parameters:
1581   //       enable - kTRUE to enable; kFALSE to disable
1582   // Throws:
1583   //       TSQLException - if a database access error occurs
1584 
1585   if(!fImp) { Destroyed(); return kFALSE; }   
1586 
1587   Bool_t return_value = kFALSE;
1588   odbc::Statement* stmt = (odbc::Statement*)fImp;
1589    
1590   try {
1591     return_value = stmt->getEscapeProcessing();
1592   } catch(odbc::SQLException& e) {
1593     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1594                   ODBCXX_STRING_CSTR(e.getSQLState()),
1595                   e.getErrorCode()) );
1596     return kFALSE;
1597   }
1598   return return_value;
1599 }
1600 
1601 //___________________________________________________________________
1602 Int_t ODBCCallableStatement::GetQueryTimeout()
1603 {
1604   // Retrieves the number of seconds the driver will wait for a
1605   // ODBCStatement to execute. If the limit is exceeded, a 
1606   // TSQLException is thrown.
1607   //
1608   // Returns:
1609   //    the current query timeout limit in seconds; zero means
1610   //    unlimited
1611   // Throws:
1612   //    TSQLException - if a database access error occurs
1613    
1614   Int_t return_value = 0;
1615    
1616   if(!fImp) { Destroyed(); return return_value; }
1617   odbc::Statement* stmt = (odbc::Statement*)fImp;
1618       
1619   try {
1620     return_value = stmt->getQueryTimeout();
1621   } catch(odbc::SQLException& e) {
1622     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1623                   ODBCXX_STRING_CSTR(e.getSQLState()),
1624                   e.getErrorCode()) );
1625     return 0;
1626   }
1627   return return_value;
1628 }
1629 
1630 //___________________________________________________________________
1631 void ODBCCallableStatement::SetQueryTimeout( Int_t seconds )
1632 {
1633   // Sets the number of seconds the driver will wait for a 
1634   // ODBCStatement to execute to the given number of seconds. 
1635   // If the limit is exceeded, a TSQLException is thrown.
1636   //
1637   // Parameters:
1638   //          seconds - the new query timeout limit in seconds; 
1639   //          zero means unlimited
1640   // Throws:
1641   //          TSQLException - if a database access error occurs
1642    
1643   if(!fImp) { Destroyed(); return; }
1644   odbc::Statement* stmt = (odbc::Statement*)fImp;
1645    
1646   try {
1647     stmt->setQueryTimeout(seconds);
1648   } catch(odbc::SQLException& e) {
1649     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1650                   ODBCXX_STRING_CSTR(e.getSQLState()),
1651                   e.getErrorCode()) );
1652   }
1653 }
1654 
1655 //___________________________________________________________________
1656 void ODBCCallableStatement::Cancel() 
1657 {
1658   // Cancels this statement object if both the DBMS and driver 
1659   // support aborting an SQL statement. This method can be used by 
1660   // one thread to cancel a statement that is being executed by 
1661   // another thread.
1662   //
1663   // Throws:
1664   //       TSQLException - if a database access error occurs
1665    
1666   if(!fImp) { Destroyed(); return; }
1667   odbc::Statement* stmt = (odbc::Statement*)fImp;
1668    
1669   try {
1670     stmt->cancel();
1671   } catch(odbc::SQLException& e) {
1672     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1673                   ODBCXX_STRING_CSTR(e.getSQLState()),
1674                   e.getErrorCode()) );
1675   }
1676 }
1677 
1678 //___________________________________________________________________
1679 void ODBCCallableStatement::Close()
1680 {
1681   // Avoid using this method. Use delete ODBCStatement instead.
1682   //
1683   //  Note: When a ODBCStatement is closed, its current 
1684   //       TSQLResultSet,  if one exists, is also closed.
1685   //
1686   //     Throws:
1687   //      TSQLException - if a database access error occurs
1688    
1689   if(!fImp) { Destroyed(); return; }
1690           
1691   try {    
1692     if(fCurrentResult)  { 
1693       delete fCurrentResult;
1694       fCurrentResult = 0;
1695     }
1696     ClearBatch();
1697     SafeDelete(fBatches);
1698 
1699     odbc::Statement* imp = (odbc::Statement*)fImp;
1700     if(imp) delete  imp;
1701   } catch(odbc::SQLException& e) {
1702     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1703                   ODBCXX_STRING_CSTR(e.getSQLState()),
1704                   e.getErrorCode()) );
1705   }
1706   fImp = 0;
1707   Destroyed();
1708 }
1709 
1710 //___________________________________________________________________
1711 void ODBCCallableStatement::SetCursorName( const TString& name )
1712 {
1713   // Defines the SQL cursor name that will be used by subsequent
1714   // ODBCStatement execute methods. This name can then be used in 
1715   // SQL positioned update/delete statements to identify the 
1716   // current row in the TSQLResultSet generated by this statement. 
1717   // If the database doesn't support positioned update/delete, 
1718   // this method is a noop. To insure that a cursor has the proper 
1719   // isolation level to support updates, the cursor's SELECT 
1720   // statement should be of the form 'SELECT FOR UPDATE ...'. If
1721   // the 'FOR UPDATE' phrase is omitted, positioned updates may 
1722   // fail. 
1723   //
1724   // Note: By definition, positioned update/delete execution must 
1725   //    be done by a different ODBCStatement than the one which 
1726   //    generated the TSQLResultSet being used for positioning.
1727   //    Also, cursor names must be unique within a connection.
1728   //
1729   // Parameters:
1730   //       name - the new cursor name, which must be unique within
1731   //       a connection
1732   // Throws:
1733   //       TSQLException - if a database access error occurs
1734    
1735   if(!fImp) { Destroyed(); return; }
1736   odbc::Statement* stmt = (odbc::Statement*)fImp;
1737    
1738   try {
1739     stmt->setCursorName(ODBCXX_STRING_C(name.Data()));
1740   } catch(odbc::SQLException& e) {
1741     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1742                   ODBCXX_STRING_CSTR(e.getSQLState()),
1743                   e.getErrorCode()) );
1744   }
1745 }
1746 
1747 //___________________________________________________________________
1748 void ODBCCallableStatement::SetFetchDirection( Int_t /* direction */ )
1749 {
1750   // Gives the driver a hint as to the direction in which the
1751   // rows in a result set will be processed. The hint applies only 
1752   // to result sets created using this statement object. 
1753   // The default value is TSQLResultSet::kTYPE_FORWARD_ONLY
1754   //
1755   // Note that this method sets the default fetch direction for 
1756   // result sets generated by this statement object.
1757   //
1758   // Parameters:
1759   //    direction - the initial direction for processing rows
1760   // Throws:
1761   //    TSQLException - if a database access error occurs or the 
1762   //                   given direction is not one of 
1763   // 
1764    
1765   if(!fImp) { Destroyed(); return; }
1766 }
1767 
1768 //___________________________________________________________________
1769 Int_t ODBCCallableStatement::GetFetchDirection()
1770 {
1771   // Retrieves the direction for fetching rows from database
1772   // tables that is the default for result sets generated from this 
1773   // statement object. If this statement object has not set 
1774   // a fetch direction by calling the method SetFetchDirection(), 
1775   // the return value is implementation-specific.
1776   //
1777   // Returns:
1778   //       the default fetch direction for result sets generated 
1779   //       from this statement object
1780   // Throws:
1781   //       TSQLException - if a database access error occurs
1782 
1783   return 0;
1784 }
1785 
1786 //___________________________________________________________________
1787 void ODBCCallableStatement::SetFetchSize( Int_t /* rows */ )
1788 {
1789   // Gives the driver a hint as to the number of rows that
1790   // should be fetched from the database when more rows are needed. 
1791   // The number of rows specified affects only result sets created 
1792   // using this statement. If the value specified is zero, then the
1793   // hint is ignored. The default value is zero.
1794   //
1795   // Parameters:
1796   //       rows - the number of rows to fetch
1797   // Throws:
1798   //       TSQLException - if a database access error occurs, or 
1799   //       the condition 0 <= rows <= GetMaxRows() is not satisfied.
1800    
1801   if(!fImp) { Destroyed(); return; }
1802 }
1803 
1804 //___________________________________________________________________
1805 Int_t ODBCCallableStatement::GetFetchSize()
1806 {
1807   // Retrieves the number of result set rows that is the default 
1808   // fetch size for result sets generated from this ODBCStatement 
1809   // object. If this statement object has not set a fetch size
1810   // by calling the method SetFetchSize(), the return value is
1811   // implementation-specific.
1812   //
1813   // Returns:
1814   //       the default fetch size for result sets generated from 
1815   //       this statement object
1816   // Throws:
1817   //       TSQLException - if a database access error occurs
1818    
1819   Int_t return_value = 0;
1820    
1821   if(!fImp) { Destroyed(); return return_value; }
1822   odbc::Statement* stmt = (odbc::Statement*)fImp;
1823    
1824   try {
1825     return_value = stmt->getFetchSize();
1826   } catch(odbc::SQLException& e) {
1827     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1828                   ODBCXX_STRING_CSTR(e.getSQLState()),
1829                   e.getErrorCode()) );
1830     return 0;
1831   }
1832   return return_value;
1833 }
1834 
1835 //___________________________________________________________________
1836 Int_t ODBCCallableStatement::GetResultSetConcurrency()
1837 {
1838   // Retrieves the result set concurrency.
1839   //
1840   // enum EResultSetConcurrency{
1841   //       kCONCUR_READ_ONLY,
1842   //       kCONCUR_UPDATABLE
1843   //    };
1844 
1845   Int_t return_value = 0;
1846    
1847   if(!fImp) { Destroyed(); return return_value; }
1848   odbc::Statement* stmt = (odbc::Statement*)fImp;
1849    
1850   try {
1851     return_value = stmt->getResultSetConcurrency();
1852   } catch(odbc::SQLException& e) {
1853     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1854                   ODBCXX_STRING_CSTR(e.getSQLState()),
1855                   e.getErrorCode()) );
1856     return 0;
1857   }   
1858   return return_value;
1859 }
1860 
1861 //___________________________________________________________________
1862 Int_t ODBCCallableStatement::GetResultSetType()
1863 {
1864   // Determine the result set type.
1865   //
1866   // enum EResultSetType{
1867   //       kTYPE_FORWARD_ONLY,
1868   //       kTYPE_SCROLL_INSENSITIVE,
1869   //       kTYPE_SCROLL_SENSITIVE
1870   //       };
1871   //
1872      
1873   Int_t return_value = 0;
1874    
1875   if(!fImp) { Destroyed(); return return_value; }
1876   odbc::Statement* stmt = (odbc::Statement*)fImp;
1877    
1878   try {
1879     return_value = stmt->getResultSetType(); 
1880   } catch(odbc::SQLException& e) {
1881     Throw( new TSQLException( ODBCXX_STRING_CSTR(e.getMessage()),
1882                   ODBCXX_STRING_CSTR(e.getSQLState()),
1883                   e.getErrorCode()) );
1884     return 0;
1885   }
1886   return return_value;
1887 }
1888 
1889 //___________________________________________________________________
1890 void ODBCCallableStatement::AddBatch( const TString& /* sql */ )
1891 {
1892   // Adds a SQL command to the current batch of commmands for
1893   // the statement. This method is optional.
1894   //
1895   // Parameters:
1896   //       sql - typically this is a static SQL INSERT or UPDATE 
1897   //       statement
1898   // Throws:
1899   //       TSQLException - if a database access error occurs, or 
1900   //       the  driver does not support batch statements
1901 
1902 }
1903 
1904 //___________________________________________________________________
1905 void ODBCCallableStatement::ClearBatch()
1906 {
1907   // Makes the set of commands in the current batch empty. This
1908   // method is optional.
1909   //
1910   // Throws:
1911   //       TSQLException - if a database access error occurs or 
1912   //       the driver does not support batch statements
1913 
1914 }
1915 
1916 //___________________________________________________________________
1917 Int_t* ODBCCallableStatement::ExecuteBatch()
1918 {
1919   // Submits a batch of commands to the database for execution.
1920   // This method is optional.
1921   //
1922   // Returns:
1923   //       an array of update counts containing one element for 
1924   //       each command in the batch. The array is ordered 
1925   //       according  to the order in which commands were inserted 
1926   //       into the  batch.
1927   //
1928   // Throws:
1929   //       TSQLException - if a database access error occurs or 
1930   //       the driver  does not support batch statements
1931 
1932   return 0;
1933 }