设为首页 加入收藏

TOP

C++使用Sqlite3,使用CppSQLite3的封装(三)
2016-04-27 17:25:21 】 浏览:2633
Tags:使用 Sqlite3 CppSQLite3 封装
char* SQLiteVersion() { return SQLITE_VERSION; } static const char* SQLiteHeaderVersion() { return SQLITE_VERSION; } static const char* SQLiteLibraryVersion() { return sqlite3_libversion(); } static int SQLiteLibraryVersionNumber() { return sqlite3_libversion_number(); } bool IsAutoCommitOn(); private: CppSQLite3DB(const CppSQLite3DB& db); CppSQLite3DB& operator=(const CppSQLite3DB& db); sqlite3_stmt* compile(const char* szSQL); void checkDB(); sqlite3* mpDB; int mnBusyTimeoutMs; }; #endif

CppSQLite3.cpp

////////////////////////////////////////////////////////////////////////////////
// CppSQLite3 - A C++ wrapper around the SQLite3 embedded database library.
//
// Copyright (c) 2004..2007 Rob Groves. All Rights Reserved. rob.groves@btinternet.com
// 
// Permission to use, copy, modify, and distribute this software and its
// documentation for any purpose, without fee, and without a written
// agreement, is hereby granted, provided that the above copyright notice, 
// this paragraph and the following two paragraphs appear in all copies, 
// modifications, and distributions.
//
// IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT,
// INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST
// PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
// EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF
// ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". THE AUTHOR HAS NO OBLIGATION
// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
//
// V3.0     03/08/2004  -Initial Version for sqlite3
//
// V3.1     16/09/2004  -Implemented getXXXXField using sqlite3 functions
//                      -Added CppSQLiteDB3::tableExists()
//
// V3.2     01/07/2005  -Fixed execScalar to handle a NULL result
//          12/07/2007  -Added int64 functions to CppSQLite3Query
//                      -Throw exception from CppSQLite3DB::close() if error
//                      -Trap above exception in CppSQLite3DB::~CppSQLite3DB()
//                      -Fix to CppSQLite3DB::compile() as provided by Dave Rollins.
//                      -sqlite3_prepare replaced with sqlite3_prepare_v2
//                      -Added Name based parameter binding to CppSQLite3Statement.
////////////////////////////////////////////////////////////////////////////////
#include "CppSQLite3.h"
#include 
   
     // Named constant for passing to CppSQLite3Exception when passing it a string // that cannot be deleted. static const bool DONT_DELETE_MSG=false; //////////////////////////////////////////////////////////////////////////////// // Prototypes for SQLite functions not included in SQLite DLL, but copied below // from SQLite encode.c //////////////////////////////////////////////////////////////////////////////// int sqlite3_encode_binary(const unsigned char *in, int n, unsigned char *out); int sqlite3_decode_binary(const unsigned char *in, unsigned char *out); //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// CppSQLite3Exception::CppSQLite3Exception(const int nErrCode, char* szErrMess, bool bDeleteMsg/*=true*/) : mnErrCode(nErrCode) { m
首页 上一页 1 2 3 4 5 6 7 下一页 尾页 3/10/10
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇C++11新特性 下一篇c++内存管理

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目