00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _SWORD_DB_DBQUERY_SQLITE_
00020 #define _SWORD_DB_DBQUERY_SQLITE_
00021
00022
00023 #ifdef HAVE_DB_SQLITE
00024
00025 #include "sword/db.DbQuery.h"
00026 #include "sword/db.DbConnection_SQLITE.h"
00027
00028 namespace sword {
00029
00030 class SWORDDECL DbQuery_SQLITE : public DbQuery {
00031 public:
00032 DbQuery_SQLITE(DbConnection_SQLITE* con, int timeout = 120);
00033 virtual ~DbQuery_SQLITE();
00034
00035 virtual bool exec(const std::string& sql, bool reportWarningsAsErrors = true);
00036 virtual bool nextRow();
00037 virtual bool nextSet();
00038 virtual int columns();
00039
00040 virtual Variant get(word column);
00041 virtual Variant get(const std::string& column);
00042
00043 private:
00044 DbConnection_SQLITE *con_;
00045
00046 sqlite_vm *vm_;
00047 bool firstRow_;
00048 word columns_;
00049 const char *tail_;
00050 const char **values_;
00051 const char **columnNames_;
00052
00053 void execOne_(const char *sql);
00054 bool fetchRow_();
00055 word columnPosition_(const std::string& columnName);
00056 };
00057
00058 }
00059
00060 #endif // HAVE_DB_SQLITE
00061
00062 #endif // _SWORD_DB_DBQUERY_SQLITE_