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