1 /******************************************************************************
2  * $Id: ogrsqlite3ext.h 355b41831cd2685c85d1aabe5b95665a2c6e99b7 2019-06-19 17:07:04 +0200 Even Rouault $
3  *
4  * Project:  OpenGIS Simple Features Reference Implementation
5  * Purpose:  Custom version of sqlite3ext.h to workaround issues with Spatialite amalgamation
6  * Author:   Even Rouault, even dot rouault at spatialys.com
7  *
8  ******************************************************************************
9  * Copyright (c) 2012-2013, Even Rouault <even dot rouault at spatialys.com>
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included
19  * in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  ****************************************************************************/
29 
30 /* Customized version of sqlite3ext.h to fix issues with */
31 /* Spatialite amalgamation sqlite3ext.h that defines */
32 /* sqlite3_macros that contradict the ones that should be defined */
33 /* by sqlite3ext.h !!! This is messy, but no other choice, */
34 /* except not using the sqlite3ext.h from spatialite amalgamation */
35 
36 #undef sqlite3_aggregate_context
37 
38 #undef sqlite3_aggregate_count
39 
40 #undef sqlite3_bind_blob
41 #undef sqlite3_bind_double
42 #undef sqlite3_bind_int
43 #undef sqlite3_bind_int64
44 #undef sqlite3_bind_null
45 #undef sqlite3_bind_parameter_count
46 #undef sqlite3_bind_parameter_index
47 #undef sqlite3_bind_parameter_name
48 #undef sqlite3_bind_text
49 #undef sqlite3_bind_text16
50 #undef sqlite3_bind_value
51 #undef sqlite3_busy_handler
52 #undef sqlite3_busy_timeout
53 #undef sqlite3_changes
54 #undef sqlite3_close
55 #undef sqlite3_collation_needed
56 #undef sqlite3_collation_needed16
57 #undef sqlite3_column_blob
58 #undef sqlite3_column_bytes
59 #undef sqlite3_column_bytes16
60 #undef sqlite3_column_count
61 #undef sqlite3_column_database_name
62 #undef sqlite3_column_database_name16
63 #undef sqlite3_column_decltype
64 #undef sqlite3_column_decltype16
65 #undef sqlite3_column_double
66 #undef sqlite3_column_int
67 #undef sqlite3_column_int64
68 #undef sqlite3_column_name
69 #undef sqlite3_column_name16
70 #undef sqlite3_column_origin_name
71 #undef sqlite3_column_origin_name16
72 #undef sqlite3_column_table_name
73 #undef sqlite3_column_table_name16
74 #undef sqlite3_column_text
75 #undef sqlite3_column_text16
76 #undef sqlite3_column_type
77 #undef sqlite3_column_value
78 #undef sqlite3_commit_hook
79 #undef sqlite3_complete
80 #undef sqlite3_complete16
81 #undef sqlite3_create_collation
82 #undef sqlite3_create_collation16
83 #undef sqlite3_create_function
84 #undef sqlite3_create_function16
85 #undef sqlite3_create_module
86 #undef sqlite3_create_module_v2
87 #undef sqlite3_data_count
88 #undef sqlite3_db_handle
89 #undef sqlite3_declare_vtab
90 #undef sqlite3_enable_shared_cache
91 #undef sqlite3_errcode
92 #undef sqlite3_errmsg
93 #undef sqlite3_errmsg16
94 #undef sqlite3_exec
95 
96 #undef sqlite3_expired
97 
98 #undef sqlite3_finalize
99 #undef sqlite3_free
100 #undef sqlite3_free_table
101 #undef sqlite3_get_autocommit
102 #undef sqlite3_get_auxdata
103 #undef sqlite3_get_table
104 
105 #undef sqlite3_global_recover
106 
107 #undef sqlite3_interrupt
108 #undef sqlite3_last_insert_rowid
109 #undef sqlite3_libversion
110 #undef sqlite3_libversion_number
111 #undef sqlite3_malloc
112 #undef sqlite3_mprintf
113 #undef sqlite3_open
114 #undef sqlite3_open16
115 #undef sqlite3_prepare
116 #undef sqlite3_prepare16
117 #undef sqlite3_prepare_v2
118 #undef sqlite3_prepare16_v2
119 #undef sqlite3_profile
120 #undef sqlite3_progress_handler
121 #undef sqlite3_realloc
122 #undef sqlite3_reset
123 #undef sqlite3_result_blob
124 #undef sqlite3_result_double
125 #undef sqlite3_result_error
126 #undef sqlite3_result_error16
127 #undef sqlite3_result_int
128 #undef sqlite3_result_int64
129 #undef sqlite3_result_null
130 #undef sqlite3_result_text
131 #undef sqlite3_result_text16
132 #undef sqlite3_result_text16be
133 #undef sqlite3_result_text16le
134 #undef sqlite3_result_value
135 #undef sqlite3_rollback_hook
136 #undef sqlite3_set_authorizer
137 #undef sqlite3_set_auxdata
138 #undef sqlite3_snprintf
139 #undef sqlite3_step
140 #undef sqlite3_table_column_metadata
141 #undef sqlite3_thread_cleanup
142 #undef sqlite3_total_changes
143 #undef sqlite3_trace
144 
145 #undef sqlite3_transfer_bindings
146 
147 #undef sqlite3_update_hook
148 #undef sqlite3_user_data
149 #undef sqlite3_value_blob
150 #undef sqlite3_value_bytes
151 #undef sqlite3_value_bytes16
152 #undef sqlite3_value_double
153 #undef sqlite3_value_int
154 #undef sqlite3_value_int64
155 #undef sqlite3_value_numeric_type
156 #undef sqlite3_value_text
157 #undef sqlite3_value_text16
158 #undef sqlite3_value_text16be
159 #undef sqlite3_value_text16le
160 #undef sqlite3_value_type
161 #undef sqlite3_vmprintf
162 #undef sqlite3_overload_function
163 #undef sqlite3_prepare_v2
164 #undef sqlite3_prepare16_v2
165 #undef sqlite3_clear_bindings
166 #undef sqlite3_bind_zeroblob
167 #undef sqlite3_blob_bytes
168 #undef sqlite3_blob_close
169 #undef sqlite3_blob_open
170 #undef sqlite3_blob_read
171 #undef sqlite3_blob_write
172 #undef sqlite3_create_collation_v2
173 #undef sqlite3_file_control
174 #undef sqlite3_memory_highwater
175 #undef sqlite3_memory_used
176 #undef sqlite3_mutex_alloc
177 #undef sqlite3_mutex_enter
178 #undef sqlite3_mutex_free
179 #undef sqlite3_mutex_leave
180 #undef sqlite3_mutex_try
181 #undef sqlite3_open_v2
182 #undef sqlite3_release_memory
183 #undef sqlite3_result_error_nomem
184 #undef sqlite3_result_error_toobig
185 #undef sqlite3_sleep
186 #undef sqlite3_soft_heap_limit
187 #undef sqlite3_vfs_find
188 #undef sqlite3_vfs_register
189 #undef sqlite3_vfs_unregister
190 #undef sqlite3_threadsafe
191 #undef sqlite3_result_zeroblob
192 #undef sqlite3_result_error_code
193 #undef sqlite3_test_control
194 #undef sqlite3_randomness
195 #undef sqlite3_context_db_handle
196 #undef sqlite3_extended_result_codes
197 #undef sqlite3_limit
198 #undef sqlite3_next_stmt
199 #undef sqlite3_sql
200 #undef sqlite3_status
201 #undef sqlite3_backup_finish
202 #undef sqlite3_backup_init
203 #undef sqlite3_backup_pagecount
204 #undef sqlite3_backup_remaining
205 #undef sqlite3_backup_step
206 #undef sqlite3_compileoption_get
207 #undef sqlite3_compileoption_used
208 #undef sqlite3_create_function_v2
209 #undef sqlite3_db_config
210 #undef sqlite3_db_mutex
211 #undef sqlite3_db_status
212 #undef sqlite3_extended_errcode
213 #undef sqlite3_log
214 #undef sqlite3_soft_heap_limit64
215 #undef sqlite3_sourceid
216 #undef sqlite3_stmt_status
217 #undef sqlite3_strnicmp
218 #undef sqlite3_unlock_notify
219 #undef sqlite3_wal_autocheckpoint
220 #undef sqlite3_wal_checkpoint
221 #undef sqlite3_wal_hook
222 #undef sqlite3_blob_reopen
223 #undef sqlite3_vtab_config
224 #undef sqlite3_vtab_on_conflict
225 
226 typedef struct sqlite3_backup ogr_sqlite3_backup;
227 
228 /*
229 ** 2006 June 7
230 **
231 ** The author disclaims copyright to this source code.  In place of
232 ** a legal notice, here is a blessing:
233 **
234 **    May you do good and not evil.
235 **    May you find forgiveness for yourself and forgive others.
236 **    May you share freely, never taking more than you give.
237 **
238 *************************************************************************
239 ** This header file defines the SQLite interface for use by
240 ** shared libraries that want to be imported as extensions into
241 ** an SQLite instance.  Shared libraries that intend to be loaded
242 ** as extensions by SQLite should #include this file instead of
243 ** sqlite3.h.
244 */
245 #ifndef SQLITE3EXT_H_
246 #define SQLITE3EXT_H_
247 
248 // Commented out to avoid reimporting the #define sqlite3_xxx macros
249 //#include "sqlite3.h"
250 
251 typedef struct sqlite3_api_routines sqlite3_api_routines;
252 
253 /*
254 ** The following structure holds pointers to all of the SQLite API
255 ** routines.
256 **
257 ** WARNING:  In order to maintain backwards compatibility, add new
258 ** interfaces to the end of this structure only.  If you insert new
259 ** interfaces in the middle of this structure, then older different
260 ** versions of SQLite will not be able to load each others' shared
261 ** libraries!
262 */
263 struct sqlite3_api_routines {
264   void * (*aggregate_context)(sqlite3_context*,int nBytes);
265   int  (*aggregate_count)(sqlite3_context*);
266   int  (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));
267   int  (*bind_double)(sqlite3_stmt*,int,double);
268   int  (*bind_int)(sqlite3_stmt*,int,int);
269   int  (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);
270   int  (*bind_null)(sqlite3_stmt*,int);
271   int  (*bind_parameter_count)(sqlite3_stmt*);
272   int  (*bind_parameter_index)(sqlite3_stmt*,const char*zName);
273   const char * (*bind_parameter_name)(sqlite3_stmt*,int);
274   int  (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));
275   int  (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));
276   int  (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);
277   int  (*busy_handler)(sqlite3*,int(*)(void*,int),void*);
278   int  (*busy_timeout)(sqlite3*,int ms);
279   int  (*changes)(sqlite3*);
280   int  (*close)(sqlite3*);
281   int  (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,
282                            int eTextRep,const char*));
283   int  (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,
284                              int eTextRep,const void*));
285   const void * (*column_blob)(sqlite3_stmt*,int iCol);
286   int  (*column_bytes)(sqlite3_stmt*,int iCol);
287   int  (*column_bytes16)(sqlite3_stmt*,int iCol);
288   int  (*column_count)(sqlite3_stmt*pStmt);
289   const char * (*column_database_name)(sqlite3_stmt*,int);
290   const void * (*column_database_name16)(sqlite3_stmt*,int);
291   const char * (*column_decltype)(sqlite3_stmt*,int i);
292   const void * (*column_decltype16)(sqlite3_stmt*,int);
293   double  (*column_double)(sqlite3_stmt*,int iCol);
294   int  (*column_int)(sqlite3_stmt*,int iCol);
295   sqlite_int64  (*column_int64)(sqlite3_stmt*,int iCol);
296   const char * (*column_name)(sqlite3_stmt*,int);
297   const void * (*column_name16)(sqlite3_stmt*,int);
298   const char * (*column_origin_name)(sqlite3_stmt*,int);
299   const void * (*column_origin_name16)(sqlite3_stmt*,int);
300   const char * (*column_table_name)(sqlite3_stmt*,int);
301   const void * (*column_table_name16)(sqlite3_stmt*,int);
302   const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);
303   const void * (*column_text16)(sqlite3_stmt*,int iCol);
304   int  (*column_type)(sqlite3_stmt*,int iCol);
305   sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);
306   void * (*commit_hook)(sqlite3*,int(*)(void*),void*);
307   int  (*complete)(const char*sql);
308   int  (*complete16)(const void*sql);
309   int  (*create_collation)(sqlite3*,const char*,int,void*,
310                            int(*)(void*,int,const void*,int,const void*));
311   int  (*create_collation16)(sqlite3*,const void*,int,void*,
312                              int(*)(void*,int,const void*,int,const void*));
313   int  (*create_function)(sqlite3*,const char*,int,int,void*,
314                           void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
315                           void (*xStep)(sqlite3_context*,int,sqlite3_value**),
316                           void (*xFinal)(sqlite3_context*));
317   int  (*create_function16)(sqlite3*,const void*,int,int,void*,
318                             void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
319                             void (*xStep)(sqlite3_context*,int,sqlite3_value**),
320                             void (*xFinal)(sqlite3_context*));
321   int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);
322   int  (*data_count)(sqlite3_stmt*pStmt);
323   sqlite3 * (*db_handle)(sqlite3_stmt*);
324   int (*declare_vtab)(sqlite3*,const char*);
325   int  (*enable_shared_cache)(int);
326   int  (*errcode)(sqlite3*db);
327   const char * (*errmsg)(sqlite3*);
328   const void * (*errmsg16)(sqlite3*);
329   int  (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);
330   int  (*expired)(sqlite3_stmt*);
331   int  (*finalize)(sqlite3_stmt*pStmt);
332   void  (*free)(void*);
333   void  (*free_table)(char**result);
334   int  (*get_autocommit)(sqlite3*);
335   void * (*get_auxdata)(sqlite3_context*,int);
336   int  (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);
337   int  (*global_recover)(void);
338   void  (*interruptx)(sqlite3*);
339   sqlite_int64  (*last_insert_rowid)(sqlite3*);
340   const char * (*libversion)(void);
341   int  (*libversion_number)(void);
342   void *(*malloc)(int);
343   char * (*mprintf)(const char*,...);
344   int  (*open)(const char*,sqlite3**);
345   int  (*open16)(const void*,sqlite3**);
346   int  (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
347   int  (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
348   void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);
349   void  (*progress_handler)(sqlite3*,int,int(*)(void*),void*);
350   void *(*realloc)(void*,int);
351   int  (*reset)(sqlite3_stmt*pStmt);
352   void  (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));
353   void  (*result_double)(sqlite3_context*,double);
354   void  (*result_error)(sqlite3_context*,const char*,int);
355   void  (*result_error16)(sqlite3_context*,const void*,int);
356   void  (*result_int)(sqlite3_context*,int);
357   void  (*result_int64)(sqlite3_context*,sqlite_int64);
358   void  (*result_null)(sqlite3_context*);
359   void  (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));
360   void  (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));
361   void  (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));
362   void  (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));
363   void  (*result_value)(sqlite3_context*,sqlite3_value*);
364   void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);
365   int  (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,
366                          const char*,const char*),void*);
367   void  (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
368   char * (*snprintf)(int,char*,const char*,...);
369   int  (*step)(sqlite3_stmt*);
370   int  (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,
371                                 char const**,char const**,int*,int*,int*);
372   void  (*thread_cleanup)(void);
373   int  (*total_changes)(sqlite3*);
374   void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);
375   int  (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);
376   void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,
377                                          sqlite_int64),void*);
378   void * (*user_data)(sqlite3_context*);
379   const void * (*value_blob)(sqlite3_value*);
380   int  (*value_bytes)(sqlite3_value*);
381   int  (*value_bytes16)(sqlite3_value*);
382   double  (*value_double)(sqlite3_value*);
383   int  (*value_int)(sqlite3_value*);
384   sqlite_int64  (*value_int64)(sqlite3_value*);
385   int  (*value_numeric_type)(sqlite3_value*);
386   const unsigned char * (*value_text)(sqlite3_value*);
387   const void * (*value_text16)(sqlite3_value*);
388   const void * (*value_text16be)(sqlite3_value*);
389   const void * (*value_text16le)(sqlite3_value*);
390   int  (*value_type)(sqlite3_value*);
391   char *(*vmprintf)(const char*,va_list);
392   /* Added ??? */
393   int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);
394   /* Added by 3.3.13 */
395   int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
396   int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
397   int (*clear_bindings)(sqlite3_stmt*);
398   /* Added by 3.4.1 */
399   int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,
400                           void (*xDestroy)(void *));
401   /* Added by 3.5.0 */
402   int (*bind_zeroblob)(sqlite3_stmt*,int,int);
403   int (*blob_bytes)(sqlite3_blob*);
404   int (*blob_close)(sqlite3_blob*);
405   int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,
406                    int,sqlite3_blob**);
407   int (*blob_read)(sqlite3_blob*,void*,int,int);
408   int (*blob_write)(sqlite3_blob*,const void*,int,int);
409   int (*create_collation_v2)(sqlite3*,const char*,int,void*,
410                              int(*)(void*,int,const void*,int,const void*),
411                              void(*)(void*));
412   int (*file_control)(sqlite3*,const char*,int,void*);
413   sqlite3_int64 (*memory_highwater)(int);
414   sqlite3_int64 (*memory_used)(void);
415   sqlite3_mutex *(*mutex_alloc)(int);
416   void (*mutex_enter)(sqlite3_mutex*);
417   void (*mutex_free)(sqlite3_mutex*);
418   void (*mutex_leave)(sqlite3_mutex*);
419   int (*mutex_try)(sqlite3_mutex*);
420   int (*open_v2)(const char*,sqlite3**,int,const char*);
421   int (*release_memory)(int);
422   void (*result_error_nomem)(sqlite3_context*);
423   void (*result_error_toobig)(sqlite3_context*);
424   int (*sleep)(int);
425   void (*soft_heap_limit)(int);
426   sqlite3_vfs *(*vfs_find)(const char*);
427   int (*vfs_register)(sqlite3_vfs*,int);
428   int (*vfs_unregister)(sqlite3_vfs*);
429   int (*xthreadsafe)(void);
430   void (*result_zeroblob)(sqlite3_context*,int);
431   void (*result_error_code)(sqlite3_context*,int);
432   int (*test_control)(int, ...);
433   void (*randomness)(int,void*);
434   sqlite3 *(*context_db_handle)(sqlite3_context*);
435   int (*extended_result_codes)(sqlite3*,int);
436   int (*limit)(sqlite3*,int,int);
437   sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);
438   const char *(*sql)(sqlite3_stmt*);
439   int (*status)(int,int*,int*,int);
440   int (*backup_finish)(ogr_sqlite3_backup*);
441   ogr_sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*);
442   int (*backup_pagecount)(ogr_sqlite3_backup*);
443   int (*backup_remaining)(ogr_sqlite3_backup*);
444   int (*backup_step)(ogr_sqlite3_backup*,int);
445   const char *(*compileoption_get)(int);
446   int (*compileoption_used)(const char*);
447   int (*create_function_v2)(sqlite3*,const char*,int,int,void*,
448                             void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
449                             void (*xStep)(sqlite3_context*,int,sqlite3_value**),
450                             void (*xFinal)(sqlite3_context*),
451                             void(*xDestroy)(void*));
452   int (*db_config)(sqlite3*,int,...);
453   sqlite3_mutex *(*db_mutex)(sqlite3*);
454   int (*db_status)(sqlite3*,int,int*,int*,int);
455   int (*extended_errcode)(sqlite3*);
456   void (*log)(int,const char*,...);
457   sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64);
458   const char *(*sourceid)(void);
459   int (*stmt_status)(sqlite3_stmt*,int,int);
460   int (*strnicmp)(const char*,const char*,int);
461   int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*);
462   int (*wal_autocheckpoint)(sqlite3*,int);
463   int (*wal_checkpoint)(sqlite3*,const char*);
464   void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*);
465   int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);
466   int (*vtab_config)(sqlite3*,int op,...);
467   int (*vtab_on_conflict)(sqlite3*);
468 };
469 
470 /*
471 ** The following macros redefine the API routines so that they are
472 ** redirected through the global sqlite3_api structure.
473 **
474 ** This header file is also used by the loadext.c source file
475 ** (part of the main SQLite library - not an extension) so that
476 ** it can get access to the sqlite3_api_routines structure
477 ** definition.  But the main library does not want to redefine
478 ** the API.  So the redefinition macros are only valid if the
479 ** SQLITE_CORE macros is undefined.
480 */
481 #ifndef SQLITE_CORE
482 #define sqlite3_aggregate_context      sqlite3_api->aggregate_context
483 #ifndef SQLITE_OMIT_DEPRECATED
484 #define sqlite3_aggregate_count        sqlite3_api->aggregate_count
485 #endif
486 #define sqlite3_bind_blob              sqlite3_api->bind_blob
487 #define sqlite3_bind_double            sqlite3_api->bind_double
488 #define sqlite3_bind_int               sqlite3_api->bind_int
489 #define sqlite3_bind_int64             sqlite3_api->bind_int64
490 #define sqlite3_bind_null              sqlite3_api->bind_null
491 #define sqlite3_bind_parameter_count   sqlite3_api->bind_parameter_count
492 #define sqlite3_bind_parameter_index   sqlite3_api->bind_parameter_index
493 #define sqlite3_bind_parameter_name    sqlite3_api->bind_parameter_name
494 #define sqlite3_bind_text              sqlite3_api->bind_text
495 #define sqlite3_bind_text16            sqlite3_api->bind_text16
496 #define sqlite3_bind_value             sqlite3_api->bind_value
497 #define sqlite3_busy_handler           sqlite3_api->busy_handler
498 #define sqlite3_busy_timeout           sqlite3_api->busy_timeout
499 #define sqlite3_changes                sqlite3_api->changes
500 #define sqlite3_close                  sqlite3_api->close
501 #define sqlite3_collation_needed       sqlite3_api->collation_needed
502 #define sqlite3_collation_needed16     sqlite3_api->collation_needed16
503 #define sqlite3_column_blob            sqlite3_api->column_blob
504 #define sqlite3_column_bytes           sqlite3_api->column_bytes
505 #define sqlite3_column_bytes16         sqlite3_api->column_bytes16
506 #define sqlite3_column_count           sqlite3_api->column_count
507 #define sqlite3_column_database_name   sqlite3_api->column_database_name
508 #define sqlite3_column_database_name16 sqlite3_api->column_database_name16
509 #define sqlite3_column_decltype        sqlite3_api->column_decltype
510 #define sqlite3_column_decltype16      sqlite3_api->column_decltype16
511 #define sqlite3_column_double          sqlite3_api->column_double
512 #define sqlite3_column_int             sqlite3_api->column_int
513 #define sqlite3_column_int64           sqlite3_api->column_int64
514 #define sqlite3_column_name            sqlite3_api->column_name
515 #define sqlite3_column_name16          sqlite3_api->column_name16
516 #define sqlite3_column_origin_name     sqlite3_api->column_origin_name
517 #define sqlite3_column_origin_name16   sqlite3_api->column_origin_name16
518 #define sqlite3_column_table_name      sqlite3_api->column_table_name
519 #define sqlite3_column_table_name16    sqlite3_api->column_table_name16
520 #define sqlite3_column_text            sqlite3_api->column_text
521 #define sqlite3_column_text16          sqlite3_api->column_text16
522 #define sqlite3_column_type            sqlite3_api->column_type
523 #define sqlite3_column_value           sqlite3_api->column_value
524 #define sqlite3_commit_hook            sqlite3_api->commit_hook
525 #define sqlite3_complete               sqlite3_api->complete
526 #define sqlite3_complete16             sqlite3_api->complete16
527 #define sqlite3_create_collation       sqlite3_api->create_collation
528 #define sqlite3_create_collation16     sqlite3_api->create_collation16
529 #define sqlite3_create_function        sqlite3_api->create_function
530 #define sqlite3_create_function16      sqlite3_api->create_function16
531 #define sqlite3_create_module          sqlite3_api->create_module
532 #define sqlite3_create_module_v2       sqlite3_api->create_module_v2
533 #define sqlite3_data_count             sqlite3_api->data_count
534 #define sqlite3_db_handle              sqlite3_api->db_handle
535 #define sqlite3_declare_vtab           sqlite3_api->declare_vtab
536 #define sqlite3_enable_shared_cache    sqlite3_api->enable_shared_cache
537 #define sqlite3_errcode                sqlite3_api->errcode
538 #define sqlite3_errmsg                 sqlite3_api->errmsg
539 #define sqlite3_errmsg16               sqlite3_api->errmsg16
540 #define sqlite3_exec                   sqlite3_api->exec
541 #ifndef SQLITE_OMIT_DEPRECATED
542 #define sqlite3_expired                sqlite3_api->expired
543 #endif
544 #define sqlite3_finalize               sqlite3_api->finalize
545 #define sqlite3_free                   sqlite3_api->free
546 #define sqlite3_free_table             sqlite3_api->free_table
547 #define sqlite3_get_autocommit         sqlite3_api->get_autocommit
548 #define sqlite3_get_auxdata            sqlite3_api->get_auxdata
549 #define sqlite3_get_table              sqlite3_api->get_table
550 #ifndef SQLITE_OMIT_DEPRECATED
551 #define sqlite3_global_recover         sqlite3_api->global_recover
552 #endif
553 #define sqlite3_interrupt              sqlite3_api->interruptx
554 #define sqlite3_last_insert_rowid      sqlite3_api->last_insert_rowid
555 #define sqlite3_libversion             sqlite3_api->libversion
556 #define sqlite3_libversion_number      sqlite3_api->libversion_number
557 #define sqlite3_malloc                 sqlite3_api->malloc
558 #define sqlite3_mprintf                sqlite3_api->mprintf
559 #define sqlite3_open                   sqlite3_api->open
560 #define sqlite3_open16                 sqlite3_api->open16
561 #define sqlite3_prepare                sqlite3_api->prepare
562 #define sqlite3_prepare16              sqlite3_api->prepare16
563 #define sqlite3_prepare_v2             sqlite3_api->prepare_v2
564 #define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2
565 #define sqlite3_profile                sqlite3_api->profile
566 #define sqlite3_progress_handler       sqlite3_api->progress_handler
567 #define sqlite3_realloc                sqlite3_api->realloc
568 #define sqlite3_reset                  sqlite3_api->reset
569 #define sqlite3_result_blob            sqlite3_api->result_blob
570 #define sqlite3_result_double          sqlite3_api->result_double
571 #define sqlite3_result_error           sqlite3_api->result_error
572 #define sqlite3_result_error16         sqlite3_api->result_error16
573 #define sqlite3_result_int             sqlite3_api->result_int
574 #define sqlite3_result_int64           sqlite3_api->result_int64
575 #define sqlite3_result_null            sqlite3_api->result_null
576 #define sqlite3_result_text            sqlite3_api->result_text
577 #define sqlite3_result_text16          sqlite3_api->result_text16
578 #define sqlite3_result_text16be        sqlite3_api->result_text16be
579 #define sqlite3_result_text16le        sqlite3_api->result_text16le
580 #define sqlite3_result_value           sqlite3_api->result_value
581 #define sqlite3_rollback_hook          sqlite3_api->rollback_hook
582 #define sqlite3_set_authorizer         sqlite3_api->set_authorizer
583 #define sqlite3_set_auxdata            sqlite3_api->set_auxdata
584 #define sqlite3_snprintf               sqlite3_api->snprintf
585 #define sqlite3_step                   sqlite3_api->step
586 #define sqlite3_table_column_metadata  sqlite3_api->table_column_metadata
587 #define sqlite3_thread_cleanup         sqlite3_api->thread_cleanup
588 #define sqlite3_total_changes          sqlite3_api->total_changes
589 #define sqlite3_trace                  sqlite3_api->trace
590 #ifndef SQLITE_OMIT_DEPRECATED
591 #define sqlite3_transfer_bindings      sqlite3_api->transfer_bindings
592 #endif
593 #define sqlite3_update_hook            sqlite3_api->update_hook
594 #define sqlite3_user_data              sqlite3_api->user_data
595 #define sqlite3_value_blob             sqlite3_api->value_blob
596 #define sqlite3_value_bytes            sqlite3_api->value_bytes
597 #define sqlite3_value_bytes16          sqlite3_api->value_bytes16
598 #define sqlite3_value_double           sqlite3_api->value_double
599 #define sqlite3_value_int              sqlite3_api->value_int
600 #define sqlite3_value_int64            sqlite3_api->value_int64
601 #define sqlite3_value_numeric_type     sqlite3_api->value_numeric_type
602 #define sqlite3_value_text             sqlite3_api->value_text
603 #define sqlite3_value_text16           sqlite3_api->value_text16
604 #define sqlite3_value_text16be         sqlite3_api->value_text16be
605 #define sqlite3_value_text16le         sqlite3_api->value_text16le
606 #define sqlite3_value_type             sqlite3_api->value_type
607 #define sqlite3_vmprintf               sqlite3_api->vmprintf
608 #define sqlite3_overload_function      sqlite3_api->overload_function
609 #define sqlite3_prepare_v2             sqlite3_api->prepare_v2
610 #define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2
611 #define sqlite3_clear_bindings         sqlite3_api->clear_bindings
612 #define sqlite3_bind_zeroblob          sqlite3_api->bind_zeroblob
613 #define sqlite3_blob_bytes             sqlite3_api->blob_bytes
614 #define sqlite3_blob_close             sqlite3_api->blob_close
615 #define sqlite3_blob_open              sqlite3_api->blob_open
616 #define sqlite3_blob_read              sqlite3_api->blob_read
617 #define sqlite3_blob_write             sqlite3_api->blob_write
618 #define sqlite3_create_collation_v2    sqlite3_api->create_collation_v2
619 #define sqlite3_file_control           sqlite3_api->file_control
620 #define sqlite3_memory_highwater       sqlite3_api->memory_highwater
621 #define sqlite3_memory_used            sqlite3_api->memory_used
622 #define sqlite3_mutex_alloc            sqlite3_api->mutex_alloc
623 #define sqlite3_mutex_enter            sqlite3_api->mutex_enter
624 #define sqlite3_mutex_free             sqlite3_api->mutex_free
625 #define sqlite3_mutex_leave            sqlite3_api->mutex_leave
626 #define sqlite3_mutex_try              sqlite3_api->mutex_try
627 #define sqlite3_open_v2                sqlite3_api->open_v2
628 #define sqlite3_release_memory         sqlite3_api->release_memory
629 #define sqlite3_result_error_nomem     sqlite3_api->result_error_nomem
630 #define sqlite3_result_error_toobig    sqlite3_api->result_error_toobig
631 #define sqlite3_sleep                  sqlite3_api->sleep
632 #define sqlite3_soft_heap_limit        sqlite3_api->soft_heap_limit
633 #define sqlite3_vfs_find               sqlite3_api->vfs_find
634 #define sqlite3_vfs_register           sqlite3_api->vfs_register
635 #define sqlite3_vfs_unregister         sqlite3_api->vfs_unregister
636 #define sqlite3_threadsafe             sqlite3_api->xthreadsafe
637 #define sqlite3_result_zeroblob        sqlite3_api->result_zeroblob
638 #define sqlite3_result_error_code      sqlite3_api->result_error_code
639 #define sqlite3_test_control           sqlite3_api->test_control
640 #define sqlite3_randomness             sqlite3_api->randomness
641 #define sqlite3_context_db_handle      sqlite3_api->context_db_handle
642 #define sqlite3_extended_result_codes  sqlite3_api->extended_result_codes
643 #define sqlite3_limit                  sqlite3_api->limit
644 #define sqlite3_next_stmt              sqlite3_api->next_stmt
645 #define sqlite3_sql                    sqlite3_api->sql
646 #define sqlite3_status                 sqlite3_api->status
647 #define sqlite3_backup_finish          sqlite3_api->backup_finish
648 #define sqlite3_backup_init            sqlite3_api->backup_init
649 #define sqlite3_backup_pagecount       sqlite3_api->backup_pagecount
650 #define sqlite3_backup_remaining       sqlite3_api->backup_remaining
651 #define sqlite3_backup_step            sqlite3_api->backup_step
652 #define sqlite3_compileoption_get      sqlite3_api->compileoption_get
653 #define sqlite3_compileoption_used     sqlite3_api->compileoption_used
654 #define sqlite3_create_function_v2     sqlite3_api->create_function_v2
655 #define sqlite3_db_config              sqlite3_api->db_config
656 #define sqlite3_db_mutex               sqlite3_api->db_mutex
657 #define sqlite3_db_status              sqlite3_api->db_status
658 #define sqlite3_extended_errcode       sqlite3_api->extended_errcode
659 #define sqlite3_log                    sqlite3_api->log
660 #define sqlite3_soft_heap_limit64      sqlite3_api->soft_heap_limit64
661 #define sqlite3_sourceid               sqlite3_api->sourceid
662 #define sqlite3_stmt_status            sqlite3_api->stmt_status
663 #define sqlite3_strnicmp               sqlite3_api->strnicmp
664 #define sqlite3_unlock_notify          sqlite3_api->unlock_notify
665 #define sqlite3_wal_autocheckpoint     sqlite3_api->wal_autocheckpoint
666 #define sqlite3_wal_checkpoint         sqlite3_api->wal_checkpoint
667 #define sqlite3_wal_hook               sqlite3_api->wal_hook
668 #define sqlite3_blob_reopen            sqlite3_api->blob_reopen
669 #define sqlite3_vtab_config            sqlite3_api->vtab_config
670 #define sqlite3_vtab_on_conflict       sqlite3_api->vtab_on_conflict
671 #endif /* SQLITE_CORE */
672 
673 #define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api = nullptr;
674 #define SQLITE_EXTENSION_INIT2(v)  sqlite3_api = v;
675 
676 #endif /* SQLITE3EXT_H_ */
677