设为首页 加入收藏

TOP

C++使用Sqlite3,使用CppSQLite3的封装(二)
2016-04-27 17:25:21 】 浏览:2627
Tags:使用 Sqlite3 CppSQLite3 封装
nt nField); const char* fieldValue(const char* szField); int getIntField(int nField, int nNullValue=0); int getIntField(const char* szField, int nNullValue=0); sqlite_int64 getInt64Field(int nField, sqlite_int64 nNullValue=0); sqlite_int64 getInt64Field(const char* szField, sqlite_int64 nNullValue=0); double getFloatField(int nField, double fNullValue=0.0); double getFloatField(const char* szField, double fNullValue=0.0); const char* getStringField(int nField, const char* szNullValue=""); const char* getStringField(const char* szField, const char* szNullValue=""); const unsigned char* getBlobField(int nField, int& nLen); const unsigned char* getBlobField(const char* szField, int& nLen); bool fieldIsNull(int nField); bool fieldIsNull(const char* szField); bool eof(); void nextRow(); void finalize(); private: void checkVM(); sqlite3* mpDB; sqlite3_stmt* mpVM; bool mbEof; int mnCols; bool mbOwnVM; }; class CppSQLite3Table { public: CppSQLite3Table(); CppSQLite3Table(const CppSQLite3Table& rTable); CppSQLite3Table(char** paszResults, int nRows, int nCols); virtual ~CppSQLite3Table(); CppSQLite3Table& operator=(const CppSQLite3Table& rTable); int numFields(); int numRows(); const char* fieldName(int nCol); const char* fieldValue(int nField); const char* fieldValue(const char* szField); int getIntField(int nField, int nNullValue=0); int getIntField(const char* szField, int nNullValue=0); double getFloatField(int nField, double fNullValue=0.0); double getFloatField(const char* szField, double fNullValue=0.0); const char* getStringField(int nField, const char* szNullValue=""); const char* getStringField(const char* szField, const char* szNullValue=""); bool fieldIsNull(int nField); bool fieldIsNull(const char* szField); void setRow(int nRow); void finalize(); private: void checkResults(); int mnCols; int mnRows; int mnCurrentRow; char** mpaszResults; }; class CppSQLite3Statement { public: CppSQLite3Statement(); CppSQLite3Statement(const CppSQLite3Statement& rStatement); CppSQLite3Statement(sqlite3* pDB, sqlite3_stmt* pVM); virtual ~CppSQLite3Statement(); CppSQLite3Statement& operator=(const CppSQLite3Statement& rStatement); int execDML(); CppSQLite3Query execQuery(); void bind(int nParam, const char* szValue); void bind(int nParam, const int nValue); void bind(int nParam, const double dwValue); void bind(int nParam, const unsigned char* blobValue, int nLen); void bindNull(int nParam); int bindParameterIndex(const char* szParam); void bind(const char* szParam, const char* szValue); void bind(const char* szParam, const int nValue); void bind(const char* szParam, const double dwValue); void bind(const char* szParam, const unsigned char* blobValue, int nLen); void bindNull(const char* szParam); void reset(); void finalize(); private: void checkDB(); void checkVM(); sqlite3* mpDB; sqlite3_stmt* mpVM; }; class CppSQLite3DB { public: CppSQLite3DB(); virtual ~CppSQLite3DB(); void open(const char* szFile); void close(); bool tableExists(const char* szTable); int execDML(const char* szSQL); CppSQLite3Query execQuery(const char* szSQL); int execScalar(const char* szSQL, int nNullValue=0); CppSQLite3Table getTable(const char* szSQL); CppSQLite3Statement compileStatement(const char* szSQL); sqlite_int64 lastRowId(); void interrupt() { sqlite3_interrupt(mpDB); } void setBusyTimeout(int nMillisecs); static const
首页 上一页 1 2 3 4 5 6 7 下一页 尾页 2/10/10
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇C++11新特性 下一篇c++内存管理

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目