65 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TSQLServer", db))) {
66 if (
h->LoadPlugin() == -1)
68 serv = (
TSQLServer *)
h->ExecPlugin(3, db, uid, pw);
133 Error(method,
"Code: %d Msg: %s", code, (msg ? msg :
"No message"));
142 return Exec(
"START TRANSACTION");
151 Warning(
"HasTransactionInFlight",
"Not implemented");
161 return Exec(
"COMMIT");
170 return Exec(
"ROLLBACK");
194 if (!res)
return nullptr;
196 TList *lst =
nullptr;
198 while ((row = res->
Next())!=
nullptr) {
199 const char* tablename = row->GetField(0);
219 if (!tablename || (strlen(tablename)==0))
return kFALSE;
233 while ((obj = iter()) !=
nullptr)
247 if (!tablename || (*tablename==0))
return 0;
250 if (!res)
return nullptr;
252 TList* lst =
nullptr;
254 while ((row = res->
Next())!=
nullptr) {
255 const char *columnname = row->GetField(0);
256 if (!lst) lst =
new TList;
271 if (!fmt) fmt =
"%e";
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
void Add(TObject *obj) override
Collectable string class.
virtual const char * GetName() const
Returns name of object.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
TObject()
TObject constructor.
virtual TSQLRow * Next()=0
virtual Bool_t Commit()
submit "COMMIT" query to database return kTRUE, if successful
void ClearError()
reset error fields
virtual const char * GetErrorMsg() const
returns error message of last operation if no errors, return 0 Each specific implementation of TSQLSe...
virtual TSQLTableInfo * GetTableInfo(const char *tablename)
Produce TSQLTableInfo object, which contain info about table itself and each table column Object must...
void SetError(Int_t code, const char *msg, const char *method=nullptr)
set new values for error fields if method is specified, displays error message
virtual Bool_t HasTransactionInFlight()
returns kTRUE when transaction is running Must be implemented in derived classes
virtual Int_t GetErrorCode() const
returns error code of last operation if res==0, no error Each specific implementation of TSQLServer p...
virtual TSQLResult * GetColumns(const char *dbname, const char *table, const char *wild=nullptr)=0
virtual Bool_t HasTable(const char *tablename)
Tests if table of that name exists in database Return kTRUE, if table exists.
virtual Bool_t Exec(const char *sql)
Execute sql query.
virtual Bool_t Rollback()
submit "ROLLBACK" query to database return kTRUE, if successful
virtual Bool_t StartTransaction()
submit "START TRANSACTION" query to database return kTRUE, if successful
virtual TList * GetTablesList(const char *wild=nullptr)
Return list of user tables Parameter wild specifies wildcard for table names.
virtual TSQLResult * Query(const char *sql)=0
virtual TSQLResult * GetTables(const char *dbname, const char *wild=nullptr)=0
virtual Bool_t IsError() const
static void SetFloatFormat(const char *fmt="%e")
set printf format for float/double members, default "%e"
static const char * fgFloatFmt
! printf argument for floats and doubles, either "%f" or "%e" or "%10f" and so on
static TSQLServer * Connect(const char *db, const char *uid, const char *pw)
The db should be of the form: <dbms>://<host>[:<port>][/<database>], e.g.: mysql://pcroot....
static const char * GetFloatFormat()
return current printf format for float/double members, default "%e"