00001 #ifndef OSQL_LITE_DRIVER_H 00002 #define OSQL_LITE_DRIVER_H 00003 00004 #include <sqlite3.h> 00005 #include <sys/types.h> 00006 #include <regex.h> 00007 00008 #include "osqldriver.h" 00009 #include "osqlerror.h" 00010 #include "osqlresult.h" 00011 00012 namespace Opie { 00013 namespace DB { 00014 namespace Internal { 00015 00016 struct sqregex { 00017 char *regex_raw; 00018 regex_t regex_c; 00019 }; 00020 00021 class OSQLiteDriver : public OSQLDriver { 00022 Q_OBJECT 00023 public: 00024 OSQLiteDriver( QLibrary *lib = 0l ); 00025 ~OSQLiteDriver(); 00026 QString id()const; 00027 void setUserName( const QString& ); 00028 void setPassword( const QString& ); 00029 void setUrl( const QString& url ); 00030 void setOptions( const QStringList& ); 00031 bool open(); 00032 bool close(); 00033 OSQLError lastError(); 00034 OSQLResult query( OSQLQuery* ); 00035 OSQLTable::ValueList tables()const; 00036 00037 private: 00038 OSQLError m_lastE; 00039 OSQLResult m_result; 00040 OSQLResultItem m_items; 00041 int handleCallBack( int, char**, char** ); 00042 static int call_back( void*, int, char**, char** ); 00043 QString m_url; 00044 sqlite3 *m_sqlite; 00045 sqregex sqreg; 00046 }; 00047 } 00048 } 00049 } 00050 00051 #endif
1.4.2