Skip to content

Commit

Permalink
Preparation of wxSQLite3 version 3.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
utelle committed Apr 9, 2016
1 parent 2a75ab1 commit f1b6fc6
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 15 additions & 7 deletions include/wx/wxsqlite3.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions include/wx/wxsqlite3def.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
<dl>
<dt><b>3.3.1</b> - <i>April 2016</i></dt>
<dd>
Upgrade to SQLite version 3.12.1<br>
Added method wxSQLite3Database::GetSystemErrorCode<br>
</dd>
<dt><b>3.3.0</b> - <i>December 2015</i></dt>
<dd>
Upgrade to SQLite version 3.9.2<br>
Expand Down
3 changes: 3 additions & 0 deletions include/wx/wxsqlite3dyn.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ tools operate in Unicode or UTF-8 mode.

## <a name="history"></a>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
Expand Down
24 changes: 22 additions & 2 deletions src/wxsqlite3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -4070,21 +4078,33 @@ 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")
};


/* static */
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];
}
Expand Down

0 comments on commit f1b6fc6

Please sign in to comment.