diff --git a/mysql/inc/TMySQLServer.h b/mysql/inc/TMySQLServer.h index 34bfd53071c4784971511e6d8ad963e516e235d9..19cef734a5202d2244498369056e38720af95726 100644 --- a/mysql/inc/TMySQLServer.h +++ b/mysql/inc/TMySQLServer.h @@ -1,4 +1,4 @@ -// @(#)root/mysql:$Name: $:$Id: TMySQLServer.h,v 1.5 2006/05/22 08:55:30 brun Exp $ +// @(#)root/mysql:$Name: $:$Id: TMySQLServer.h,v 1.6 2006/06/02 14:02:03 brun Exp $ // Author: Fons Rademakers 15/02/2000 /************************************************************************* @@ -40,7 +40,7 @@ public: TSQLResult *Query(const char *sql); Bool_t Exec(const char* sql); TSQLStatement *Statement(const char *sql, Int_t = 100); - Bool_t IsSupportStatement() const { return kTRUE; } + Bool_t IsSupportStatement() const; Int_t SelectDataBase(const char *dbname); TSQLResult *GetDataBases(const char *wild = 0); TSQLResult *GetTables(const char *dbname, const char *wild = 0); diff --git a/mysql/inc/TMySQLStatement.h b/mysql/inc/TMySQLStatement.h index ab56c41285c68ea398e298093ba1af1e3a5f75b7..815affb994a58326a73b9aec21d3e7741bb13044 100644 --- a/mysql/inc/TMySQLStatement.h +++ b/mysql/inc/TMySQLStatement.h @@ -1,4 +1,4 @@ -// @(#)root/mysql:$Name: $:$Id: TMySQLStatement.h,v 1.2 2006/04/12 21:42:37 rdm Exp $ +// @(#)root/mysql:$Name: $:$Id: TMySQLStatement.h,v 1.3 2006/06/02 14:02:03 brun Exp $ // Author: Sergey Linev 6/02/2006 /************************************************************************* @@ -21,6 +21,12 @@ #include <sys/time.h> #endif #include <mysql.h> + +#if MYSQL_VERSION_ID < 40100 +typedef struct { int dummy; } MYSQL_STMT; +typedef struct { int dummy; } MYSQL_BIND; +#endif + #else struct MYSQL_STMT; struct MYSQL_BIND; @@ -64,7 +70,7 @@ private: void *BeforeSet(Int_t npar, Int_t sqltype, Bool_t sig = kTRUE, Int_t size = 0); public: - TMySQLStatement(MYSQL_STMT* stmt); + TMySQLStatement(MYSQL_STMT* stmt, Bool_t errout = kTRUE); virtual ~TMySQLStatement(); virtual void Close(Option_t * = ""); diff --git a/mysql/src/TMySQLServer.cxx b/mysql/src/TMySQLServer.cxx index 7a6145e13c1e59e22d24a5e2b613e56a63727257..aa1e96cd94716a0ac5bd4f8c6d832e17a347dc5b 100644 --- a/mysql/src/TMySQLServer.cxx +++ b/mysql/src/TMySQLServer.cxx @@ -1,4 +1,4 @@ -// @(#)root/mysql:$Name: $:$Id: TMySQLServer.cxx,v 1.10 2006/05/22 08:55:30 brun Exp $ +// @(#)root/mysql:$Name: $:$Id: TMySQLServer.cxx,v 1.11 2006/06/02 14:02:03 brun Exp $ // Author: Fons Rademakers 15/02/2000 /************************************************************************* @@ -306,6 +306,8 @@ TSQLTableInfo* TMySQLServer::GetTableInfo(const char* tablename) data_length = fields[nfield].length; if (data_length==0) data_length = -1; +#if MYSQL_VERSION_ID >= 40100 + switch (fields[nfield].type) { case MYSQL_TYPE_TINY: case MYSQL_TYPE_SHORT: @@ -364,6 +366,8 @@ TSQLTableInfo* TMySQLServer::GetTableInfo(const char* tablename) if (IS_NUM(fields[nfield].type)) sqltype = kSQL_NUMERIC; } + +#endif if (lst==0) lst = new TList; lst->Add(new TSQLColumnInfo(column_name, @@ -578,11 +582,30 @@ const char *TMySQLServer::ServerInfo() return res; } +//______________________________________________________________________________ +Bool_t TMySQLServer::IsSupportStatement() const +{ + // return kTRUE if TSQLStatement class is supported. + // Starts from MySQL 4.1 + +#if MYSQL_VERSION_ID < 40100 + return kFALSE; +#else + return kTRUE; +#endif +} + //______________________________________________________________________________ TSQLStatement* TMySQLServer::Statement(const char *sql, Int_t) { // Produce TMySQLStatement + +#if MYSQL_VERSION_ID < 40100 + ClearError(); + SetError(-1, "Statement class does not supported by MySQL version < 4.1", "Statement"); + return 0; +#else CheckConnect("Statement", 0); @@ -596,11 +619,14 @@ TSQLStatement* TMySQLServer::Statement(const char *sql, Int_t) CheckErrNo("Statement", kTRUE, 0); if (mysql_stmt_prepare(stmt, sql, strlen(sql))) { + SetError(mysql_errno(fMySQL), mysql_error(fMySQL), "Statement"); mysql_stmt_close(stmt); - CheckErrNo("Statement", kTRUE, 0); + return 0; } - return new TMySQLStatement(stmt); + return new TMySQLStatement(stmt, fErrorOut); + +#endif } //______________________________________________________________________________ @@ -611,8 +637,6 @@ Bool_t TMySQLServer::StartTransaction() CheckConnect("StartTransaction", kFALSE); return TSQLServer::StartTransaction(); - -// return Commit(); } //______________________________________________________________________________ @@ -621,11 +645,19 @@ Bool_t TMySQLServer::Commit() // Commit changes CheckConnect("Commit", kFALSE); + +#if MYSQL_VERSION_ID >= 40100 if (mysql_commit(fMySQL)) CheckErrNo("Commit", kTRUE, kFALSE); return kTRUE; + +#else + + return TSQLServer::Commit(); + +#endif } @@ -636,8 +668,17 @@ Bool_t TMySQLServer::Rollback() CheckConnect("Rollback", kFALSE); +#if MYSQL_VERSION_ID >= 40100 + if (mysql_rollback(fMySQL)) CheckErrNo("Rollback", kTRUE, kFALSE); return kTRUE; + +#else + + return TSQLServer::Rollback(); + +#endif + } diff --git a/mysql/src/TMySQLStatement.cxx b/mysql/src/TMySQLStatement.cxx index 46d81b7e507020a79c96dd05466bd1595f60da3f..e74478dee5ef1ff1d60fa0836c75286c50f5efd9 100644 --- a/mysql/src/TMySQLStatement.cxx +++ b/mysql/src/TMySQLStatement.cxx @@ -1,4 +1,4 @@ -// @(#)root/mysql:$Name: $:$Id: TMySQLStatement.cxx,v 1.2 2006/05/22 08:55:30 brun Exp $ +// @(#)root/mysql:$Name: $:$Id: TMySQLStatement.cxx,v 1.3 2006/06/02 14:02:03 brun Exp $ // Author: Sergey Linev 6/02/2006 /************************************************************************* @@ -23,9 +23,12 @@ ClassImp(TMySQLStatement) + +#if MYSQL_VERSION_ID >= 40100 + //______________________________________________________________________________ -TMySQLStatement::TMySQLStatement(MYSQL_STMT* stmt) : - TSQLStatement(), +TMySQLStatement::TMySQLStatement(MYSQL_STMT* stmt, Bool_t errout) : + TSQLStatement(errout), fStmt(stmt), fNumBuffers(0), fBind(0), @@ -34,7 +37,7 @@ TMySQLStatement::TMySQLStatement(MYSQL_STMT* stmt) : { // Normal constructor // Checks if statement contains parameters tags - + unsigned long paramcount = mysql_stmt_param_count(fStmt); if (paramcount>0) { @@ -56,7 +59,7 @@ TMySQLStatement::~TMySQLStatement() //______________________________________________________________________________ void TMySQLStatement::Close(Option_t *) { - // Close query result. + // Close statement if (fStmt) mysql_stmt_close(fStmt); @@ -720,3 +723,277 @@ Bool_t TMySQLStatement::SetString(Int_t npar, const char* value, Int_t maxsize) return kTRUE; } + + +#else + +//______________________________________________________________________________ +TMySQLStatement::TMySQLStatement(MYSQL_STMT*, Bool_t) +{ + // Normal constructor + // For MySQL version < 4.1 no statement is supported +} + +//______________________________________________________________________________ +TMySQLStatement::~TMySQLStatement() +{ + // destructor +} + +//______________________________________________________________________________ +void TMySQLStatement::Close(Option_t *) +{ + // Close statement +} + +//______________________________________________________________________________ +Bool_t TMySQLStatement::Process() +{ + // Process statement + + return kFALSE; +} + +//______________________________________________________________________________ +Int_t TMySQLStatement::GetNumAffectedRows() +{ + // Return number of affected rows after statement is processed + + return 0; +} + +//______________________________________________________________________________ +Int_t TMySQLStatement::GetNumParameters() +{ + // Return number of statement parameters + + return 0; +} + +//______________________________________________________________________________ +Bool_t TMySQLStatement::StoreResult() +{ + // Store result of statement processing to access them + // via GetInt(), GetDouble() and so on methods. + + return kFALSE; +} + +//______________________________________________________________________________ +Int_t TMySQLStatement::GetNumFields() +{ + // Return number of fields in result set + + return 0; +} + +//______________________________________________________________________________ +const char* TMySQLStatement::GetFieldName(Int_t) +{ + // Returns field name in result set + + return 0; +} + +//______________________________________________________________________________ +Bool_t TMySQLStatement::NextResultRow() +{ + // Shift cursor to nect row in result set + + return kFALSE; +} + + +//______________________________________________________________________________ +Bool_t TMySQLStatement::NextIteration() +{ + // Increment iteration counter for statement, where parameter can be set. + // Statement with parameters of previous iteration + // automatically will be applied to database + + return kFALSE; +} + +//______________________________________________________________________________ +void TMySQLStatement::FreeBuffers() +{ + // Release all buffers, used by statement +} + +//______________________________________________________________________________ +void TMySQLStatement::SetBuffersNumber(Int_t) +{ + // Allocate buffers for statement parameters/ result fields +} + +//______________________________________________________________________________ +const char* TMySQLStatement::ConvertToString(Int_t) +{ + // Convert field value to string + + return 0; +} + +//______________________________________________________________________________ +long double TMySQLStatement::ConvertToNumeric(Int_t) +{ + // Convert field to numeric value + + return 0; +} + +//______________________________________________________________________________ +Bool_t TMySQLStatement::IsNull(Int_t) +{ + // Checks if field value is null + + return kTRUE; +} + +//______________________________________________________________________________ +Int_t TMySQLStatement::GetInt(Int_t) +{ + // Return field value as integer + + return 0; +} + +//______________________________________________________________________________ +UInt_t TMySQLStatement::GetUInt(Int_t) +{ + // Return field value as unsigned integer + + return 0; +} + +//______________________________________________________________________________ +Long_t TMySQLStatement::GetLong(Int_t) +{ + // Return field value as long integer + + return 0; +} + +//______________________________________________________________________________ +Long64_t TMySQLStatement::GetLong64(Int_t) +{ + // Return field value as 64-bit integer + + return 0; +} + +//______________________________________________________________________________ +ULong64_t TMySQLStatement::GetULong64(Int_t) +{ + // Return field value as unsigned 64-bit integer + + return 0; +} + +//______________________________________________________________________________ +Double_t TMySQLStatement::GetDouble(Int_t) +{ + // Return field value as double + + return 0.; +} + +//______________________________________________________________________________ +const char *TMySQLStatement::GetString(Int_t) +{ + // Return field value as string + + return 0; +} + +//______________________________________________________________________________ +Bool_t TMySQLStatement::SetSQLParamType(Int_t, int, bool, int) +{ + // Set parameter type to be used as buffer + // Used in both setting data to database and retriving data from data base + // Initialize proper MYSQL_BIND structure and allocate required buffers + + return kFALSE; +} + +//______________________________________________________________________________ +void *TMySQLStatement::BeforeSet(Int_t, Int_t, Bool_t, Int_t) +{ + // Check boundary condition before setting value of parameter + // Return address of parameter buffer + + return 0; +} + +//______________________________________________________________________________ +Bool_t TMySQLStatement::SetNull(Int_t) +{ + // Set NULL as parameter value + // If NULL should be set for statement parameter during first iteration, + // one should call before proper Set... method to identify type of argument for + // the future. For instance, if one suppose to have double as type of parameter, + // code should look like: + // stmt->SetDouble(2, 0.); + // stmt->SetNull(2); + + return kFALSE; +} + +//______________________________________________________________________________ +Bool_t TMySQLStatement::SetInt(Int_t, Int_t) +{ + // Set parameter value as integer + + return kFALSE; +} + +//______________________________________________________________________________ +Bool_t TMySQLStatement::SetUInt(Int_t, UInt_t) +{ + // Set parameter value as unsigned integer + + return kFALSE; +} + +//______________________________________________________________________________ +Bool_t TMySQLStatement::SetLong(Int_t, Long_t) +{ + // Set parameter value as long integer + + return kFALSE; +} + +//______________________________________________________________________________ +Bool_t TMySQLStatement::SetLong64(Int_t, Long64_t) +{ + // Set parameter value as 64-bit integer + + return kFALSE; +} + +//______________________________________________________________________________ +Bool_t TMySQLStatement::SetULong64(Int_t, ULong64_t) +{ + // Set parameter value as unsigned 64-bit integer + + return kFALSE; +} + +//______________________________________________________________________________ +Bool_t TMySQLStatement::SetDouble(Int_t, Double_t) +{ + // Set parameter value as double + + return kFALSE; +} + +//______________________________________________________________________________ +Bool_t TMySQLStatement::SetString(Int_t, const char*, Int_t) +{ + // Set parameter value as string + + return kFALSE; +} + + +#endif // MYSQL_VERSION_ID > 40100 diff --git a/net/inc/TSQLStatement.h b/net/inc/TSQLStatement.h index b22d290110c9ea32a0bfc079ca3db2fed5bad3bc..153cc20f2754385e73661660a8e10e6dff2edde8 100644 --- a/net/inc/TSQLStatement.h +++ b/net/inc/TSQLStatement.h @@ -1,4 +1,4 @@ -// @(#)root/net:$Name: $:$Id: TSQLStatement.h,v 1.3 2006/05/24 15:10:46 brun Exp $ +// @(#)root/net:$Name: $:$Id: TSQLStatement.h,v 1.4 2006/06/02 14:02:03 brun Exp $ // Author: Sergey Linev 6/02/2006 /************************************************************************* @@ -22,10 +22,12 @@ class TSQLStatement : public TObject { protected: - TSQLStatement() : TObject() { ClearError(); } + TSQLStatement(Bool_t errout = kTRUE) : TObject(), fErrorCode(0), + fErrorMsg(), fErrorOut(errout) { ClearError(); } Int_t fErrorCode; // error code of last operation TString fErrorMsg; // error message of last operation + Bool_t fErrorOut; // enable error output void ClearError(); void SetError(Int_t code, const char* msg, const char* method = 0); @@ -67,6 +69,7 @@ public: virtual Bool_t IsError() const { return GetErrorCode()!=0; } virtual Int_t GetErrorCode() const; virtual const char* GetErrorMsg() const; + virtual void EnableErrorOutput(Bool_t on = kTRUE) { fErrorOut = on; } ClassDef(TSQLStatement, 0) //SQL statement }; diff --git a/net/src/TSQLServer.cxx b/net/src/TSQLServer.cxx index 6a558db2dfbd41ed1dfcb5401d07bff6074ea4d3..54fbdf7fd9eedbef07b3cde97ae69f9e75151fb1 100644 --- a/net/src/TSQLServer.cxx +++ b/net/src/TSQLServer.cxx @@ -1,4 +1,4 @@ -// @(#)root/net:$Name: $:$Id: TSQLServer.cxx,v 1.12 2006/06/02 15:00:18 rdm Exp $ +// @(#)root/net:$Name: $:$Id: TSQLServer.cxx,v 1.13 2006/06/22 08:18:57 brun Exp $ // Author: Fons Rademakers 25/11/99 /************************************************************************* @@ -121,7 +121,7 @@ void TSQLServer::SetError(Int_t code, const char* msg, const char* method) fErrorCode = code; fErrorMsg = msg; if ((method!=0) && fErrorOut) - Error(method,"Code: %d Msg: %s", code, msg); + Error(method,"Code: %d Msg: %s", code, (msg ? msg : "No message")); } //______________________________________________________________________________ diff --git a/net/src/TSQLStatement.cxx b/net/src/TSQLStatement.cxx index 8c381f3b4259f28838604246cc33babbe908bcb0..396f8fe5f05948f0e8407008ad874a3eb4a35bbb 100644 --- a/net/src/TSQLStatement.cxx +++ b/net/src/TSQLStatement.cxx @@ -1,4 +1,4 @@ -// @(#)root/net:$Name: $:$Id: TSQLStatement.cxx,v 1.2 2006/05/22 08:55:30 brun Exp $ +// @(#)root/net:$Name: $:$Id: TSQLStatement.cxx,v 1.3 2006/06/02 14:02:03 brun Exp $ // Author: Sergey Linev 6/02/2006 /************************************************************************* @@ -206,6 +206,6 @@ void TSQLStatement::SetError(Int_t code, const char* msg, const char* method) fErrorCode = code; fErrorMsg = msg; - if (method!=0) - Error(method,"Code: %d Msg: %s", code, msg); + if ((method!=0) && fErrorOut) + Error(method,"Code: %d Msg: %s", code, (msg ? msg : "No message")); } diff --git a/odbc/inc/TODBCStatement.h b/odbc/inc/TODBCStatement.h index 117136eb726137509f0ca701277d1a5aff453a4f..a2bf2b556e2c54d5e2880ec71d5638d1a94a2ae5 100644 --- a/odbc/inc/TODBCStatement.h +++ b/odbc/inc/TODBCStatement.h @@ -1,4 +1,4 @@ -// @(#)root/odbc:$Name: $:$Id: TODBCStatement.h,v 1.5 2006/05/18 06:57:22 brun Exp $ +// @(#)root/odbc:$Name: $:$Id: TODBCStatement.h,v 1.6 2006/06/02 14:02:03 brun Exp $ // Author: Sergey Linev 6/02/2006 /************************************************************************* @@ -67,7 +67,6 @@ protected: Bool_t BindColumn(Int_t ncol, SQLSMALLINT sqltype, SQLUINTEGER size); Bool_t BindParam(Int_t n, Int_t type, Int_t size = 1024); - Bool_t ExtractErrors(SQLRETURN retcode, const char* method); void SetNumBuffers(Int_t isize, Int_t ilen); @@ -77,7 +76,7 @@ protected: Bool_t IsResultSet() const { return fWorkingMode==2; } public: - TODBCStatement(SQLHSTMT stmt, Int_t rowarrsize); + TODBCStatement(SQLHSTMT stmt, Int_t rowarrsize, Bool_t errout = kTRUE); virtual ~TODBCStatement(); virtual void Close(Option_t * = ""); diff --git a/odbc/src/TODBCServer.cxx b/odbc/src/TODBCServer.cxx index 8040c86c6ebb7f4177db33564e7a20735852d1c7..bc9940f2450d60c4b15501371f11fef7c8a6f870 100644 --- a/odbc/src/TODBCServer.cxx +++ b/odbc/src/TODBCServer.cxx @@ -1,4 +1,4 @@ -// @(#)root/odbc:$Name: $:$Id: TODBCServer.cxx,v 1.10 2006/06/02 14:27:25 brun Exp $ +// @(#)root/odbc:$Name: $:$Id: TODBCServer.cxx,v 1.11 2006/06/06 09:14:54 rdm Exp $ // Author: Sergey Linev 6/02/2006 /************************************************************************* @@ -646,7 +646,7 @@ TSQLStatement *TODBCServer::Statement(const char *sql, Int_t bufsize) return 0; } - return new TODBCStatement(hstmt, bufsize); + return new TODBCStatement(hstmt, bufsize, fErrorOut); } //______________________________________________________________________________ diff --git a/odbc/src/TODBCStatement.cxx b/odbc/src/TODBCStatement.cxx index 3562972ad054350809dd3cc1da6d754011e2c768..0aed8b18e0af5ac0b7e6ceed6ea54f0421f406ed 100644 --- a/odbc/src/TODBCStatement.cxx +++ b/odbc/src/TODBCStatement.cxx @@ -1,4 +1,4 @@ -// @(#)root/odbc:$Name: $:$Id: TODBCStatement.cxx,v 1.7 2006/05/23 06:20:36 brun Exp $ +// @(#)root/odbc:$Name: $:$Id: TODBCStatement.cxx,v 1.8 2006/06/02 14:02:03 brun Exp $ // Author: Sergey Linev 6/02/2006 /************************************************************************* @@ -30,8 +30,8 @@ ClassImp(TODBCStatement) //______________________________________________________________________________ -TODBCStatement::TODBCStatement(SQLHSTMT stmt, Int_t rowarrsize) : - TSQLStatement() +TODBCStatement::TODBCStatement(SQLHSTMT stmt, Int_t rowarrsize, Bool_t errout) : + TSQLStatement(errout) { //constructor diff --git a/oracle/inc/TOracleStatement.h b/oracle/inc/TOracleStatement.h index eba9630e1965cb20c551a4bb589de7e19686a21b..dc9a6ea4fbca3c124b5496afc7eeb47a08e2a166 100644 --- a/oracle/inc/TOracleStatement.h +++ b/oracle/inc/TOracleStatement.h @@ -1,4 +1,4 @@ -// @(#)root/oracle:$Name: $:$Id: TOracleStatement.h,v 1.2 2006/05/22 08:55:30 brun Exp $ +// @(#)root/oracle:$Name: $:$Id: TOracleStatement.h,v 1.3 2006/06/02 14:02:03 brun Exp $ // Author: Sergey Linev 6/02/2006 /************************************************************************* @@ -52,7 +52,7 @@ protected: void CloseBuffer(); public: - TOracleStatement(Connection* conn, Statement* stmt, Int_t niter); + TOracleStatement(Connection* conn, Statement* stmt, Int_t niter, Bool_t errout = kTRUE); virtual ~TOracleStatement(); virtual void Close(Option_t * = ""); diff --git a/oracle/src/TOracleServer.cxx b/oracle/src/TOracleServer.cxx index 2813498dc690d544224f111ecc8109de0a854862..b438707b391a70db5b990e9cb60dabcdd04980a3 100644 --- a/oracle/src/TOracleServer.cxx +++ b/oracle/src/TOracleServer.cxx @@ -1,4 +1,4 @@ -// @(#)root/oracle:$Name: $:$Id: TOracleServer.cxx,v 1.11 2006/06/02 14:02:03 brun Exp $ +// @(#)root/oracle:$Name: $:$Id: TOracleServer.cxx,v 1.12 2006/06/22 08:18:57 brun Exp $ // Author: Yan Liu and Shaowen Wang 23/11/04 /************************************************************************* @@ -121,7 +121,7 @@ TSQLStatement *TOracleServer::Statement(const char *sql, Int_t niter) try { oracle::occi::Statement *stmt = fConn->createStatement(sql); - return new TOracleStatement(fConn, stmt, niter); + return new TOracleStatement(fConn, stmt, niter, fErrorOut); } CatchError("Statement") diff --git a/oracle/src/TOracleStatement.cxx b/oracle/src/TOracleStatement.cxx index 0f68652b65a6734f145d5b62f6061d3b5c46e2f7..484fcad05dd43db71d437100c62e2af615ff72a2 100644 --- a/oracle/src/TOracleStatement.cxx +++ b/oracle/src/TOracleStatement.cxx @@ -1,4 +1,4 @@ -// @(#)root/oracle:$Name: $:$Id: TOracleStatement.cxx,v 1.3 2006/06/02 14:02:03 brun Exp $ +// @(#)root/oracle:$Name: $:$Id: TOracleStatement.cxx,v 1.4 2006/06/22 08:18:57 brun Exp $ // Author: Sergey Linev 6/02/2006 @@ -24,8 +24,8 @@ ClassImp(TOracleStatement) //______________________________________________________________________________ -TOracleStatement::TOracleStatement(Connection* conn, Statement* stmt, Int_t niter) : - TSQLStatement(), +TOracleStatement::TOracleStatement(Connection* conn, Statement* stmt, Int_t niter, Bool_t errout) : + TSQLStatement(errout), fConn(conn), fStmt(stmt), fResult(0), diff --git a/sql/src/TSQLFile.cxx b/sql/src/TSQLFile.cxx index 604a73b05cd353632f01c30c4ad6bc8ab2539be6..6856677a624a14be25fba00e77091308dea40d7b 100644 --- a/sql/src/TSQLFile.cxx +++ b/sql/src/TSQLFile.cxx @@ -1,4 +1,4 @@ -// @(#)root/sql:$Name: $:$Id: TSQLFile.cxx,v 1.12 2006/06/22 08:21:22 brun Exp $ +// @(#)root/sql:$Name: $:$Id: TSQLFile.cxx,v 1.13 2006/06/23 11:52:30 brun Exp $ // Author: Sergey Linev 20/11/2005 /************************************************************************* @@ -1471,10 +1471,12 @@ Bool_t TSQLFile::SQLCanStatement() //______________________________________________________________________________ TSQLStatement* TSQLFile::SQLStatement(const char* cmd, Int_t bufsize) { - // Produces statement for + // Produces SQL statement for currently conected DB server if (fSQL==0) return 0; + if (!fSQL->IsSupportStatement()) return 0; + if (gDebug>1) Info("SQLStatement",cmd); @@ -2406,7 +2408,7 @@ TObjArray* TSQLFile::SQLObjectsInfo(Long64_t keyid) if (gDebug>2) Info("SQLObjectsInfo",sqlcmd); fQuerisCounter++; - TSQLStatement* stmt = fSQL->Statement(sqlcmd.Data(), 1000); + TSQLStatement* stmt = SQLStatement(sqlcmd.Data(), 1000); if (stmt!=0) { stmt->Process(); @@ -2511,7 +2513,7 @@ TSQLStatement* TSQLFile::GetBlobClassDataStmt(Long64_t objid, TSQLClassInfo* sql if (gDebug>2) Info("BuildStatement",sqlcmd); fQuerisCounter++; - TSQLStatement* stmt = fSQL->Statement(sqlcmd.Data(), 1000); + TSQLStatement* stmt = SQLStatement(sqlcmd.Data(), 1000); if (stmt==0) return 0; stmt->Process();