Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields  

db.DbQuery_SQLITE.h

00001 /*----------------------------------------------------------------------------
00002   SWORD 2000 - Software With Objects for Rapid Development
00003   Copyright (C) 2003 Eric NICOLAS
00004   ----------------------------------------------------------------------------
00005   SWORD is free software; you can redistribute it and/or modify
00006   it under the terms of the GNU Lesser General Public License as published by
00007   the Free Software Foundation; either version 2 of the License, or
00008   (at your option) any later version.
00009 
00010   SWORD is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013   GNU Lesser General Public License for more details.
00014 
00015   You should have received a copy of the GNU Lesser General Public License
00016   along with SWORD; if not, write to the Free Software
00017   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018   --------------------------------------------------------------------------*/
00019 #ifndef _SWORD_DB_DBQUERY_SQLITE_
00020 #define _SWORD_DB_DBQUERY_SQLITE_
00021 
00022 // This is available only if you have enabled the "db.odbc" feature
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 } // namespace sword
00059 
00060 #endif // HAVE_DB_SQLITE
00061 
00062 #endif // _SWORD_DB_DBQUERY_SQLITE_

Generated on Tue Dec 23 20:08:56 2003 for SWORD by doxygen1.3-rc2