12 #include "KVSQLiteResult.h"
19 using namespace std::chrono_literals;
31 fResult = (sqlite3_stmt*)
result;
62 sqlite3_finalize(fResult);
76 Error(
"IsValid",
"result set closed");
79 if (field < 0 || field >= GetFieldCount()) {
80 Error(
"IsValid",
"field index out of bounds");
96 Error(
"GetFieldCount",
"result set closed");
99 return sqlite3_column_count(fResult);
112 Error(
"GetFieldName",
"result set closed");
115 return sqlite3_column_name(fResult, field);
142 Error(
"Next",
"result set closed");
146 int ret = sqlite3_step(fResult);
147 if ((ret != SQLITE_DONE) && (ret != SQLITE_ROW)) {
148 if(ret == SQLITE_BUSY)
155 Info(
"Next",
"DB locked: retry same statement processing in 50ms...(%d)",i);
156 std::this_thread::sleep_for(50ms);
157 ret = sqlite3_step(fResult);
159 while((i<4) && ((ret != SQLITE_DONE) && (ret != SQLITE_ROW)));
160 if ((ret != SQLITE_DONE) && (ret != SQLITE_ROW))
162 Error(
"Next",
"SQL Error: %d %s", ret, sqlite3_errmsg(sqlite3_db_handle(fResult)));
166 Info(
"Next",
"...statement processing successful!");
167 if (ret == SQLITE_DONE) {
173 Error(
"Next",
"SQL Error: %d %s", ret, sqlite3_errmsg(sqlite3_db_handle(fResult)));
176 if (ret == SQLITE_DONE) {
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Modified copy of TSQLiteResult.
const char * GetFieldName(Int_t field) final
Get name of specified field.
KVSQLiteResult(void *result)
SQLite query result.
void Close(Option_t *opt="") final
Close query result.
~KVSQLiteResult()
Cleanup SQLite query result.
Bool_t IsValid(Int_t field)
Check if result set is open and field index within range.
Int_t GetFieldCount() final
Get number of fields in result.
Int_t GetRowCount() const final