1
///////////////////////////////////////////////////////////////////////////////
2
// Name: wxsqlite3def.h
3
// Purpose: wxWidgets wrapper around the SQLite3 embedded database library.
4
// Author: Ulrich Telle
7
// Changes: 2005-10-03 - Upgrade to SQLite3 version 3.2.7
8
// 2005-10-09 - Corrected error in wxSQLite3Table::FindColumnIndex
9
// 2005-10-30 - Added wxGTK build support
10
// 2005-11-01 - Corrected wxSQLite3ResultSet::GetInt64.
11
// Added wxSQLite3Table::GetInt64
12
// 2005-11-09 - Optionally load SQLite library dynamically
13
// 2006-02-01 - Upgrade to SQLite3 version 3.3.3
14
// 2006-02-12 - Upgrade to SQLite3 version 3.3.4 (wxMSW only)
15
// 2006-03-15 - Fixed a bug in wxSQLite3Database::Prepare
16
// Added wxSQLite3Database::IsOpen for convenience
17
// 2006-06-11 - Upgrade to SQLite3 version 3.3.6
18
// Added support for optional SQLite meta data methods
19
// 2007-01-11 - Upgrade to SQLite3 version 3.3.10
20
// Added support for BLOBs as wxMemoryBuffer objects
21
// Added support for loadable extensions
22
// Optional support for key based database encryption
23
// 2007-02-12 - Upgrade to SQLite3 version 3.3.12
24
// 2007-05-01 - Upgrade to SQLite3 version 3.3.17
25
// 2007-10-28 - Upgrade to SQLite3 version 3.5.2
26
// 2007-11-17 - Fixed a bug in wxSQLite3Database::Close
27
// Eliminated several compile time warnings
28
// 2007-12-19 - Upgrade to SQLite3 version 3.5.4
29
// Fixed a bug in wxSQLite3Database::Begin
30
// 2008-01-05 - Added support for shared cache mode
31
// Added support for access to original SQL statement
32
// for prepared statements (requires SQLite 3.5.3 or above)
33
// 2008-04-27 - Upgrade to SQLite3 version 3.5.8
34
// Fixed several minor issues in the build files
35
// 2008-06-28 - Upgrade to SQLite3 version 3.5.9
36
// 2008-07-19 - Upgrade to SQLite3 version 3.6.0
37
// 2008-09-04 - Upgrade to SQLite3 version 3.6.2
38
// 2008-11-22 - Upgrade to SQLite3 version 3.6.6
39
// 2008-12-18 - Upgrade to SQLite3 version 3.6.7
40
// Fixed a bug in method wxSQLite3Table::GetDouble
41
// 2009-01-14 - Upgrade to SQLite3 version 3.6.10
42
// Added savepoint support
43
// Added IsOk methods to some classes
44
// 2009-02-21 - Upgrade to SQLite3 version 3.6.11
45
// Added user defined function class for REGEXP operator
46
// Added support for SQLite backup/restore API
47
// 2009-09-12 - Upgrade to SQLite3 version 3.6.18
48
// Fixed a potential memory leak in wxSQLite3Statement class
49
// 2009-11-07 - Upgrade to SQLite3 version 3.6.20
50
// 2010-02-05 - Upgrade to SQLite3 version 3.6.22
51
// 2010-03-11 - Upgrade to SQLite3 version 3.6.23
52
// 2010-07-25 - Upgrade to SQLite3 version 3.7.0
53
// 2010-10-10 - Upgrade to SQLite3 version 3.7.3
54
// 2010-12-11 - Upgrade to SQLite3 version 3.7.4
55
// 2011-02-09 - Upgrade to SQLite3 version 3.7.5
56
// 2011-04-17 - Upgrade to SQLite3 version 3.7.6.1
58
// Copyright: (c) Ulrich Telle
59
// Licence: wxWindows licence
60
///////////////////////////////////////////////////////////////////////////////
62
/// \file wxsqlite3def.h Compile time switches for the wxSQLite3 class
64
/** \mainpage wxSQLite3
66
\section intro What is wxSQLite3?
68
\b wxSQLite3 is a C++ wrapper around the public domain <a href="http://www.sqlite.org">SQLite 3.x</a> database
69
and is specifically designed for use in programs based on the \b wxWidgets library.
71
Several solutions already exist to access SQLite databases. To name just a few:
73
- <a href="http://sourceforge.net/projects/wxsqlite">wxSQLite</a> :
74
This is a wxWidgets wrapper for version 2.8.x of SQLite.
75
SQLite version 3.x has a lot more features - which are not supported by this wrapper.
77
- <a href="http://www.codeproject.com/database/CppSQLite.asp">CppSQLite</a> :
78
Not wxWidgets specific, but with (partial) support for the newer version 3.x of SQLite.
80
- <a href="http://wxcode.sf.net">DatabaseLayer</a> :
81
This is a database abstraction providing a JDBC-like interface to database I/O.
82
In the current version SQLite3, PostgreSQL, MySQL, Firebird, and ODBC database backends
85
The component \b wxSQLite3 was inspired by all three mentioned SQLite wrappers.
86
\b wxSQLite3 does not try to hide the underlying database, in contrary almost all special features
87
of the SQLite3 version 3.x are supported, like for example the creation of user defined
88
scalar or aggregate functions.
90
Since SQLite stores strings in UTF-8 encoding, the wxSQLite3 methods provide automatic conversion
91
between wxStrings and UTF-8 strings. The methods ToUTF8 and FromUTF8 of the wxString class (available
92
since wxWidgets 2.8.4) are used for the conversion. Special care has to be taken if external administration
93
tools are used to modify the database contents, since not all of these tools operate in Unicode or UTF-8 mode.
95
\section version Version history
99
<dt><b>2.1.1</b> - <i>April 2011</i></dt>
101
Upgrade to SQLite version 3.7.6.1<br>
102
Added convenience method wxSQLite3Statement::ExecuteScalar<br>
103
Changed write-ahead log checkpoint method to new version (v2)<br>
106
<dt><b>2.1.0</b> - <i>March 2011</i></dt>
108
Upgrade to SQLite version 3.7.5<br>
109
Added wxSQLite+, a database administration application written by Fred Cailleau-Lepetit,
110
as a GUI sample for wxSQLite3. Minor adjustments were applied to make wxSQLite+
111
compatible with wxWidgets 2.9.x. Please note that wxSQLite+ is under GPL license.<br>
114
<dt><b>2.0.2</b> - <i>December 2010</i></dt>
116
Upgrade to SQLite version 3.7.4<br>
117
Added support for rebinding a BLOB object to a new row<br>
118
Added support for determining if an SQL statement writes the database<br>
121
<dt><b>2.0.1</b> - <i>October 2010</i></dt>
123
Upgrade to SQLite version 3.7.3<br>
124
Added parameter transferStatementOwnership to method wxSQLite3Statement::ExecuteQuery
125
to allow using the returned result set beyond the life time of the wxSQLite3Statement instance<br>
126
Eliminated the use of sqlite3_mprintf which caused linker problems when loading SQLite dynamically<br>
129
<dt><b>2.0.0</b> - <i>July 2010</i></dt>
131
Upgrade to SQLite version 3.7.0<br>
132
Fixed a bug in class wxSQLite3ResultSet<br>
133
Added support for SQLite's write-ahead log journal mode<br>
134
Added support for named collections (see class wxSQLite3NamedCollection)<br>
135
Changed UTF-8 string handling to use methods To/FromUTF8 of the wxString class (requires wxWidgets 2.8.4 or higher)<br>
136
Compatible with wxWidgets 2.9.1<br>
139
<dt><b>1.9.9</b> - <i>March 2010</i></dt>
141
Upgrade to SQLite version 3.6.23<br>
142
Fixed a bug when compiling for dynamic loading of SQLite<br>
143
Added static methods for accessing the run-time library compilation options diagnostics<br>
144
Added mathod FormatV to class wxSQLite3StatementBuffer<br>
147
<dt><b>1.9.8</b> - <i>February 2010</i></dt>
149
Upgrade to SQLite version 3.6.22<br>
150
Fixed a bug when compiling without precompiled header support
151
(by including wx/arrstr.h)<br>
154
<dt><b>1.9.7</b> - <i>November 2009</i></dt>
156
Upgrade to SQLite version 3.6.20<br>
157
Added methods to query, enable or disable foreign key support<br>
160
<dt><b>1.9.6</b> - <i>September 2009</i></dt>
162
Upgrade to SQLite version 3.6.18<br>
163
Added method to get the SQLite library source id<br>
164
Added flags parameter to wxSQLite3Database::Open to allow additional control over the database
165
connection (see http://www.sqlite.org/c3ref/open.html for further information)<br>
166
Fixed a potential memory leak in wxSQLite3Statement class<br>
167
Converted encryption extension from C++ to pure C to make it
168
compatible with the SQLite amalgamation.<br>
171
<dt><b>1.9.5</b> - <i>February 2009</i></dt>
173
Upgrade to SQLite version 3.6.11<br>
174
Added user defined function class for REGEXP operator.<br>
175
Added support for SQLite backup/restore API, introduced with SQLite 3.6.11<br>
178
<dt><b>1.9.4</b> - <i>January 2009</i></dt>
180
Upgrade to SQLite version 3.6.10<br>
181
Added support for savepoints, introduced with SQLite 3.6.8<br>
182
Added method IsOk to the classes wxSQLite3Statement, wxSQLite3Table and wxSQLite3ResultSet,
183
thus instances of these classes can be checked whether the associated SQLite database or
184
statement are valid without throwing an exception.<br>
187
<dt><b>1.9.3</b> - <i>December 2008</i></dt>
189
Upgrade to SQLite version 3.6.7<br>
190
Fixed a bug in method wxSQLite3Table::GetDouble
191
(conversion from string to double failed in non-US locales)<br>
192
Build system upgraded using Bakefile 0.2.5<br>
195
<dt><b>1.9.2</b> - <i>November 2008</i></dt>
197
Upgrade to SQLite version 3.6.6<br>
198
Added RAII transaction class (see docs for details)<br>
201
<dt><b>1.9.1</b> - <i>September 2008</i></dt>
203
Upgrade to SQLite version 3.6.2<br>
204
Introduced own step counting for aggregate user functions
205
since the sqlite3_aggregate_count function is now deprecated<br>
206
Enhanced wxSQLite3Database::TableExists method to query an attached database
207
for existence of a table or to query the main database and all attached databases<br>
210
<dt><b>1.9.0</b> - <i>July 2008</i></dt>
212
Upgrade to SQLite version 3.6.0<br>
213
The optional key based encryption support has been adapted to
214
support SQLite version 3.6.0.<br>
215
Added static methods to initialize and shutdown the SQLite library.<br>
216
Changed build system to support static library build against shared
217
wxWidgets build on Linux.<br>
218
Changed behaviour of wxSQLite3Database::Close method to finalize
219
all unfinalized prepared statements.
222
<dt><b>1.8.5</b> - <i>June 2008</i></dt>
224
Upgrade to SQLite version 3.5.9<br>
225
Integration of the optional key based encryption support into SQLite
226
has been made easier. Changes to original SQLite source files
227
are no longer necessary.
230
<dt><b>1.8.4</b> - <i>April 2008</i></dt>
232
Upgrade to SQLite version 3.5.8<br>
233
Added support for accessing database limits<br>
234
Changed method TableExists to check a table name case insensitive<br>
235
Fixed several minor issues in the build files.
238
<dt><b>1.8.3</b> - <i>January 2008</i></dt>
240
Added support for shared cache mode<br>
241
Added support for access to original SQL statement
242
for prepared statements (requires SQLite 3.5.3 or above)
245
<dt><b>1.8.2</b> - <i>December 2007</i></dt>
247
Upgrade to SQLite version 3.5.4<br>
248
Fixed a bug in wxSQLite3Database::Begin (wrong transaction type)
251
<dt><b>1.8.1</b> - <i>November 2007</i></dt>
253
Fixed a bug in in wxSQLite3Database::Close (resetting flag m_isEncrypted)<br>
254
Eliminated several compile time warnings (regarding unused parameters)<br>
255
Fixed a compile time bug in wxSQLite3Database::GetBlob (missing explicit type cast)
258
<dt><b>1.8.0</b> - <i>November 2007</i></dt>
260
Upgrade to SQLite version 3.5.2<br>
261
Support for SQLite incremental BLOBs<br>
262
Changed source code in the SQLite3 encryption extension to eliminate several warnings<br>
263
Changed default wxWidgets version to 2.8.x<br>
264
Adjusted sources for SQLite encryption support are included for all SQLite version from 3.3.1 up to 3.5.2<br>
265
SQLite link libraries for MinGW on Windows are included<br>
266
Added <code>WXMAKINGLIB_WXSQLITE3</code> compile time option
267
to support building wxSQLite3 as a static library while
268
using the shared libraries of wxWidgets.
271
<dt><b>1.7.3</b> - <i>May 2007</i></dt>
273
Upgrade to SQLite version 3.3.17<br>
275
Fixed a bug in the SQLite3 encryption extension
276
(MD5 algorithm was not aware of endianess on
277
big-endian platforms, resulting in non-portable
281
<dt><b>1.7.2</b> - <i>February 2007</i></dt>
283
Upgrade to SQLite version 3.3.12<br>
284
Support for loadable extensions is now optional
285
Check for optional wxSQLite3 features at runtime
286
wxSQLite3 API independent of optional features
289
<dt><b>1.7.1</b> - <i>January 2007</i></dt>
291
Fixed a bug in the key based database encryption feature
292
(The call to <b>sqlite3_rekey</b> in wxSQLite3Database::ReKey
293
could cause a program crash, when used to encrypt a previously
294
unencrypted database.)<br>
297
<dt><b>1.7.0</b> - <i>January 2007</i></dt>
299
Upgrade to SQLite version 3.3.10 (<b>Attention</b>: at least SQLite version 3.3.9 is required)<br>
300
Added support for BLOBs as wxMemoryBuffer objects<br>
301
Added support for loadable extensions<br>
302
Optional support for key based database encryption
305
<dt><b>1.6.0</b> - <i>July 2006</i></dt>
307
Added support for user defined collation sequences
310
<dt><b>1.5.3</b> - <i>June 2006</i></dt>
312
Upgrade to SQLite version 3.3.6<br>
313
Added support for optional SQLite meta data methods
316
<dt><b>1.5.2</b> - <i>March 2006</i></dt>
318
Fixed a bug in wxSQLite3Database::Prepare<br>
319
Added wxSQLite3Database::IsOpen for convenience
322
<dt><b>1.5.1</b> - <i>February 2006</i></dt>
324
Upgrade to SQLite version 3.3.4 (wxMSW only)
327
<dt><b>1.5</b> - <i>February 2006</i></dt>
329
Upgrade to SQLite version 3.3.3<br>
330
Added support for commit, rollback and update callbacks
333
<dt><b>1.4.2</b> - <i>November 2005</i></dt>
335
Optimized code for wxString arguments
338
<dt><b>1.4.1</b> - <i>November 2005</i></dt>
340
Fixed a bug in wxSQLite3Database::TableExists,<br>
341
Changed the handling of Unicode string conversion,<br>
342
Added support for different transaction types
345
<dt><b>1.4</b> - <i>November 2005</i></dt>
347
Optionally load the SQLite library dynamically at run time.
350
<dt><b>1.3.1</b> - <i>November 2005</i></dt>
352
Corrected wxSQLite3ResultSet::GetInt64.<br>
353
Added wxSQLite3Table::GetInt64
356
<dt><b>1.3</b> - <i>October 2005</i></dt>
358
Added wxGTK build support<br>
361
<dt><b>1.2</b> - <i>October 2005</i></dt>
363
Corrected error in wxSQLite3Table::FindColumnIndex<br>
366
<dt><b>1.1</b> - <i>October 2005</i></dt>
368
Upgrade to SQLite version 3.2.7 <br>
372
<dt><b>1.0</b> - <i>July 2005</i></dt>
378
\author Ulrich Telle (<a href="mailto:ulrich.telle@gmx.de">ulrich DOT telle AT gmx DOT de</a>)
380
\section ackn Acknowledgements
382
Kudos to <b>Fred Cailleau-Lepetit</b> for developing <b>wxSQLite+</b> as a sample demonstrating
383
the wxWidgets components <b>wxAUI</b> and <b>wxSQLite3</b> and for allowing it to be included
384
in the wxSQLite3 distribution.
386
The following people have contributed to wxSQLite3:
389
<li>Francesco Montorsi (enhancement of the build system)</li>
390
<li>Neville Dastur (enhancement of the method TableExists)</li>
391
<li>Tobias Langner (RAII class for managing transactions)</li>
396
#ifndef _WX_SQLITE3_DEF_H_
397
#define _WX_SQLITE3_DEF_H_
399
#if defined(WXMAKINGLIB_WXSQLITE3)
400
#define WXDLLIMPEXP_SQLITE3
401
#elif defined(WXMAKINGDLL_WXSQLITE3)
402
#define WXDLLIMPEXP_SQLITE3 WXEXPORT
403
#elif defined(WXUSINGDLL_WXSQLITE3)
404
#define WXDLLIMPEXP_SQLITE3 WXIMPORT
405
#else // not making nor using DLL
406
#define WXDLLIMPEXP_SQLITE3
410
GCC warns about using __declspec on forward declarations
411
while MSVC complains about forward declarations without
412
__declspec for the classes later declared with it. To hide this
413
difference a separate macro for forward declarations is defined:
415
#if defined(__WINDOWS__) && defined(__GNUC__)
416
#define WXDLLIMPEXP_FWD_SQLITE3
418
#define WXDLLIMPEXP_FWD_SQLITE3 WXDLLIMPEXP_SQLITE3
421
#endif // _WX_SQLITE3_DEF_H_