amalgalite 1.6.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTING.md +49 -0
  3. data/HISTORY.md +346 -0
  4. data/LICENSE +31 -0
  5. data/Manifest.txt +104 -0
  6. data/README.md +65 -0
  7. data/Rakefile +26 -0
  8. data/TODO.md +57 -0
  9. data/bin/amalgalite-pack +147 -0
  10. data/examples/a.rb +9 -0
  11. data/examples/blob.rb +88 -0
  12. data/examples/bootstrap.rb +36 -0
  13. data/examples/define_aggregate.rb +75 -0
  14. data/examples/define_function.rb +104 -0
  15. data/examples/fts5.rb +152 -0
  16. data/examples/gem-db.rb +94 -0
  17. data/examples/require_me.rb +11 -0
  18. data/examples/requires.rb +42 -0
  19. data/examples/schema-info.rb +34 -0
  20. data/ext/amalgalite/c/amalgalite.c +355 -0
  21. data/ext/amalgalite/c/amalgalite.h +151 -0
  22. data/ext/amalgalite/c/amalgalite_blob.c +240 -0
  23. data/ext/amalgalite/c/amalgalite_constants.c +1226 -0
  24. data/ext/amalgalite/c/amalgalite_database.c +1178 -0
  25. data/ext/amalgalite/c/amalgalite_requires_bootstrap.c +282 -0
  26. data/ext/amalgalite/c/amalgalite_statement.c +649 -0
  27. data/ext/amalgalite/c/extconf.rb +62 -0
  28. data/ext/amalgalite/c/gen_constants.rb +330 -0
  29. data/ext/amalgalite/c/notes.txt +134 -0
  30. data/ext/amalgalite/c/sqlite3.c +205352 -0
  31. data/ext/amalgalite/c/sqlite3.h +10727 -0
  32. data/ext/amalgalite/c/sqlite3_options.h +4 -0
  33. data/ext/amalgalite/c/sqlite3ext.h +578 -0
  34. data/lib/amalgalite.rb +51 -0
  35. data/lib/amalgalite/2.0/amalgalite.so +0 -0
  36. data/lib/amalgalite/2.1/amalgalite.so +0 -0
  37. data/lib/amalgalite/2.2/amalgalite.so +0 -0
  38. data/lib/amalgalite/2.3/amalgalite.so +0 -0
  39. data/lib/amalgalite/2.4/amalgalite.so +0 -0
  40. data/lib/amalgalite/aggregate.rb +67 -0
  41. data/lib/amalgalite/blob.rb +186 -0
  42. data/lib/amalgalite/boolean.rb +42 -0
  43. data/lib/amalgalite/busy_timeout.rb +47 -0
  44. data/lib/amalgalite/column.rb +99 -0
  45. data/lib/amalgalite/core_ext/kernel/require.rb +21 -0
  46. data/lib/amalgalite/csv_table_importer.rb +74 -0
  47. data/lib/amalgalite/database.rb +984 -0
  48. data/lib/amalgalite/function.rb +61 -0
  49. data/lib/amalgalite/index.rb +43 -0
  50. data/lib/amalgalite/memory_database.rb +15 -0
  51. data/lib/amalgalite/packer.rb +231 -0
  52. data/lib/amalgalite/paths.rb +80 -0
  53. data/lib/amalgalite/profile_tap.rb +131 -0
  54. data/lib/amalgalite/progress_handler.rb +21 -0
  55. data/lib/amalgalite/requires.rb +151 -0
  56. data/lib/amalgalite/schema.rb +225 -0
  57. data/lib/amalgalite/sqlite3.rb +6 -0
  58. data/lib/amalgalite/sqlite3/constants.rb +95 -0
  59. data/lib/amalgalite/sqlite3/database/function.rb +48 -0
  60. data/lib/amalgalite/sqlite3/database/status.rb +68 -0
  61. data/lib/amalgalite/sqlite3/status.rb +60 -0
  62. data/lib/amalgalite/sqlite3/version.rb +55 -0
  63. data/lib/amalgalite/statement.rb +418 -0
  64. data/lib/amalgalite/table.rb +91 -0
  65. data/lib/amalgalite/taps.rb +2 -0
  66. data/lib/amalgalite/taps/console.rb +27 -0
  67. data/lib/amalgalite/taps/io.rb +71 -0
  68. data/lib/amalgalite/trace_tap.rb +35 -0
  69. data/lib/amalgalite/type_map.rb +63 -0
  70. data/lib/amalgalite/type_maps/default_map.rb +166 -0
  71. data/lib/amalgalite/type_maps/storage_map.rb +38 -0
  72. data/lib/amalgalite/type_maps/text_map.rb +21 -0
  73. data/lib/amalgalite/version.rb +8 -0
  74. data/lib/amalgalite/view.rb +26 -0
  75. data/spec/aggregate_spec.rb +154 -0
  76. data/spec/amalgalite_spec.rb +4 -0
  77. data/spec/blob_spec.rb +78 -0
  78. data/spec/boolean_spec.rb +24 -0
  79. data/spec/busy_handler.rb +157 -0
  80. data/spec/data/iso-3166-country.txt +242 -0
  81. data/spec/data/iso-3166-schema.sql +22 -0
  82. data/spec/data/iso-3166-subcountry.txt +3995 -0
  83. data/spec/data/make-iso-db.sh +12 -0
  84. data/spec/database_spec.rb +508 -0
  85. data/spec/default_map_spec.rb +92 -0
  86. data/spec/function_spec.rb +78 -0
  87. data/spec/integeration_spec.rb +97 -0
  88. data/spec/iso_3166_database.rb +58 -0
  89. data/spec/packer_spec.rb +60 -0
  90. data/spec/paths_spec.rb +28 -0
  91. data/spec/progress_handler_spec.rb +91 -0
  92. data/spec/requires_spec.rb +54 -0
  93. data/spec/rtree_spec.rb +66 -0
  94. data/spec/schema_spec.rb +131 -0
  95. data/spec/spec_helper.rb +48 -0
  96. data/spec/sqlite3/constants_spec.rb +108 -0
  97. data/spec/sqlite3/database_status_spec.rb +36 -0
  98. data/spec/sqlite3/status_spec.rb +22 -0
  99. data/spec/sqlite3/version_spec.rb +28 -0
  100. data/spec/sqlite3_spec.rb +53 -0
  101. data/spec/statement_spec.rb +168 -0
  102. data/spec/storage_map_spec.rb +38 -0
  103. data/spec/tap_spec.rb +57 -0
  104. data/spec/text_map_spec.rb +20 -0
  105. data/spec/type_map_spec.rb +14 -0
  106. data/spec/version_spec.rb +8 -0
  107. data/tasks/custom.rake +102 -0
  108. data/tasks/default.rake +240 -0
  109. data/tasks/extension.rake +38 -0
  110. data/tasks/this.rb +208 -0
  111. metadata +318 -0
@@ -0,0 +1,4 @@
1
+ /*
2
+ * Compile time options that are turned on for the amalgalite extension
3
+ */
4
+ #define
@@ -0,0 +1,578 @@
1
+ /*
2
+ ** 2006 June 7
3
+ **
4
+ ** The author disclaims copyright to this source code. In place of
5
+ ** a legal notice, here is a blessing:
6
+ **
7
+ ** May you do good and not evil.
8
+ ** May you find forgiveness for yourself and forgive others.
9
+ ** May you share freely, never taking more than you give.
10
+ **
11
+ *************************************************************************
12
+ ** This header file defines the SQLite interface for use by
13
+ ** shared libraries that want to be imported as extensions into
14
+ ** an SQLite instance. Shared libraries that intend to be loaded
15
+ ** as extensions by SQLite should #include this file instead of
16
+ ** sqlite3.h.
17
+ */
18
+ #ifndef SQLITE3EXT_H
19
+ #define SQLITE3EXT_H
20
+ #include "sqlite3.h"
21
+
22
+ /*
23
+ ** The following structure holds pointers to all of the SQLite API
24
+ ** routines.
25
+ **
26
+ ** WARNING: In order to maintain backwards compatibility, add new
27
+ ** interfaces to the end of this structure only. If you insert new
28
+ ** interfaces in the middle of this structure, then older different
29
+ ** versions of SQLite will not be able to load each other's shared
30
+ ** libraries!
31
+ */
32
+ struct sqlite3_api_routines {
33
+ void * (*aggregate_context)(sqlite3_context*,int nBytes);
34
+ int (*aggregate_count)(sqlite3_context*);
35
+ int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));
36
+ int (*bind_double)(sqlite3_stmt*,int,double);
37
+ int (*bind_int)(sqlite3_stmt*,int,int);
38
+ int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);
39
+ int (*bind_null)(sqlite3_stmt*,int);
40
+ int (*bind_parameter_count)(sqlite3_stmt*);
41
+ int (*bind_parameter_index)(sqlite3_stmt*,const char*zName);
42
+ const char * (*bind_parameter_name)(sqlite3_stmt*,int);
43
+ int (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));
44
+ int (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));
45
+ int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);
46
+ int (*busy_handler)(sqlite3*,int(*)(void*,int),void*);
47
+ int (*busy_timeout)(sqlite3*,int ms);
48
+ int (*changes)(sqlite3*);
49
+ int (*close)(sqlite3*);
50
+ int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,
51
+ int eTextRep,const char*));
52
+ int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,
53
+ int eTextRep,const void*));
54
+ const void * (*column_blob)(sqlite3_stmt*,int iCol);
55
+ int (*column_bytes)(sqlite3_stmt*,int iCol);
56
+ int (*column_bytes16)(sqlite3_stmt*,int iCol);
57
+ int (*column_count)(sqlite3_stmt*pStmt);
58
+ const char * (*column_database_name)(sqlite3_stmt*,int);
59
+ const void * (*column_database_name16)(sqlite3_stmt*,int);
60
+ const char * (*column_decltype)(sqlite3_stmt*,int i);
61
+ const void * (*column_decltype16)(sqlite3_stmt*,int);
62
+ double (*column_double)(sqlite3_stmt*,int iCol);
63
+ int (*column_int)(sqlite3_stmt*,int iCol);
64
+ sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol);
65
+ const char * (*column_name)(sqlite3_stmt*,int);
66
+ const void * (*column_name16)(sqlite3_stmt*,int);
67
+ const char * (*column_origin_name)(sqlite3_stmt*,int);
68
+ const void * (*column_origin_name16)(sqlite3_stmt*,int);
69
+ const char * (*column_table_name)(sqlite3_stmt*,int);
70
+ const void * (*column_table_name16)(sqlite3_stmt*,int);
71
+ const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);
72
+ const void * (*column_text16)(sqlite3_stmt*,int iCol);
73
+ int (*column_type)(sqlite3_stmt*,int iCol);
74
+ sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);
75
+ void * (*commit_hook)(sqlite3*,int(*)(void*),void*);
76
+ int (*complete)(const char*sql);
77
+ int (*complete16)(const void*sql);
78
+ int (*create_collation)(sqlite3*,const char*,int,void*,
79
+ int(*)(void*,int,const void*,int,const void*));
80
+ int (*create_collation16)(sqlite3*,const void*,int,void*,
81
+ int(*)(void*,int,const void*,int,const void*));
82
+ int (*create_function)(sqlite3*,const char*,int,int,void*,
83
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
84
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**),
85
+ void (*xFinal)(sqlite3_context*));
86
+ int (*create_function16)(sqlite3*,const void*,int,int,void*,
87
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
88
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**),
89
+ void (*xFinal)(sqlite3_context*));
90
+ int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);
91
+ int (*data_count)(sqlite3_stmt*pStmt);
92
+ sqlite3 * (*db_handle)(sqlite3_stmt*);
93
+ int (*declare_vtab)(sqlite3*,const char*);
94
+ int (*enable_shared_cache)(int);
95
+ int (*errcode)(sqlite3*db);
96
+ const char * (*errmsg)(sqlite3*);
97
+ const void * (*errmsg16)(sqlite3*);
98
+ int (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);
99
+ int (*expired)(sqlite3_stmt*);
100
+ int (*finalize)(sqlite3_stmt*pStmt);
101
+ void (*free)(void*);
102
+ void (*free_table)(char**result);
103
+ int (*get_autocommit)(sqlite3*);
104
+ void * (*get_auxdata)(sqlite3_context*,int);
105
+ int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);
106
+ int (*global_recover)(void);
107
+ void (*interruptx)(sqlite3*);
108
+ sqlite_int64 (*last_insert_rowid)(sqlite3*);
109
+ const char * (*libversion)(void);
110
+ int (*libversion_number)(void);
111
+ void *(*malloc)(int);
112
+ char * (*mprintf)(const char*,...);
113
+ int (*open)(const char*,sqlite3**);
114
+ int (*open16)(const void*,sqlite3**);
115
+ int (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
116
+ int (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
117
+ void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);
118
+ void (*progress_handler)(sqlite3*,int,int(*)(void*),void*);
119
+ void *(*realloc)(void*,int);
120
+ int (*reset)(sqlite3_stmt*pStmt);
121
+ void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));
122
+ void (*result_double)(sqlite3_context*,double);
123
+ void (*result_error)(sqlite3_context*,const char*,int);
124
+ void (*result_error16)(sqlite3_context*,const void*,int);
125
+ void (*result_int)(sqlite3_context*,int);
126
+ void (*result_int64)(sqlite3_context*,sqlite_int64);
127
+ void (*result_null)(sqlite3_context*);
128
+ void (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));
129
+ void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));
130
+ void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));
131
+ void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));
132
+ void (*result_value)(sqlite3_context*,sqlite3_value*);
133
+ void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);
134
+ int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,
135
+ const char*,const char*),void*);
136
+ void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
137
+ char * (*xsnprintf)(int,char*,const char*,...);
138
+ int (*step)(sqlite3_stmt*);
139
+ int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,
140
+ char const**,char const**,int*,int*,int*);
141
+ void (*thread_cleanup)(void);
142
+ int (*total_changes)(sqlite3*);
143
+ void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);
144
+ int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);
145
+ void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,
146
+ sqlite_int64),void*);
147
+ void * (*user_data)(sqlite3_context*);
148
+ const void * (*value_blob)(sqlite3_value*);
149
+ int (*value_bytes)(sqlite3_value*);
150
+ int (*value_bytes16)(sqlite3_value*);
151
+ double (*value_double)(sqlite3_value*);
152
+ int (*value_int)(sqlite3_value*);
153
+ sqlite_int64 (*value_int64)(sqlite3_value*);
154
+ int (*value_numeric_type)(sqlite3_value*);
155
+ const unsigned char * (*value_text)(sqlite3_value*);
156
+ const void * (*value_text16)(sqlite3_value*);
157
+ const void * (*value_text16be)(sqlite3_value*);
158
+ const void * (*value_text16le)(sqlite3_value*);
159
+ int (*value_type)(sqlite3_value*);
160
+ char *(*vmprintf)(const char*,va_list);
161
+ /* Added ??? */
162
+ int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);
163
+ /* Added by 3.3.13 */
164
+ int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
165
+ int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
166
+ int (*clear_bindings)(sqlite3_stmt*);
167
+ /* Added by 3.4.1 */
168
+ int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,
169
+ void (*xDestroy)(void *));
170
+ /* Added by 3.5.0 */
171
+ int (*bind_zeroblob)(sqlite3_stmt*,int,int);
172
+ int (*blob_bytes)(sqlite3_blob*);
173
+ int (*blob_close)(sqlite3_blob*);
174
+ int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,
175
+ int,sqlite3_blob**);
176
+ int (*blob_read)(sqlite3_blob*,void*,int,int);
177
+ int (*blob_write)(sqlite3_blob*,const void*,int,int);
178
+ int (*create_collation_v2)(sqlite3*,const char*,int,void*,
179
+ int(*)(void*,int,const void*,int,const void*),
180
+ void(*)(void*));
181
+ int (*file_control)(sqlite3*,const char*,int,void*);
182
+ sqlite3_int64 (*memory_highwater)(int);
183
+ sqlite3_int64 (*memory_used)(void);
184
+ sqlite3_mutex *(*mutex_alloc)(int);
185
+ void (*mutex_enter)(sqlite3_mutex*);
186
+ void (*mutex_free)(sqlite3_mutex*);
187
+ void (*mutex_leave)(sqlite3_mutex*);
188
+ int (*mutex_try)(sqlite3_mutex*);
189
+ int (*open_v2)(const char*,sqlite3**,int,const char*);
190
+ int (*release_memory)(int);
191
+ void (*result_error_nomem)(sqlite3_context*);
192
+ void (*result_error_toobig)(sqlite3_context*);
193
+ int (*sleep)(int);
194
+ void (*soft_heap_limit)(int);
195
+ sqlite3_vfs *(*vfs_find)(const char*);
196
+ int (*vfs_register)(sqlite3_vfs*,int);
197
+ int (*vfs_unregister)(sqlite3_vfs*);
198
+ int (*xthreadsafe)(void);
199
+ void (*result_zeroblob)(sqlite3_context*,int);
200
+ void (*result_error_code)(sqlite3_context*,int);
201
+ int (*test_control)(int, ...);
202
+ void (*randomness)(int,void*);
203
+ sqlite3 *(*context_db_handle)(sqlite3_context*);
204
+ int (*extended_result_codes)(sqlite3*,int);
205
+ int (*limit)(sqlite3*,int,int);
206
+ sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);
207
+ const char *(*sql)(sqlite3_stmt*);
208
+ int (*status)(int,int*,int*,int);
209
+ int (*backup_finish)(sqlite3_backup*);
210
+ sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*);
211
+ int (*backup_pagecount)(sqlite3_backup*);
212
+ int (*backup_remaining)(sqlite3_backup*);
213
+ int (*backup_step)(sqlite3_backup*,int);
214
+ const char *(*compileoption_get)(int);
215
+ int (*compileoption_used)(const char*);
216
+ int (*create_function_v2)(sqlite3*,const char*,int,int,void*,
217
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
218
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**),
219
+ void (*xFinal)(sqlite3_context*),
220
+ void(*xDestroy)(void*));
221
+ int (*db_config)(sqlite3*,int,...);
222
+ sqlite3_mutex *(*db_mutex)(sqlite3*);
223
+ int (*db_status)(sqlite3*,int,int*,int*,int);
224
+ int (*extended_errcode)(sqlite3*);
225
+ void (*log)(int,const char*,...);
226
+ sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64);
227
+ const char *(*sourceid)(void);
228
+ int (*stmt_status)(sqlite3_stmt*,int,int);
229
+ int (*strnicmp)(const char*,const char*,int);
230
+ int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*);
231
+ int (*wal_autocheckpoint)(sqlite3*,int);
232
+ int (*wal_checkpoint)(sqlite3*,const char*);
233
+ void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*);
234
+ int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);
235
+ int (*vtab_config)(sqlite3*,int op,...);
236
+ int (*vtab_on_conflict)(sqlite3*);
237
+ /* Version 3.7.16 and later */
238
+ int (*close_v2)(sqlite3*);
239
+ const char *(*db_filename)(sqlite3*,const char*);
240
+ int (*db_readonly)(sqlite3*,const char*);
241
+ int (*db_release_memory)(sqlite3*);
242
+ const char *(*errstr)(int);
243
+ int (*stmt_busy)(sqlite3_stmt*);
244
+ int (*stmt_readonly)(sqlite3_stmt*);
245
+ int (*stricmp)(const char*,const char*);
246
+ int (*uri_boolean)(const char*,const char*,int);
247
+ sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64);
248
+ const char *(*uri_parameter)(const char*,const char*);
249
+ char *(*xvsnprintf)(int,char*,const char*,va_list);
250
+ int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
251
+ /* Version 3.8.7 and later */
252
+ int (*auto_extension)(void(*)(void));
253
+ int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64,
254
+ void(*)(void*));
255
+ int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,
256
+ void(*)(void*),unsigned char);
257
+ int (*cancel_auto_extension)(void(*)(void));
258
+ int (*load_extension)(sqlite3*,const char*,const char*,char**);
259
+ void *(*malloc64)(sqlite3_uint64);
260
+ sqlite3_uint64 (*msize)(void*);
261
+ void *(*realloc64)(void*,sqlite3_uint64);
262
+ void (*reset_auto_extension)(void);
263
+ void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64,
264
+ void(*)(void*));
265
+ void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64,
266
+ void(*)(void*), unsigned char);
267
+ int (*strglob)(const char*,const char*);
268
+ /* Version 3.8.11 and later */
269
+ sqlite3_value *(*value_dup)(const sqlite3_value*);
270
+ void (*value_free)(sqlite3_value*);
271
+ int (*result_zeroblob64)(sqlite3_context*,sqlite3_uint64);
272
+ int (*bind_zeroblob64)(sqlite3_stmt*, int, sqlite3_uint64);
273
+ /* Version 3.9.0 and later */
274
+ unsigned int (*value_subtype)(sqlite3_value*);
275
+ void (*result_subtype)(sqlite3_context*,unsigned int);
276
+ /* Version 3.10.0 and later */
277
+ int (*status64)(int,sqlite3_int64*,sqlite3_int64*,int);
278
+ int (*strlike)(const char*,const char*,unsigned int);
279
+ int (*db_cacheflush)(sqlite3*);
280
+ /* Version 3.12.0 and later */
281
+ int (*system_errno)(sqlite3*);
282
+ /* Version 3.14.0 and later */
283
+ int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);
284
+ char *(*expanded_sql)(sqlite3_stmt*);
285
+ /* Version 3.18.0 and later */
286
+ void (*set_last_insert_rowid)(sqlite3*,sqlite3_int64);
287
+ /* Version 3.20.0 and later */
288
+ int (*prepare_v3)(sqlite3*,const char*,int,unsigned int,
289
+ sqlite3_stmt**,const char**);
290
+ int (*prepare16_v3)(sqlite3*,const void*,int,unsigned int,
291
+ sqlite3_stmt**,const void**);
292
+ int (*bind_pointer)(sqlite3_stmt*,int,void*,const char*,void(*)(void*));
293
+ void (*result_pointer)(sqlite3_context*,void*,const char*,void(*)(void*));
294
+ void *(*value_pointer)(sqlite3_value*,const char*);
295
+ };
296
+
297
+ /*
298
+ ** This is the function signature used for all extension entry points. It
299
+ ** is also defined in the file "loadext.c".
300
+ */
301
+ typedef int (*sqlite3_loadext_entry)(
302
+ sqlite3 *db, /* Handle to the database. */
303
+ char **pzErrMsg, /* Used to set error string on failure. */
304
+ const sqlite3_api_routines *pThunk /* Extension API function pointers. */
305
+ );
306
+
307
+ /*
308
+ ** The following macros redefine the API routines so that they are
309
+ ** redirected through the global sqlite3_api structure.
310
+ **
311
+ ** This header file is also used by the loadext.c source file
312
+ ** (part of the main SQLite library - not an extension) so that
313
+ ** it can get access to the sqlite3_api_routines structure
314
+ ** definition. But the main library does not want to redefine
315
+ ** the API. So the redefinition macros are only valid if the
316
+ ** SQLITE_CORE macros is undefined.
317
+ */
318
+ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
319
+ #define sqlite3_aggregate_context sqlite3_api->aggregate_context
320
+ #ifndef SQLITE_OMIT_DEPRECATED
321
+ #define sqlite3_aggregate_count sqlite3_api->aggregate_count
322
+ #endif
323
+ #define sqlite3_bind_blob sqlite3_api->bind_blob
324
+ #define sqlite3_bind_double sqlite3_api->bind_double
325
+ #define sqlite3_bind_int sqlite3_api->bind_int
326
+ #define sqlite3_bind_int64 sqlite3_api->bind_int64
327
+ #define sqlite3_bind_null sqlite3_api->bind_null
328
+ #define sqlite3_bind_parameter_count sqlite3_api->bind_parameter_count
329
+ #define sqlite3_bind_parameter_index sqlite3_api->bind_parameter_index
330
+ #define sqlite3_bind_parameter_name sqlite3_api->bind_parameter_name
331
+ #define sqlite3_bind_text sqlite3_api->bind_text
332
+ #define sqlite3_bind_text16 sqlite3_api->bind_text16
333
+ #define sqlite3_bind_value sqlite3_api->bind_value
334
+ #define sqlite3_busy_handler sqlite3_api->busy_handler
335
+ #define sqlite3_busy_timeout sqlite3_api->busy_timeout
336
+ #define sqlite3_changes sqlite3_api->changes
337
+ #define sqlite3_close sqlite3_api->close
338
+ #define sqlite3_collation_needed sqlite3_api->collation_needed
339
+ #define sqlite3_collation_needed16 sqlite3_api->collation_needed16
340
+ #define sqlite3_column_blob sqlite3_api->column_blob
341
+ #define sqlite3_column_bytes sqlite3_api->column_bytes
342
+ #define sqlite3_column_bytes16 sqlite3_api->column_bytes16
343
+ #define sqlite3_column_count sqlite3_api->column_count
344
+ #define sqlite3_column_database_name sqlite3_api->column_database_name
345
+ #define sqlite3_column_database_name16 sqlite3_api->column_database_name16
346
+ #define sqlite3_column_decltype sqlite3_api->column_decltype
347
+ #define sqlite3_column_decltype16 sqlite3_api->column_decltype16
348
+ #define sqlite3_column_double sqlite3_api->column_double
349
+ #define sqlite3_column_int sqlite3_api->column_int
350
+ #define sqlite3_column_int64 sqlite3_api->column_int64
351
+ #define sqlite3_column_name sqlite3_api->column_name
352
+ #define sqlite3_column_name16 sqlite3_api->column_name16
353
+ #define sqlite3_column_origin_name sqlite3_api->column_origin_name
354
+ #define sqlite3_column_origin_name16 sqlite3_api->column_origin_name16
355
+ #define sqlite3_column_table_name sqlite3_api->column_table_name
356
+ #define sqlite3_column_table_name16 sqlite3_api->column_table_name16
357
+ #define sqlite3_column_text sqlite3_api->column_text
358
+ #define sqlite3_column_text16 sqlite3_api->column_text16
359
+ #define sqlite3_column_type sqlite3_api->column_type
360
+ #define sqlite3_column_value sqlite3_api->column_value
361
+ #define sqlite3_commit_hook sqlite3_api->commit_hook
362
+ #define sqlite3_complete sqlite3_api->complete
363
+ #define sqlite3_complete16 sqlite3_api->complete16
364
+ #define sqlite3_create_collation sqlite3_api->create_collation
365
+ #define sqlite3_create_collation16 sqlite3_api->create_collation16
366
+ #define sqlite3_create_function sqlite3_api->create_function
367
+ #define sqlite3_create_function16 sqlite3_api->create_function16
368
+ #define sqlite3_create_module sqlite3_api->create_module
369
+ #define sqlite3_create_module_v2 sqlite3_api->create_module_v2
370
+ #define sqlite3_data_count sqlite3_api->data_count
371
+ #define sqlite3_db_handle sqlite3_api->db_handle
372
+ #define sqlite3_declare_vtab sqlite3_api->declare_vtab
373
+ #define sqlite3_enable_shared_cache sqlite3_api->enable_shared_cache
374
+ #define sqlite3_errcode sqlite3_api->errcode
375
+ #define sqlite3_errmsg sqlite3_api->errmsg
376
+ #define sqlite3_errmsg16 sqlite3_api->errmsg16
377
+ #define sqlite3_exec sqlite3_api->exec
378
+ #ifndef SQLITE_OMIT_DEPRECATED
379
+ #define sqlite3_expired sqlite3_api->expired
380
+ #endif
381
+ #define sqlite3_finalize sqlite3_api->finalize
382
+ #define sqlite3_free sqlite3_api->free
383
+ #define sqlite3_free_table sqlite3_api->free_table
384
+ #define sqlite3_get_autocommit sqlite3_api->get_autocommit
385
+ #define sqlite3_get_auxdata sqlite3_api->get_auxdata
386
+ #define sqlite3_get_table sqlite3_api->get_table
387
+ #ifndef SQLITE_OMIT_DEPRECATED
388
+ #define sqlite3_global_recover sqlite3_api->global_recover
389
+ #endif
390
+ #define sqlite3_interrupt sqlite3_api->interruptx
391
+ #define sqlite3_last_insert_rowid sqlite3_api->last_insert_rowid
392
+ #define sqlite3_libversion sqlite3_api->libversion
393
+ #define sqlite3_libversion_number sqlite3_api->libversion_number
394
+ #define sqlite3_malloc sqlite3_api->malloc
395
+ #define sqlite3_mprintf sqlite3_api->mprintf
396
+ #define sqlite3_open sqlite3_api->open
397
+ #define sqlite3_open16 sqlite3_api->open16
398
+ #define sqlite3_prepare sqlite3_api->prepare
399
+ #define sqlite3_prepare16 sqlite3_api->prepare16
400
+ #define sqlite3_prepare_v2 sqlite3_api->prepare_v2
401
+ #define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
402
+ #define sqlite3_profile sqlite3_api->profile
403
+ #define sqlite3_progress_handler sqlite3_api->progress_handler
404
+ #define sqlite3_realloc sqlite3_api->realloc
405
+ #define sqlite3_reset sqlite3_api->reset
406
+ #define sqlite3_result_blob sqlite3_api->result_blob
407
+ #define sqlite3_result_double sqlite3_api->result_double
408
+ #define sqlite3_result_error sqlite3_api->result_error
409
+ #define sqlite3_result_error16 sqlite3_api->result_error16
410
+ #define sqlite3_result_int sqlite3_api->result_int
411
+ #define sqlite3_result_int64 sqlite3_api->result_int64
412
+ #define sqlite3_result_null sqlite3_api->result_null
413
+ #define sqlite3_result_text sqlite3_api->result_text
414
+ #define sqlite3_result_text16 sqlite3_api->result_text16
415
+ #define sqlite3_result_text16be sqlite3_api->result_text16be
416
+ #define sqlite3_result_text16le sqlite3_api->result_text16le
417
+ #define sqlite3_result_value sqlite3_api->result_value
418
+ #define sqlite3_rollback_hook sqlite3_api->rollback_hook
419
+ #define sqlite3_set_authorizer sqlite3_api->set_authorizer
420
+ #define sqlite3_set_auxdata sqlite3_api->set_auxdata
421
+ #define sqlite3_snprintf sqlite3_api->xsnprintf
422
+ #define sqlite3_step sqlite3_api->step
423
+ #define sqlite3_table_column_metadata sqlite3_api->table_column_metadata
424
+ #define sqlite3_thread_cleanup sqlite3_api->thread_cleanup
425
+ #define sqlite3_total_changes sqlite3_api->total_changes
426
+ #define sqlite3_trace sqlite3_api->trace
427
+ #ifndef SQLITE_OMIT_DEPRECATED
428
+ #define sqlite3_transfer_bindings sqlite3_api->transfer_bindings
429
+ #endif
430
+ #define sqlite3_update_hook sqlite3_api->update_hook
431
+ #define sqlite3_user_data sqlite3_api->user_data
432
+ #define sqlite3_value_blob sqlite3_api->value_blob
433
+ #define sqlite3_value_bytes sqlite3_api->value_bytes
434
+ #define sqlite3_value_bytes16 sqlite3_api->value_bytes16
435
+ #define sqlite3_value_double sqlite3_api->value_double
436
+ #define sqlite3_value_int sqlite3_api->value_int
437
+ #define sqlite3_value_int64 sqlite3_api->value_int64
438
+ #define sqlite3_value_numeric_type sqlite3_api->value_numeric_type
439
+ #define sqlite3_value_text sqlite3_api->value_text
440
+ #define sqlite3_value_text16 sqlite3_api->value_text16
441
+ #define sqlite3_value_text16be sqlite3_api->value_text16be
442
+ #define sqlite3_value_text16le sqlite3_api->value_text16le
443
+ #define sqlite3_value_type sqlite3_api->value_type
444
+ #define sqlite3_vmprintf sqlite3_api->vmprintf
445
+ #define sqlite3_vsnprintf sqlite3_api->xvsnprintf
446
+ #define sqlite3_overload_function sqlite3_api->overload_function
447
+ #define sqlite3_prepare_v2 sqlite3_api->prepare_v2
448
+ #define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
449
+ #define sqlite3_clear_bindings sqlite3_api->clear_bindings
450
+ #define sqlite3_bind_zeroblob sqlite3_api->bind_zeroblob
451
+ #define sqlite3_blob_bytes sqlite3_api->blob_bytes
452
+ #define sqlite3_blob_close sqlite3_api->blob_close
453
+ #define sqlite3_blob_open sqlite3_api->blob_open
454
+ #define sqlite3_blob_read sqlite3_api->blob_read
455
+ #define sqlite3_blob_write sqlite3_api->blob_write
456
+ #define sqlite3_create_collation_v2 sqlite3_api->create_collation_v2
457
+ #define sqlite3_file_control sqlite3_api->file_control
458
+ #define sqlite3_memory_highwater sqlite3_api->memory_highwater
459
+ #define sqlite3_memory_used sqlite3_api->memory_used
460
+ #define sqlite3_mutex_alloc sqlite3_api->mutex_alloc
461
+ #define sqlite3_mutex_enter sqlite3_api->mutex_enter
462
+ #define sqlite3_mutex_free sqlite3_api->mutex_free
463
+ #define sqlite3_mutex_leave sqlite3_api->mutex_leave
464
+ #define sqlite3_mutex_try sqlite3_api->mutex_try
465
+ #define sqlite3_open_v2 sqlite3_api->open_v2
466
+ #define sqlite3_release_memory sqlite3_api->release_memory
467
+ #define sqlite3_result_error_nomem sqlite3_api->result_error_nomem
468
+ #define sqlite3_result_error_toobig sqlite3_api->result_error_toobig
469
+ #define sqlite3_sleep sqlite3_api->sleep
470
+ #define sqlite3_soft_heap_limit sqlite3_api->soft_heap_limit
471
+ #define sqlite3_vfs_find sqlite3_api->vfs_find
472
+ #define sqlite3_vfs_register sqlite3_api->vfs_register
473
+ #define sqlite3_vfs_unregister sqlite3_api->vfs_unregister
474
+ #define sqlite3_threadsafe sqlite3_api->xthreadsafe
475
+ #define sqlite3_result_zeroblob sqlite3_api->result_zeroblob
476
+ #define sqlite3_result_error_code sqlite3_api->result_error_code
477
+ #define sqlite3_test_control sqlite3_api->test_control
478
+ #define sqlite3_randomness sqlite3_api->randomness
479
+ #define sqlite3_context_db_handle sqlite3_api->context_db_handle
480
+ #define sqlite3_extended_result_codes sqlite3_api->extended_result_codes
481
+ #define sqlite3_limit sqlite3_api->limit
482
+ #define sqlite3_next_stmt sqlite3_api->next_stmt
483
+ #define sqlite3_sql sqlite3_api->sql
484
+ #define sqlite3_status sqlite3_api->status
485
+ #define sqlite3_backup_finish sqlite3_api->backup_finish
486
+ #define sqlite3_backup_init sqlite3_api->backup_init
487
+ #define sqlite3_backup_pagecount sqlite3_api->backup_pagecount
488
+ #define sqlite3_backup_remaining sqlite3_api->backup_remaining
489
+ #define sqlite3_backup_step sqlite3_api->backup_step
490
+ #define sqlite3_compileoption_get sqlite3_api->compileoption_get
491
+ #define sqlite3_compileoption_used sqlite3_api->compileoption_used
492
+ #define sqlite3_create_function_v2 sqlite3_api->create_function_v2
493
+ #define sqlite3_db_config sqlite3_api->db_config
494
+ #define sqlite3_db_mutex sqlite3_api->db_mutex
495
+ #define sqlite3_db_status sqlite3_api->db_status
496
+ #define sqlite3_extended_errcode sqlite3_api->extended_errcode
497
+ #define sqlite3_log sqlite3_api->log
498
+ #define sqlite3_soft_heap_limit64 sqlite3_api->soft_heap_limit64
499
+ #define sqlite3_sourceid sqlite3_api->sourceid
500
+ #define sqlite3_stmt_status sqlite3_api->stmt_status
501
+ #define sqlite3_strnicmp sqlite3_api->strnicmp
502
+ #define sqlite3_unlock_notify sqlite3_api->unlock_notify
503
+ #define sqlite3_wal_autocheckpoint sqlite3_api->wal_autocheckpoint
504
+ #define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint
505
+ #define sqlite3_wal_hook sqlite3_api->wal_hook
506
+ #define sqlite3_blob_reopen sqlite3_api->blob_reopen
507
+ #define sqlite3_vtab_config sqlite3_api->vtab_config
508
+ #define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict
509
+ /* Version 3.7.16 and later */
510
+ #define sqlite3_close_v2 sqlite3_api->close_v2
511
+ #define sqlite3_db_filename sqlite3_api->db_filename
512
+ #define sqlite3_db_readonly sqlite3_api->db_readonly
513
+ #define sqlite3_db_release_memory sqlite3_api->db_release_memory
514
+ #define sqlite3_errstr sqlite3_api->errstr
515
+ #define sqlite3_stmt_busy sqlite3_api->stmt_busy
516
+ #define sqlite3_stmt_readonly sqlite3_api->stmt_readonly
517
+ #define sqlite3_stricmp sqlite3_api->stricmp
518
+ #define sqlite3_uri_boolean sqlite3_api->uri_boolean
519
+ #define sqlite3_uri_int64 sqlite3_api->uri_int64
520
+ #define sqlite3_uri_parameter sqlite3_api->uri_parameter
521
+ #define sqlite3_uri_vsnprintf sqlite3_api->xvsnprintf
522
+ #define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2
523
+ /* Version 3.8.7 and later */
524
+ #define sqlite3_auto_extension sqlite3_api->auto_extension
525
+ #define sqlite3_bind_blob64 sqlite3_api->bind_blob64
526
+ #define sqlite3_bind_text64 sqlite3_api->bind_text64
527
+ #define sqlite3_cancel_auto_extension sqlite3_api->cancel_auto_extension
528
+ #define sqlite3_load_extension sqlite3_api->load_extension
529
+ #define sqlite3_malloc64 sqlite3_api->malloc64
530
+ #define sqlite3_msize sqlite3_api->msize
531
+ #define sqlite3_realloc64 sqlite3_api->realloc64
532
+ #define sqlite3_reset_auto_extension sqlite3_api->reset_auto_extension
533
+ #define sqlite3_result_blob64 sqlite3_api->result_blob64
534
+ #define sqlite3_result_text64 sqlite3_api->result_text64
535
+ #define sqlite3_strglob sqlite3_api->strglob
536
+ /* Version 3.8.11 and later */
537
+ #define sqlite3_value_dup sqlite3_api->value_dup
538
+ #define sqlite3_value_free sqlite3_api->value_free
539
+ #define sqlite3_result_zeroblob64 sqlite3_api->result_zeroblob64
540
+ #define sqlite3_bind_zeroblob64 sqlite3_api->bind_zeroblob64
541
+ /* Version 3.9.0 and later */
542
+ #define sqlite3_value_subtype sqlite3_api->value_subtype
543
+ #define sqlite3_result_subtype sqlite3_api->result_subtype
544
+ /* Version 3.10.0 and later */
545
+ #define sqlite3_status64 sqlite3_api->status64
546
+ #define sqlite3_strlike sqlite3_api->strlike
547
+ #define sqlite3_db_cacheflush sqlite3_api->db_cacheflush
548
+ /* Version 3.12.0 and later */
549
+ #define sqlite3_system_errno sqlite3_api->system_errno
550
+ /* Version 3.14.0 and later */
551
+ #define sqlite3_trace_v2 sqlite3_api->trace_v2
552
+ #define sqlite3_expanded_sql sqlite3_api->expanded_sql
553
+ /* Version 3.18.0 and later */
554
+ #define sqlite3_set_last_insert_rowid sqlite3_api->set_last_insert_rowid
555
+ /* Version 3.20.0 and later */
556
+ #define sqlite3_prepare_v3 sqlite3_api->prepare_v3
557
+ #define sqlite3_prepare16_v3 sqlite3_api->prepare16_v3
558
+ #define sqlite3_bind_pointer sqlite3_api->bind_pointer
559
+ #define sqlite3_result_pointer sqlite3_api->result_pointer
560
+ #define sqlite3_value_pointer sqlite3_api->value_pointer
561
+ #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
562
+
563
+ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
564
+ /* This case when the file really is being compiled as a loadable
565
+ ** extension */
566
+ # define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0;
567
+ # define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v;
568
+ # define SQLITE_EXTENSION_INIT3 \
569
+ extern const sqlite3_api_routines *sqlite3_api;
570
+ #else
571
+ /* This case when the file is being statically linked into the
572
+ ** application */
573
+ # define SQLITE_EXTENSION_INIT1 /*no-op*/
574
+ # define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */
575
+ # define SQLITE_EXTENSION_INIT3 /*no-op*/
576
+ #endif
577
+
578
+ #endif /* SQLITE3EXT_H */