11 #include "KVSQLiteResult.h"
18 using namespace std::chrono_literals;
30 fResult = (sqlite3_stmt*)
result;
61 sqlite3_finalize(fResult);
75 Error(
"IsValid",
"result set closed");
78 if (field < 0 || field >= GetFieldCount()) {
79 Error(
"IsValid",
"field index out of bounds");
95 Error(
"GetFieldCount",
"result set closed");
98 return sqlite3_column_count(fResult);
111 Error(
"GetFieldName",
"result set closed");
114 return sqlite3_column_name(fResult, field);
141 Error(
"Next",
"result set closed");
145 int ret = sqlite3_step(fResult);
146 if ((ret != SQLITE_DONE) && (ret != SQLITE_ROW)) {
147 if(ret == SQLITE_BUSY)
154 Info(
"Next",
"DB locked: retry same statement processing in 50ms...(%d)",i);
155 std::this_thread::sleep_for(50ms);
156 ret = sqlite3_step(fResult);
158 while((i<4) && ((ret != SQLITE_DONE) && (ret != SQLITE_ROW)));
159 if ((ret != SQLITE_DONE) && (ret != SQLITE_ROW))
161 Error(
"Next",
"SQL Error: %d %s", ret, sqlite3_errmsg(sqlite3_db_handle(fResult)));
165 Info(
"Next",
"...statement processing successful!");
166 if (ret == SQLITE_DONE) {
172 Error(
"Next",
"SQL Error: %d %s", ret, sqlite3_errmsg(sqlite3_db_handle(fResult)));
175 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