… | |
… | |
26 | ** routines. |
26 | ** routines. |
27 | ** |
27 | ** |
28 | ** WARNING: In order to maintain backwards compatibility, add new |
28 | ** WARNING: In order to maintain backwards compatibility, add new |
29 | ** interfaces to the end of this structure only. If you insert new |
29 | ** interfaces to the end of this structure only. If you insert new |
30 | ** interfaces in the middle of this structure, then older different |
30 | ** interfaces in the middle of this structure, then older different |
31 | ** versions of SQLite will not be able to load each others' shared |
31 | ** versions of SQLite will not be able to load each other's shared |
32 | ** libraries! |
32 | ** libraries! |
33 | */ |
33 | */ |
34 | struct sqlite3_api_routines { |
34 | struct sqlite3_api_routines { |
35 | void * (*aggregate_context)(sqlite3_context*,int nBytes); |
35 | void * (*aggregate_context)(sqlite3_context*,int nBytes); |
36 | int (*aggregate_count)(sqlite3_context*); |
36 | int (*aggregate_count)(sqlite3_context*); |
… | |
… | |
234 | int (*wal_checkpoint)(sqlite3*,const char*); |
234 | int (*wal_checkpoint)(sqlite3*,const char*); |
235 | void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*); |
235 | void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*); |
236 | int (*blob_reopen)(sqlite3_blob*,sqlite3_int64); |
236 | int (*blob_reopen)(sqlite3_blob*,sqlite3_int64); |
237 | int (*vtab_config)(sqlite3*,int op,...); |
237 | int (*vtab_config)(sqlite3*,int op,...); |
238 | int (*vtab_on_conflict)(sqlite3*); |
238 | int (*vtab_on_conflict)(sqlite3*); |
|
|
239 | /* Version 3.7.16 and later */ |
|
|
240 | int (*close_v2)(sqlite3*); |
|
|
241 | const char *(*db_filename)(sqlite3*,const char*); |
|
|
242 | int (*db_readonly)(sqlite3*,const char*); |
|
|
243 | int (*db_release_memory)(sqlite3*); |
|
|
244 | const char *(*errstr)(int); |
|
|
245 | int (*stmt_busy)(sqlite3_stmt*); |
|
|
246 | int (*stmt_readonly)(sqlite3_stmt*); |
|
|
247 | int (*stricmp)(const char*,const char*); |
|
|
248 | int (*uri_boolean)(const char*,const char*,int); |
|
|
249 | sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64); |
|
|
250 | const char *(*uri_parameter)(const char*,const char*); |
|
|
251 | char *(*vsnprintf)(int,char*,const char*,va_list); |
|
|
252 | int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*); |
|
|
253 | /* Version 3.8.7 and later */ |
|
|
254 | int (*auto_extension)(void(*)(void)); |
|
|
255 | int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64, |
|
|
256 | void(*)(void*)); |
|
|
257 | int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64, |
|
|
258 | void(*)(void*),unsigned char); |
|
|
259 | int (*cancel_auto_extension)(void(*)(void)); |
|
|
260 | int (*load_extension)(sqlite3*,const char*,const char*,char**); |
|
|
261 | void *(*malloc64)(sqlite3_uint64); |
|
|
262 | sqlite3_uint64 (*msize)(void*); |
|
|
263 | void *(*realloc64)(void*,sqlite3_uint64); |
|
|
264 | void (*reset_auto_extension)(void); |
|
|
265 | void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64, |
|
|
266 | void(*)(void*)); |
|
|
267 | void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64, |
|
|
268 | void(*)(void*), unsigned char); |
|
|
269 | int (*strglob)(const char*,const char*); |
239 | }; |
270 | }; |
240 | |
271 | |
241 | /* |
272 | /* |
242 | ** The following macros redefine the API routines so that they are |
273 | ** The following macros redefine the API routines so that they are |
243 | ** redirected throught the global sqlite3_api structure. |
274 | ** redirected through the global sqlite3_api structure. |
244 | ** |
275 | ** |
245 | ** This header file is also used by the loadext.c source file |
276 | ** This header file is also used by the loadext.c source file |
246 | ** (part of the main SQLite library - not an extension) so that |
277 | ** (part of the main SQLite library - not an extension) so that |
247 | ** it can get access to the sqlite3_api_routines structure |
278 | ** it can get access to the sqlite3_api_routines structure |
248 | ** definition. But the main library does not want to redefine |
279 | ** definition. But the main library does not want to redefine |
… | |
… | |
437 | #define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint |
468 | #define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint |
438 | #define sqlite3_wal_hook sqlite3_api->wal_hook |
469 | #define sqlite3_wal_hook sqlite3_api->wal_hook |
439 | #define sqlite3_blob_reopen sqlite3_api->blob_reopen |
470 | #define sqlite3_blob_reopen sqlite3_api->blob_reopen |
440 | #define sqlite3_vtab_config sqlite3_api->vtab_config |
471 | #define sqlite3_vtab_config sqlite3_api->vtab_config |
441 | #define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict |
472 | #define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict |
|
|
473 | /* Version 3.7.16 and later */ |
|
|
474 | #define sqlite3_close_v2 sqlite3_api->close_v2 |
|
|
475 | #define sqlite3_db_filename sqlite3_api->db_filename |
|
|
476 | #define sqlite3_db_readonly sqlite3_api->db_readonly |
|
|
477 | #define sqlite3_db_release_memory sqlite3_api->db_release_memory |
|
|
478 | #define sqlite3_errstr sqlite3_api->errstr |
|
|
479 | #define sqlite3_stmt_busy sqlite3_api->stmt_busy |
|
|
480 | #define sqlite3_stmt_readonly sqlite3_api->stmt_readonly |
|
|
481 | #define sqlite3_stricmp sqlite3_api->stricmp |
|
|
482 | #define sqlite3_uri_boolean sqlite3_api->uri_boolean |
|
|
483 | #define sqlite3_uri_int64 sqlite3_api->uri_int64 |
|
|
484 | #define sqlite3_uri_parameter sqlite3_api->uri_parameter |
|
|
485 | #define sqlite3_uri_vsnprintf sqlite3_api->vsnprintf |
|
|
486 | #define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2 |
|
|
487 | /* Version 3.8.7 and later */ |
|
|
488 | #define sqlite3_auto_extension sqlite3_api->auto_extension |
|
|
489 | #define sqlite3_bind_blob64 sqlite3_api->bind_blob64 |
|
|
490 | #define sqlite3_bind_text64 sqlite3_api->bind_text64 |
|
|
491 | #define sqlite3_cancel_auto_extension sqlite3_api->cancel_auto_extension |
|
|
492 | #define sqlite3_load_extension sqlite3_api->load_extension |
|
|
493 | #define sqlite3_malloc64 sqlite3_api->malloc64 |
|
|
494 | #define sqlite3_msize sqlite3_api->msize |
|
|
495 | #define sqlite3_realloc64 sqlite3_api->realloc64 |
|
|
496 | #define sqlite3_reset_auto_extension sqlite3_api->reset_auto_extension |
|
|
497 | #define sqlite3_result_blob64 sqlite3_api->result_blob64 |
|
|
498 | #define sqlite3_result_text64 sqlite3_api->result_text64 |
|
|
499 | #define sqlite3_strglob sqlite3_api->strglob |
442 | #endif /* SQLITE_CORE */ |
500 | #endif /* SQLITE_CORE */ |
443 | |
501 | |
|
|
502 | #ifndef SQLITE_CORE |
|
|
503 | /* This case when the file really is being compiled as a loadable |
|
|
504 | ** extension */ |
444 | #define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api = 0; |
505 | # define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0; |
445 | #define SQLITE_EXTENSION_INIT2(v) sqlite3_api = v; |
506 | # define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v; |
|
|
507 | # define SQLITE_EXTENSION_INIT3 \ |
|
|
508 | extern const sqlite3_api_routines *sqlite3_api; |
|
|
509 | #else |
|
|
510 | /* This case when the file is being statically linked into the |
|
|
511 | ** application */ |
|
|
512 | # define SQLITE_EXTENSION_INIT1 /*no-op*/ |
|
|
513 | # define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */ |
|
|
514 | # define SQLITE_EXTENSION_INIT3 /*no-op*/ |
|
|
515 | #endif |
446 | |
516 | |
447 | #endif /* _SQLITE3EXT_H_ */ |
517 | #endif /* _SQLITE3EXT_H_ */ |