From df93ea865e9e1dc4c9c59e8143df5c4a33132b4b Mon Sep 17 00:00:00 2001 From: Alexandra Dobrescu <alexandra-maria.dobrescu@cern.ch> Date: Mon, 16 Jul 2018 14:44:34 +0200 Subject: [PATCH] [sqlite] Document that SQLite will always return -1 as rowCount. --- sql/sqlite/inc/TSQLiteResult.h | 1 + sql/sqlite/src/TSQLiteResult.cxx | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/sql/sqlite/inc/TSQLiteResult.h b/sql/sqlite/inc/TSQLiteResult.h index 4d9197ad32f..1ed07a4561c 100644 --- a/sql/sqlite/inc/TSQLiteResult.h +++ b/sql/sqlite/inc/TSQLiteResult.h @@ -35,6 +35,7 @@ public: void Close(Option_t *opt=""); Int_t GetFieldCount(); const char *GetFieldName(Int_t field); + Int_t GetRowCount() const; TSQLRow *Next(); ClassDef(TSQLiteResult, 0) // SQLite query result diff --git a/sql/sqlite/src/TSQLiteResult.cxx b/sql/sqlite/src/TSQLiteResult.cxx index 8f18d742c0f..937cab16071 100644 --- a/sql/sqlite/src/TSQLiteResult.cxx +++ b/sql/sqlite/src/TSQLiteResult.cxx @@ -86,6 +86,15 @@ const char *TSQLiteResult::GetFieldName(Int_t field) return sqlite3_column_name(fResult, field); } +//////////////////////////////////////////////////////////////////////////////// +/// SQLite can not determine the row count for a Query, return -1 instead. +/// For similar functionality, call Next() until it retruns nullptr. + +Int_t TSQLiteResult::GetRowCount() const +{ + return -1; +} + //////////////////////////////////////////////////////////////////////////////// /// Get next query result row. The returned object must be /// deleted by the user. -- GitLab