ROOT logo
// @(#)root/sqlite:$Id$
// Author: o.freyermuth <o.f@cern.ch>, 01/06/2013

/*************************************************************************
 * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
//  SQL statement class for SQLite.                                     //
//                                                                      //
//  See TSQLStatement class documentation for more details.             //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TSQLiteStatement.h"
#include "TDataType.h"
#include "TDatime.h"
#include "TTimeStamp.h"

#include <stdlib.h>

ClassImp(TSQLiteStatement)

//______________________________________________________________________________
TSQLiteStatement::TSQLiteStatement(SQLite3_Stmt_t* stmt, Bool_t errout):
      TSQLStatement(errout),
      fStmt(stmt),
      fWorkingMode(0),
      fNumPars(0),
      fIterationCount(0)
{
   // Normal constructor.
   // Checks if statement contains parameters tags.

   unsigned long bindParamcount = sqlite3_bind_parameter_count(fStmt->fRes);

   if (bindParamcount > 0) {
      fWorkingMode = 1;
      fNumPars = bindParamcount;
   } else {
      fWorkingMode = 2;
      fNumPars = sqlite3_column_count(fStmt->fRes);
   }
}

//______________________________________________________________________________
TSQLiteStatement::~TSQLiteStatement()
{
   // Destructor.

   Close();
}

//______________________________________________________________________________
void TSQLiteStatement::Close(Option_t *)
{
   // Close statement.

   if (fStmt->fRes) {
      sqlite3_finalize(fStmt->fRes);
   }

   fStmt->fRes = 0;
   fStmt->fConn = 0;
   delete fStmt;
}


// Reset error and check that statement exists
#define CheckStmt(method, res)                          \
   {                                                    \
      ClearError();                                     \
      if (fStmt==0) {                                   \
         SetError(-1,"Statement handle is 0",method);   \
         return res;                                    \
      }                                                 \
   }

#define CheckErrNo(method, force, res)                  \
   {                                                    \
      int stmterrno = sqlite3_errcode(fStmt->fConn);    \
      if ((stmterrno!=0) || force) {                    \
         const char* stmterrmsg = sqlite3_errmsg(fStmt->fConn);  \
         if (stmterrno==0) { stmterrno = -1; stmterrmsg = "SQLite statement error"; } \
         SetError(stmterrno, stmterrmsg, method);       \
         return res;                                    \
      }                                                 \
   }

#define CheckGetField(method, res)                      \
   {                                                    \
      ClearError();                                     \
      if (!IsResultSetMode()) {                         \
         SetError(-1,"Cannot get statement parameters",method); \
         return res;                                    \
      }                                                 \
      if ((npar<0) || (npar>=fNumPars)) {     \
         SetError(-1,Form("Invalid parameter number %d", npar),method); \
         return res;                                    \
      }                                                 \
   }


Bool_t TSQLiteStatement::CheckBindError(const char *method, int res)
{
   if (res == SQLITE_RANGE) {
      SetError(-1, Form("SQLite parameter out of bounds, error: %d %s", res, sqlite3_errmsg(fStmt->fConn)), method);
      return kFALSE;
   }
   if (res != SQLITE_OK) {
      SetError(-1, Form("SQLite error code during parameter binding, error: %d %s", res, sqlite3_errmsg(fStmt->fConn)), method);
      return kFALSE;
   }
   return kTRUE;
}

//________________________________________________________________________
Bool_t TSQLiteStatement::Process()
{
   // Process statement.

   CheckStmt("Process", kFALSE);

   int res = sqlite3_step(fStmt->fRes);
   if ((res != SQLITE_DONE) && (res != SQLITE_ROW)) {
      SetError(-1, Form("SQLite error code during statement-stepping: %d %s", res, sqlite3_errmsg(fStmt->fConn)), "Process");
      return kFALSE;
   }

   // After a DONE-step, we have to reset, note this still KEEPS the parameters bound in SQLite,
   // real reset happens in finalize, but user can still reuse the query!
   if (res == SQLITE_DONE) {
      sqlite3_reset(fStmt->fRes);

      // If IsResultSetMode then this means we are done and should return kFALSE:
      if (IsResultSetMode()) {
         return kFALSE;
      }

      // If IsSetParsMode then this means we just stepped and should return kTRUE:
      if (IsSetParsMode()) {
         return kTRUE;
      }
   }

   if (res == SQLITE_ROW) {
      // Next row data retrieved, return kTRUE.
      return kTRUE;
   }

   return kFALSE;
}

//________________________________________________________________________
Int_t TSQLiteStatement::GetNumAffectedRows()
{
   // Return number of affected rows after statement is processed.
   // Indirect changes e.g. by triggers are not counted, only direct changes
   // from last completed statement are taken into account.

   CheckStmt("GetNumAffectedRows", kFALSE);

   return (Int_t) sqlite3_changes(fStmt->fConn);
}

//______________________________________________________________________________
Int_t TSQLiteStatement::GetNumParameters()
{
   // Return number of statement parameters.

   CheckStmt("GetNumParameters", -1);

   Int_t res = sqlite3_bind_parameter_count(fStmt->fRes);

   CheckErrNo("GetNumParameters", kFALSE, -1);

   return res;
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::StoreResult()
{
   // Store result of statement processing to access them
   // via GetInt(), GetDouble() and so on methods.
   // For SQLite, this is a NO-OP.

   fWorkingMode = 2;

   CheckStmt("StoreResult", kFALSE);

   return kTRUE;
}

//______________________________________________________________________________
Int_t TSQLiteStatement::GetNumFields()
{
   // Return number of fields in result set.

   return fNumPars;
}

//______________________________________________________________________________
const char* TSQLiteStatement::GetFieldName(Int_t nfield)
{
   // Returns field name in result set.

   if (!IsResultSetMode() || (nfield < 0) || (nfield >= sqlite3_column_count(fStmt->fRes))) {
      return 0;
   }

   return sqlite3_column_name(fStmt->fRes, nfield);
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::NextResultRow()
{
   // Shift cursor to next row in result set.

   ClearError();

   if ((fStmt == 0) || !IsResultSetMode()) return kFALSE;

   if (fIterationCount == 0) {
      // The interface says user should call NextResultRow() before getting any data,
      // this makes no sense at least for SQLite.
      // We just return kTRUE here and only do something on second request.
      fIterationCount++;
      return kTRUE;
   }

   return Process();
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::NextIteration()
{
   // Increment iteration counter for statement, where parameter can be set.
   // Statement with parameters of previous iteration
   // automatically will be applied to database.
   // Actually a NO-OP for SQLite, as parameters stay bound when step-ping.

   ClearError();

   if (!IsSetParsMode()) {
      SetError(-1, "Cannot call for that statement", "NextIteration");
      return kFALSE;
   }

   if (fIterationCount == 0) {
      // The interface says user should call NextIteration() before binding any parameters,
      // this makes no sense at least for SQLite.
      // We just return kTRUE here and wait for data to really do something.
      fIterationCount++;
      return kTRUE;
   }

   fIterationCount++;

   return Process();
}

//______________________________________________________________________________
const char* TSQLiteStatement::ConvertToString(Int_t npar)
{
   // Convert field value to string.

   CheckGetField("ConvertToString", "");

   return reinterpret_cast<const char *>(sqlite3_column_text(fStmt->fRes, npar));
}

//______________________________________________________________________________
long double TSQLiteStatement::ConvertToNumeric(Int_t npar)
{
   // Convert field to numeric.

   CheckGetField("ConvertToNumeric", -1);

   return (long double) sqlite3_column_double(fStmt->fRes, npar);
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::IsNull(Int_t npar)
{
   // Checks if field value is null.

   CheckGetField("IsNull", kFALSE);

   return (sqlite3_column_type(fStmt->fRes, npar) == SQLITE_NULL);
}

//______________________________________________________________________________
Int_t TSQLiteStatement::GetInt(Int_t npar)
{
   // Get integer.

   CheckGetField("GetInt", -1);

   return (Int_t) sqlite3_column_int(fStmt->fRes, npar);
}

//______________________________________________________________________________
UInt_t TSQLiteStatement::GetUInt(Int_t npar)
{
   // Get unsigned integer.

   CheckGetField("GetUInt", 0);

   return (UInt_t) sqlite3_column_int(fStmt->fRes, npar);
}

//______________________________________________________________________________
Long_t TSQLiteStatement::GetLong(Int_t npar)
{
   // Get long.

   CheckGetField("GetLong", -1);

   return (Long_t) sqlite3_column_int64(fStmt->fRes, npar);
}

//______________________________________________________________________________
Long64_t TSQLiteStatement::GetLong64(Int_t npar)
{
   // Get long64.

   CheckGetField("GetLong64", -1);

   return (Long64_t) sqlite3_column_int64(fStmt->fRes, npar);
}

//______________________________________________________________________________
ULong64_t TSQLiteStatement::GetULong64(Int_t npar)
{
   // Return field value as unsigned 64-bit integer

   CheckGetField("GetULong64", 0);

   return (ULong64_t) sqlite3_column_int64(fStmt->fRes, npar);
}

//______________________________________________________________________________
Double_t TSQLiteStatement::GetDouble(Int_t npar)
{
   // Return field value as double.

   CheckGetField("GetDouble", -1);

   return (Double_t) sqlite3_column_double(fStmt->fRes, npar);
}

//______________________________________________________________________________
const char *TSQLiteStatement::GetString(Int_t npar)
{
   // Return field value as string.

   CheckGetField("GetString", "");

   return reinterpret_cast<const char *>(sqlite3_column_text(fStmt->fRes, npar));
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::GetBinary(Int_t npar, void* &mem, Long_t& size)
{
   // Return field value as binary array.
   // Memory at 'mem' will be reallocated and size updated
   // to fit the data if not large enough.

   CheckGetField("GetBinary", kFALSE);

   // As we retrieve "as blob", we do NOT call sqlite3_column_text() before
   // sqlite3_column_bytes(), which might leave us with a non-zero terminated
   // data struture, but this should be okay for BLOB.
   size_t sz = sqlite3_column_bytes(fStmt->fRes, npar);
   if ((Long_t)sz > size) {
      delete [](unsigned char*) mem;
      mem = (void*) new unsigned char[sz];
   }
   size = sz;

   memcpy(mem, sqlite3_column_blob(fStmt->fRes, npar), sz);

   return kTRUE;
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::GetDate(Int_t npar, Int_t& year, Int_t& month, Int_t& day)
{
   // Return field value as date.

   CheckGetField("GetDate", kFALSE);

   TString val = reinterpret_cast<const char*>(sqlite3_column_text(fStmt->fRes, npar));
   TDatime d = TDatime(val.Data());
   year = d.GetYear();
   month = d.GetMonth();
   day = d.GetDay();

   return kTRUE;
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::GetTime(Int_t npar, Int_t& hour, Int_t& min, Int_t& sec)
{
   // Return field as time.

   CheckGetField("GetTime", kFALSE);

   TString val = reinterpret_cast<const char*>(sqlite3_column_text(fStmt->fRes, npar));
   TDatime d = TDatime(val.Data());
   hour = d.GetHour();
   min = d.GetMinute();
   sec = d.GetSecond();

   return kTRUE;
}

//______________________________________________________________________________
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)
{
   // Return field value as date & time.

   CheckGetField("GetDatime", kFALSE);

   TString val = reinterpret_cast<const char*>(sqlite3_column_text(fStmt->fRes, npar));
   TDatime d = TDatime(val.Data());
   year = d.GetYear();
   month = d.GetMonth();
   day = d.GetDay();
   hour = d.GetHour();
   min = d.GetMinute();
   sec = d.GetSecond();

   return kTRUE;
}

//______________________________________________________________________________
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)
{
   // Return field as timestamp.
   // Second fraction is in milliseconds, which is also the precision all date and time functions of sqlite use.

   CheckGetField("GetTimestamp", kFALSE);

   TString val = reinterpret_cast<const char*>(sqlite3_column_text(fStmt->fRes, npar));

   Ssiz_t p = val.Last('.');
   TSubString ts_part = val(0, p);

   TDatime d(ts_part.Data());
   year = d.GetYear();
   month = d.GetMonth();
   day = d.GetDay();
   hour = d.GetHour();
   min = d.GetMinute();
   sec = d.GetSecond();

   TSubString s_frac = val(p, val.Length() - p+1);
   frac=(Int_t) (atof(s_frac.Data())*1.E3);

   return kTRUE;
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::SetNull(Int_t npar)
{
   // Set NULL as parameter value.

   int res = sqlite3_bind_null(fStmt->fRes, npar + 1);

   return CheckBindError("SetNull", res);
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::SetInt(Int_t npar, Int_t value)
{
   // Set parameter value as integer.

   int res = sqlite3_bind_int(fStmt->fRes, npar + 1, value);

   return CheckBindError("SetInt", res);
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::SetUInt(Int_t npar, UInt_t value)
{
   // Set parameter value as unsigned integer.
   // Actually casted to signed integer, has to be re-casted upon read!

   int res = sqlite3_bind_int(fStmt->fRes, npar + 1, (Int_t)value);

   return CheckBindError("SetUInt", res);
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::SetLong(Int_t npar, Long_t value)
{
   // Set parameter value as long.

   int res = sqlite3_bind_int64(fStmt->fRes, npar + 1, value);

   return CheckBindError("SetLong", res);
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::SetLong64(Int_t npar, Long64_t value)
{
   // Set parameter value as 64-bit integer.

   int res = sqlite3_bind_int64(fStmt->fRes, npar + 1, value);

   return CheckBindError("SetLong64", res);
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::SetULong64(Int_t npar, ULong64_t value)
{
   // Set parameter value as unsigned 64-bit integer.
   // Actually casted to signed integer, has to be re-casted upon read!

   int res = sqlite3_bind_int64(fStmt->fRes, npar + 1, (Long64_t)value);

   return CheckBindError("SetULong64", res);
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::SetDouble(Int_t npar, Double_t value)
{
   // Set parameter value as double value.

   int res = sqlite3_bind_double(fStmt->fRes, npar + 1, value);

   return CheckBindError("SetDouble", res);
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::SetString(Int_t npar, const char* value, Int_t maxsize)
{
   // Set parameter value as string.

   int res = sqlite3_bind_text(fStmt->fRes, npar + 1, value, maxsize, SQLITE_TRANSIENT);

   return CheckBindError("SetString", res);
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::SetBinary(Int_t npar, void* mem, Long_t size, Long_t /*maxsize*/)
{
   // Set parameter value as binary data.
   // Maxsize is ignored for SQLite, we directly insert BLOB of size 'size'.
   // Negative size would cause undefined behaviour, so we refuse that.

   if (size < 0) {
      SetError(-1, "Passing negative value to size for BLOB to SQLite would cause undefined behaviour, refusing it!", "SetBinary");
      return kFALSE;
   }

   int res = sqlite3_bind_blob(fStmt->fRes, npar + 1, mem, (size_t)size, SQLITE_TRANSIENT);

   return CheckBindError("SetBinary", res);
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::SetDate(Int_t npar, Int_t year, Int_t month, Int_t day)
{
   // Set parameter value as date.

   TDatime d = TDatime(year, month, day, 0, 0, 0);
   int res = sqlite3_bind_text(fStmt->fRes, npar + 1, (char*)d.AsSQLString(), -1, SQLITE_TRANSIENT);

   return CheckBindError("SetDate", res);
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::SetTime(Int_t npar, Int_t hour, Int_t min, Int_t sec)
{
   // Set parameter value as time.

   TDatime d = TDatime(2000, 1, 1, hour, min, sec);

   int res = sqlite3_bind_text(fStmt->fRes, npar + 1, (char*)d.AsSQLString(), -1, SQLITE_TRANSIENT);

   return CheckBindError("SetTime", res);
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::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.

   TDatime d = TDatime(year, month, day, hour, min, sec);

   int res = sqlite3_bind_text(fStmt->fRes, npar + 1, (char*)d.AsSQLString(), -1, SQLITE_TRANSIENT);

   return CheckBindError("SetDatime", res);
}

//______________________________________________________________________________
Bool_t TSQLiteStatement::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)
{
   // Set parameter value as timestamp.
   // The second fraction has to be in milliseconds,
   // as all SQLite functions for date and time assume 3 significant digits.

   TDatime d(year,month,day,hour,min,sec);
   TString value;
   value.Form("%s.%03d", (char*)d.AsSQLString(), frac);

   int res = sqlite3_bind_text(fStmt->fRes, npar + 1, value.Data(), -1, SQLITE_TRANSIENT);

   return CheckBindError("SetTimestamp", res);
}
 TSQLiteStatement.cxx:1
 TSQLiteStatement.cxx:2
 TSQLiteStatement.cxx:3
 TSQLiteStatement.cxx:4
 TSQLiteStatement.cxx:5
 TSQLiteStatement.cxx:6
 TSQLiteStatement.cxx:7
 TSQLiteStatement.cxx:8
 TSQLiteStatement.cxx:9
 TSQLiteStatement.cxx:10
 TSQLiteStatement.cxx:11
 TSQLiteStatement.cxx:12
 TSQLiteStatement.cxx:13
 TSQLiteStatement.cxx:14
 TSQLiteStatement.cxx:15
 TSQLiteStatement.cxx:16
 TSQLiteStatement.cxx:17
 TSQLiteStatement.cxx:18
 TSQLiteStatement.cxx:19
 TSQLiteStatement.cxx:20
 TSQLiteStatement.cxx:21
 TSQLiteStatement.cxx:22
 TSQLiteStatement.cxx:23
 TSQLiteStatement.cxx:24
 TSQLiteStatement.cxx:25
 TSQLiteStatement.cxx:26
 TSQLiteStatement.cxx:27
 TSQLiteStatement.cxx:28
 TSQLiteStatement.cxx:29
 TSQLiteStatement.cxx:30
 TSQLiteStatement.cxx:31
 TSQLiteStatement.cxx:32
 TSQLiteStatement.cxx:33
 TSQLiteStatement.cxx:34
 TSQLiteStatement.cxx:35
 TSQLiteStatement.cxx:36
 TSQLiteStatement.cxx:37
 TSQLiteStatement.cxx:38
 TSQLiteStatement.cxx:39
 TSQLiteStatement.cxx:40
 TSQLiteStatement.cxx:41
 TSQLiteStatement.cxx:42
 TSQLiteStatement.cxx:43
 TSQLiteStatement.cxx:44
 TSQLiteStatement.cxx:45
 TSQLiteStatement.cxx:46
 TSQLiteStatement.cxx:47
 TSQLiteStatement.cxx:48
 TSQLiteStatement.cxx:49
 TSQLiteStatement.cxx:50
 TSQLiteStatement.cxx:51
 TSQLiteStatement.cxx:52
 TSQLiteStatement.cxx:53
 TSQLiteStatement.cxx:54
 TSQLiteStatement.cxx:55
 TSQLiteStatement.cxx:56
 TSQLiteStatement.cxx:57
 TSQLiteStatement.cxx:58
 TSQLiteStatement.cxx:59
 TSQLiteStatement.cxx:60
 TSQLiteStatement.cxx:61
 TSQLiteStatement.cxx:62
 TSQLiteStatement.cxx:63
 TSQLiteStatement.cxx:64
 TSQLiteStatement.cxx:65
 TSQLiteStatement.cxx:66
 TSQLiteStatement.cxx:67
 TSQLiteStatement.cxx:68
 TSQLiteStatement.cxx:69
 TSQLiteStatement.cxx:70
 TSQLiteStatement.cxx:71
 TSQLiteStatement.cxx:72
 TSQLiteStatement.cxx:73
 TSQLiteStatement.cxx:74
 TSQLiteStatement.cxx:75
 TSQLiteStatement.cxx:76
 TSQLiteStatement.cxx:77
 TSQLiteStatement.cxx:78
 TSQLiteStatement.cxx:79
 TSQLiteStatement.cxx:80
 TSQLiteStatement.cxx:81
 TSQLiteStatement.cxx:82
 TSQLiteStatement.cxx:83
 TSQLiteStatement.cxx:84
 TSQLiteStatement.cxx:85
 TSQLiteStatement.cxx:86
 TSQLiteStatement.cxx:87
 TSQLiteStatement.cxx:88
 TSQLiteStatement.cxx:89
 TSQLiteStatement.cxx:90
 TSQLiteStatement.cxx:91
 TSQLiteStatement.cxx:92
 TSQLiteStatement.cxx:93
 TSQLiteStatement.cxx:94
 TSQLiteStatement.cxx:95
 TSQLiteStatement.cxx:96
 TSQLiteStatement.cxx:97
 TSQLiteStatement.cxx:98
 TSQLiteStatement.cxx:99
 TSQLiteStatement.cxx:100
 TSQLiteStatement.cxx:101
 TSQLiteStatement.cxx:102
 TSQLiteStatement.cxx:103
 TSQLiteStatement.cxx:104
 TSQLiteStatement.cxx:105
 TSQLiteStatement.cxx:106
 TSQLiteStatement.cxx:107
 TSQLiteStatement.cxx:108
 TSQLiteStatement.cxx:109
 TSQLiteStatement.cxx:110
 TSQLiteStatement.cxx:111
 TSQLiteStatement.cxx:112
 TSQLiteStatement.cxx:113
 TSQLiteStatement.cxx:114
 TSQLiteStatement.cxx:115
 TSQLiteStatement.cxx:116
 TSQLiteStatement.cxx:117
 TSQLiteStatement.cxx:118
 TSQLiteStatement.cxx:119
 TSQLiteStatement.cxx:120
 TSQLiteStatement.cxx:121
 TSQLiteStatement.cxx:122
 TSQLiteStatement.cxx:123
 TSQLiteStatement.cxx:124
 TSQLiteStatement.cxx:125
 TSQLiteStatement.cxx:126
 TSQLiteStatement.cxx:127
 TSQLiteStatement.cxx:128
 TSQLiteStatement.cxx:129
 TSQLiteStatement.cxx:130
 TSQLiteStatement.cxx:131
 TSQLiteStatement.cxx:132
 TSQLiteStatement.cxx:133
 TSQLiteStatement.cxx:134
 TSQLiteStatement.cxx:135
 TSQLiteStatement.cxx:136
 TSQLiteStatement.cxx:137
 TSQLiteStatement.cxx:138
 TSQLiteStatement.cxx:139
 TSQLiteStatement.cxx:140
 TSQLiteStatement.cxx:141
 TSQLiteStatement.cxx:142
 TSQLiteStatement.cxx:143
 TSQLiteStatement.cxx:144
 TSQLiteStatement.cxx:145
 TSQLiteStatement.cxx:146
 TSQLiteStatement.cxx:147
 TSQLiteStatement.cxx:148
 TSQLiteStatement.cxx:149
 TSQLiteStatement.cxx:150
 TSQLiteStatement.cxx:151
 TSQLiteStatement.cxx:152
 TSQLiteStatement.cxx:153
 TSQLiteStatement.cxx:154
 TSQLiteStatement.cxx:155
 TSQLiteStatement.cxx:156
 TSQLiteStatement.cxx:157
 TSQLiteStatement.cxx:158
 TSQLiteStatement.cxx:159
 TSQLiteStatement.cxx:160
 TSQLiteStatement.cxx:161
 TSQLiteStatement.cxx:162
 TSQLiteStatement.cxx:163
 TSQLiteStatement.cxx:164
 TSQLiteStatement.cxx:165
 TSQLiteStatement.cxx:166
 TSQLiteStatement.cxx:167
 TSQLiteStatement.cxx:168
 TSQLiteStatement.cxx:169
 TSQLiteStatement.cxx:170
 TSQLiteStatement.cxx:171
 TSQLiteStatement.cxx:172
 TSQLiteStatement.cxx:173
 TSQLiteStatement.cxx:174
 TSQLiteStatement.cxx:175
 TSQLiteStatement.cxx:176
 TSQLiteStatement.cxx:177
 TSQLiteStatement.cxx:178
 TSQLiteStatement.cxx:179
 TSQLiteStatement.cxx:180
 TSQLiteStatement.cxx:181
 TSQLiteStatement.cxx:182
 TSQLiteStatement.cxx:183
 TSQLiteStatement.cxx:184
 TSQLiteStatement.cxx:185
 TSQLiteStatement.cxx:186
 TSQLiteStatement.cxx:187
 TSQLiteStatement.cxx:188
 TSQLiteStatement.cxx:189
 TSQLiteStatement.cxx:190
 TSQLiteStatement.cxx:191
 TSQLiteStatement.cxx:192
 TSQLiteStatement.cxx:193
 TSQLiteStatement.cxx:194
 TSQLiteStatement.cxx:195
 TSQLiteStatement.cxx:196
 TSQLiteStatement.cxx:197
 TSQLiteStatement.cxx:198
 TSQLiteStatement.cxx:199
 TSQLiteStatement.cxx:200
 TSQLiteStatement.cxx:201
 TSQLiteStatement.cxx:202
 TSQLiteStatement.cxx:203
 TSQLiteStatement.cxx:204
 TSQLiteStatement.cxx:205
 TSQLiteStatement.cxx:206
 TSQLiteStatement.cxx:207
 TSQLiteStatement.cxx:208
 TSQLiteStatement.cxx:209
 TSQLiteStatement.cxx:210
 TSQLiteStatement.cxx:211
 TSQLiteStatement.cxx:212
 TSQLiteStatement.cxx:213
 TSQLiteStatement.cxx:214
 TSQLiteStatement.cxx:215
 TSQLiteStatement.cxx:216
 TSQLiteStatement.cxx:217
 TSQLiteStatement.cxx:218
 TSQLiteStatement.cxx:219
 TSQLiteStatement.cxx:220
 TSQLiteStatement.cxx:221
 TSQLiteStatement.cxx:222
 TSQLiteStatement.cxx:223
 TSQLiteStatement.cxx:224
 TSQLiteStatement.cxx:225
 TSQLiteStatement.cxx:226
 TSQLiteStatement.cxx:227
 TSQLiteStatement.cxx:228
 TSQLiteStatement.cxx:229
 TSQLiteStatement.cxx:230
 TSQLiteStatement.cxx:231
 TSQLiteStatement.cxx:232
 TSQLiteStatement.cxx:233
 TSQLiteStatement.cxx:234
 TSQLiteStatement.cxx:235
 TSQLiteStatement.cxx:236
 TSQLiteStatement.cxx:237
 TSQLiteStatement.cxx:238
 TSQLiteStatement.cxx:239
 TSQLiteStatement.cxx:240
 TSQLiteStatement.cxx:241
 TSQLiteStatement.cxx:242
 TSQLiteStatement.cxx:243
 TSQLiteStatement.cxx:244
 TSQLiteStatement.cxx:245
 TSQLiteStatement.cxx:246
 TSQLiteStatement.cxx:247
 TSQLiteStatement.cxx:248
 TSQLiteStatement.cxx:249
 TSQLiteStatement.cxx:250
 TSQLiteStatement.cxx:251
 TSQLiteStatement.cxx:252
 TSQLiteStatement.cxx:253
 TSQLiteStatement.cxx:254
 TSQLiteStatement.cxx:255
 TSQLiteStatement.cxx:256
 TSQLiteStatement.cxx:257
 TSQLiteStatement.cxx:258
 TSQLiteStatement.cxx:259
 TSQLiteStatement.cxx:260
 TSQLiteStatement.cxx:261
 TSQLiteStatement.cxx:262
 TSQLiteStatement.cxx:263
 TSQLiteStatement.cxx:264
 TSQLiteStatement.cxx:265
 TSQLiteStatement.cxx:266
 TSQLiteStatement.cxx:267
 TSQLiteStatement.cxx:268
 TSQLiteStatement.cxx:269
 TSQLiteStatement.cxx:270
 TSQLiteStatement.cxx:271
 TSQLiteStatement.cxx:272
 TSQLiteStatement.cxx:273
 TSQLiteStatement.cxx:274
 TSQLiteStatement.cxx:275
 TSQLiteStatement.cxx:276
 TSQLiteStatement.cxx:277
 TSQLiteStatement.cxx:278
 TSQLiteStatement.cxx:279
 TSQLiteStatement.cxx:280
 TSQLiteStatement.cxx:281
 TSQLiteStatement.cxx:282
 TSQLiteStatement.cxx:283
 TSQLiteStatement.cxx:284
 TSQLiteStatement.cxx:285
 TSQLiteStatement.cxx:286
 TSQLiteStatement.cxx:287
 TSQLiteStatement.cxx:288
 TSQLiteStatement.cxx:289
 TSQLiteStatement.cxx:290
 TSQLiteStatement.cxx:291
 TSQLiteStatement.cxx:292
 TSQLiteStatement.cxx:293
 TSQLiteStatement.cxx:294
 TSQLiteStatement.cxx:295
 TSQLiteStatement.cxx:296
 TSQLiteStatement.cxx:297
 TSQLiteStatement.cxx:298
 TSQLiteStatement.cxx:299
 TSQLiteStatement.cxx:300
 TSQLiteStatement.cxx:301
 TSQLiteStatement.cxx:302
 TSQLiteStatement.cxx:303
 TSQLiteStatement.cxx:304
 TSQLiteStatement.cxx:305
 TSQLiteStatement.cxx:306
 TSQLiteStatement.cxx:307
 TSQLiteStatement.cxx:308
 TSQLiteStatement.cxx:309
 TSQLiteStatement.cxx:310
 TSQLiteStatement.cxx:311
 TSQLiteStatement.cxx:312
 TSQLiteStatement.cxx:313
 TSQLiteStatement.cxx:314
 TSQLiteStatement.cxx:315
 TSQLiteStatement.cxx:316
 TSQLiteStatement.cxx:317
 TSQLiteStatement.cxx:318
 TSQLiteStatement.cxx:319
 TSQLiteStatement.cxx:320
 TSQLiteStatement.cxx:321
 TSQLiteStatement.cxx:322
 TSQLiteStatement.cxx:323
 TSQLiteStatement.cxx:324
 TSQLiteStatement.cxx:325
 TSQLiteStatement.cxx:326
 TSQLiteStatement.cxx:327
 TSQLiteStatement.cxx:328
 TSQLiteStatement.cxx:329
 TSQLiteStatement.cxx:330
 TSQLiteStatement.cxx:331
 TSQLiteStatement.cxx:332
 TSQLiteStatement.cxx:333
 TSQLiteStatement.cxx:334
 TSQLiteStatement.cxx:335
 TSQLiteStatement.cxx:336
 TSQLiteStatement.cxx:337
 TSQLiteStatement.cxx:338
 TSQLiteStatement.cxx:339
 TSQLiteStatement.cxx:340
 TSQLiteStatement.cxx:341
 TSQLiteStatement.cxx:342
 TSQLiteStatement.cxx:343
 TSQLiteStatement.cxx:344
 TSQLiteStatement.cxx:345
 TSQLiteStatement.cxx:346
 TSQLiteStatement.cxx:347
 TSQLiteStatement.cxx:348
 TSQLiteStatement.cxx:349
 TSQLiteStatement.cxx:350
 TSQLiteStatement.cxx:351
 TSQLiteStatement.cxx:352
 TSQLiteStatement.cxx:353
 TSQLiteStatement.cxx:354
 TSQLiteStatement.cxx:355
 TSQLiteStatement.cxx:356
 TSQLiteStatement.cxx:357
 TSQLiteStatement.cxx:358
 TSQLiteStatement.cxx:359
 TSQLiteStatement.cxx:360
 TSQLiteStatement.cxx:361
 TSQLiteStatement.cxx:362
 TSQLiteStatement.cxx:363
 TSQLiteStatement.cxx:364
 TSQLiteStatement.cxx:365
 TSQLiteStatement.cxx:366
 TSQLiteStatement.cxx:367
 TSQLiteStatement.cxx:368
 TSQLiteStatement.cxx:369
 TSQLiteStatement.cxx:370
 TSQLiteStatement.cxx:371
 TSQLiteStatement.cxx:372
 TSQLiteStatement.cxx:373
 TSQLiteStatement.cxx:374
 TSQLiteStatement.cxx:375
 TSQLiteStatement.cxx:376
 TSQLiteStatement.cxx:377
 TSQLiteStatement.cxx:378
 TSQLiteStatement.cxx:379
 TSQLiteStatement.cxx:380
 TSQLiteStatement.cxx:381
 TSQLiteStatement.cxx:382
 TSQLiteStatement.cxx:383
 TSQLiteStatement.cxx:384
 TSQLiteStatement.cxx:385
 TSQLiteStatement.cxx:386
 TSQLiteStatement.cxx:387
 TSQLiteStatement.cxx:388
 TSQLiteStatement.cxx:389
 TSQLiteStatement.cxx:390
 TSQLiteStatement.cxx:391
 TSQLiteStatement.cxx:392
 TSQLiteStatement.cxx:393
 TSQLiteStatement.cxx:394
 TSQLiteStatement.cxx:395
 TSQLiteStatement.cxx:396
 TSQLiteStatement.cxx:397
 TSQLiteStatement.cxx:398
 TSQLiteStatement.cxx:399
 TSQLiteStatement.cxx:400
 TSQLiteStatement.cxx:401
 TSQLiteStatement.cxx:402
 TSQLiteStatement.cxx:403
 TSQLiteStatement.cxx:404
 TSQLiteStatement.cxx:405
 TSQLiteStatement.cxx:406
 TSQLiteStatement.cxx:407
 TSQLiteStatement.cxx:408
 TSQLiteStatement.cxx:409
 TSQLiteStatement.cxx:410
 TSQLiteStatement.cxx:411
 TSQLiteStatement.cxx:412
 TSQLiteStatement.cxx:413
 TSQLiteStatement.cxx:414
 TSQLiteStatement.cxx:415
 TSQLiteStatement.cxx:416
 TSQLiteStatement.cxx:417
 TSQLiteStatement.cxx:418
 TSQLiteStatement.cxx:419
 TSQLiteStatement.cxx:420
 TSQLiteStatement.cxx:421
 TSQLiteStatement.cxx:422
 TSQLiteStatement.cxx:423
 TSQLiteStatement.cxx:424
 TSQLiteStatement.cxx:425
 TSQLiteStatement.cxx:426
 TSQLiteStatement.cxx:427
 TSQLiteStatement.cxx:428
 TSQLiteStatement.cxx:429
 TSQLiteStatement.cxx:430
 TSQLiteStatement.cxx:431
 TSQLiteStatement.cxx:432
 TSQLiteStatement.cxx:433
 TSQLiteStatement.cxx:434
 TSQLiteStatement.cxx:435
 TSQLiteStatement.cxx:436
 TSQLiteStatement.cxx:437
 TSQLiteStatement.cxx:438
 TSQLiteStatement.cxx:439
 TSQLiteStatement.cxx:440
 TSQLiteStatement.cxx:441
 TSQLiteStatement.cxx:442
 TSQLiteStatement.cxx:443
 TSQLiteStatement.cxx:444
 TSQLiteStatement.cxx:445
 TSQLiteStatement.cxx:446
 TSQLiteStatement.cxx:447
 TSQLiteStatement.cxx:448
 TSQLiteStatement.cxx:449
 TSQLiteStatement.cxx:450
 TSQLiteStatement.cxx:451
 TSQLiteStatement.cxx:452
 TSQLiteStatement.cxx:453
 TSQLiteStatement.cxx:454
 TSQLiteStatement.cxx:455
 TSQLiteStatement.cxx:456
 TSQLiteStatement.cxx:457
 TSQLiteStatement.cxx:458
 TSQLiteStatement.cxx:459
 TSQLiteStatement.cxx:460
 TSQLiteStatement.cxx:461
 TSQLiteStatement.cxx:462
 TSQLiteStatement.cxx:463
 TSQLiteStatement.cxx:464
 TSQLiteStatement.cxx:465
 TSQLiteStatement.cxx:466
 TSQLiteStatement.cxx:467
 TSQLiteStatement.cxx:468
 TSQLiteStatement.cxx:469
 TSQLiteStatement.cxx:470
 TSQLiteStatement.cxx:471
 TSQLiteStatement.cxx:472
 TSQLiteStatement.cxx:473
 TSQLiteStatement.cxx:474
 TSQLiteStatement.cxx:475
 TSQLiteStatement.cxx:476
 TSQLiteStatement.cxx:477
 TSQLiteStatement.cxx:478
 TSQLiteStatement.cxx:479
 TSQLiteStatement.cxx:480
 TSQLiteStatement.cxx:481
 TSQLiteStatement.cxx:482
 TSQLiteStatement.cxx:483
 TSQLiteStatement.cxx:484
 TSQLiteStatement.cxx:485
 TSQLiteStatement.cxx:486
 TSQLiteStatement.cxx:487
 TSQLiteStatement.cxx:488
 TSQLiteStatement.cxx:489
 TSQLiteStatement.cxx:490
 TSQLiteStatement.cxx:491
 TSQLiteStatement.cxx:492
 TSQLiteStatement.cxx:493
 TSQLiteStatement.cxx:494
 TSQLiteStatement.cxx:495
 TSQLiteStatement.cxx:496
 TSQLiteStatement.cxx:497
 TSQLiteStatement.cxx:498
 TSQLiteStatement.cxx:499
 TSQLiteStatement.cxx:500
 TSQLiteStatement.cxx:501
 TSQLiteStatement.cxx:502
 TSQLiteStatement.cxx:503
 TSQLiteStatement.cxx:504
 TSQLiteStatement.cxx:505
 TSQLiteStatement.cxx:506
 TSQLiteStatement.cxx:507
 TSQLiteStatement.cxx:508
 TSQLiteStatement.cxx:509
 TSQLiteStatement.cxx:510
 TSQLiteStatement.cxx:511
 TSQLiteStatement.cxx:512
 TSQLiteStatement.cxx:513
 TSQLiteStatement.cxx:514
 TSQLiteStatement.cxx:515
 TSQLiteStatement.cxx:516
 TSQLiteStatement.cxx:517
 TSQLiteStatement.cxx:518
 TSQLiteStatement.cxx:519
 TSQLiteStatement.cxx:520
 TSQLiteStatement.cxx:521
 TSQLiteStatement.cxx:522
 TSQLiteStatement.cxx:523
 TSQLiteStatement.cxx:524
 TSQLiteStatement.cxx:525
 TSQLiteStatement.cxx:526
 TSQLiteStatement.cxx:527
 TSQLiteStatement.cxx:528
 TSQLiteStatement.cxx:529
 TSQLiteStatement.cxx:530
 TSQLiteStatement.cxx:531
 TSQLiteStatement.cxx:532
 TSQLiteStatement.cxx:533
 TSQLiteStatement.cxx:534
 TSQLiteStatement.cxx:535
 TSQLiteStatement.cxx:536
 TSQLiteStatement.cxx:537
 TSQLiteStatement.cxx:538
 TSQLiteStatement.cxx:539
 TSQLiteStatement.cxx:540
 TSQLiteStatement.cxx:541
 TSQLiteStatement.cxx:542
 TSQLiteStatement.cxx:543
 TSQLiteStatement.cxx:544
 TSQLiteStatement.cxx:545
 TSQLiteStatement.cxx:546
 TSQLiteStatement.cxx:547
 TSQLiteStatement.cxx:548
 TSQLiteStatement.cxx:549
 TSQLiteStatement.cxx:550
 TSQLiteStatement.cxx:551
 TSQLiteStatement.cxx:552
 TSQLiteStatement.cxx:553
 TSQLiteStatement.cxx:554
 TSQLiteStatement.cxx:555
 TSQLiteStatement.cxx:556
 TSQLiteStatement.cxx:557
 TSQLiteStatement.cxx:558
 TSQLiteStatement.cxx:559
 TSQLiteStatement.cxx:560
 TSQLiteStatement.cxx:561
 TSQLiteStatement.cxx:562
 TSQLiteStatement.cxx:563
 TSQLiteStatement.cxx:564
 TSQLiteStatement.cxx:565
 TSQLiteStatement.cxx:566
 TSQLiteStatement.cxx:567
 TSQLiteStatement.cxx:568
 TSQLiteStatement.cxx:569
 TSQLiteStatement.cxx:570
 TSQLiteStatement.cxx:571
 TSQLiteStatement.cxx:572
 TSQLiteStatement.cxx:573
 TSQLiteStatement.cxx:574
 TSQLiteStatement.cxx:575
 TSQLiteStatement.cxx:576
 TSQLiteStatement.cxx:577
 TSQLiteStatement.cxx:578
 TSQLiteStatement.cxx:579
 TSQLiteStatement.cxx:580
 TSQLiteStatement.cxx:581
 TSQLiteStatement.cxx:582
 TSQLiteStatement.cxx:583
 TSQLiteStatement.cxx:584
 TSQLiteStatement.cxx:585
 TSQLiteStatement.cxx:586
 TSQLiteStatement.cxx:587
 TSQLiteStatement.cxx:588
 TSQLiteStatement.cxx:589
 TSQLiteStatement.cxx:590
 TSQLiteStatement.cxx:591
 TSQLiteStatement.cxx:592
 TSQLiteStatement.cxx:593
 TSQLiteStatement.cxx:594
 TSQLiteStatement.cxx:595
 TSQLiteStatement.cxx:596
 TSQLiteStatement.cxx:597
 TSQLiteStatement.cxx:598
 TSQLiteStatement.cxx:599
 TSQLiteStatement.cxx:600
 TSQLiteStatement.cxx:601
 TSQLiteStatement.cxx:602
 TSQLiteStatement.cxx:603
 TSQLiteStatement.cxx:604
 TSQLiteStatement.cxx:605
 TSQLiteStatement.cxx:606
 TSQLiteStatement.cxx:607
 TSQLiteStatement.cxx:608
 TSQLiteStatement.cxx:609
 TSQLiteStatement.cxx:610
 TSQLiteStatement.cxx:611
 TSQLiteStatement.cxx:612
 TSQLiteStatement.cxx:613
 TSQLiteStatement.cxx:614
 TSQLiteStatement.cxx:615
 TSQLiteStatement.cxx:616
 TSQLiteStatement.cxx:617