From f1b6fc62e6aa4cfc37796266ae60f1b51193f124 Mon Sep 17 00:00:00 2001 From: utelle Date: Sat, 9 Apr 2016 23:31:02 +0200 Subject: [PATCH] Preparation of wxSQLite3 version 3.3.1 --- docs/Doxyfile | 2 +- include/wx/wxsqlite3.h | 22 +++++++++++++++------- include/wx/wxsqlite3def.h | 7 +++++++ include/wx/wxsqlite3dyn.h | 3 +++ readme.md | 6 +++--- src/wxsqlite3.cpp | 24 ++++++++++++++++++++++-- 6 files changed, 51 insertions(+), 13 deletions(-) diff --git a/docs/Doxyfile b/docs/Doxyfile index f8479b13..29912734 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = wxSQLite3 # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 3.3.0 +PROJECT_NUMBER = 3.3.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/include/wx/wxsqlite3.h b/include/wx/wxsqlite3.h index ce95be31..4d958c96 100644 --- a/include/wx/wxsqlite3.h +++ b/include/wx/wxsqlite3.h @@ -27,7 +27,7 @@ #include "wx/wxsqlite3def.h" /// wxSQLite3 version string -#define wxSQLITE3_VERSION_STRING wxT("wxSQLite3 3.3.0") +#define wxSQLITE3_VERSION_STRING wxT("wxSQLite3 3.3.1") #define WXSQLITE_ERROR 1000 @@ -65,7 +65,8 @@ enum wxSQLite3LimitType WXSQLITE_LIMIT_ATTACHED = 7, WXSQLITE_LIMIT_LIKE_PATTERN_LENGTH = 8, WXSQLITE_LIMIT_VARIABLE_NUMBER = 9, - WXSQLITE_LIMIT_TRIGGER_DEPTH = 10 + WXSQLITE_LIMIT_TRIGGER_DEPTH = 10, + WXSQLITE_LIMIT_WORKER_THREADS = 11 }; /// Enumeration of journal modes @@ -98,9 +99,10 @@ enum wxSQLite3StatementStatus #define WXSQLITE_OPEN_SHAREDCACHE 0x00020000 #define WXSQLITE_OPEN_PRIVATECACHE 0x00040000 -#define WXSQLITE_CHECKPOINT_PASSIVE 0 -#define WXSQLITE_CHECKPOINT_FULL 1 -#define WXSQLITE_CHECKPOINT_RESTART 2 +#define WXSQLITE_CHECKPOINT_PASSIVE 0 +#define WXSQLITE_CHECKPOINT_FULL 1 +#define WXSQLITE_CHECKPOINT_RESTART 2 +#define WXSQLITE_CHECKPOINT_TRUNCATE 3 inline void operator++(wxSQLite3LimitType& value) { @@ -133,8 +135,8 @@ class WXDLLIMPEXP_SQLITE3 wxSQLite3Exception static const wxString ErrorCodeAsString(int errorCode); private: - int m_errorCode; ///< SQLite3 error code associated with this exception - wxString m_errorMessage; ///< SQLite3 error message associated with this exception + int m_errorCode; ///< SQLite3 error code associated with this exception + wxString m_errorMessage; ///< SQLite3 error message associated with this exception }; /// SQL statment buffer for use with SQLite3's printf method @@ -2662,6 +2664,12 @@ class WXDLLIMPEXP_SQLITE3 wxSQLite3Database */ void ReleaseMemory(); + /// Get system error code + /** + * Get the underlying system error code after a SQLite function has failed, i.e. a file couldn't be opened + */ + int GetSystemErrorCode() const; + /// Convert database limit type to string /** * \param type The database limit type to be converted to string representation. diff --git a/include/wx/wxsqlite3def.h b/include/wx/wxsqlite3def.h index 29a461a6..68e44167 100644 --- a/include/wx/wxsqlite3def.h +++ b/include/wx/wxsqlite3def.h @@ -47,6 +47,13 @@
+
3.3.1 - April 2016
+
+Upgrade to SQLite version 3.12.1
+Added method wxSQLite3Database::GetSystemErrorCode
+ + +
3.3.0 - December 2015
Upgrade to SQLite version 3.9.2
diff --git a/include/wx/wxsqlite3dyn.h b/include/wx/wxsqlite3dyn.h index 83d474b7..4745789d 100644 --- a/include/wx/wxsqlite3dyn.h +++ b/include/wx/wxsqlite3dyn.h @@ -183,6 +183,9 @@ DYNFUNC(return, int, sqlite3_stmt_readonly, (sqlite3_s #if SQLITE_VERSION_NUMBER >= 3007000 DYNFUNC(return, int, sqlite3_stmt_status, (sqlite3_stmt* pStmt, int op, int resetFlg), (pStmt, op, resetFlg)); #endif +#if SQLITE_VERSION_NUMBER >= 3012001 +DYNFUNC(return, int, sqlite3_system_errno, (sqlite3* db), (db)); +#endif DYNFUNC(return, int, sqlite3_threadsafe, (void), ()); // DYNFUNC(return, int, sqlite3_total_changes, (sqlite3 *db), (db)); // DYNFUNC(return, void *, sqlite3_trace, (sqlite3 *db, void(*xTrace)(void*,const char*), void *pArg), (db, xTrace, pArg)); diff --git a/readme.md b/readme.md index b6adf772..8fad74e9 100644 --- a/readme.md +++ b/readme.md @@ -25,12 +25,12 @@ tools operate in Unicode or UTF-8 mode. ## Version history +* 3.3.1 - *April 2016* + - Upgrade to SQLite version 3.12.1 + - Added method `wxSQLite3Database::GetSystemErrorCode` * 3.3.0 - *December 2015* - Upgrade to SQLite version 3.9.2 (including adjusted SQLite amalgamation source to fix problem with the user authentication module) - Transition from SourceForge to GitHub - - Removal of build files for wxWidgets 2.9.x - - Default build for wxWidgets 3.0.x - - Added support for premake5 (version 5.0-alpha6 or later) * 3.2.1 - *March 2015* - Upgrade to SQLite version 3.8.8.3 - Fixed a bug in method GetParamName diff --git a/src/wxsqlite3.cpp b/src/wxsqlite3.cpp index a25fa533..9febdaad 100644 --- a/src/wxsqlite3.cpp +++ b/src/wxsqlite3.cpp @@ -4031,7 +4031,11 @@ int wxSQLite3Database::GetLimit(wxSQLite3LimitType id) int value = -1; #if SQLITE_VERSION_NUMBER >= 3005008 CheckDatabase(); +#if SQLITE_VERSION_NUMBER >= 3008007 + if (id >= WXSQLITE_LIMIT_LENGTH && id <= WXSQLITE_LIMIT_WORKER_THREADS) +#else if (id >= WXSQLITE_LIMIT_LENGTH && id <= WXSQLITE_LIMIT_VARIABLE_NUMBER) +#endif { value = sqlite3_limit(m_db->m_db, id, -1); } @@ -4046,7 +4050,11 @@ int wxSQLite3Database::SetLimit(wxSQLite3LimitType id, int newValue) int value = -1; #if SQLITE_VERSION_NUMBER >= 3005008 CheckDatabase(); +#if SQLITE_VERSION_NUMBER >= 3008007 + if (id >= WXSQLITE_LIMIT_LENGTH && id <= WXSQLITE_LIMIT_WORKER_THREADS) +#else if (id >= WXSQLITE_LIMIT_LENGTH && id <= WXSQLITE_LIMIT_VARIABLE_NUMBER) +#endif { value = sqlite3_limit(m_db->m_db, id, newValue); } @@ -4070,13 +4078,25 @@ void wxSQLite3Database::ReleaseMemory() #endif } +int wxSQLite3Database::GetSystemErrorCode() const +{ + int rc = 0; +#if SQLITE_VERSION_NUMBER >= 3012000 + if (m_db != NULL) + { + rc = sqlite3_system_errno(m_db->m_db); + } +#endif + return rc; +} + static const wxChar* limitCodeString[] = { wxT("SQLITE_LIMIT_LENGTH"), wxT("SQLITE_LIMIT_SQL_LENGTH"), wxT("SQLITE_LIMIT_COLUMN"), wxT("SQLITE_LIMIT_EXPR_DEPTH"), wxT("SQLITE_LIMIT_COMPOUND_SELECT"), wxT("SQLITE_LIMIT_VDBE_OP"), wxT("SQLITE_LIMIT_FUNCTION_ARG"), wxT("SQLITE_LIMIT_ATTACHED"), wxT("SQLITE_LIMIT_LIKE_PATTERN_LENGTH"), wxT("SQLITE_LIMIT_VARIABLE_NUMBER"), - wxT("SQLITE_LIMIT_TRIGGER_DEPTH") + wxT("SQLITE_LIMIT_TRIGGER_DEPTH"), wxT("SQLITE_LIMIT_WORKER_THREADS") }; @@ -4084,7 +4104,7 @@ static const wxChar* limitCodeString[] = wxString wxSQLite3Database::LimitTypeToString(wxSQLite3LimitType type) { const wxChar* limitString = wxT("Unknown"); - if (type >= WXSQLITE_LIMIT_LENGTH && type <= WXSQLITE_LIMIT_VARIABLE_NUMBER) + if (type >= WXSQLITE_LIMIT_LENGTH && type <= WXSQLITE_LIMIT_WORKER_THREADS) { limitString = limitCodeString[type]; }