summaryrefslogtreecommitdiff
blob: 762f1359b9facf129db0faa995db3c6ae25f34f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
Add initialization functions for internal usage in libsqlite3.so.

SQLite revision: a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b

--- /ext/misc/amatch.c
+++ /ext/misc/amatch.c
@@ -1480,9 +1480,18 @@
 
 #endif /* SQLITE_OMIT_VIRTUALTABLE */
 
+int sqlite3AmatchInit(sqlite3 *db){
+  int rc = SQLITE_OK;
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+  rc = sqlite3_create_module(db, "approximate_match", &amatchModule, 0);
+#endif /* SQLITE_OMIT_VIRTUALTABLE */
+  return rc;
+}
+
 /*
 ** Register the amatch virtual table
 */
+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
 #ifdef _WIN32
 __declspec(dllexport)
 #endif
@@ -1491,11 +1500,8 @@
   char **pzErrMsg, 
   const sqlite3_api_routines *pApi
 ){
-  int rc = SQLITE_OK;
   SQLITE_EXTENSION_INIT2(pApi);
   (void)pzErrMsg;  /* Not used */
-#ifndef SQLITE_OMIT_VIRTUALTABLE
-  rc = sqlite3_create_module(db, "approximate_match", &amatchModule, 0);
-#endif /* SQLITE_OMIT_VIRTUALTABLE */
-  return rc;
+  return sqlite3AmatchInit(db);
 }
+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
--- /ext/misc/carray.c
+++ /ext/misc/carray.c
@@ -498,16 +498,8 @@
 
 #endif /* SQLITE_OMIT_VIRTUALTABLE */
 
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
-int sqlite3_carray_init(
-  sqlite3 *db, 
-  char **pzErrMsg, 
-  const sqlite3_api_routines *pApi
-){
+int sqlite3CarrayInit(sqlite3 *db){
   int rc = SQLITE_OK;
-  SQLITE_EXTENSION_INIT2(pApi);
 #ifndef SQLITE_OMIT_VIRTUALTABLE
   rc = sqlite3_create_module(db, "carray", &carrayModule, 0);
 #ifdef SQLITE_TEST
@@ -519,3 +511,18 @@
 #endif /* SQLITE_OMIT_VIRTUALTABLE */
   return rc;
 }
+
+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int sqlite3_carray_init(
+  sqlite3 *db, 
+  char **pzErrMsg, 
+  const sqlite3_api_routines *pApi
+){
+  SQLITE_EXTENSION_INIT2(pApi);
+  (void)pzErrMsg;  /* Unused parameter */
+  return sqlite3CarrayInit(db);
+}
+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
--- /ext/misc/completion.c
+++ /ext/misc/completion.c
@@ -483,12 +483,13 @@
   return rc;
 }
 
+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
 #ifdef _WIN32
 __declspec(dllexport)
 #endif
 int sqlite3_completion_init(
-  sqlite3 *db, 
-  char **pzErrMsg, 
+  sqlite3 *db,
+  char **pzErrMsg,
   const sqlite3_api_routines *pApi
 ){
   int rc = SQLITE_OK;
@@ -499,3 +500,4 @@
 #endif
   return rc;
 }
+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
--- /ext/misc/csv.c
+++ /ext/misc/csv.c
@@ -928,6 +928,22 @@
 #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */
 
 
+int sqlite3CsvInit(sqlite3 *db){
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+  int rc;
+  rc = sqlite3_create_module(db, "csv", &CsvModule, 0);
+#ifdef SQLITE_TEST
+  if( rc==SQLITE_OK ){
+    rc = sqlite3_create_module(db, "csv_wr", &CsvModuleFauxWrite, 0);
+  }
+#endif
+  return rc;
+#else
+  return SQLITE_OK;
+#endif
+}
+
+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
 #ifdef _WIN32
 __declspec(dllexport)
 #endif
@@ -941,17 +957,8 @@
   char **pzErrMsg, 
   const sqlite3_api_routines *pApi
 ){
-#ifndef SQLITE_OMIT_VIRTUALTABLE	
-  int rc;
   SQLITE_EXTENSION_INIT2(pApi);
-  rc = sqlite3_create_module(db, "csv", &CsvModule, 0);
-#ifdef SQLITE_TEST
-  if( rc==SQLITE_OK ){
-    rc = sqlite3_create_module(db, "csv_wr", &CsvModuleFauxWrite, 0);
-  }
-#endif
-  return rc;
-#else
-  return SQLITE_OK;
-#endif
+  (void)pzErrMsg;  /* Unused parameter */
+  return sqlite3CsvInit(db);
 }
+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
--- /ext/misc/dbdata.c
+++ /ext/misc/dbdata.c
@@ -803,7 +803,7 @@
 /*
 ** Invoke this routine to register the "sqlite_dbdata" virtual table module
 */
-static int sqlite3DbdataRegister(sqlite3 *db){
+int sqlite3DbdataRegister(sqlite3 *db){
   static sqlite3_module dbdata_module = {
     0,                            /* iVersion */
     0,                            /* xCreate */
@@ -838,6 +838,7 @@
   return rc;
 }
 
+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
 #ifdef _WIN32
 __declspec(dllexport)
 #endif
@@ -849,3 +850,4 @@
   SQLITE_EXTENSION_INIT2(pApi);
   return sqlite3DbdataRegister(db);
 }
+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
--- /ext/misc/decimal.c
+++ /ext/misc/decimal.c
@@ -590,14 +590,7 @@
   decimal_free(pB);
 }
 
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
-int sqlite3_decimal_init(
-  sqlite3 *db, 
-  char **pzErrMsg, 
-  const sqlite3_api_routines *pApi
-){
+int sqlite3DecimalInit(sqlite3 *db){
   int rc = SQLITE_OK;
   static const struct {
     const char *zFuncName;
@@ -611,10 +604,6 @@
     { "decimal_mul",   2,   decimalMulFunc     },
   };
   unsigned int i;
-  (void)pzErrMsg;  /* Unused parameter */
-
-  SQLITE_EXTENSION_INIT2(pApi);
-
   for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){
     rc = sqlite3_create_function(db, aFunc[i].zFuncName, aFunc[i].nArg,
                    SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
@@ -632,3 +621,20 @@
   }
   return rc;
 }
+
+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int sqlite3_decimal_init(
+  sqlite3 *db, 
+  char **pzErrMsg, 
+  const sqlite3_api_routines *pApi
+){
+  (void)pzErrMsg;  /* Unused parameter */
+
+  SQLITE_EXTENSION_INIT2(pApi);
+
+  return sqlite3DecimalInit(db);
+}
+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
--- /ext/misc/eval.c
+++ /ext/misc/eval.c
@@ -102,6 +102,20 @@
 }
 
 
+int sqlite3EvalInit(sqlite3 *db){
+  int rc = SQLITE_OK;
+  rc = sqlite3_create_function(db, "eval", 1,
+                               SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
+                               sqlEvalFunc, 0, 0);
+  if( rc==SQLITE_OK ){
+    rc = sqlite3_create_function(db, "eval", 2,
+                                 SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
+                                 sqlEvalFunc, 0, 0);
+  }
+  return rc;
+}
+
+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
 #ifdef _WIN32
 __declspec(dllexport)
 #endif
@@ -110,16 +124,8 @@
   char **pzErrMsg, 
   const sqlite3_api_routines *pApi
 ){
-  int rc = SQLITE_OK;
   SQLITE_EXTENSION_INIT2(pApi);
   (void)pzErrMsg;  /* Unused parameter */
-  rc = sqlite3_create_function(db, "eval", 1, 
-                               SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
-                               sqlEvalFunc, 0, 0);
-  if( rc==SQLITE_OK ){
-    rc = sqlite3_create_function(db, "eval", 2,
-                                 SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
-                                 sqlEvalFunc, 0, 0);
-  }
-  return rc;
+  return sqlite3EvalInit(db);
 }
+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
--- /ext/misc/fileio.c
+++ /ext/misc/fileio.c
@@ -340,7 +340,7 @@
 ** This function does the work for the writefile() UDF. Refer to 
 ** header comments at the top of this file for details.
 */
-static int writeFile(
+static int writeFileContents(
   sqlite3_context *pCtx,          /* Context to return bytes written in */
   const char *zFile,              /* File to write */
   sqlite3_value *pData,           /* Data to write */
@@ -480,10 +480,10 @@
     mtime = sqlite3_value_int64(argv[3]);
   }
 
-  res = writeFile(context, zFile, argv[1], mode, mtime);
+  res = writeFileContents(context, zFile, argv[1], mode, mtime);
   if( res==1 && errno==ENOENT ){
     if( makeDirectory(zFile)==SQLITE_OK ){
-      res = writeFile(context, zFile, argv[1], mode, mtime);
+      res = writeFileContents(context, zFile, argv[1], mode, mtime);
     }
   }
 
@@ -970,18 +970,9 @@
 # define fsdirRegister(x) SQLITE_OK
 #endif
 
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
-int sqlite3_fileio_init(
-  sqlite3 *db, 
-  char **pzErrMsg, 
-  const sqlite3_api_routines *pApi
-){
+int sqlite3FileioInit(sqlite3 *db){
   int rc = SQLITE_OK;
-  SQLITE_EXTENSION_INIT2(pApi);
-  (void)pzErrMsg;  /* Unused parameter */
-  rc = sqlite3_create_function(db, "readfile", 1, 
+  rc = sqlite3_create_function(db, "readfile", 1,
                                SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
                                readfileFunc, 0, 0);
   if( rc==SQLITE_OK ){
@@ -998,3 +989,18 @@
   }
   return rc;
 }
+
+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int sqlite3_fileio_init(
+  sqlite3 *db, 
+  char **pzErrMsg, 
+  const sqlite3_api_routines *pApi
+){
+  SQLITE_EXTENSION_INIT2(pApi);
+  (void)pzErrMsg;  /* Unused parameter */
+  return sqlite3FileioInit(db);
+}
+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */
--- /ext/misc/ieee754.c
+++ /ext/misc/ieee754.c
@@ -245,14 +245,7 @@
 }
 
 
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
-int sqlite3_ieee_init(
-  sqlite3 *db, 
-  char **pzErrMsg, 
-  const sqlite3_api_routines *pApi
-){
+int sqlite3IeeeInit(sqlite3 *db){
   static const struct {
     char *zFName;
     int nArg;
@@ -269,13 +262,26 @@
   };
   unsigned int i;
   int rc = SQLITE_OK;
-  SQLITE_EXTENSION_INIT2(pApi);
-  (void)pzErrMsg;  /* Unused parameter */
   for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){
-    rc = sqlite3_create_function(db, aFunc[i].zFName, aFunc[i].nArg,	
+    rc = sqlite3_create_function(db, aFunc[i].zFName, aFunc[i].nArg,
                                SQLITE_UTF8|SQLITE_INNOCUOUS,
                                (void*)&aFunc[i].iAux,
                                aFunc[i].xFunc, 0, 0);
   }
   return rc;
 }
+
+#if !defined(SQLITE_CORE) || defined(SQLITE_TEST)
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int sqlite3_ieee_init(
+  sqlite3 *db, 
+  char **pzErrMsg, 
+  const sqlite3_api_routines *pApi
+){
+  SQLITE_EXTENSION_INIT2(pApi);
+  (void)pzErrMsg;  /* Unused parameter */
+  return sqlite3IeeeInit(db);
+}
+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */