~ubuntu-branches/ubuntu/wily/ginkgocadx/wily-proposed

« back to all changes in this revision

Viewing changes to src/cadxcore/wx/wxsqlite3/wxsqlite3def.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Tille
  • Date: 2011-05-02 08:09:26 UTC
  • Revision ID: james.westby@ubuntu.com-20110502080926-bql5wep49c7hg91t
Tags: upstream-2.4.1.1
ImportĀ upstreamĀ versionĀ 2.4.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
//              2011-02-09  - Upgrade to SQLite3 version 3.7.5
 
56
//              2011-04-17  - Upgrade to SQLite3 version 3.7.6.1
 
57
//
 
58
// Copyright:   (c) Ulrich Telle
 
59
// Licence:     wxWindows licence
 
60
///////////////////////////////////////////////////////////////////////////////
 
61
 
 
62
/// \file wxsqlite3def.h Compile time switches for the wxSQLite3 class
 
63
 
 
64
/** \mainpage wxSQLite3
 
65
 
 
66
\section intro What is wxSQLite3?
 
67
 
 
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.
 
70
 
 
71
  Several solutions already exist to access SQLite databases. To name just a few:
 
72
 
 
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.
 
76
 
 
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.
 
79
 
 
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
 
83
    are supported.
 
84
 
 
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.
 
89
 
 
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.
 
94
 
 
95
\section version Version history
 
96
 
 
97
<dl>
 
98
 
 
99
<dt><b>2.1.1</b> - <i>April 2011</i></dt>
 
100
<dd>
 
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>
 
104
 
 
105
</dd>
 
106
<dt><b>2.1.0</b> - <i>March 2011</i></dt>
 
107
<dd>
 
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>
 
112
 
 
113
</dd>
 
114
<dt><b>2.0.2</b> - <i>December 2010</i></dt>
 
115
<dd>
 
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>
 
119
 
 
120
</dd>
 
121
<dt><b>2.0.1</b> - <i>October 2010</i></dt>
 
122
<dd>
 
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>
 
127
 
 
128
</dd>
 
129
<dt><b>2.0.0</b> - <i>July 2010</i></dt>
 
130
<dd>
 
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>
 
137
 
 
138
</dd>
 
139
<dt><b>1.9.9</b> - <i>March 2010</i></dt>
 
140
<dd>
 
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>
 
145
 
 
146
</dd>
 
147
<dt><b>1.9.8</b> - <i>February 2010</i></dt>
 
148
<dd>
 
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>
 
152
 
 
153
</dd>
 
154
<dt><b>1.9.7</b> - <i>November 2009</i></dt>
 
155
<dd>
 
156
Upgrade to SQLite version 3.6.20<br>
 
157
Added methods to query, enable or disable foreign key support<br>
 
158
 
 
159
</dd>
 
160
<dt><b>1.9.6</b> - <i>September 2009</i></dt>
 
161
<dd>
 
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>
 
169
 
 
170
</dd>
 
171
<dt><b>1.9.5</b> - <i>February 2009</i></dt>
 
172
<dd>
 
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>
 
176
 
 
177
</dd>
 
178
<dt><b>1.9.4</b> - <i>January 2009</i></dt>
 
179
<dd>
 
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>
 
185
 
 
186
</dd>
 
187
<dt><b>1.9.3</b> - <i>December 2008</i></dt>
 
188
<dd>
 
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>
 
193
 
 
194
</dd>
 
195
<dt><b>1.9.2</b> - <i>November 2008</i></dt>
 
196
<dd>
 
197
Upgrade to SQLite version 3.6.6<br>
 
198
Added RAII transaction class (see docs for details)<br>
 
199
 
 
200
</dd>
 
201
<dt><b>1.9.1</b> - <i>September 2008</i></dt>
 
202
<dd>
 
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>
 
208
 
 
209
</dd>
 
210
<dt><b>1.9.0</b> - <i>July 2008</i></dt>
 
211
<dd>
 
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.
 
220
 
 
221
</dd>
 
222
<dt><b>1.8.5</b> - <i>June 2008</i></dt>
 
223
<dd>
 
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.
 
228
 
 
229
</dd>
 
230
<dt><b>1.8.4</b> - <i>April 2008</i></dt>
 
231
<dd>
 
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.
 
236
 
 
237
</dd>
 
238
<dt><b>1.8.3</b> - <i>January 2008</i></dt>
 
239
<dd>
 
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)
 
243
 
 
244
</dd>
 
245
<dt><b>1.8.2</b> - <i>December 2007</i></dt>
 
246
<dd>
 
247
Upgrade to SQLite version 3.5.4<br>
 
248
Fixed a bug in wxSQLite3Database::Begin (wrong transaction type)
 
249
 
 
250
</dd>
 
251
<dt><b>1.8.1</b> - <i>November 2007</i></dt>
 
252
<dd>
 
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)
 
256
 
 
257
</dd>
 
258
<dt><b>1.8.0</b> - <i>November 2007</i></dt>
 
259
<dd>
 
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.
 
269
 
 
270
</dd>
 
271
<dt><b>1.7.3</b> - <i>May 2007</i></dt>
 
272
<dd>
 
273
Upgrade to SQLite version 3.3.17<br>
 
274
 
 
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
 
278
database files)
 
279
 
 
280
</dd>
 
281
<dt><b>1.7.2</b> - <i>February 2007</i></dt>
 
282
<dd>
 
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
 
287
 
 
288
</dd>
 
289
<dt><b>1.7.1</b> - <i>January 2007</i></dt>
 
290
<dd>
 
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>
 
295
 
 
296
</dd>
 
297
<dt><b>1.7.0</b> - <i>January 2007</i></dt>
 
298
<dd>
 
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
 
303
 
 
304
</dd>
 
305
<dt><b>1.6.0</b> - <i>July 2006</i></dt>
 
306
<dd>
 
307
Added support for user defined collation sequences
 
308
 
 
309
</dd>
 
310
<dt><b>1.5.3</b> - <i>June 2006</i></dt>
 
311
<dd>
 
312
Upgrade to SQLite version 3.3.6<br>
 
313
Added support for optional SQLite meta data methods
 
314
 
 
315
</dd>
 
316
<dt><b>1.5.2</b> - <i>March 2006</i></dt>
 
317
<dd>
 
318
Fixed a bug in wxSQLite3Database::Prepare<br>
 
319
Added wxSQLite3Database::IsOpen for convenience
 
320
 
 
321
</dd>
 
322
<dt><b>1.5.1</b> - <i>February 2006</i></dt>
 
323
<dd>
 
324
Upgrade to SQLite version 3.3.4 (wxMSW only)
 
325
 
 
326
</dd>
 
327
<dt><b>1.5</b> - <i>February 2006</i></dt>
 
328
<dd>
 
329
Upgrade to SQLite version 3.3.3<br>
 
330
Added support for commit, rollback and update callbacks
 
331
 
 
332
</dd>
 
333
<dt><b>1.4.2</b> - <i>November 2005</i></dt>
 
334
<dd>
 
335
Optimized code for wxString arguments
 
336
 
 
337
</dd>
 
338
<dt><b>1.4.1</b> - <i>November 2005</i></dt>
 
339
<dd>
 
340
Fixed a bug in wxSQLite3Database::TableExists,<br>
 
341
Changed the handling of Unicode string conversion,<br>
 
342
Added support for different transaction types
 
343
 
 
344
</dd>
 
345
<dt><b>1.4</b> - <i>November 2005</i></dt>
 
346
<dd>
 
347
Optionally load the SQLite library dynamically at run time.
 
348
 
 
349
</dd>
 
350
<dt><b>1.3.1</b> - <i>November 2005</i></dt>
 
351
<dd>
 
352
Corrected wxSQLite3ResultSet::GetInt64.<br>
 
353
Added wxSQLite3Table::GetInt64
 
354
 
 
355
</dd>
 
356
<dt><b>1.3</b> - <i>October 2005</i></dt>
 
357
<dd>
 
358
Added wxGTK build support<br>
 
359
 
 
360
</dd>
 
361
<dt><b>1.2</b> - <i>October 2005</i></dt>
 
362
<dd>
 
363
Corrected error in wxSQLite3Table::FindColumnIndex<br>
 
364
 
 
365
</dd>
 
366
<dt><b>1.1</b> - <i>October 2005</i></dt>
 
367
<dd>
 
368
Upgrade to SQLite version 3.2.7 <br>
 
369
 
 
370
</dd>
 
371
 
 
372
<dt><b>1.0</b> - <i>July 2005</i></dt>
 
373
<dd>
 
374
First public release
 
375
</dd>
 
376
</dl>
 
377
 
 
378
\author Ulrich Telle (<a href="&#109;&#97;&#105;&#108;&#116;&#111;:&#117;&#108;&#114;&#105;&#99;&#104;&#46;&#116;&#101;&#108;&#108;&#101;&#64;&#103;&#109;&#120;&#46;&#100;&#101;">ulrich DOT telle AT gmx DOT de</a>)
 
379
 
 
380
\section ackn Acknowledgements
 
381
 
 
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.
 
385
 
 
386
The following people have contributed to wxSQLite3:
 
387
 
 
388
<ul>
 
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>
 
392
</ul>
 
393
 
 
394
 */
 
395
 
 
396
#ifndef _WX_SQLITE3_DEF_H_
 
397
#define _WX_SQLITE3_DEF_H_
 
398
 
 
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
 
407
#endif
 
408
 
 
409
/*
 
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:
 
414
 */
 
415
#if defined(__WINDOWS__) && defined(__GNUC__)
 
416
  #define WXDLLIMPEXP_FWD_SQLITE3
 
417
#else
 
418
  #define WXDLLIMPEXP_FWD_SQLITE3 WXDLLIMPEXP_SQLITE3
 
419
#endif
 
420
 
 
421
#endif // _WX_SQLITE3_DEF_H_