0
|
1 ///////////////////////////////////////////////////////////////////////////////
|
|
2 // Name: wxsqlite3def.h
|
|
3 // Purpose: wxWidgets wrapper around the SQLite3 embedded database library.
|
|
4 // Author: Ulrich Telle
|
|
5 // Modified by:
|
|
6 // Created: 2005-07-14
|
|
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 //
|
|
56 // Copyright: (c) Ulrich Telle
|
|
57 // Licence: wxWindows licence
|
|
58 ///////////////////////////////////////////////////////////////////////////////
|
|
59
|
|
60 /// \file wxsqlite3def.h Compile time switches for the wxSQLite3 class
|
|
61
|
|
62 /** \mainpage wxSQLite3
|
|
63
|
|
64 \section intro What is wxSQLite3?
|
|
65
|
|
66 \b wxSQLite3 is a C++ wrapper around the public domain <a href="http://www.sqlite.org">SQLite 3.x</a> database
|
|
67 and is specifically designed for use in programs based on the \b wxWidgets library.
|
|
68
|
|
69 Several solutions already exist to access SQLite databases. To name just a few:
|
|
70
|
|
71 - <a href="http://sourceforge.net/projects/wxsqlite">wxSQLite</a> :
|
|
72 This is a wxWidgets wrapper for version 2.8.x of SQLite.
|
|
73 SQLite version 3.x has a lot more features - which are not supported by this wrapper.
|
|
74
|
|
75 - <a href="http://www.codeproject.com/database/CppSQLite.asp">CppSQLite</a> :
|
|
76 Not wxWidgets specific, but with (partial) support for the newer version 3.x of SQLite.
|
|
77
|
|
78 - <a href="http://wxcode.sf.net">DatabaseLayer</a> :
|
|
79 This is a database abstraction providing a JDBC-like interface to database I/O.
|
|
80 In the current version SQLite3, PostgreSQL, MySQL, Firebird, and ODBC database backends
|
|
81 are supported.
|
|
82
|
|
83 The component \b wxSQLite3 was inspired by all three mentioned SQLite wrappers.
|
|
84 \b wxSQLite3 does not try to hide the underlying database, in contrary almost all special features
|
|
85 of the SQLite3 version 3.x are supported, like for example the creation of user defined
|
|
86 scalar or aggregate functions.
|
|
87
|
|
88 Since SQLite stores strings in UTF-8 encoding, the wxSQLite3 methods provide automatic conversion
|
|
89 between wxStrings and UTF-8 strings. The methods ToUTF8 and FromUTF8 of the wxString class (available
|
|
90 since wxWidgets 2.8.4) are used for the conversion. Special care has to be taken if external administration
|
|
91 tools are used to modify the database contents, since not all of these tools operate in Unicode or UTF-8 mode.
|
|
92
|
|
93 \section version Version history
|
|
94
|
|
95 <dl>
|
|
96
|
|
97 <dt><b>2.0.2</b> - <i>December 2010</i></dt>
|
|
98 <dd>
|
|
99 Upgrade to SQLite version 3.7.4<br>
|
|
100 Added support for rebinding a BLOB object to a new row<br>
|
|
101 Added support for determining if an SQL statement writes the database<br>
|
|
102
|
|
103 </dd>
|
|
104 <dt><b>2.0.1</b> - <i>October 2010</i></dt>
|
|
105 <dd>
|
|
106 Upgrade to SQLite version 3.7.3<br>
|
|
107 Added parameter transferStatementOwnership to method wxSQLite3Statement::ExecuteQuery
|
|
108 to allow using the returned result set beyond the life time of the wxSQLite3Statement instance<br>
|
|
109 Eliminated the use of sqlite3_mprintf which caused linker problems when loading SQLite dynamically<br>
|
|
110
|
|
111 </dd>
|
|
112 <dt><b>2.0.0</b> - <i>July 2010</i></dt>
|
|
113 <dd>
|
|
114 Upgrade to SQLite version 3.7.0<br>
|
|
115 Fixed a bug in class wxSQLite3ResultSet<br>
|
|
116 Added support for SQLite's write-ahead log journal mode<br>
|
|
117 Added support for named collections (see class wxSQLite3NamedCollection)<br>
|
|
118 Changed UTF-8 string handling to use methods To/FromUTF8 of the wxString class (requires wxWidgets 2.8.4 or higher)<br>
|
|
119 Compatible with wxWidgets 2.9.1<br>
|
|
120
|
|
121 </dd>
|
|
122 <dt><b>1.9.9</b> - <i>March 2010</i></dt>
|
|
123 <dd>
|
|
124 Upgrade to SQLite version 3.6.23<br>
|
|
125 Fixed a bug when compiling for dynamic loading of SQLite<br>
|
|
126 Added static methods for accessing the run-time library compilation options diagnostics<br>
|
|
127 Added mathod FormatV to class wxSQLite3StatementBuffer<br>
|
|
128
|
|
129 </dd>
|
|
130 <dt><b>1.9.8</b> - <i>February 2010</i></dt>
|
|
131 <dd>
|
|
132 Upgrade to SQLite version 3.6.22<br>
|
|
133 Fixed a bug when compiling without precompiled header support
|
|
134 (by including wx/arrstr.h)<br>
|
|
135
|
|
136 </dd>
|
|
137 <dt><b>1.9.7</b> - <i>November 2009</i></dt>
|
|
138 <dd>
|
|
139 Upgrade to SQLite version 3.6.20<br>
|
|
140 Added methods to query, enable or disable foreign key support<br>
|
|
141
|
|
142 </dd>
|
|
143 <dt><b>1.9.6</b> - <i>September 2009</i></dt>
|
|
144 <dd>
|
|
145 Upgrade to SQLite version 3.6.18<br>
|
|
146 Added method to get the SQLite library source id<br>
|
|
147 Added flags parameter to wxSQLite3Database::Open to allow additional control over the database
|
|
148 connection (see http://www.sqlite.org/c3ref/open.html for further information)<br>
|
|
149 Fixed a potential memory leak in wxSQLite3Statement class<br>
|
|
150 Converted encryption extension from C++ to pure C to make it
|
|
151 compatible with the SQLite amalgamation.<br>
|
|
152
|
|
153 </dd>
|
|
154 <dt><b>1.9.5</b> - <i>February 2009</i></dt>
|
|
155 <dd>
|
|
156 Upgrade to SQLite version 3.6.11<br>
|
|
157 Added user defined function class for REGEXP operator.<br>
|
|
158 Added support for SQLite backup/restore API, introduced with SQLite 3.6.11<br>
|
|
159
|
|
160 </dd>
|
|
161 <dt><b>1.9.4</b> - <i>January 2009</i></dt>
|
|
162 <dd>
|
|
163 Upgrade to SQLite version 3.6.10<br>
|
|
164 Added support for savepoints, introduced with SQLite 3.6.8<br>
|
|
165 Added method IsOk to the classes wxSQLite3Statement, wxSQLite3Table and wxSQLite3ResultSet,
|
|
166 thus instances of these classes can be checked whether the associated SQLite database or
|
|
167 statement are valid without throwing an exception.<br>
|
|
168
|
|
169 </dd>
|
|
170 <dt><b>1.9.3</b> - <i>December 2008</i></dt>
|
|
171 <dd>
|
|
172 Upgrade to SQLite version 3.6.7<br>
|
|
173 Fixed a bug in method wxSQLite3Table::GetDouble
|
|
174 (conversion from string to double failed in non-US locales)<br>
|
|
175 Build system upgraded using Bakefile 0.2.5<br>
|
|
176
|
|
177 </dd>
|
|
178 <dt><b>1.9.2</b> - <i>November 2008</i></dt>
|
|
179 <dd>
|
|
180 Upgrade to SQLite version 3.6.6<br>
|
|
181 Added RAII transaction class (see docs for details)<br>
|
|
182
|
|
183 </dd>
|
|
184 <dt><b>1.9.1</b> - <i>September 2008</i></dt>
|
|
185 <dd>
|
|
186 Upgrade to SQLite version 3.6.2<br>
|
|
187 Introduced own step counting for aggregate user functions
|
|
188 since the sqlite3_aggregate_count function is now deprecated<br>
|
|
189 Enhanced wxSQLite3Database::TableExists method to query an attached database
|
|
190 for existence of a table or to query the main database and all attached databases<br>
|
|
191
|
|
192 </dd>
|
|
193 <dt><b>1.9.0</b> - <i>July 2008</i></dt>
|
|
194 <dd>
|
|
195 Upgrade to SQLite version 3.6.0<br>
|
|
196 The optional key based encryption support has been adapted to
|
|
197 support SQLite version 3.6.0.<br>
|
|
198 Added static methods to initialize and shutdown the SQLite library.<br>
|
|
199 Changed build system to support static library build against shared
|
|
200 wxWidgets build on Linux.<br>
|
|
201 Changed behaviour of wxSQLite3Database::Close method to finalize
|
|
202 all unfinalized prepared statements.
|
|
203
|
|
204 </dd>
|
|
205 <dt><b>1.8.5</b> - <i>June 2008</i></dt>
|
|
206 <dd>
|
|
207 Upgrade to SQLite version 3.5.9<br>
|
|
208 Integration of the optional key based encryption support into SQLite
|
|
209 has been made easier. Changes to original SQLite source files
|
|
210 are no longer necessary.
|
|
211
|
|
212 </dd>
|
|
213 <dt><b>1.8.4</b> - <i>April 2008</i></dt>
|
|
214 <dd>
|
|
215 Upgrade to SQLite version 3.5.8<br>
|
|
216 Added support for accessing database limits<br>
|
|
217 Changed method TableExists to check a table name case insensitive<br>
|
|
218 Fixed several minor issues in the build files.
|
|
219
|
|
220 </dd>
|
|
221 <dt><b>1.8.3</b> - <i>January 2008</i></dt>
|
|
222 <dd>
|
|
223 Added support for shared cache mode<br>
|
|
224 Added support for access to original SQL statement
|
|
225 for prepared statements (requires SQLite 3.5.3 or above)
|
|
226
|
|
227 </dd>
|
|
228 <dt><b>1.8.2</b> - <i>December 2007</i></dt>
|
|
229 <dd>
|
|
230 Upgrade to SQLite version 3.5.4<br>
|
|
231 Fixed a bug in wxSQLite3Database::Begin (wrong transaction type)
|
|
232
|
|
233 </dd>
|
|
234 <dt><b>1.8.1</b> - <i>November 2007</i></dt>
|
|
235 <dd>
|
|
236 Fixed a bug in in wxSQLite3Database::Close (resetting flag m_isEncrypted)<br>
|
|
237 Eliminated several compile time warnings (regarding unused parameters)<br>
|
|
238 Fixed a compile time bug in wxSQLite3Database::GetBlob (missing explicit type cast)
|
|
239
|
|
240 </dd>
|
|
241 <dt><b>1.8.0</b> - <i>November 2007</i></dt>
|
|
242 <dd>
|
|
243 Upgrade to SQLite version 3.5.2<br>
|
|
244 Support for SQLite incremental BLOBs<br>
|
|
245 Changed source code in the SQLite3 encryption extension to eliminate several warnings<br>
|
|
246 Changed default wxWidgets version to 2.8.x<br>
|
|
247 Adjusted sources for SQLite encryption support are included for all SQLite version from 3.3.1 up to 3.5.2<br>
|
|
248 SQLite link libraries for MinGW on Windows are included<br>
|
|
249 Added <code>WXMAKINGLIB_WXSQLITE3</code> compile time option
|
|
250 to support building wxSQLite3 as a static library while
|
|
251 using the shared libraries of wxWidgets.
|
|
252
|
|
253 </dd>
|
|
254 <dt><b>1.7.3</b> - <i>May 2007</i></dt>
|
|
255 <dd>
|
|
256 Upgrade to SQLite version 3.3.17<br>
|
|
257
|
|
258 Fixed a bug in the SQLite3 encryption extension
|
|
259 (MD5 algorithm was not aware of endianess on
|
|
260 big-endian platforms, resulting in non-portable
|
|
261 database files)
|
|
262
|
|
263 </dd>
|
|
264 <dt><b>1.7.2</b> - <i>February 2007</i></dt>
|
|
265 <dd>
|
|
266 Upgrade to SQLite version 3.3.12<br>
|
|
267 Support for loadable extensions is now optional
|
|
268 Check for optional wxSQLite3 features at runtime
|
|
269 wxSQLite3 API independent of optional features
|
|
270
|
|
271 </dd>
|
|
272 <dt><b>1.7.1</b> - <i>January 2007</i></dt>
|
|
273 <dd>
|
|
274 Fixed a bug in the key based database encryption feature
|
|
275 (The call to <b>sqlite3_rekey</b> in wxSQLite3Database::ReKey
|
|
276 could cause a program crash, when used to encrypt a previously
|
|
277 unencrypted database.)<br>
|
|
278
|
|
279 </dd>
|
|
280 <dt><b>1.7.0</b> - <i>January 2007</i></dt>
|
|
281 <dd>
|
|
282 Upgrade to SQLite version 3.3.10 (<b>Attention</b>: at least SQLite version 3.3.9 is required)<br>
|
|
283 Added support for BLOBs as wxMemoryBuffer objects<br>
|
|
284 Added support for loadable extensions<br>
|
|
285 Optional support for key based database encryption
|
|
286
|
|
287 </dd>
|
|
288 <dt><b>1.6.0</b> - <i>July 2006</i></dt>
|
|
289 <dd>
|
|
290 Added support for user defined collation sequences
|
|
291
|
|
292 </dd>
|
|
293 <dt><b>1.5.3</b> - <i>June 2006</i></dt>
|
|
294 <dd>
|
|
295 Upgrade to SQLite version 3.3.6<br>
|
|
296 Added support for optional SQLite meta data methods
|
|
297
|
|
298 </dd>
|
|
299 <dt><b>1.5.2</b> - <i>March 2006</i></dt>
|
|
300 <dd>
|
|
301 Fixed a bug in wxSQLite3Database::Prepare<br>
|
|
302 Added wxSQLite3Database::IsOpen for convenience
|
|
303
|
|
304 </dd>
|
|
305 <dt><b>1.5.1</b> - <i>February 2006</i></dt>
|
|
306 <dd>
|
|
307 Upgrade to SQLite version 3.3.4 (wxMSW only)
|
|
308
|
|
309 </dd>
|
|
310 <dt><b>1.5</b> - <i>February 2006</i></dt>
|
|
311 <dd>
|
|
312 Upgrade to SQLite version 3.3.3<br>
|
|
313 Added support for commit, rollback and update callbacks
|
|
314
|
|
315 </dd>
|
|
316 <dt><b>1.4.2</b> - <i>November 2005</i></dt>
|
|
317 <dd>
|
|
318 Optimized code for wxString arguments
|
|
319
|
|
320 </dd>
|
|
321 <dt><b>1.4.1</b> - <i>November 2005</i></dt>
|
|
322 <dd>
|
|
323 Fixed a bug in wxSQLite3Database::TableExists,<br>
|
|
324 Changed the handling of Unicode string conversion,<br>
|
|
325 Added support for different transaction types
|
|
326
|
|
327 </dd>
|
|
328 <dt><b>1.4</b> - <i>November 2005</i></dt>
|
|
329 <dd>
|
|
330 Optionally load the SQLite library dynamically at run time.
|
|
331
|
|
332 </dd>
|
|
333 <dt><b>1.3.1</b> - <i>November 2005</i></dt>
|
|
334 <dd>
|
|
335 Corrected wxSQLite3ResultSet::GetInt64.<br>
|
|
336 Added wxSQLite3Table::GetInt64
|
|
337
|
|
338 </dd>
|
|
339 <dt><b>1.3</b> - <i>October 2005</i></dt>
|
|
340 <dd>
|
|
341 Added wxGTK build support<br>
|
|
342
|
|
343 </dd>
|
|
344 <dt><b>1.2</b> - <i>October 2005</i></dt>
|
|
345 <dd>
|
|
346 Corrected error in wxSQLite3Table::FindColumnIndex<br>
|
|
347
|
|
348 </dd>
|
|
349 <dt><b>1.1</b> - <i>October 2005</i></dt>
|
|
350 <dd>
|
|
351 Upgrade to SQLite version 3.2.7 <br>
|
|
352
|
|
353 </dd>
|
|
354
|
|
355 <dt><b>1.0</b> - <i>July 2005</i></dt>
|
|
356 <dd>
|
|
357 First public release
|
|
358 </dd>
|
|
359 </dl>
|
|
360
|
|
361 \author Ulrich Telle (<a href="mailto:ulrich.telle@gmx.de">ulrich DOT telle AT gmx DOT de</a>)
|
|
362
|
|
363 \section ackn Acknowledgements
|
|
364
|
|
365 The following people have contributed to wxSQLite3:
|
|
366
|
|
367 <ul>
|
|
368 <li>Francesco Montorsi (enhancement of the build system)</li>
|
|
369 <li>Neville Dastur (enhancement of the method TableExists)</li>
|
|
370 <li>Tobias Langner (RAII class for managing transactions)</li>
|
|
371 </ul>
|
|
372
|
|
373 */
|
|
374
|
|
375 #ifndef _WX_SQLITE3_DEF_H_
|
|
376 #define _WX_SQLITE3_DEF_H_
|
|
377
|
|
378 #if defined(WXMAKINGLIB_WXSQLITE3)
|
|
379 #define WXDLLIMPEXP_SQLITE3
|
|
380 #elif defined(WXMAKINGDLL_WXSQLITE3)
|
|
381 #define WXDLLIMPEXP_SQLITE3 WXEXPORT
|
|
382 #elif defined(WXUSINGDLL_WXSQLITE3)
|
|
383 #define WXDLLIMPEXP_SQLITE3 WXIMPORT
|
|
384 #else // not making nor using DLL
|
|
385 #define WXDLLIMPEXP_SQLITE3
|
|
386 #endif
|
|
387
|
|
388 /*
|
|
389 GCC warns about using __declspec on forward declarations
|
|
390 while MSVC complains about forward declarations without
|
|
391 __declspec for the classes later declared with it. To hide this
|
|
392 difference a separate macro for forward declarations is defined:
|
|
393 */
|
|
394 #if defined(__WINDOWS__) && defined(__GNUC__)
|
|
395 #define WXDLLIMPEXP_FWD_SQLITE3
|
|
396 #else
|
|
397 #define WXDLLIMPEXP_FWD_SQLITE3 WXDLLIMPEXP_SQLITE3
|
|
398 #endif
|
|
399
|
|
400 #endif // _WX_SQLITE3_DEF_H_
|