ROOT  6.06/09
Reference Guide
TSQLiteStatement.cxx
Go to the documentation of this file.
1 // @(#)root/sqlite:$Id$
2 // Author: o.freyermuth <o.f@cern.ch>, 01/06/2013
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 //////////////////////////////////////////////////////////////////////////
13 // //
14 // SQL statement class for SQLite. //
15 // //
16 // See TSQLStatement class documentation for more details. //
17 // //
18 //////////////////////////////////////////////////////////////////////////
19 
20 #include "TSQLiteStatement.h"
21 #include "TDataType.h"
22 #include "TDatime.h"
23 #include "TTimeStamp.h"
24 
25 #include <stdlib.h>
26 
28 
29 ////////////////////////////////////////////////////////////////////////////////
30 /// Normal constructor.
31 /// Checks if statement contains parameters tags.
32 
34  TSQLStatement(errout),
35  fStmt(stmt),
36  fWorkingMode(0),
37  fNumPars(0),
38  fIterationCount(0)
39 {
40  unsigned long bindParamcount = sqlite3_bind_parameter_count(fStmt->fRes);
41 
42  if (bindParamcount > 0) {
43  fWorkingMode = 1;
44  fNumPars = bindParamcount;
45  } else {
46  fWorkingMode = 2;
47  fNumPars = sqlite3_column_count(fStmt->fRes);
48  }
49 }
50 
51 ////////////////////////////////////////////////////////////////////////////////
52 /// Destructor.
53 
55 {
56  Close();
57 }
58 
59 ////////////////////////////////////////////////////////////////////////////////
60 /// Close statement.
61 
63 {
64  if (fStmt->fRes) {
65  sqlite3_finalize(fStmt->fRes);
66  }
67 
68  fStmt->fRes = 0;
69  fStmt->fConn = 0;
70  delete fStmt;
71 }
72 
73 
74 // Reset error and check that statement exists
75 #define CheckStmt(method, res) \
76  { \
77  ClearError(); \
78  if (fStmt==0) { \
79  SetError(-1,"Statement handle is 0",method); \
80  return res; \
81  } \
82  }
83 
84 #define CheckErrNo(method, force, res) \
85  { \
86  int stmterrno = sqlite3_errcode(fStmt->fConn); \
87  if ((stmterrno!=0) || force) { \
88  const char* stmterrmsg = sqlite3_errmsg(fStmt->fConn); \
89  if (stmterrno==0) { stmterrno = -1; stmterrmsg = "SQLite statement error"; } \
90  SetError(stmterrno, stmterrmsg, method); \
91  return res; \
92  } \
93  }
94 
95 #define CheckGetField(method, res) \
96  { \
97  ClearError(); \
98  if (!IsResultSetMode()) { \
99  SetError(-1,"Cannot get statement parameters",method); \
100  return res; \
101  } \
102  if ((npar<0) || (npar>=fNumPars)) { \
103  SetError(-1,Form("Invalid parameter number %d", npar),method); \
104  return res; \
105  } \
106  }
107 
108 
109 Bool_t TSQLiteStatement::CheckBindError(const char *method, int res)
110 {
111  if (res == SQLITE_RANGE) {
112  SetError(-1, Form("SQLite parameter out of bounds, error: %d %s", res, sqlite3_errmsg(fStmt->fConn)), method);
113  return kFALSE;
114  }
115  if (res != SQLITE_OK) {
116  SetError(-1, Form("SQLite error code during parameter binding, error: %d %s", res, sqlite3_errmsg(fStmt->fConn)), method);
117  return kFALSE;
118  }
119  return kTRUE;
120 }
121 
122 ////////////////////////////////////////////////////////////////////////////////
123 /// Process statement.
124 
126 {
127  CheckStmt("Process", kFALSE);
128 
129  int res = sqlite3_step(fStmt->fRes);
130  if ((res != SQLITE_DONE) && (res != SQLITE_ROW)) {
131  SetError(-1, Form("SQLite error code during statement-stepping: %d %s", res, sqlite3_errmsg(fStmt->fConn)), "Process");
132  return kFALSE;
133  }
134 
135  // After a DONE-step, we have to reset, note this still KEEPS the parameters bound in SQLite,
136  // real reset happens in finalize, but user can still reuse the query!
137  if (res == SQLITE_DONE) {
138  sqlite3_reset(fStmt->fRes);
139 
140  // If IsResultSetMode then this means we are done and should return kFALSE:
141  if (IsResultSetMode()) {
142  return kFALSE;
143  }
144 
145  // If IsSetParsMode then this means we just stepped and should return kTRUE:
146  if (IsSetParsMode()) {
147  return kTRUE;
148  }
149  }
150 
151  if (res == SQLITE_ROW) {
152  // Next row data retrieved, return kTRUE.
153  return kTRUE;
154  }
155 
156  return kFALSE;
157 }
158 
159 ////////////////////////////////////////////////////////////////////////////////
160 /// Return number of affected rows after statement is processed.
161 /// Indirect changes e.g. by triggers are not counted, only direct changes
162 /// from last completed statement are taken into account.
163 
165 {
166  CheckStmt("GetNumAffectedRows", kFALSE);
167 
168  return (Int_t) sqlite3_changes(fStmt->fConn);
169 }
170 
171 ////////////////////////////////////////////////////////////////////////////////
172 /// Return number of statement parameters.
173 
175 {
176  CheckStmt("GetNumParameters", -1);
177 
178  Int_t res = sqlite3_bind_parameter_count(fStmt->fRes);
179 
180  CheckErrNo("GetNumParameters", kFALSE, -1);
181 
182  return res;
183 }
184 
185 ////////////////////////////////////////////////////////////////////////////////
186 /// Store result of statement processing to access them
187 /// via GetInt(), GetDouble() and so on methods.
188 /// For SQLite, this is a NO-OP.
189 
191 {
192  fWorkingMode = 2;
193 
194  CheckStmt("StoreResult", kFALSE);
195 
196  return kTRUE;
197 }
198 
199 ////////////////////////////////////////////////////////////////////////////////
200 /// Return number of fields in result set.
201 
203 {
204  return fNumPars;
205 }
206 
207 ////////////////////////////////////////////////////////////////////////////////
208 /// Returns field name in result set.
209 
211 {
212  if (!IsResultSetMode() || (nfield < 0) || (nfield >= sqlite3_column_count(fStmt->fRes))) {
213  return 0;
214  }
215 
216  return sqlite3_column_name(fStmt->fRes, nfield);
217 }
218 
219 ////////////////////////////////////////////////////////////////////////////////
220 /// Shift cursor to next row in result set.
221 
223 {
224  ClearError();
225 
226  if ((fStmt == 0) || !IsResultSetMode()) return kFALSE;
227 
228  if (fIterationCount == 0) {
229  // The interface says user should call NextResultRow() before getting any data,
230  // this makes no sense at least for SQLite.
231  // We just return kTRUE here and only do something on second request.
232  fIterationCount++;
233  return kTRUE;
234  }
235 
236  return Process();
237 }
238 
239 ////////////////////////////////////////////////////////////////////////////////
240 /// Increment iteration counter for statement, where parameter can be set.
241 /// Statement with parameters of previous iteration
242 /// automatically will be applied to database.
243 /// Actually a NO-OP for SQLite, as parameters stay bound when step-ping.
244 
246 {
247  ClearError();
248 
249  if (!IsSetParsMode()) {
250  SetError(-1, "Cannot call for that statement", "NextIteration");
251  return kFALSE;
252  }
253 
254  if (fIterationCount == 0) {
255  // The interface says user should call NextIteration() before binding any parameters,
256  // this makes no sense at least for SQLite.
257  // We just return kTRUE here and wait for data to really do something.
258  fIterationCount++;
259  return kTRUE;
260  }
261 
262  fIterationCount++;
263 
264  return Process();
265 }
266 
267 ////////////////////////////////////////////////////////////////////////////////
268 /// Convert field value to string.
269 
271 {
272  CheckGetField("ConvertToString", "");
273 
274  return reinterpret_cast<const char *>(sqlite3_column_text(fStmt->fRes, npar));
275 }
276 
277 ////////////////////////////////////////////////////////////////////////////////
278 /// Convert field to numeric.
279 
281 {
282  CheckGetField("ConvertToNumeric", -1);
283 
284  return (long double) sqlite3_column_double(fStmt->fRes, npar);
285 }
286 
287 ////////////////////////////////////////////////////////////////////////////////
288 /// Checks if field value is null.
289 
291 {
292  CheckGetField("IsNull", kFALSE);
293 
294  return (sqlite3_column_type(fStmt->fRes, npar) == SQLITE_NULL);
295 }
296 
297 ////////////////////////////////////////////////////////////////////////////////
298 /// Get integer.
299 
301 {
302  CheckGetField("GetInt", -1);
303 
304  return (Int_t) sqlite3_column_int(fStmt->fRes, npar);
305 }
306 
307 ////////////////////////////////////////////////////////////////////////////////
308 /// Get unsigned integer.
309 
311 {
312  CheckGetField("GetUInt", 0);
313 
314  return (UInt_t) sqlite3_column_int(fStmt->fRes, npar);
315 }
316 
317 ////////////////////////////////////////////////////////////////////////////////
318 /// Get long.
319 
321 {
322  CheckGetField("GetLong", -1);
323 
324  return (Long_t) sqlite3_column_int64(fStmt->fRes, npar);
325 }
326 
327 ////////////////////////////////////////////////////////////////////////////////
328 /// Get long64.
329 
331 {
332  CheckGetField("GetLong64", -1);
333 
334  return (Long64_t) sqlite3_column_int64(fStmt->fRes, npar);
335 }
336 
337 ////////////////////////////////////////////////////////////////////////////////
338 /// Return field value as unsigned 64-bit integer
339 
341 {
342  CheckGetField("GetULong64", 0);
343 
344  return (ULong64_t) sqlite3_column_int64(fStmt->fRes, npar);
345 }
346 
347 ////////////////////////////////////////////////////////////////////////////////
348 /// Return field value as double.
349 
351 {
352  CheckGetField("GetDouble", -1);
353 
354  return (Double_t) sqlite3_column_double(fStmt->fRes, npar);
355 }
356 
357 ////////////////////////////////////////////////////////////////////////////////
358 /// Return field value as string.
359 
361 {
362  CheckGetField("GetString", "");
363 
364  return reinterpret_cast<const char *>(sqlite3_column_text(fStmt->fRes, npar));
365 }
366 
367 ////////////////////////////////////////////////////////////////////////////////
368 /// Return field value as binary array.
369 /// Memory at 'mem' will be reallocated and size updated
370 /// to fit the data if not large enough.
371 
373 {
374  CheckGetField("GetBinary", kFALSE);
375 
376  // As we retrieve "as blob", we do NOT call sqlite3_column_text() before
377  // sqlite3_column_bytes(), which might leave us with a non-zero terminated
378  // data struture, but this should be okay for BLOB.
379  size_t sz = sqlite3_column_bytes(fStmt->fRes, npar);
380  if ((Long_t)sz > size) {
381  delete [](unsigned char*) mem;
382  mem = (void*) new unsigned char[sz];
383  }
384  size = sz;
385 
386  memcpy(mem, sqlite3_column_blob(fStmt->fRes, npar), sz);
387 
388  return kTRUE;
389 }
390 
391 ////////////////////////////////////////////////////////////////////////////////
392 /// Return field value as date.
393 
395 {
396  CheckGetField("GetDate", kFALSE);
397 
398  TString val = reinterpret_cast<const char*>(sqlite3_column_text(fStmt->fRes, npar));
399  TDatime d = TDatime(val.Data());
400  year = d.GetYear();
401  month = d.GetMonth();
402  day = d.GetDay();
403 
404  return kTRUE;
405 }
406 
407 ////////////////////////////////////////////////////////////////////////////////
408 /// Return field as time.
409 
411 {
412  CheckGetField("GetTime", kFALSE);
413 
414  TString val = reinterpret_cast<const char*>(sqlite3_column_text(fStmt->fRes, npar));
415  TDatime d = TDatime(val.Data());
416  hour = d.GetHour();
417  min = d.GetMinute();
418  sec = d.GetSecond();
419 
420  return kTRUE;
421 }
422 
423 ////////////////////////////////////////////////////////////////////////////////
424 /// Return field value as date & time.
425 
426 Bool_t TSQLiteStatement::GetDatime(Int_t npar, Int_t& year, Int_t& month, Int_t& day, Int_t& hour, Int_t& min, Int_t& sec)
427 {
428  CheckGetField("GetDatime", kFALSE);
429 
430  TString val = reinterpret_cast<const char*>(sqlite3_column_text(fStmt->fRes, npar));
431  TDatime d = TDatime(val.Data());
432  year = d.GetYear();
433  month = d.GetMonth();
434  day = d.GetDay();
435  hour = d.GetHour();
436  min = d.GetMinute();
437  sec = d.GetSecond();
438 
439  return kTRUE;
440 }
441 
442 ////////////////////////////////////////////////////////////////////////////////
443 /// Return field as timestamp.
444 /// Second fraction is in milliseconds, which is also the precision all date and time functions of sqlite use.
445 
446 Bool_t TSQLiteStatement::GetTimestamp(Int_t npar, Int_t& year, Int_t& month, Int_t& day, Int_t& hour, Int_t& min, Int_t& sec, Int_t& frac)
447 {
448  CheckGetField("GetTimestamp", kFALSE);
449 
450  TString val = reinterpret_cast<const char*>(sqlite3_column_text(fStmt->fRes, npar));
451 
452  Ssiz_t p = val.Last('.');
453  TSubString ts_part = val(0, p);
454 
455  TDatime d(ts_part.Data());
456  year = d.GetYear();
457  month = d.GetMonth();
458  day = d.GetDay();
459  hour = d.GetHour();
460  min = d.GetMinute();
461  sec = d.GetSecond();
462 
463  TSubString s_frac = val(p, val.Length() - p+1);
464  frac=(Int_t) (atof(s_frac.Data())*1.E3);
465 
466  return kTRUE;
467 }
468 
469 ////////////////////////////////////////////////////////////////////////////////
470 /// Set NULL as parameter value.
471 
473 {
474  int res = sqlite3_bind_null(fStmt->fRes, npar + 1);
475 
476  return CheckBindError("SetNull", res);
477 }
478 
479 ////////////////////////////////////////////////////////////////////////////////
480 /// Set parameter value as integer.
481 
483 {
484  int res = sqlite3_bind_int(fStmt->fRes, npar + 1, value);
485 
486  return CheckBindError("SetInt", res);
487 }
488 
489 ////////////////////////////////////////////////////////////////////////////////
490 /// Set parameter value as unsigned integer.
491 /// Actually casted to signed integer, has to be re-casted upon read!
492 
494 {
495  int res = sqlite3_bind_int(fStmt->fRes, npar + 1, (Int_t)value);
496 
497  return CheckBindError("SetUInt", res);
498 }
499 
500 ////////////////////////////////////////////////////////////////////////////////
501 /// Set parameter value as long.
502 
504 {
505  int res = sqlite3_bind_int64(fStmt->fRes, npar + 1, value);
506 
507  return CheckBindError("SetLong", res);
508 }
509 
510 ////////////////////////////////////////////////////////////////////////////////
511 /// Set parameter value as 64-bit integer.
512 
514 {
515  int res = sqlite3_bind_int64(fStmt->fRes, npar + 1, value);
516 
517  return CheckBindError("SetLong64", res);
518 }
519 
520 ////////////////////////////////////////////////////////////////////////////////
521 /// Set parameter value as unsigned 64-bit integer.
522 /// Actually casted to signed integer, has to be re-casted upon read!
523 
525 {
526  int res = sqlite3_bind_int64(fStmt->fRes, npar + 1, (Long64_t)value);
527 
528  return CheckBindError("SetULong64", res);
529 }
530 
531 ////////////////////////////////////////////////////////////////////////////////
532 /// Set parameter value as double value.
533 
535 {
536  int res = sqlite3_bind_double(fStmt->fRes, npar + 1, value);
537 
538  return CheckBindError("SetDouble", res);
539 }
540 
541 ////////////////////////////////////////////////////////////////////////////////
542 /// Set parameter value as string.
543 
545 {
546  int res = sqlite3_bind_text(fStmt->fRes, npar + 1, value, maxsize, SQLITE_TRANSIENT);
547 
548  return CheckBindError("SetString", res);
549 }
550 
551 ////////////////////////////////////////////////////////////////////////////////
552 /// Set parameter value as binary data.
553 /// Maxsize is ignored for SQLite, we directly insert BLOB of size 'size'.
554 /// Negative size would cause undefined behaviour, so we refuse that.
555 
556 Bool_t TSQLiteStatement::SetBinary(Int_t npar, void* mem, Long_t size, Long_t /*maxsize*/)
557 {
558  if (size < 0) {
559  SetError(-1, "Passing negative value to size for BLOB to SQLite would cause undefined behaviour, refusing it!", "SetBinary");
560  return kFALSE;
561  }
562 
563  int res = sqlite3_bind_blob(fStmt->fRes, npar + 1, mem, (size_t)size, SQLITE_TRANSIENT);
564 
565  return CheckBindError("SetBinary", res);
566 }
567 
568 ////////////////////////////////////////////////////////////////////////////////
569 /// Set parameter value as date.
570 
572 {
573  TDatime d = TDatime(year, month, day, 0, 0, 0);
574  int res = sqlite3_bind_text(fStmt->fRes, npar + 1, (char*)d.AsSQLString(), -1, SQLITE_TRANSIENT);
575 
576  return CheckBindError("SetDate", res);
577 }
578 
579 ////////////////////////////////////////////////////////////////////////////////
580 /// Set parameter value as time.
581 
583 {
584  TDatime d = TDatime(2000, 1, 1, hour, min, sec);
585 
586  int res = sqlite3_bind_text(fStmt->fRes, npar + 1, (char*)d.AsSQLString(), -1, SQLITE_TRANSIENT);
587 
588  return CheckBindError("SetTime", res);
589 }
590 
591 ////////////////////////////////////////////////////////////////////////////////
592 /// Set parameter value as date & time.
593 
595 {
596  TDatime d = TDatime(year, month, day, hour, min, sec);
597 
598  int res = sqlite3_bind_text(fStmt->fRes, npar + 1, (char*)d.AsSQLString(), -1, SQLITE_TRANSIENT);
599 
600  return CheckBindError("SetDatime", res);
601 }
602 
603 ////////////////////////////////////////////////////////////////////////////////
604 /// Set parameter value as timestamp.
605 /// The second fraction has to be in milliseconds,
606 /// as all SQLite functions for date and time assume 3 significant digits.
607 
609 {
610  TDatime d(year,month,day,hour,min,sec);
611  TString value;
612  value.Form("%s.%03d", (char*)d.AsSQLString(), frac);
613 
614  int res = sqlite3_bind_text(fStmt->fRes, npar + 1, value.Data(), -1, SQLITE_TRANSIENT);
615 
616  return CheckBindError("SetTimestamp", res);
617 }
A zero length substring is legal.
Definition: TString.h:83
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition: TString.cxx:864
virtual Bool_t GetBinary(Int_t npar, void *&mem, Long_t &size)
Return field value as binary array.
SQLite3_Stmt_t * fStmt
Int_t GetMonth() const
Definition: TDatime.h:68
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
Definition: vector.h:433
virtual Bool_t IsNull(Int_t npar)
Checks if field value is null.
virtual Bool_t SetUInt(Int_t npar, UInt_t value)
Set parameter value as unsigned integer.
long long Long64_t
Definition: RtypesCore.h:69
Bool_t IsSetParsMode() const
Iteration count.
virtual const char * GetString(Int_t npar)
Return field value as string.
Ssiz_t Length() const
Definition: TString.h:390
virtual Bool_t SetLong64(Int_t npar, Long64_t value)
Set parameter value as 64-bit integer.
#define CheckStmt(method, res)
const char Option_t
Definition: RtypesCore.h:62
void ClearError()
reset error fields
void SetError(Int_t code, const char *msg, const char *method=0)
set new values for error fields if method specified, displays error message
virtual Bool_t Process()
Process statement.
virtual Bool_t SetLong(Int_t npar, Long_t value)
Set parameter value as long.
virtual Int_t GetInt(Int_t npar)
Get integer.
Basic string class.
Definition: TString.h:137
virtual Double_t GetDouble(Int_t npar)
Return field value as double.
int Int_t
Definition: RtypesCore.h:41
Int_t fNumPars
1 - setting parameters, 2 - retrieving results
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
Int_t fWorkingMode
executed statement
const char * Data() const
Definition: TString.h:349
Int_t GetDay() const
Definition: TDatime.h:69
virtual Long_t GetLong(Int_t npar)
Get long.
virtual Bool_t SetULong64(Int_t npar, ULong64_t value)
Set parameter value as unsigned 64-bit integer.
virtual Bool_t SetBinary(Int_t npar, void *mem, Long_t size, Long_t maxsize=0x1000)
Set parameter value as binary data.
virtual Bool_t GetDatime(Int_t npar, Int_t &year, Int_t &month, Int_t &day, Int_t &hour, Int_t &min, Int_t &sec)
Return field value as date & time.
const int maxsize
#define CheckGetField(method, res)
ClassImp(TSQLiteStatement) TSQLiteStatement
Normal constructor.
virtual Bool_t SetDate(Int_t npar, Int_t year, Int_t month, Int_t day)
Set parameter value as date.
Int_t fIterationCount
Number of bindable / gettable parameters.
virtual Bool_t SetTime(Int_t npar, Int_t hour, Int_t min, Int_t sec)
Set parameter value as time.
virtual Bool_t SetString(Int_t npar, const char *value, Int_t maxsize=256)
Set parameter value as string.
Int_t GetHour() const
Definition: TDatime.h:71
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2321
unsigned int UInt_t
Definition: RtypesCore.h:42
char * Form(const char *fmt,...)
virtual Bool_t NextIteration()
Increment iteration counter for statement, where parameter can be set.
const char * ConvertToString(Int_t npar)
Convert field value to string.
Int_t GetSecond() const
Definition: TDatime.h:73
Bool_t CheckBindError(const char *method, int res)
virtual UInt_t GetUInt(Int_t npar)
Get unsigned integer.
virtual const char * GetFieldName(Int_t nfield)
Returns field name in result set.
virtual Bool_t SetNull(Int_t npar)
Set NULL as parameter value.
#define CheckErrNo(method, force, res)
virtual ~TSQLiteStatement()
Destructor.
virtual Int_t GetNumFields()
Return number of fields in result set.
Int_t GetYear() const
Definition: TDatime.h:67
long Long_t
Definition: RtypesCore.h:50
int Ssiz_t
Definition: RtypesCore.h:63
virtual Bool_t NextResultRow()
Shift cursor to next row in result set.
Int_t GetMinute() const
Definition: TDatime.h:72
virtual Bool_t SetInt(Int_t npar, Int_t value)
Set parameter value as integer.
double Double_t
Definition: RtypesCore.h:55
virtual Int_t GetNumParameters()
Return number of statement parameters.
unsigned long long ULong64_t
Definition: RtypesCore.h:70
virtual Bool_t SetDouble(Int_t npar, Double_t value)
Set parameter value as double value.
virtual Bool_t SetTimestamp(Int_t npar, Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec, Int_t frac=0)
Set parameter value as timestamp.
virtual Int_t GetNumAffectedRows()
Return number of affected rows after statement is processed.
sqlite3_stmt * fRes
long double ConvertToNumeric(Int_t npar)
Convert field to numeric.
virtual Bool_t GetTime(Int_t npar, Int_t &hour, Int_t &min, Int_t &sec)
Return field as time.
virtual Bool_t GetTimestamp(Int_t npar, Int_t &year, Int_t &month, Int_t &day, Int_t &hour, Int_t &min, Int_t &sec, Int_t &)
Return field as timestamp.
virtual void Close(Option_t *="")
Close statement.
virtual Bool_t GetDate(Int_t npar, Int_t &year, Int_t &month, Int_t &day)
Return field value as date.
const char * Data() const
Definition: TString.h:669
Bool_t IsResultSetMode() const
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual Long64_t GetLong64(Int_t npar)
Get long64.
float value
Definition: math.cpp:443
virtual Bool_t SetDatime(Int_t npar, Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec)
Set parameter value as date & time.
virtual ULong64_t GetULong64(Int_t npar)
Return field value as unsigned 64-bit integer.
const char * AsSQLString() const
Return the date & time in SQL compatible string format, like: 1997-01-15 20:16:28.
Definition: TDatime.cxx:149
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition: TDatime.h:39
virtual Bool_t StoreResult()
Store result of statement processing to access them via GetInt(), GetDouble() and so on methods...