Fossil SCM

Update to the latest SQLite 3.15.0 beta for testing. Adjust the SQLite compilation to use the "lean" configuration.

drh 2016-09-22 19:47 UTC trunk
Commit 121201eb35eeeaaa23f2c1edd3ea1614ff0528ce
+9 -5
--- src/main.mk
+++ src/main.mk
@@ -489,17 +489,21 @@
489489
$(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion
490490
$(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
491491
492492
# Setup the options used to compile the included SQLite library.
493493
SQLITE_OPTIONS = -DNDEBUG=1 \
494
- -DSQLITE_OMIT_LOAD_EXTENSION=1 \
495
- -DSQLITE_OMIT_SHARED_CACHE \
496
- -DSQLITE_ENABLE_LOCKING_STYLE=0 \
497
- -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 \
498494
-DSQLITE_THREADSAFE=0 \
499
- -DSQLITE_DEFAULT_FILE_FORMAT=4 \
495
+ -DSQLITE_DEFAULT_MEMSTATUS=0 \
496
+ -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \
497
+ -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
498
+ -DSQLITE_OMIT_DECLTYPE \
500499
-DSQLITE_OMIT_DEPRECATED \
500
+ -DSQLITE_OMIT_PROGRESS_CALLBACK \
501
+ -DSQLITE_OMIT_SHARED_CACHE \
502
+ -DSQLITE_OMIT_LOAD_EXTENSION \
503
+ -DSQLITE_ENABLE_LOCKING_STYLE=0 \
504
+ -DSQLITE_DEFAULT_FILE_FORMAT=4 \
501505
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
502506
-DSQLITE_ENABLE_FTS4 \
503507
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
504508
-DSQLITE_ENABLE_DBSTAT_VTAB \
505509
-DSQLITE_ENABLE_JSON1 \
506510
--- src/main.mk
+++ src/main.mk
@@ -489,17 +489,21 @@
489 $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion
490 $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
491
492 # Setup the options used to compile the included SQLite library.
493 SQLITE_OPTIONS = -DNDEBUG=1 \
494 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
495 -DSQLITE_OMIT_SHARED_CACHE \
496 -DSQLITE_ENABLE_LOCKING_STYLE=0 \
497 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 \
498 -DSQLITE_THREADSAFE=0 \
499 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
 
 
 
500 -DSQLITE_OMIT_DEPRECATED \
 
 
 
 
 
501 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
502 -DSQLITE_ENABLE_FTS4 \
503 -DSQLITE_ENABLE_FTS3_PARENTHESIS \
504 -DSQLITE_ENABLE_DBSTAT_VTAB \
505 -DSQLITE_ENABLE_JSON1 \
506
--- src/main.mk
+++ src/main.mk
@@ -489,17 +489,21 @@
489 $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion
490 $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
491
492 # Setup the options used to compile the included SQLite library.
493 SQLITE_OPTIONS = -DNDEBUG=1 \
 
 
 
 
494 -DSQLITE_THREADSAFE=0 \
495 -DSQLITE_DEFAULT_MEMSTATUS=0 \
496 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \
497 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
498 -DSQLITE_OMIT_DECLTYPE \
499 -DSQLITE_OMIT_DEPRECATED \
500 -DSQLITE_OMIT_PROGRESS_CALLBACK \
501 -DSQLITE_OMIT_SHARED_CACHE \
502 -DSQLITE_OMIT_LOAD_EXTENSION \
503 -DSQLITE_ENABLE_LOCKING_STYLE=0 \
504 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
505 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
506 -DSQLITE_ENABLE_FTS4 \
507 -DSQLITE_ENABLE_FTS3_PARENTHESIS \
508 -DSQLITE_ENABLE_DBSTAT_VTAB \
509 -DSQLITE_ENABLE_JSON1 \
510
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -155,17 +155,21 @@
155155
156156
# Options used to compile the included SQLite library.
157157
#
158158
set SQLITE_OPTIONS {
159159
-DNDEBUG=1
160
- -DSQLITE_OMIT_LOAD_EXTENSION=1
161
- -DSQLITE_OMIT_SHARED_CACHE
162
- -DSQLITE_ENABLE_LOCKING_STYLE=0
163
- -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1
164160
-DSQLITE_THREADSAFE=0
165
- -DSQLITE_DEFAULT_FILE_FORMAT=4
161
+ -DSQLITE_DEFAULT_MEMSTATUS=0
162
+ -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1
163
+ -DSQLITE_LIKE_DOESNT_MATCH_BLOBS
164
+ -DSQLITE_OMIT_DECLTYPE
166165
-DSQLITE_OMIT_DEPRECATED
166
+ -DSQLITE_OMIT_PROGRESS_CALLBACK
167
+ -DSQLITE_OMIT_SHARED_CACHE
168
+ -DSQLITE_OMIT_LOAD_EXTENSION
169
+ -DSQLITE_ENABLE_LOCKING_STYLE=0
170
+ -DSQLITE_DEFAULT_FILE_FORMAT=4
167171
-DSQLITE_ENABLE_EXPLAIN_COMMENTS
168172
-DSQLITE_ENABLE_FTS4
169173
-DSQLITE_ENABLE_FTS3_PARENTHESIS
170174
-DSQLITE_ENABLE_DBSTAT_VTAB
171175
-DSQLITE_ENABLE_JSON1
172176
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -155,17 +155,21 @@
155
156 # Options used to compile the included SQLite library.
157 #
158 set SQLITE_OPTIONS {
159 -DNDEBUG=1
160 -DSQLITE_OMIT_LOAD_EXTENSION=1
161 -DSQLITE_OMIT_SHARED_CACHE
162 -DSQLITE_ENABLE_LOCKING_STYLE=0
163 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1
164 -DSQLITE_THREADSAFE=0
165 -DSQLITE_DEFAULT_FILE_FORMAT=4
 
 
 
166 -DSQLITE_OMIT_DEPRECATED
 
 
 
 
 
167 -DSQLITE_ENABLE_EXPLAIN_COMMENTS
168 -DSQLITE_ENABLE_FTS4
169 -DSQLITE_ENABLE_FTS3_PARENTHESIS
170 -DSQLITE_ENABLE_DBSTAT_VTAB
171 -DSQLITE_ENABLE_JSON1
172
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -155,17 +155,21 @@
155
156 # Options used to compile the included SQLite library.
157 #
158 set SQLITE_OPTIONS {
159 -DNDEBUG=1
 
 
 
 
160 -DSQLITE_THREADSAFE=0
161 -DSQLITE_DEFAULT_MEMSTATUS=0
162 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1
163 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS
164 -DSQLITE_OMIT_DECLTYPE
165 -DSQLITE_OMIT_DEPRECATED
166 -DSQLITE_OMIT_PROGRESS_CALLBACK
167 -DSQLITE_OMIT_SHARED_CACHE
168 -DSQLITE_OMIT_LOAD_EXTENSION
169 -DSQLITE_ENABLE_LOCKING_STYLE=0
170 -DSQLITE_DEFAULT_FILE_FORMAT=4
171 -DSQLITE_ENABLE_EXPLAIN_COMMENTS
172 -DSQLITE_ENABLE_FTS4
173 -DSQLITE_ENABLE_FTS3_PARENTHESIS
174 -DSQLITE_ENABLE_DBSTAT_VTAB
175 -DSQLITE_ENABLE_JSON1
176
+246 -36
--- src/shell.c
+++ src/shell.c
@@ -141,10 +141,11 @@
141141
142142
/* string conversion routines only needed on Win32 */
143143
extern char *sqlite3_win32_unicode_to_utf8(LPCWSTR);
144144
extern char *sqlite3_win32_mbcs_to_utf8_v2(const char *, int);
145145
extern char *sqlite3_win32_utf8_to_mbcs_v2(const char *, int);
146
+extern LPWSTR sqlite3_win32_utf8_to_unicode(const char *zText);
146147
#endif
147148
148149
/* On Windows, we normally run with output mode of TEXT so that \n characters
149150
** are automatically translated into \r\n. However, this behavior needs
150151
** to be disabled in some cases (ex: when generating CSV output and when
@@ -624,12 +625,14 @@
624625
int mode; /* An output mode setting */
625626
int cMode; /* temporary output mode for the current query */
626627
int normalMode; /* Output mode before ".explain on" */
627628
int writableSchema; /* True if PRAGMA writable_schema=ON */
628629
int showHeader; /* True to show column names in List or Column mode */
630
+ int nCheck; /* Number of ".check" commands run */
629631
unsigned shellFlgs; /* Various flags */
630632
char *zDestTable; /* Name of destination table when MODE_Insert */
633
+ char zTestcase[30]; /* Name of current test case */
631634
char colSeparator[20]; /* Column separator character for several modes */
632635
char rowSeparator[20]; /* Row separator character for MODE_Ascii */
633636
int colWidth[100]; /* Requested width of each column when in column mode*/
634637
int actualWidth[100]; /* Actual width of each column */
635638
char nullValue[20]; /* The text to print when a NULL comes back from
@@ -892,10 +895,11 @@
892895
if( seenInterrupt>2 ) exit(1);
893896
if( globalDb ) sqlite3_interrupt(globalDb);
894897
}
895898
#endif
896899
900
+#ifndef SQLITE_OMIT_AUTHORIZATION
897901
/*
898902
** When the ".auth ON" is set, the following authorizer callback is
899903
** invoked. It always returns SQLITE_OK.
900904
*/
901905
static int shellAuth(
@@ -924,11 +928,11 @@
924928
const char *az[4];
925929
az[0] = zA1;
926930
az[1] = zA2;
927931
az[2] = zA3;
928932
az[3] = zA4;
929
- raw_printf(p->out, "authorizer: %s", azAction[op]);
933
+ utf8_printf(p->out, "authorizer: %s", azAction[op]);
930934
for(i=0; i<4; i++){
931935
raw_printf(p->out, " ");
932936
if( az[i] ){
933937
output_c_string(p->out, az[i]);
934938
}else{
@@ -936,11 +940,12 @@
936940
}
937941
}
938942
raw_printf(p->out, "\n");
939943
return SQLITE_OK;
940944
}
941
-
945
+#endif
946
+
942947
943948
/*
944949
** This is the callback routine that the shell
945950
** invokes for each row of a query result.
946951
*/
@@ -1440,11 +1445,11 @@
14401445
};
14411446
int i;
14421447
for(i=0; i<ArraySize(aTrans); i++){
14431448
int n = (int)strlen(aTrans[i].zPattern);
14441449
if( strncmp(aTrans[i].zPattern, z, n)==0 ){
1445
- raw_printf(out, "%-36s %s", aTrans[i].zDesc, &z[n]);
1450
+ utf8_printf(out, "%-36s %s", aTrans[i].zDesc, &z[n]);
14461451
break;
14471452
}
14481453
}
14491454
}
14501455
fclose(in);
@@ -2129,15 +2134,18 @@
21292134
21302135
/*
21312136
** Text of a help message
21322137
*/
21332138
static char zHelp[] =
2139
+#ifndef SQLITE_OMIT_AUTHORIZATION
21342140
".auth ON|OFF Show authorizer callbacks\n"
2141
+#endif
21352142
".backup ?DB? FILE Backup DB (default \"main\") to FILE\n"
21362143
".bail on|off Stop after hitting an error. Default OFF\n"
21372144
".binary on|off Turn binary output on or off. Default OFF\n"
21382145
".changes on|off Show number of rows changed by SQL\n"
2146
+ ".check GLOB Fail if output since .testcase does not match\n"
21392147
".clone NEWDB Clone data into NEWDB from the existing database\n"
21402148
".databases List names and files of attached databases\n"
21412149
".dbinfo ?DB? Show status information about the database\n"
21422150
".dump ?TABLE? ... Dump the database in an SQL text format\n"
21432151
" If TABLE specified, only dump tables matching\n"
@@ -2171,11 +2179,12 @@
21712179
" list Values delimited by .separator strings\n"
21722180
" tabs Tab-separated values\n"
21732181
" tcl TCL list elements\n"
21742182
".nullvalue STRING Use STRING in place of NULL values\n"
21752183
".once FILENAME Output for the next SQL command only to FILENAME\n"
2176
- ".open ?FILENAME? Close existing database and reopen FILENAME\n"
2184
+ ".open ?--new? ?FILE? Close existing database and reopen FILE\n"
2185
+ " The --new starts with an empty file\n"
21772186
".output ?FILENAME? Send output to FILENAME or stdout\n"
21782187
".print STRING... Print literal STRING\n"
21792188
".prompt MAIN CONTINUE Replace the standard prompts\n"
21802189
".quit Exit this program\n"
21812190
".read FILENAME Execute SQL in FILENAME\n"
@@ -2194,10 +2203,11 @@
21942203
".stats ?on|off? Show stats or turn stats on or off\n"
21952204
".system CMD ARGS... Run CMD ARGS... in a system shell\n"
21962205
".tables ?TABLE? List names of tables\n"
21972206
" If TABLE specified, only list tables matching\n"
21982207
" LIKE pattern TABLE.\n"
2208
+ ".testcase NAME Begin redirecting output to 'testcase-out.txt'\n"
21992209
".timeout MS Try opening locked tables for MS milliseconds\n"
22002210
".timer on|off Turn SQL timer on or off\n"
22012211
".trace FILE|off Output each SQL statement as it is run\n"
22022212
".vfsinfo ?AUX? Information about the top-level VFS\n"
22032213
".vfslist List all available VFSes\n"
@@ -2230,10 +2240,39 @@
22302240
#endif
22312241
22322242
22332243
/* Forward reference */
22342244
static int process_input(ShellState *p, FILE *in);
2245
+
2246
+
2247
+/*
2248
+** Read the content of a file into memory obtained from sqlite3_malloc64().
2249
+** The caller is responsible for freeing the memory.
2250
+**
2251
+** NULL is returned if any error is encountered.
2252
+*/
2253
+static char *readFile(const char *zName){
2254
+ FILE *in = fopen(zName, "rb");
2255
+ long nIn;
2256
+ size_t nRead;
2257
+ char *pBuf;
2258
+ if( in==0 ) return 0;
2259
+ fseek(in, 0, SEEK_END);
2260
+ nIn = ftell(in);
2261
+ rewind(in);
2262
+ pBuf = sqlite3_malloc64( nIn+1 );
2263
+ if( pBuf==0 ) return 0;
2264
+ nRead = fread(pBuf, nIn, 1, in);
2265
+ fclose(in);
2266
+ if( nRead!=1 ){
2267
+ sqlite3_free(pBuf);
2268
+ return 0;
2269
+ }
2270
+ pBuf[nIn] = 0;
2271
+ return pBuf;
2272
+}
2273
+
22352274
/*
22362275
** Implementation of the "readfile(X)" SQL function. The entire content
22372276
** of the file named X is read and returned as a BLOB. NULL is returned
22382277
** if the file does not exist or is unreadable.
22392278
*/
@@ -2241,29 +2280,17 @@
22412280
sqlite3_context *context,
22422281
int argc,
22432282
sqlite3_value **argv
22442283
){
22452284
const char *zName;
2246
- FILE *in;
2247
- long nIn;
22482285
void *pBuf;
22492286
22502287
UNUSED_PARAMETER(argc);
22512288
zName = (const char*)sqlite3_value_text(argv[0]);
22522289
if( zName==0 ) return;
2253
- in = fopen(zName, "rb");
2254
- if( in==0 ) return;
2255
- fseek(in, 0, SEEK_END);
2256
- nIn = ftell(in);
2257
- rewind(in);
2258
- pBuf = sqlite3_malloc64( nIn );
2259
- if( pBuf && 1==fread(pBuf, nIn, 1, in) ){
2260
- sqlite3_result_blob(context, pBuf, nIn, sqlite3_free);
2261
- }else{
2262
- sqlite3_free(pBuf);
2263
- }
2264
- fclose(in);
2290
+ pBuf = readFile(zName);
2291
+ if( pBuf ) sqlite3_result_blob(context, pBuf, -1, sqlite3_free);
22652292
}
22662293
22672294
/*
22682295
** Implementation of the "writefile(X,Y)" SQL function. The argument Y
22692296
** is written into file X. The number of bytes written is returned. Or
@@ -3060,10 +3087,108 @@
30603087
*/
30613088
static int shellNomemError(void){
30623089
raw_printf(stderr, "Error: out of memory\n");
30633090
return 1;
30643091
}
3092
+
3093
+/*
3094
+** Compare the pattern in zGlob[] against the text in z[]. Return TRUE
3095
+** if they match and FALSE (0) if they do not match.
3096
+**
3097
+** Globbing rules:
3098
+**
3099
+** '*' Matches any sequence of zero or more characters.
3100
+**
3101
+** '?' Matches exactly one character.
3102
+**
3103
+** [...] Matches one character from the enclosed list of
3104
+** characters.
3105
+**
3106
+** [^...] Matches one character not in the enclosed list.
3107
+**
3108
+** '#' Matches any sequence of one or more digits with an
3109
+** optional + or - sign in front
3110
+**
3111
+** ' ' Any span of whitespace matches any other span of
3112
+** whitespace.
3113
+**
3114
+** Extra whitespace at the end of z[] is ignored.
3115
+*/
3116
+static int testcase_glob(const char *zGlob, const char *z){
3117
+ int c, c2;
3118
+ int invert;
3119
+ int seen;
3120
+
3121
+ while( (c = (*(zGlob++)))!=0 ){
3122
+ if( IsSpace(c) ){
3123
+ if( !IsSpace(*z) ) return 0;
3124
+ while( IsSpace(*zGlob) ) zGlob++;
3125
+ while( IsSpace(*z) ) z++;
3126
+ }else if( c=='*' ){
3127
+ while( (c=(*(zGlob++))) == '*' || c=='?' ){
3128
+ if( c=='?' && (*(z++))==0 ) return 0;
3129
+ }
3130
+ if( c==0 ){
3131
+ return 1;
3132
+ }else if( c=='[' ){
3133
+ while( *z && testcase_glob(zGlob-1,z)==0 ){
3134
+ z++;
3135
+ }
3136
+ return (*z)!=0;
3137
+ }
3138
+ while( (c2 = (*(z++)))!=0 ){
3139
+ while( c2!=c ){
3140
+ c2 = *(z++);
3141
+ if( c2==0 ) return 0;
3142
+ }
3143
+ if( testcase_glob(zGlob,z) ) return 1;
3144
+ }
3145
+ return 0;
3146
+ }else if( c=='?' ){
3147
+ if( (*(z++))==0 ) return 0;
3148
+ }else if( c=='[' ){
3149
+ int prior_c = 0;
3150
+ seen = 0;
3151
+ invert = 0;
3152
+ c = *(z++);
3153
+ if( c==0 ) return 0;
3154
+ c2 = *(zGlob++);
3155
+ if( c2=='^' ){
3156
+ invert = 1;
3157
+ c2 = *(zGlob++);
3158
+ }
3159
+ if( c2==']' ){
3160
+ if( c==']' ) seen = 1;
3161
+ c2 = *(zGlob++);
3162
+ }
3163
+ while( c2 && c2!=']' ){
3164
+ if( c2=='-' && zGlob[0]!=']' && zGlob[0]!=0 && prior_c>0 ){
3165
+ c2 = *(zGlob++);
3166
+ if( c>=prior_c && c<=c2 ) seen = 1;
3167
+ prior_c = 0;
3168
+ }else{
3169
+ if( c==c2 ){
3170
+ seen = 1;
3171
+ }
3172
+ prior_c = c2;
3173
+ }
3174
+ c2 = *(zGlob++);
3175
+ }
3176
+ if( c2==0 || (seen ^ invert)==0 ) return 0;
3177
+ }else if( c=='#' ){
3178
+ if( (z[0]=='-' || z[0]=='+') && IsDigit(z[1]) ) z++;
3179
+ if( !IsDigit(z[0]) ) return 0;
3180
+ z++;
3181
+ while( IsDigit(z[0]) ){ z++; }
3182
+ }else{
3183
+ if( c!=(*(z++)) ) return 0;
3184
+ }
3185
+ }
3186
+ while( IsSpace(*z) ){ z++; }
3187
+ return *z==0;
3188
+}
3189
+
30653190
30663191
/*
30673192
** Compare the string as a command-line option with either one or two
30683193
** initial "-" characters.
30693194
*/
@@ -3071,10 +3196,25 @@
30713196
if( zStr[0]!='-' ) return 0;
30723197
zStr++;
30733198
if( zStr[0]=='-' ) zStr++;
30743199
return strcmp(zStr, zOpt)==0;
30753200
}
3201
+
3202
+/*
3203
+** Delete a file.
3204
+*/
3205
+int shellDeleteFile(const char *zFilename){
3206
+ int rc;
3207
+#ifdef _WIN32
3208
+ wchar_t *z = sqlite3_win32_utf8_to_unicode(zFilename);
3209
+ rc = _wunlink(z);
3210
+ sqlite3_free(z);
3211
+#else
3212
+ rc = unlink(zFilename);
3213
+#endif
3214
+ return rc;
3215
+}
30763216
30773217
/*
30783218
** If an input line begins with "." then invoke this routine to
30793219
** process that line.
30803220
**
@@ -3115,10 +3255,11 @@
31153255
*/
31163256
if( nArg==0 ) return 0; /* no tokens, no error */
31173257
n = strlen30(azArg[0]);
31183258
c = azArg[0][0];
31193259
3260
+#ifndef SQLITE_OMIT_AUTHORIZATION
31203261
if( c=='a' && strncmp(azArg[0], "auth", n)==0 ){
31213262
if( nArg!=2 ){
31223263
raw_printf(stderr, "Usage: .auth ON|OFF\n");
31233264
rc = 1;
31243265
goto meta_command_exit;
@@ -3128,10 +3269,11 @@
31283269
sqlite3_set_authorizer(p->db, shellAuth, p);
31293270
}else{
31303271
sqlite3_set_authorizer(p->db, 0, 0);
31313272
}
31323273
}else
3274
+#endif
31333275
31343276
if( (c=='b' && n>=3 && strncmp(azArg[0], "backup", n)==0)
31353277
|| (c=='s' && n>=3 && strncmp(azArg[0], "save", n)==0)
31363278
){
31373279
const char *zDestFile = 0;
@@ -3222,10 +3364,35 @@
32223364
}else{
32233365
raw_printf(stderr, "Usage: .changes on|off\n");
32243366
rc = 1;
32253367
}
32263368
}else
3369
+
3370
+ /* Cancel output redirection, if it is currently set (by .testcase)
3371
+ ** Then read the content of the testcase-out.txt file and compare against
3372
+ ** azArg[1]. If there are differences, report an error and exit.
3373
+ */
3374
+ if( c=='c' && n>=3 && strncmp(azArg[0], "check", n)==0 ){
3375
+ char *zRes = 0;
3376
+ output_reset(p);
3377
+ if( nArg!=2 ){
3378
+ raw_printf(stderr, "Usage: .check GLOB-PATTERN\n");
3379
+ rc = 2;
3380
+ }else if( (zRes = readFile("testcase-out.txt"))==0 ){
3381
+ raw_printf(stderr, "Error: cannot read 'testcase-out.txt'\n");
3382
+ rc = 2;
3383
+ }else if( testcase_glob(azArg[1],zRes)==0 ){
3384
+ utf8_printf(stderr,
3385
+ "testcase-%s FAILED\n Expected: [%s]\n Got: [%s]\n",
3386
+ p->zTestcase, azArg[1], zRes);
3387
+ rc = 2;
3388
+ }else{
3389
+ utf8_printf(stdout, "testcase-%s ok\n", p->zTestcase);
3390
+ p->nCheck++;
3391
+ }
3392
+ sqlite3_free(zRes);
3393
+ }else
32273394
32283395
if( c=='c' && strncmp(azArg[0], "clone", n)==0 ){
32293396
if( nArg==2 ){
32303397
tryToClone(p, azArg[1]);
32313398
}else{
@@ -3831,26 +3998,47 @@
38313998
rc = 1;
38323999
}
38334000
}else
38344001
38354002
if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
3836
- sqlite3 *savedDb = p->db;
3837
- const char *zSavedFilename = p->zDbFilename;
3838
- char *zNewFilename = 0;
4003
+ char *zNewFilename; /* Name of the database file to open */
4004
+ int iName = 1; /* Index in azArg[] of the filename */
4005
+ int newFlag = 0; /* True to delete file before opening */
4006
+ /* Close the existing database */
4007
+ session_close_all(p);
4008
+ sqlite3_close(p->db);
38394009
p->db = 0;
3840
- if( nArg>=2 ) zNewFilename = sqlite3_mprintf("%s", azArg[1]);
3841
- p->zDbFilename = zNewFilename;
3842
- open_db(p, 1);
3843
- if( p->db!=0 ){
3844
- session_close_all(p);
3845
- sqlite3_close(savedDb);
3846
- sqlite3_free(p->zFreeOnClose);
3847
- p->zFreeOnClose = zNewFilename;
3848
- }else{
3849
- sqlite3_free(zNewFilename);
3850
- p->db = savedDb;
3851
- p->zDbFilename = zSavedFilename;
4010
+ sqlite3_free(p->zFreeOnClose);
4011
+ p->zFreeOnClose = 0;
4012
+ /* Check for command-line arguments */
4013
+ for(iName=1; iName<nArg && azArg[iName][0]=='-'; iName++){
4014
+ const char *z = azArg[iName];
4015
+ if( optionMatch(z,"new") ){
4016
+ newFlag = 1;
4017
+ }else if( z[0]=='-' ){
4018
+ utf8_printf(stderr, "unknown option: %s\n", z);
4019
+ rc = 1;
4020
+ goto meta_command_exit;
4021
+ }
4022
+ }
4023
+ /* If a filename is specified, try to open it first */
4024
+ zNewFilename = nArg>iName ? sqlite3_mprintf("%s", azArg[iName]) : 0;
4025
+ if( zNewFilename ){
4026
+ if( newFlag ) shellDeleteFile(zNewFilename);
4027
+ p->zDbFilename = zNewFilename;
4028
+ open_db(p, 1);
4029
+ if( p->db==0 ){
4030
+ utf8_printf(stderr, "Error: cannot open '%s'\n", zNewFilename);
4031
+ sqlite3_free(zNewFilename);
4032
+ }else{
4033
+ p->zFreeOnClose = zNewFilename;
4034
+ }
4035
+ }
4036
+ if( p->db==0 ){
4037
+ /* As a fall-back open a TEMP database */
4038
+ p->zDbFilename = 0;
4039
+ open_db(p, 0);
38524040
}
38534041
}else
38544042
38554043
if( c=='o'
38564044
&& (strncmp(azArg[0], "output", n)==0 || strncmp(azArg[0], "once", n)==0)
@@ -4376,10 +4564,12 @@
43764564
utf8_printf(p->out, "%12.12s: ", "width");
43774565
for (i=0;i<(int)ArraySize(p->colWidth) && p->colWidth[i] != 0;i++) {
43784566
raw_printf(p->out, "%d ", p->colWidth[i]);
43794567
}
43804568
raw_printf(p->out, "\n");
4569
+ utf8_printf(p->out, "%12.12s: %s\n", "filename",
4570
+ p->zDbFilename ? p->zDbFilename : "");
43814571
}else
43824572
43834573
if( c=='s' && strncmp(azArg[0], "stats", n)==0 ){
43844574
if( nArg==2 ){
43854575
p->statsOn = booleanValue(azArg[1]);
@@ -4492,10 +4682,24 @@
44924682
}
44934683
44944684
for(ii=0; ii<nRow; ii++) sqlite3_free(azResult[ii]);
44954685
sqlite3_free(azResult);
44964686
}else
4687
+
4688
+ /* Begin redirecting output to the file "testcase-out.txt" */
4689
+ if( c=='t' && strcmp(azArg[0],"testcase")==0 ){
4690
+ output_reset(p);
4691
+ p->out = output_file_open("testcase-out.txt");
4692
+ if( p->out==0 ){
4693
+ utf8_printf(stderr, "Error: cannot open 'testcase-out.txt'\n");
4694
+ }
4695
+ if( nArg>=2 ){
4696
+ sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "%s", azArg[1]);
4697
+ }else{
4698
+ sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "?");
4699
+ }
4700
+ }else
44974701
44984702
if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 && nArg>=2 ){
44994703
static const struct {
45004704
const char *zCtrlName; /* Name of a test-control option */
45014705
int ctrlCode; /* Integer code for that option */
@@ -5003,12 +5207,17 @@
50035207
50045208
/*
50055209
** Return a pathname which is the user's home directory. A
50065210
** 0 return indicates an error of some kind.
50075211
*/
5008
-static char *find_home_dir(void){
5212
+static char *find_home_dir(int clearFlag){
50095213
static char *home_dir = NULL;
5214
+ if( clearFlag ){
5215
+ free(home_dir);
5216
+ home_dir = 0;
5217
+ return 0;
5218
+ }
50105219
if( home_dir ) return home_dir;
50115220
50125221
#if !defined(_WIN32) && !defined(WIN32) && !defined(_WIN32_WCE) \
50135222
&& !defined(__RTP__) && !defined(_WRS_KERNEL)
50145223
{
@@ -5079,11 +5288,11 @@
50795288
const char *sqliterc = sqliterc_override;
50805289
char *zBuf = 0;
50815290
FILE *in = NULL;
50825291
50835292
if (sqliterc == NULL) {
5084
- home_dir = find_home_dir();
5293
+ home_dir = find_home_dir(0);
50855294
if( home_dir==0 ){
50865295
raw_printf(stderr, "-- warning: cannot find home directory;"
50875296
" cannot read ~/.sqliterc\n");
50885297
return;
50895298
}
@@ -5567,11 +5776,11 @@
55675776
printf("Connected to a ");
55685777
printBold("transient in-memory database");
55695778
printf(".\nUse \".open FILENAME\" to reopen on a "
55705779
"persistent database.\n");
55715780
}
5572
- zHome = find_home_dir();
5781
+ zHome = find_home_dir(0);
55735782
if( zHome ){
55745783
nHistory = strlen30(zHome) + 20;
55755784
if( (zHistory = malloc(nHistory))!=0 ){
55765785
sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
55775786
}
@@ -5591,11 +5800,12 @@
55915800
if( data.db ){
55925801
session_close_all(&data);
55935802
sqlite3_close(data.db);
55945803
}
55955804
sqlite3_free(data.zFreeOnClose);
5805
+ find_home_dir(1);
55965806
#if !SQLITE_SHELL_IS_UTF8
55975807
for(i=0; i<argc; i++) sqlite3_free(argv[i]);
55985808
sqlite3_free(argv);
55995809
#endif
56005810
return rc;
56015811
}
56025812
--- src/shell.c
+++ src/shell.c
@@ -141,10 +141,11 @@
141
142 /* string conversion routines only needed on Win32 */
143 extern char *sqlite3_win32_unicode_to_utf8(LPCWSTR);
144 extern char *sqlite3_win32_mbcs_to_utf8_v2(const char *, int);
145 extern char *sqlite3_win32_utf8_to_mbcs_v2(const char *, int);
 
146 #endif
147
148 /* On Windows, we normally run with output mode of TEXT so that \n characters
149 ** are automatically translated into \r\n. However, this behavior needs
150 ** to be disabled in some cases (ex: when generating CSV output and when
@@ -624,12 +625,14 @@
624 int mode; /* An output mode setting */
625 int cMode; /* temporary output mode for the current query */
626 int normalMode; /* Output mode before ".explain on" */
627 int writableSchema; /* True if PRAGMA writable_schema=ON */
628 int showHeader; /* True to show column names in List or Column mode */
 
629 unsigned shellFlgs; /* Various flags */
630 char *zDestTable; /* Name of destination table when MODE_Insert */
 
631 char colSeparator[20]; /* Column separator character for several modes */
632 char rowSeparator[20]; /* Row separator character for MODE_Ascii */
633 int colWidth[100]; /* Requested width of each column when in column mode*/
634 int actualWidth[100]; /* Actual width of each column */
635 char nullValue[20]; /* The text to print when a NULL comes back from
@@ -892,10 +895,11 @@
892 if( seenInterrupt>2 ) exit(1);
893 if( globalDb ) sqlite3_interrupt(globalDb);
894 }
895 #endif
896
 
897 /*
898 ** When the ".auth ON" is set, the following authorizer callback is
899 ** invoked. It always returns SQLITE_OK.
900 */
901 static int shellAuth(
@@ -924,11 +928,11 @@
924 const char *az[4];
925 az[0] = zA1;
926 az[1] = zA2;
927 az[2] = zA3;
928 az[3] = zA4;
929 raw_printf(p->out, "authorizer: %s", azAction[op]);
930 for(i=0; i<4; i++){
931 raw_printf(p->out, " ");
932 if( az[i] ){
933 output_c_string(p->out, az[i]);
934 }else{
@@ -936,11 +940,12 @@
936 }
937 }
938 raw_printf(p->out, "\n");
939 return SQLITE_OK;
940 }
941
 
942
943 /*
944 ** This is the callback routine that the shell
945 ** invokes for each row of a query result.
946 */
@@ -1440,11 +1445,11 @@
1440 };
1441 int i;
1442 for(i=0; i<ArraySize(aTrans); i++){
1443 int n = (int)strlen(aTrans[i].zPattern);
1444 if( strncmp(aTrans[i].zPattern, z, n)==0 ){
1445 raw_printf(out, "%-36s %s", aTrans[i].zDesc, &z[n]);
1446 break;
1447 }
1448 }
1449 }
1450 fclose(in);
@@ -2129,15 +2134,18 @@
2129
2130 /*
2131 ** Text of a help message
2132 */
2133 static char zHelp[] =
 
2134 ".auth ON|OFF Show authorizer callbacks\n"
 
2135 ".backup ?DB? FILE Backup DB (default \"main\") to FILE\n"
2136 ".bail on|off Stop after hitting an error. Default OFF\n"
2137 ".binary on|off Turn binary output on or off. Default OFF\n"
2138 ".changes on|off Show number of rows changed by SQL\n"
 
2139 ".clone NEWDB Clone data into NEWDB from the existing database\n"
2140 ".databases List names and files of attached databases\n"
2141 ".dbinfo ?DB? Show status information about the database\n"
2142 ".dump ?TABLE? ... Dump the database in an SQL text format\n"
2143 " If TABLE specified, only dump tables matching\n"
@@ -2171,11 +2179,12 @@
2171 " list Values delimited by .separator strings\n"
2172 " tabs Tab-separated values\n"
2173 " tcl TCL list elements\n"
2174 ".nullvalue STRING Use STRING in place of NULL values\n"
2175 ".once FILENAME Output for the next SQL command only to FILENAME\n"
2176 ".open ?FILENAME? Close existing database and reopen FILENAME\n"
 
2177 ".output ?FILENAME? Send output to FILENAME or stdout\n"
2178 ".print STRING... Print literal STRING\n"
2179 ".prompt MAIN CONTINUE Replace the standard prompts\n"
2180 ".quit Exit this program\n"
2181 ".read FILENAME Execute SQL in FILENAME\n"
@@ -2194,10 +2203,11 @@
2194 ".stats ?on|off? Show stats or turn stats on or off\n"
2195 ".system CMD ARGS... Run CMD ARGS... in a system shell\n"
2196 ".tables ?TABLE? List names of tables\n"
2197 " If TABLE specified, only list tables matching\n"
2198 " LIKE pattern TABLE.\n"
 
2199 ".timeout MS Try opening locked tables for MS milliseconds\n"
2200 ".timer on|off Turn SQL timer on or off\n"
2201 ".trace FILE|off Output each SQL statement as it is run\n"
2202 ".vfsinfo ?AUX? Information about the top-level VFS\n"
2203 ".vfslist List all available VFSes\n"
@@ -2230,10 +2240,39 @@
2230 #endif
2231
2232
2233 /* Forward reference */
2234 static int process_input(ShellState *p, FILE *in);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2235 /*
2236 ** Implementation of the "readfile(X)" SQL function. The entire content
2237 ** of the file named X is read and returned as a BLOB. NULL is returned
2238 ** if the file does not exist or is unreadable.
2239 */
@@ -2241,29 +2280,17 @@
2241 sqlite3_context *context,
2242 int argc,
2243 sqlite3_value **argv
2244 ){
2245 const char *zName;
2246 FILE *in;
2247 long nIn;
2248 void *pBuf;
2249
2250 UNUSED_PARAMETER(argc);
2251 zName = (const char*)sqlite3_value_text(argv[0]);
2252 if( zName==0 ) return;
2253 in = fopen(zName, "rb");
2254 if( in==0 ) return;
2255 fseek(in, 0, SEEK_END);
2256 nIn = ftell(in);
2257 rewind(in);
2258 pBuf = sqlite3_malloc64( nIn );
2259 if( pBuf && 1==fread(pBuf, nIn, 1, in) ){
2260 sqlite3_result_blob(context, pBuf, nIn, sqlite3_free);
2261 }else{
2262 sqlite3_free(pBuf);
2263 }
2264 fclose(in);
2265 }
2266
2267 /*
2268 ** Implementation of the "writefile(X,Y)" SQL function. The argument Y
2269 ** is written into file X. The number of bytes written is returned. Or
@@ -3060,10 +3087,108 @@
3060 */
3061 static int shellNomemError(void){
3062 raw_printf(stderr, "Error: out of memory\n");
3063 return 1;
3064 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3065
3066 /*
3067 ** Compare the string as a command-line option with either one or two
3068 ** initial "-" characters.
3069 */
@@ -3071,10 +3196,25 @@
3071 if( zStr[0]!='-' ) return 0;
3072 zStr++;
3073 if( zStr[0]=='-' ) zStr++;
3074 return strcmp(zStr, zOpt)==0;
3075 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3076
3077 /*
3078 ** If an input line begins with "." then invoke this routine to
3079 ** process that line.
3080 **
@@ -3115,10 +3255,11 @@
3115 */
3116 if( nArg==0 ) return 0; /* no tokens, no error */
3117 n = strlen30(azArg[0]);
3118 c = azArg[0][0];
3119
 
3120 if( c=='a' && strncmp(azArg[0], "auth", n)==0 ){
3121 if( nArg!=2 ){
3122 raw_printf(stderr, "Usage: .auth ON|OFF\n");
3123 rc = 1;
3124 goto meta_command_exit;
@@ -3128,10 +3269,11 @@
3128 sqlite3_set_authorizer(p->db, shellAuth, p);
3129 }else{
3130 sqlite3_set_authorizer(p->db, 0, 0);
3131 }
3132 }else
 
3133
3134 if( (c=='b' && n>=3 && strncmp(azArg[0], "backup", n)==0)
3135 || (c=='s' && n>=3 && strncmp(azArg[0], "save", n)==0)
3136 ){
3137 const char *zDestFile = 0;
@@ -3222,10 +3364,35 @@
3222 }else{
3223 raw_printf(stderr, "Usage: .changes on|off\n");
3224 rc = 1;
3225 }
3226 }else
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3227
3228 if( c=='c' && strncmp(azArg[0], "clone", n)==0 ){
3229 if( nArg==2 ){
3230 tryToClone(p, azArg[1]);
3231 }else{
@@ -3831,26 +3998,47 @@
3831 rc = 1;
3832 }
3833 }else
3834
3835 if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
3836 sqlite3 *savedDb = p->db;
3837 const char *zSavedFilename = p->zDbFilename;
3838 char *zNewFilename = 0;
 
 
 
3839 p->db = 0;
3840 if( nArg>=2 ) zNewFilename = sqlite3_mprintf("%s", azArg[1]);
3841 p->zDbFilename = zNewFilename;
3842 open_db(p, 1);
3843 if( p->db!=0 ){
3844 session_close_all(p);
3845 sqlite3_close(savedDb);
3846 sqlite3_free(p->zFreeOnClose);
3847 p->zFreeOnClose = zNewFilename;
3848 }else{
3849 sqlite3_free(zNewFilename);
3850 p->db = savedDb;
3851 p->zDbFilename = zSavedFilename;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3852 }
3853 }else
3854
3855 if( c=='o'
3856 && (strncmp(azArg[0], "output", n)==0 || strncmp(azArg[0], "once", n)==0)
@@ -4376,10 +4564,12 @@
4376 utf8_printf(p->out, "%12.12s: ", "width");
4377 for (i=0;i<(int)ArraySize(p->colWidth) && p->colWidth[i] != 0;i++) {
4378 raw_printf(p->out, "%d ", p->colWidth[i]);
4379 }
4380 raw_printf(p->out, "\n");
 
 
4381 }else
4382
4383 if( c=='s' && strncmp(azArg[0], "stats", n)==0 ){
4384 if( nArg==2 ){
4385 p->statsOn = booleanValue(azArg[1]);
@@ -4492,10 +4682,24 @@
4492 }
4493
4494 for(ii=0; ii<nRow; ii++) sqlite3_free(azResult[ii]);
4495 sqlite3_free(azResult);
4496 }else
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4497
4498 if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 && nArg>=2 ){
4499 static const struct {
4500 const char *zCtrlName; /* Name of a test-control option */
4501 int ctrlCode; /* Integer code for that option */
@@ -5003,12 +5207,17 @@
5003
5004 /*
5005 ** Return a pathname which is the user's home directory. A
5006 ** 0 return indicates an error of some kind.
5007 */
5008 static char *find_home_dir(void){
5009 static char *home_dir = NULL;
 
 
 
 
 
5010 if( home_dir ) return home_dir;
5011
5012 #if !defined(_WIN32) && !defined(WIN32) && !defined(_WIN32_WCE) \
5013 && !defined(__RTP__) && !defined(_WRS_KERNEL)
5014 {
@@ -5079,11 +5288,11 @@
5079 const char *sqliterc = sqliterc_override;
5080 char *zBuf = 0;
5081 FILE *in = NULL;
5082
5083 if (sqliterc == NULL) {
5084 home_dir = find_home_dir();
5085 if( home_dir==0 ){
5086 raw_printf(stderr, "-- warning: cannot find home directory;"
5087 " cannot read ~/.sqliterc\n");
5088 return;
5089 }
@@ -5567,11 +5776,11 @@
5567 printf("Connected to a ");
5568 printBold("transient in-memory database");
5569 printf(".\nUse \".open FILENAME\" to reopen on a "
5570 "persistent database.\n");
5571 }
5572 zHome = find_home_dir();
5573 if( zHome ){
5574 nHistory = strlen30(zHome) + 20;
5575 if( (zHistory = malloc(nHistory))!=0 ){
5576 sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
5577 }
@@ -5591,11 +5800,12 @@
5591 if( data.db ){
5592 session_close_all(&data);
5593 sqlite3_close(data.db);
5594 }
5595 sqlite3_free(data.zFreeOnClose);
 
5596 #if !SQLITE_SHELL_IS_UTF8
5597 for(i=0; i<argc; i++) sqlite3_free(argv[i]);
5598 sqlite3_free(argv);
5599 #endif
5600 return rc;
5601 }
5602
--- src/shell.c
+++ src/shell.c
@@ -141,10 +141,11 @@
141
142 /* string conversion routines only needed on Win32 */
143 extern char *sqlite3_win32_unicode_to_utf8(LPCWSTR);
144 extern char *sqlite3_win32_mbcs_to_utf8_v2(const char *, int);
145 extern char *sqlite3_win32_utf8_to_mbcs_v2(const char *, int);
146 extern LPWSTR sqlite3_win32_utf8_to_unicode(const char *zText);
147 #endif
148
149 /* On Windows, we normally run with output mode of TEXT so that \n characters
150 ** are automatically translated into \r\n. However, this behavior needs
151 ** to be disabled in some cases (ex: when generating CSV output and when
@@ -624,12 +625,14 @@
625 int mode; /* An output mode setting */
626 int cMode; /* temporary output mode for the current query */
627 int normalMode; /* Output mode before ".explain on" */
628 int writableSchema; /* True if PRAGMA writable_schema=ON */
629 int showHeader; /* True to show column names in List or Column mode */
630 int nCheck; /* Number of ".check" commands run */
631 unsigned shellFlgs; /* Various flags */
632 char *zDestTable; /* Name of destination table when MODE_Insert */
633 char zTestcase[30]; /* Name of current test case */
634 char colSeparator[20]; /* Column separator character for several modes */
635 char rowSeparator[20]; /* Row separator character for MODE_Ascii */
636 int colWidth[100]; /* Requested width of each column when in column mode*/
637 int actualWidth[100]; /* Actual width of each column */
638 char nullValue[20]; /* The text to print when a NULL comes back from
@@ -892,10 +895,11 @@
895 if( seenInterrupt>2 ) exit(1);
896 if( globalDb ) sqlite3_interrupt(globalDb);
897 }
898 #endif
899
900 #ifndef SQLITE_OMIT_AUTHORIZATION
901 /*
902 ** When the ".auth ON" is set, the following authorizer callback is
903 ** invoked. It always returns SQLITE_OK.
904 */
905 static int shellAuth(
@@ -924,11 +928,11 @@
928 const char *az[4];
929 az[0] = zA1;
930 az[1] = zA2;
931 az[2] = zA3;
932 az[3] = zA4;
933 utf8_printf(p->out, "authorizer: %s", azAction[op]);
934 for(i=0; i<4; i++){
935 raw_printf(p->out, " ");
936 if( az[i] ){
937 output_c_string(p->out, az[i]);
938 }else{
@@ -936,11 +940,12 @@
940 }
941 }
942 raw_printf(p->out, "\n");
943 return SQLITE_OK;
944 }
945 #endif
946
947
948 /*
949 ** This is the callback routine that the shell
950 ** invokes for each row of a query result.
951 */
@@ -1440,11 +1445,11 @@
1445 };
1446 int i;
1447 for(i=0; i<ArraySize(aTrans); i++){
1448 int n = (int)strlen(aTrans[i].zPattern);
1449 if( strncmp(aTrans[i].zPattern, z, n)==0 ){
1450 utf8_printf(out, "%-36s %s", aTrans[i].zDesc, &z[n]);
1451 break;
1452 }
1453 }
1454 }
1455 fclose(in);
@@ -2129,15 +2134,18 @@
2134
2135 /*
2136 ** Text of a help message
2137 */
2138 static char zHelp[] =
2139 #ifndef SQLITE_OMIT_AUTHORIZATION
2140 ".auth ON|OFF Show authorizer callbacks\n"
2141 #endif
2142 ".backup ?DB? FILE Backup DB (default \"main\") to FILE\n"
2143 ".bail on|off Stop after hitting an error. Default OFF\n"
2144 ".binary on|off Turn binary output on or off. Default OFF\n"
2145 ".changes on|off Show number of rows changed by SQL\n"
2146 ".check GLOB Fail if output since .testcase does not match\n"
2147 ".clone NEWDB Clone data into NEWDB from the existing database\n"
2148 ".databases List names and files of attached databases\n"
2149 ".dbinfo ?DB? Show status information about the database\n"
2150 ".dump ?TABLE? ... Dump the database in an SQL text format\n"
2151 " If TABLE specified, only dump tables matching\n"
@@ -2171,11 +2179,12 @@
2179 " list Values delimited by .separator strings\n"
2180 " tabs Tab-separated values\n"
2181 " tcl TCL list elements\n"
2182 ".nullvalue STRING Use STRING in place of NULL values\n"
2183 ".once FILENAME Output for the next SQL command only to FILENAME\n"
2184 ".open ?--new? ?FILE? Close existing database and reopen FILE\n"
2185 " The --new starts with an empty file\n"
2186 ".output ?FILENAME? Send output to FILENAME or stdout\n"
2187 ".print STRING... Print literal STRING\n"
2188 ".prompt MAIN CONTINUE Replace the standard prompts\n"
2189 ".quit Exit this program\n"
2190 ".read FILENAME Execute SQL in FILENAME\n"
@@ -2194,10 +2203,11 @@
2203 ".stats ?on|off? Show stats or turn stats on or off\n"
2204 ".system CMD ARGS... Run CMD ARGS... in a system shell\n"
2205 ".tables ?TABLE? List names of tables\n"
2206 " If TABLE specified, only list tables matching\n"
2207 " LIKE pattern TABLE.\n"
2208 ".testcase NAME Begin redirecting output to 'testcase-out.txt'\n"
2209 ".timeout MS Try opening locked tables for MS milliseconds\n"
2210 ".timer on|off Turn SQL timer on or off\n"
2211 ".trace FILE|off Output each SQL statement as it is run\n"
2212 ".vfsinfo ?AUX? Information about the top-level VFS\n"
2213 ".vfslist List all available VFSes\n"
@@ -2230,10 +2240,39 @@
2240 #endif
2241
2242
2243 /* Forward reference */
2244 static int process_input(ShellState *p, FILE *in);
2245
2246
2247 /*
2248 ** Read the content of a file into memory obtained from sqlite3_malloc64().
2249 ** The caller is responsible for freeing the memory.
2250 **
2251 ** NULL is returned if any error is encountered.
2252 */
2253 static char *readFile(const char *zName){
2254 FILE *in = fopen(zName, "rb");
2255 long nIn;
2256 size_t nRead;
2257 char *pBuf;
2258 if( in==0 ) return 0;
2259 fseek(in, 0, SEEK_END);
2260 nIn = ftell(in);
2261 rewind(in);
2262 pBuf = sqlite3_malloc64( nIn+1 );
2263 if( pBuf==0 ) return 0;
2264 nRead = fread(pBuf, nIn, 1, in);
2265 fclose(in);
2266 if( nRead!=1 ){
2267 sqlite3_free(pBuf);
2268 return 0;
2269 }
2270 pBuf[nIn] = 0;
2271 return pBuf;
2272 }
2273
2274 /*
2275 ** Implementation of the "readfile(X)" SQL function. The entire content
2276 ** of the file named X is read and returned as a BLOB. NULL is returned
2277 ** if the file does not exist or is unreadable.
2278 */
@@ -2241,29 +2280,17 @@
2280 sqlite3_context *context,
2281 int argc,
2282 sqlite3_value **argv
2283 ){
2284 const char *zName;
 
 
2285 void *pBuf;
2286
2287 UNUSED_PARAMETER(argc);
2288 zName = (const char*)sqlite3_value_text(argv[0]);
2289 if( zName==0 ) return;
2290 pBuf = readFile(zName);
2291 if( pBuf ) sqlite3_result_blob(context, pBuf, -1, sqlite3_free);
 
 
 
 
 
 
 
 
 
 
2292 }
2293
2294 /*
2295 ** Implementation of the "writefile(X,Y)" SQL function. The argument Y
2296 ** is written into file X. The number of bytes written is returned. Or
@@ -3060,10 +3087,108 @@
3087 */
3088 static int shellNomemError(void){
3089 raw_printf(stderr, "Error: out of memory\n");
3090 return 1;
3091 }
3092
3093 /*
3094 ** Compare the pattern in zGlob[] against the text in z[]. Return TRUE
3095 ** if they match and FALSE (0) if they do not match.
3096 **
3097 ** Globbing rules:
3098 **
3099 ** '*' Matches any sequence of zero or more characters.
3100 **
3101 ** '?' Matches exactly one character.
3102 **
3103 ** [...] Matches one character from the enclosed list of
3104 ** characters.
3105 **
3106 ** [^...] Matches one character not in the enclosed list.
3107 **
3108 ** '#' Matches any sequence of one or more digits with an
3109 ** optional + or - sign in front
3110 **
3111 ** ' ' Any span of whitespace matches any other span of
3112 ** whitespace.
3113 **
3114 ** Extra whitespace at the end of z[] is ignored.
3115 */
3116 static int testcase_glob(const char *zGlob, const char *z){
3117 int c, c2;
3118 int invert;
3119 int seen;
3120
3121 while( (c = (*(zGlob++)))!=0 ){
3122 if( IsSpace(c) ){
3123 if( !IsSpace(*z) ) return 0;
3124 while( IsSpace(*zGlob) ) zGlob++;
3125 while( IsSpace(*z) ) z++;
3126 }else if( c=='*' ){
3127 while( (c=(*(zGlob++))) == '*' || c=='?' ){
3128 if( c=='?' && (*(z++))==0 ) return 0;
3129 }
3130 if( c==0 ){
3131 return 1;
3132 }else if( c=='[' ){
3133 while( *z && testcase_glob(zGlob-1,z)==0 ){
3134 z++;
3135 }
3136 return (*z)!=0;
3137 }
3138 while( (c2 = (*(z++)))!=0 ){
3139 while( c2!=c ){
3140 c2 = *(z++);
3141 if( c2==0 ) return 0;
3142 }
3143 if( testcase_glob(zGlob,z) ) return 1;
3144 }
3145 return 0;
3146 }else if( c=='?' ){
3147 if( (*(z++))==0 ) return 0;
3148 }else if( c=='[' ){
3149 int prior_c = 0;
3150 seen = 0;
3151 invert = 0;
3152 c = *(z++);
3153 if( c==0 ) return 0;
3154 c2 = *(zGlob++);
3155 if( c2=='^' ){
3156 invert = 1;
3157 c2 = *(zGlob++);
3158 }
3159 if( c2==']' ){
3160 if( c==']' ) seen = 1;
3161 c2 = *(zGlob++);
3162 }
3163 while( c2 && c2!=']' ){
3164 if( c2=='-' && zGlob[0]!=']' && zGlob[0]!=0 && prior_c>0 ){
3165 c2 = *(zGlob++);
3166 if( c>=prior_c && c<=c2 ) seen = 1;
3167 prior_c = 0;
3168 }else{
3169 if( c==c2 ){
3170 seen = 1;
3171 }
3172 prior_c = c2;
3173 }
3174 c2 = *(zGlob++);
3175 }
3176 if( c2==0 || (seen ^ invert)==0 ) return 0;
3177 }else if( c=='#' ){
3178 if( (z[0]=='-' || z[0]=='+') && IsDigit(z[1]) ) z++;
3179 if( !IsDigit(z[0]) ) return 0;
3180 z++;
3181 while( IsDigit(z[0]) ){ z++; }
3182 }else{
3183 if( c!=(*(z++)) ) return 0;
3184 }
3185 }
3186 while( IsSpace(*z) ){ z++; }
3187 return *z==0;
3188 }
3189
3190
3191 /*
3192 ** Compare the string as a command-line option with either one or two
3193 ** initial "-" characters.
3194 */
@@ -3071,10 +3196,25 @@
3196 if( zStr[0]!='-' ) return 0;
3197 zStr++;
3198 if( zStr[0]=='-' ) zStr++;
3199 return strcmp(zStr, zOpt)==0;
3200 }
3201
3202 /*
3203 ** Delete a file.
3204 */
3205 int shellDeleteFile(const char *zFilename){
3206 int rc;
3207 #ifdef _WIN32
3208 wchar_t *z = sqlite3_win32_utf8_to_unicode(zFilename);
3209 rc = _wunlink(z);
3210 sqlite3_free(z);
3211 #else
3212 rc = unlink(zFilename);
3213 #endif
3214 return rc;
3215 }
3216
3217 /*
3218 ** If an input line begins with "." then invoke this routine to
3219 ** process that line.
3220 **
@@ -3115,10 +3255,11 @@
3255 */
3256 if( nArg==0 ) return 0; /* no tokens, no error */
3257 n = strlen30(azArg[0]);
3258 c = azArg[0][0];
3259
3260 #ifndef SQLITE_OMIT_AUTHORIZATION
3261 if( c=='a' && strncmp(azArg[0], "auth", n)==0 ){
3262 if( nArg!=2 ){
3263 raw_printf(stderr, "Usage: .auth ON|OFF\n");
3264 rc = 1;
3265 goto meta_command_exit;
@@ -3128,10 +3269,11 @@
3269 sqlite3_set_authorizer(p->db, shellAuth, p);
3270 }else{
3271 sqlite3_set_authorizer(p->db, 0, 0);
3272 }
3273 }else
3274 #endif
3275
3276 if( (c=='b' && n>=3 && strncmp(azArg[0], "backup", n)==0)
3277 || (c=='s' && n>=3 && strncmp(azArg[0], "save", n)==0)
3278 ){
3279 const char *zDestFile = 0;
@@ -3222,10 +3364,35 @@
3364 }else{
3365 raw_printf(stderr, "Usage: .changes on|off\n");
3366 rc = 1;
3367 }
3368 }else
3369
3370 /* Cancel output redirection, if it is currently set (by .testcase)
3371 ** Then read the content of the testcase-out.txt file and compare against
3372 ** azArg[1]. If there are differences, report an error and exit.
3373 */
3374 if( c=='c' && n>=3 && strncmp(azArg[0], "check", n)==0 ){
3375 char *zRes = 0;
3376 output_reset(p);
3377 if( nArg!=2 ){
3378 raw_printf(stderr, "Usage: .check GLOB-PATTERN\n");
3379 rc = 2;
3380 }else if( (zRes = readFile("testcase-out.txt"))==0 ){
3381 raw_printf(stderr, "Error: cannot read 'testcase-out.txt'\n");
3382 rc = 2;
3383 }else if( testcase_glob(azArg[1],zRes)==0 ){
3384 utf8_printf(stderr,
3385 "testcase-%s FAILED\n Expected: [%s]\n Got: [%s]\n",
3386 p->zTestcase, azArg[1], zRes);
3387 rc = 2;
3388 }else{
3389 utf8_printf(stdout, "testcase-%s ok\n", p->zTestcase);
3390 p->nCheck++;
3391 }
3392 sqlite3_free(zRes);
3393 }else
3394
3395 if( c=='c' && strncmp(azArg[0], "clone", n)==0 ){
3396 if( nArg==2 ){
3397 tryToClone(p, azArg[1]);
3398 }else{
@@ -3831,26 +3998,47 @@
3998 rc = 1;
3999 }
4000 }else
4001
4002 if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
4003 char *zNewFilename; /* Name of the database file to open */
4004 int iName = 1; /* Index in azArg[] of the filename */
4005 int newFlag = 0; /* True to delete file before opening */
4006 /* Close the existing database */
4007 session_close_all(p);
4008 sqlite3_close(p->db);
4009 p->db = 0;
4010 sqlite3_free(p->zFreeOnClose);
4011 p->zFreeOnClose = 0;
4012 /* Check for command-line arguments */
4013 for(iName=1; iName<nArg && azArg[iName][0]=='-'; iName++){
4014 const char *z = azArg[iName];
4015 if( optionMatch(z,"new") ){
4016 newFlag = 1;
4017 }else if( z[0]=='-' ){
4018 utf8_printf(stderr, "unknown option: %s\n", z);
4019 rc = 1;
4020 goto meta_command_exit;
4021 }
4022 }
4023 /* If a filename is specified, try to open it first */
4024 zNewFilename = nArg>iName ? sqlite3_mprintf("%s", azArg[iName]) : 0;
4025 if( zNewFilename ){
4026 if( newFlag ) shellDeleteFile(zNewFilename);
4027 p->zDbFilename = zNewFilename;
4028 open_db(p, 1);
4029 if( p->db==0 ){
4030 utf8_printf(stderr, "Error: cannot open '%s'\n", zNewFilename);
4031 sqlite3_free(zNewFilename);
4032 }else{
4033 p->zFreeOnClose = zNewFilename;
4034 }
4035 }
4036 if( p->db==0 ){
4037 /* As a fall-back open a TEMP database */
4038 p->zDbFilename = 0;
4039 open_db(p, 0);
4040 }
4041 }else
4042
4043 if( c=='o'
4044 && (strncmp(azArg[0], "output", n)==0 || strncmp(azArg[0], "once", n)==0)
@@ -4376,10 +4564,12 @@
4564 utf8_printf(p->out, "%12.12s: ", "width");
4565 for (i=0;i<(int)ArraySize(p->colWidth) && p->colWidth[i] != 0;i++) {
4566 raw_printf(p->out, "%d ", p->colWidth[i]);
4567 }
4568 raw_printf(p->out, "\n");
4569 utf8_printf(p->out, "%12.12s: %s\n", "filename",
4570 p->zDbFilename ? p->zDbFilename : "");
4571 }else
4572
4573 if( c=='s' && strncmp(azArg[0], "stats", n)==0 ){
4574 if( nArg==2 ){
4575 p->statsOn = booleanValue(azArg[1]);
@@ -4492,10 +4682,24 @@
4682 }
4683
4684 for(ii=0; ii<nRow; ii++) sqlite3_free(azResult[ii]);
4685 sqlite3_free(azResult);
4686 }else
4687
4688 /* Begin redirecting output to the file "testcase-out.txt" */
4689 if( c=='t' && strcmp(azArg[0],"testcase")==0 ){
4690 output_reset(p);
4691 p->out = output_file_open("testcase-out.txt");
4692 if( p->out==0 ){
4693 utf8_printf(stderr, "Error: cannot open 'testcase-out.txt'\n");
4694 }
4695 if( nArg>=2 ){
4696 sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "%s", azArg[1]);
4697 }else{
4698 sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "?");
4699 }
4700 }else
4701
4702 if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 && nArg>=2 ){
4703 static const struct {
4704 const char *zCtrlName; /* Name of a test-control option */
4705 int ctrlCode; /* Integer code for that option */
@@ -5003,12 +5207,17 @@
5207
5208 /*
5209 ** Return a pathname which is the user's home directory. A
5210 ** 0 return indicates an error of some kind.
5211 */
5212 static char *find_home_dir(int clearFlag){
5213 static char *home_dir = NULL;
5214 if( clearFlag ){
5215 free(home_dir);
5216 home_dir = 0;
5217 return 0;
5218 }
5219 if( home_dir ) return home_dir;
5220
5221 #if !defined(_WIN32) && !defined(WIN32) && !defined(_WIN32_WCE) \
5222 && !defined(__RTP__) && !defined(_WRS_KERNEL)
5223 {
@@ -5079,11 +5288,11 @@
5288 const char *sqliterc = sqliterc_override;
5289 char *zBuf = 0;
5290 FILE *in = NULL;
5291
5292 if (sqliterc == NULL) {
5293 home_dir = find_home_dir(0);
5294 if( home_dir==0 ){
5295 raw_printf(stderr, "-- warning: cannot find home directory;"
5296 " cannot read ~/.sqliterc\n");
5297 return;
5298 }
@@ -5567,11 +5776,11 @@
5776 printf("Connected to a ");
5777 printBold("transient in-memory database");
5778 printf(".\nUse \".open FILENAME\" to reopen on a "
5779 "persistent database.\n");
5780 }
5781 zHome = find_home_dir(0);
5782 if( zHome ){
5783 nHistory = strlen30(zHome) + 20;
5784 if( (zHistory = malloc(nHistory))!=0 ){
5785 sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
5786 }
@@ -5591,11 +5800,12 @@
5800 if( data.db ){
5801 session_close_all(&data);
5802 sqlite3_close(data.db);
5803 }
5804 sqlite3_free(data.zFreeOnClose);
5805 find_home_dir(1);
5806 #if !SQLITE_SHELL_IS_UTF8
5807 for(i=0; i<argc; i++) sqlite3_free(argv[i]);
5808 sqlite3_free(argv);
5809 #endif
5810 return rc;
5811 }
5812
+799 -804
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,17 +1,17 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.15.0. By combining all the individual C code files into this
3
+** version 3.15.0. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
99
**
1010
** This file is all you need to compile SQLite. To use SQLite in other
1111
** programs, you need this file and the "sqlite3.h" header file that defines
12
-** the programming interface to the SQLite library. (If you do not have
12
+** the programming interface to the SQLite library. (If you do not have
1313
** the "sqlite3.h" header file at hand, you will find a copy embedded within
1414
** the text of this file. Search for "Begin file sqlite3.h" to find the start
1515
** of the embedded sqlite3.h header file.) Additional code files may be needed
1616
** if you want a wrapper to interface SQLite with your choice of programming
1717
** language. The code for the "sqlite3" command-line shell is also in a
@@ -366,11 +366,12 @@
366366
** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
367367
** be larger than the release from which it is derived. Either Y will
368368
** be held constant and Z will be incremented or else Y will be incremented
369369
** and Z will be reset to zero.
370370
**
371
-** Since version 3.6.18, SQLite source code has been stored in the
371
+** Since [version 3.6.18] ([dateof:3.6.18]),
372
+** SQLite source code has been stored in the
372373
** <a href="http://www.fossil-scm.org/">Fossil configuration management
373374
** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
374375
** a string which identifies a particular check-in of SQLite
375376
** within its configuration management system. ^The SQLITE_SOURCE_ID
376377
** string contains the date and time of the check-in (UTC) and an SHA1
@@ -380,11 +381,11 @@
380381
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
381382
** [sqlite_version()] and [sqlite_source_id()].
382383
*/
383384
#define SQLITE_VERSION "3.15.0"
384385
#define SQLITE_VERSION_NUMBER 3015000
385
-#define SQLITE_SOURCE_ID "2016-09-10 19:51:40 711c59171b22df04224183a713e6c36e0bb3bba8"
386
+#define SQLITE_SOURCE_ID "2016-09-22 18:53:13 c3774c6a5fe48af91fda28e9e18c6ed9053ea992"
386387
387388
/*
388389
** CAPI3REF: Run-Time Library Version Numbers
389390
** KEYWORDS: sqlite3_version, sqlite3_sourceid
390391
**
@@ -413,13 +414,13 @@
413414
** [SQLITE_SOURCE_ID] C preprocessor macro.
414415
**
415416
** See also: [sqlite_version()] and [sqlite_source_id()].
416417
*/
417418
SQLITE_API const char sqlite3_version[] = SQLITE_VERSION;
418
-SQLITE_API const char *SQLITE_STDCALL sqlite3_libversion(void);
419
-SQLITE_API const char *SQLITE_STDCALL sqlite3_sourceid(void);
420
-SQLITE_API int SQLITE_STDCALL sqlite3_libversion_number(void);
419
+SQLITE_API const char *sqlite3_libversion(void);
420
+SQLITE_API const char *sqlite3_sourceid(void);
421
+SQLITE_API int sqlite3_libversion_number(void);
421422
422423
/*
423424
** CAPI3REF: Run-Time Library Compilation Options Diagnostics
424425
**
425426
** ^The sqlite3_compileoption_used() function returns 0 or 1
@@ -440,12 +441,12 @@
440441
**
441442
** See also: SQL functions [sqlite_compileoption_used()] and
442443
** [sqlite_compileoption_get()] and the [compile_options pragma].
443444
*/
444445
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
445
-SQLITE_API int SQLITE_STDCALL sqlite3_compileoption_used(const char *zOptName);
446
-SQLITE_API const char *SQLITE_STDCALL sqlite3_compileoption_get(int N);
446
+SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
447
+SQLITE_API const char *sqlite3_compileoption_get(int N);
447448
#endif
448449
449450
/*
450451
** CAPI3REF: Test To See If The Library Is Threadsafe
451452
**
@@ -480,11 +481,11 @@
480481
** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
481482
** is unchanged by calls to sqlite3_config().)^
482483
**
483484
** See the [threading mode] documentation for additional information.
484485
*/
485
-SQLITE_API int SQLITE_STDCALL sqlite3_threadsafe(void);
486
+SQLITE_API int sqlite3_threadsafe(void);
486487
487488
/*
488489
** CAPI3REF: Database Connection Handle
489490
** KEYWORDS: {database connection} {database connections}
490491
**
@@ -577,12 +578,12 @@
577578
** from [sqlite3_open()], [sqlite3_open16()], or
578579
** [sqlite3_open_v2()], and not previously closed.
579580
** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer
580581
** argument is a harmless no-op.
581582
*/
582
-SQLITE_API int SQLITE_STDCALL sqlite3_close(sqlite3*);
583
-SQLITE_API int SQLITE_STDCALL sqlite3_close_v2(sqlite3*);
583
+SQLITE_API int sqlite3_close(sqlite3*);
584
+SQLITE_API int sqlite3_close_v2(sqlite3*);
584585
585586
/*
586587
** The type for a callback function.
587588
** This is legacy and deprecated. It is included for historical
588589
** compatibility and is not documented.
@@ -649,11 +650,11 @@
649650
** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
650651
** <li> The application must not modify the SQL statement text passed into
651652
** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
652653
** </ul>
653654
*/
654
-SQLITE_API int SQLITE_STDCALL sqlite3_exec(
655
+SQLITE_API int sqlite3_exec(
655656
sqlite3*, /* An open database */
656657
const char *sql, /* SQL to be evaluated */
657658
int (*callback)(void*,int,char**,char**), /* Callback function */
658659
void *, /* 1st argument to callback */
659660
char **errmsg /* Error msg written here */
@@ -710,11 +711,12 @@
710711
**
711712
** In its default configuration, SQLite API routines return one of 30 integer
712713
** [result codes]. However, experience has shown that many of
713714
** these result codes are too coarse-grained. They do not provide as
714715
** much information about problems as programmers might like. In an effort to
715
-** address this, newer versions of SQLite (version 3.3.8 and later) include
716
+** address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]
717
+** and later) include
716718
** support for additional result codes that provide more detailed information
717719
** about errors. These [extended result codes] are enabled or disabled
718720
** on a per database connection basis using the
719721
** [sqlite3_extended_result_codes()] API. Or, the extended code for
720722
** the most recent error can be obtained using
@@ -1648,14 +1650,14 @@
16481650
** sqlite3_os_init() and sqlite3_os_end(). An application-supplied
16491651
** implementation of sqlite3_os_init() or sqlite3_os_end()
16501652
** must return [SQLITE_OK] on success and some other [error code] upon
16511653
** failure.
16521654
*/
1653
-SQLITE_API int SQLITE_STDCALL sqlite3_initialize(void);
1654
-SQLITE_API int SQLITE_STDCALL sqlite3_shutdown(void);
1655
-SQLITE_API int SQLITE_STDCALL sqlite3_os_init(void);
1656
-SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void);
1655
+SQLITE_API int sqlite3_initialize(void);
1656
+SQLITE_API int sqlite3_shutdown(void);
1657
+SQLITE_API int sqlite3_os_init(void);
1658
+SQLITE_API int sqlite3_os_end(void);
16571659
16581660
/*
16591661
** CAPI3REF: Configuring The SQLite Library
16601662
**
16611663
** The sqlite3_config() interface is used to make global configuration
@@ -1684,11 +1686,11 @@
16841686
**
16851687
** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
16861688
** ^If the option is unknown or SQLite is unable to set the option
16871689
** then this routine returns a non-zero [error code].
16881690
*/
1689
-SQLITE_API int SQLITE_CDECL sqlite3_config(int, ...);
1691
+SQLITE_API int sqlite3_config(int, ...);
16901692
16911693
/*
16921694
** CAPI3REF: Configure database connections
16931695
** METHOD: sqlite3
16941696
**
@@ -1703,11 +1705,11 @@
17031705
** Subsequent arguments vary depending on the configuration verb.
17041706
**
17051707
** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
17061708
** the call is considered successful.
17071709
*/
1708
-SQLITE_API int SQLITE_CDECL sqlite3_db_config(sqlite3*, int op, ...);
1710
+SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...);
17091711
17101712
/*
17111713
** CAPI3REF: Memory Allocation Routines
17121714
**
17131715
** An instance of this object defines the interface between SQLite
@@ -2254,11 +2256,11 @@
22542256
**
22552257
** ^The sqlite3_extended_result_codes() routine enables or disables the
22562258
** [extended result codes] feature of SQLite. ^The extended result
22572259
** codes are disabled by default for historical compatibility.
22582260
*/
2259
-SQLITE_API int SQLITE_STDCALL sqlite3_extended_result_codes(sqlite3*, int onoff);
2261
+SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);
22602262
22612263
/*
22622264
** CAPI3REF: Last Insert Rowid
22632265
** METHOD: sqlite3
22642266
**
@@ -2306,11 +2308,11 @@
23062308
** function is running and thus changes the last insert [rowid],
23072309
** then the value returned by [sqlite3_last_insert_rowid()] is
23082310
** unpredictable and might not equal either the old or the new
23092311
** last insert [rowid].
23102312
*/
2311
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_last_insert_rowid(sqlite3*);
2313
+SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
23122314
23132315
/*
23142316
** CAPI3REF: Count The Number Of Rows Modified
23152317
** METHOD: sqlite3
23162318
**
@@ -2359,11 +2361,11 @@
23592361
**
23602362
** If a separate thread makes changes on the same database connection
23612363
** while [sqlite3_changes()] is running then the value returned
23622364
** is unpredictable and not meaningful.
23632365
*/
2364
-SQLITE_API int SQLITE_STDCALL sqlite3_changes(sqlite3*);
2366
+SQLITE_API int sqlite3_changes(sqlite3*);
23652367
23662368
/*
23672369
** CAPI3REF: Total Number Of Rows Modified
23682370
** METHOD: sqlite3
23692371
**
@@ -2383,11 +2385,11 @@
23832385
**
23842386
** If a separate thread makes changes on the same database connection
23852387
** while [sqlite3_total_changes()] is running then the value
23862388
** returned is unpredictable and not meaningful.
23872389
*/
2388
-SQLITE_API int SQLITE_STDCALL sqlite3_total_changes(sqlite3*);
2390
+SQLITE_API int sqlite3_total_changes(sqlite3*);
23892391
23902392
/*
23912393
** CAPI3REF: Interrupt A Long-Running Query
23922394
** METHOD: sqlite3
23932395
**
@@ -2423,11 +2425,11 @@
24232425
** that are started after the sqlite3_interrupt() call returns.
24242426
**
24252427
** If the database connection closes while [sqlite3_interrupt()]
24262428
** is running then bad things will likely happen.
24272429
*/
2428
-SQLITE_API void SQLITE_STDCALL sqlite3_interrupt(sqlite3*);
2430
+SQLITE_API void sqlite3_interrupt(sqlite3*);
24292431
24302432
/*
24312433
** CAPI3REF: Determine If An SQL Statement Is Complete
24322434
**
24332435
** These routines are useful during command-line input to determine if the
@@ -2458,12 +2460,12 @@
24582460
** UTF-8 string.
24592461
**
24602462
** The input to [sqlite3_complete16()] must be a zero-terminated
24612463
** UTF-16 string in native byte order.
24622464
*/
2463
-SQLITE_API int SQLITE_STDCALL sqlite3_complete(const char *sql);
2464
-SQLITE_API int SQLITE_STDCALL sqlite3_complete16(const void *sql);
2465
+SQLITE_API int sqlite3_complete(const char *sql);
2466
+SQLITE_API int sqlite3_complete16(const void *sql);
24652467
24662468
/*
24672469
** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
24682470
** KEYWORDS: {busy-handler callback} {busy handler}
24692471
** METHOD: sqlite3
@@ -2520,11 +2522,11 @@
25202522
** result in undefined behavior.
25212523
**
25222524
** A busy handler must not close the database connection
25232525
** or [prepared statement] that invoked the busy handler.
25242526
*/
2525
-SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
2527
+SQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
25262528
25272529
/*
25282530
** CAPI3REF: Set A Busy Timeout
25292531
** METHOD: sqlite3
25302532
**
@@ -2543,11 +2545,11 @@
25432545
** was defined (using [sqlite3_busy_handler()]) prior to calling
25442546
** this routine, that other busy handler is cleared.)^
25452547
**
25462548
** See also: [PRAGMA busy_timeout]
25472549
*/
2548
-SQLITE_API int SQLITE_STDCALL sqlite3_busy_timeout(sqlite3*, int ms);
2550
+SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
25492551
25502552
/*
25512553
** CAPI3REF: Convenience Routines For Running Queries
25522554
** METHOD: sqlite3
25532555
**
@@ -2618,19 +2620,19 @@
26182620
** interface defined here. As a consequence, errors that occur in the
26192621
** wrapper layer outside of the internal [sqlite3_exec()] call are not
26202622
** reflected in subsequent calls to [sqlite3_errcode()] or
26212623
** [sqlite3_errmsg()].
26222624
*/
2623
-SQLITE_API int SQLITE_STDCALL sqlite3_get_table(
2625
+SQLITE_API int sqlite3_get_table(
26242626
sqlite3 *db, /* An open database */
26252627
const char *zSql, /* SQL to be evaluated */
26262628
char ***pazResult, /* Results of the query */
26272629
int *pnRow, /* Number of result rows written here */
26282630
int *pnColumn, /* Number of result columns written here */
26292631
char **pzErrmsg /* Error msg written here */
26302632
);
2631
-SQLITE_API void SQLITE_STDCALL sqlite3_free_table(char **result);
2633
+SQLITE_API void sqlite3_free_table(char **result);
26322634
26332635
/*
26342636
** CAPI3REF: Formatted String Printing Functions
26352637
**
26362638
** These routines are work-alikes of the "printf()" family of functions
@@ -2732,14 +2734,14 @@
27322734
**
27332735
** ^(The "%z" formatting option works like "%s" but with the
27342736
** addition that after the string has been read and copied into
27352737
** the result, [sqlite3_free()] is called on the input string.)^
27362738
*/
2737
-SQLITE_API char *SQLITE_CDECL sqlite3_mprintf(const char*,...);
2738
-SQLITE_API char *SQLITE_STDCALL sqlite3_vmprintf(const char*, va_list);
2739
-SQLITE_API char *SQLITE_CDECL sqlite3_snprintf(int,char*,const char*, ...);
2740
-SQLITE_API char *SQLITE_STDCALL sqlite3_vsnprintf(int,char*,const char*, va_list);
2739
+SQLITE_API char *sqlite3_mprintf(const char*,...);
2740
+SQLITE_API char *sqlite3_vmprintf(const char*, va_list);
2741
+SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);
2742
+SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
27412743
27422744
/*
27432745
** CAPI3REF: Memory Allocation Subsystem
27442746
**
27452747
** The SQLite core uses these three routines for all of its own
@@ -2825,16 +2827,16 @@
28252827
**
28262828
** The application must not read or write any part of
28272829
** a block of memory after it has been released using
28282830
** [sqlite3_free()] or [sqlite3_realloc()].
28292831
*/
2830
-SQLITE_API void *SQLITE_STDCALL sqlite3_malloc(int);
2831
-SQLITE_API void *SQLITE_STDCALL sqlite3_malloc64(sqlite3_uint64);
2832
-SQLITE_API void *SQLITE_STDCALL sqlite3_realloc(void*, int);
2833
-SQLITE_API void *SQLITE_STDCALL sqlite3_realloc64(void*, sqlite3_uint64);
2834
-SQLITE_API void SQLITE_STDCALL sqlite3_free(void*);
2835
-SQLITE_API sqlite3_uint64 SQLITE_STDCALL sqlite3_msize(void*);
2832
+SQLITE_API void *sqlite3_malloc(int);
2833
+SQLITE_API void *sqlite3_malloc64(sqlite3_uint64);
2834
+SQLITE_API void *sqlite3_realloc(void*, int);
2835
+SQLITE_API void *sqlite3_realloc64(void*, sqlite3_uint64);
2836
+SQLITE_API void sqlite3_free(void*);
2837
+SQLITE_API sqlite3_uint64 sqlite3_msize(void*);
28362838
28372839
/*
28382840
** CAPI3REF: Memory Allocator Statistics
28392841
**
28402842
** SQLite provides these two interfaces for reporting on the status
@@ -2855,12 +2857,12 @@
28552857
** [sqlite3_memory_used()] if and only if the parameter to
28562858
** [sqlite3_memory_highwater()] is true. ^The value returned
28572859
** by [sqlite3_memory_highwater(1)] is the high-water mark
28582860
** prior to the reset.
28592861
*/
2860
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_used(void);
2861
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_highwater(int resetFlag);
2862
+SQLITE_API sqlite3_int64 sqlite3_memory_used(void);
2863
+SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
28622864
28632865
/*
28642866
** CAPI3REF: Pseudo-Random Number Generator
28652867
**
28662868
** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
@@ -2879,11 +2881,11 @@
28792881
** ^If the previous call to this routine had an N of 1 or more and a
28802882
** non-NULL P then the pseudo-randomness is generated
28812883
** internally and without recourse to the [sqlite3_vfs] xRandomness
28822884
** method.
28832885
*/
2884
-SQLITE_API void SQLITE_STDCALL sqlite3_randomness(int N, void *P);
2886
+SQLITE_API void sqlite3_randomness(int N, void *P);
28852887
28862888
/*
28872889
** CAPI3REF: Compile-Time Authorization Callbacks
28882890
** METHOD: sqlite3
28892891
**
@@ -2962,11 +2964,11 @@
29622964
** [sqlite3_prepare()] or its variants. Authorization is not
29632965
** performed during statement evaluation in [sqlite3_step()], unless
29642966
** as stated in the previous paragraph, sqlite3_step() invokes
29652967
** sqlite3_prepare_v2() to reprepare a statement after a schema change.
29662968
*/
2967
-SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer(
2969
+SQLITE_API int sqlite3_set_authorizer(
29682970
sqlite3*,
29692971
int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
29702972
void *pUserData
29712973
);
29722974
@@ -3070,13 +3072,13 @@
30703072
** digits in the time are meaningless. Future versions of SQLite
30713073
** might provide greater resolution on the profiler callback. The
30723074
** sqlite3_profile() function is considered experimental and is
30733075
** subject to change in future versions of SQLite.
30743076
*/
3075
-SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_trace(sqlite3*,
3077
+SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*,
30763078
void(*xTrace)(void*,const char*), void*);
3077
-SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_profile(sqlite3*,
3079
+SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,
30783080
void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
30793081
30803082
/*
30813083
** CAPI3REF: SQL Trace Event Codes
30823084
** KEYWORDS: SQLITE_TRACE
@@ -3161,11 +3163,11 @@
31613163
**
31623164
** The sqlite3_trace_v2() interface is intended to replace the legacy
31633165
** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which
31643166
** are deprecated.
31653167
*/
3166
-SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2(
3168
+SQLITE_API int sqlite3_trace_v2(
31673169
sqlite3*,
31683170
unsigned uMask,
31693171
int(*xCallback)(unsigned,void*,void*,void*),
31703172
void *pCtx
31713173
);
@@ -3200,11 +3202,11 @@
32003202
** the database connection that invoked the progress handler.
32013203
** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
32023204
** database connections for the meaning of "modify" in this paragraph.
32033205
**
32043206
*/
3205
-SQLITE_API void SQLITE_STDCALL sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
3207
+SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
32063208
32073209
/*
32083210
** CAPI3REF: Opening A New Database Connection
32093211
** CONSTRUCTOR: sqlite3
32103212
**
@@ -3429,19 +3431,19 @@
34293431
** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various
34303432
** features that require the use of temporary files may fail.
34313433
**
34323434
** See also: [sqlite3_temp_directory]
34333435
*/
3434
-SQLITE_API int SQLITE_STDCALL sqlite3_open(
3436
+SQLITE_API int sqlite3_open(
34353437
const char *filename, /* Database filename (UTF-8) */
34363438
sqlite3 **ppDb /* OUT: SQLite db handle */
34373439
);
3438
-SQLITE_API int SQLITE_STDCALL sqlite3_open16(
3440
+SQLITE_API int sqlite3_open16(
34393441
const void *filename, /* Database filename (UTF-16) */
34403442
sqlite3 **ppDb /* OUT: SQLite db handle */
34413443
);
3442
-SQLITE_API int SQLITE_STDCALL sqlite3_open_v2(
3444
+SQLITE_API int sqlite3_open_v2(
34433445
const char *filename, /* Database filename (UTF-8) */
34443446
sqlite3 **ppDb, /* OUT: SQLite db handle */
34453447
int flags, /* Flags */
34463448
const char *zVfs /* Name of VFS module to use */
34473449
);
@@ -3483,13 +3485,13 @@
34833485
** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
34843486
** is not a database file pathname pointer that SQLite passed into the xOpen
34853487
** VFS method, then the behavior of this routine is undefined and probably
34863488
** undesirable.
34873489
*/
3488
-SQLITE_API const char *SQLITE_STDCALL sqlite3_uri_parameter(const char *zFilename, const char *zParam);
3489
-SQLITE_API int SQLITE_STDCALL sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
3490
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
3490
+SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
3491
+SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
3492
+SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
34913493
34923494
34933495
/*
34943496
** CAPI3REF: Error Codes And Messages
34953497
** METHOD: sqlite3
@@ -3529,15 +3531,15 @@
35293531
**
35303532
** If an interface fails with SQLITE_MISUSE, that means the interface
35313533
** was invoked incorrectly by the application. In that case, the
35323534
** error code and message may or may not be set.
35333535
*/
3534
-SQLITE_API int SQLITE_STDCALL sqlite3_errcode(sqlite3 *db);
3535
-SQLITE_API int SQLITE_STDCALL sqlite3_extended_errcode(sqlite3 *db);
3536
-SQLITE_API const char *SQLITE_STDCALL sqlite3_errmsg(sqlite3*);
3537
-SQLITE_API const void *SQLITE_STDCALL sqlite3_errmsg16(sqlite3*);
3538
-SQLITE_API const char *SQLITE_STDCALL sqlite3_errstr(int);
3536
+SQLITE_API int sqlite3_errcode(sqlite3 *db);
3537
+SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
3538
+SQLITE_API const char *sqlite3_errmsg(sqlite3*);
3539
+SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
3540
+SQLITE_API const char *sqlite3_errstr(int);
35393541
35403542
/*
35413543
** CAPI3REF: Prepared Statement Object
35423544
** KEYWORDS: {prepared statement} {prepared statements}
35433545
**
@@ -3601,11 +3603,11 @@
36013603
** created by an untrusted script can be contained using the
36023604
** [max_page_count] [PRAGMA].
36033605
**
36043606
** New run-time limit categories may be added in future releases.
36053607
*/
3606
-SQLITE_API int SQLITE_STDCALL sqlite3_limit(sqlite3*, int id, int newVal);
3608
+SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
36073609
36083610
/*
36093611
** CAPI3REF: Run-Time Limit Categories
36103612
** KEYWORDS: {limit category} {*limit categories}
36113613
**
@@ -3753,32 +3755,32 @@
37533755
** or [GLOB] operator or if the parameter is compared to an indexed column
37543756
** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
37553757
** </li>
37563758
** </ol>
37573759
*/
3758
-SQLITE_API int SQLITE_STDCALL sqlite3_prepare(
3760
+SQLITE_API int sqlite3_prepare(
37593761
sqlite3 *db, /* Database handle */
37603762
const char *zSql, /* SQL statement, UTF-8 encoded */
37613763
int nByte, /* Maximum length of zSql in bytes. */
37623764
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
37633765
const char **pzTail /* OUT: Pointer to unused portion of zSql */
37643766
);
3765
-SQLITE_API int SQLITE_STDCALL sqlite3_prepare_v2(
3767
+SQLITE_API int sqlite3_prepare_v2(
37663768
sqlite3 *db, /* Database handle */
37673769
const char *zSql, /* SQL statement, UTF-8 encoded */
37683770
int nByte, /* Maximum length of zSql in bytes. */
37693771
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
37703772
const char **pzTail /* OUT: Pointer to unused portion of zSql */
37713773
);
3772
-SQLITE_API int SQLITE_STDCALL sqlite3_prepare16(
3774
+SQLITE_API int sqlite3_prepare16(
37733775
sqlite3 *db, /* Database handle */
37743776
const void *zSql, /* SQL statement, UTF-16 encoded */
37753777
int nByte, /* Maximum length of zSql in bytes. */
37763778
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
37773779
const void **pzTail /* OUT: Pointer to unused portion of zSql */
37783780
);
3779
-SQLITE_API int SQLITE_STDCALL sqlite3_prepare16_v2(
3781
+SQLITE_API int sqlite3_prepare16_v2(
37803782
sqlite3 *db, /* Database handle */
37813783
const void *zSql, /* SQL statement, UTF-16 encoded */
37823784
int nByte, /* Maximum length of zSql in bytes. */
37833785
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
37843786
const void **pzTail /* OUT: Pointer to unused portion of zSql */
@@ -3813,12 +3815,12 @@
38133815
** automatically freed when the prepared statement is finalized.
38143816
** ^The string returned by sqlite3_expanded_sql(P), on the other hand,
38153817
** is obtained from [sqlite3_malloc()] and must be free by the application
38163818
** by passing it to [sqlite3_free()].
38173819
*/
3818
-SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt);
3819
-SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt);
3820
+SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
3821
+SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt);
38203822
38213823
/*
38223824
** CAPI3REF: Determine If An SQL Statement Writes The Database
38233825
** METHOD: sqlite3_stmt
38243826
**
@@ -3846,11 +3848,11 @@
38463848
** database. ^The [ATTACH] and [DETACH] statements also cause
38473849
** sqlite3_stmt_readonly() to return true since, while those statements
38483850
** change the configuration of a database connection, they do not make
38493851
** changes to the content of the database files on disk.
38503852
*/
3851
-SQLITE_API int SQLITE_STDCALL sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3853
+SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
38523854
38533855
/*
38543856
** CAPI3REF: Determine If A Prepared Statement Has Been Reset
38553857
** METHOD: sqlite3_stmt
38563858
**
@@ -3867,11 +3869,11 @@
38673869
** to locate all prepared statements associated with a database
38683870
** connection that are in need of being reset. This can be used,
38693871
** for example, in diagnostic routines to search for prepared
38703872
** statements that are holding a transaction open.
38713873
*/
3872
-SQLITE_API int SQLITE_STDCALL sqlite3_stmt_busy(sqlite3_stmt*);
3874
+SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
38733875
38743876
/*
38753877
** CAPI3REF: Dynamically Typed Value Object
38763878
** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
38773879
**
@@ -4031,24 +4033,24 @@
40314033
** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails.
40324034
**
40334035
** See also: [sqlite3_bind_parameter_count()],
40344036
** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
40354037
*/
4036
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
4037
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
4038
+SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
4039
+SQLITE_API int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
40384040
void(*)(void*));
4039
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_double(sqlite3_stmt*, int, double);
4040
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_int(sqlite3_stmt*, int, int);
4041
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
4042
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_null(sqlite3_stmt*, int);
4043
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
4044
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
4045
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
4041
+SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);
4042
+SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int);
4043
+SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
4044
+SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);
4045
+SQLITE_API int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
4046
+SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
4047
+SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
40464048
void(*)(void*), unsigned char encoding);
4047
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
4048
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
4049
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
4049
+SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
4050
+SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
4051
+SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
40504052
40514053
/*
40524054
** CAPI3REF: Number Of SQL Parameters
40534055
** METHOD: sqlite3_stmt
40544056
**
@@ -4065,11 +4067,11 @@
40654067
**
40664068
** See also: [sqlite3_bind_blob|sqlite3_bind()],
40674069
** [sqlite3_bind_parameter_name()], and
40684070
** [sqlite3_bind_parameter_index()].
40694071
*/
4070
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_count(sqlite3_stmt*);
4072
+SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);
40714073
40724074
/*
40734075
** CAPI3REF: Name Of A Host Parameter
40744076
** METHOD: sqlite3_stmt
40754077
**
@@ -4093,11 +4095,11 @@
40934095
**
40944096
** See also: [sqlite3_bind_blob|sqlite3_bind()],
40954097
** [sqlite3_bind_parameter_count()], and
40964098
** [sqlite3_bind_parameter_index()].
40974099
*/
4098
-SQLITE_API const char *SQLITE_STDCALL sqlite3_bind_parameter_name(sqlite3_stmt*, int);
4100
+SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
40994101
41004102
/*
41014103
** CAPI3REF: Index Of A Parameter With A Given Name
41024104
** METHOD: sqlite3_stmt
41034105
**
@@ -4110,21 +4112,21 @@
41104112
**
41114113
** See also: [sqlite3_bind_blob|sqlite3_bind()],
41124114
** [sqlite3_bind_parameter_count()], and
41134115
** [sqlite3_bind_parameter_name()].
41144116
*/
4115
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
4117
+SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
41164118
41174119
/*
41184120
** CAPI3REF: Reset All Bindings On A Prepared Statement
41194121
** METHOD: sqlite3_stmt
41204122
**
41214123
** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset
41224124
** the [sqlite3_bind_blob | bindings] on a [prepared statement].
41234125
** ^Use this routine to reset all host parameters to NULL.
41244126
*/
4125
-SQLITE_API int SQLITE_STDCALL sqlite3_clear_bindings(sqlite3_stmt*);
4127
+SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);
41264128
41274129
/*
41284130
** CAPI3REF: Number Of Columns In A Result Set
41294131
** METHOD: sqlite3_stmt
41304132
**
@@ -4132,11 +4134,11 @@
41324134
** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
41334135
** statement that does not return data (for example an [UPDATE]).
41344136
**
41354137
** See also: [sqlite3_data_count()]
41364138
*/
4137
-SQLITE_API int SQLITE_STDCALL sqlite3_column_count(sqlite3_stmt *pStmt);
4139
+SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
41384140
41394141
/*
41404142
** CAPI3REF: Column Names In A Result Set
41414143
** METHOD: sqlite3_stmt
41424144
**
@@ -4161,12 +4163,12 @@
41614163
** ^The name of a result column is the value of the "AS" clause for
41624164
** that column, if there is an AS clause. If there is no AS clause
41634165
** then the name of the column is unspecified and may change from
41644166
** one release of SQLite to the next.
41654167
*/
4166
-SQLITE_API const char *SQLITE_STDCALL sqlite3_column_name(sqlite3_stmt*, int N);
4167
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_name16(sqlite3_stmt*, int N);
4168
+SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);
4169
+SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
41684170
41694171
/*
41704172
** CAPI3REF: Source Of Data In A Query Result
41714173
** METHOD: sqlite3_stmt
41724174
**
@@ -4210,16 +4212,16 @@
42104212
** If two or more threads call one or more
42114213
** [sqlite3_column_database_name | column metadata interfaces]
42124214
** for the same [prepared statement] and result column
42134215
** at the same time then the results are undefined.
42144216
*/
4215
-SQLITE_API const char *SQLITE_STDCALL sqlite3_column_database_name(sqlite3_stmt*,int);
4216
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_database_name16(sqlite3_stmt*,int);
4217
-SQLITE_API const char *SQLITE_STDCALL sqlite3_column_table_name(sqlite3_stmt*,int);
4218
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_table_name16(sqlite3_stmt*,int);
4219
-SQLITE_API const char *SQLITE_STDCALL sqlite3_column_origin_name(sqlite3_stmt*,int);
4220
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_origin_name16(sqlite3_stmt*,int);
4217
+SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);
4218
+SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
4219
+SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int);
4220
+SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int);
4221
+SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int);
4222
+SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);
42214223
42224224
/*
42234225
** CAPI3REF: Declared Datatype Of A Query Result
42244226
** METHOD: sqlite3_stmt
42254227
**
@@ -4247,12 +4249,12 @@
42474249
** data stored in that column is of the declared type. SQLite is
42484250
** strongly typed, but the typing is dynamic not static. ^Type
42494251
** is associated with individual values, not with the containers
42504252
** used to hold those values.
42514253
*/
4252
-SQLITE_API const char *SQLITE_STDCALL sqlite3_column_decltype(sqlite3_stmt*,int);
4253
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_decltype16(sqlite3_stmt*,int);
4254
+SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int);
4255
+SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
42544256
42554257
/*
42564258
** CAPI3REF: Evaluate An SQL Statement
42574259
** METHOD: sqlite3_stmt
42584260
**
@@ -4309,11 +4311,12 @@
43094311
** For all versions of SQLite up to and including 3.6.23.1, a call to
43104312
** [sqlite3_reset()] was required after sqlite3_step() returned anything
43114313
** other than [SQLITE_ROW] before any subsequent invocation of
43124314
** sqlite3_step(). Failure to reset the prepared statement using
43134315
** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
4314
-** sqlite3_step(). But after version 3.6.23.1, sqlite3_step() began
4316
+** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
4317
+** sqlite3_step() began
43154318
** calling [sqlite3_reset()] automatically in this circumstance rather
43164319
** than returning [SQLITE_MISUSE]. This is not considered a compatibility
43174320
** break because any application that ever receives an SQLITE_MISUSE error
43184321
** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
43194322
** can be used to restore the legacy behavior.
@@ -4328,11 +4331,11 @@
43284331
** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
43294332
** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
43304333
** then the more specific [error codes] are returned directly
43314334
** by sqlite3_step(). The use of the "v2" interface is recommended.
43324335
*/
4333
-SQLITE_API int SQLITE_STDCALL sqlite3_step(sqlite3_stmt*);
4336
+SQLITE_API int sqlite3_step(sqlite3_stmt*);
43344337
43354338
/*
43364339
** CAPI3REF: Number of columns in a result set
43374340
** METHOD: sqlite3_stmt
43384341
**
@@ -4349,11 +4352,11 @@
43494352
** where it always returns zero since each step of that multi-step
43504353
** pragma returns 0 columns of data.
43514354
**
43524355
** See also: [sqlite3_column_count()]
43534356
*/
4354
-SQLITE_API int SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt);
4357
+SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
43554358
43564359
/*
43574360
** CAPI3REF: Fundamental Datatypes
43584361
** KEYWORDS: SQLITE_TEXT
43594362
**
@@ -4539,20 +4542,20 @@
45394542
** of these routines, a default value is returned. The default value
45404543
** is either the integer 0, the floating point number 0.0, or a NULL
45414544
** pointer. Subsequent calls to [sqlite3_errcode()] will return
45424545
** [SQLITE_NOMEM].)^
45434546
*/
4544
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_blob(sqlite3_stmt*, int iCol);
4545
-SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes(sqlite3_stmt*, int iCol);
4546
-SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
4547
-SQLITE_API double SQLITE_STDCALL sqlite3_column_double(sqlite3_stmt*, int iCol);
4548
-SQLITE_API int SQLITE_STDCALL sqlite3_column_int(sqlite3_stmt*, int iCol);
4549
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_column_int64(sqlite3_stmt*, int iCol);
4550
-SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_column_text(sqlite3_stmt*, int iCol);
4551
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_text16(sqlite3_stmt*, int iCol);
4552
-SQLITE_API int SQLITE_STDCALL sqlite3_column_type(sqlite3_stmt*, int iCol);
4553
-SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_column_value(sqlite3_stmt*, int iCol);
4547
+SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
4548
+SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
4549
+SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
4550
+SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
4551
+SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
4552
+SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
4553
+SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
4554
+SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
4555
+SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
4556
+SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
45544557
45554558
/*
45564559
** CAPI3REF: Destroy A Prepared Statement Object
45574560
** DESTRUCTOR: sqlite3_stmt
45584561
**
@@ -4576,11 +4579,11 @@
45764579
** resource leaks. It is a grievous error for the application to try to use
45774580
** a prepared statement after it has been finalized. Any use of a prepared
45784581
** statement after it has been finalized can result in undefined and
45794582
** undesirable behavior such as segfaults and heap corruption.
45804583
*/
4581
-SQLITE_API int SQLITE_STDCALL sqlite3_finalize(sqlite3_stmt *pStmt);
4584
+SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
45824585
45834586
/*
45844587
** CAPI3REF: Reset A Prepared Statement Object
45854588
** METHOD: sqlite3_stmt
45864589
**
@@ -4603,11 +4606,11 @@
46034606
** [sqlite3_reset(S)] returns an appropriate [error code].
46044607
**
46054608
** ^The [sqlite3_reset(S)] interface does not change the values
46064609
** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
46074610
*/
4608
-SQLITE_API int SQLITE_STDCALL sqlite3_reset(sqlite3_stmt *pStmt);
4611
+SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
46094612
46104613
/*
46114614
** CAPI3REF: Create Or Redefine SQL Functions
46124615
** KEYWORDS: {function creation routines}
46134616
** KEYWORDS: {application-defined SQL function}
@@ -4703,31 +4706,31 @@
47034706
** ^An application-defined function is permitted to call other
47044707
** SQLite interfaces. However, such calls must not
47054708
** close the database connection nor finalize or reset the prepared
47064709
** statement in which the function is running.
47074710
*/
4708
-SQLITE_API int SQLITE_STDCALL sqlite3_create_function(
4711
+SQLITE_API int sqlite3_create_function(
47094712
sqlite3 *db,
47104713
const char *zFunctionName,
47114714
int nArg,
47124715
int eTextRep,
47134716
void *pApp,
47144717
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
47154718
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
47164719
void (*xFinal)(sqlite3_context*)
47174720
);
4718
-SQLITE_API int SQLITE_STDCALL sqlite3_create_function16(
4721
+SQLITE_API int sqlite3_create_function16(
47194722
sqlite3 *db,
47204723
const void *zFunctionName,
47214724
int nArg,
47224725
int eTextRep,
47234726
void *pApp,
47244727
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
47254728
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
47264729
void (*xFinal)(sqlite3_context*)
47274730
);
4728
-SQLITE_API int SQLITE_STDCALL sqlite3_create_function_v2(
4731
+SQLITE_API int sqlite3_create_function_v2(
47294732
sqlite3 *db,
47304733
const char *zFunctionName,
47314734
int nArg,
47324735
int eTextRep,
47334736
void *pApp,
@@ -4769,16 +4772,16 @@
47694772
** to be supported. However, new applications should avoid
47704773
** the use of these functions. To encourage programmers to avoid
47714774
** these functions, we will not explain what they do.
47724775
*/
47734776
#ifndef SQLITE_OMIT_DEPRECATED
4774
-SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_aggregate_count(sqlite3_context*);
4775
-SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_expired(sqlite3_stmt*);
4776
-SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
4777
-SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_global_recover(void);
4778
-SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_thread_cleanup(void);
4779
-SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
4777
+SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);
4778
+SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);
4779
+SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
4780
+SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);
4781
+SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
4782
+SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
47804783
void*,sqlite3_int64);
47814784
#endif
47824785
47834786
/*
47844787
** CAPI3REF: Obtaining SQL Values
@@ -4824,22 +4827,22 @@
48244827
** or [sqlite3_value_text16()].
48254828
**
48264829
** These routines must be called from the same thread as
48274830
** the SQL function that supplied the [sqlite3_value*] parameters.
48284831
*/
4829
-SQLITE_API const void *SQLITE_STDCALL sqlite3_value_blob(sqlite3_value*);
4830
-SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes(sqlite3_value*);
4831
-SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes16(sqlite3_value*);
4832
-SQLITE_API double SQLITE_STDCALL sqlite3_value_double(sqlite3_value*);
4833
-SQLITE_API int SQLITE_STDCALL sqlite3_value_int(sqlite3_value*);
4834
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_value_int64(sqlite3_value*);
4835
-SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_value_text(sqlite3_value*);
4836
-SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16(sqlite3_value*);
4837
-SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16le(sqlite3_value*);
4838
-SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16be(sqlite3_value*);
4839
-SQLITE_API int SQLITE_STDCALL sqlite3_value_type(sqlite3_value*);
4840
-SQLITE_API int SQLITE_STDCALL sqlite3_value_numeric_type(sqlite3_value*);
4832
+SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
4833
+SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
4834
+SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
4835
+SQLITE_API double sqlite3_value_double(sqlite3_value*);
4836
+SQLITE_API int sqlite3_value_int(sqlite3_value*);
4837
+SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
4838
+SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
4839
+SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
4840
+SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
4841
+SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
4842
+SQLITE_API int sqlite3_value_type(sqlite3_value*);
4843
+SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
48414844
48424845
/*
48434846
** CAPI3REF: Finding The Subtype Of SQL Values
48444847
** METHOD: sqlite3_value
48454848
**
@@ -4851,11 +4854,11 @@
48514854
**
48524855
** SQLite makes no use of subtype itself. It merely passes the subtype
48534856
** from the result of one [application-defined SQL function] into the
48544857
** input of another.
48554858
*/
4856
-SQLITE_API unsigned int SQLITE_STDCALL sqlite3_value_subtype(sqlite3_value*);
4859
+SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
48574860
48584861
/*
48594862
** CAPI3REF: Copy And Free SQL Values
48604863
** METHOD: sqlite3_value
48614864
**
@@ -4867,12 +4870,12 @@
48674870
**
48684871
** ^The sqlite3_value_free(V) interface frees an [sqlite3_value] object
48694872
** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
48704873
** then sqlite3_value_free(V) is a harmless no-op.
48714874
*/
4872
-SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_value_dup(const sqlite3_value*);
4873
-SQLITE_API void SQLITE_STDCALL sqlite3_value_free(sqlite3_value*);
4875
+SQLITE_API sqlite3_value *sqlite3_value_dup(const sqlite3_value*);
4876
+SQLITE_API void sqlite3_value_free(sqlite3_value*);
48744877
48754878
/*
48764879
** CAPI3REF: Obtain Aggregate Function Context
48774880
** METHOD: sqlite3_context
48784881
**
@@ -4913,11 +4916,11 @@
49134916
** function.
49144917
**
49154918
** This routine must be called from the same thread in which
49164919
** the aggregate SQL function is running.
49174920
*/
4918
-SQLITE_API void *SQLITE_STDCALL sqlite3_aggregate_context(sqlite3_context*, int nBytes);
4921
+SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
49194922
49204923
/*
49214924
** CAPI3REF: User Data For Functions
49224925
** METHOD: sqlite3_context
49234926
**
@@ -4928,11 +4931,11 @@
49284931
** registered the application defined function.
49294932
**
49304933
** This routine must be called from the same thread in which
49314934
** the application-defined function is running.
49324935
*/
4933
-SQLITE_API void *SQLITE_STDCALL sqlite3_user_data(sqlite3_context*);
4936
+SQLITE_API void *sqlite3_user_data(sqlite3_context*);
49344937
49354938
/*
49364939
** CAPI3REF: Database Connection For Functions
49374940
** METHOD: sqlite3_context
49384941
**
@@ -4940,11 +4943,11 @@
49404943
** the pointer to the [database connection] (the 1st parameter)
49414944
** of the [sqlite3_create_function()]
49424945
** and [sqlite3_create_function16()] routines that originally
49434946
** registered the application defined function.
49444947
*/
4945
-SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_context*);
4948
+SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
49464949
49474950
/*
49484951
** CAPI3REF: Function Auxiliary Data
49494952
** METHOD: sqlite3_context
49504953
**
@@ -4994,12 +4997,12 @@
49944997
** values and [parameters] and expressions composed from the same.)^
49954998
**
49964999
** These routines must be called from the same thread in which
49975000
** the SQL function is running.
49985001
*/
4999
-SQLITE_API void *SQLITE_STDCALL sqlite3_get_auxdata(sqlite3_context*, int N);
5000
-SQLITE_API void SQLITE_STDCALL sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
5002
+SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);
5003
+SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
50015004
50025005
50035006
/*
50045007
** CAPI3REF: Constants Defining Special Destructor Behavior
50055008
**
@@ -5131,31 +5134,31 @@
51315134
**
51325135
** If these routines are called from within the different thread
51335136
** than the one containing the application-defined function that received
51345137
** the [sqlite3_context] pointer, the results are undefined.
51355138
*/
5136
-SQLITE_API void SQLITE_STDCALL sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
5137
-SQLITE_API void SQLITE_STDCALL sqlite3_result_blob64(sqlite3_context*,const void*,
5139
+SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
5140
+SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,
51385141
sqlite3_uint64,void(*)(void*));
5139
-SQLITE_API void SQLITE_STDCALL sqlite3_result_double(sqlite3_context*, double);
5140
-SQLITE_API void SQLITE_STDCALL sqlite3_result_error(sqlite3_context*, const char*, int);
5141
-SQLITE_API void SQLITE_STDCALL sqlite3_result_error16(sqlite3_context*, const void*, int);
5142
-SQLITE_API void SQLITE_STDCALL sqlite3_result_error_toobig(sqlite3_context*);
5143
-SQLITE_API void SQLITE_STDCALL sqlite3_result_error_nomem(sqlite3_context*);
5144
-SQLITE_API void SQLITE_STDCALL sqlite3_result_error_code(sqlite3_context*, int);
5145
-SQLITE_API void SQLITE_STDCALL sqlite3_result_int(sqlite3_context*, int);
5146
-SQLITE_API void SQLITE_STDCALL sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
5147
-SQLITE_API void SQLITE_STDCALL sqlite3_result_null(sqlite3_context*);
5148
-SQLITE_API void SQLITE_STDCALL sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
5149
-SQLITE_API void SQLITE_STDCALL sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
5142
+SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
5143
+SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
5144
+SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
5145
+SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
5146
+SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
5147
+SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int);
5148
+SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
5149
+SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
5150
+SQLITE_API void sqlite3_result_null(sqlite3_context*);
5151
+SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
5152
+SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
51505153
void(*)(void*), unsigned char encoding);
5151
-SQLITE_API void SQLITE_STDCALL sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
5152
-SQLITE_API void SQLITE_STDCALL sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
5153
-SQLITE_API void SQLITE_STDCALL sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
5154
-SQLITE_API void SQLITE_STDCALL sqlite3_result_value(sqlite3_context*, sqlite3_value*);
5155
-SQLITE_API void SQLITE_STDCALL sqlite3_result_zeroblob(sqlite3_context*, int n);
5156
-SQLITE_API int SQLITE_STDCALL sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
5154
+SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
5155
+SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
5156
+SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
5157
+SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
5158
+SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
5159
+SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
51575160
51585161
51595162
/*
51605163
** CAPI3REF: Setting The Subtype Of An SQL Function
51615164
** METHOD: sqlite3_context
@@ -5166,11 +5169,11 @@
51665169
** of the subtype T are preserved in current versions of SQLite;
51675170
** higher order bits are discarded.
51685171
** The number of subtype bytes preserved by SQLite might increase
51695172
** in future releases of SQLite.
51705173
*/
5171
-SQLITE_API void SQLITE_STDCALL sqlite3_result_subtype(sqlite3_context*,unsigned int);
5174
+SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int);
51725175
51735176
/*
51745177
** CAPI3REF: Define New Collating Sequences
51755178
** METHOD: sqlite3
51765179
**
@@ -5248,26 +5251,26 @@
52485251
** is unfortunate but cannot be changed without breaking backwards
52495252
** compatibility.
52505253
**
52515254
** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
52525255
*/
5253
-SQLITE_API int SQLITE_STDCALL sqlite3_create_collation(
5256
+SQLITE_API int sqlite3_create_collation(
52545257
sqlite3*,
52555258
const char *zName,
52565259
int eTextRep,
52575260
void *pArg,
52585261
int(*xCompare)(void*,int,const void*,int,const void*)
52595262
);
5260
-SQLITE_API int SQLITE_STDCALL sqlite3_create_collation_v2(
5263
+SQLITE_API int sqlite3_create_collation_v2(
52615264
sqlite3*,
52625265
const char *zName,
52635266
int eTextRep,
52645267
void *pArg,
52655268
int(*xCompare)(void*,int,const void*,int,const void*),
52665269
void(*xDestroy)(void*)
52675270
);
5268
-SQLITE_API int SQLITE_STDCALL sqlite3_create_collation16(
5271
+SQLITE_API int sqlite3_create_collation16(
52695272
sqlite3*,
52705273
const void *zName,
52715274
int eTextRep,
52725275
void *pArg,
52735276
int(*xCompare)(void*,int,const void*,int,const void*)
@@ -5298,16 +5301,16 @@
52985301
**
52995302
** The callback function should register the desired collation using
53005303
** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
53015304
** [sqlite3_create_collation_v2()].
53025305
*/
5303
-SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed(
5306
+SQLITE_API int sqlite3_collation_needed(
53045307
sqlite3*,
53055308
void*,
53065309
void(*)(void*,sqlite3*,int eTextRep,const char*)
53075310
);
5308
-SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed16(
5311
+SQLITE_API int sqlite3_collation_needed16(
53095312
sqlite3*,
53105313
void*,
53115314
void(*)(void*,sqlite3*,int eTextRep,const void*)
53125315
);
53135316
@@ -5317,15 +5320,15 @@
53175320
** called right after sqlite3_open().
53185321
**
53195322
** The code to implement this API is not available in the public release
53205323
** of SQLite.
53215324
*/
5322
-SQLITE_API int SQLITE_STDCALL sqlite3_key(
5325
+SQLITE_API int sqlite3_key(
53235326
sqlite3 *db, /* Database to be rekeyed */
53245327
const void *pKey, int nKey /* The key */
53255328
);
5326
-SQLITE_API int SQLITE_STDCALL sqlite3_key_v2(
5329
+SQLITE_API int sqlite3_key_v2(
53275330
sqlite3 *db, /* Database to be rekeyed */
53285331
const char *zDbName, /* Name of the database */
53295332
const void *pKey, int nKey /* The key */
53305333
);
53315334
@@ -5335,35 +5338,35 @@
53355338
** database is decrypted.
53365339
**
53375340
** The code to implement this API is not available in the public release
53385341
** of SQLite.
53395342
*/
5340
-SQLITE_API int SQLITE_STDCALL sqlite3_rekey(
5343
+SQLITE_API int sqlite3_rekey(
53415344
sqlite3 *db, /* Database to be rekeyed */
53425345
const void *pKey, int nKey /* The new key */
53435346
);
5344
-SQLITE_API int SQLITE_STDCALL sqlite3_rekey_v2(
5347
+SQLITE_API int sqlite3_rekey_v2(
53455348
sqlite3 *db, /* Database to be rekeyed */
53465349
const char *zDbName, /* Name of the database */
53475350
const void *pKey, int nKey /* The new key */
53485351
);
53495352
53505353
/*
53515354
** Specify the activation key for a SEE database. Unless
53525355
** activated, none of the SEE routines will work.
53535356
*/
5354
-SQLITE_API void SQLITE_STDCALL sqlite3_activate_see(
5357
+SQLITE_API void sqlite3_activate_see(
53555358
const char *zPassPhrase /* Activation phrase */
53565359
);
53575360
#endif
53585361
53595362
#ifdef SQLITE_ENABLE_CEROD
53605363
/*
53615364
** Specify the activation key for a CEROD database. Unless
53625365
** activated, none of the CEROD routines will work.
53635366
*/
5364
-SQLITE_API void SQLITE_STDCALL sqlite3_activate_cerod(
5367
+SQLITE_API void sqlite3_activate_cerod(
53655368
const char *zPassPhrase /* Activation phrase */
53665369
);
53675370
#endif
53685371
53695372
/*
@@ -5381,11 +5384,11 @@
53815384
** method of the default [sqlite3_vfs] object. If the xSleep() method
53825385
** of the default VFS is not implemented correctly, or not implemented at
53835386
** all, then the behavior of sqlite3_sleep() may deviate from the description
53845387
** in the previous paragraphs.
53855388
*/
5386
-SQLITE_API int SQLITE_STDCALL sqlite3_sleep(int);
5389
+SQLITE_API int sqlite3_sleep(int);
53875390
53885391
/*
53895392
** CAPI3REF: Name Of The Folder Holding Temporary Files
53905393
**
53915394
** ^(If this global variable is made to point to a string which is
@@ -5500,11 +5503,11 @@
55005503
**
55015504
** If another thread changes the autocommit status of the database
55025505
** connection while this routine is running, then the return value
55035506
** is undefined.
55045507
*/
5505
-SQLITE_API int SQLITE_STDCALL sqlite3_get_autocommit(sqlite3*);
5508
+SQLITE_API int sqlite3_get_autocommit(sqlite3*);
55065509
55075510
/*
55085511
** CAPI3REF: Find The Database Handle Of A Prepared Statement
55095512
** METHOD: sqlite3_stmt
55105513
**
@@ -5513,11 +5516,11 @@
55135516
** returned by sqlite3_db_handle is the same [database connection]
55145517
** that was the first argument
55155518
** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
55165519
** create the statement in the first place.
55175520
*/
5518
-SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_db_handle(sqlite3_stmt*);
5521
+SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
55195522
55205523
/*
55215524
** CAPI3REF: Return The Filename For A Database Connection
55225525
** METHOD: sqlite3
55235526
**
@@ -5530,21 +5533,21 @@
55305533
** ^The filename returned by this function is the output of the
55315534
** xFullPathname method of the [VFS]. ^In other words, the filename
55325535
** will be an absolute pathname, even if the filename used
55335536
** to open the database originally was a URI or relative pathname.
55345537
*/
5535
-SQLITE_API const char *SQLITE_STDCALL sqlite3_db_filename(sqlite3 *db, const char *zDbName);
5538
+SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);
55365539
55375540
/*
55385541
** CAPI3REF: Determine if a database is read-only
55395542
** METHOD: sqlite3
55405543
**
55415544
** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N
55425545
** of connection D is read-only, 0 if it is read/write, or -1 if N is not
55435546
** the name of a database on connection D.
55445547
*/
5545
-SQLITE_API int SQLITE_STDCALL sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
5548
+SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
55465549
55475550
/*
55485551
** CAPI3REF: Find the next prepared statement
55495552
** METHOD: sqlite3
55505553
**
@@ -5556,11 +5559,11 @@
55565559
**
55575560
** The [database connection] pointer D in a call to
55585561
** [sqlite3_next_stmt(D,S)] must refer to an open database
55595562
** connection and in particular must not be a NULL pointer.
55605563
*/
5561
-SQLITE_API sqlite3_stmt *SQLITE_STDCALL sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
5564
+SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
55625565
55635566
/*
55645567
** CAPI3REF: Commit And Rollback Notification Callbacks
55655568
** METHOD: sqlite3
55665569
**
@@ -5605,12 +5608,12 @@
56055608
** ^The rollback callback is not invoked if a transaction is
56065609
** automatically rolled back because the database connection is closed.
56075610
**
56085611
** See also the [sqlite3_update_hook()] interface.
56095612
*/
5610
-SQLITE_API void *SQLITE_STDCALL sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
5611
-SQLITE_API void *SQLITE_STDCALL sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
5613
+SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
5614
+SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
56125615
56135616
/*
56145617
** CAPI3REF: Data Change Notification Callbacks
56155618
** METHOD: sqlite3
56165619
**
@@ -5657,11 +5660,11 @@
56575660
** the first call on D.
56585661
**
56595662
** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()],
56605663
** and [sqlite3_preupdate_hook()] interfaces.
56615664
*/
5662
-SQLITE_API void *SQLITE_STDCALL sqlite3_update_hook(
5665
+SQLITE_API void *sqlite3_update_hook(
56635666
sqlite3*,
56645667
void(*)(void *,int ,char const *,char const *,sqlite3_int64),
56655668
void*
56665669
);
56675670
@@ -5672,11 +5675,12 @@
56725675
** and schema data structures between [database connection | connections]
56735676
** to the same database. Sharing is enabled if the argument is true
56745677
** and disabled if the argument is false.)^
56755678
**
56765679
** ^Cache sharing is enabled and disabled for an entire process.
5677
-** This is a change as of SQLite version 3.5.0. In prior versions of SQLite,
5680
+** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]).
5681
+** In prior versions of SQLite,
56785682
** sharing was enabled or disabled for each thread separately.
56795683
**
56805684
** ^(The cache sharing mode set by this interface effects all subsequent
56815685
** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
56825686
** Existing database connections continue use the sharing mode
@@ -5697,11 +5701,11 @@
56975701
** This interface is threadsafe on processors where writing a
56985702
** 32-bit integer is atomic.
56995703
**
57005704
** See Also: [SQLite Shared-Cache Mode]
57015705
*/
5702
-SQLITE_API int SQLITE_STDCALL sqlite3_enable_shared_cache(int);
5706
+SQLITE_API int sqlite3_enable_shared_cache(int);
57035707
57045708
/*
57055709
** CAPI3REF: Attempt To Free Heap Memory
57065710
**
57075711
** ^The sqlite3_release_memory() interface attempts to free N bytes
@@ -5713,11 +5717,11 @@
57135717
** ^The sqlite3_release_memory() routine is a no-op returning zero
57145718
** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT].
57155719
**
57165720
** See also: [sqlite3_db_release_memory()]
57175721
*/
5718
-SQLITE_API int SQLITE_STDCALL sqlite3_release_memory(int);
5722
+SQLITE_API int sqlite3_release_memory(int);
57195723
57205724
/*
57215725
** CAPI3REF: Free Memory Used By A Database Connection
57225726
** METHOD: sqlite3
57235727
**
@@ -5727,11 +5731,11 @@
57275731
** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is
57285732
** omitted.
57295733
**
57305734
** See also: [sqlite3_release_memory()]
57315735
*/
5732
-SQLITE_API int SQLITE_STDCALL sqlite3_db_release_memory(sqlite3*);
5736
+SQLITE_API int sqlite3_db_release_memory(sqlite3*);
57335737
57345738
/*
57355739
** CAPI3REF: Impose A Limit On Heap Size
57365740
**
57375741
** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
@@ -5766,11 +5770,12 @@
57665770
** <li> The page cache allocates from its own memory pool supplied
57675771
** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
57685772
** from the heap.
57695773
** </ul>)^
57705774
**
5771
-** Beginning with SQLite version 3.7.3, the soft heap limit is enforced
5775
+** Beginning with SQLite [version 3.7.3] ([dateof:3.7.3]),
5776
+** the soft heap limit is enforced
57725777
** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT]
57735778
** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT],
57745779
** the soft heap limit is enforced on every memory allocation. Without
57755780
** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced
57765781
** when memory is allocated by the page cache. Testing suggests that because
@@ -5779,11 +5784,11 @@
57795784
** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT].
57805785
**
57815786
** The circumstances under which SQLite will enforce the soft heap limit may
57825787
** changes in future releases of SQLite.
57835788
*/
5784
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_soft_heap_limit64(sqlite3_int64 N);
5789
+SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
57855790
57865791
/*
57875792
** CAPI3REF: Deprecated Soft Heap Limit Interface
57885793
** DEPRECATED
57895794
**
@@ -5790,11 +5795,11 @@
57905795
** This is a deprecated version of the [sqlite3_soft_heap_limit64()]
57915796
** interface. This routine is provided for historical compatibility
57925797
** only. All new applications should use the
57935798
** [sqlite3_soft_heap_limit64()] interface rather than this one.
57945799
*/
5795
-SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_soft_heap_limit(int N);
5800
+SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
57965801
57975802
57985803
/*
57995804
** CAPI3REF: Extract Metadata About A Column Of A Table
58005805
** METHOD: sqlite3
@@ -5860,11 +5865,11 @@
58605865
**
58615866
** ^This function causes all database schemas to be read from disk and
58625867
** parsed, if that has not already been done, and returns an error if
58635868
** any errors are encountered while loading the schema.
58645869
*/
5865
-SQLITE_API int SQLITE_STDCALL sqlite3_table_column_metadata(
5870
+SQLITE_API int sqlite3_table_column_metadata(
58665871
sqlite3 *db, /* Connection handle */
58675872
const char *zDbName, /* Database name or NULL */
58685873
const char *zTableName, /* Table name */
58695874
const char *zColumnName, /* Column name */
58705875
char const **pzDataType, /* OUTPUT: Declared data type */
@@ -5916,11 +5921,11 @@
59165921
** disabled and prevent SQL injections from giving attackers
59175922
** access to extension loading capabilities.
59185923
**
59195924
** See also the [load_extension() SQL function].
59205925
*/
5921
-SQLITE_API int SQLITE_STDCALL sqlite3_load_extension(
5926
+SQLITE_API int sqlite3_load_extension(
59225927
sqlite3 *db, /* Load the extension into this database connection */
59235928
const char *zFile, /* Name of the shared library containing extension */
59245929
const char *zProc, /* Entry point. Derived from zFile if 0 */
59255930
char **pzErrMsg /* Put error message here if not 0 */
59265931
);
@@ -5948,11 +5953,11 @@
59485953
** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method
59495954
** rather than this interface, so the [load_extension()] SQL function
59505955
** remains disabled. This will prevent SQL injections from giving attackers
59515956
** access to extension loading capabilities.
59525957
*/
5953
-SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int onoff);
5958
+SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
59545959
59555960
/*
59565961
** CAPI3REF: Automatically Load Statically Linked Extensions
59575962
**
59585963
** ^This interface causes the xEntryPoint() function to be invoked for
@@ -5986,11 +5991,11 @@
59865991
** will be called more than once for each database connection that is opened.
59875992
**
59885993
** See also: [sqlite3_reset_auto_extension()]
59895994
** and [sqlite3_cancel_auto_extension()]
59905995
*/
5991
-SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void(*xEntryPoint)(void));
5996
+SQLITE_API int sqlite3_auto_extension(void(*xEntryPoint)(void));
59925997
59935998
/*
59945999
** CAPI3REF: Cancel Automatic Extension Loading
59956000
**
59966001
** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
@@ -5998,19 +6003,19 @@
59986003
** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)]
59996004
** routine returns 1 if initialization routine X was successfully
60006005
** unregistered and it returns 0 if X was not on the list of initialization
60016006
** routines.
60026007
*/
6003
-SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
6008
+SQLITE_API int sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
60046009
60056010
/*
60066011
** CAPI3REF: Reset Automatic Extension Loading
60076012
**
60086013
** ^This interface disables all automatic extensions previously
60096014
** registered using [sqlite3_auto_extension()].
60106015
*/
6011
-SQLITE_API void SQLITE_STDCALL sqlite3_reset_auto_extension(void);
6016
+SQLITE_API void sqlite3_reset_auto_extension(void);
60126017
60136018
/*
60146019
** The interface to the virtual-table mechanism is currently considered
60156020
** to be experimental. The interface might change in incompatible ways.
60166021
** If this is a problem for you, do not use the interface at this time.
@@ -6160,17 +6165,19 @@
61606165
** before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
61616166
** set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
61626167
** the xUpdate method are automatically rolled back by SQLite.
61636168
**
61646169
** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
6165
-** structure for SQLite version 3.8.2. If a virtual table extension is
6170
+** structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
6171
+** If a virtual table extension is
61666172
** used with an SQLite version earlier than 3.8.2, the results of attempting
61676173
** to read or write the estimatedRows field are undefined (but are likely
61686174
** to included crashing the application). The estimatedRows field should
61696175
** therefore only be used if [sqlite3_libversion_number()] returns a
61706176
** value greater than or equal to 3008002. Similarly, the idxFlags field
6171
-** was added for version 3.9.0. It may therefore only be used if
6177
+** was added for [version 3.9.0] ([dateof:3.9.0]).
6178
+** It may therefore only be used if
61726179
** sqlite3_libversion_number() returns a value greater than or equal to
61736180
** 3009000.
61746181
*/
61756182
struct sqlite3_index_info {
61766183
/* Inputs */
@@ -6251,17 +6258,17 @@
62516258
** be invoked if the call to sqlite3_create_module_v2() fails.
62526259
** ^The sqlite3_create_module()
62536260
** interface is equivalent to sqlite3_create_module_v2() with a NULL
62546261
** destructor.
62556262
*/
6256
-SQLITE_API int SQLITE_STDCALL sqlite3_create_module(
6263
+SQLITE_API int sqlite3_create_module(
62576264
sqlite3 *db, /* SQLite connection to register module with */
62586265
const char *zName, /* Name of the module */
62596266
const sqlite3_module *p, /* Methods for the module */
62606267
void *pClientData /* Client data for xCreate/xConnect */
62616268
);
6262
-SQLITE_API int SQLITE_STDCALL sqlite3_create_module_v2(
6269
+SQLITE_API int sqlite3_create_module_v2(
62636270
sqlite3 *db, /* SQLite connection to register module with */
62646271
const char *zName, /* Name of the module */
62656272
const sqlite3_module *p, /* Methods for the module */
62666273
void *pClientData, /* Client data for xCreate/xConnect */
62676274
void(*xDestroy)(void*) /* Module destructor function */
@@ -6320,11 +6327,11 @@
63206327
** ^The [xCreate] and [xConnect] methods of a
63216328
** [virtual table module] call this interface
63226329
** to declare the format (the names and datatypes of the columns) of
63236330
** the virtual tables they implement.
63246331
*/
6325
-SQLITE_API int SQLITE_STDCALL sqlite3_declare_vtab(sqlite3*, const char *zSQL);
6332
+SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
63266333
63276334
/*
63286335
** CAPI3REF: Overload A Function For A Virtual Table
63296336
** METHOD: sqlite3
63306337
**
@@ -6339,11 +6346,11 @@
63396346
** of the new function always causes an exception to be thrown. So
63406347
** the new function is not good for anything by itself. Its only
63416348
** purpose is to be a placeholder function that can be overloaded
63426349
** by a [virtual table].
63436350
*/
6344
-SQLITE_API int SQLITE_STDCALL sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
6351
+SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
63456352
63466353
/*
63476354
** The interface to the virtual-table mechanism defined above (back up
63486355
** to a comment remarkably similar to this one) is currently considered
63496356
** to be experimental. The interface might change in incompatible ways.
@@ -6438,11 +6445,11 @@
64386445
** zero-filled blob to read or write using the incremental-blob interface.
64396446
**
64406447
** To avoid a resource leak, every open [BLOB handle] should eventually
64416448
** be released by a call to [sqlite3_blob_close()].
64426449
*/
6443
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_open(
6450
+SQLITE_API int sqlite3_blob_open(
64446451
sqlite3*,
64456452
const char *zDb,
64466453
const char *zTable,
64476454
const char *zColumn,
64486455
sqlite3_int64 iRow,
@@ -6471,11 +6478,11 @@
64716478
** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle
64726479
** always returns zero.
64736480
**
64746481
** ^This function sets the database handle error code and message.
64756482
*/
6476
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
6483
+SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
64776484
64786485
/*
64796486
** CAPI3REF: Close A BLOB Handle
64806487
** DESTRUCTOR: sqlite3_blob
64816488
**
@@ -6494,11 +6501,11 @@
64946501
** with a null pointer (such as would be returned by a failed call to
64956502
** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
64966503
** is passed a valid open blob handle, the values returned by the
64976504
** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
64986505
*/
6499
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_close(sqlite3_blob *);
6506
+SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
65006507
65016508
/*
65026509
** CAPI3REF: Return The Size Of An Open BLOB
65036510
** METHOD: sqlite3_blob
65046511
**
@@ -6510,11 +6517,11 @@
65106517
** This routine only works on a [BLOB handle] which has been created
65116518
** by a prior successful call to [sqlite3_blob_open()] and which has not
65126519
** been closed by [sqlite3_blob_close()]. Passing any other pointer in
65136520
** to this routine results in undefined and probably undesirable behavior.
65146521
*/
6515
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_bytes(sqlite3_blob *);
6522
+SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);
65166523
65176524
/*
65186525
** CAPI3REF: Read Data From A BLOB Incrementally
65196526
** METHOD: sqlite3_blob
65206527
**
@@ -6539,11 +6546,11 @@
65396546
** been closed by [sqlite3_blob_close()]. Passing any other pointer in
65406547
** to this routine results in undefined and probably undesirable behavior.
65416548
**
65426549
** See also: [sqlite3_blob_write()].
65436550
*/
6544
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
6551
+SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
65456552
65466553
/*
65476554
** CAPI3REF: Write Data Into A BLOB Incrementally
65486555
** METHOD: sqlite3_blob
65496556
**
@@ -6581,11 +6588,11 @@
65816588
** been closed by [sqlite3_blob_close()]. Passing any other pointer in
65826589
** to this routine results in undefined and probably undesirable behavior.
65836590
**
65846591
** See also: [sqlite3_blob_read()].
65856592
*/
6586
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
6593
+SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
65876594
65886595
/*
65896596
** CAPI3REF: Virtual File System Objects
65906597
**
65916598
** A virtual filesystem (VFS) is an [sqlite3_vfs] object
@@ -6612,13 +6619,13 @@
66126619
**
66136620
** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.
66146621
** ^(If the default VFS is unregistered, another VFS is chosen as
66156622
** the default. The choice for the new VFS is arbitrary.)^
66166623
*/
6617
-SQLITE_API sqlite3_vfs *SQLITE_STDCALL sqlite3_vfs_find(const char *zVfsName);
6618
-SQLITE_API int SQLITE_STDCALL sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
6619
-SQLITE_API int SQLITE_STDCALL sqlite3_vfs_unregister(sqlite3_vfs*);
6624
+SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
6625
+SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
6626
+SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
66206627
66216628
/*
66226629
** CAPI3REF: Mutexes
66236630
**
66246631
** The SQLite core uses these routines for thread
@@ -6730,15 +6737,15 @@
67306737
** sqlite3_mutex_leave() is a NULL pointer, then all three routines
67316738
** behave as no-ops.
67326739
**
67336740
** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
67346741
*/
6735
-SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_mutex_alloc(int);
6736
-SQLITE_API void SQLITE_STDCALL sqlite3_mutex_free(sqlite3_mutex*);
6737
-SQLITE_API void SQLITE_STDCALL sqlite3_mutex_enter(sqlite3_mutex*);
6738
-SQLITE_API int SQLITE_STDCALL sqlite3_mutex_try(sqlite3_mutex*);
6739
-SQLITE_API void SQLITE_STDCALL sqlite3_mutex_leave(sqlite3_mutex*);
6742
+SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
6743
+SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
6744
+SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*);
6745
+SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*);
6746
+SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
67406747
67416748
/*
67426749
** CAPI3REF: Mutex Methods Object
67436750
**
67446751
** An instance of this structure defines the low-level routines
@@ -6844,12 +6851,12 @@
68446851
** call to sqlite3_mutex_held() to fail, so a non-zero return is
68456852
** the appropriate thing to do. The sqlite3_mutex_notheld()
68466853
** interface should also return 1 when given a NULL pointer.
68476854
*/
68486855
#ifndef NDEBUG
6849
-SQLITE_API int SQLITE_STDCALL sqlite3_mutex_held(sqlite3_mutex*);
6850
-SQLITE_API int SQLITE_STDCALL sqlite3_mutex_notheld(sqlite3_mutex*);
6856
+SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
6857
+SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
68516858
#endif
68526859
68536860
/*
68546861
** CAPI3REF: Mutex Types
68556862
**
@@ -6864,11 +6871,11 @@
68646871
#define SQLITE_MUTEX_RECURSIVE 1
68656872
#define SQLITE_MUTEX_STATIC_MASTER 2
68666873
#define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */
68676874
#define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */
68686875
#define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */
6869
-#define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */
6876
+#define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_randomness() */
68706877
#define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
68716878
#define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */
68726879
#define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */
68736880
#define SQLITE_MUTEX_STATIC_APP1 8 /* For use by application */
68746881
#define SQLITE_MUTEX_STATIC_APP2 9 /* For use by application */
@@ -6885,11 +6892,11 @@
68856892
** serializes access to the [database connection] given in the argument
68866893
** when the [threading mode] is Serialized.
68876894
** ^If the [threading mode] is Single-thread or Multi-thread then this
68886895
** routine returns a NULL pointer.
68896896
*/
6890
-SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_db_mutex(sqlite3*);
6897
+SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
68916898
68926899
/*
68936900
** CAPI3REF: Low-Level Control Of Database Files
68946901
** METHOD: sqlite3
68956902
**
@@ -6920,11 +6927,11 @@
69206927
** an incorrect zDbName and an SQLITE_ERROR return from the underlying
69216928
** xFileControl method.
69226929
**
69236930
** See also: [SQLITE_FCNTL_LOCKSTATE]
69246931
*/
6925
-SQLITE_API int SQLITE_STDCALL sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
6932
+SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
69266933
69276934
/*
69286935
** CAPI3REF: Testing Interface
69296936
**
69306937
** ^The sqlite3_test_control() interface is used to read out internal
@@ -6939,11 +6946,11 @@
69396946
** The details of the operation codes, their meanings, the parameters
69406947
** they take, and what they do are all subject to change without notice.
69416948
** Unlike most of the SQLite API, this function is not guaranteed to
69426949
** operate consistently from one release to the next.
69436950
*/
6944
-SQLITE_API int SQLITE_CDECL sqlite3_test_control(int op, ...);
6951
+SQLITE_API int sqlite3_test_control(int op, ...);
69456952
69466953
/*
69476954
** CAPI3REF: Testing Interface Operation Codes
69486955
**
69496956
** These constants are the valid operation code parameters used
@@ -6968,10 +6975,11 @@
69686975
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
69696976
#define SQLITE_TESTCTRL_ISKEYWORD 16
69706977
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17
69716978
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
69726979
#define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
6980
+#define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
69736981
#define SQLITE_TESTCTRL_NEVER_CORRUPT 20
69746982
#define SQLITE_TESTCTRL_VDBE_COVERAGE 21
69756983
#define SQLITE_TESTCTRL_BYTEORDER 22
69766984
#define SQLITE_TESTCTRL_ISINIT 23
69776985
#define SQLITE_TESTCTRL_SORTER_MMAP 24
@@ -7002,12 +7010,12 @@
70027010
** be represented by a 32-bit integer, then the values returned by
70037011
** sqlite3_status() are undefined.
70047012
**
70057013
** See also: [sqlite3_db_status()]
70067014
*/
7007
-SQLITE_API int SQLITE_STDCALL sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
7008
-SQLITE_API int SQLITE_STDCALL sqlite3_status64(
7015
+SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
7016
+SQLITE_API int sqlite3_status64(
70097017
int op,
70107018
sqlite3_int64 *pCurrent,
70117019
sqlite3_int64 *pHighwater,
70127020
int resetFlag
70137021
);
@@ -7128,11 +7136,11 @@
71287136
** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
71297137
** non-zero [error code] on failure.
71307138
**
71317139
** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
71327140
*/
7133
-SQLITE_API int SQLITE_STDCALL sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
7141
+SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
71347142
71357143
/*
71367144
** CAPI3REF: Status Parameters for database connections
71377145
** KEYWORDS: {SQLITE_DBSTATUS options}
71387146
**
@@ -7271,11 +7279,11 @@
72717279
** ^If the resetFlg is true, then the counter is reset to zero after this
72727280
** interface call returns.
72737281
**
72747282
** See also: [sqlite3_status()] and [sqlite3_db_status()].
72757283
*/
7276
-SQLITE_API int SQLITE_STDCALL sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
7284
+SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
72777285
72787286
/*
72797287
** CAPI3REF: Status Parameters for prepared statements
72807288
** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters}
72817289
**
@@ -7740,20 +7748,20 @@
77407748
** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()
77417749
** APIs are not strictly speaking threadsafe. If they are invoked at the
77427750
** same time as another thread is invoking sqlite3_backup_step() it is
77437751
** possible that they return invalid values.
77447752
*/
7745
-SQLITE_API sqlite3_backup *SQLITE_STDCALL sqlite3_backup_init(
7753
+SQLITE_API sqlite3_backup *sqlite3_backup_init(
77467754
sqlite3 *pDest, /* Destination database handle */
77477755
const char *zDestName, /* Destination database name */
77487756
sqlite3 *pSource, /* Source database handle */
77497757
const char *zSourceName /* Source database name */
77507758
);
7751
-SQLITE_API int SQLITE_STDCALL sqlite3_backup_step(sqlite3_backup *p, int nPage);
7752
-SQLITE_API int SQLITE_STDCALL sqlite3_backup_finish(sqlite3_backup *p);
7753
-SQLITE_API int SQLITE_STDCALL sqlite3_backup_remaining(sqlite3_backup *p);
7754
-SQLITE_API int SQLITE_STDCALL sqlite3_backup_pagecount(sqlite3_backup *p);
7759
+SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage);
7760
+SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p);
7761
+SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p);
7762
+SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
77557763
77567764
/*
77577765
** CAPI3REF: Unlock Notification
77587766
** METHOD: sqlite3
77597767
**
@@ -7866,11 +7874,11 @@
78667874
** by an sqlite3_step() call. ^(If there is a blocking connection, then the
78677875
** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in
78687876
** the special "DROP TABLE/INDEX" case, the extended error code is just
78697877
** SQLITE_LOCKED.)^
78707878
*/
7871
-SQLITE_API int SQLITE_STDCALL sqlite3_unlock_notify(
7879
+SQLITE_API int sqlite3_unlock_notify(
78727880
sqlite3 *pBlocked, /* Waiting connection */
78737881
void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */
78747882
void *pNotifyArg /* Argument to pass to xNotify */
78757883
);
78767884
@@ -7881,12 +7889,12 @@
78817889
** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications
78827890
** and extensions to compare the contents of two buffers containing UTF-8
78837891
** strings in a case-independent fashion, using the same definition of "case
78847892
** independence" that SQLite uses internally when comparing identifiers.
78857893
*/
7886
-SQLITE_API int SQLITE_STDCALL sqlite3_stricmp(const char *, const char *);
7887
-SQLITE_API int SQLITE_STDCALL sqlite3_strnicmp(const char *, const char *, int);
7894
+SQLITE_API int sqlite3_stricmp(const char *, const char *);
7895
+SQLITE_API int sqlite3_strnicmp(const char *, const char *, int);
78887896
78897897
/*
78907898
** CAPI3REF: String Globbing
78917899
*
78927900
** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if
@@ -7899,11 +7907,11 @@
78997907
** Note that this routine returns zero on a match and non-zero if the strings
79007908
** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
79017909
**
79027910
** See also: [sqlite3_strlike()].
79037911
*/
7904
-SQLITE_API int SQLITE_STDCALL sqlite3_strglob(const char *zGlob, const char *zStr);
7912
+SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr);
79057913
79067914
/*
79077915
** CAPI3REF: String LIKE Matching
79087916
*
79097917
** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if
@@ -7922,11 +7930,11 @@
79227930
** Note that this routine returns zero on a match and non-zero if the strings
79237931
** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
79247932
**
79257933
** See also: [sqlite3_strglob()].
79267934
*/
7927
-SQLITE_API int SQLITE_STDCALL sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc);
7935
+SQLITE_API int sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc);
79287936
79297937
/*
79307938
** CAPI3REF: Error Logging Interface
79317939
**
79327940
** ^The [sqlite3_log()] interface writes a message into the [error log]
@@ -7945,11 +7953,11 @@
79457953
** will not use dynamically allocated memory. The log message is stored in
79467954
** a fixed-length buffer on the stack. If the log message is longer than
79477955
** a few hundred characters, it will be truncated to the length of the
79487956
** buffer.
79497957
*/
7950
-SQLITE_API void SQLITE_CDECL sqlite3_log(int iErrCode, const char *zFormat, ...);
7958
+SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
79517959
79527960
/*
79537961
** CAPI3REF: Write-Ahead Log Commit Hook
79547962
** METHOD: sqlite3
79557963
**
@@ -7981,11 +7989,11 @@
79817989
** previously registered write-ahead log callback. ^Note that the
79827990
** [sqlite3_wal_autocheckpoint()] interface and the
79837991
** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
79847992
** overwrite any prior [sqlite3_wal_hook()] settings.
79857993
*/
7986
-SQLITE_API void *SQLITE_STDCALL sqlite3_wal_hook(
7994
+SQLITE_API void *sqlite3_wal_hook(
79877995
sqlite3*,
79887996
int(*)(void *,sqlite3*,const char*,int),
79897997
void*
79907998
);
79917999
@@ -8016,11 +8024,11 @@
80168024
** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
80178025
** pages. The use of this interface
80188026
** is only necessary if the default setting is found to be suboptimal
80198027
** for a particular application.
80208028
*/
8021
-SQLITE_API int SQLITE_STDCALL sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
8029
+SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
80228030
80238031
/*
80248032
** CAPI3REF: Checkpoint a database
80258033
** METHOD: sqlite3
80268034
**
@@ -8038,11 +8046,11 @@
80388046
** interface was added. This interface is retained for backwards
80398047
** compatibility and as a convenience for applications that need to manually
80408048
** start a callback but which do not need the full power (and corresponding
80418049
** complication) of [sqlite3_wal_checkpoint_v2()].
80428050
*/
8043
-SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
8051
+SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
80448052
80458053
/*
80468054
** CAPI3REF: Checkpoint a database
80478055
** METHOD: sqlite3
80488056
**
@@ -8132,11 +8140,11 @@
81328140
** [sqlite3_errcode()] and [sqlite3_errmsg()].
81338141
**
81348142
** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
81358143
** from SQL.
81368144
*/
8137
-SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint_v2(
8145
+SQLITE_API int sqlite3_wal_checkpoint_v2(
81388146
sqlite3 *db, /* Database handle */
81398147
const char *zDb, /* Name of attached database (or NULL) */
81408148
int eMode, /* SQLITE_CHECKPOINT_* value */
81418149
int *pnLog, /* OUT: Size of WAL log in frames */
81428150
int *pnCkpt /* OUT: Total number of frames checkpointed */
@@ -8168,11 +8176,11 @@
81688176
**
81698177
** At present, there is only one option that may be configured using
81708178
** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].) Further options
81718179
** may be added in the future.
81728180
*/
8173
-SQLITE_API int SQLITE_CDECL sqlite3_vtab_config(sqlite3*, int op, ...);
8181
+SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
81748182
81758183
/*
81768184
** CAPI3REF: Virtual Table Configuration Options
81778185
**
81788186
** These macros define the various options to the
@@ -8221,11 +8229,11 @@
82218229
** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],
82228230
** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode
82238231
** of the SQL statement that triggered the call to the [xUpdate] method of the
82248232
** [virtual table].
82258233
*/
8226
-SQLITE_API int SQLITE_STDCALL sqlite3_vtab_on_conflict(sqlite3 *);
8234
+SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);
82278235
82288236
/*
82298237
** CAPI3REF: Conflict resolution modes
82308238
** KEYWORDS: {conflict resolution mode}
82318239
**
@@ -8326,11 +8334,11 @@
83268334
** as if the loop did not exist - it returns non-zero and leave the variable
83278335
** that pOut points to unchanged.
83288336
**
83298337
** See also: [sqlite3_stmt_scanstatus_reset()]
83308338
*/
8331
-SQLITE_API int SQLITE_STDCALL sqlite3_stmt_scanstatus(
8339
+SQLITE_API int sqlite3_stmt_scanstatus(
83328340
sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
83338341
int idx, /* Index of loop to report on */
83348342
int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
83358343
void *pOut /* Result written here */
83368344
);
@@ -8342,11 +8350,11 @@
83428350
** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.
83438351
**
83448352
** This API is only available if the library is built with pre-processor
83458353
** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
83468354
*/
8347
-SQLITE_API void SQLITE_STDCALL sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
8355
+SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
83488356
83498357
/*
83508358
** CAPI3REF: Flush caches to disk mid-transaction
83518359
**
83528360
** ^If a write-transaction is open on [database connection] D when the
@@ -8374,11 +8382,11 @@
83748382
** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK.
83758383
**
83768384
** ^This function does not set the database handle error code or message
83778385
** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.
83788386
*/
8379
-SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*);
8387
+SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
83808388
83818389
/*
83828390
** CAPI3REF: The pre-update hook.
83838391
**
83848392
** ^These interfaces are only available if SQLite is compiled using the
@@ -8454,11 +8462,11 @@
84548462
** triggers; or 2 for changes resulting from triggers called by top-level
84558463
** triggers; and so forth.
84568464
**
84578465
** See also: [sqlite3_update_hook()]
84588466
*/
8459
-SQLITE_API SQLITE_EXPERIMENTAL void *SQLITE_STDCALL sqlite3_preupdate_hook(
8467
+SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_preupdate_hook(
84608468
sqlite3 *db,
84618469
void(*xPreUpdate)(
84628470
void *pCtx, /* Copy of third arg to preupdate_hook() */
84638471
sqlite3 *db, /* Database handle */
84648472
int op, /* SQLITE_UPDATE, DELETE or INSERT */
@@ -8467,14 +8475,14 @@
84678475
sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */
84688476
sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */
84698477
),
84708478
void*
84718479
);
8472
-SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);
8473
-SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_count(sqlite3 *);
8474
-SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_depth(sqlite3 *);
8475
-SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
8480
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);
8481
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_count(sqlite3 *);
8482
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_depth(sqlite3 *);
8483
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
84768484
84778485
/*
84788486
** CAPI3REF: Low-level system error code
84798487
**
84808488
** ^Attempt to return the underlying operating system error code or error
@@ -8482,11 +8490,11 @@
84828490
** The return value is OS-dependent. For example, on unix systems, after
84838491
** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be
84848492
** called to get back the underlying "errno" that caused the problem, such
84858493
** as ENOSPC, EAUTH, EISDIR, and so forth.
84868494
*/
8487
-SQLITE_API int SQLITE_STDCALL sqlite3_system_errno(sqlite3*);
8495
+SQLITE_API int sqlite3_system_errno(sqlite3*);
84888496
84898497
/*
84908498
** CAPI3REF: Database Snapshot
84918499
** KEYWORDS: {snapshot}
84928500
** EXPERIMENTAL
@@ -8532,11 +8540,11 @@
85328540
** to avoid a memory leak.
85338541
**
85348542
** The [sqlite3_snapshot_get()] interface is only available when the
85358543
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
85368544
*/
8537
-SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_get(
8545
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
85388546
sqlite3 *db,
85398547
const char *zSchema,
85408548
sqlite3_snapshot **ppSnapshot
85418549
);
85428550
@@ -8570,11 +8578,11 @@
85708578
** database connection in order to make it ready to use snapshots.)
85718579
**
85728580
** The [sqlite3_snapshot_open()] interface is only available when the
85738581
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
85748582
*/
8575
-SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_open(
8583
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(
85768584
sqlite3 *db,
85778585
const char *zSchema,
85788586
sqlite3_snapshot *pSnapshot
85798587
);
85808588
@@ -8587,11 +8595,11 @@
85878595
** using this routine to avoid a memory leak.
85888596
**
85898597
** The [sqlite3_snapshot_free()] interface is only available when the
85908598
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
85918599
*/
8592
-SQLITE_API SQLITE_EXPERIMENTAL void SQLITE_STDCALL sqlite3_snapshot_free(sqlite3_snapshot*);
8600
+SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);
85938601
85948602
/*
85958603
** CAPI3REF: Compare the ages of two snapshot handles.
85968604
** EXPERIMENTAL
85978605
**
@@ -8611,11 +8619,11 @@
86118619
**
86128620
** Otherwise, this API returns a negative value if P1 refers to an older
86138621
** snapshot than P2, zero if the two handles refer to the same database
86148622
** snapshot, and a positive value if P1 is a newer snapshot than P2.
86158623
*/
8616
-SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_cmp(
8624
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(
86178625
sqlite3_snapshot *p1,
86188626
sqlite3_snapshot *p2
86198627
);
86208628
86218629
/*
@@ -8669,11 +8677,11 @@
86698677
** Register a geometry callback named zGeom that can be used as part of an
86708678
** R-Tree geometry query as follows:
86718679
**
86728680
** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
86738681
*/
8674
-SQLITE_API int SQLITE_STDCALL sqlite3_rtree_geometry_callback(
8682
+SQLITE_API int sqlite3_rtree_geometry_callback(
86758683
sqlite3 *db,
86768684
const char *zGeom,
86778685
int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),
86788686
void *pContext
86798687
);
@@ -8695,11 +8703,11 @@
86958703
** Register a 2nd-generation geometry callback named zScore that can be
86968704
** used as part of an R-Tree geometry query as follows:
86978705
**
86988706
** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
86998707
*/
8700
-SQLITE_API int SQLITE_STDCALL sqlite3_rtree_query_callback(
8708
+SQLITE_API int sqlite3_rtree_query_callback(
87018709
sqlite3 *db,
87028710
const char *zQueryFunc,
87038711
int (*xQueryFunc)(sqlite3_rtree_query_info*),
87048712
void *pContext,
87058713
void (*xDestructor)(void*)
@@ -11916,12 +11924,12 @@
1191611924
*/
1191711925
#ifdef SQLITE_OMIT_WSD
1191811926
#define SQLITE_WSD const
1191911927
#define GLOBAL(t,v) (*(t*)sqlite3_wsd_find((void*)&(v), sizeof(v)))
1192011928
#define sqlite3GlobalConfig GLOBAL(struct Sqlite3Config, sqlite3Config)
11921
-SQLITE_API int SQLITE_STDCALL sqlite3_wsd_init(int N, int J);
11922
-SQLITE_API void *SQLITE_STDCALL sqlite3_wsd_find(void *K, int L);
11929
+SQLITE_API int sqlite3_wsd_init(int N, int J);
11930
+SQLITE_API void *sqlite3_wsd_find(void *K, int L);
1192311931
#else
1192411932
#define SQLITE_WSD
1192511933
#define GLOBAL(t,v) v
1192611934
#define sqlite3GlobalConfig sqlite3Config
1192711935
#endif
@@ -12462,11 +12470,10 @@
1246212470
struct SubProgram {
1246312471
VdbeOp *aOp; /* Array of opcodes for sub-program */
1246412472
int nOp; /* Elements in aOp[] */
1246512473
int nMem; /* Number of memory cells required */
1246612474
int nCsr; /* Number of cursors required */
12467
- int nOnce; /* Number of OP_Once instructions */
1246812475
void *token; /* id that may be used to recursive triggers */
1246912476
SubProgram *pNext; /* Next sub-program already visited */
1247012477
};
1247112478
1247212479
/*
@@ -15514,11 +15521,10 @@
1551415521
int iRangeReg; /* First register in temporary register block */
1551515522
int nErr; /* Number of errors seen */
1551615523
int nTab; /* Number of previously allocated VDBE cursors */
1551715524
int nMem; /* Number of memory cells used so far */
1551815525
int nSet; /* Number of sets used so far */
15519
- int nOnce; /* Number of OP_Once instructions so far */
1552015526
int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */
1552115527
int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
1552215528
int iFixedOp; /* Never back out opcodes iFixedOp-1 or earlier */
1552315529
int ckBase; /* Base register of data during check constraints */
1552415530
int iSelfTab; /* Table of an index whose exprs are being coded */
@@ -15848,10 +15854,11 @@
1584815854
#endif
1584915855
#ifndef SQLITE_OMIT_BUILTIN_TEST
1585015856
int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */
1585115857
#endif
1585215858
int bLocaltimeFault; /* True to fail localtime() calls */
15859
+ int iOnceResetThreshold; /* When to reset OP_Once counters */
1585315860
};
1585415861
1585515862
/*
1585615863
** This macro is used inside of assert() statements to indicate that
1585715864
** the assert is only valid on a well-formed database. Instead of:
@@ -16201,11 +16208,10 @@
1620116208
SQLITE_PRIVATE void sqlite3AddCollateType(Parse*, Token*);
1620216209
SQLITE_PRIVATE void sqlite3EndTable(Parse*,Token*,Token*,u8,Select*);
1620316210
SQLITE_PRIVATE int sqlite3ParseUri(const char*,const char*,unsigned int*,
1620416211
sqlite3_vfs**,char**,char **);
1620516212
SQLITE_PRIVATE Btree *sqlite3DbNameToBtree(sqlite3*,const char*);
16206
-SQLITE_PRIVATE int sqlite3CodeOnce(Parse *);
1620716213
1620816214
#ifdef SQLITE_OMIT_BUILTIN_TEST
1620916215
# define sqlite3FaultSim(X) SQLITE_OK
1621016216
#else
1621116217
SQLITE_PRIVATE int sqlite3FaultSim(int);
@@ -17129,11 +17135,12 @@
1712917135
0, /* pVbeBranchArg */
1713017136
#endif
1713117137
#ifndef SQLITE_OMIT_BUILTIN_TEST
1713217138
0, /* xTestCallback */
1713317139
#endif
17134
- 0 /* bLocaltimeFault */
17140
+ 0, /* bLocaltimeFault */
17141
+ 0x7ffffffe /* iOnceResetThreshold */
1713517142
};
1713617143
1713717144
/*
1713817145
** Hash table for global functions - functions common to all
1713917146
** database connections. After initialization, this table is
@@ -17601,11 +17608,11 @@
1760117608
** was used and false if not.
1760217609
**
1760317610
** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
1760417611
** is not required for a match.
1760517612
*/
17606
-SQLITE_API int SQLITE_STDCALL sqlite3_compileoption_used(const char *zOptName){
17613
+SQLITE_API int sqlite3_compileoption_used(const char *zOptName){
1760717614
int i, n;
1760817615
1760917616
#if SQLITE_ENABLE_API_ARMOR
1761017617
if( zOptName==0 ){
1761117618
(void)SQLITE_MISUSE_BKPT;
@@ -17629,11 +17636,11 @@
1762917636
1763017637
/*
1763117638
** Return the N-th compile-time option string. If N is out of range,
1763217639
** return a NULL pointer.
1763317640
*/
17634
-SQLITE_API const char *SQLITE_STDCALL sqlite3_compileoption_get(int N){
17641
+SQLITE_API const char *sqlite3_compileoption_get(int N){
1763517642
if( N>=0 && N<ArraySize(azCompileOpt) ){
1763617643
return azCompileOpt[N];
1763717644
}
1763817645
return 0;
1763917646
}
@@ -17817,20 +17824,18 @@
1781717824
Vdbe *v; /* VM this frame belongs to */
1781817825
VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */
1781917826
Op *aOp; /* Program instructions for parent frame */
1782017827
i64 *anExec; /* Event counters from parent frame */
1782117828
Mem *aMem; /* Array of memory cells for parent frame */
17822
- u8 *aOnceFlag; /* Array of OP_Once flags for parent frame */
1782317829
VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */
1782417830
void *token; /* Copy of SubProgram.token */
1782517831
i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
1782617832
AuxData *pAuxData; /* Linked list of auxdata allocations */
1782717833
int nCursor; /* Number of entries in apCsr */
1782817834
int pc; /* Program Counter in parent (calling) frame */
1782917835
int nOp; /* Size of aOp array */
1783017836
int nMem; /* Number of entries in aMem */
17831
- int nOnceFlag; /* Number of entries in aOnceFlag */
1783217837
int nChildMem; /* Number of memory cells for child frame */
1783317838
int nChildCsr; /* Number of cursors for child frame */
1783417839
int nChange; /* Statement changes (Vdbe.nChange) */
1783517840
int nDbChange; /* Value of db->nChange */
1783617841
};
@@ -18070,12 +18075,10 @@
1807018075
VdbeFrame *pFrame; /* Parent frame */
1807118076
VdbeFrame *pDelFrame; /* List of frame objects to free on VM reset */
1807218077
int nFrame; /* Number of frames in pFrame list */
1807318078
u32 expmask; /* Binding to these vars invalidates VM */
1807418079
SubProgram *pProgram; /* Linked list of all sub-programs used by VM */
18075
- int nOnceFlag; /* Size of array aOnceFlag[] */
18076
- u8 *aOnceFlag; /* Flags for OP_Once */
1807718080
AuxData *pAuxData; /* Linked list of auxdata allocations */
1807818081
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
1807918082
i64 *anExec; /* Number of times each op has been executed */
1808018083
int nScan; /* Entries in aScan[] */
1808118084
ScanStatus *aScan; /* Scan definitions for sqlite3_stmt_scanstatus() */
@@ -18339,11 +18342,11 @@
1833918342
}
1834018343
1834118344
/*
1834218345
** Query status information.
1834318346
*/
18344
-SQLITE_API int SQLITE_STDCALL sqlite3_status64(
18347
+SQLITE_API int sqlite3_status64(
1834518348
int op,
1834618349
sqlite3_int64 *pCurrent,
1834718350
sqlite3_int64 *pHighwater,
1834818351
int resetFlag
1834918352
){
@@ -18364,11 +18367,11 @@
1836418367
}
1836518368
sqlite3_mutex_leave(pMutex);
1836618369
(void)pMutex; /* Prevent warning when SQLITE_THREADSAFE=0 */
1836718370
return SQLITE_OK;
1836818371
}
18369
-SQLITE_API int SQLITE_STDCALL sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){
18372
+SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){
1837018373
sqlite3_int64 iCur = 0, iHwtr = 0;
1837118374
int rc;
1837218375
#ifdef SQLITE_ENABLE_API_ARMOR
1837318376
if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT;
1837418377
#endif
@@ -18381,11 +18384,11 @@
1838118384
}
1838218385
1838318386
/*
1838418387
** Query status information for a single database connection
1838518388
*/
18386
-SQLITE_API int SQLITE_STDCALL sqlite3_db_status(
18389
+SQLITE_API int sqlite3_db_status(
1838718390
sqlite3 *db, /* The database connection whose status is desired */
1838818391
int op, /* Status verb */
1838918392
int *pCurrent, /* Write current value here */
1839018393
int *pHighwater, /* Write high-water mark here */
1839118394
int resetFlag /* Reset high-water mark if true */
@@ -20058,11 +20061,11 @@
2005820061
2005920062
/*
2006020063
** Locate a VFS by name. If no name is given, simply return the
2006120064
** first VFS on the list.
2006220065
*/
20063
-SQLITE_API sqlite3_vfs *SQLITE_STDCALL sqlite3_vfs_find(const char *zVfs){
20066
+SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfs){
2006420067
sqlite3_vfs *pVfs = 0;
2006520068
#if SQLITE_THREADSAFE
2006620069
sqlite3_mutex *mutex;
2006720070
#endif
2006820071
#ifndef SQLITE_OMIT_AUTOINIT
@@ -20104,11 +20107,11 @@
2010420107
/*
2010520108
** Register a VFS with the system. It is harmless to register the same
2010620109
** VFS multiple times. The new VFS becomes the default if makeDflt is
2010720110
** true.
2010820111
*/
20109
-SQLITE_API int SQLITE_STDCALL sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){
20112
+SQLITE_API int sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){
2011020113
MUTEX_LOGIC(sqlite3_mutex *mutex;)
2011120114
#ifndef SQLITE_OMIT_AUTOINIT
2011220115
int rc = sqlite3_initialize();
2011320116
if( rc ) return rc;
2011420117
#endif
@@ -20132,11 +20135,11 @@
2013220135
}
2013320136
2013420137
/*
2013520138
** Unregister a VFS so that it is no longer accessible.
2013620139
*/
20137
-SQLITE_API int SQLITE_STDCALL sqlite3_vfs_unregister(sqlite3_vfs *pVfs){
20140
+SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs *pVfs){
2013820141
#if SQLITE_THREADSAFE
2013920142
sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
2014020143
#endif
2014120144
sqlite3_mutex_enter(mutex);
2014220145
vfsUnlink(pVfs);
@@ -22483,11 +22486,11 @@
2248322486
}
2248422487
2248522488
/*
2248622489
** Retrieve a pointer to a static mutex or allocate a new dynamic one.
2248722490
*/
22488
-SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_mutex_alloc(int id){
22491
+SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int id){
2248922492
#ifndef SQLITE_OMIT_AUTOINIT
2249022493
if( id<=SQLITE_MUTEX_RECURSIVE && sqlite3_initialize() ) return 0;
2249122494
if( id>SQLITE_MUTEX_RECURSIVE && sqlite3MutexInit() ) return 0;
2249222495
#endif
2249322496
assert( sqlite3GlobalConfig.mutex.xMutexAlloc );
@@ -22504,11 +22507,11 @@
2250422507
}
2250522508
2250622509
/*
2250722510
** Free a dynamic mutex.
2250822511
*/
22509
-SQLITE_API void SQLITE_STDCALL sqlite3_mutex_free(sqlite3_mutex *p){
22512
+SQLITE_API void sqlite3_mutex_free(sqlite3_mutex *p){
2251022513
if( p ){
2251122514
assert( sqlite3GlobalConfig.mutex.xMutexFree );
2251222515
sqlite3GlobalConfig.mutex.xMutexFree(p);
2251322516
}
2251422517
}
@@ -22515,11 +22518,11 @@
2251522518
2251622519
/*
2251722520
** Obtain the mutex p. If some other thread already has the mutex, block
2251822521
** until it can be obtained.
2251922522
*/
22520
-SQLITE_API void SQLITE_STDCALL sqlite3_mutex_enter(sqlite3_mutex *p){
22523
+SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex *p){
2252122524
if( p ){
2252222525
assert( sqlite3GlobalConfig.mutex.xMutexEnter );
2252322526
sqlite3GlobalConfig.mutex.xMutexEnter(p);
2252422527
}
2252522528
}
@@ -22526,11 +22529,11 @@
2252622529
2252722530
/*
2252822531
** Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another
2252922532
** thread holds the mutex and it cannot be obtained, return SQLITE_BUSY.
2253022533
*/
22531
-SQLITE_API int SQLITE_STDCALL sqlite3_mutex_try(sqlite3_mutex *p){
22534
+SQLITE_API int sqlite3_mutex_try(sqlite3_mutex *p){
2253222535
int rc = SQLITE_OK;
2253322536
if( p ){
2253422537
assert( sqlite3GlobalConfig.mutex.xMutexTry );
2253522538
return sqlite3GlobalConfig.mutex.xMutexTry(p);
2253622539
}
@@ -22541,11 +22544,11 @@
2254122544
** The sqlite3_mutex_leave() routine exits a mutex that was previously
2254222545
** entered by the same thread. The behavior is undefined if the mutex
2254322546
** is not currently entered. If a NULL pointer is passed as an argument
2254422547
** this function is a no-op.
2254522548
*/
22546
-SQLITE_API void SQLITE_STDCALL sqlite3_mutex_leave(sqlite3_mutex *p){
22549
+SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex *p){
2254722550
if( p ){
2254822551
assert( sqlite3GlobalConfig.mutex.xMutexLeave );
2254922552
sqlite3GlobalConfig.mutex.xMutexLeave(p);
2255022553
}
2255122554
}
@@ -22553,15 +22556,15 @@
2255322556
#ifndef NDEBUG
2255422557
/*
2255522558
** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are
2255622559
** intended for use inside assert() statements.
2255722560
*/
22558
-SQLITE_API int SQLITE_STDCALL sqlite3_mutex_held(sqlite3_mutex *p){
22561
+SQLITE_API int sqlite3_mutex_held(sqlite3_mutex *p){
2255922562
assert( p==0 || sqlite3GlobalConfig.mutex.xMutexHeld );
2256022563
return p==0 || sqlite3GlobalConfig.mutex.xMutexHeld(p);
2256122564
}
22562
-SQLITE_API int SQLITE_STDCALL sqlite3_mutex_notheld(sqlite3_mutex *p){
22565
+SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex *p){
2256322566
assert( p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld );
2256422567
return p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld(p);
2256522568
}
2256622569
#endif
2256722570
@@ -23589,12 +23592,12 @@
2358923592
** of the sqlite3_initialize() and sqlite3_shutdown() processing, the
2359023593
** "interlocked" magic used here is probably not strictly necessary.
2359123594
*/
2359223595
static LONG SQLITE_WIN32_VOLATILE winMutex_lock = 0;
2359323596
23594
-SQLITE_API int SQLITE_STDCALL sqlite3_win32_is_nt(void); /* os_win.c */
23595
-SQLITE_API void SQLITE_STDCALL sqlite3_win32_sleep(DWORD milliseconds); /* os_win.c */
23597
+SQLITE_API int sqlite3_win32_is_nt(void); /* os_win.c */
23598
+SQLITE_API void sqlite3_win32_sleep(DWORD milliseconds); /* os_win.c */
2359623599
2359723600
static int winMutexInit(void){
2359823601
/* The first to increment to 1 does actual initialization */
2359923602
if( InterlockedCompareExchange(&winMutex_lock, 1, 0)==0 ){
2360023603
int i;
@@ -23890,11 +23893,11 @@
2389023893
/*
2389123894
** Attempt to release up to n bytes of non-essential memory currently
2389223895
** held by SQLite. An example of non-essential memory is memory used to
2389323896
** cache database pages that are not currently in use.
2389423897
*/
23895
-SQLITE_API int SQLITE_STDCALL sqlite3_release_memory(int n){
23898
+SQLITE_API int sqlite3_release_memory(int n){
2389623899
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
2389723900
return sqlite3PcacheReleaseMemory(n);
2389823901
#else
2389923902
/* IMPLEMENTATION-OF: R-34391-24921 The sqlite3_release_memory() routine
2390023903
** is a no-op returning zero if SQLite is not compiled with
@@ -23949,11 +23952,11 @@
2394923952
/*
2395023953
** Deprecated external interface. It used to set an alarm callback
2395123954
** that was invoked when memory usage grew too large. Now it is a
2395223955
** no-op.
2395323956
*/
23954
-SQLITE_API int SQLITE_STDCALL sqlite3_memory_alarm(
23957
+SQLITE_API int sqlite3_memory_alarm(
2395523958
void(*xCallback)(void *pArg, sqlite3_int64 used,int N),
2395623959
void *pArg,
2395723960
sqlite3_int64 iThreshold
2395823961
){
2395923962
(void)xCallback;
@@ -23965,11 +23968,11 @@
2396523968
2396623969
/*
2396723970
** Set the soft heap-size limit for the library. Passing a zero or
2396823971
** negative value indicates no limit.
2396923972
*/
23970
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_soft_heap_limit64(sqlite3_int64 n){
23973
+SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 n){
2397123974
sqlite3_int64 priorLimit;
2397223975
sqlite3_int64 excess;
2397323976
sqlite3_int64 nUsed;
2397423977
#ifndef SQLITE_OMIT_AUTOINIT
2397523978
int rc = sqlite3_initialize();
@@ -23987,11 +23990,11 @@
2398723990
sqlite3_mutex_leave(mem0.mutex);
2398823991
excess = sqlite3_memory_used() - n;
2398923992
if( excess>0 ) sqlite3_release_memory((int)(excess & 0x7fffffff));
2399023993
return priorLimit;
2399123994
}
23992
-SQLITE_API void SQLITE_STDCALL sqlite3_soft_heap_limit(int n){
23995
+SQLITE_API void sqlite3_soft_heap_limit(int n){
2399323996
if( n<0 ) n = 0;
2399423997
sqlite3_soft_heap_limit64(n);
2399523998
}
2399623999
2399724000
/*
@@ -24056,11 +24059,11 @@
2405624059
}
2405724060
2405824061
/*
2405924062
** Return the amount of memory currently checked out.
2406024063
*/
24061
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_used(void){
24064
+SQLITE_API sqlite3_int64 sqlite3_memory_used(void){
2406224065
sqlite3_int64 res, mx;
2406324066
sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, 0);
2406424067
return res;
2406524068
}
2406624069
@@ -24067,11 +24070,11 @@
2406724070
/*
2406824071
** Return the maximum amount of memory that has ever been
2406924072
** checked out since either the beginning of this process
2407024073
** or since the most recent reset.
2407124074
*/
24072
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_highwater(int resetFlag){
24075
+SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag){
2407324076
sqlite3_int64 res, mx;
2407424077
sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, resetFlag);
2407524078
return mx;
2407624079
}
2407724080
@@ -24147,17 +24150,17 @@
2414724150
/*
2414824151
** This version of the memory allocation is for use by the application.
2414924152
** First make sure the memory subsystem is initialized, then do the
2415024153
** allocation.
2415124154
*/
24152
-SQLITE_API void *SQLITE_STDCALL sqlite3_malloc(int n){
24155
+SQLITE_API void *sqlite3_malloc(int n){
2415324156
#ifndef SQLITE_OMIT_AUTOINIT
2415424157
if( sqlite3_initialize() ) return 0;
2415524158
#endif
2415624159
return n<=0 ? 0 : sqlite3Malloc(n);
2415724160
}
24158
-SQLITE_API void *SQLITE_STDCALL sqlite3_malloc64(sqlite3_uint64 n){
24161
+SQLITE_API void *sqlite3_malloc64(sqlite3_uint64 n){
2415924162
#ifndef SQLITE_OMIT_AUTOINIT
2416024163
if( sqlite3_initialize() ) return 0;
2416124164
#endif
2416224165
return sqlite3Malloc(n);
2416324166
}
@@ -24296,20 +24299,20 @@
2429624299
}else{
2429724300
assert( sqlite3_mutex_held(db->mutex) );
2429824301
return db->lookaside.sz;
2429924302
}
2430024303
}
24301
-SQLITE_API sqlite3_uint64 SQLITE_STDCALL sqlite3_msize(void *p){
24304
+SQLITE_API sqlite3_uint64 sqlite3_msize(void *p){
2430224305
assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
2430324306
assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
2430424307
return p ? sqlite3GlobalConfig.m.xSize(p) : 0;
2430524308
}
2430624309
2430724310
/*
2430824311
** Free memory previously obtained from sqlite3Malloc().
2430924312
*/
24310
-SQLITE_API void SQLITE_STDCALL sqlite3_free(void *p){
24313
+SQLITE_API void sqlite3_free(void *p){
2431124314
if( p==0 ) return; /* IMP: R-49053-54554 */
2431224315
assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
2431324316
assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
2431424317
if( sqlite3GlobalConfig.bMemstat ){
2431524318
sqlite3_mutex_enter(mem0.mutex);
@@ -24414,18 +24417,18 @@
2441424417
2441524418
/*
2441624419
** The public interface to sqlite3Realloc. Make sure that the memory
2441724420
** subsystem is initialized prior to invoking sqliteRealloc.
2441824421
*/
24419
-SQLITE_API void *SQLITE_STDCALL sqlite3_realloc(void *pOld, int n){
24422
+SQLITE_API void *sqlite3_realloc(void *pOld, int n){
2442024423
#ifndef SQLITE_OMIT_AUTOINIT
2442124424
if( sqlite3_initialize() ) return 0;
2442224425
#endif
2442324426
if( n<0 ) n = 0; /* IMP: R-26507-47431 */
2442424427
return sqlite3Realloc(pOld, n);
2442524428
}
24426
-SQLITE_API void *SQLITE_STDCALL sqlite3_realloc64(void *pOld, sqlite3_uint64 n){
24429
+SQLITE_API void *sqlite3_realloc64(void *pOld, sqlite3_uint64 n){
2442724430
#ifndef SQLITE_OMIT_AUTOINIT
2442824431
if( sqlite3_initialize() ) return 0;
2442924432
#endif
2443024433
return sqlite3Realloc(pOld, n);
2443124434
}
@@ -25648,11 +25651,11 @@
2564825651
2564925652
/*
2565025653
** Print into memory obtained from sqlite3_malloc(). Omit the internal
2565125654
** %-conversion extensions.
2565225655
*/
25653
-SQLITE_API char *SQLITE_STDCALL sqlite3_vmprintf(const char *zFormat, va_list ap){
25656
+SQLITE_API char *sqlite3_vmprintf(const char *zFormat, va_list ap){
2565425657
char *z;
2565525658
char zBase[SQLITE_PRINT_BUF_SIZE];
2565625659
StrAccum acc;
2565725660
2565825661
#ifdef SQLITE_ENABLE_API_ARMOR
@@ -25672,11 +25675,11 @@
2567225675
2567325676
/*
2567425677
** Print into memory obtained from sqlite3_malloc()(). Omit the internal
2567525678
** %-conversion extensions.
2567625679
*/
25677
-SQLITE_API char *SQLITE_CDECL sqlite3_mprintf(const char *zFormat, ...){
25680
+SQLITE_API char *sqlite3_mprintf(const char *zFormat, ...){
2567825681
va_list ap;
2567925682
char *z;
2568025683
#ifndef SQLITE_OMIT_AUTOINIT
2568125684
if( sqlite3_initialize() ) return 0;
2568225685
#endif
@@ -25697,11 +25700,11 @@
2569725700
** this without breaking compatibility, so we just have to live with the
2569825701
** mistake.
2569925702
**
2570025703
** sqlite3_vsnprintf() is the varargs version.
2570125704
*/
25702
-SQLITE_API char *SQLITE_STDCALL sqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_list ap){
25705
+SQLITE_API char *sqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_list ap){
2570325706
StrAccum acc;
2570425707
if( n<=0 ) return zBuf;
2570525708
#ifdef SQLITE_ENABLE_API_ARMOR
2570625709
if( zBuf==0 || zFormat==0 ) {
2570725710
(void)SQLITE_MISUSE_BKPT;
@@ -25711,11 +25714,11 @@
2571125714
#endif
2571225715
sqlite3StrAccumInit(&acc, 0, zBuf, n, 0);
2571325716
sqlite3VXPrintf(&acc, zFormat, ap);
2571425717
return sqlite3StrAccumFinish(&acc);
2571525718
}
25716
-SQLITE_API char *SQLITE_CDECL sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
25719
+SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
2571725720
char *z;
2571825721
va_list ap;
2571925722
va_start(ap,zFormat);
2572025723
z = sqlite3_vsnprintf(n, zBuf, zFormat, ap);
2572125724
va_end(ap);
@@ -25747,11 +25750,11 @@
2574725750
}
2574825751
2574925752
/*
2575025753
** Format and write a message to the log if logging is enabled.
2575125754
*/
25752
-SQLITE_API void SQLITE_CDECL sqlite3_log(int iErrCode, const char *zFormat, ...){
25755
+SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...){
2575325756
va_list ap; /* Vararg list */
2575425757
if( sqlite3GlobalConfig.xLog ){
2575525758
va_start(ap, zFormat);
2575625759
renderLogMsg(iErrCode, zFormat, ap);
2575725760
va_end(ap);
@@ -26341,11 +26344,11 @@
2634126344
} sqlite3Prng;
2634226345
2634326346
/*
2634426347
** Return N random bytes.
2634526348
*/
26346
-SQLITE_API void SQLITE_STDCALL sqlite3_randomness(int N, void *pBuf){
26349
+SQLITE_API void sqlite3_randomness(int N, void *pBuf){
2634726350
unsigned char t;
2634826351
unsigned char *zBuf = pBuf;
2634926352
2635026353
/* The "wsdPrng" macro will resolve to the pseudo-random number generator
2635126354
** state vector. If writable static data is unsupported on the target,
@@ -27544,11 +27547,11 @@
2754427547
** sqlite3_strnicmp() APIs allow applications and extensions to compare
2754527548
** the contents of two buffers containing UTF-8 strings in a
2754627549
** case-independent fashion, using the same definition of "case
2754727550
** independence" that SQLite uses internally when comparing identifiers.
2754827551
*/
27549
-SQLITE_API int SQLITE_STDCALL sqlite3_stricmp(const char *zLeft, const char *zRight){
27552
+SQLITE_API int sqlite3_stricmp(const char *zLeft, const char *zRight){
2755027553
if( zLeft==0 ){
2755127554
return zRight ? -1 : 0;
2755227555
}else if( zRight==0 ){
2755327556
return 1;
2755427557
}
@@ -27565,11 +27568,11 @@
2756527568
a++;
2756627569
b++;
2756727570
}
2756827571
return c;
2756927572
}
27570
-SQLITE_API int SQLITE_STDCALL sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){
27573
+SQLITE_API int sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){
2757127574
register unsigned char *a, *b;
2757227575
if( zLeft==0 ){
2757327576
return zRight ? -1 : 0;
2757427577
}else if( zRight==0 ){
2757527578
return 1;
@@ -28563,40 +28566,25 @@
2856328566
return 0;
2856428567
}else{
2856528568
return sqlite3AddInt64(pA, -iB);
2856628569
}
2856728570
}
28568
-#define TWOPOWER32 (((i64)1)<<32)
28569
-#define TWOPOWER31 (((i64)1)<<31)
2857028571
SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){
2857128572
i64 iA = *pA;
28572
- i64 iA1, iA0, iB1, iB0, r;
28573
-
28574
- iA1 = iA/TWOPOWER32;
28575
- iA0 = iA % TWOPOWER32;
28576
- iB1 = iB/TWOPOWER32;
28577
- iB0 = iB % TWOPOWER32;
28578
- if( iA1==0 ){
28579
- if( iB1==0 ){
28580
- *pA *= iB;
28581
- return 0;
28582
- }
28583
- r = iA0*iB1;
28584
- }else if( iB1==0 ){
28585
- r = iA1*iB0;
28586
- }else{
28587
- /* If both iA1 and iB1 are non-zero, overflow will result */
28588
- return 1;
28589
- }
28590
- testcase( r==(-TWOPOWER31)-1 );
28591
- testcase( r==(-TWOPOWER31) );
28592
- testcase( r==TWOPOWER31 );
28593
- testcase( r==TWOPOWER31-1 );
28594
- if( r<(-TWOPOWER31) || r>=TWOPOWER31 ) return 1;
28595
- r *= TWOPOWER32;
28596
- if( sqlite3AddInt64(&r, iA0*iB0) ) return 1;
28597
- *pA = r;
28573
+ if( iB>0 ){
28574
+ if( iA>LARGEST_INT64/iB ) return 1;
28575
+ if( iA<SMALLEST_INT64/iB ) return 1;
28576
+ }else if( iB<0 ){
28577
+ if( iA>0 ){
28578
+ if( iB<SMALLEST_INT64/iA ) return 1;
28579
+ }else if( iA<0 ){
28580
+ if( iB==SMALLEST_INT64 ) return 1;
28581
+ if( iA==SMALLEST_INT64 ) return 1;
28582
+ if( -iA>LARGEST_INT64/-iB ) return 1;
28583
+ }
28584
+ }
28585
+ *pA = iA*iB;
2859828586
return 0;
2859928587
}
2860028588
2860128589
/*
2860228590
** Compute the absolute value of a 32-bit signed integer, of possible. Or
@@ -36888,11 +36876,11 @@
3688836876
** This routine is called once during SQLite initialization and by a
3688936877
** single thread. The memory allocation and mutex subsystems have not
3689036878
** necessarily been initialized when this routine is called, and so they
3689136879
** should not be used.
3689236880
*/
36893
-SQLITE_API int SQLITE_STDCALL sqlite3_os_init(void){
36881
+SQLITE_API int sqlite3_os_init(void){
3689436882
/*
3689536883
** The following macro defines an initializer for an sqlite3_vfs object.
3689636884
** The name of the VFS is NAME. The pAppData is a pointer to a pointer
3689736885
** to the "finder" function. (pAppData is a pointer to a pointer because
3689836886
** silly C90 rules prohibit a void* from being cast to a function pointer
@@ -36987,11 +36975,11 @@
3698736975
**
3698836976
** Some operating systems might need to do some cleanup in this routine,
3698936977
** to release dynamically allocated objects. But not on unix.
3699036978
** This routine is a no-op for unix.
3699136979
*/
36992
-SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void){
36980
+SQLITE_API int sqlite3_os_end(void){
3699336981
return SQLITE_OK;
3699436982
}
3699536983
3699636984
#endif /* SQLITE_OS_UNIX */
3699736985
@@ -38422,11 +38410,11 @@
3842238410
** compact it. Upon success, SQLITE_OK will be returned. Upon failure, one
3842338411
** of SQLITE_NOMEM, SQLITE_ERROR, or SQLITE_NOTFOUND will be returned. The
3842438412
** "pnLargest" argument, if non-zero, will be used to return the size of the
3842538413
** largest committed free block in the heap, in bytes.
3842638414
*/
38427
-SQLITE_API int SQLITE_STDCALL sqlite3_win32_compact_heap(LPUINT pnLargest){
38415
+SQLITE_API int sqlite3_win32_compact_heap(LPUINT pnLargest){
3842838416
int rc = SQLITE_OK;
3842938417
UINT nLargest = 0;
3843038418
HANDLE hHeap;
3843138419
3843238420
winMemAssertMagic();
@@ -38462,11 +38450,11 @@
3846238450
** If a Win32 native heap has been configured, this function will attempt to
3846338451
** destroy and recreate it. If the Win32 native heap is not isolated and/or
3846438452
** the sqlite3_memory_used() function does not return zero, SQLITE_BUSY will
3846538453
** be returned and no changes will be made to the Win32 native heap.
3846638454
*/
38467
-SQLITE_API int SQLITE_STDCALL sqlite3_win32_reset_heap(){
38455
+SQLITE_API int sqlite3_win32_reset_heap(){
3846838456
int rc;
3846938457
MUTEX_LOGIC( sqlite3_mutex *pMaster; ) /* The main static mutex */
3847038458
MUTEX_LOGIC( sqlite3_mutex *pMem; ) /* The memsys static mutex */
3847138459
MUTEX_LOGIC( pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); )
3847238460
MUTEX_LOGIC( pMem = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); )
@@ -38507,11 +38495,11 @@
3850738495
/*
3850838496
** This function outputs the specified (ANSI) string to the Win32 debugger
3850938497
** (if available).
3851038498
*/
3851138499
38512
-SQLITE_API void SQLITE_STDCALL sqlite3_win32_write_debug(const char *zBuf, int nBuf){
38500
+SQLITE_API void sqlite3_win32_write_debug(const char *zBuf, int nBuf){
3851338501
char zDbgBuf[SQLITE_WIN32_DBG_BUF_SIZE];
3851438502
int nMin = MIN(nBuf, (SQLITE_WIN32_DBG_BUF_SIZE - 1)); /* may be negative. */
3851538503
if( nMin<-1 ) nMin = -1; /* all negative values become -1. */
3851638504
assert( nMin==-1 || nMin==0 || nMin<SQLITE_WIN32_DBG_BUF_SIZE );
3851738505
#ifdef SQLITE_ENABLE_API_ARMOR
@@ -38553,11 +38541,11 @@
3855338541
*/
3855438542
#if SQLITE_OS_WINRT
3855538543
static HANDLE sleepObj = NULL;
3855638544
#endif
3855738545
38558
-SQLITE_API void SQLITE_STDCALL sqlite3_win32_sleep(DWORD milliseconds){
38546
+SQLITE_API void sqlite3_win32_sleep(DWORD milliseconds){
3855938547
#if SQLITE_OS_WINRT
3856038548
if ( sleepObj==NULL ){
3856138549
sleepObj = osCreateEventExW(NULL, NULL, CREATE_EVENT_MANUAL_RESET,
3856238550
SYNCHRONIZE);
3856338551
}
@@ -38602,11 +38590,11 @@
3860238590
3860338591
/*
3860438592
** This function determines if the machine is running a version of Windows
3860538593
** based on the NT kernel.
3860638594
*/
38607
-SQLITE_API int SQLITE_STDCALL sqlite3_win32_is_nt(void){
38595
+SQLITE_API int sqlite3_win32_is_nt(void){
3860838596
#if SQLITE_OS_WINRT
3860938597
/*
3861038598
** NOTE: The WinRT sub-platform is always assumed to be based on the NT
3861138599
** kernel.
3861238600
*/
@@ -38990,11 +38978,11 @@
3899038978
}
3899138979
3899238980
/*
3899338981
** This is a public wrapper for the winUtf8ToUnicode() function.
3899438982
*/
38995
-SQLITE_API LPWSTR SQLITE_STDCALL sqlite3_win32_utf8_to_unicode(const char *zText){
38983
+SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char *zText){
3899638984
#ifdef SQLITE_ENABLE_API_ARMOR
3899738985
if( !zText ){
3899838986
(void)SQLITE_MISUSE_BKPT;
3899938987
return 0;
3900038988
}
@@ -39006,11 +38994,11 @@
3900638994
}
3900738995
3900838996
/*
3900938997
** This is a public wrapper for the winUnicodeToUtf8() function.
3901038998
*/
39011
-SQLITE_API char *SQLITE_STDCALL sqlite3_win32_unicode_to_utf8(LPCWSTR zWideText){
38999
+SQLITE_API char *sqlite3_win32_unicode_to_utf8(LPCWSTR zWideText){
3901239000
#ifdef SQLITE_ENABLE_API_ARMOR
3901339001
if( !zWideText ){
3901439002
(void)SQLITE_MISUSE_BKPT;
3901539003
return 0;
3901639004
}
@@ -39022,11 +39010,11 @@
3902239010
}
3902339011
3902439012
/*
3902539013
** This is a public wrapper for the winMbcsToUtf8() function.
3902639014
*/
39027
-SQLITE_API char *SQLITE_STDCALL sqlite3_win32_mbcs_to_utf8(const char *zText){
39015
+SQLITE_API char *sqlite3_win32_mbcs_to_utf8(const char *zText){
3902839016
#ifdef SQLITE_ENABLE_API_ARMOR
3902939017
if( !zText ){
3903039018
(void)SQLITE_MISUSE_BKPT;
3903139019
return 0;
3903239020
}
@@ -39038,11 +39026,11 @@
3903839026
}
3903939027
3904039028
/*
3904139029
** This is a public wrapper for the winMbcsToUtf8() function.
3904239030
*/
39043
-SQLITE_API char *SQLITE_STDCALL sqlite3_win32_mbcs_to_utf8_v2(const char *zText, int useAnsi){
39031
+SQLITE_API char *sqlite3_win32_mbcs_to_utf8_v2(const char *zText, int useAnsi){
3904439032
#ifdef SQLITE_ENABLE_API_ARMOR
3904539033
if( !zText ){
3904639034
(void)SQLITE_MISUSE_BKPT;
3904739035
return 0;
3904839036
}
@@ -39054,11 +39042,11 @@
3905439042
}
3905539043
3905639044
/*
3905739045
** This is a public wrapper for the winUtf8ToMbcs() function.
3905839046
*/
39059
-SQLITE_API char *SQLITE_STDCALL sqlite3_win32_utf8_to_mbcs(const char *zText){
39047
+SQLITE_API char *sqlite3_win32_utf8_to_mbcs(const char *zText){
3906039048
#ifdef SQLITE_ENABLE_API_ARMOR
3906139049
if( !zText ){
3906239050
(void)SQLITE_MISUSE_BKPT;
3906339051
return 0;
3906439052
}
@@ -39070,11 +39058,11 @@
3907039058
}
3907139059
3907239060
/*
3907339061
** This is a public wrapper for the winUtf8ToMbcs() function.
3907439062
*/
39075
-SQLITE_API char *SQLITE_STDCALL sqlite3_win32_utf8_to_mbcs_v2(const char *zText, int useAnsi){
39063
+SQLITE_API char *sqlite3_win32_utf8_to_mbcs_v2(const char *zText, int useAnsi){
3907639064
#ifdef SQLITE_ENABLE_API_ARMOR
3907739065
if( !zText ){
3907839066
(void)SQLITE_MISUSE_BKPT;
3907939067
return 0;
3908039068
}
@@ -39090,11 +39078,11 @@
3909039078
** the provided arguments. The type argument must be 1 in order to set the
3909139079
** data directory or 2 in order to set the temporary directory. The zValue
3909239080
** argument is the name of the directory to use. The return value will be
3909339081
** SQLITE_OK if successful.
3909439082
*/
39095
-SQLITE_API int SQLITE_STDCALL sqlite3_win32_set_directory(DWORD type, LPCWSTR zValue){
39083
+SQLITE_API int sqlite3_win32_set_directory(DWORD type, LPCWSTR zValue){
3909639084
char **ppDirectory = 0;
3909739085
#ifndef SQLITE_OMIT_AUTOINIT
3909839086
int rc = sqlite3_initialize();
3909939087
if( rc ) return rc;
3910039088
#endif
@@ -43008,11 +42996,11 @@
4300842996
}
4300942997
4301042998
/*
4301142999
** Initialize and deinitialize the operating system interface.
4301243000
*/
43013
-SQLITE_API int SQLITE_STDCALL sqlite3_os_init(void){
43001
+SQLITE_API int sqlite3_os_init(void){
4301443002
static sqlite3_vfs winVfs = {
4301543003
3, /* iVersion */
4301643004
sizeof(winFile), /* szOsFile */
4301743005
SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */
4301843006
0, /* pNext */
@@ -43139,11 +43127,11 @@
4313943127
#endif
4314043128
4314143129
return SQLITE_OK;
4314243130
}
4314343131
43144
-SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void){
43132
+SQLITE_API int sqlite3_os_end(void){
4314543133
#if SQLITE_OS_WINRT
4314643134
if( sleepObj!=NULL ){
4314743135
osCloseHandle(sleepObj);
4314843136
sleepObj = NULL;
4314943137
}
@@ -57182,11 +57170,11 @@
5718257170
5718357171
/*
5718457172
** Return a +ve value if snapshot p1 is newer than p2. A -ve value if
5718557173
** p1 is older than p2 and zero if p1 and p2 are the same snapshot.
5718657174
*/
57187
-SQLITE_API int SQLITE_STDCALL sqlite3_snapshot_cmp(sqlite3_snapshot *p1, sqlite3_snapshot *p2){
57175
+SQLITE_API int sqlite3_snapshot_cmp(sqlite3_snapshot *p1, sqlite3_snapshot *p2){
5718857176
WalIndexHdr *pHdr1 = (WalIndexHdr*)p1;
5718957177
WalIndexHdr *pHdr2 = (WalIndexHdr*)p2;
5719057178
5719157179
/* aSalt[0] is a copy of the value stored in the wal file header. It
5719257180
** is incremented each time the wal file is restarted. */
@@ -58319,11 +58307,11 @@
5831958307
**
5832058308
** This routine has no effect on existing database connections.
5832158309
** The shared cache setting effects only future calls to
5832258310
** sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2().
5832358311
*/
58324
-SQLITE_API int SQLITE_STDCALL sqlite3_enable_shared_cache(int enable){
58312
+SQLITE_API int sqlite3_enable_shared_cache(int enable){
5832558313
sqlite3GlobalConfig.sharedCacheEnabled = enable;
5832658314
return SQLITE_OK;
5832758315
}
5832858316
#endif
5832958317
@@ -59838,12 +59826,15 @@
5983859826
hdr = pPage->hdrOffset;
5983959827
iPtr = hdr + 1;
5984059828
if( data[iPtr+1]==0 && data[iPtr]==0 ){
5984159829
iFreeBlk = 0; /* Shortcut for the case when the freelist is empty */
5984259830
}else{
59843
- while( (iFreeBlk = get2byte(&data[iPtr]))>0 && iFreeBlk<iStart ){
59844
- if( iFreeBlk<iPtr+4 ) return SQLITE_CORRUPT_BKPT;
59831
+ while( (iFreeBlk = get2byte(&data[iPtr]))<iStart ){
59832
+ if( iFreeBlk<iPtr+4 ){
59833
+ if( iFreeBlk==0 ) break;
59834
+ return SQLITE_CORRUPT_BKPT;
59835
+ }
5984559836
iPtr = iFreeBlk;
5984659837
}
5984759838
if( iFreeBlk>iLast ) return SQLITE_CORRUPT_BKPT;
5984859839
assert( iFreeBlk>iPtr || iFreeBlk==0 );
5984959840
@@ -68092,11 +68083,11 @@
6809268083
** a pointer to the new sqlite3_backup object.
6809368084
**
6809468085
** If an error occurs, NULL is returned and an error code and error message
6809568086
** stored in database handle pDestDb.
6809668087
*/
68097
-SQLITE_API sqlite3_backup *SQLITE_STDCALL sqlite3_backup_init(
68088
+SQLITE_API sqlite3_backup *sqlite3_backup_init(
6809868089
sqlite3* pDestDb, /* Database to write to */
6809968090
const char *zDestDb, /* Name of database within pDestDb */
6810068091
sqlite3* pSrcDb, /* Database connection to read from */
6810168092
const char *zSrcDb /* Name of database within pSrcDb */
6810268093
){
@@ -68299,11 +68290,11 @@
6829968290
}
6830068291
6830168292
/*
6830268293
** Copy nPage pages from the source b-tree to the destination.
6830368294
*/
68304
-SQLITE_API int SQLITE_STDCALL sqlite3_backup_step(sqlite3_backup *p, int nPage){
68295
+SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){
6830568296
int rc;
6830668297
int destMode; /* Destination journal mode */
6830768298
int pgszSrc = 0; /* Source page size */
6830868299
int pgszDest = 0; /* Destination page size */
6830968300
@@ -68553,11 +68544,11 @@
6855368544
}
6855468545
6855568546
/*
6855668547
** Release all resources associated with an sqlite3_backup* handle.
6855768548
*/
68558
-SQLITE_API int SQLITE_STDCALL sqlite3_backup_finish(sqlite3_backup *p){
68549
+SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p){
6855968550
sqlite3_backup **pp; /* Ptr to head of pagers backup list */
6856068551
sqlite3 *pSrcDb; /* Source database connection */
6856168552
int rc; /* Value to return */
6856268553
6856368554
/* Enter the mutexes */
@@ -68605,11 +68596,11 @@
6860568596
6860668597
/*
6860768598
** Return the number of pages still to be backed up as of the most recent
6860868599
** call to sqlite3_backup_step().
6860968600
*/
68610
-SQLITE_API int SQLITE_STDCALL sqlite3_backup_remaining(sqlite3_backup *p){
68601
+SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p){
6861168602
#ifdef SQLITE_ENABLE_API_ARMOR
6861268603
if( p==0 ){
6861368604
(void)SQLITE_MISUSE_BKPT;
6861468605
return 0;
6861568606
}
@@ -68619,11 +68610,11 @@
6861968610
6862068611
/*
6862168612
** Return the total number of pages in the source database as of the most
6862268613
** recent call to sqlite3_backup_step().
6862368614
*/
68624
-SQLITE_API int SQLITE_STDCALL sqlite3_backup_pagecount(sqlite3_backup *p){
68615
+SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p){
6862568616
#ifdef SQLITE_ENABLE_API_ARMOR
6862668617
if( p==0 ){
6862768618
(void)SQLITE_MISUSE_BKPT;
6862868619
return 0;
6862968620
}
@@ -68946,22 +68937,22 @@
6894668937
** MEM.zMalloc, where it can be safely written.
6894768938
**
6894868939
** Return SQLITE_OK on success or SQLITE_NOMEM if malloc fails.
6894968940
*/
6895068941
SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){
68951
- int f;
6895268942
assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
6895368943
assert( (pMem->flags&MEM_RowSet)==0 );
68954
- (void)ExpandBlob(pMem);
68955
- f = pMem->flags;
68956
- if( (f&(MEM_Str|MEM_Blob)) && (pMem->szMalloc==0 || pMem->z!=pMem->zMalloc) ){
68957
- if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){
68958
- return SQLITE_NOMEM_BKPT;
68959
- }
68960
- pMem->z[pMem->n] = 0;
68961
- pMem->z[pMem->n+1] = 0;
68962
- pMem->flags |= MEM_Term;
68944
+ if( (pMem->flags & (MEM_Str|MEM_Blob))!=0 ){
68945
+ if( ExpandBlob(pMem) ) return SQLITE_NOMEM;
68946
+ if( pMem->szMalloc==0 || pMem->z!=pMem->zMalloc ){
68947
+ if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){
68948
+ return SQLITE_NOMEM_BKPT;
68949
+ }
68950
+ pMem->z[pMem->n] = 0;
68951
+ pMem->z[pMem->n+1] = 0;
68952
+ pMem->flags |= MEM_Term;
68953
+ }
6896368954
}
6896468955
pMem->flags &= ~MEM_Ephem;
6896568956
#ifdef SQLITE_DEBUG
6896668957
pMem->pScopyFrom = 0;
6896768958
#endif
@@ -68973,29 +68964,28 @@
6897368964
** If the given Mem* has a zero-filled tail, turn it into an ordinary
6897468965
** blob stored in dynamically allocated space.
6897568966
*/
6897668967
#ifndef SQLITE_OMIT_INCRBLOB
6897768968
SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){
68978
- if( pMem->flags & MEM_Zero ){
68979
- int nByte;
68980
- assert( pMem->flags&MEM_Blob );
68981
- assert( (pMem->flags&MEM_RowSet)==0 );
68982
- assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
68983
-
68984
- /* Set nByte to the number of bytes required to store the expanded blob. */
68985
- nByte = pMem->n + pMem->u.nZero;
68986
- if( nByte<=0 ){
68987
- nByte = 1;
68988
- }
68989
- if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){
68990
- return SQLITE_NOMEM_BKPT;
68991
- }
68992
-
68993
- memset(&pMem->z[pMem->n], 0, pMem->u.nZero);
68994
- pMem->n += pMem->u.nZero;
68995
- pMem->flags &= ~(MEM_Zero|MEM_Term);
68996
- }
68969
+ int nByte;
68970
+ assert( pMem->flags & MEM_Zero );
68971
+ assert( pMem->flags&MEM_Blob );
68972
+ assert( (pMem->flags&MEM_RowSet)==0 );
68973
+ assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
68974
+
68975
+ /* Set nByte to the number of bytes required to store the expanded blob. */
68976
+ nByte = pMem->n + pMem->u.nZero;
68977
+ if( nByte<=0 ){
68978
+ nByte = 1;
68979
+ }
68980
+ if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){
68981
+ return SQLITE_NOMEM_BKPT;
68982
+ }
68983
+
68984
+ memset(&pMem->z[pMem->n], 0, pMem->u.nZero);
68985
+ pMem->n += pMem->u.nZero;
68986
+ pMem->flags &= ~(MEM_Zero|MEM_Term);
6899768987
return SQLITE_OK;
6899868988
}
6899968989
#endif
6900068990
6900168991
/*
@@ -72345,11 +72335,10 @@
7234572335
sqlite3 *db; /* The database connection */
7234672336
int nVar; /* Number of parameters */
7234772337
int nMem; /* Number of VM memory registers */
7234872338
int nCursor; /* Number of cursors required */
7234972339
int nArg; /* Number of arguments in subprograms */
72350
- int nOnce; /* Number of OP_Once instructions */
7235172340
int n; /* Loop counter */
7235272341
struct ReusableSpace x; /* Reusable bulk memory */
7235372342
7235472343
assert( p!=0 );
7235572344
assert( p->nOp>0 );
@@ -72360,12 +72349,10 @@
7236072349
assert( db->mallocFailed==0 );
7236172350
nVar = pParse->nVar;
7236272351
nMem = pParse->nMem;
7236372352
nCursor = pParse->nTab;
7236472353
nArg = pParse->nMaxArg;
72365
- nOnce = pParse->nOnce;
72366
- if( nOnce==0 ) nOnce = 1; /* Ensure at least one byte in p->aOnceFlag[] */
7236772354
7236872355
/* Each cursor uses a memory cell. The first cursor (cursor 0) can
7236972356
** use aMem[0] which is not otherwise used by the VDBE program. Allocate
7237072357
** space at the end of aMem[] for cursors 1 and greater.
7237172358
** See also: allocateCursor().
@@ -72408,21 +72395,19 @@
7240872395
x.nNeeded = 0;
7240972396
p->aMem = allocSpace(&x, p->aMem, nMem*sizeof(Mem));
7241072397
p->aVar = allocSpace(&x, p->aVar, nVar*sizeof(Mem));
7241172398
p->apArg = allocSpace(&x, p->apArg, nArg*sizeof(Mem*));
7241272399
p->apCsr = allocSpace(&x, p->apCsr, nCursor*sizeof(VdbeCursor*));
72413
- p->aOnceFlag = allocSpace(&x, p->aOnceFlag, nOnce);
7241472400
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
7241572401
p->anExec = allocSpace(&x, p->anExec, p->nOp*sizeof(i64));
7241672402
#endif
7241772403
if( x.nNeeded==0 ) break;
7241872404
x.pSpace = p->pFree = sqlite3DbMallocZero(db, x.nNeeded);
7241972405
x.nFree = x.nNeeded;
7242072406
}while( !db->mallocFailed );
7242172407
7242272408
p->nCursor = nCursor;
72423
- p->nOnceFlag = nOnce;
7242472409
if( p->aVar ){
7242572410
p->nVar = (ynVar)nVar;
7242672411
for(n=0; n<nVar; n++){
7242772412
p->aVar[n].flags = MEM_Null;
7242872413
p->aVar[n].db = db;
@@ -72506,12 +72491,10 @@
7250672491
Vdbe *v = pFrame->v;
7250772492
closeCursorsInFrame(v);
7250872493
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
7250972494
v->anExec = pFrame->anExec;
7251072495
#endif
72511
- v->aOnceFlag = pFrame->aOnceFlag;
72512
- v->nOnceFlag = pFrame->nOnceFlag;
7251372496
v->aOp = pFrame->aOp;
7251472497
v->nOp = pFrame->nOp;
7251572498
v->aMem = pFrame->aMem;
7251672499
v->nMem = pFrame->nMem;
7251772500
v->apCsr = pFrame->apCsr;
@@ -73048,11 +73031,10 @@
7304873031
*/
7304973032
7305073033
if( db->mallocFailed ){
7305173034
p->rc = SQLITE_NOMEM_BKPT;
7305273035
}
73053
- if( p->aOnceFlag ) memset(p->aOnceFlag, 0, p->nOnceFlag);
7305473036
closeAllCursors(p);
7305573037
if( p->magic!=VDBE_MAGIC_RUN ){
7305673038
return SQLITE_OK;
7305773039
}
7305873040
checkActiveVdbeCnt(db);
@@ -74196,14 +74178,16 @@
7419674178
7419774179
/*
7419874180
** The input pBlob is guaranteed to be a Blob that is not marked
7419974181
** with MEM_Zero. Return true if it could be a zero-blob.
7420074182
*/
74201
-static int isZeroBlob(const Mem *pBlob){
74183
+static int isAllZero(const char *z, int n){
7420274184
int i;
74203
- for(i=0; i<pBlob->n && pBlob->z[i]==0; i++){}
74204
- return i==pBlob->n;
74185
+ for(i=0; i<n; i++){
74186
+ if( z[i] ) return 0;
74187
+ }
74188
+ return 1;
7420574189
}
7420674190
7420774191
/*
7420874192
** Compare two blobs. Return negative, zero, or positive if the first
7420974193
** is less than, equal to, or greater than the second, respectively.
@@ -74223,14 +74207,14 @@
7422374207
7422474208
if( (pB1->flags|pB2->flags) & MEM_Zero ){
7422574209
if( pB1->flags & pB2->flags & MEM_Zero ){
7422674210
return pB1->u.nZero - pB2->u.nZero;
7422774211
}else if( pB1->flags & MEM_Zero ){
74228
- if( !isZeroBlob(pB2) ) return -1;
74212
+ if( !isAllZero(pB2->z, pB2->n) ) return -1;
7422974213
return pB1->u.nZero - n2;
7423074214
}else{
74231
- if( !isZeroBlob(pB1) ) return +1;
74215
+ if( !isAllZero(pB1->z, pB1->n) ) return +1;
7423274216
return n1 - pB2->u.nZero;
7423374217
}
7423474218
}
7423574219
c = memcmp(pB1->z, pB2->z, n1>n2 ? n2 : n1);
7423674220
if( c ) return c;
@@ -74538,10 +74522,11 @@
7453874522
}
7453974523
}
7454074524
7454174525
/* RHS is a blob */
7454274526
else if( pRhs->flags & MEM_Blob ){
74527
+ assert( (pRhs->flags & MEM_Zero)==0 || pRhs->n==0 );
7454374528
getVarint32(&aKey1[idx1], serial_type);
7454474529
testcase( serial_type==12 );
7454574530
if( serial_type<12 || (serial_type & 0x01) ){
7454674531
rc = -1;
7454774532
}else{
@@ -74549,10 +74534,16 @@
7454974534
testcase( (d1+nStr)==(unsigned)nKey1 );
7455074535
testcase( (d1+nStr+1)==(unsigned)nKey1 );
7455174536
if( (d1+nStr) > (unsigned)nKey1 ){
7455274537
pPKey2->errCode = (u8)SQLITE_CORRUPT_BKPT;
7455374538
return 0; /* Corruption */
74539
+ }else if( pRhs->flags & MEM_Zero ){
74540
+ if( !isAllZero((const char*)&aKey1[d1],nStr) ){
74541
+ rc = 1;
74542
+ }else{
74543
+ rc = nStr - pRhs->u.nZero;
74544
+ }
7455474545
}else{
7455574546
int nCmp = MIN(nStr, pRhs->n);
7455674547
rc = memcmp(&aKey1[d1], pRhs->z, nCmp);
7455774548
if( rc==0 ) rc = nStr - pRhs->n;
7455874549
}
@@ -74619,11 +74610,11 @@
7461974610
const u8 *aKey = &((const u8*)pKey1)[*(const u8*)pKey1 & 0x3F];
7462074611
int serial_type = ((const u8*)pKey1)[1];
7462174612
int res;
7462274613
u32 y;
7462374614
u64 x;
74624
- i64 v = pPKey2->aMem[0].u.i;
74615
+ i64 v;
7462574616
i64 lhs;
7462674617
7462774618
vdbeAssertFieldCountWithinLimits(nKey1, pKey1, pPKey2->pKeyInfo);
7462874619
assert( (*(u8*)pKey1)<=0x3F || CORRUPT_DB );
7462974620
switch( serial_type ){
@@ -74678,10 +74669,11 @@
7467874669
7467974670
default:
7468074671
return sqlite3VdbeRecordCompare(nKey1, pKey1, pPKey2);
7468174672
}
7468274673
74674
+ v = pPKey2->aMem[0].u.i;
7468374675
if( v>lhs ){
7468474676
res = pPKey2->r1;
7468574677
}else if( v<lhs ){
7468674678
res = pPKey2->r2;
7468774679
}else if( pPKey2->nField>1 ){
@@ -75128,11 +75120,11 @@
7512875120
** execution environment changes in a way that would alter the program
7512975121
** that sqlite3_prepare() generates. For example, if new functions or
7513075122
** collating sequences are registered or if an authorizer function is
7513175123
** added or changed.
7513275124
*/
75133
-SQLITE_API int SQLITE_STDCALL sqlite3_expired(sqlite3_stmt *pStmt){
75125
+SQLITE_API int sqlite3_expired(sqlite3_stmt *pStmt){
7513475126
Vdbe *p = (Vdbe*)pStmt;
7513575127
return p==0 || p->expired;
7513675128
}
7513775129
#endif
7513875130
@@ -75197,11 +75189,11 @@
7519775189
** machine.
7519875190
**
7519975191
** This routine sets the error code and string returned by
7520075192
** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
7520175193
*/
75202
-SQLITE_API int SQLITE_STDCALL sqlite3_finalize(sqlite3_stmt *pStmt){
75194
+SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt){
7520375195
int rc;
7520475196
if( pStmt==0 ){
7520575197
/* IMPLEMENTATION-OF: R-57228-12904 Invoking sqlite3_finalize() on a NULL
7520675198
** pointer is a harmless no-op. */
7520775199
rc = SQLITE_OK;
@@ -75224,11 +75216,11 @@
7522475216
** the prior execution is returned.
7522575217
**
7522675218
** This routine sets the error code and string returned by
7522775219
** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
7522875220
*/
75229
-SQLITE_API int SQLITE_STDCALL sqlite3_reset(sqlite3_stmt *pStmt){
75221
+SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt){
7523075222
int rc;
7523175223
if( pStmt==0 ){
7523275224
rc = SQLITE_OK;
7523375225
}else{
7523475226
Vdbe *v = (Vdbe*)pStmt;
@@ -75245,11 +75237,11 @@
7524575237
}
7524675238
7524775239
/*
7524875240
** Set all the parameters in the compiled SQL statement to NULL.
7524975241
*/
75250
-SQLITE_API int SQLITE_STDCALL sqlite3_clear_bindings(sqlite3_stmt *pStmt){
75242
+SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt *pStmt){
7525175243
int i;
7525275244
int rc = SQLITE_OK;
7525375245
Vdbe *p = (Vdbe*)pStmt;
7525475246
#if SQLITE_THREADSAFE
7525575247
sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex;
@@ -75269,61 +75261,61 @@
7526975261
7527075262
/**************************** sqlite3_value_ *******************************
7527175263
** The following routines extract information from a Mem or sqlite3_value
7527275264
** structure.
7527375265
*/
75274
-SQLITE_API const void *SQLITE_STDCALL sqlite3_value_blob(sqlite3_value *pVal){
75266
+SQLITE_API const void *sqlite3_value_blob(sqlite3_value *pVal){
7527575267
Mem *p = (Mem*)pVal;
7527675268
if( p->flags & (MEM_Blob|MEM_Str) ){
75277
- if( sqlite3VdbeMemExpandBlob(p)!=SQLITE_OK ){
75269
+ if( ExpandBlob(p)!=SQLITE_OK ){
7527875270
assert( p->flags==MEM_Null && p->z==0 );
7527975271
return 0;
7528075272
}
7528175273
p->flags |= MEM_Blob;
7528275274
return p->n ? p->z : 0;
7528375275
}else{
7528475276
return sqlite3_value_text(pVal);
7528575277
}
7528675278
}
75287
-SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes(sqlite3_value *pVal){
75279
+SQLITE_API int sqlite3_value_bytes(sqlite3_value *pVal){
7528875280
return sqlite3ValueBytes(pVal, SQLITE_UTF8);
7528975281
}
75290
-SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes16(sqlite3_value *pVal){
75282
+SQLITE_API int sqlite3_value_bytes16(sqlite3_value *pVal){
7529175283
return sqlite3ValueBytes(pVal, SQLITE_UTF16NATIVE);
7529275284
}
75293
-SQLITE_API double SQLITE_STDCALL sqlite3_value_double(sqlite3_value *pVal){
75285
+SQLITE_API double sqlite3_value_double(sqlite3_value *pVal){
7529475286
return sqlite3VdbeRealValue((Mem*)pVal);
7529575287
}
75296
-SQLITE_API int SQLITE_STDCALL sqlite3_value_int(sqlite3_value *pVal){
75288
+SQLITE_API int sqlite3_value_int(sqlite3_value *pVal){
7529775289
return (int)sqlite3VdbeIntValue((Mem*)pVal);
7529875290
}
75299
-SQLITE_API sqlite_int64 SQLITE_STDCALL sqlite3_value_int64(sqlite3_value *pVal){
75291
+SQLITE_API sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){
7530075292
return sqlite3VdbeIntValue((Mem*)pVal);
7530175293
}
75302
-SQLITE_API unsigned int SQLITE_STDCALL sqlite3_value_subtype(sqlite3_value *pVal){
75294
+SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value *pVal){
7530375295
Mem *pMem = (Mem*)pVal;
7530475296
return ((pMem->flags & MEM_Subtype) ? pMem->eSubtype : 0);
7530575297
}
75306
-SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_value_text(sqlite3_value *pVal){
75298
+SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value *pVal){
7530775299
return (const unsigned char *)sqlite3ValueText(pVal, SQLITE_UTF8);
7530875300
}
7530975301
#ifndef SQLITE_OMIT_UTF16
75310
-SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16(sqlite3_value* pVal){
75302
+SQLITE_API const void *sqlite3_value_text16(sqlite3_value* pVal){
7531175303
return sqlite3ValueText(pVal, SQLITE_UTF16NATIVE);
7531275304
}
75313
-SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16be(sqlite3_value *pVal){
75305
+SQLITE_API const void *sqlite3_value_text16be(sqlite3_value *pVal){
7531475306
return sqlite3ValueText(pVal, SQLITE_UTF16BE);
7531575307
}
75316
-SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16le(sqlite3_value *pVal){
75308
+SQLITE_API const void *sqlite3_value_text16le(sqlite3_value *pVal){
7531775309
return sqlite3ValueText(pVal, SQLITE_UTF16LE);
7531875310
}
7531975311
#endif /* SQLITE_OMIT_UTF16 */
7532075312
/* EVIDENCE-OF: R-12793-43283 Every value in SQLite has one of five
7532175313
** fundamental datatypes: 64-bit signed integer 64-bit IEEE floating
7532275314
** point number string BLOB NULL
7532375315
*/
75324
-SQLITE_API int SQLITE_STDCALL sqlite3_value_type(sqlite3_value* pVal){
75316
+SQLITE_API int sqlite3_value_type(sqlite3_value* pVal){
7532575317
static const u8 aType[] = {
7532675318
SQLITE_BLOB, /* 0x00 */
7532775319
SQLITE_NULL, /* 0x01 */
7532875320
SQLITE_TEXT, /* 0x02 */
7532975321
SQLITE_NULL, /* 0x03 */
@@ -75359,11 +75351,11 @@
7535975351
return aType[pVal->flags&MEM_AffMask];
7536075352
}
7536175353
7536275354
/* Make a copy of an sqlite3_value object
7536375355
*/
75364
-SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_value_dup(const sqlite3_value *pOrig){
75356
+SQLITE_API sqlite3_value *sqlite3_value_dup(const sqlite3_value *pOrig){
7536575357
sqlite3_value *pNew;
7536675358
if( pOrig==0 ) return 0;
7536775359
pNew = sqlite3_malloc( sizeof(*pNew) );
7536875360
if( pNew==0 ) return 0;
7536975361
memset(pNew, 0, sizeof(*pNew));
@@ -75382,11 +75374,11 @@
7538275374
}
7538375375
7538475376
/* Destroy an sqlite3_value object previously obtained from
7538575377
** sqlite3_value_dup().
7538675378
*/
75387
-SQLITE_API void SQLITE_STDCALL sqlite3_value_free(sqlite3_value *pOld){
75379
+SQLITE_API void sqlite3_value_free(sqlite3_value *pOld){
7538875380
sqlite3ValueFree(pOld);
7538975381
}
7539075382
7539175383
7539275384
/**************************** sqlite3_result_ *******************************
@@ -75425,21 +75417,21 @@
7542575417
xDel((void*)p);
7542675418
}
7542775419
if( pCtx ) sqlite3_result_error_toobig(pCtx);
7542875420
return SQLITE_TOOBIG;
7542975421
}
75430
-SQLITE_API void SQLITE_STDCALL sqlite3_result_blob(
75422
+SQLITE_API void sqlite3_result_blob(
7543175423
sqlite3_context *pCtx,
7543275424
const void *z,
7543375425
int n,
7543475426
void (*xDel)(void *)
7543575427
){
7543675428
assert( n>=0 );
7543775429
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7543875430
setResultStrOrError(pCtx, z, n, 0, xDel);
7543975431
}
75440
-SQLITE_API void SQLITE_STDCALL sqlite3_result_blob64(
75432
+SQLITE_API void sqlite3_result_blob64(
7544175433
sqlite3_context *pCtx,
7544275434
const void *z,
7544375435
sqlite3_uint64 n,
7544475436
void (*xDel)(void *)
7544575437
){
@@ -75449,56 +75441,56 @@
7544975441
(void)invokeValueDestructor(z, xDel, pCtx);
7545075442
}else{
7545175443
setResultStrOrError(pCtx, z, (int)n, 0, xDel);
7545275444
}
7545375445
}
75454
-SQLITE_API void SQLITE_STDCALL sqlite3_result_double(sqlite3_context *pCtx, double rVal){
75446
+SQLITE_API void sqlite3_result_double(sqlite3_context *pCtx, double rVal){
7545575447
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7545675448
sqlite3VdbeMemSetDouble(pCtx->pOut, rVal);
7545775449
}
75458
-SQLITE_API void SQLITE_STDCALL sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){
75450
+SQLITE_API void sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){
7545975451
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7546075452
pCtx->isError = SQLITE_ERROR;
7546175453
pCtx->fErrorOrAux = 1;
7546275454
sqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF8, SQLITE_TRANSIENT);
7546375455
}
7546475456
#ifndef SQLITE_OMIT_UTF16
75465
-SQLITE_API void SQLITE_STDCALL sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){
75457
+SQLITE_API void sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){
7546675458
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7546775459
pCtx->isError = SQLITE_ERROR;
7546875460
pCtx->fErrorOrAux = 1;
7546975461
sqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF16NATIVE, SQLITE_TRANSIENT);
7547075462
}
7547175463
#endif
75472
-SQLITE_API void SQLITE_STDCALL sqlite3_result_int(sqlite3_context *pCtx, int iVal){
75464
+SQLITE_API void sqlite3_result_int(sqlite3_context *pCtx, int iVal){
7547375465
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7547475466
sqlite3VdbeMemSetInt64(pCtx->pOut, (i64)iVal);
7547575467
}
75476
-SQLITE_API void SQLITE_STDCALL sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){
75468
+SQLITE_API void sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){
7547775469
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7547875470
sqlite3VdbeMemSetInt64(pCtx->pOut, iVal);
7547975471
}
75480
-SQLITE_API void SQLITE_STDCALL sqlite3_result_null(sqlite3_context *pCtx){
75472
+SQLITE_API void sqlite3_result_null(sqlite3_context *pCtx){
7548175473
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7548275474
sqlite3VdbeMemSetNull(pCtx->pOut);
7548375475
}
75484
-SQLITE_API void SQLITE_STDCALL sqlite3_result_subtype(sqlite3_context *pCtx, unsigned int eSubtype){
75476
+SQLITE_API void sqlite3_result_subtype(sqlite3_context *pCtx, unsigned int eSubtype){
7548575477
Mem *pOut = pCtx->pOut;
7548675478
assert( sqlite3_mutex_held(pOut->db->mutex) );
7548775479
pOut->eSubtype = eSubtype & 0xff;
7548875480
pOut->flags |= MEM_Subtype;
7548975481
}
75490
-SQLITE_API void SQLITE_STDCALL sqlite3_result_text(
75482
+SQLITE_API void sqlite3_result_text(
7549175483
sqlite3_context *pCtx,
7549275484
const char *z,
7549375485
int n,
7549475486
void (*xDel)(void *)
7549575487
){
7549675488
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7549775489
setResultStrOrError(pCtx, z, n, SQLITE_UTF8, xDel);
7549875490
}
75499
-SQLITE_API void SQLITE_STDCALL sqlite3_result_text64(
75491
+SQLITE_API void sqlite3_result_text64(
7550075492
sqlite3_context *pCtx,
7550175493
const char *z,
7550275494
sqlite3_uint64 n,
7550375495
void (*xDel)(void *),
7550475496
unsigned char enc
@@ -75511,56 +75503,56 @@
7551175503
}else{
7551275504
setResultStrOrError(pCtx, z, (int)n, enc, xDel);
7551375505
}
7551475506
}
7551575507
#ifndef SQLITE_OMIT_UTF16
75516
-SQLITE_API void SQLITE_STDCALL sqlite3_result_text16(
75508
+SQLITE_API void sqlite3_result_text16(
7551775509
sqlite3_context *pCtx,
7551875510
const void *z,
7551975511
int n,
7552075512
void (*xDel)(void *)
7552175513
){
7552275514
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7552375515
setResultStrOrError(pCtx, z, n, SQLITE_UTF16NATIVE, xDel);
7552475516
}
75525
-SQLITE_API void SQLITE_STDCALL sqlite3_result_text16be(
75517
+SQLITE_API void sqlite3_result_text16be(
7552675518
sqlite3_context *pCtx,
7552775519
const void *z,
7552875520
int n,
7552975521
void (*xDel)(void *)
7553075522
){
7553175523
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7553275524
setResultStrOrError(pCtx, z, n, SQLITE_UTF16BE, xDel);
7553375525
}
75534
-SQLITE_API void SQLITE_STDCALL sqlite3_result_text16le(
75526
+SQLITE_API void sqlite3_result_text16le(
7553575527
sqlite3_context *pCtx,
7553675528
const void *z,
7553775529
int n,
7553875530
void (*xDel)(void *)
7553975531
){
7554075532
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7554175533
setResultStrOrError(pCtx, z, n, SQLITE_UTF16LE, xDel);
7554275534
}
7554375535
#endif /* SQLITE_OMIT_UTF16 */
75544
-SQLITE_API void SQLITE_STDCALL sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){
75536
+SQLITE_API void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){
7554575537
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7554675538
sqlite3VdbeMemCopy(pCtx->pOut, pValue);
7554775539
}
75548
-SQLITE_API void SQLITE_STDCALL sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){
75540
+SQLITE_API void sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){
7554975541
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7555075542
sqlite3VdbeMemSetZeroBlob(pCtx->pOut, n);
7555175543
}
75552
-SQLITE_API int SQLITE_STDCALL sqlite3_result_zeroblob64(sqlite3_context *pCtx, u64 n){
75544
+SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context *pCtx, u64 n){
7555375545
Mem *pOut = pCtx->pOut;
7555475546
assert( sqlite3_mutex_held(pOut->db->mutex) );
7555575547
if( n>(u64)pOut->db->aLimit[SQLITE_LIMIT_LENGTH] ){
7555675548
return SQLITE_TOOBIG;
7555775549
}
7555875550
sqlite3VdbeMemSetZeroBlob(pCtx->pOut, (int)n);
7555975551
return SQLITE_OK;
7556075552
}
75561
-SQLITE_API void SQLITE_STDCALL sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){
75553
+SQLITE_API void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){
7556275554
pCtx->isError = errCode;
7556375555
pCtx->fErrorOrAux = 1;
7556475556
#ifdef SQLITE_DEBUG
7556575557
if( pCtx->pVdbe ) pCtx->pVdbe->rcApp = errCode;
7556675558
#endif
@@ -75569,20 +75561,20 @@
7556975561
SQLITE_UTF8, SQLITE_STATIC);
7557075562
}
7557175563
}
7557275564
7557375565
/* Force an SQLITE_TOOBIG error. */
75574
-SQLITE_API void SQLITE_STDCALL sqlite3_result_error_toobig(sqlite3_context *pCtx){
75566
+SQLITE_API void sqlite3_result_error_toobig(sqlite3_context *pCtx){
7557575567
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7557675568
pCtx->isError = SQLITE_TOOBIG;
7557775569
pCtx->fErrorOrAux = 1;
7557875570
sqlite3VdbeMemSetStr(pCtx->pOut, "string or blob too big", -1,
7557975571
SQLITE_UTF8, SQLITE_STATIC);
7558075572
}
7558175573
7558275574
/* An SQLITE_NOMEM error. */
75583
-SQLITE_API void SQLITE_STDCALL sqlite3_result_error_nomem(sqlite3_context *pCtx){
75575
+SQLITE_API void sqlite3_result_error_nomem(sqlite3_context *pCtx){
7558475576
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7558575577
sqlite3VdbeMemSetNull(pCtx->pOut);
7558675578
pCtx->isError = SQLITE_NOMEM_BKPT;
7558775579
pCtx->fErrorOrAux = 1;
7558875580
sqlite3OomFault(pCtx->pOut->db);
@@ -75750,11 +75742,11 @@
7575075742
/*
7575175743
** This is the top-level implementation of sqlite3_step(). Call
7575275744
** sqlite3Step() to do most of the work. If a schema error occurs,
7575375745
** call sqlite3Reprepare() and try again.
7575475746
*/
75755
-SQLITE_API int SQLITE_STDCALL sqlite3_step(sqlite3_stmt *pStmt){
75747
+SQLITE_API int sqlite3_step(sqlite3_stmt *pStmt){
7575675748
int rc = SQLITE_OK; /* Result from sqlite3Step() */
7575775749
int rc2 = SQLITE_OK; /* Result from sqlite3Reprepare() */
7575875750
Vdbe *v = (Vdbe*)pStmt; /* the prepared statement */
7575975751
int cnt = 0; /* Counter to prevent infinite loop of reprepares */
7576075752
sqlite3 *db; /* The database connection */
@@ -75801,11 +75793,11 @@
7580175793
7580275794
/*
7580375795
** Extract the user data from a sqlite3_context structure and return a
7580475796
** pointer to it.
7580575797
*/
75806
-SQLITE_API void *SQLITE_STDCALL sqlite3_user_data(sqlite3_context *p){
75798
+SQLITE_API void *sqlite3_user_data(sqlite3_context *p){
7580775799
assert( p && p->pFunc );
7580875800
return p->pFunc->pUserData;
7580975801
}
7581075802
7581175803
/*
@@ -75816,11 +75808,11 @@
7581675808
** returns a copy of the pointer to the database connection (the 1st
7581775809
** parameter) of the sqlite3_create_function() and
7581875810
** sqlite3_create_function16() routines that originally registered the
7581975811
** application defined function.
7582075812
*/
75821
-SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_context *p){
75813
+SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context *p){
7582275814
assert( p && p->pOut );
7582375815
return p->pOut->db;
7582475816
}
7582575817
7582675818
/*
@@ -75892,11 +75884,11 @@
7589275884
/*
7589375885
** Allocate or return the aggregate context for a user function. A new
7589475886
** context is allocated on the first call. Subsequent calls return the
7589575887
** same context that was returned on prior calls.
7589675888
*/
75897
-SQLITE_API void *SQLITE_STDCALL sqlite3_aggregate_context(sqlite3_context *p, int nByte){
75889
+SQLITE_API void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){
7589875890
assert( p && p->pFunc && p->pFunc->xFinalize );
7589975891
assert( sqlite3_mutex_held(p->pOut->db->mutex) );
7590075892
testcase( nByte<0 );
7590175893
if( (p->pMem->flags & MEM_Agg)==0 ){
7590275894
return createAggContext(p, nByte);
@@ -75907,11 +75899,11 @@
7590775899
7590875900
/*
7590975901
** Return the auxiliary data pointer, if any, for the iArg'th argument to
7591075902
** the user-function defined by pCtx.
7591175903
*/
75912
-SQLITE_API void *SQLITE_STDCALL sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
75904
+SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
7591375905
AuxData *pAuxData;
7591475906
7591575907
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
7591675908
#if SQLITE_ENABLE_STAT3_OR_STAT4
7591775909
if( pCtx->pVdbe==0 ) return 0;
@@ -75928,11 +75920,11 @@
7592875920
/*
7592975921
** Set the auxiliary data pointer and delete function, for the iArg'th
7593075922
** argument to the user-function defined by pCtx. Any previous value is
7593175923
** deleted by calling the delete function specified when it was set.
7593275924
*/
75933
-SQLITE_API void SQLITE_STDCALL sqlite3_set_auxdata(
75925
+SQLITE_API void sqlite3_set_auxdata(
7593475926
sqlite3_context *pCtx,
7593575927
int iArg,
7593675928
void *pAux,
7593775929
void (*xDelete)(void*)
7593875930
){
@@ -75983,29 +75975,29 @@
7598375975
** This function is deprecated. Do not use it for new code. It is
7598475976
** provide only to avoid breaking legacy code. New aggregate function
7598575977
** implementations should keep their own counts within their aggregate
7598675978
** context.
7598775979
*/
75988
-SQLITE_API int SQLITE_STDCALL sqlite3_aggregate_count(sqlite3_context *p){
75980
+SQLITE_API int sqlite3_aggregate_count(sqlite3_context *p){
7598975981
assert( p && p->pMem && p->pFunc && p->pFunc->xFinalize );
7599075982
return p->pMem->n;
7599175983
}
7599275984
#endif
7599375985
7599475986
/*
7599575987
** Return the number of columns in the result set for the statement pStmt.
7599675988
*/
75997
-SQLITE_API int SQLITE_STDCALL sqlite3_column_count(sqlite3_stmt *pStmt){
75989
+SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt){
7599875990
Vdbe *pVm = (Vdbe *)pStmt;
7599975991
return pVm ? pVm->nResColumn : 0;
7600075992
}
7600175993
7600275994
/*
7600375995
** Return the number of values available from the current row of the
7600475996
** currently executing statement pStmt.
7600575997
*/
76006
-SQLITE_API int SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt){
75998
+SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt){
7600775999
Vdbe *pVm = (Vdbe *)pStmt;
7600876000
if( pVm==0 || pVm->pResultSet==0 ) return 0;
7600976001
return pVm->nResColumn;
7601076002
}
7601176003
@@ -76104,67 +76096,67 @@
7610476096
7610576097
/**************************** sqlite3_column_ *******************************
7610676098
** The following routines are used to access elements of the current row
7610776099
** in the result set.
7610876100
*/
76109
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_blob(sqlite3_stmt *pStmt, int i){
76101
+SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt *pStmt, int i){
7611076102
const void *val;
7611176103
val = sqlite3_value_blob( columnMem(pStmt,i) );
7611276104
/* Even though there is no encoding conversion, value_blob() might
7611376105
** need to call malloc() to expand the result of a zeroblob()
7611476106
** expression.
7611576107
*/
7611676108
columnMallocFailure(pStmt);
7611776109
return val;
7611876110
}
76119
-SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes(sqlite3_stmt *pStmt, int i){
76111
+SQLITE_API int sqlite3_column_bytes(sqlite3_stmt *pStmt, int i){
7612076112
int val = sqlite3_value_bytes( columnMem(pStmt,i) );
7612176113
columnMallocFailure(pStmt);
7612276114
return val;
7612376115
}
76124
-SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes16(sqlite3_stmt *pStmt, int i){
76116
+SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt *pStmt, int i){
7612576117
int val = sqlite3_value_bytes16( columnMem(pStmt,i) );
7612676118
columnMallocFailure(pStmt);
7612776119
return val;
7612876120
}
76129
-SQLITE_API double SQLITE_STDCALL sqlite3_column_double(sqlite3_stmt *pStmt, int i){
76121
+SQLITE_API double sqlite3_column_double(sqlite3_stmt *pStmt, int i){
7613076122
double val = sqlite3_value_double( columnMem(pStmt,i) );
7613176123
columnMallocFailure(pStmt);
7613276124
return val;
7613376125
}
76134
-SQLITE_API int SQLITE_STDCALL sqlite3_column_int(sqlite3_stmt *pStmt, int i){
76126
+SQLITE_API int sqlite3_column_int(sqlite3_stmt *pStmt, int i){
7613576127
int val = sqlite3_value_int( columnMem(pStmt,i) );
7613676128
columnMallocFailure(pStmt);
7613776129
return val;
7613876130
}
76139
-SQLITE_API sqlite_int64 SQLITE_STDCALL sqlite3_column_int64(sqlite3_stmt *pStmt, int i){
76131
+SQLITE_API sqlite_int64 sqlite3_column_int64(sqlite3_stmt *pStmt, int i){
7614076132
sqlite_int64 val = sqlite3_value_int64( columnMem(pStmt,i) );
7614176133
columnMallocFailure(pStmt);
7614276134
return val;
7614376135
}
76144
-SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_column_text(sqlite3_stmt *pStmt, int i){
76136
+SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt *pStmt, int i){
7614576137
const unsigned char *val = sqlite3_value_text( columnMem(pStmt,i) );
7614676138
columnMallocFailure(pStmt);
7614776139
return val;
7614876140
}
76149
-SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_column_value(sqlite3_stmt *pStmt, int i){
76141
+SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt *pStmt, int i){
7615076142
Mem *pOut = columnMem(pStmt, i);
7615176143
if( pOut->flags&MEM_Static ){
7615276144
pOut->flags &= ~MEM_Static;
7615376145
pOut->flags |= MEM_Ephem;
7615476146
}
7615576147
columnMallocFailure(pStmt);
7615676148
return (sqlite3_value *)pOut;
7615776149
}
7615876150
#ifndef SQLITE_OMIT_UTF16
76159
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_text16(sqlite3_stmt *pStmt, int i){
76151
+SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt *pStmt, int i){
7616076152
const void *val = sqlite3_value_text16( columnMem(pStmt,i) );
7616176153
columnMallocFailure(pStmt);
7616276154
return val;
7616376155
}
7616476156
#endif /* SQLITE_OMIT_UTF16 */
76165
-SQLITE_API int SQLITE_STDCALL sqlite3_column_type(sqlite3_stmt *pStmt, int i){
76157
+SQLITE_API int sqlite3_column_type(sqlite3_stmt *pStmt, int i){
7616676158
int iType = sqlite3_value_type( columnMem(pStmt,i) );
7616776159
columnMallocFailure(pStmt);
7616876160
return iType;
7616976161
}
7617076162
@@ -76224,16 +76216,16 @@
7622476216
7622576217
/*
7622676218
** Return the name of the Nth column of the result set returned by SQL
7622776219
** statement pStmt.
7622876220
*/
76229
-SQLITE_API const char *SQLITE_STDCALL sqlite3_column_name(sqlite3_stmt *pStmt, int N){
76221
+SQLITE_API const char *sqlite3_column_name(sqlite3_stmt *pStmt, int N){
7623076222
return columnName(
7623176223
pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_NAME);
7623276224
}
7623376225
#ifndef SQLITE_OMIT_UTF16
76234
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_name16(sqlite3_stmt *pStmt, int N){
76226
+SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){
7623576227
return columnName(
7623676228
pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_NAME);
7623776229
}
7623876230
#endif
7623976231
@@ -76249,16 +76241,16 @@
7624976241
#ifndef SQLITE_OMIT_DECLTYPE
7625076242
/*
7625176243
** Return the column declaration type (if applicable) of the 'i'th column
7625276244
** of the result set of SQL statement pStmt.
7625376245
*/
76254
-SQLITE_API const char *SQLITE_STDCALL sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){
76246
+SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){
7625576247
return columnName(
7625676248
pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DECLTYPE);
7625776249
}
7625876250
#ifndef SQLITE_OMIT_UTF16
76259
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){
76251
+SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){
7626076252
return columnName(
7626176253
pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DECLTYPE);
7626276254
}
7626376255
#endif /* SQLITE_OMIT_UTF16 */
7626476256
#endif /* SQLITE_OMIT_DECLTYPE */
@@ -76267,16 +76259,16 @@
7626776259
/*
7626876260
** Return the name of the database from which a result column derives.
7626976261
** NULL is returned if the result column is an expression or constant or
7627076262
** anything else which is not an unambiguous reference to a database column.
7627176263
*/
76272
-SQLITE_API const char *SQLITE_STDCALL sqlite3_column_database_name(sqlite3_stmt *pStmt, int N){
76264
+SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt *pStmt, int N){
7627376265
return columnName(
7627476266
pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DATABASE);
7627576267
}
7627676268
#ifndef SQLITE_OMIT_UTF16
76277
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N){
76269
+SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N){
7627876270
return columnName(
7627976271
pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DATABASE);
7628076272
}
7628176273
#endif /* SQLITE_OMIT_UTF16 */
7628276274
@@ -76283,16 +76275,16 @@
7628376275
/*
7628476276
** Return the name of the table from which a result column derives.
7628576277
** NULL is returned if the result column is an expression or constant or
7628676278
** anything else which is not an unambiguous reference to a database column.
7628776279
*/
76288
-SQLITE_API const char *SQLITE_STDCALL sqlite3_column_table_name(sqlite3_stmt *pStmt, int N){
76280
+SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt *pStmt, int N){
7628976281
return columnName(
7629076282
pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_TABLE);
7629176283
}
7629276284
#ifndef SQLITE_OMIT_UTF16
76293
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){
76285
+SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){
7629476286
return columnName(
7629576287
pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_TABLE);
7629676288
}
7629776289
#endif /* SQLITE_OMIT_UTF16 */
7629876290
@@ -76299,16 +76291,16 @@
7629976291
/*
7630076292
** Return the name of the table column from which a result column derives.
7630176293
** NULL is returned if the result column is an expression or constant or
7630276294
** anything else which is not an unambiguous reference to a database column.
7630376295
*/
76304
-SQLITE_API const char *SQLITE_STDCALL sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N){
76296
+SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N){
7630576297
return columnName(
7630676298
pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_COLUMN);
7630776299
}
7630876300
#ifndef SQLITE_OMIT_UTF16
76309
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){
76301
+SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){
7631076302
return columnName(
7631176303
pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_COLUMN);
7631276304
}
7631376305
#endif /* SQLITE_OMIT_UTF16 */
7631476306
#endif /* SQLITE_ENABLE_COLUMN_METADATA */
@@ -76405,11 +76397,11 @@
7640576397
7640676398
7640776399
/*
7640876400
** Bind a blob value to an SQL statement variable.
7640976401
*/
76410
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob(
76402
+SQLITE_API int sqlite3_bind_blob(
7641176403
sqlite3_stmt *pStmt,
7641276404
int i,
7641376405
const void *zData,
7641476406
int nData,
7641576407
void (*xDel)(void*)
@@ -76417,11 +76409,11 @@
7641776409
#ifdef SQLITE_ENABLE_API_ARMOR
7641876410
if( nData<0 ) return SQLITE_MISUSE_BKPT;
7641976411
#endif
7642076412
return bindText(pStmt, i, zData, nData, xDel, 0);
7642176413
}
76422
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob64(
76414
+SQLITE_API int sqlite3_bind_blob64(
7642376415
sqlite3_stmt *pStmt,
7642476416
int i,
7642576417
const void *zData,
7642676418
sqlite3_uint64 nData,
7642776419
void (*xDel)(void*)
@@ -76431,52 +76423,52 @@
7643176423
return invokeValueDestructor(zData, xDel, 0);
7643276424
}else{
7643376425
return bindText(pStmt, i, zData, (int)nData, xDel, 0);
7643476426
}
7643576427
}
76436
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_double(sqlite3_stmt *pStmt, int i, double rValue){
76428
+SQLITE_API int sqlite3_bind_double(sqlite3_stmt *pStmt, int i, double rValue){
7643776429
int rc;
7643876430
Vdbe *p = (Vdbe *)pStmt;
7643976431
rc = vdbeUnbind(p, i);
7644076432
if( rc==SQLITE_OK ){
7644176433
sqlite3VdbeMemSetDouble(&p->aVar[i-1], rValue);
7644276434
sqlite3_mutex_leave(p->db->mutex);
7644376435
}
7644476436
return rc;
7644576437
}
76446
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_int(sqlite3_stmt *p, int i, int iValue){
76438
+SQLITE_API int sqlite3_bind_int(sqlite3_stmt *p, int i, int iValue){
7644776439
return sqlite3_bind_int64(p, i, (i64)iValue);
7644876440
}
76449
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_int64(sqlite3_stmt *pStmt, int i, sqlite_int64 iValue){
76441
+SQLITE_API int sqlite3_bind_int64(sqlite3_stmt *pStmt, int i, sqlite_int64 iValue){
7645076442
int rc;
7645176443
Vdbe *p = (Vdbe *)pStmt;
7645276444
rc = vdbeUnbind(p, i);
7645376445
if( rc==SQLITE_OK ){
7645476446
sqlite3VdbeMemSetInt64(&p->aVar[i-1], iValue);
7645576447
sqlite3_mutex_leave(p->db->mutex);
7645676448
}
7645776449
return rc;
7645876450
}
76459
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_null(sqlite3_stmt *pStmt, int i){
76451
+SQLITE_API int sqlite3_bind_null(sqlite3_stmt *pStmt, int i){
7646076452
int rc;
7646176453
Vdbe *p = (Vdbe*)pStmt;
7646276454
rc = vdbeUnbind(p, i);
7646376455
if( rc==SQLITE_OK ){
7646476456
sqlite3_mutex_leave(p->db->mutex);
7646576457
}
7646676458
return rc;
7646776459
}
76468
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_text(
76460
+SQLITE_API int sqlite3_bind_text(
7646976461
sqlite3_stmt *pStmt,
7647076462
int i,
7647176463
const char *zData,
7647276464
int nData,
7647376465
void (*xDel)(void*)
7647476466
){
7647576467
return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF8);
7647676468
}
76477
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_text64(
76469
+SQLITE_API int sqlite3_bind_text64(
7647876470
sqlite3_stmt *pStmt,
7647976471
int i,
7648076472
const char *zData,
7648176473
sqlite3_uint64 nData,
7648276474
void (*xDel)(void*),
@@ -76489,21 +76481,21 @@
7648976481
if( enc==SQLITE_UTF16 ) enc = SQLITE_UTF16NATIVE;
7649076482
return bindText(pStmt, i, zData, (int)nData, xDel, enc);
7649176483
}
7649276484
}
7649376485
#ifndef SQLITE_OMIT_UTF16
76494
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_text16(
76486
+SQLITE_API int sqlite3_bind_text16(
7649576487
sqlite3_stmt *pStmt,
7649676488
int i,
7649776489
const void *zData,
7649876490
int nData,
7649976491
void (*xDel)(void*)
7650076492
){
7650176493
return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF16NATIVE);
7650276494
}
7650376495
#endif /* SQLITE_OMIT_UTF16 */
76504
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_value(sqlite3_stmt *pStmt, int i, const sqlite3_value *pValue){
76496
+SQLITE_API int sqlite3_bind_value(sqlite3_stmt *pStmt, int i, const sqlite3_value *pValue){
7650576497
int rc;
7650676498
switch( sqlite3_value_type((sqlite3_value*)pValue) ){
7650776499
case SQLITE_INTEGER: {
7650876500
rc = sqlite3_bind_int64(pStmt, i, pValue->u.i);
7650976501
break;
@@ -76530,21 +76522,21 @@
7653076522
break;
7653176523
}
7653276524
}
7653376525
return rc;
7653476526
}
76535
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){
76527
+SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){
7653676528
int rc;
7653776529
Vdbe *p = (Vdbe *)pStmt;
7653876530
rc = vdbeUnbind(p, i);
7653976531
if( rc==SQLITE_OK ){
7654076532
sqlite3VdbeMemSetZeroBlob(&p->aVar[i-1], n);
7654176533
sqlite3_mutex_leave(p->db->mutex);
7654276534
}
7654376535
return rc;
7654476536
}
76545
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob64(sqlite3_stmt *pStmt, int i, sqlite3_uint64 n){
76537
+SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt *pStmt, int i, sqlite3_uint64 n){
7654676538
int rc;
7654776539
Vdbe *p = (Vdbe *)pStmt;
7654876540
sqlite3_mutex_enter(p->db->mutex);
7654976541
if( n>(u64)p->db->aLimit[SQLITE_LIMIT_LENGTH] ){
7655076542
rc = SQLITE_TOOBIG;
@@ -76559,11 +76551,11 @@
7655976551
7656076552
/*
7656176553
** Return the number of wildcards that can be potentially bound to.
7656276554
** This routine is added to support DBD::SQLite.
7656376555
*/
76564
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){
76556
+SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){
7656576557
Vdbe *p = (Vdbe*)pStmt;
7656676558
return p ? p->nVar : 0;
7656776559
}
7656876560
7656976561
/*
@@ -76570,11 +76562,11 @@
7657076562
** Return the name of a wildcard parameter. Return NULL if the index
7657176563
** is out of range or if the wildcard is unnamed.
7657276564
**
7657376565
** The result is always UTF-8.
7657476566
*/
76575
-SQLITE_API const char *SQLITE_STDCALL sqlite3_bind_parameter_name(sqlite3_stmt *pStmt, int i){
76567
+SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt *pStmt, int i){
7657676568
Vdbe *p = (Vdbe*)pStmt;
7657776569
if( p==0 || i<1 || i>p->nzVar ){
7657876570
return 0;
7657976571
}
7658076572
return p->azVar[i-1];
@@ -76598,11 +76590,11 @@
7659876590
}
7659976591
}
7660076592
}
7660176593
return 0;
7660276594
}
76603
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const char *zName){
76595
+SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const char *zName){
7660476596
return sqlite3VdbeParameterIndex((Vdbe*)pStmt, zName, sqlite3Strlen30(zName));
7660576597
}
7660676598
7660776599
/*
7660876600
** Transfer all bindings from the first statement over to the second.
@@ -76632,11 +76624,11 @@
7663276624
**
7663376625
** If the two statements contain a different number of bindings, then
7663476626
** an SQLITE_ERROR is returned. Nothing else can go wrong, so otherwise
7663576627
** SQLITE_OK is returned.
7663676628
*/
76637
-SQLITE_API int SQLITE_STDCALL sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){
76629
+SQLITE_API int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){
7663876630
Vdbe *pFrom = (Vdbe*)pFromStmt;
7663976631
Vdbe *pTo = (Vdbe*)pToStmt;
7664076632
if( pFrom->nVar!=pTo->nVar ){
7664176633
return SQLITE_ERROR;
7664276634
}
@@ -76654,26 +76646,26 @@
7665476646
** Return the sqlite3* database handle to which the prepared statement given
7665576647
** in the argument belongs. This is the same database handle that was
7665676648
** the first argument to the sqlite3_prepare() that was used to create
7665776649
** the statement in the first place.
7665876650
*/
76659
-SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_db_handle(sqlite3_stmt *pStmt){
76651
+SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt *pStmt){
7666076652
return pStmt ? ((Vdbe*)pStmt)->db : 0;
7666176653
}
7666276654
7666376655
/*
7666476656
** Return true if the prepared statement is guaranteed to not modify the
7666576657
** database.
7666676658
*/
76667
-SQLITE_API int SQLITE_STDCALL sqlite3_stmt_readonly(sqlite3_stmt *pStmt){
76659
+SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt){
7666876660
return pStmt ? ((Vdbe*)pStmt)->readOnly : 1;
7666976661
}
7667076662
7667176663
/*
7667276664
** Return true if the prepared statement is in need of being reset.
7667376665
*/
76674
-SQLITE_API int SQLITE_STDCALL sqlite3_stmt_busy(sqlite3_stmt *pStmt){
76666
+SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt *pStmt){
7667576667
Vdbe *v = (Vdbe*)pStmt;
7667676668
return v!=0 && v->pc>=0 && v->magic==VDBE_MAGIC_RUN;
7667776669
}
7667876670
7667976671
/*
@@ -76680,11 +76672,11 @@
7668076672
** Return a pointer to the next prepared statement after pStmt associated
7668176673
** with database connection pDb. If pStmt is NULL, return the first
7668276674
** prepared statement for the database connection. Return NULL if there
7668376675
** are no more.
7668476676
*/
76685
-SQLITE_API sqlite3_stmt *SQLITE_STDCALL sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt){
76677
+SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt){
7668676678
sqlite3_stmt *pNext;
7668776679
#ifdef SQLITE_ENABLE_API_ARMOR
7668876680
if( !sqlite3SafetyCheckOk(pDb) ){
7668976681
(void)SQLITE_MISUSE_BKPT;
7669076682
return 0;
@@ -76701,11 +76693,11 @@
7670176693
}
7670276694
7670376695
/*
7670476696
** Return the value of a status counter for a prepared statement
7670576697
*/
76706
-SQLITE_API int SQLITE_STDCALL sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){
76698
+SQLITE_API int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){
7670776699
Vdbe *pVdbe = (Vdbe*)pStmt;
7670876700
u32 v;
7670976701
#ifdef SQLITE_ENABLE_API_ARMOR
7671076702
if( !pStmt ){
7671176703
(void)SQLITE_MISUSE_BKPT;
@@ -76718,11 +76710,11 @@
7671876710
}
7671976711
7672076712
/*
7672176713
** Return the SQL associated with a prepared statement
7672276714
*/
76723
-SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt){
76715
+SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt){
7672476716
Vdbe *p = (Vdbe *)pStmt;
7672576717
return p ? p->zSql : 0;
7672676718
}
7672776719
7672876720
/*
@@ -76732,11 +76724,11 @@
7673276724
** freeing the returned string by passing it to sqlite3_free().
7673376725
**
7673476726
** The SQLITE_TRACE_SIZE_LIMIT puts an upper bound on the size of
7673576727
** expanded bound parameters.
7673676728
*/
76737
-SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt){
76729
+SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt){
7673876730
#ifdef SQLITE_OMIT_TRACE
7673976731
return 0;
7674076732
#else
7674176733
char *z = 0;
7674276734
const char *zSql = sqlite3_sql(pStmt);
@@ -76774,11 +76766,11 @@
7677476766
7677576767
/*
7677676768
** This function is called from within a pre-update callback to retrieve
7677776769
** a field of the row currently being updated or deleted.
7677876770
*/
76779
-SQLITE_API int SQLITE_STDCALL sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppValue){
76771
+SQLITE_API int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppValue){
7678076772
PreUpdate *p = db->pPreUpdate;
7678176773
int rc = SQLITE_OK;
7678276774
7678376775
/* Test that this call is being made from within an SQLITE_DELETE or
7678476776
** SQLITE_UPDATE pre-update callback, and that iIdx is within range. */
@@ -76829,11 +76821,11 @@
7682976821
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
7683076822
/*
7683176823
** This function is called from within a pre-update callback to retrieve
7683276824
** the number of columns in the row being updated, deleted or inserted.
7683376825
*/
76834
-SQLITE_API int SQLITE_STDCALL sqlite3_preupdate_count(sqlite3 *db){
76826
+SQLITE_API int sqlite3_preupdate_count(sqlite3 *db){
7683576827
PreUpdate *p = db->pPreUpdate;
7683676828
return (p ? p->keyinfo.nField : 0);
7683776829
}
7683876830
#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
7683976831
@@ -76847,11 +76839,11 @@
7684776839
** top-level trigger etc.).
7684876840
**
7684976841
** For the purposes of the previous paragraph, a foreign key CASCADE, SET NULL
7685076842
** or SET DEFAULT action is considered a trigger.
7685176843
*/
76852
-SQLITE_API int SQLITE_STDCALL sqlite3_preupdate_depth(sqlite3 *db){
76844
+SQLITE_API int sqlite3_preupdate_depth(sqlite3 *db){
7685376845
PreUpdate *p = db->pPreUpdate;
7685476846
return (p ? p->v->nFrame : 0);
7685576847
}
7685676848
#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
7685776849
@@ -76858,11 +76850,11 @@
7685876850
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
7685976851
/*
7686076852
** This function is called from within a pre-update callback to retrieve
7686176853
** a field of the row currently being updated or inserted.
7686276854
*/
76863
-SQLITE_API int SQLITE_STDCALL sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppValue){
76855
+SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppValue){
7686476856
PreUpdate *p = db->pPreUpdate;
7686576857
int rc = SQLITE_OK;
7686676858
Mem *pMem;
7686776859
7686876860
if( !p || p->op==SQLITE_DELETE ){
@@ -76878,11 +76870,11 @@
7687876870
/* For an INSERT, memory cell p->iNewReg contains the serialized record
7687976871
** that is being inserted. Deserialize it. */
7688076872
UnpackedRecord *pUnpack = p->pNewUnpacked;
7688176873
if( !pUnpack ){
7688276874
Mem *pData = &p->v->aMem[p->iNewReg];
76883
- rc = sqlite3VdbeMemExpandBlob(pData);
76875
+ rc = ExpandBlob(pData);
7688476876
if( rc!=SQLITE_OK ) goto preupdate_new_out;
7688576877
pUnpack = vdbeUnpackRecord(&p->keyinfo, pData->n, pData->z);
7688676878
if( !pUnpack ){
7688776879
rc = SQLITE_NOMEM;
7688876880
goto preupdate_new_out;
@@ -76932,11 +76924,11 @@
7693276924
7693376925
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
7693476926
/*
7693576927
** Return status data for a single loop within query pStmt.
7693676928
*/
76937
-SQLITE_API int SQLITE_STDCALL sqlite3_stmt_scanstatus(
76929
+SQLITE_API int sqlite3_stmt_scanstatus(
7693876930
sqlite3_stmt *pStmt, /* Prepared statement being queried */
7693976931
int idx, /* Index of loop to report on */
7694076932
int iScanStatusOp, /* Which metric to return */
7694176933
void *pOut /* OUT: Write the answer here */
7694276934
){
@@ -76991,11 +76983,11 @@
7699176983
}
7699276984
7699376985
/*
7699476986
** Zero all counters associated with the sqlite3_stmt_scanstatus() data.
7699576987
*/
76996
-SQLITE_API void SQLITE_STDCALL sqlite3_stmt_scanstatus_reset(sqlite3_stmt *pStmt){
76988
+SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt *pStmt){
7699776989
Vdbe *p = (Vdbe*)pStmt;
7699876990
memset(p->anExec, 0, p->nOp * sizeof(i64));
7699976991
}
7700076992
#endif /* SQLITE_ENABLE_STMT_SCANSTATUS */
7700176993
@@ -77518,11 +77510,11 @@
7751877510
** Try to convert the type of a function argument or a result column
7751977511
** into a numeric representation. Use either INTEGER or REAL whichever
7752077512
** is appropriate. But only do the conversion if it is possible without
7752177513
** loss of information and return the revised type of the argument.
7752277514
*/
77523
-SQLITE_API int SQLITE_STDCALL sqlite3_value_numeric_type(sqlite3_value *pVal){
77515
+SQLITE_API int sqlite3_value_numeric_type(sqlite3_value *pVal){
7752477516
int eType = sqlite3_value_type(pVal);
7752577517
if( eType==SQLITE_TEXT ){
7752677518
Mem *pMem = (Mem*)pVal;
7752777519
applyNumericAffinity(pMem, 0);
7752877520
eType = sqlite3_value_type(pVal);
@@ -79344,12 +79336,11 @@
7934479336
testcase( pIn1->flags & MEM_Int );
7934579337
testcase( pIn1->flags & MEM_Real );
7934679338
sqlite3VdbeMemStringify(pIn1, encoding, 1);
7934779339
testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) );
7934879340
flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask);
79349
- testcase( flags3!=pIn3->flags ); /* Possible if pIn1==pIn3 */
79350
- flags3 = pIn3->flags;
79341
+ assert( pIn1!=pIn3 );
7935179342
}
7935279343
if( (flags3 & MEM_Str)==0 && (flags3 & (MEM_Int|MEM_Real))!=0 ){
7935379344
testcase( pIn3->flags & MEM_Int );
7935479345
testcase( pIn3->flags & MEM_Real );
7935579346
sqlite3VdbeMemStringify(pIn3, encoding, 1);
@@ -79409,15 +79400,15 @@
7940979400
break;
7941079401
}
7941179402
7941279403
/* Opcode: ElseNotEq * P2 * * *
7941379404
**
79414
-** This opcode must immediately follow an Lt or Gt comparison operator.
79415
-** If the operands in that previous comparison had been used with an Eq
79416
-** operator and if the result of that Eq would be NULL or false (0), then
79417
-** then jump to P2. If the result of comparing the two previous operands
79418
-** using Eq would have been true (1), then fall through.
79405
+** This opcode must immediately follow an OP_Lt or OP_Gt comparison operator.
79406
+** If result of an OP_Eq comparison on the same two operands
79407
+** would have be NULL or false (0), then then jump to P2.
79408
+** If the result of an OP_Eq comparison on the two previous operands
79409
+** would have been true (1), then fall through.
7941979410
*/
7942079411
case OP_ElseNotEq: { /* same as TK_ESCAPE, jump */
7942179412
assert( pOp>aOp );
7942279413
assert( pOp[-1].opcode==OP_Lt || pOp[-1].opcode==OP_Gt );
7942379414
assert( pOp[-1].p5 & SQLITE_STOREP2 );
@@ -79620,26 +79611,22 @@
7962079611
break;
7962179612
}
7962279613
7962379614
/* Opcode: Once P1 P2 * * *
7962479615
**
79625
-** Check the "once" flag number P1. If it is set, jump to instruction P2.
79626
-** Otherwise, set the flag and fall through to the next instruction.
79627
-** In other words, this opcode causes all following opcodes up through P2
79628
-** (but not including P2) to run just once and to be skipped on subsequent
79629
-** times through the loop.
79630
-**
79631
-** All "once" flags are initially cleared whenever a prepared statement
79632
-** first begins to run.
79616
+** If the P1 value is equal to the P1 value on the OP_Init opcode at
79617
+** instruction 0, then jump to P2. If the two P1 values differ, then
79618
+** set the P1 value on this opcode to equal the P1 value on the OP_Init
79619
+** and fall through.
7963379620
*/
7963479621
case OP_Once: { /* jump */
79635
- assert( pOp->p1<p->nOnceFlag );
79636
- VdbeBranchTaken(p->aOnceFlag[pOp->p1]!=0, 2);
79637
- if( p->aOnceFlag[pOp->p1] ){
79622
+ assert( p->aOp[0].opcode==OP_Init );
79623
+ VdbeBranchTaken(p->aOp[0].p1==pOp->p1, 2);
79624
+ if( p->aOp[0].p1==pOp->p1 ){
7963879625
goto jump_to_p2;
7963979626
}else{
79640
- p->aOnceFlag[pOp->p1] = 1;
79627
+ pOp->p1 = p->aOp[0].p1;
7964179628
}
7964279629
break;
7964379630
}
7964479631
7964579632
/* Opcode: If P1 P2 P3 * *
@@ -80468,16 +80455,16 @@
8046880455
8046980456
if( pBt ){
8047080457
rc = sqlite3BtreeBeginTrans(pBt, pOp->p2);
8047180458
testcase( rc==SQLITE_BUSY_SNAPSHOT );
8047280459
testcase( rc==SQLITE_BUSY_RECOVERY );
80473
- if( (rc&0xff)==SQLITE_BUSY ){
80474
- p->pc = (int)(pOp - aOp);
80475
- p->rc = rc;
80476
- goto vdbe_return;
80477
- }
8047880460
if( rc!=SQLITE_OK ){
80461
+ if( (rc&0xff)==SQLITE_BUSY ){
80462
+ p->pc = (int)(pOp - aOp);
80463
+ p->rc = rc;
80464
+ goto vdbe_return;
80465
+ }
8047980466
goto abort_due_to_error;
8048080467
}
8048180468
8048280469
if( pOp->p2 && p->usesStmtJournal
8048380470
&& (db->autoCommit==0 || db->nVdbeRead>1)
@@ -81164,11 +81151,10 @@
8116481151
8116581152
r.aMem = &aMem[pOp->p3];
8116681153
#ifdef SQLITE_DEBUG
8116781154
{ int i; for(i=0; i<r.nField; i++) assert( memIsValid(&r.aMem[i]) ); }
8116881155
#endif
81169
- (void)ExpandBlob(r.aMem);
8117081156
r.eqSeen = 0;
8117181157
rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, &r, 0, 0, &res);
8117281158
if( rc!=SQLITE_OK ){
8117381159
goto abort_due_to_error;
8117481160
}
@@ -81305,17 +81291,17 @@
8130581291
pFree = 0;
8130681292
if( pOp->p4.i>0 ){
8130781293
r.pKeyInfo = pC->pKeyInfo;
8130881294
r.nField = (u16)pOp->p4.i;
8130981295
r.aMem = pIn3;
81296
+#ifdef SQLITE_DEBUG
8131081297
for(ii=0; ii<r.nField; ii++){
8131181298
assert( memIsValid(&r.aMem[ii]) );
81312
- (void)ExpandBlob(&r.aMem[ii]);
81313
-#ifdef SQLITE_DEBUG
81299
+ assert( (r.aMem[ii].flags & MEM_Zero)==0 || r.aMem[ii].n==0 );
8131481300
if( ii ) REGISTER_TRACE(pOp->p3+ii, &r.aMem[ii]);
81301
+ }
8131581302
#endif
81316
- }
8131781303
pIdxKey = &r;
8131881304
}else{
8131981305
pIdxKey = sqlite3VdbeAllocUnpackedRecord(
8132081306
pC->pKeyInfo, aTempRec, sizeof(aTempRec), &pFree
8132181307
);
@@ -83078,12 +83064,11 @@
8307883064
nMem = pProgram->nMem + pProgram->nCsr;
8307983065
assert( nMem>0 );
8308083066
if( pProgram->nCsr==0 ) nMem++;
8308183067
nByte = ROUND8(sizeof(VdbeFrame))
8308283068
+ nMem * sizeof(Mem)
83083
- + pProgram->nCsr * sizeof(VdbeCursor *)
83084
- + pProgram->nOnce * sizeof(u8);
83069
+ + pProgram->nCsr * sizeof(VdbeCursor *);
8308583070
pFrame = sqlite3DbMallocZero(db, nByte);
8308683071
if( !pFrame ){
8308783072
goto no_mem;
8308883073
}
8308983074
sqlite3VdbeMemRelease(pRt);
@@ -83099,12 +83084,10 @@
8309983084
pFrame->apCsr = p->apCsr;
8310083085
pFrame->nCursor = p->nCursor;
8310183086
pFrame->aOp = p->aOp;
8310283087
pFrame->nOp = p->nOp;
8310383088
pFrame->token = pProgram->token;
83104
- pFrame->aOnceFlag = p->aOnceFlag;
83105
- pFrame->nOnceFlag = p->nOnceFlag;
8310683089
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
8310783090
pFrame->anExec = p->anExec;
8310883091
#endif
8310983092
8311083093
pEnd = &VdbeFrameMem(pFrame)[pFrame->nChildMem];
@@ -83134,17 +83117,14 @@
8313483117
p->nMem = pFrame->nChildMem;
8313583118
p->nCursor = (u16)pFrame->nChildCsr;
8313683119
p->apCsr = (VdbeCursor **)&aMem[p->nMem];
8313783120
p->aOp = aOp = pProgram->aOp;
8313883121
p->nOp = pProgram->nOp;
83139
- p->aOnceFlag = (u8 *)&p->apCsr[p->nCursor];
83140
- p->nOnceFlag = pProgram->nOnce;
8314183122
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
8314283123
p->anExec = 0;
8314383124
#endif
8314483125
pOp = &aOp[-1];
83145
- memset(p->aOnceFlag, 0, p->nOnceFlag);
8314683126
8314783127
break;
8314883128
}
8314983129
8315083130
/* Opcode: Param P1 P2 * * *
@@ -84107,11 +84087,11 @@
8410784087
break;
8410884088
}
8410984089
#endif
8411084090
8411184091
84112
-/* Opcode: Init * P2 * P4 *
84092
+/* Opcode: Init P1 P2 * P4 *
8411384093
** Synopsis: Start at P2
8411484094
**
8411584095
** Programs contain a single instance of this opcode as the very first
8411684096
** opcode.
8411784097
**
@@ -84118,13 +84098,17 @@
8411884098
** If tracing is enabled (by the sqlite3_trace()) interface, then
8411984099
** the UTF-8 string contained in P4 is emitted on the trace callback.
8412084100
** Or if P4 is blank, use the string returned by sqlite3_sql().
8412184101
**
8412284102
** If P2 is not zero, jump to instruction P2.
84103
+**
84104
+** Increment the value of P1 so that OP_Once opcodes will jump the
84105
+** first time they are evaluated for this run.
8412384106
*/
8412484107
case OP_Init: { /* jump */
8412584108
char *zTrace;
84109
+ int i;
8412684110
8412784111
/* If the P4 argument is not NULL, then it must be an SQL comment string.
8412884112
** The "--" string is broken up to prevent false-positives with srcck1.c.
8412984113
**
8413084114
** This assert() provides evidence for:
@@ -84132,10 +84116,11 @@
8413284116
** would have been returned by the legacy sqlite3_trace() interface by
8413384117
** using the X argument when X begins with "--" and invoking
8413484118
** sqlite3_expanded_sql(P) otherwise.
8413584119
*/
8413684120
assert( pOp->p4.z==0 || strncmp(pOp->p4.z, "-" "- ", 3)==0 );
84121
+ assert( pOp==p->aOp ); /* Always instruction 0 */
8413784122
8413884123
#ifndef SQLITE_OMIT_TRACE
8413984124
if( (db->mTrace & (SQLITE_TRACE_STMT|SQLITE_TRACE_LEGACY))!=0
8414084125
&& !p->doingRerun
8414184126
&& (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0
@@ -84153,14 +84138,14 @@
8415384138
}
8415484139
}
8415584140
#ifdef SQLITE_USE_FCNTL_TRACE
8415684141
zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql);
8415784142
if( zTrace ){
84158
- int i;
84159
- for(i=0; i<db->nDb; i++){
84160
- if( DbMaskTest(p->btreeMask, i)==0 ) continue;
84161
- sqlite3_file_control(db, db->aDb[i].zDbSName, SQLITE_FCNTL_TRACE, zTrace);
84143
+ int j;
84144
+ for(j=0; j<db->nDb; j++){
84145
+ if( DbMaskTest(p->btreeMask, j)==0 ) continue;
84146
+ sqlite3_file_control(db, db->aDb[j].zDbSName, SQLITE_FCNTL_TRACE, zTrace);
8416284147
}
8416384148
}
8416484149
#endif /* SQLITE_USE_FCNTL_TRACE */
8416584150
#ifdef SQLITE_DEBUG
8416684151
if( (db->flags & SQLITE_SqlTrace)!=0
@@ -84169,10 +84154,17 @@
8416984154
sqlite3DebugPrintf("SQL-trace: %s\n", zTrace);
8417084155
}
8417184156
#endif /* SQLITE_DEBUG */
8417284157
#endif /* SQLITE_OMIT_TRACE */
8417384158
assert( pOp->p2>0 );
84159
+ if( pOp->p1>=sqlite3GlobalConfig.iOnceResetThreshold ){
84160
+ for(i=1; i<p->nOp; i++){
84161
+ if( p->aOp[i].opcode==OP_Once ) p->aOp[i].p1 = 0;
84162
+ }
84163
+ pOp->p1 = 0;
84164
+ }
84165
+ pOp->p1++;
8417484166
goto jump_to_p2;
8417584167
}
8417684168
8417784169
#ifdef SQLITE_ENABLE_CURSOR_HINTS
8417884170
/* Opcode: CursorHint P1 * * P4 *
@@ -84422,11 +84414,11 @@
8442284414
}
8442384415
8442484416
/*
8442584417
** Open a blob handle.
8442684418
*/
84427
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_open(
84419
+SQLITE_API int sqlite3_blob_open(
8442884420
sqlite3* db, /* The database connection */
8442984421
const char *zDb, /* The attached database containing the blob */
8443084422
const char *zTable, /* The table containing the blob */
8443184423
const char *zColumn, /* The column containing the blob */
8443284424
sqlite_int64 iRow, /* The row containing the glob */
@@ -84663,11 +84655,11 @@
8466384655
8466484656
/*
8466584657
** Close a blob handle that was previously created using
8466684658
** sqlite3_blob_open().
8466784659
*/
84668
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_close(sqlite3_blob *pBlob){
84660
+SQLITE_API int sqlite3_blob_close(sqlite3_blob *pBlob){
8466984661
Incrblob *p = (Incrblob *)pBlob;
8467084662
int rc;
8467184663
sqlite3 *db;
8467284664
8467384665
if( p ){
@@ -84756,28 +84748,28 @@
8475684748
}
8475784749
8475884750
/*
8475984751
** Read data from a blob handle.
8476084752
*/
84761
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_read(sqlite3_blob *pBlob, void *z, int n, int iOffset){
84753
+SQLITE_API int sqlite3_blob_read(sqlite3_blob *pBlob, void *z, int n, int iOffset){
8476284754
return blobReadWrite(pBlob, z, n, iOffset, sqlite3BtreeData);
8476384755
}
8476484756
8476584757
/*
8476684758
** Write data to a blob handle.
8476784759
*/
84768
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_write(sqlite3_blob *pBlob, const void *z, int n, int iOffset){
84760
+SQLITE_API int sqlite3_blob_write(sqlite3_blob *pBlob, const void *z, int n, int iOffset){
8476984761
return blobReadWrite(pBlob, (void *)z, n, iOffset, sqlite3BtreePutData);
8477084762
}
8477184763
8477284764
/*
8477384765
** Query a blob handle for the size of the data.
8477484766
**
8477584767
** The Incrblob.nByte field is fixed for the lifetime of the Incrblob
8477684768
** so no mutex is required for access.
8477784769
*/
84778
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_bytes(sqlite3_blob *pBlob){
84770
+SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *pBlob){
8477984771
Incrblob *p = (Incrblob *)pBlob;
8478084772
return (p && p->pStmt) ? p->nByte : 0;
8478184773
}
8478284774
8478384775
/*
@@ -84788,11 +84780,11 @@
8478884780
** contain a blob or text value, then an error code is returned and the
8478984781
** database handle error code and message set. If this happens, then all
8479084782
** subsequent calls to sqlite3_blob_xxx() functions (except blob_close())
8479184783
** immediately return SQLITE_ABORT.
8479284784
*/
84793
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_reopen(sqlite3_blob *pBlob, sqlite3_int64 iRow){
84785
+SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *pBlob, sqlite3_int64 iRow){
8479484786
int rc;
8479584787
Incrblob *p = (Incrblob *)pBlob;
8479684788
sqlite3 *db;
8479784789
8479884790
if( p==0 ) return SQLITE_MISUSE_BKPT;
@@ -88049,11 +88041,11 @@
8804988041
if( rc || ExprHasProperty(pExpr,EP_TokenOnly) ) return rc & WRC_Abort;
8805088042
if( pExpr->pLeft && walkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;
8805188043
if( pExpr->pRight && walkExpr(pWalker, pExpr->pRight) ) return WRC_Abort;
8805288044
if( ExprHasProperty(pExpr, EP_xIsSelect) ){
8805388045
if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;
88054
- }else{
88046
+ }else if( pExpr->x.pList ){
8805588047
if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
8805688048
}
8805788049
return WRC_Continue;
8805888050
}
8805988051
SQLITE_PRIVATE int sqlite3WalkExpr(Walker *pWalker, Expr *pExpr){
@@ -88811,11 +88803,10 @@
8881188803
ExprList *pList = pExpr->x.pList; /* The argument list */
8881288804
int n = pList ? pList->nExpr : 0; /* Number of arguments */
8881388805
int no_such_func = 0; /* True if no such function exists */
8881488806
int wrong_num_args = 0; /* True if wrong number of arguments */
8881588807
int is_agg = 0; /* True if is an aggregate function */
88816
- int auth; /* Authorization to use the function */
8881788808
int nId; /* Number of characters in function name */
8881888809
const char *zId; /* The function name. */
8881988810
FuncDef *pDef; /* Information about the function */
8882088811
u8 enc = ENC(pParse->db); /* The database encoding */
8882188812
@@ -88855,19 +88846,21 @@
8885588846
/* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */
8885688847
pExpr->iTable = pDef->zName[0]=='u' ? 8388608 : 125829120;
8885788848
}
8885888849
}
8885988850
#ifndef SQLITE_OMIT_AUTHORIZATION
88860
- auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0, pDef->zName, 0);
88861
- if( auth!=SQLITE_OK ){
88862
- if( auth==SQLITE_DENY ){
88863
- sqlite3ErrorMsg(pParse, "not authorized to use function: %s",
88864
- pDef->zName);
88865
- pNC->nErr++;
88866
- }
88867
- pExpr->op = TK_NULL;
88868
- return WRC_Prune;
88851
+ {
88852
+ int auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0,pDef->zName,0);
88853
+ if( auth!=SQLITE_OK ){
88854
+ if( auth==SQLITE_DENY ){
88855
+ sqlite3ErrorMsg(pParse, "not authorized to use function: %s",
88856
+ pDef->zName);
88857
+ pNC->nErr++;
88858
+ }
88859
+ pExpr->op = TK_NULL;
88860
+ return WRC_Prune;
88861
+ }
8886988862
}
8887088863
#endif
8887188864
if( pDef->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG) ){
8887288865
/* For the purposes of the EP_ConstFunc flag, date and time
8887388866
** functions and other functions that change slowly are considered
@@ -91664,19 +91657,10 @@
9166491657
}
9166591658
return p;
9166691659
}
9166791660
#endif /* SQLITE_OMIT_SUBQUERY */
9166891661
91669
-/*
91670
-** Code an OP_Once instruction and allocate space for its flag. Return the
91671
-** address of the new instruction.
91672
-*/
91673
-SQLITE_PRIVATE int sqlite3CodeOnce(Parse *pParse){
91674
- Vdbe *v = sqlite3GetVdbe(pParse); /* Virtual machine being coded */
91675
- return sqlite3VdbeAddOp1(v, OP_Once, pParse->nOnce++);
91676
-}
91677
-
9167891662
#ifndef SQLITE_OMIT_SUBQUERY
9167991663
/*
9168091664
** Generate code that checks the left-most column of index table iCur to see if
9168191665
** it contains any NULL entries. Cause the register at regHasNull to be set
9168291666
** to a non-NULL value if iCur contains no NULLs. Cause register regHasNull
@@ -91846,11 +91830,11 @@
9184691830
sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
9184791831
9184891832
assert(v); /* sqlite3GetVdbe() has always been previously called */
9184991833
if( nExpr==1 && pEList->a[0].pExpr->iColumn<0 ){
9185091834
/* The "x IN (SELECT rowid FROM table)" case */
91851
- int iAddr = sqlite3CodeOnce(pParse);
91835
+ int iAddr = sqlite3VdbeAddOp0(v, OP_Once);
9185291836
VdbeCoverage(v);
9185391837
9185491838
sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);
9185591839
eType = IN_INDEX_ROWID;
9185691840
@@ -91929,11 +91913,11 @@
9192991913
}
9193091914
9193191915
assert( i==nExpr || colUsed!=(MASKBIT(nExpr)-1) );
9193291916
if( colUsed==(MASKBIT(nExpr)-1) ){
9193391917
/* If we reach this point, that means the index pIdx is usable */
91934
- int iAddr = sqlite3CodeOnce(pParse); VdbeCoverage(v);
91918
+ int iAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
9193591919
#ifndef SQLITE_OMIT_EXPLAIN
9193691920
sqlite3VdbeAddOp4(v, OP_Explain, 0, 0, 0,
9193791921
sqlite3MPrintf(db, "USING INDEX %s FOR IN-OPERATOR",pIdx->zName),
9193891922
P4_DYNAMIC);
9193991923
#endif
@@ -92104,11 +92088,11 @@
9210492088
**
9210592089
** If all of the above are false, then we can run this code just once
9210692090
** save the results, and reuse the same result on subsequent invocations.
9210792091
*/
9210892092
if( !ExprHasProperty(pExpr, EP_VarSelect) ){
92109
- jmpIfDynamic = sqlite3CodeOnce(pParse); VdbeCoverage(v);
92093
+ jmpIfDynamic = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
9211092094
}
9211192095
9211292096
#ifndef SQLITE_OMIT_EXPLAIN
9211392097
if( pParse->explain==2 ){
9211492098
char *zMsg = sqlite3MPrintf(pParse->db, "EXECUTE %s%s SUBQUERY %d",
@@ -93044,11 +93028,10 @@
9304493028
int op; /* The opcode being coded */
9304593029
int inReg = target; /* Results stored in register inReg */
9304693030
int regFree1 = 0; /* If non-zero free this temporary register */
9304793031
int regFree2 = 0; /* If non-zero free this temporary register */
9304893032
int r1, r2; /* Various register numbers */
93049
- sqlite3 *db = pParse->db; /* The database connection */
9305093033
Expr tempX; /* Temporary expression node */
9305193034
int p5 = 0;
9305293035
9305393036
assert( target>0 && target<=pParse->nMem );
9305493037
if( v==0 ){
@@ -93065,56 +93048,53 @@
9306593048
case TK_AGG_COLUMN: {
9306693049
AggInfo *pAggInfo = pExpr->pAggInfo;
9306793050
struct AggInfo_col *pCol = &pAggInfo->aCol[pExpr->iAgg];
9306893051
if( !pAggInfo->directMode ){
9306993052
assert( pCol->iMem>0 );
93070
- inReg = pCol->iMem;
93071
- break;
93053
+ return pCol->iMem;
9307293054
}else if( pAggInfo->useSortingIdx ){
9307393055
sqlite3VdbeAddOp3(v, OP_Column, pAggInfo->sortingIdxPTab,
9307493056
pCol->iSorterColumn, target);
93075
- break;
93057
+ return target;
9307693058
}
9307793059
/* Otherwise, fall thru into the TK_COLUMN case */
9307893060
}
9307993061
case TK_COLUMN: {
9308093062
int iTab = pExpr->iTable;
9308193063
if( iTab<0 ){
9308293064
if( pParse->ckBase>0 ){
9308393065
/* Generating CHECK constraints or inserting into partial index */
93084
- inReg = pExpr->iColumn + pParse->ckBase;
93085
- break;
93066
+ return pExpr->iColumn + pParse->ckBase;
9308693067
}else{
9308793068
/* Coding an expression that is part of an index where column names
9308893069
** in the index refer to the table to which the index belongs */
9308993070
iTab = pParse->iSelfTab;
9309093071
}
9309193072
}
93092
- inReg = sqlite3ExprCodeGetColumn(pParse, pExpr->pTab,
93073
+ return sqlite3ExprCodeGetColumn(pParse, pExpr->pTab,
9309393074
pExpr->iColumn, iTab, target,
9309493075
pExpr->op2);
93095
- break;
9309693076
}
9309793077
case TK_INTEGER: {
9309893078
codeInteger(pParse, pExpr, 0, target);
93099
- break;
93079
+ return target;
9310093080
}
9310193081
#ifndef SQLITE_OMIT_FLOATING_POINT
9310293082
case TK_FLOAT: {
9310393083
assert( !ExprHasProperty(pExpr, EP_IntValue) );
9310493084
codeReal(v, pExpr->u.zToken, 0, target);
93105
- break;
93085
+ return target;
9310693086
}
9310793087
#endif
9310893088
case TK_STRING: {
9310993089
assert( !ExprHasProperty(pExpr, EP_IntValue) );
9311093090
sqlite3VdbeLoadString(v, target, pExpr->u.zToken);
93111
- break;
93091
+ return target;
9311293092
}
9311393093
case TK_NULL: {
9311493094
sqlite3VdbeAddOp2(v, OP_Null, 0, target);
93115
- break;
93095
+ return target;
9311693096
}
9311793097
#ifndef SQLITE_OMIT_BLOB_LITERAL
9311893098
case TK_BLOB: {
9311993099
int n;
9312093100
const char *z;
@@ -93125,11 +93105,11 @@
9312593105
z = &pExpr->u.zToken[2];
9312693106
n = sqlite3Strlen30(z) - 1;
9312793107
assert( z[n]=='\'' );
9312893108
zBlob = sqlite3HexToBlob(sqlite3VdbeDb(v), z, n);
9312993109
sqlite3VdbeAddOp4(v, OP_Blob, n/2, target, 0, zBlob, P4_DYNAMIC);
93130
- break;
93110
+ return target;
9313193111
}
9313293112
#endif
9313393113
case TK_VARIABLE: {
9313493114
assert( !ExprHasProperty(pExpr, EP_IntValue) );
9313593115
assert( pExpr->u.zToken!=0 );
@@ -93138,15 +93118,14 @@
9313893118
if( pExpr->u.zToken[1]!=0 ){
9313993119
assert( pExpr->u.zToken[0]=='?'
9314093120
|| strcmp(pExpr->u.zToken, pParse->azVar[pExpr->iColumn-1])==0 );
9314193121
sqlite3VdbeChangeP4(v, -1, pParse->azVar[pExpr->iColumn-1], P4_STATIC);
9314293122
}
93143
- break;
93123
+ return target;
9314493124
}
9314593125
case TK_REGISTER: {
93146
- inReg = pExpr->iTable;
93147
- break;
93126
+ return pExpr->iTable;
9314893127
}
9314993128
#ifndef SQLITE_OMIT_CAST
9315093129
case TK_CAST: {
9315193130
/* Expressions of the form: CAST(pLeft AS token) */
9315293131
inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
@@ -93156,11 +93135,11 @@
9315693135
}
9315793136
sqlite3VdbeAddOp2(v, OP_Cast, target,
9315893137
sqlite3AffinityType(pExpr->u.zToken, 0));
9315993138
testcase( usedAsColumnCache(pParse, inReg, inReg) );
9316093139
sqlite3ExprCacheAffinityChange(pParse, inReg, 1);
93161
- break;
93140
+ return inReg;
9316293141
}
9316393142
#endif /* SQLITE_OMIT_CAST */
9316493143
case TK_IS:
9316593144
case TK_ISNOT:
9316693145
op = (op==TK_IS) ? TK_EQ : TK_NE;
@@ -93224,14 +93203,16 @@
9322493203
case TK_UMINUS: {
9322593204
Expr *pLeft = pExpr->pLeft;
9322693205
assert( pLeft );
9322793206
if( pLeft->op==TK_INTEGER ){
9322893207
codeInteger(pParse, pLeft, 1, target);
93208
+ return target;
9322993209
#ifndef SQLITE_OMIT_FLOATING_POINT
9323093210
}else if( pLeft->op==TK_FLOAT ){
9323193211
assert( !ExprHasProperty(pExpr, EP_IntValue) );
9323293212
codeReal(v, pLeft->u.zToken, 1, target);
93213
+ return target;
9323393214
#endif
9323493215
}else{
9323593216
tempX.op = TK_INTEGER;
9323693217
tempX.flags = EP_IntValue|EP_TokenOnly;
9323793218
tempX.u.iValue = 0;
@@ -93238,20 +93219,18 @@
9323893219
r1 = sqlite3ExprCodeTemp(pParse, &tempX, &regFree1);
9323993220
r2 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree2);
9324093221
sqlite3VdbeAddOp3(v, OP_Subtract, r2, r1, target);
9324193222
testcase( regFree2==0 );
9324293223
}
93243
- inReg = target;
9324493224
break;
9324593225
}
9324693226
case TK_BITNOT:
9324793227
case TK_NOT: {
9324893228
assert( TK_BITNOT==OP_BitNot ); testcase( op==TK_BITNOT );
9324993229
assert( TK_NOT==OP_Not ); testcase( op==TK_NOT );
9325093230
r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
9325193231
testcase( regFree1==0 );
93252
- inReg = target;
9325393232
sqlite3VdbeAddOp2(v, op, r1, inReg);
9325493233
break;
9325593234
}
9325693235
case TK_ISNULL:
9325793236
case TK_NOTNULL: {
@@ -93272,11 +93251,11 @@
9327293251
AggInfo *pInfo = pExpr->pAggInfo;
9327393252
if( pInfo==0 ){
9327493253
assert( !ExprHasProperty(pExpr, EP_IntValue) );
9327593254
sqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken);
9327693255
}else{
93277
- inReg = pInfo->aFunc[pExpr->iAgg].iMem;
93256
+ return pInfo->aFunc[pExpr->iAgg].iMem;
9327893257
}
9327993258
break;
9328093259
}
9328193260
case TK_FUNCTION: {
9328293261
ExprList *pFarg; /* List of function arguments */
@@ -93283,10 +93262,11 @@
9328393262
int nFarg; /* Number of function arguments */
9328493263
FuncDef *pDef; /* The function definition object */
9328593264
const char *zId; /* The function name */
9328693265
u32 constMask = 0; /* Mask of function arguments that are constant */
9328793266
int i; /* Loop counter */
93267
+ sqlite3 *db = pParse->db; /* The database connection */
9328893268
u8 enc = ENC(db); /* The text encoding used by this database */
9328993269
CollSeq *pColl = 0; /* A collating sequence */
9329093270
9329193271
assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
9329293272
if( ExprHasProperty(pExpr, EP_TokenOnly) ){
@@ -93331,12 +93311,11 @@
9333193311
/* The UNLIKELY() function is a no-op. The result is the value
9333293312
** of the first argument.
9333393313
*/
9333493314
if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){
9333593315
assert( nFarg>=1 );
93336
- inReg = sqlite3ExprCodeTarget(pParse, pFarg->a[0].pExpr, target);
93337
- break;
93316
+ return sqlite3ExprCodeTarget(pParse, pFarg->a[0].pExpr, target);
9333893317
}
9333993318
9334093319
for(i=0; i<nFarg; i++){
9334193320
if( i<32 && sqlite3ExprIsConstant(pFarg->a[i].pExpr) ){
9334293321
testcase( i==31 );
@@ -93407,11 +93386,11 @@
9340793386
(char*)pDef, P4_FUNCDEF);
9340893387
sqlite3VdbeChangeP5(v, (u8)nFarg);
9340993388
if( nFarg && constMask==0 ){
9341093389
sqlite3ReleaseTempRange(pParse, r1, nFarg);
9341193390
}
93412
- break;
93391
+ return target;
9341393392
}
9341493393
#ifndef SQLITE_OMIT_SUBQUERY
9341593394
case TK_EXISTS:
9341693395
case TK_SELECT: {
9341793396
int nCol;
@@ -93418,20 +93397,19 @@
9341893397
testcase( op==TK_EXISTS );
9341993398
testcase( op==TK_SELECT );
9342093399
if( op==TK_SELECT && (nCol = pExpr->x.pSelect->pEList->nExpr)!=1 ){
9342193400
sqlite3SubselectError(pParse, nCol, 1);
9342293401
}else{
93423
- inReg = sqlite3CodeSubselect(pParse, pExpr, 0, 0);
93402
+ return sqlite3CodeSubselect(pParse, pExpr, 0, 0);
9342493403
}
9342593404
break;
9342693405
}
9342793406
case TK_SELECT_COLUMN: {
9342893407
if( pExpr->pLeft->iTable==0 ){
9342993408
pExpr->pLeft->iTable = sqlite3CodeSubselect(pParse, pExpr->pLeft, 0, 0);
9343093409
}
93431
- inReg = pExpr->pLeft->iTable + pExpr->iColumn;
93432
- break;
93410
+ return pExpr->pLeft->iTable + pExpr->iColumn;
9343393411
}
9343493412
case TK_IN: {
9343593413
int destIfFalse = sqlite3VdbeMakeLabel(v);
9343693414
int destIfNull = sqlite3VdbeMakeLabel(v);
9343793415
sqlite3VdbeAddOp2(v, OP_Null, 0, target);
@@ -93438,11 +93416,11 @@
9343893416
sqlite3ExprCodeIN(pParse, pExpr, destIfFalse, destIfNull);
9343993417
sqlite3VdbeAddOp2(v, OP_Integer, 1, target);
9344093418
sqlite3VdbeResolveLabel(v, destIfFalse);
9344193419
sqlite3VdbeAddOp2(v, OP_AddImm, target, 0);
9344293420
sqlite3VdbeResolveLabel(v, destIfNull);
93443
- break;
93421
+ return target;
9344493422
}
9344593423
#endif /* SQLITE_OMIT_SUBQUERY */
9344693424
9344793425
9344893426
/*
@@ -93456,17 +93434,16 @@
9345693434
** Y is stored in pExpr->pList->a[0].pExpr.
9345793435
** Z is stored in pExpr->pList->a[1].pExpr.
9345893436
*/
9345993437
case TK_BETWEEN: {
9346093438
exprCodeBetween(pParse, pExpr, target, 0, 0);
93461
- break;
93439
+ return target;
9346293440
}
9346393441
case TK_SPAN:
9346493442
case TK_COLLATE:
9346593443
case TK_UPLUS: {
93466
- inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
93467
- break;
93444
+ return sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
9346893445
}
9346993446
9347093447
case TK_TRIGGER: {
9347193448
/* If the opcode is TK_TRIGGER, then the expression is a reference
9347293449
** to a column in the new.* or old.* pseudo-tables available to
@@ -93604,11 +93581,11 @@
9360493581
sqlite3ExprCode(pParse, pEList->a[nExpr-1].pExpr, target);
9360593582
sqlite3ExprCachePop(pParse);
9360693583
}else{
9360793584
sqlite3VdbeAddOp2(v, OP_Null, 0, target);
9360893585
}
93609
- assert( db->mallocFailed || pParse->nErr>0
93586
+ assert( pParse->db->mallocFailed || pParse->nErr>0
9361093587
|| pParse->iCacheLevel==iCacheLevel );
9361193588
sqlite3VdbeResolveLabel(v, endLabel);
9361293589
break;
9361393590
}
9361493591
#ifndef SQLITE_OMIT_TRIGGER
@@ -97644,11 +97621,11 @@
9764497621
break;
9764597622
9764697623
case SQLITE_NULL:
9764797624
/* No key specified. Use the key from the main database */
9764897625
sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);
97649
- if( nKey>0 || sqlite3BtreeGetOptimalReserve(db->aDb[0].pBt)>0 ){
97626
+ if( nKey || sqlite3BtreeGetOptimalReserve(db->aDb[0].pBt)>0 ){
9765097627
rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
9765197628
}
9765297629
break;
9765397630
}
9765497631
}
@@ -98103,11 +98080,11 @@
9810398080
** and attempts to write the column will be ignored.
9810498081
**
9810598082
** Setting the auth function to NULL disables this hook. The default
9810698083
** setting of the auth function is NULL.
9810798084
*/
98108
-SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer(
98085
+SQLITE_API int sqlite3_set_authorizer(
9810998086
sqlite3 *db,
9811098087
int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
9811198088
void *pArg
9811298089
){
9811398090
#ifdef SQLITE_ENABLE_API_ARMOR
@@ -100441,11 +100418,13 @@
100441100418
Table *pSelTab; /* A fake table from which we get the result set */
100442100419
Select *pSel; /* Copy of the SELECT that implements the view */
100443100420
int nErr = 0; /* Number of errors encountered */
100444100421
int n; /* Temporarily holds the number of cursors assigned */
100445100422
sqlite3 *db = pParse->db; /* Database connection for malloc errors */
100423
+#ifndef SQLITE_OMIT_AUTHORIZATION
100446100424
sqlite3_xauth xAuth; /* Saved xAuth pointer */
100425
+#endif
100447100426
100448100427
assert( pTable );
100449100428
100450100429
#ifndef SQLITE_OMIT_VIRTUALTABLE
100451100430
if( sqlite3VtabCallConnect(pParse, pTable) ){
@@ -103434,11 +103413,10 @@
103434103413
SrcList *pTabList, /* The table from which we should delete things */
103435103414
Expr *pWhere /* The WHERE clause. May be null */
103436103415
){
103437103416
Vdbe *v; /* The virtual database engine */
103438103417
Table *pTab; /* The table from which records will be deleted */
103439
- const char *zDb; /* Name of database holding pTab */
103440103418
int i; /* Loop counter */
103441103419
WhereInfo *pWInfo; /* Information about the WHERE clause */
103442103420
Index *pIdx; /* For looping over indices of the table */
103443103421
int iTabCur; /* Cursor number for the table */
103444103422
int iDataCur = 0; /* VDBE cursor for the canonical data source */
@@ -103511,12 +103489,12 @@
103511103489
if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){
103512103490
goto delete_from_cleanup;
103513103491
}
103514103492
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
103515103493
assert( iDb<db->nDb );
103516
- zDb = db->aDb[iDb].zDbSName;
103517
- rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb);
103494
+ rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0,
103495
+ db->aDb[iDb].zDbSName);
103518103496
assert( rcauth==SQLITE_OK || rcauth==SQLITE_DENY || rcauth==SQLITE_IGNORE );
103519103497
if( rcauth==SQLITE_DENY ){
103520103498
goto delete_from_cleanup;
103521103499
}
103522103500
assert(!isView || pTrigger);
@@ -103696,11 +103674,11 @@
103696103674
** triggers.
103697103675
*/
103698103676
if( !isView ){
103699103677
int iAddrOnce = 0;
103700103678
if( eOnePass==ONEPASS_MULTI ){
103701
- iAddrOnce = sqlite3CodeOnce(pParse); VdbeCoverage(v);
103679
+ iAddrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
103702103680
}
103703103681
testcase( IsVirtual(pTab) );
103704103682
sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, OPFLAG_FORDELETE,
103705103683
iTabCur, aToOpen, &iDataCur, &iIdxCur);
103706103684
assert( pPk || IsVirtual(pTab) || iDataCur==iTabCur );
@@ -104874,18 +104852,18 @@
104874104852
}
104875104853
104876104854
/*
104877104855
** The sqlite3_strglob() interface.
104878104856
*/
104879
-SQLITE_API int SQLITE_STDCALL sqlite3_strglob(const char *zGlobPattern, const char *zString){
104857
+SQLITE_API int sqlite3_strglob(const char *zGlobPattern, const char *zString){
104880104858
return patternCompare((u8*)zGlobPattern, (u8*)zString, &globInfo, '[')==0;
104881104859
}
104882104860
104883104861
/*
104884104862
** The sqlite3_strlike() interface.
104885104863
*/
104886
-SQLITE_API int SQLITE_STDCALL sqlite3_strlike(const char *zPattern, const char *zStr, unsigned int esc){
104864
+SQLITE_API int sqlite3_strlike(const char *zPattern, const char *zStr, unsigned int esc){
104887104865
return patternCompare((u8*)zPattern, (u8*)zStr, &likeInfoNorm, esc)==0;
104888104866
}
104889104867
104890104868
/*
104891104869
** Count the number of times that the LIKE operator (or GLOB which is
@@ -107868,11 +107846,10 @@
107868107846
int onError /* How to handle constraint errors */
107869107847
){
107870107848
sqlite3 *db; /* The main database structure */
107871107849
Table *pTab; /* The table to insert into. aka TABLE */
107872107850
char *zTab; /* Name of the table into which we are inserting */
107873
- const char *zDb; /* Name of the database holding this table */
107874107851
int i, j, idx; /* Loop counters */
107875107852
Vdbe *v; /* Generate code into this virtual machine */
107876107853
Index *pIdx; /* For looping over indices of the table */
107877107854
int nColumn; /* Number of columns in the data */
107878107855
int nHidden = 0; /* Number of hidden columns if TABLE is virtual */
@@ -107883,11 +107860,10 @@
107883107860
int srcTab = 0; /* Data comes from this temporary cursor if >=0 */
107884107861
int addrInsTop = 0; /* Jump to label "D" */
107885107862
int addrCont = 0; /* Top of insert loop. Label "C" in templates 3 and 4 */
107886107863
SelectDest dest; /* Destination for SELECT on rhs of INSERT */
107887107864
int iDb; /* Index of database holding TABLE */
107888
- Db *pDb; /* The database containing table being inserted into */
107889107865
u8 useTempTable = 0; /* Store SELECT results in intermediate table */
107890107866
u8 appendFlag = 0; /* True if the insert is likely to be an append */
107891107867
u8 withoutRowid; /* 0 for normal table. 1 for WITHOUT ROWID table */
107892107868
u8 bIdListInOrder; /* True if IDLIST is in table order */
107893107869
ExprList *pList = 0; /* List of VALUES() to be inserted */
@@ -107933,13 +107909,12 @@
107933107909
if( pTab==0 ){
107934107910
goto insert_cleanup;
107935107911
}
107936107912
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
107937107913
assert( iDb<db->nDb );
107938
- pDb = &db->aDb[iDb];
107939
- zDb = pDb->zDbSName;
107940
- if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0, zDb) ){
107914
+ if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0,
107915
+ db->aDb[iDb].zDbSName) ){
107941107916
goto insert_cleanup;
107942107917
}
107943107918
withoutRowid = !HasRowid(pTab);
107944107919
107945107920
/* Figure out if we have any triggers and if the table being
@@ -109604,11 +109579,11 @@
109604109579
** If the SQL is a query, then for each row in the query result
109605109580
** the xCallback() function is called. pArg becomes the first
109606109581
** argument to xCallback(). If xCallback=NULL then no callback
109607109582
** is invoked, even for queries.
109608109583
*/
109609
-SQLITE_API int SQLITE_STDCALL sqlite3_exec(
109584
+SQLITE_API int sqlite3_exec(
109610109585
sqlite3 *db, /* The database on which the SQL executes */
109611109586
const char *zSql, /* The SQL to be executed */
109612109587
sqlite3_callback xCallback, /* Invoke this callback routine */
109613109588
void *pArg, /* First argument to xCallback() */
109614109589
char **pzErrMsg /* Write error messages here */
@@ -110866,11 +110841,11 @@
110866110841
db->aExtension = aHandle;
110867110842
110868110843
db->aExtension[db->nExtension++] = handle;
110869110844
return SQLITE_OK;
110870110845
}
110871
-SQLITE_API int SQLITE_STDCALL sqlite3_load_extension(
110846
+SQLITE_API int sqlite3_load_extension(
110872110847
sqlite3 *db, /* Load the extension into this database connection */
110873110848
const char *zFile, /* Name of the shared library containing extension */
110874110849
const char *zProc, /* Entry point. Use "sqlite3_extension_init" if 0 */
110875110850
char **pzErrMsg /* Put error message here if not 0 */
110876110851
){
@@ -110897,11 +110872,11 @@
110897110872
110898110873
/*
110899110874
** Enable or disable extension loading. Extension loading is disabled by
110900110875
** default so as not to open security holes in older applications.
110901110876
*/
110902
-SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int onoff){
110877
+SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff){
110903110878
sqlite3_mutex_enter(db->mutex);
110904110879
if( onoff ){
110905110880
db->flags |= SQLITE_LoadExtension|SQLITE_LoadExtFunc;
110906110881
}else{
110907110882
db->flags &= ~(SQLITE_LoadExtension|SQLITE_LoadExtFunc);
@@ -110908,22 +110883,11 @@
110908110883
}
110909110884
sqlite3_mutex_leave(db->mutex);
110910110885
return SQLITE_OK;
110911110886
}
110912110887
110913
-#endif /* SQLITE_OMIT_LOAD_EXTENSION */
110914
-
110915
-/*
110916
-** The auto-extension code added regardless of whether or not extension
110917
-** loading is supported. We need a dummy sqlite3Apis pointer for that
110918
-** code if regular extension loading is not available. This is that
110919
-** dummy pointer.
110920
-*/
110921
-#ifdef SQLITE_OMIT_LOAD_EXTENSION
110922
-static const sqlite3_api_routines sqlite3Apis = { 0 };
110923
-#endif
110924
-
110888
+#endif /* !defined(SQLITE_OMIT_LOAD_EXTENSION) */
110925110889
110926110890
/*
110927110891
** The following object holds the list of automatically loaded
110928110892
** extensions.
110929110893
**
@@ -110954,11 +110918,11 @@
110954110918
110955110919
/*
110956110920
** Register a statically linked extension that is automatically
110957110921
** loaded by every new database connection.
110958110922
*/
110959
-SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(
110923
+SQLITE_API int sqlite3_auto_extension(
110960110924
void (*xInit)(void)
110961110925
){
110962110926
int rc = SQLITE_OK;
110963110927
#ifndef SQLITE_OMIT_AUTOINIT
110964110928
rc = sqlite3_initialize();
@@ -111001,11 +110965,11 @@
111001110965
** routine is a no-op.
111002110966
**
111003110967
** Return 1 if xInit was found on the list and removed. Return 0 if xInit
111004110968
** was not on the list.
111005110969
*/
111006
-SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(
110970
+SQLITE_API int sqlite3_cancel_auto_extension(
111007110971
void (*xInit)(void)
111008110972
){
111009110973
#if SQLITE_THREADSAFE
111010110974
sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
111011110975
#endif
@@ -111026,11 +110990,11 @@
111026110990
}
111027110991
111028110992
/*
111029110993
** Reset the automatic extension loading mechanism.
111030110994
*/
111031
-SQLITE_API void SQLITE_STDCALL sqlite3_reset_auto_extension(void){
110995
+SQLITE_API void sqlite3_reset_auto_extension(void){
111032110996
#ifndef SQLITE_OMIT_AUTOINIT
111033110997
if( sqlite3_initialize()==SQLITE_OK )
111034110998
#endif
111035110999
{
111036111000
#if SQLITE_THREADSAFE
@@ -111064,20 +111028,25 @@
111064111028
for(i=0; go; i++){
111065111029
char *zErrmsg;
111066111030
#if SQLITE_THREADSAFE
111067111031
sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
111068111032
#endif
111033
+#ifdef SQLITE_OMIT_LOAD_EXTENSION
111034
+ const sqlite3_api_routines *pThunk = 0;
111035
+#else
111036
+ const sqlite3_api_routines *pThunk = &sqlite3Apis;
111037
+#endif
111069111038
sqlite3_mutex_enter(mutex);
111070111039
if( i>=wsdAutoext.nExt ){
111071111040
xInit = 0;
111072111041
go = 0;
111073111042
}else{
111074111043
xInit = (sqlite3_loadext_entry)wsdAutoext.aExt[i];
111075111044
}
111076111045
sqlite3_mutex_leave(mutex);
111077111046
zErrmsg = 0;
111078
- if( xInit && (rc = xInit(db, &zErrmsg, &sqlite3Apis))!=0 ){
111047
+ if( xInit && (rc = xInit(db, &zErrmsg, pThunk))!=0 ){
111079111048
sqlite3ErrorWithMsg(db, rc,
111080111049
"automatic extension loading failed: %s", zErrmsg);
111081111050
go = 0;
111082111051
}
111083111052
sqlite3_free(zErrmsg);
@@ -114289,11 +114258,11 @@
114289114258
** and so if a schema change occurs, SQLITE_SCHEMA is returned by
114290114259
** sqlite3_step(). In the new version, the original SQL text is retained
114291114260
** and the statement is automatically recompiled if an schema change
114292114261
** occurs.
114293114262
*/
114294
-SQLITE_API int SQLITE_STDCALL sqlite3_prepare(
114263
+SQLITE_API int sqlite3_prepare(
114295114264
sqlite3 *db, /* Database handle. */
114296114265
const char *zSql, /* UTF-8 encoded SQL statement. */
114297114266
int nBytes, /* Length of zSql in bytes. */
114298114267
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
114299114268
const char **pzTail /* OUT: End of parsed string */
@@ -114301,11 +114270,11 @@
114301114270
int rc;
114302114271
rc = sqlite3LockAndPrepare(db,zSql,nBytes,0,0,ppStmt,pzTail);
114303114272
assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */
114304114273
return rc;
114305114274
}
114306
-SQLITE_API int SQLITE_STDCALL sqlite3_prepare_v2(
114275
+SQLITE_API int sqlite3_prepare_v2(
114307114276
sqlite3 *db, /* Database handle. */
114308114277
const char *zSql, /* UTF-8 encoded SQL statement. */
114309114278
int nBytes, /* Length of zSql in bytes. */
114310114279
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
114311114280
const char **pzTail /* OUT: End of parsed string */
@@ -114377,11 +114346,11 @@
114377114346
** and so if a schema change occurs, SQLITE_SCHEMA is returned by
114378114347
** sqlite3_step(). In the new version, the original SQL text is retained
114379114348
** and the statement is automatically recompiled if an schema change
114380114349
** occurs.
114381114350
*/
114382
-SQLITE_API int SQLITE_STDCALL sqlite3_prepare16(
114351
+SQLITE_API int sqlite3_prepare16(
114383114352
sqlite3 *db, /* Database handle. */
114384114353
const void *zSql, /* UTF-16 encoded SQL statement. */
114385114354
int nBytes, /* Length of zSql in bytes. */
114386114355
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
114387114356
const void **pzTail /* OUT: End of parsed string */
@@ -114389,11 +114358,11 @@
114389114358
int rc;
114390114359
rc = sqlite3Prepare16(db,zSql,nBytes,0,ppStmt,pzTail);
114391114360
assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */
114392114361
return rc;
114393114362
}
114394
-SQLITE_API int SQLITE_STDCALL sqlite3_prepare16_v2(
114363
+SQLITE_API int sqlite3_prepare16_v2(
114395114364
sqlite3 *db, /* Database handle. */
114396114365
const void *zSql, /* UTF-16 encoded SQL statement. */
114397114366
int nBytes, /* Length of zSql in bytes. */
114398114367
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
114399114368
const void **pzTail /* OUT: End of parsed string */
@@ -115640,11 +115609,11 @@
115640115609
nKey = pOrderBy->nExpr - pSort->nOBSat;
115641115610
if( pSort->sortFlags & SORTFLAG_UseSorter ){
115642115611
int regSortOut = ++pParse->nMem;
115643115612
iSortTab = pParse->nTab++;
115644115613
if( pSort->labelBkOut ){
115645
- addrOnce = sqlite3CodeOnce(pParse); VdbeCoverage(v);
115614
+ addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
115646115615
}
115647115616
sqlite3VdbeAddOp3(v, OP_OpenPseudo, iSortTab, regSortOut, nKey+1+nSortData);
115648115617
if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce);
115649115618
addr = 1 + sqlite3VdbeAddOp2(v, OP_SorterSort, iTab, addrBreak);
115650115619
VdbeCoverage(v);
@@ -119435,11 +119404,11 @@
119435119404
pItem->addrFillSub = topAddr+1;
119436119405
if( pItem->fg.isCorrelated==0 ){
119437119406
/* If the subquery is not correlated and if we are not inside of
119438119407
** a trigger, then we only need to compute the value of the subquery
119439119408
** once. */
119440
- onceAddr = sqlite3CodeOnce(pParse); VdbeCoverage(v);
119409
+ onceAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
119441119410
VdbeComment((v, "materialize \"%s\"", pItem->pTab->zName));
119442119411
}else{
119443119412
VdbeNoopComment((v, "materialize \"%s\"", pItem->pTab->zName));
119444119413
}
119445119414
sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor);
@@ -120198,11 +120167,11 @@
120198120167
** The result that is written to ***pazResult is held in memory obtained
120199120168
** from malloc(). But the caller cannot free this memory directly.
120200120169
** Instead, the entire table should be passed to sqlite3_free_table() when
120201120170
** the calling procedure is finished using it.
120202120171
*/
120203
-SQLITE_API int SQLITE_STDCALL sqlite3_get_table(
120172
+SQLITE_API int sqlite3_get_table(
120204120173
sqlite3 *db, /* The database on which the SQL executes */
120205120174
const char *zSql, /* The SQL to be executed */
120206120175
char ***pazResult, /* Write the result table here */
120207120176
int *pnRow, /* Write the number of rows in the result here */
120208120177
int *pnColumn, /* Write the number of columns of result here */
@@ -120267,11 +120236,11 @@
120267120236
}
120268120237
120269120238
/*
120270120239
** This routine frees the space the sqlite3_get_table() malloced.
120271120240
*/
120272
-SQLITE_API void SQLITE_STDCALL sqlite3_free_table(
120241
+SQLITE_API void sqlite3_free_table(
120273120242
char **azResult /* Result returned from sqlite3_get_table() */
120274120243
){
120275120244
if( azResult ){
120276120245
int i, n;
120277120246
azResult--;
@@ -120382,11 +120351,10 @@
120382120351
char *zName = 0; /* Name of the trigger */
120383120352
sqlite3 *db = pParse->db; /* The database connection */
120384120353
int iDb; /* The database to store the trigger in */
120385120354
Token *pName; /* The unqualified db name */
120386120355
DbFixer sFix; /* State vector for the DB fixer */
120387
- int iTabDb; /* Index of the database holding pTab */
120388120356
120389120357
assert( pName1!=0 ); /* pName1->z might be NULL, but not pName1 itself */
120390120358
assert( pName2!=0 );
120391120359
assert( op==TK_INSERT || op==TK_UPDATE || op==TK_DELETE );
120392120360
assert( op>0 && op<0xff );
@@ -120495,14 +120463,14 @@
120495120463
if( !pTab->pSelect && tr_tm==TK_INSTEAD ){
120496120464
sqlite3ErrorMsg(pParse, "cannot create INSTEAD OF"
120497120465
" trigger on table: %S", pTableName, 0);
120498120466
goto trigger_cleanup;
120499120467
}
120500
- iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
120501120468
120502120469
#ifndef SQLITE_OMIT_AUTHORIZATION
120503120470
{
120471
+ int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
120504120472
int code = SQLITE_CREATE_TRIGGER;
120505120473
const char *zDb = db->aDb[iTabDb].zDbSName;
120506120474
const char *zDbTrig = isTemp ? db->aDb[1].zDbSName : zDb;
120507120475
if( iTabDb==1 || isTemp ) code = SQLITE_CREATE_TEMP_TRIGGER;
120508120476
if( sqlite3AuthCheck(pParse, code, zName, pTab->zName, zDbTrig) ){
@@ -121166,11 +121134,10 @@
121166121134
if( db->mallocFailed==0 ){
121167121135
pProgram->aOp = sqlite3VdbeTakeOpArray(v, &pProgram->nOp, &pTop->nMaxArg);
121168121136
}
121169121137
pProgram->nMem = pSubParse->nMem;
121170121138
pProgram->nCsr = pSubParse->nTab;
121171
- pProgram->nOnce = pSubParse->nOnce;
121172121139
pProgram->token = (void *)pTrigger;
121173121140
pPrg->aColmask[0] = pSubParse->oldmask;
121174121141
pPrg->aColmask[1] = pSubParse->newmask;
121175121142
sqlite3VdbeDelete(v);
121176121143
}
@@ -122655,11 +122622,11 @@
122655122622
122656122623
122657122624
/*
122658122625
** External API function used to create a new virtual-table module.
122659122626
*/
122660
-SQLITE_API int SQLITE_STDCALL sqlite3_create_module(
122627
+SQLITE_API int sqlite3_create_module(
122661122628
sqlite3 *db, /* Database in which module is registered */
122662122629
const char *zName, /* Name assigned to this module */
122663122630
const sqlite3_module *pModule, /* The definition of the module */
122664122631
void *pAux /* Context pointer for xCreate/xConnect */
122665122632
){
@@ -122670,11 +122637,11 @@
122670122637
}
122671122638
122672122639
/*
122673122640
** External API function used to create a new virtual-table module.
122674122641
*/
122675
-SQLITE_API int SQLITE_STDCALL sqlite3_create_module_v2(
122642
+SQLITE_API int sqlite3_create_module_v2(
122676122643
sqlite3 *db, /* Database in which module is registered */
122677122644
const char *zName, /* Name assigned to this module */
122678122645
const sqlite3_module *pModule, /* The definition of the module */
122679122646
void *pAux, /* Context pointer for xCreate/xConnect */
122680122647
void (*xDestroy)(void *) /* Module destructor function */
@@ -123294,11 +123261,11 @@
123294123261
/*
123295123262
** This function is used to set the schema of a virtual table. It is only
123296123263
** valid to call this function from within the xCreate() or xConnect() of a
123297123264
** virtual table module.
123298123265
*/
123299
-SQLITE_API int SQLITE_STDCALL sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
123266
+SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
123300123267
VtabCtx *pCtx;
123301123268
Parse *pParse;
123302123269
int rc = SQLITE_OK;
123303123270
Table *pTab;
123304123271
char *zErr = 0;
@@ -123751,11 +123718,11 @@
123751123718
** table update operation currently in progress.
123752123719
**
123753123720
** The results of this routine are undefined unless it is called from
123754123721
** within an xUpdate method.
123755123722
*/
123756
-SQLITE_API int SQLITE_STDCALL sqlite3_vtab_on_conflict(sqlite3 *db){
123723
+SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *db){
123757123724
static const unsigned char aMap[] = {
123758123725
SQLITE_ROLLBACK, SQLITE_ABORT, SQLITE_FAIL, SQLITE_IGNORE, SQLITE_REPLACE
123759123726
};
123760123727
#ifdef SQLITE_ENABLE_API_ARMOR
123761123728
if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
@@ -123769,11 +123736,11 @@
123769123736
/*
123770123737
** Call from within the xCreate() or xConnect() methods to provide
123771123738
** the SQLite core with additional information about the behavior
123772123739
** of the virtual table being implemented.
123773123740
*/
123774
-SQLITE_API int SQLITE_CDECL sqlite3_vtab_config(sqlite3 *db, int op, ...){
123741
+SQLITE_API int sqlite3_vtab_config(sqlite3 *db, int op, ...){
123775123742
va_list ap;
123776123743
int rc = SQLITE_OK;
123777123744
123778123745
#ifdef SQLITE_ENABLE_API_ARMOR
123779123746
if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
@@ -124886,18 +124853,17 @@
124886124853
pIn = pLevel->u.in.aInLoop;
124887124854
if( pIn ){
124888124855
int iMap = 0; /* Index in aiMap[] */
124889124856
pIn += i;
124890124857
for(i=iEq;i<pLoop->nLTerm; i++){
124891
- int iOut = iReg;
124892124858
if( pLoop->aLTerm[i]->pExpr==pX ){
124859
+ int iOut = iReg + i - iEq;
124893124860
if( eType==IN_INDEX_ROWID ){
124894
- assert( nEq==1 && i==iEq );
124895
- pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iReg);
124861
+ testcase( nEq>1 ); /* Happens with a UNIQUE index on ROWID */
124862
+ pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut);
124896124863
}else{
124897124864
int iCol = aiMap ? aiMap[iMap++] : 0;
124898
- iOut = iReg + i - iEq;
124899124865
pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut);
124900124866
}
124901124867
sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v);
124902124868
if( i==iEq ){
124903124869
pIn->iCur = iTab;
@@ -128496,11 +128462,11 @@
128496128462
128497128463
/* Generate code to skip over the creation and initialization of the
128498128464
** transient index on 2nd and subsequent iterations of the loop. */
128499128465
v = pParse->pVdbe;
128500128466
assert( v!=0 );
128501
- addrInit = sqlite3CodeOnce(pParse); VdbeCoverage(v);
128467
+ addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
128502128468
128503128469
/* Count the number of columns that will be added to the index
128504128470
** and used to match WHERE clause constraints */
128505128471
nKeyCol = 0;
128506128472
pTable = pSrc->pTab;
@@ -130167,10 +130133,12 @@
130167130133
LogEst rLogSize; /* Logarithm of table size */
130168130134
WhereTerm *pTop = 0, *pBtm = 0; /* Top and bottom range constraints */
130169130135
130170130136
pNew = pBuilder->pNew;
130171130137
if( db->mallocFailed ) return SQLITE_NOMEM_BKPT;
130138
+ WHERETRACE(0x800, ("BEGIN addBtreeIdx(%s), nEq=%d\n",
130139
+ pProbe->zName, pNew->u.btree.nEq));
130172130140
130173130141
assert( (pNew->wsFlags & WHERE_VIRTUALTABLE)==0 );
130174130142
assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 );
130175130143
if( pNew->wsFlags & WHERE_BTM_LIMIT ){
130176130144
opMask = WO_LT|WO_LE;
@@ -130253,11 +130221,11 @@
130253130221
** In this case there is a separate term for each of (x) and (y).
130254130222
** However, the nIn multiplier should only be applied once, not once
130255130223
** for each such term. The following loop checks that pTerm is the
130256130224
** first such term in use, and sets nIn back to 0 if it is not. */
130257130225
for(i=0; i<pNew->nLTerm-1; i++){
130258
- if( pNew->aLTerm[i]->pExpr==pExpr ) nIn = 0;
130226
+ if( pNew->aLTerm[i] && pNew->aLTerm[i]->pExpr==pExpr ) nIn = 0;
130259130227
}
130260130228
}else if( ALWAYS(pExpr->x.pList && pExpr->x.pList->nExpr) ){
130261130229
/* "x IN (value, value, ...)" */
130262130230
nIn = sqlite3LogEst(pExpr->x.pList->nExpr);
130263130231
assert( nIn>0 ); /* RHS always has 2 or more terms... The parser
@@ -130445,10 +130413,12 @@
130445130413
pNew->u.btree.nEq = saved_nEq;
130446130414
pNew->nSkip = saved_nSkip;
130447130415
pNew->wsFlags = saved_wsFlags;
130448130416
}
130449130417
130418
+ WHERETRACE(0x800, ("END addBtreeIdx(%s), nEq=%d, rc=%d\n",
130419
+ pProbe->zName, saved_nEq, rc));
130450130420
return rc;
130451130421
}
130452130422
130453130423
/*
130454130424
** Return True if it is possible that pIndex might be useful in
@@ -137554,11 +137524,11 @@
137554137524
**
137555137525
** If we compile with SQLITE_OMIT_TRIGGER, all of the computation needed
137556137526
** to recognize the end of a trigger can be omitted. All we have to do
137557137527
** is look for a semicolon that is not part of an string or comment.
137558137528
*/
137559
-SQLITE_API int SQLITE_STDCALL sqlite3_complete(const char *zSql){
137529
+SQLITE_API int sqlite3_complete(const char *zSql){
137560137530
u8 state = 0; /* Current state, using numbers defined in header comment */
137561137531
u8 token; /* Value of the next token */
137562137532
137563137533
#ifndef SQLITE_OMIT_TRIGGER
137564137534
/* A complex statement machine used to detect the end of a CREATE TRIGGER
@@ -137719,11 +137689,11 @@
137719137689
/*
137720137690
** This routine is the same as the sqlite3_complete() routine described
137721137691
** above, except that the parameter is required to be UTF-16 encoded, not
137722137692
** UTF-8.
137723137693
*/
137724
-SQLITE_API int SQLITE_STDCALL sqlite3_complete16(const void *zSql){
137694
+SQLITE_API int sqlite3_complete16(const void *zSql){
137725137695
sqlite3_value *pVal;
137726137696
char const *zSql8;
137727137697
int rc;
137728137698
137729137699
#ifndef SQLITE_OMIT_AUTOINIT
@@ -137879,28 +137849,28 @@
137879137849
#endif
137880137850
137881137851
/* IMPLEMENTATION-OF: R-53536-42575 The sqlite3_libversion() function returns
137882137852
** a pointer to the to the sqlite3_version[] string constant.
137883137853
*/
137884
-SQLITE_API const char *SQLITE_STDCALL sqlite3_libversion(void){ return sqlite3_version; }
137854
+SQLITE_API const char *sqlite3_libversion(void){ return sqlite3_version; }
137885137855
137886137856
/* IMPLEMENTATION-OF: R-63124-39300 The sqlite3_sourceid() function returns a
137887137857
** pointer to a string constant whose value is the same as the
137888137858
** SQLITE_SOURCE_ID C preprocessor macro.
137889137859
*/
137890
-SQLITE_API const char *SQLITE_STDCALL sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
137860
+SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
137891137861
137892137862
/* IMPLEMENTATION-OF: R-35210-63508 The sqlite3_libversion_number() function
137893137863
** returns an integer equal to SQLITE_VERSION_NUMBER.
137894137864
*/
137895
-SQLITE_API int SQLITE_STDCALL sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; }
137865
+SQLITE_API int sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; }
137896137866
137897137867
/* IMPLEMENTATION-OF: R-20790-14025 The sqlite3_threadsafe() function returns
137898137868
** zero if and only if SQLite was compiled with mutexing code omitted due to
137899137869
** the SQLITE_THREADSAFE compile-time option being set to 0.
137900137870
*/
137901
-SQLITE_API int SQLITE_STDCALL sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; }
137871
+SQLITE_API int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; }
137902137872
137903137873
/*
137904137874
** When compiling the test fixture or with debugging enabled (on Win32),
137905137875
** this variable being set to non-zero will cause OSTRACE macros to emit
137906137876
** extra diagnostic information.
@@ -137969,11 +137939,11 @@
137969137939
** call by X completes.
137970137940
**
137971137941
** * Recursive calls to this routine from thread X return immediately
137972137942
** without blocking.
137973137943
*/
137974
-SQLITE_API int SQLITE_STDCALL sqlite3_initialize(void){
137944
+SQLITE_API int sqlite3_initialize(void){
137975137945
MUTEX_LOGIC( sqlite3_mutex *pMaster; ) /* The main static mutex */
137976137946
int rc; /* Result code */
137977137947
#ifdef SQLITE_EXTRA_INIT
137978137948
int bRunExtraInit = 0; /* Extra initialization needed */
137979137949
#endif
@@ -138135,11 +138105,11 @@
138135138105
** while any part of SQLite is otherwise in use in any thread. This
138136138106
** routine is not threadsafe. But it is safe to invoke this routine
138137138107
** on when SQLite is already shut down. If SQLite is already shut down
138138138108
** when this routine is invoked, then this routine is a harmless no-op.
138139138109
*/
138140
-SQLITE_API int SQLITE_STDCALL sqlite3_shutdown(void){
138110
+SQLITE_API int sqlite3_shutdown(void){
138141138111
#ifdef SQLITE_OMIT_WSD
138142138112
int rc = sqlite3_wsd_init(4096, 24);
138143138113
if( rc!=SQLITE_OK ){
138144138114
return rc;
138145138115
}
@@ -138189,11 +138159,11 @@
138189138159
** This routine should only be called when there are no outstanding
138190138160
** database connections or memory allocations. This routine is not
138191138161
** threadsafe. Failure to heed these warnings can lead to unpredictable
138192138162
** behavior.
138193138163
*/
138194
-SQLITE_API int SQLITE_CDECL sqlite3_config(int op, ...){
138164
+SQLITE_API int sqlite3_config(int op, ...){
138195138165
va_list ap;
138196138166
int rc = SQLITE_OK;
138197138167
138198138168
/* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while
138199138169
** the SQLite library is in use. */
@@ -138554,11 +138524,11 @@
138554138524
}
138555138525
138556138526
/*
138557138527
** Return the mutex associated with a database connection.
138558138528
*/
138559
-SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_db_mutex(sqlite3 *db){
138529
+SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3 *db){
138560138530
#ifdef SQLITE_ENABLE_API_ARMOR
138561138531
if( !sqlite3SafetyCheckOk(db) ){
138562138532
(void)SQLITE_MISUSE_BKPT;
138563138533
return 0;
138564138534
}
@@ -138568,11 +138538,11 @@
138568138538
138569138539
/*
138570138540
** Free up as much memory as we can from the given database
138571138541
** connection.
138572138542
*/
138573
-SQLITE_API int SQLITE_STDCALL sqlite3_db_release_memory(sqlite3 *db){
138543
+SQLITE_API int sqlite3_db_release_memory(sqlite3 *db){
138574138544
int i;
138575138545
138576138546
#ifdef SQLITE_ENABLE_API_ARMOR
138577138547
if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
138578138548
#endif
@@ -138592,11 +138562,11 @@
138592138562
138593138563
/*
138594138564
** Flush any dirty pages in the pager-cache for any attached database
138595138565
** to disk.
138596138566
*/
138597
-SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3 *db){
138567
+SQLITE_API int sqlite3_db_cacheflush(sqlite3 *db){
138598138568
int i;
138599138569
int rc = SQLITE_OK;
138600138570
int bSeenBusy = 0;
138601138571
138602138572
#ifdef SQLITE_ENABLE_API_ARMOR
@@ -138621,11 +138591,11 @@
138621138591
}
138622138592
138623138593
/*
138624138594
** Configuration settings for an individual database connection
138625138595
*/
138626
-SQLITE_API int SQLITE_CDECL sqlite3_db_config(sqlite3 *db, int op, ...){
138596
+SQLITE_API int sqlite3_db_config(sqlite3 *db, int op, ...){
138627138597
va_list ap;
138628138598
int rc;
138629138599
va_start(ap, op);
138630138600
switch( op ){
138631138601
case SQLITE_DBCONFIG_MAINDBNAME: {
@@ -138747,11 +138717,11 @@
138747138717
}
138748138718
138749138719
/*
138750138720
** Return the ROWID of the most recent insert
138751138721
*/
138752
-SQLITE_API sqlite_int64 SQLITE_STDCALL sqlite3_last_insert_rowid(sqlite3 *db){
138722
+SQLITE_API sqlite_int64 sqlite3_last_insert_rowid(sqlite3 *db){
138753138723
#ifdef SQLITE_ENABLE_API_ARMOR
138754138724
if( !sqlite3SafetyCheckOk(db) ){
138755138725
(void)SQLITE_MISUSE_BKPT;
138756138726
return 0;
138757138727
}
@@ -138760,11 +138730,11 @@
138760138730
}
138761138731
138762138732
/*
138763138733
** Return the number of changes in the most recent call to sqlite3_exec().
138764138734
*/
138765
-SQLITE_API int SQLITE_STDCALL sqlite3_changes(sqlite3 *db){
138735
+SQLITE_API int sqlite3_changes(sqlite3 *db){
138766138736
#ifdef SQLITE_ENABLE_API_ARMOR
138767138737
if( !sqlite3SafetyCheckOk(db) ){
138768138738
(void)SQLITE_MISUSE_BKPT;
138769138739
return 0;
138770138740
}
@@ -138773,11 +138743,11 @@
138773138743
}
138774138744
138775138745
/*
138776138746
** Return the number of changes since the database handle was opened.
138777138747
*/
138778
-SQLITE_API int SQLITE_STDCALL sqlite3_total_changes(sqlite3 *db){
138748
+SQLITE_API int sqlite3_total_changes(sqlite3 *db){
138779138749
#ifdef SQLITE_ENABLE_API_ARMOR
138780138750
if( !sqlite3SafetyCheckOk(db) ){
138781138751
(void)SQLITE_MISUSE_BKPT;
138782138752
return 0;
138783138753
}
@@ -138924,12 +138894,12 @@
138924138894
** statements or unfinished sqlite3_backups. The sqlite3_close_v2()
138925138895
** version forces the connection to become a zombie if there are
138926138896
** unclosed resources, and arranges for deallocation when the last
138927138897
** prepare statement or sqlite3_backup closes.
138928138898
*/
138929
-SQLITE_API int SQLITE_STDCALL sqlite3_close(sqlite3 *db){ return sqlite3Close(db,0); }
138930
-SQLITE_API int SQLITE_STDCALL sqlite3_close_v2(sqlite3 *db){ return sqlite3Close(db,1); }
138899
+SQLITE_API int sqlite3_close(sqlite3 *db){ return sqlite3Close(db,0); }
138900
+SQLITE_API int sqlite3_close_v2(sqlite3 *db){ return sqlite3Close(db,1); }
138931138901
138932138902
138933138903
/*
138934138904
** Close the mutex on database connection db.
138935138905
**
@@ -139332,11 +139302,11 @@
139332139302
139333139303
/*
139334139304
** This routine sets the busy callback for an Sqlite database to the
139335139305
** given callback function with the given argument.
139336139306
*/
139337
-SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(
139307
+SQLITE_API int sqlite3_busy_handler(
139338139308
sqlite3 *db,
139339139309
int (*xBusy)(void*,int),
139340139310
void *pArg
139341139311
){
139342139312
#ifdef SQLITE_ENABLE_API_ARMOR
@@ -139355,11 +139325,11 @@
139355139325
/*
139356139326
** This routine sets the progress callback for an Sqlite database to the
139357139327
** given callback function with the given argument. The progress callback will
139358139328
** be invoked every nOps opcodes.
139359139329
*/
139360
-SQLITE_API void SQLITE_STDCALL sqlite3_progress_handler(
139330
+SQLITE_API void sqlite3_progress_handler(
139361139331
sqlite3 *db,
139362139332
int nOps,
139363139333
int (*xProgress)(void*),
139364139334
void *pArg
139365139335
){
@@ -139386,11 +139356,11 @@
139386139356
139387139357
/*
139388139358
** This routine installs a default busy handler that waits for the
139389139359
** specified number of milliseconds before returning 0.
139390139360
*/
139391
-SQLITE_API int SQLITE_STDCALL sqlite3_busy_timeout(sqlite3 *db, int ms){
139361
+SQLITE_API int sqlite3_busy_timeout(sqlite3 *db, int ms){
139392139362
#ifdef SQLITE_ENABLE_API_ARMOR
139393139363
if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
139394139364
#endif
139395139365
if( ms>0 ){
139396139366
sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db);
@@ -139402,11 +139372,11 @@
139402139372
}
139403139373
139404139374
/*
139405139375
** Cause any pending operation to stop at its earliest opportunity.
139406139376
*/
139407
-SQLITE_API void SQLITE_STDCALL sqlite3_interrupt(sqlite3 *db){
139377
+SQLITE_API void sqlite3_interrupt(sqlite3 *db){
139408139378
#ifdef SQLITE_ENABLE_API_ARMOR
139409139379
if( !sqlite3SafetyCheckOk(db) ){
139410139380
(void)SQLITE_MISUSE_BKPT;
139411139381
return;
139412139382
}
@@ -139518,11 +139488,11 @@
139518139488
}
139519139489
139520139490
/*
139521139491
** Create new user functions.
139522139492
*/
139523
-SQLITE_API int SQLITE_STDCALL sqlite3_create_function(
139493
+SQLITE_API int sqlite3_create_function(
139524139494
sqlite3 *db,
139525139495
const char *zFunc,
139526139496
int nArg,
139527139497
int enc,
139528139498
void *p,
@@ -139532,11 +139502,11 @@
139532139502
){
139533139503
return sqlite3_create_function_v2(db, zFunc, nArg, enc, p, xSFunc, xStep,
139534139504
xFinal, 0);
139535139505
}
139536139506
139537
-SQLITE_API int SQLITE_STDCALL sqlite3_create_function_v2(
139507
+SQLITE_API int sqlite3_create_function_v2(
139538139508
sqlite3 *db,
139539139509
const char *zFunc,
139540139510
int nArg,
139541139511
int enc,
139542139512
void *p,
@@ -139575,11 +139545,11 @@
139575139545
sqlite3_mutex_leave(db->mutex);
139576139546
return rc;
139577139547
}
139578139548
139579139549
#ifndef SQLITE_OMIT_UTF16
139580
-SQLITE_API int SQLITE_STDCALL sqlite3_create_function16(
139550
+SQLITE_API int sqlite3_create_function16(
139581139551
sqlite3 *db,
139582139552
const void *zFunctionName,
139583139553
int nArg,
139584139554
int eTextRep,
139585139555
void *p,
@@ -139615,11 +139585,11 @@
139615139585
** When virtual tables intend to provide an overloaded function, they
139616139586
** should call this routine to make sure the global function exists.
139617139587
** A global function must exist in order for name resolution to work
139618139588
** properly.
139619139589
*/
139620
-SQLITE_API int SQLITE_STDCALL sqlite3_overload_function(
139590
+SQLITE_API int sqlite3_overload_function(
139621139591
sqlite3 *db,
139622139592
const char *zName,
139623139593
int nArg
139624139594
){
139625139595
int rc = SQLITE_OK;
@@ -139647,11 +139617,11 @@
139647139617
** A NULL trace function means that no tracing is executes. A non-NULL
139648139618
** trace is a pointer to a function that is invoked at the start of each
139649139619
** SQL statement.
139650139620
*/
139651139621
#ifndef SQLITE_OMIT_DEPRECATED
139652
-SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3 *db, void(*xTrace)(void*,const char*), void *pArg){
139622
+SQLITE_API void *sqlite3_trace(sqlite3 *db, void(*xTrace)(void*,const char*), void *pArg){
139653139623
void *pOld;
139654139624
139655139625
#ifdef SQLITE_ENABLE_API_ARMOR
139656139626
if( !sqlite3SafetyCheckOk(db) ){
139657139627
(void)SQLITE_MISUSE_BKPT;
@@ -139668,11 +139638,11 @@
139668139638
}
139669139639
#endif /* SQLITE_OMIT_DEPRECATED */
139670139640
139671139641
/* Register a trace callback using the version-2 interface.
139672139642
*/
139673
-SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2(
139643
+SQLITE_API int sqlite3_trace_v2(
139674139644
sqlite3 *db, /* Trace this connection */
139675139645
unsigned mTrace, /* Mask of events to be traced */
139676139646
int(*xTrace)(unsigned,void*,void*,void*), /* Callback to invoke */
139677139647
void *pArg /* Context */
139678139648
){
@@ -139698,11 +139668,11 @@
139698139668
**
139699139669
** A NULL profile function means that no profiling is executes. A non-NULL
139700139670
** profile is a pointer to a function that is invoked at the conclusion of
139701139671
** each SQL statement that is run.
139702139672
*/
139703
-SQLITE_API void *SQLITE_STDCALL sqlite3_profile(
139673
+SQLITE_API void *sqlite3_profile(
139704139674
sqlite3 *db,
139705139675
void (*xProfile)(void*,const char*,sqlite_uint64),
139706139676
void *pArg
139707139677
){
139708139678
void *pOld;
@@ -139726,11 +139696,11 @@
139726139696
/*
139727139697
** Register a function to be invoked when a transaction commits.
139728139698
** If the invoked function returns non-zero, then the commit becomes a
139729139699
** rollback.
139730139700
*/
139731
-SQLITE_API void *SQLITE_STDCALL sqlite3_commit_hook(
139701
+SQLITE_API void *sqlite3_commit_hook(
139732139702
sqlite3 *db, /* Attach the hook to this database */
139733139703
int (*xCallback)(void*), /* Function to invoke on each commit */
139734139704
void *pArg /* Argument to the function */
139735139705
){
139736139706
void *pOld;
@@ -139751,11 +139721,11 @@
139751139721
139752139722
/*
139753139723
** Register a callback to be invoked each time a row is updated,
139754139724
** inserted or deleted using this database connection.
139755139725
*/
139756
-SQLITE_API void *SQLITE_STDCALL sqlite3_update_hook(
139726
+SQLITE_API void *sqlite3_update_hook(
139757139727
sqlite3 *db, /* Attach the hook to this database */
139758139728
void (*xCallback)(void*,int,char const *,char const *,sqlite_int64),
139759139729
void *pArg /* Argument to the function */
139760139730
){
139761139731
void *pRet;
@@ -139776,11 +139746,11 @@
139776139746
139777139747
/*
139778139748
** Register a callback to be invoked each time a transaction is rolled
139779139749
** back by this database connection.
139780139750
*/
139781
-SQLITE_API void *SQLITE_STDCALL sqlite3_rollback_hook(
139751
+SQLITE_API void *sqlite3_rollback_hook(
139782139752
sqlite3 *db, /* Attach the hook to this database */
139783139753
void (*xCallback)(void*), /* Callback function */
139784139754
void *pArg /* Argument to the function */
139785139755
){
139786139756
void *pRet;
@@ -139802,11 +139772,11 @@
139802139772
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
139803139773
/*
139804139774
** Register a callback to be invoked each time a row is updated,
139805139775
** inserted or deleted using this database connection.
139806139776
*/
139807
-SQLITE_API void *SQLITE_STDCALL sqlite3_preupdate_hook(
139777
+SQLITE_API void *sqlite3_preupdate_hook(
139808139778
sqlite3 *db, /* Attach the hook to this database */
139809139779
void(*xCallback)( /* Callback function */
139810139780
void*,sqlite3*,int,char const*,char const*,sqlite3_int64,sqlite3_int64),
139811139781
void *pArg /* First callback argument */
139812139782
){
@@ -139851,11 +139821,11 @@
139851139821
** The callback registered by this function replaces any existing callback
139852139822
** registered using sqlite3_wal_hook(). Likewise, registering a callback
139853139823
** using sqlite3_wal_hook() disables the automatic checkpoint mechanism
139854139824
** configured by this function.
139855139825
*/
139856
-SQLITE_API int SQLITE_STDCALL sqlite3_wal_autocheckpoint(sqlite3 *db, int nFrame){
139826
+SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int nFrame){
139857139827
#ifdef SQLITE_OMIT_WAL
139858139828
UNUSED_PARAMETER(db);
139859139829
UNUSED_PARAMETER(nFrame);
139860139830
#else
139861139831
#ifdef SQLITE_ENABLE_API_ARMOR
@@ -139872,11 +139842,11 @@
139872139842
139873139843
/*
139874139844
** Register a callback to be invoked each time a transaction is written
139875139845
** into the write-ahead-log by this database connection.
139876139846
*/
139877
-SQLITE_API void *SQLITE_STDCALL sqlite3_wal_hook(
139847
+SQLITE_API void *sqlite3_wal_hook(
139878139848
sqlite3 *db, /* Attach the hook to this db handle */
139879139849
int(*xCallback)(void *, sqlite3*, const char*, int),
139880139850
void *pArg /* First argument passed to xCallback() */
139881139851
){
139882139852
#ifndef SQLITE_OMIT_WAL
@@ -139899,11 +139869,11 @@
139899139869
}
139900139870
139901139871
/*
139902139872
** Checkpoint database zDb.
139903139873
*/
139904
-SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint_v2(
139874
+SQLITE_API int sqlite3_wal_checkpoint_v2(
139905139875
sqlite3 *db, /* Database handle */
139906139876
const char *zDb, /* Name of attached database (or NULL) */
139907139877
int eMode, /* SQLITE_CHECKPOINT_* value */
139908139878
int *pnLog, /* OUT: Size of WAL log in frames */
139909139879
int *pnCkpt /* OUT: Total number of frames checkpointed */
@@ -139954,11 +139924,11 @@
139954139924
/*
139955139925
** Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points
139956139926
** to contains a zero-length string, all attached databases are
139957139927
** checkpointed.
139958139928
*/
139959
-SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){
139929
+SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){
139960139930
/* EVIDENCE-OF: R-41613-20553 The sqlite3_wal_checkpoint(D,X) is equivalent to
139961139931
** sqlite3_wal_checkpoint_v2(D,X,SQLITE_CHECKPOINT_PASSIVE,0,0). */
139962139932
return sqlite3_wal_checkpoint_v2(db,zDb,SQLITE_CHECKPOINT_PASSIVE,0,0);
139963139933
}
139964139934
@@ -140045,11 +140015,11 @@
140045140015
140046140016
/*
140047140017
** Return UTF-8 encoded English language explanation of the most recent
140048140018
** error.
140049140019
*/
140050
-SQLITE_API const char *SQLITE_STDCALL sqlite3_errmsg(sqlite3 *db){
140020
+SQLITE_API const char *sqlite3_errmsg(sqlite3 *db){
140051140021
const char *z;
140052140022
if( !db ){
140053140023
return sqlite3ErrStr(SQLITE_NOMEM_BKPT);
140054140024
}
140055140025
if( !sqlite3SafetyCheckSickOrOk(db) ){
@@ -140073,11 +140043,11 @@
140073140043
#ifndef SQLITE_OMIT_UTF16
140074140044
/*
140075140045
** Return UTF-16 encoded English language explanation of the most recent
140076140046
** error.
140077140047
*/
140078
-SQLITE_API const void *SQLITE_STDCALL sqlite3_errmsg16(sqlite3 *db){
140048
+SQLITE_API const void *sqlite3_errmsg16(sqlite3 *db){
140079140049
static const u16 outOfMem[] = {
140080140050
'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0
140081140051
};
140082140052
static const u16 misuse[] = {
140083140053
'l', 'i', 'b', 'r', 'a', 'r', 'y', ' ',
@@ -140118,38 +140088,38 @@
140118140088
140119140089
/*
140120140090
** Return the most recent error code generated by an SQLite routine. If NULL is
140121140091
** passed to this function, we assume a malloc() failed during sqlite3_open().
140122140092
*/
140123
-SQLITE_API int SQLITE_STDCALL sqlite3_errcode(sqlite3 *db){
140093
+SQLITE_API int sqlite3_errcode(sqlite3 *db){
140124140094
if( db && !sqlite3SafetyCheckSickOrOk(db) ){
140125140095
return SQLITE_MISUSE_BKPT;
140126140096
}
140127140097
if( !db || db->mallocFailed ){
140128140098
return SQLITE_NOMEM_BKPT;
140129140099
}
140130140100
return db->errCode & db->errMask;
140131140101
}
140132
-SQLITE_API int SQLITE_STDCALL sqlite3_extended_errcode(sqlite3 *db){
140102
+SQLITE_API int sqlite3_extended_errcode(sqlite3 *db){
140133140103
if( db && !sqlite3SafetyCheckSickOrOk(db) ){
140134140104
return SQLITE_MISUSE_BKPT;
140135140105
}
140136140106
if( !db || db->mallocFailed ){
140137140107
return SQLITE_NOMEM_BKPT;
140138140108
}
140139140109
return db->errCode;
140140140110
}
140141
-SQLITE_API int SQLITE_STDCALL sqlite3_system_errno(sqlite3 *db){
140111
+SQLITE_API int sqlite3_system_errno(sqlite3 *db){
140142140112
return db ? db->iSysErrno : 0;
140143140113
}
140144140114
140145140115
/*
140146140116
** Return a string that describes the kind of error specified in the
140147140117
** argument. For now, this simply calls the internal sqlite3ErrStr()
140148140118
** function.
140149140119
*/
140150
-SQLITE_API const char *SQLITE_STDCALL sqlite3_errstr(int rc){
140120
+SQLITE_API const char *sqlite3_errstr(int rc){
140151140121
return sqlite3ErrStr(rc);
140152140122
}
140153140123
140154140124
/*
140155140125
** Create a new collating function for database "db". The name is zName
@@ -140293,11 +140263,11 @@
140293140263
**
140294140264
** A new lower limit does not shrink existing constructs.
140295140265
** It merely prevents new constructs that exceed the limit
140296140266
** from forming.
140297140267
*/
140298
-SQLITE_API int SQLITE_STDCALL sqlite3_limit(sqlite3 *db, int limitId, int newLimit){
140268
+SQLITE_API int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){
140299140269
int oldLimit;
140300140270
140301140271
#ifdef SQLITE_ENABLE_API_ARMOR
140302140272
if( !sqlite3SafetyCheckOk(db) ){
140303140273
(void)SQLITE_MISUSE_BKPT;
@@ -140920,18 +140890,18 @@
140920140890
}
140921140891
140922140892
/*
140923140893
** Open a new database handle.
140924140894
*/
140925
-SQLITE_API int SQLITE_STDCALL sqlite3_open(
140895
+SQLITE_API int sqlite3_open(
140926140896
const char *zFilename,
140927140897
sqlite3 **ppDb
140928140898
){
140929140899
return openDatabase(zFilename, ppDb,
140930140900
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);
140931140901
}
140932
-SQLITE_API int SQLITE_STDCALL sqlite3_open_v2(
140902
+SQLITE_API int sqlite3_open_v2(
140933140903
const char *filename, /* Database filename (UTF-8) */
140934140904
sqlite3 **ppDb, /* OUT: SQLite db handle */
140935140905
int flags, /* Flags */
140936140906
const char *zVfs /* Name of VFS module to use */
140937140907
){
@@ -140940,11 +140910,11 @@
140940140910
140941140911
#ifndef SQLITE_OMIT_UTF16
140942140912
/*
140943140913
** Open a new database handle.
140944140914
*/
140945
-SQLITE_API int SQLITE_STDCALL sqlite3_open16(
140915
+SQLITE_API int sqlite3_open16(
140946140916
const void *zFilename,
140947140917
sqlite3 **ppDb
140948140918
){
140949140919
char const *zFilename8; /* zFilename encoded in UTF-8 instead of UTF-16 */
140950140920
sqlite3_value *pVal;
@@ -140979,11 +140949,11 @@
140979140949
#endif /* SQLITE_OMIT_UTF16 */
140980140950
140981140951
/*
140982140952
** Register a new collation sequence with the database handle db.
140983140953
*/
140984
-SQLITE_API int SQLITE_STDCALL sqlite3_create_collation(
140954
+SQLITE_API int sqlite3_create_collation(
140985140955
sqlite3* db,
140986140956
const char *zName,
140987140957
int enc,
140988140958
void* pCtx,
140989140959
int(*xCompare)(void*,int,const void*,int,const void*)
@@ -140992,11 +140962,11 @@
140992140962
}
140993140963
140994140964
/*
140995140965
** Register a new collation sequence with the database handle db.
140996140966
*/
140997
-SQLITE_API int SQLITE_STDCALL sqlite3_create_collation_v2(
140967
+SQLITE_API int sqlite3_create_collation_v2(
140998140968
sqlite3* db,
140999140969
const char *zName,
141000140970
int enc,
141001140971
void* pCtx,
141002140972
int(*xCompare)(void*,int,const void*,int,const void*),
@@ -141017,11 +140987,11 @@
141017140987
141018140988
#ifndef SQLITE_OMIT_UTF16
141019140989
/*
141020140990
** Register a new collation sequence with the database handle db.
141021140991
*/
141022
-SQLITE_API int SQLITE_STDCALL sqlite3_create_collation16(
140992
+SQLITE_API int sqlite3_create_collation16(
141023140993
sqlite3* db,
141024140994
const void *zName,
141025140995
int enc,
141026140996
void* pCtx,
141027140997
int(*xCompare)(void*,int,const void*,int,const void*)
@@ -141047,11 +141017,11 @@
141047141017
141048141018
/*
141049141019
** Register a collation sequence factory callback with the database handle
141050141020
** db. Replace any previously installed collation sequence factory.
141051141021
*/
141052
-SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed(
141022
+SQLITE_API int sqlite3_collation_needed(
141053141023
sqlite3 *db,
141054141024
void *pCollNeededArg,
141055141025
void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*)
141056141026
){
141057141027
#ifdef SQLITE_ENABLE_API_ARMOR
@@ -141068,11 +141038,11 @@
141068141038
#ifndef SQLITE_OMIT_UTF16
141069141039
/*
141070141040
** Register a collation sequence factory callback with the database handle
141071141041
** db. Replace any previously installed collation sequence factory.
141072141042
*/
141073
-SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed16(
141043
+SQLITE_API int sqlite3_collation_needed16(
141074141044
sqlite3 *db,
141075141045
void *pCollNeededArg,
141076141046
void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*)
141077141047
){
141078141048
#ifdef SQLITE_ENABLE_API_ARMOR
@@ -141090,11 +141060,11 @@
141090141060
#ifndef SQLITE_OMIT_DEPRECATED
141091141061
/*
141092141062
** This function is now an anachronism. It used to be used to recover from a
141093141063
** malloc() failure, but SQLite now does this automatically.
141094141064
*/
141095
-SQLITE_API int SQLITE_STDCALL sqlite3_global_recover(void){
141065
+SQLITE_API int sqlite3_global_recover(void){
141096141066
return SQLITE_OK;
141097141067
}
141098141068
#endif
141099141069
141100141070
/*
@@ -141101,11 +141071,11 @@
141101141071
** Test to see whether or not the database connection is in autocommit
141102141072
** mode. Return TRUE if it is and FALSE if not. Autocommit mode is on
141103141073
** by default. Autocommit is disabled by a BEGIN statement and reenabled
141104141074
** by the next COMMIT or ROLLBACK.
141105141075
*/
141106
-SQLITE_API int SQLITE_STDCALL sqlite3_get_autocommit(sqlite3 *db){
141076
+SQLITE_API int sqlite3_get_autocommit(sqlite3 *db){
141107141077
#ifdef SQLITE_ENABLE_API_ARMOR
141108141078
if( !sqlite3SafetyCheckOk(db) ){
141109141079
(void)SQLITE_MISUSE_BKPT;
141110141080
return 0;
141111141081
}
@@ -141158,19 +141128,19 @@
141158141128
** data for this thread has been deallocated.
141159141129
**
141160141130
** SQLite no longer uses thread-specific data so this routine is now a
141161141131
** no-op. It is retained for historical compatibility.
141162141132
*/
141163
-SQLITE_API void SQLITE_STDCALL sqlite3_thread_cleanup(void){
141133
+SQLITE_API void sqlite3_thread_cleanup(void){
141164141134
}
141165141135
#endif
141166141136
141167141137
/*
141168141138
** Return meta information about a specific column of a database table.
141169141139
** See comment in sqlite3.h (sqlite.h.in) for details.
141170141140
*/
141171
-SQLITE_API int SQLITE_STDCALL sqlite3_table_column_metadata(
141141
+SQLITE_API int sqlite3_table_column_metadata(
141172141142
sqlite3 *db, /* Connection handle */
141173141143
const char *zDbName, /* Database name or NULL */
141174141144
const char *zTableName, /* Table name */
141175141145
const char *zColumnName, /* Column name */
141176141146
char const **pzDataType, /* OUTPUT: Declared data type */
@@ -141284,11 +141254,11 @@
141284141254
}
141285141255
141286141256
/*
141287141257
** Sleep for a little while. Return the amount of time slept.
141288141258
*/
141289
-SQLITE_API int SQLITE_STDCALL sqlite3_sleep(int ms){
141259
+SQLITE_API int sqlite3_sleep(int ms){
141290141260
sqlite3_vfs *pVfs;
141291141261
int rc;
141292141262
pVfs = sqlite3_vfs_find(0);
141293141263
if( pVfs==0 ) return 0;
141294141264
@@ -141300,11 +141270,11 @@
141300141270
}
141301141271
141302141272
/*
141303141273
** Enable or disable the extended result codes.
141304141274
*/
141305
-SQLITE_API int SQLITE_STDCALL sqlite3_extended_result_codes(sqlite3 *db, int onoff){
141275
+SQLITE_API int sqlite3_extended_result_codes(sqlite3 *db, int onoff){
141306141276
#ifdef SQLITE_ENABLE_API_ARMOR
141307141277
if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
141308141278
#endif
141309141279
sqlite3_mutex_enter(db->mutex);
141310141280
db->errMask = onoff ? 0xffffffff : 0xff;
@@ -141313,11 +141283,11 @@
141313141283
}
141314141284
141315141285
/*
141316141286
** Invoke the xFileControl method on a particular database.
141317141287
*/
141318
-SQLITE_API int SQLITE_STDCALL sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){
141288
+SQLITE_API int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){
141319141289
int rc = SQLITE_ERROR;
141320141290
Btree *pBtree;
141321141291
141322141292
#ifdef SQLITE_ENABLE_API_ARMOR
141323141293
if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
@@ -141353,11 +141323,11 @@
141353141323
}
141354141324
141355141325
/*
141356141326
** Interface to the testing logic.
141357141327
*/
141358
-SQLITE_API int SQLITE_CDECL sqlite3_test_control(int op, ...){
141328
+SQLITE_API int sqlite3_test_control(int op, ...){
141359141329
int rc = 0;
141360141330
#ifdef SQLITE_OMIT_BUILTIN_TEST
141361141331
UNUSED_PARAMETER(op);
141362141332
#else
141363141333
va_list ap;
@@ -141621,10 +141591,19 @@
141621141591
case SQLITE_TESTCTRL_NEVER_CORRUPT: {
141622141592
sqlite3GlobalConfig.neverCorrupt = va_arg(ap, int);
141623141593
break;
141624141594
}
141625141595
141596
+ /* Set the threshold at which OP_Once counters reset back to zero.
141597
+ ** By default this is 0x7ffffffe (over 2 billion), but that value is
141598
+ ** too big to test in a reasonable amount of time, so this control is
141599
+ ** provided to set a small and easily reachable reset value.
141600
+ */
141601
+ case SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD: {
141602
+ sqlite3GlobalConfig.iOnceResetThreshold = va_arg(ap, int);
141603
+ break;
141604
+ }
141626141605
141627141606
/* sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE, xCallback, ptr);
141628141607
**
141629141608
** Set the VDBE coverage callback function to xCallback with context
141630141609
** pointer ptr.
@@ -141698,11 +141677,11 @@
141698141677
** method of a VFS implementation. The zParam argument is the name of the
141699141678
** query parameter we seek. This routine returns the value of the zParam
141700141679
** parameter if it exists. If the parameter does not exist, this routine
141701141680
** returns a NULL pointer.
141702141681
*/
141703
-SQLITE_API const char *SQLITE_STDCALL sqlite3_uri_parameter(const char *zFilename, const char *zParam){
141682
+SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam){
141704141683
if( zFilename==0 || zParam==0 ) return 0;
141705141684
zFilename += sqlite3Strlen30(zFilename) + 1;
141706141685
while( zFilename[0] ){
141707141686
int x = strcmp(zFilename, zParam);
141708141687
zFilename += sqlite3Strlen30(zFilename) + 1;
@@ -141713,20 +141692,20 @@
141713141692
}
141714141693
141715141694
/*
141716141695
** Return a boolean value for a query parameter.
141717141696
*/
141718
-SQLITE_API int SQLITE_STDCALL sqlite3_uri_boolean(const char *zFilename, const char *zParam, int bDflt){
141697
+SQLITE_API int sqlite3_uri_boolean(const char *zFilename, const char *zParam, int bDflt){
141719141698
const char *z = sqlite3_uri_parameter(zFilename, zParam);
141720141699
bDflt = bDflt!=0;
141721141700
return z ? sqlite3GetBoolean(z, bDflt) : bDflt;
141722141701
}
141723141702
141724141703
/*
141725141704
** Return a 64-bit integer value for a query parameter.
141726141705
*/
141727
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_uri_int64(
141706
+SQLITE_API sqlite3_int64 sqlite3_uri_int64(
141728141707
const char *zFilename, /* Filename as passed to xOpen */
141729141708
const char *zParam, /* URI parameter sought */
141730141709
sqlite3_int64 bDflt /* return if parameter is missing */
141731141710
){
141732141711
const char *z = sqlite3_uri_parameter(zFilename, zParam);
@@ -141754,11 +141733,11 @@
141754141733
141755141734
/*
141756141735
** Return the filename of the database associated with a database
141757141736
** connection.
141758141737
*/
141759
-SQLITE_API const char *SQLITE_STDCALL sqlite3_db_filename(sqlite3 *db, const char *zDbName){
141738
+SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName){
141760141739
Btree *pBt;
141761141740
#ifdef SQLITE_ENABLE_API_ARMOR
141762141741
if( !sqlite3SafetyCheckOk(db) ){
141763141742
(void)SQLITE_MISUSE_BKPT;
141764141743
return 0;
@@ -141770,11 +141749,11 @@
141770141749
141771141750
/*
141772141751
** Return 1 if database is read-only or 0 if read/write. Return -1 if
141773141752
** no such database exists.
141774141753
*/
141775
-SQLITE_API int SQLITE_STDCALL sqlite3_db_readonly(sqlite3 *db, const char *zDbName){
141754
+SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName){
141776141755
Btree *pBt;
141777141756
#ifdef SQLITE_ENABLE_API_ARMOR
141778141757
if( !sqlite3SafetyCheckOk(db) ){
141779141758
(void)SQLITE_MISUSE_BKPT;
141780141759
return -1;
@@ -141787,11 +141766,11 @@
141787141766
#ifdef SQLITE_ENABLE_SNAPSHOT
141788141767
/*
141789141768
** Obtain a snapshot handle for the snapshot of database zDb currently
141790141769
** being read by handle db.
141791141770
*/
141792
-SQLITE_API int SQLITE_STDCALL sqlite3_snapshot_get(
141771
+SQLITE_API int sqlite3_snapshot_get(
141793141772
sqlite3 *db,
141794141773
const char *zDb,
141795141774
sqlite3_snapshot **ppSnapshot
141796141775
){
141797141776
int rc = SQLITE_ERROR;
@@ -141822,11 +141801,11 @@
141822141801
}
141823141802
141824141803
/*
141825141804
** Open a read-transaction on the snapshot idendified by pSnapshot.
141826141805
*/
141827
-SQLITE_API int SQLITE_STDCALL sqlite3_snapshot_open(
141806
+SQLITE_API int sqlite3_snapshot_open(
141828141807
sqlite3 *db,
141829141808
const char *zDb,
141830141809
sqlite3_snapshot *pSnapshot
141831141810
){
141832141811
int rc = SQLITE_ERROR;
@@ -141859,11 +141838,11 @@
141859141838
}
141860141839
141861141840
/*
141862141841
** Free a snapshot handle obtained from sqlite3_snapshot_get().
141863141842
*/
141864
-SQLITE_API void SQLITE_STDCALL sqlite3_snapshot_free(sqlite3_snapshot *pSnapshot){
141843
+SQLITE_API void sqlite3_snapshot_free(sqlite3_snapshot *pSnapshot){
141865141844
sqlite3_free(pSnapshot);
141866141845
}
141867141846
#endif /* SQLITE_ENABLE_SNAPSHOT */
141868141847
141869141848
/************** End of main.c ************************************************/
@@ -142013,11 +141992,11 @@
142013141992
**
142014141993
** Each call to this routine overrides any prior callbacks registered
142015141994
** on the same "db". If xNotify==0 then any prior callbacks are immediately
142016141995
** cancelled.
142017141996
*/
142018
-SQLITE_API int SQLITE_STDCALL sqlite3_unlock_notify(
141997
+SQLITE_API int sqlite3_unlock_notify(
142019141998
sqlite3 *db,
142020141999
void (*xNotify)(void **, int),
142021142000
void *pArg
142022142001
){
142023142002
int rc = SQLITE_OK;
@@ -149016,11 +148995,11 @@
149016148995
** Initialize API pointer table, if required.
149017148996
*/
149018148997
#ifdef _WIN32
149019148998
__declspec(dllexport)
149020148999
#endif
149021
-SQLITE_API int SQLITE_STDCALL sqlite3_fts3_init(
149000
+SQLITE_API int sqlite3_fts3_init(
149022149001
sqlite3 *db,
149023149002
char **pzErrMsg,
149024149003
const sqlite3_api_routines *pApi
149025149004
){
149026149005
SQLITE_EXTENSION_INIT2(pApi)
@@ -164817,11 +164796,11 @@
164817164796
}
164818164797
164819164798
/*
164820164799
** Register a new geometry function for use with the r-tree MATCH operator.
164821164800
*/
164822
-SQLITE_API int SQLITE_STDCALL sqlite3_rtree_geometry_callback(
164801
+SQLITE_API int sqlite3_rtree_geometry_callback(
164823164802
sqlite3 *db, /* Register SQL function on this connection */
164824164803
const char *zGeom, /* Name of the new SQL function */
164825164804
int (*xGeom)(sqlite3_rtree_geometry*,int,RtreeDValue*,int*), /* Callback */
164826164805
void *pContext /* Extra data associated with the callback */
164827164806
){
@@ -164841,11 +164820,11 @@
164841164820
164842164821
/*
164843164822
** Register a new 2nd-generation geometry function for use with the
164844164823
** r-tree MATCH operator.
164845164824
*/
164846
-SQLITE_API int SQLITE_STDCALL sqlite3_rtree_query_callback(
164825
+SQLITE_API int sqlite3_rtree_query_callback(
164847164826
sqlite3 *db, /* Register SQL function on this connection */
164848164827
const char *zQueryFunc, /* Name of new SQL function */
164849164828
int (*xQueryFunc)(sqlite3_rtree_query_info*), /* Callback */
164850164829
void *pContext, /* Extra data passed into the callback */
164851164830
void (*xDestructor)(void*) /* Destructor for the extra data */
@@ -164866,11 +164845,11 @@
164866164845
164867164846
#if !SQLITE_CORE
164868164847
#ifdef _WIN32
164869164848
__declspec(dllexport)
164870164849
#endif
164871
-SQLITE_API int SQLITE_STDCALL sqlite3_rtree_init(
164850
+SQLITE_API int sqlite3_rtree_init(
164872164851
sqlite3 *db,
164873164852
char **pzErrMsg,
164874164853
const sqlite3_api_routines *pApi
164875164854
){
164876164855
SQLITE_EXTENSION_INIT2(pApi)
@@ -165417,11 +165396,11 @@
165417165396
165418165397
#if !SQLITE_CORE
165419165398
#ifdef _WIN32
165420165399
__declspec(dllexport)
165421165400
#endif
165422
-SQLITE_API int SQLITE_STDCALL sqlite3_icu_init(
165401
+SQLITE_API int sqlite3_icu_init(
165423165402
sqlite3 *db,
165424165403
char **pzErrMsg,
165425165404
const sqlite3_api_routines *pApi
165426165405
){
165427165406
SQLITE_EXTENSION_INIT2(pApi)
@@ -166097,11 +166076,11 @@
166097166076
** IMPORTANT NOTE FOR ZIPVFS USERS: The RBU extension works with all of
166098166077
** SQLite's built-in VFSs, including the multiplexor VFS. However it does
166099166078
** not work out of the box with zipvfs. Refer to the comment describing
166100166079
** the zipvfs_create_vfs() API below for details on using RBU with zipvfs.
166101166080
*/
166102
-SQLITE_API sqlite3rbu *SQLITE_STDCALL sqlite3rbu_open(
166081
+SQLITE_API sqlite3rbu *sqlite3rbu_open(
166103166082
const char *zTarget,
166104166083
const char *zRbu,
166105166084
const char *zState
166106166085
);
166107166086
@@ -166136,11 +166115,11 @@
166136166115
** As with sqlite3rbu_open(), Zipvfs users should rever to the comment
166137166116
** describing the sqlite3rbu_create_vfs() API function below for
166138166117
** a description of the complications associated with using RBU with
166139166118
** zipvfs databases.
166140166119
*/
166141
-SQLITE_API sqlite3rbu *SQLITE_STDCALL sqlite3rbu_vacuum(
166120
+SQLITE_API sqlite3rbu *sqlite3rbu_vacuum(
166142166121
const char *zTarget,
166143166122
const char *zState
166144166123
);
166145166124
166146166125
/*
@@ -166172,11 +166151,11 @@
166172166151
** when sqlite3rbu_close() is called.
166173166152
**
166174166153
** Database handles returned by this function remain valid until the next
166175166154
** call to any sqlite3rbu_xxx() function other than sqlite3rbu_db().
166176166155
*/
166177
-SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3rbu_db(sqlite3rbu*, int bRbu);
166156
+SQLITE_API sqlite3 *sqlite3rbu_db(sqlite3rbu*, int bRbu);
166178166157
166179166158
/*
166180166159
** Do some work towards applying the RBU update to the target db.
166181166160
**
166182166161
** Return SQLITE_DONE if the update has been completely applied, or
@@ -166186,11 +166165,11 @@
166186166165
**
166187166166
** Once a call to sqlite3rbu_step() has returned a value other than
166188166167
** SQLITE_OK, all subsequent calls on the same RBU handle are no-ops
166189166168
** that immediately return the same value.
166190166169
*/
166191
-SQLITE_API int SQLITE_STDCALL sqlite3rbu_step(sqlite3rbu *pRbu);
166170
+SQLITE_API int sqlite3rbu_step(sqlite3rbu *pRbu);
166192166171
166193166172
/*
166194166173
** Force RBU to save its state to disk.
166195166174
**
166196166175
** If a power failure or application crash occurs during an update, following
@@ -166198,11 +166177,11 @@
166198166177
** was last saved. In other words, from the most recent successful call to
166199166178
** sqlite3rbu_close() or this function.
166200166179
**
166201166180
** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
166202166181
*/
166203
-SQLITE_API int SQLITE_STDCALL sqlite3rbu_savestate(sqlite3rbu *pRbu);
166182
+SQLITE_API int sqlite3rbu_savestate(sqlite3rbu *pRbu);
166204166183
166205166184
/*
166206166185
** Close an RBU handle.
166207166186
**
166208166187
** If the RBU update has been completely applied, mark the RBU database
@@ -166218,18 +166197,18 @@
166218166197
**
166219166198
** Otherwise, if no error occurs, this function returns SQLITE_OK if the
166220166199
** update has been partially applied, or SQLITE_DONE if it has been
166221166200
** completely applied.
166222166201
*/
166223
-SQLITE_API int SQLITE_STDCALL sqlite3rbu_close(sqlite3rbu *pRbu, char **pzErrmsg);
166202
+SQLITE_API int sqlite3rbu_close(sqlite3rbu *pRbu, char **pzErrmsg);
166224166203
166225166204
/*
166226166205
** Return the total number of key-value operations (inserts, deletes or
166227166206
** updates) that have been performed on the target database since the
166228166207
** current RBU update was started.
166229166208
*/
166230
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3rbu_progress(sqlite3rbu *pRbu);
166209
+SQLITE_API sqlite3_int64 sqlite3rbu_progress(sqlite3rbu *pRbu);
166231166210
166232166211
/*
166233166212
** Obtain permyriadage (permyriadage is to 10000 as percentage is to 100)
166234166213
** progress indications for the two stages of an RBU update. This API may
166235166214
** be useful for driving GUI progress indicators and similar.
@@ -166267,11 +166246,11 @@
166267166246
** permyriadage progress of the same stage. If the rbu_count table does
166268166247
** not exist, then (*pnOne) is set to -1 during stage 1. If the rbu_count
166269166248
** table exists but is not correctly populated, the value of the *pnOne
166270166249
** output variable during stage 1 is undefined.
166271166250
*/
166272
-SQLITE_API void SQLITE_STDCALL sqlite3rbu_bp_progress(sqlite3rbu *pRbu, int *pnOne, int *pnTwo);
166251
+SQLITE_API void sqlite3rbu_bp_progress(sqlite3rbu *pRbu, int *pnOne, int *pnTwo);
166273166252
166274166253
/*
166275166254
** Obtain an indication as to the current stage of an RBU update or vacuum.
166276166255
** This function always returns one of the SQLITE_RBU_STATE_XXX constants
166277166256
** defined in this file. Return values should be interpreted as follows:
@@ -166305,11 +166284,11 @@
166305166284
#define SQLITE_RBU_STATE_MOVE 2
166306166285
#define SQLITE_RBU_STATE_CHECKPOINT 3
166307166286
#define SQLITE_RBU_STATE_DONE 4
166308166287
#define SQLITE_RBU_STATE_ERROR 5
166309166288
166310
-SQLITE_API int SQLITE_STDCALL sqlite3rbu_state(sqlite3rbu *pRbu);
166289
+SQLITE_API int sqlite3rbu_state(sqlite3rbu *pRbu);
166311166290
166312166291
/*
166313166292
** Create an RBU VFS named zName that accesses the underlying file-system
166314166293
** via existing VFS zParent. Or, if the zParent parameter is passed NULL,
166315166294
** then the new RBU VFS uses the default system VFS to access the file-system.
@@ -166349,21 +166328,21 @@
166349166328
** The overhead of adding the "rbu" VFS to the system is negligible for
166350166329
** non-RBU users. There is no harm in an application accessing the
166351166330
** file-system via "rbu" all the time, even if it only uses RBU functionality
166352166331
** occasionally.
166353166332
*/
166354
-SQLITE_API int SQLITE_STDCALL sqlite3rbu_create_vfs(const char *zName, const char *zParent);
166333
+SQLITE_API int sqlite3rbu_create_vfs(const char *zName, const char *zParent);
166355166334
166356166335
/*
166357166336
** Deregister and destroy an RBU vfs created by an earlier call to
166358166337
** sqlite3rbu_create_vfs().
166359166338
**
166360166339
** VFS objects are not reference counted. If a VFS object is destroyed
166361166340
** before all database handles that use it have been closed, the results
166362166341
** are undefined.
166363166342
*/
166364
-SQLITE_API void SQLITE_STDCALL sqlite3rbu_destroy_vfs(const char *zName);
166343
+SQLITE_API void sqlite3rbu_destroy_vfs(const char *zName);
166365166344
166366166345
#if 0
166367166346
} /* end of the 'extern "C"' block */
166368166347
#endif
166369166348
@@ -169456,11 +169435,11 @@
169456169435
}
169457169436
169458169437
/*
169459169438
** Step the RBU object.
169460169439
*/
169461
-SQLITE_API int SQLITE_STDCALL sqlite3rbu_step(sqlite3rbu *p){
169440
+SQLITE_API int sqlite3rbu_step(sqlite3rbu *p){
169462169441
if( p ){
169463169442
switch( p->eStage ){
169464169443
case RBU_STAGE_OAL: {
169465169444
RbuObjIter *pIter = &p->objiter;
169466169445
@@ -169910,11 +169889,11 @@
169910169889
}
169911169890
169912169891
/*
169913169892
** Open and return a new RBU handle.
169914169893
*/
169915
-SQLITE_API sqlite3rbu *SQLITE_STDCALL sqlite3rbu_open(
169894
+SQLITE_API sqlite3rbu *sqlite3rbu_open(
169916169895
const char *zTarget,
169917169896
const char *zRbu,
169918169897
const char *zState
169919169898
){
169920169899
if( zTarget==0 || zRbu==0 ){ return rbuMisuseError(); }
@@ -169923,11 +169902,11 @@
169923169902
}
169924169903
169925169904
/*
169926169905
** Open a handle to begin or resume an RBU VACUUM operation.
169927169906
*/
169928
-SQLITE_API sqlite3rbu *SQLITE_STDCALL sqlite3rbu_vacuum(
169907
+SQLITE_API sqlite3rbu *sqlite3rbu_vacuum(
169929169908
const char *zTarget,
169930169909
const char *zState
169931169910
){
169932169911
if( zTarget==0 ){ return rbuMisuseError(); }
169933169912
/* TODO: Check that both arguments are non-NULL */
@@ -169935,11 +169914,11 @@
169935169914
}
169936169915
169937169916
/*
169938169917
** Return the database handle used by pRbu.
169939169918
*/
169940
-SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3rbu_db(sqlite3rbu *pRbu, int bRbu){
169919
+SQLITE_API sqlite3 *sqlite3rbu_db(sqlite3rbu *pRbu, int bRbu){
169941169920
sqlite3 *db = 0;
169942169921
if( pRbu ){
169943169922
db = (bRbu ? pRbu->dbRbu : pRbu->dbMain);
169944169923
}
169945169924
return db;
@@ -169967,11 +169946,11 @@
169967169946
}
169968169947
169969169948
/*
169970169949
** Close the RBU handle.
169971169950
*/
169972
-SQLITE_API int SQLITE_STDCALL sqlite3rbu_close(sqlite3rbu *p, char **pzErrmsg){
169951
+SQLITE_API int sqlite3rbu_close(sqlite3rbu *p, char **pzErrmsg){
169973169952
int rc;
169974169953
if( p ){
169975169954
169976169955
/* Commit the transaction to the *-oal file. */
169977169956
if( p->rc==SQLITE_OK && p->eStage==RBU_STAGE_OAL ){
@@ -170019,19 +169998,19 @@
170019169998
/*
170020169999
** Return the total number of key-value operations (inserts, deletes or
170021170000
** updates) that have been performed on the target database since the
170022170001
** current RBU update was started.
170023170002
*/
170024
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3rbu_progress(sqlite3rbu *pRbu){
170003
+SQLITE_API sqlite3_int64 sqlite3rbu_progress(sqlite3rbu *pRbu){
170025170004
return pRbu->nProgress;
170026170005
}
170027170006
170028170007
/*
170029170008
** Return permyriadage progress indications for the two main stages of
170030170009
** an RBU update.
170031170010
*/
170032
-SQLITE_API void SQLITE_STDCALL sqlite3rbu_bp_progress(sqlite3rbu *p, int *pnOne, int *pnTwo){
170011
+SQLITE_API void sqlite3rbu_bp_progress(sqlite3rbu *p, int *pnOne, int *pnTwo){
170033170012
const int MAX_PROGRESS = 10000;
170034170013
switch( p->eStage ){
170035170014
case RBU_STAGE_OAL:
170036170015
if( p->nPhaseOneStep>0 ){
170037170016
*pnOne = (int)(MAX_PROGRESS * (i64)p->nProgress/(i64)p->nPhaseOneStep);
@@ -170062,11 +170041,11 @@
170062170041
}
170063170042
170064170043
/*
170065170044
** Return the current state of the RBU vacuum or update operation.
170066170045
*/
170067
-SQLITE_API int SQLITE_STDCALL sqlite3rbu_state(sqlite3rbu *p){
170046
+SQLITE_API int sqlite3rbu_state(sqlite3rbu *p){
170068170047
int aRes[] = {
170069170048
0, SQLITE_RBU_STATE_OAL, SQLITE_RBU_STATE_MOVE,
170070170049
0, SQLITE_RBU_STATE_CHECKPOINT, SQLITE_RBU_STATE_DONE
170071170050
};
170072170051
@@ -170090,11 +170069,11 @@
170090170069
);
170091170070
return aRes[p->eStage];
170092170071
}
170093170072
}
170094170073
170095
-SQLITE_API int SQLITE_STDCALL sqlite3rbu_savestate(sqlite3rbu *p){
170074
+SQLITE_API int sqlite3rbu_savestate(sqlite3rbu *p){
170096170075
int rc = p->rc;
170097170076
if( rc==SQLITE_DONE ) return SQLITE_OK;
170098170077
170099170078
assert( p->eStage>=RBU_STAGE_OAL && p->eStage<=RBU_STAGE_DONE );
170100170079
if( p->eStage==RBU_STAGE_OAL ){
@@ -170917,11 +170896,11 @@
170917170896
170918170897
/*
170919170898
** Deregister and destroy an RBU vfs created by an earlier call to
170920170899
** sqlite3rbu_create_vfs().
170921170900
*/
170922
-SQLITE_API void SQLITE_STDCALL sqlite3rbu_destroy_vfs(const char *zName){
170901
+SQLITE_API void sqlite3rbu_destroy_vfs(const char *zName){
170923170902
sqlite3_vfs *pVfs = sqlite3_vfs_find(zName);
170924170903
if( pVfs && pVfs->xOpen==rbuVfsOpen ){
170925170904
sqlite3_mutex_free(((rbu_vfs*)pVfs)->mutex);
170926170905
sqlite3_vfs_unregister(pVfs);
170927170906
sqlite3_free(pVfs);
@@ -170931,11 +170910,11 @@
170931170910
/*
170932170911
** Create an RBU VFS named zName that accesses the underlying file-system
170933170912
** via existing VFS zParent. The new object is registered as a non-default
170934170913
** VFS with SQLite before returning.
170935170914
*/
170936
-SQLITE_API int SQLITE_STDCALL sqlite3rbu_create_vfs(const char *zName, const char *zParent){
170915
+SQLITE_API int sqlite3rbu_create_vfs(const char *zName, const char *zParent){
170937170916
170938170917
/* Template for VFS */
170939170918
static sqlite3_vfs vfs_template = {
170940170919
1, /* iVersion */
170941170920
0, /* szOsFile */
@@ -173176,11 +173155,11 @@
173176173155
}
173177173156
173178173157
return rc;
173179173158
}
173180173159
173181
-SQLITE_API int SQLITE_STDCALL sqlite3session_diff(
173160
+SQLITE_API int sqlite3session_diff(
173182173161
sqlite3_session *pSession,
173183173162
const char *zFrom,
173184173163
const char *zTbl,
173185173164
char **pzErrMsg
173186173165
){
@@ -173270,11 +173249,11 @@
173270173249
173271173250
/*
173272173251
** Create a session object. This session object will record changes to
173273173252
** database zDb attached to connection db.
173274173253
*/
173275
-SQLITE_API int SQLITE_STDCALL sqlite3session_create(
173254
+SQLITE_API int sqlite3session_create(
173276173255
sqlite3 *db, /* Database handle */
173277173256
const char *zDb, /* Name of db (e.g. "main") */
173278173257
sqlite3_session **ppSession /* OUT: New session object */
173279173258
){
173280173259
sqlite3_session *pNew; /* Newly allocated session object */
@@ -173332,11 +173311,11 @@
173332173311
}
173333173312
173334173313
/*
173335173314
** Delete a session object previously allocated using sqlite3session_create().
173336173315
*/
173337
-SQLITE_API void SQLITE_STDCALL sqlite3session_delete(sqlite3_session *pSession){
173316
+SQLITE_API void sqlite3session_delete(sqlite3_session *pSession){
173338173317
sqlite3 *db = pSession->db;
173339173318
sqlite3_session *pHead;
173340173319
sqlite3_session **pp;
173341173320
173342173321
/* Unlink the session from the linked list of sessions attached to the
@@ -173361,11 +173340,11 @@
173361173340
}
173362173341
173363173342
/*
173364173343
** Set a table filter on a Session Object.
173365173344
*/
173366
-SQLITE_API void SQLITE_STDCALL sqlite3session_table_filter(
173345
+SQLITE_API void sqlite3session_table_filter(
173367173346
sqlite3_session *pSession,
173368173347
int(*xFilter)(void*, const char*),
173369173348
void *pCtx /* First argument passed to xFilter */
173370173349
){
173371173350
pSession->bAutoAttach = 1;
@@ -173379,11 +173358,11 @@
173379173358
**
173380173359
** Only tables that have a PRIMARY KEY defined may be attached. It does
173381173360
** not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias)
173382173361
** or not.
173383173362
*/
173384
-SQLITE_API int SQLITE_STDCALL sqlite3session_attach(
173363
+SQLITE_API int sqlite3session_attach(
173385173364
sqlite3_session *pSession, /* Session object */
173386173365
const char *zName /* Table name */
173387173366
){
173388173367
int rc = SQLITE_OK;
173389173368
sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db));
@@ -174069,11 +174048,11 @@
174069174048
** session object passed as the first argument.
174070174049
**
174071174050
** It is the responsibility of the caller to eventually free the buffer
174072174051
** using sqlite3_free().
174073174052
*/
174074
-SQLITE_API int SQLITE_STDCALL sqlite3session_changeset(
174053
+SQLITE_API int sqlite3session_changeset(
174075174054
sqlite3_session *pSession, /* Session object */
174076174055
int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
174077174056
void **ppChangeset /* OUT: Buffer containing changeset */
174078174057
){
174079174058
return sessionGenerateChangeset(pSession, 0, 0, 0, pnChangeset, ppChangeset);
@@ -174080,11 +174059,11 @@
174080174059
}
174081174060
174082174061
/*
174083174062
** Streaming version of sqlite3session_changeset().
174084174063
*/
174085
-SQLITE_API int SQLITE_STDCALL sqlite3session_changeset_strm(
174064
+SQLITE_API int sqlite3session_changeset_strm(
174086174065
sqlite3_session *pSession,
174087174066
int (*xOutput)(void *pOut, const void *pData, int nData),
174088174067
void *pOut
174089174068
){
174090174069
return sessionGenerateChangeset(pSession, 0, xOutput, pOut, 0, 0);
@@ -174091,11 +174070,11 @@
174091174070
}
174092174071
174093174072
/*
174094174073
** Streaming version of sqlite3session_patchset().
174095174074
*/
174096
-SQLITE_API int SQLITE_STDCALL sqlite3session_patchset_strm(
174075
+SQLITE_API int sqlite3session_patchset_strm(
174097174076
sqlite3_session *pSession,
174098174077
int (*xOutput)(void *pOut, const void *pData, int nData),
174099174078
void *pOut
174100174079
){
174101174080
return sessionGenerateChangeset(pSession, 1, xOutput, pOut, 0, 0);
@@ -174106,11 +174085,11 @@
174106174085
** session object passed as the first argument.
174107174086
**
174108174087
** It is the responsibility of the caller to eventually free the buffer
174109174088
** using sqlite3_free().
174110174089
*/
174111
-SQLITE_API int SQLITE_STDCALL sqlite3session_patchset(
174090
+SQLITE_API int sqlite3session_patchset(
174112174091
sqlite3_session *pSession, /* Session object */
174113174092
int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */
174114174093
void **ppPatchset /* OUT: Buffer containing changeset */
174115174094
){
174116174095
return sessionGenerateChangeset(pSession, 1, 0, 0, pnPatchset, ppPatchset);
@@ -174117,11 +174096,11 @@
174117174096
}
174118174097
174119174098
/*
174120174099
** Enable or disable the session object passed as the first argument.
174121174100
*/
174122
-SQLITE_API int SQLITE_STDCALL sqlite3session_enable(sqlite3_session *pSession, int bEnable){
174101
+SQLITE_API int sqlite3session_enable(sqlite3_session *pSession, int bEnable){
174123174102
int ret;
174124174103
sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db));
174125174104
if( bEnable>=0 ){
174126174105
pSession->bEnable = bEnable;
174127174106
}
@@ -174131,11 +174110,11 @@
174131174110
}
174132174111
174133174112
/*
174134174113
** Enable or disable the session object passed as the first argument.
174135174114
*/
174136
-SQLITE_API int SQLITE_STDCALL sqlite3session_indirect(sqlite3_session *pSession, int bIndirect){
174115
+SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect){
174137174116
int ret;
174138174117
sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db));
174139174118
if( bIndirect>=0 ){
174140174119
pSession->bIndirect = bIndirect;
174141174120
}
@@ -174146,11 +174125,11 @@
174146174125
174147174126
/*
174148174127
** Return true if there have been no changes to monitored tables recorded
174149174128
** by the session object passed as the only argument.
174150174129
*/
174151
-SQLITE_API int SQLITE_STDCALL sqlite3session_isempty(sqlite3_session *pSession){
174130
+SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession){
174152174131
int ret = 0;
174153174132
SessionTable *pTab;
174154174133
174155174134
sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db));
174156174135
for(pTab=pSession->pTable; pTab && ret==0; pTab=pTab->pNext){
@@ -174196,11 +174175,11 @@
174196174175
}
174197174176
174198174177
/*
174199174178
** Create an iterator used to iterate through the contents of a changeset.
174200174179
*/
174201
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_start(
174180
+SQLITE_API int sqlite3changeset_start(
174202174181
sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
174203174182
int nChangeset, /* Size of buffer pChangeset in bytes */
174204174183
void *pChangeset /* Pointer to buffer containing changeset */
174205174184
){
174206174185
return sessionChangesetStart(pp, 0, 0, nChangeset, pChangeset);
@@ -174207,11 +174186,11 @@
174207174186
}
174208174187
174209174188
/*
174210174189
** Streaming version of sqlite3changeset_start().
174211174190
*/
174212
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_start_strm(
174191
+SQLITE_API int sqlite3changeset_start_strm(
174213174192
sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
174214174193
int (*xInput)(void *pIn, void *pData, int *pnData),
174215174194
void *pIn
174216174195
){
174217174196
return sessionChangesetStart(pp, xInput, pIn, 0, 0);
@@ -174628,20 +174607,20 @@
174628174607
** or SQLITE_CORRUPT.
174629174608
**
174630174609
** This function may not be called on iterators passed to a conflict handler
174631174610
** callback by changeset_apply().
174632174611
*/
174633
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_next(sqlite3_changeset_iter *p){
174612
+SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *p){
174634174613
return sessionChangesetNext(p, 0, 0);
174635174614
}
174636174615
174637174616
/*
174638174617
** The following function extracts information on the current change
174639174618
** from a changeset iterator. It may only be called after changeset_next()
174640174619
** has returned SQLITE_ROW.
174641174620
*/
174642
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_op(
174621
+SQLITE_API int sqlite3changeset_op(
174643174622
sqlite3_changeset_iter *pIter, /* Iterator handle */
174644174623
const char **pzTab, /* OUT: Pointer to table name */
174645174624
int *pnCol, /* OUT: Number of columns in table */
174646174625
int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */
174647174626
int *pbIndirect /* OUT: True if change is indirect */
@@ -174657,11 +174636,11 @@
174657174636
** Return information regarding the PRIMARY KEY and number of columns in
174658174637
** the database table affected by the change that pIter currently points
174659174638
** to. This function may only be called after changeset_next() returns
174660174639
** SQLITE_ROW.
174661174640
*/
174662
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_pk(
174641
+SQLITE_API int sqlite3changeset_pk(
174663174642
sqlite3_changeset_iter *pIter, /* Iterator object */
174664174643
unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */
174665174644
int *pnCol /* OUT: Number of entries in output array */
174666174645
){
174667174646
*pabPK = pIter->abPK;
@@ -174680,11 +174659,11 @@
174680174659
** was not modified and is not a PK column), set *ppValue to NULL.
174681174660
**
174682174661
** If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is
174683174662
** not modified. Otherwise, SQLITE_OK.
174684174663
*/
174685
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_old(
174664
+SQLITE_API int sqlite3changeset_old(
174686174665
sqlite3_changeset_iter *pIter, /* Changeset iterator */
174687174666
int iVal, /* Index of old.* value to retrieve */
174688174667
sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */
174689174668
){
174690174669
if( pIter->op!=SQLITE_UPDATE && pIter->op!=SQLITE_DELETE ){
@@ -174708,11 +174687,11 @@
174708174687
** was not modified), set *ppValue to NULL.
174709174688
**
174710174689
** If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is
174711174690
** not modified. Otherwise, SQLITE_OK.
174712174691
*/
174713
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_new(
174692
+SQLITE_API int sqlite3changeset_new(
174714174693
sqlite3_changeset_iter *pIter, /* Changeset iterator */
174715174694
int iVal, /* Index of new.* value to retrieve */
174716174695
sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */
174717174696
){
174718174697
if( pIter->op!=SQLITE_UPDATE && pIter->op!=SQLITE_INSERT ){
@@ -174742,11 +174721,11 @@
174742174721
** containing the iVal'th value of the conflicting record.
174743174722
**
174744174723
** If value iVal is out-of-range or some other error occurs, an SQLite error
174745174724
** code is returned. Otherwise, SQLITE_OK.
174746174725
*/
174747
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_conflict(
174726
+SQLITE_API int sqlite3changeset_conflict(
174748174727
sqlite3_changeset_iter *pIter, /* Changeset iterator */
174749174728
int iVal, /* Index of conflict record value to fetch */
174750174729
sqlite3_value **ppValue /* OUT: Value from conflicting row */
174751174730
){
174752174731
if( !pIter->pConflict ){
@@ -174765,11 +174744,11 @@
174765174744
** it sets the output variable to the total number of known foreign key
174766174745
** violations in the destination database and returns SQLITE_OK.
174767174746
**
174768174747
** In all other cases this function returns SQLITE_MISUSE.
174769174748
*/
174770
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_fk_conflicts(
174749
+SQLITE_API int sqlite3changeset_fk_conflicts(
174771174750
sqlite3_changeset_iter *pIter, /* Changeset iterator */
174772174751
int *pnOut /* OUT: Number of FK violations */
174773174752
){
174774174753
if( pIter->pConflict || pIter->apValue ){
174775174754
return SQLITE_MISUSE;
@@ -174783,11 +174762,11 @@
174783174762
** Finalize an iterator allocated with sqlite3changeset_start().
174784174763
**
174785174764
** This function may not be called on iterators passed to a conflict handler
174786174765
** callback by changeset_apply().
174787174766
*/
174788
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_finalize(sqlite3_changeset_iter *p){
174767
+SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *p){
174789174768
int rc = SQLITE_OK;
174790174769
if( p ){
174791174770
int i; /* Used to iterate through p->apValue[] */
174792174771
rc = p->rc;
174793174772
if( p->apValue ){
@@ -174957,11 +174936,11 @@
174957174936
174958174937
174959174938
/*
174960174939
** Invert a changeset object.
174961174940
*/
174962
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_invert(
174941
+SQLITE_API int sqlite3changeset_invert(
174963174942
int nChangeset, /* Number of bytes in input */
174964174943
const void *pChangeset, /* Input changeset */
174965174944
int *pnInverted, /* OUT: Number of bytes in output changeset */
174966174945
void **ppInverted /* OUT: Inverse of pChangeset */
174967174946
){
@@ -174976,11 +174955,11 @@
174976174955
}
174977174956
174978174957
/*
174979174958
** Streaming version of sqlite3changeset_invert().
174980174959
*/
174981
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_invert_strm(
174960
+SQLITE_API int sqlite3changeset_invert_strm(
174982174961
int (*xInput)(void *pIn, void *pData, int *pnData),
174983174962
void *pIn,
174984174963
int (*xOutput)(void *pOut, const void *pData, int nData),
174985174964
void *pOut
174986174965
){
@@ -175856,11 +175835,11 @@
175856175835
/*
175857175836
** Apply the changeset passed via pChangeset/nChangeset to the main database
175858175837
** attached to handle "db". Invoke the supplied conflict handler callback
175859175838
** to resolve any conflicts encountered while applying the change.
175860175839
*/
175861
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_apply(
175840
+SQLITE_API int sqlite3changeset_apply(
175862175841
sqlite3 *db, /* Apply change to "main" db of this handle */
175863175842
int nChangeset, /* Size of changeset in bytes */
175864175843
void *pChangeset, /* Changeset blob */
175865175844
int(*xFilter)(
175866175845
void *pCtx, /* Copy of sixth arg to _apply() */
@@ -175884,11 +175863,11 @@
175884175863
/*
175885175864
** Apply the changeset passed via xInput/pIn to the main database
175886175865
** attached to handle "db". Invoke the supplied conflict handler callback
175887175866
** to resolve any conflicts encountered while applying the change.
175888175867
*/
175889
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_apply_strm(
175868
+SQLITE_API int sqlite3changeset_apply_strm(
175890175869
sqlite3 *db, /* Apply change to "main" db of this handle */
175891175870
int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
175892175871
void *pIn, /* First arg for xInput */
175893175872
int(*xFilter)(
175894175873
void *pCtx, /* Copy of sixth arg to _apply() */
@@ -176219,11 +176198,11 @@
176219176198
}
176220176199
176221176200
/*
176222176201
** Allocate a new, empty, sqlite3_changegroup.
176223176202
*/
176224
-SQLITE_API int SQLITE_STDCALL sqlite3changegroup_new(sqlite3_changegroup **pp){
176203
+SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp){
176225176204
int rc = SQLITE_OK; /* Return code */
176226176205
sqlite3_changegroup *p; /* New object */
176227176206
p = (sqlite3_changegroup*)sqlite3_malloc(sizeof(sqlite3_changegroup));
176228176207
if( p==0 ){
176229176208
rc = SQLITE_NOMEM;
@@ -176236,11 +176215,11 @@
176236176215
176237176216
/*
176238176217
** Add the changeset currently stored in buffer pData, size nData bytes,
176239176218
** to changeset-group p.
176240176219
*/
176241
-SQLITE_API int SQLITE_STDCALL sqlite3changegroup_add(sqlite3_changegroup *pGrp, int nData, void *pData){
176220
+SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup *pGrp, int nData, void *pData){
176242176221
sqlite3_changeset_iter *pIter; /* Iterator opened on pData/nData */
176243176222
int rc; /* Return code */
176244176223
176245176224
rc = sqlite3changeset_start(&pIter, nData, pData);
176246176225
if( rc==SQLITE_OK ){
@@ -176252,11 +176231,11 @@
176252176231
176253176232
/*
176254176233
** Obtain a buffer containing a changeset representing the concatenation
176255176234
** of all changesets added to the group so far.
176256176235
*/
176257
-SQLITE_API int SQLITE_STDCALL sqlite3changegroup_output(
176236
+SQLITE_API int sqlite3changegroup_output(
176258176237
sqlite3_changegroup *pGrp,
176259176238
int *pnData,
176260176239
void **ppData
176261176240
){
176262176241
return sessionChangegroupOutput(pGrp, 0, 0, pnData, ppData);
@@ -176263,11 +176242,11 @@
176263176242
}
176264176243
176265176244
/*
176266176245
** Streaming versions of changegroup_add().
176267176246
*/
176268
-SQLITE_API int SQLITE_STDCALL sqlite3changegroup_add_strm(
176247
+SQLITE_API int sqlite3changegroup_add_strm(
176269176248
sqlite3_changegroup *pGrp,
176270176249
int (*xInput)(void *pIn, void *pData, int *pnData),
176271176250
void *pIn
176272176251
){
176273176252
sqlite3_changeset_iter *pIter; /* Iterator opened on pData/nData */
@@ -176282,11 +176261,11 @@
176282176261
}
176283176262
176284176263
/*
176285176264
** Streaming versions of changegroup_output().
176286176265
*/
176287
-SQLITE_API int SQLITE_STDCALL sqlite3changegroup_output_strm(
176266
+SQLITE_API int sqlite3changegroup_output_strm(
176288176267
sqlite3_changegroup *pGrp,
176289176268
int (*xOutput)(void *pOut, const void *pData, int nData),
176290176269
void *pOut
176291176270
){
176292176271
return sessionChangegroupOutput(pGrp, xOutput, pOut, 0, 0);
@@ -176293,21 +176272,21 @@
176293176272
}
176294176273
176295176274
/*
176296176275
** Delete a changegroup object.
176297176276
*/
176298
-SQLITE_API void SQLITE_STDCALL sqlite3changegroup_delete(sqlite3_changegroup *pGrp){
176277
+SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup *pGrp){
176299176278
if( pGrp ){
176300176279
sessionDeleteTable(pGrp->pList);
176301176280
sqlite3_free(pGrp);
176302176281
}
176303176282
}
176304176283
176305176284
/*
176306176285
** Combine two changesets together.
176307176286
*/
176308
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_concat(
176287
+SQLITE_API int sqlite3changeset_concat(
176309176288
int nLeft, /* Number of bytes in lhs input */
176310176289
void *pLeft, /* Lhs input changeset */
176311176290
int nRight /* Number of bytes in rhs input */,
176312176291
void *pRight, /* Rhs input changeset */
176313176292
int *pnOut, /* OUT: Number of bytes in output changeset */
@@ -176332,11 +176311,11 @@
176332176311
}
176333176312
176334176313
/*
176335176314
** Streaming version of sqlite3changeset_concat().
176336176315
*/
176337
-SQLITE_API int SQLITE_STDCALL sqlite3changeset_concat_strm(
176316
+SQLITE_API int sqlite3changeset_concat_strm(
176338176317
int (*xInputA)(void *pIn, void *pData, int *pnData),
176339176318
void *pInA,
176340176319
int (*xInputB)(void *pIn, void *pData, int *pnData),
176341176320
void *pInB,
176342176321
int (*xOutput)(void *pOut, const void *pData, int nData),
@@ -178564,11 +178543,11 @@
178564178543
178565178544
#ifndef SQLITE_CORE
178566178545
#ifdef _WIN32
178567178546
__declspec(dllexport)
178568178547
#endif
178569
-SQLITE_API int SQLITE_STDCALL sqlite3_json_init(
178548
+SQLITE_API int sqlite3_json_init(
178570178549
sqlite3 *db,
178571178550
char **pzErrMsg,
178572178551
const sqlite3_api_routines *pApi
178573178552
){
178574178553
SQLITE_EXTENSION_INIT2(pApi);
@@ -184048,18 +184027,18 @@
184048184027
Fts5ExprNode *pNode
184049184028
){
184050184029
Fts5ExprNearset *pNear = pNode->pNear;
184051184030
int i, j;
184052184031
int rc = SQLITE_OK;
184032
+ int bEof = 1;
184053184033
184054184034
assert( pNode->bNomatch==0 );
184055184035
for(i=0; rc==SQLITE_OK && i<pNear->nPhrase; i++){
184056184036
Fts5ExprPhrase *pPhrase = pNear->apPhrase[i];
184057184037
for(j=0; j<pPhrase->nTerm; j++){
184058184038
Fts5ExprTerm *pTerm = &pPhrase->aTerm[j];
184059184039
Fts5ExprTerm *p;
184060
- int bEof = 1;
184061184040
184062184041
for(p=pTerm; p && rc==SQLITE_OK; p=p->pSynonym){
184063184042
if( p->pIter ){
184064184043
sqlite3Fts5IterClose(p->pIter);
184065184044
p->pIter = 0;
@@ -184075,17 +184054,16 @@
184075184054
if( p->pIter && 0==sqlite3Fts5IterEof(p->pIter) ){
184076184055
bEof = 0;
184077184056
}
184078184057
}
184079184058
184080
- if( bEof ){
184081
- pNode->bEof = 1;
184082
- return rc;
184083
- }
184059
+ if( bEof ) break;
184084184060
}
184061
+ if( bEof ) break;
184085184062
}
184086184063
184064
+ pNode->bEof = bEof;
184087184065
return rc;
184088184066
}
184089184067
184090184068
/*
184091184069
** If pExpr is an ASC iterator, this function returns a value with the
@@ -184932,11 +184910,10 @@
184932184910
int iPhrase,
184933184911
Fts5Expr **ppNew
184934184912
){
184935184913
int rc = SQLITE_OK; /* Return code */
184936184914
Fts5ExprPhrase *pOrig; /* The phrase extracted from pExpr */
184937
- int i; /* Used to iterate through phrase terms */
184938184915
Fts5Expr *pNew = 0; /* Expression to return via *ppNew */
184939184916
TokenCtx sCtx = {0,0}; /* Context object for fts5ParseTokenize */
184940184917
184941184918
pOrig = pExpr->apExprPhrase[iPhrase];
184942184919
pNew = (Fts5Expr*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Expr));
@@ -184962,22 +184939,29 @@
184962184939
}
184963184940
pNew->pRoot->pNear->pColset = pColset;
184964184941
}
184965184942
}
184966184943
184967
- for(i=0; rc==SQLITE_OK && i<pOrig->nTerm; i++){
184968
- int tflags = 0;
184969
- Fts5ExprTerm *p;
184970
- for(p=&pOrig->aTerm[i]; p && rc==SQLITE_OK; p=p->pSynonym){
184971
- const char *zTerm = p->zTerm;
184972
- rc = fts5ParseTokenize((void*)&sCtx, tflags, zTerm, (int)strlen(zTerm),
184973
- 0, 0);
184974
- tflags = FTS5_TOKEN_COLOCATED;
184975
- }
184976
- if( rc==SQLITE_OK ){
184977
- sCtx.pPhrase->aTerm[i].bPrefix = pOrig->aTerm[i].bPrefix;
184978
- }
184944
+ if( pOrig->nTerm ){
184945
+ int i; /* Used to iterate through phrase terms */
184946
+ for(i=0; rc==SQLITE_OK && i<pOrig->nTerm; i++){
184947
+ int tflags = 0;
184948
+ Fts5ExprTerm *p;
184949
+ for(p=&pOrig->aTerm[i]; p && rc==SQLITE_OK; p=p->pSynonym){
184950
+ const char *zTerm = p->zTerm;
184951
+ rc = fts5ParseTokenize((void*)&sCtx, tflags, zTerm, (int)strlen(zTerm),
184952
+ 0, 0);
184953
+ tflags = FTS5_TOKEN_COLOCATED;
184954
+ }
184955
+ if( rc==SQLITE_OK ){
184956
+ sCtx.pPhrase->aTerm[i].bPrefix = pOrig->aTerm[i].bPrefix;
184957
+ }
184958
+ }
184959
+ }else{
184960
+ /* This happens when parsing a token or quoted phrase that contains
184961
+ ** no token characters at all. (e.g ... MATCH '""'). */
184962
+ sCtx.pPhrase = sqlite3Fts5MallocZero(&rc, sizeof(Fts5ExprPhrase));
184979184963
}
184980184964
184981184965
if( rc==SQLITE_OK ){
184982184966
/* All the allocations succeeded. Put the expression object together. */
184983184967
pNew->pIndex = pExpr->pIndex;
@@ -195613,11 +195597,11 @@
195613195597
int nArg, /* Number of args */
195614195598
sqlite3_value **apUnused /* Function arguments */
195615195599
){
195616195600
assert( nArg==0 );
195617195601
UNUSED_PARAM2(nArg, apUnused);
195618
- sqlite3_result_text(pCtx, "fts5: 2016-09-10 14:43:07 8a9d128119fde36c175735be56876d30e5c8586f", -1, SQLITE_TRANSIENT);
195602
+ sqlite3_result_text(pCtx, "fts5: 2016-09-21 19:43:34 0741812d7fcd558479e4849fbb3ba8d03738d018", -1, SQLITE_TRANSIENT);
195619195603
}
195620195604
195621195605
static int fts5Init(sqlite3 *db){
195622195606
static const sqlite3_module fts5Mod = {
195623195607
/* iVersion */ 2,
@@ -195701,11 +195685,11 @@
195701195685
*/
195702195686
#ifndef SQLITE_CORE
195703195687
#ifdef _WIN32
195704195688
__declspec(dllexport)
195705195689
#endif
195706
-SQLITE_API int SQLITE_STDCALL sqlite3_fts_init(
195690
+SQLITE_API int sqlite3_fts_init(
195707195691
sqlite3 *db,
195708195692
char **pzErrMsg,
195709195693
const sqlite3_api_routines *pApi
195710195694
){
195711195695
SQLITE_EXTENSION_INIT2(pApi);
@@ -195714,11 +195698,11 @@
195714195698
}
195715195699
195716195700
#ifdef _WIN32
195717195701
__declspec(dllexport)
195718195702
#endif
195719
-SQLITE_API int SQLITE_STDCALL sqlite3_fts5_init(
195703
+SQLITE_API int sqlite3_fts5_init(
195720195704
sqlite3 *db,
195721195705
char **pzErrMsg,
195722195706
const sqlite3_api_routines *pApi
195723195707
){
195724195708
SQLITE_EXTENSION_INIT2(pApi);
@@ -199095,12 +199079,23 @@
199095199079
pInfo->aConstraintUsage[iTermLe].argvIndex = ++nArg;
199096199080
pInfo->estimatedCost = pInfo->estimatedCost / 2;
199097199081
}
199098199082
}
199099199083
199100
- pInfo->idxNum = idxNum;
199084
+ /* This virtual table always delivers results in ascending order of
199085
+ ** the "term" column (column 0). So if the user has requested this
199086
+ ** specifically - "ORDER BY term" or "ORDER BY term ASC" - set the
199087
+ ** sqlite3_index_info.orderByConsumed flag to tell the core the results
199088
+ ** are already in sorted order. */
199089
+ if( pInfo->nOrderBy==1
199090
+ && pInfo->aOrderBy[0].iColumn==0
199091
+ && pInfo->aOrderBy[0].desc==0
199092
+ ){
199093
+ pInfo->orderByConsumed = 1;
199094
+ }
199101199095
199096
+ pInfo->idxNum = idxNum;
199102199097
return SQLITE_OK;
199103199098
}
199104199099
199105199100
/*
199106199101
** Implementation of xOpen method.
199107199102
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,17 +1,17 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.15.0. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
9 **
10 ** This file is all you need to compile SQLite. To use SQLite in other
11 ** programs, you need this file and the "sqlite3.h" header file that defines
12 ** the programming interface to the SQLite library. (If you do not have
13 ** the "sqlite3.h" header file at hand, you will find a copy embedded within
14 ** the text of this file. Search for "Begin file sqlite3.h" to find the start
15 ** of the embedded sqlite3.h header file.) Additional code files may be needed
16 ** if you want a wrapper to interface SQLite with your choice of programming
17 ** language. The code for the "sqlite3" command-line shell is also in a
@@ -366,11 +366,12 @@
366 ** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
367 ** be larger than the release from which it is derived. Either Y will
368 ** be held constant and Z will be incremented or else Y will be incremented
369 ** and Z will be reset to zero.
370 **
371 ** Since version 3.6.18, SQLite source code has been stored in the
 
372 ** <a href="http://www.fossil-scm.org/">Fossil configuration management
373 ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
374 ** a string which identifies a particular check-in of SQLite
375 ** within its configuration management system. ^The SQLITE_SOURCE_ID
376 ** string contains the date and time of the check-in (UTC) and an SHA1
@@ -380,11 +381,11 @@
380 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
381 ** [sqlite_version()] and [sqlite_source_id()].
382 */
383 #define SQLITE_VERSION "3.15.0"
384 #define SQLITE_VERSION_NUMBER 3015000
385 #define SQLITE_SOURCE_ID "2016-09-10 19:51:40 711c59171b22df04224183a713e6c36e0bb3bba8"
386
387 /*
388 ** CAPI3REF: Run-Time Library Version Numbers
389 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
390 **
@@ -413,13 +414,13 @@
413 ** [SQLITE_SOURCE_ID] C preprocessor macro.
414 **
415 ** See also: [sqlite_version()] and [sqlite_source_id()].
416 */
417 SQLITE_API const char sqlite3_version[] = SQLITE_VERSION;
418 SQLITE_API const char *SQLITE_STDCALL sqlite3_libversion(void);
419 SQLITE_API const char *SQLITE_STDCALL sqlite3_sourceid(void);
420 SQLITE_API int SQLITE_STDCALL sqlite3_libversion_number(void);
421
422 /*
423 ** CAPI3REF: Run-Time Library Compilation Options Diagnostics
424 **
425 ** ^The sqlite3_compileoption_used() function returns 0 or 1
@@ -440,12 +441,12 @@
440 **
441 ** See also: SQL functions [sqlite_compileoption_used()] and
442 ** [sqlite_compileoption_get()] and the [compile_options pragma].
443 */
444 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
445 SQLITE_API int SQLITE_STDCALL sqlite3_compileoption_used(const char *zOptName);
446 SQLITE_API const char *SQLITE_STDCALL sqlite3_compileoption_get(int N);
447 #endif
448
449 /*
450 ** CAPI3REF: Test To See If The Library Is Threadsafe
451 **
@@ -480,11 +481,11 @@
480 ** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
481 ** is unchanged by calls to sqlite3_config().)^
482 **
483 ** See the [threading mode] documentation for additional information.
484 */
485 SQLITE_API int SQLITE_STDCALL sqlite3_threadsafe(void);
486
487 /*
488 ** CAPI3REF: Database Connection Handle
489 ** KEYWORDS: {database connection} {database connections}
490 **
@@ -577,12 +578,12 @@
577 ** from [sqlite3_open()], [sqlite3_open16()], or
578 ** [sqlite3_open_v2()], and not previously closed.
579 ** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer
580 ** argument is a harmless no-op.
581 */
582 SQLITE_API int SQLITE_STDCALL sqlite3_close(sqlite3*);
583 SQLITE_API int SQLITE_STDCALL sqlite3_close_v2(sqlite3*);
584
585 /*
586 ** The type for a callback function.
587 ** This is legacy and deprecated. It is included for historical
588 ** compatibility and is not documented.
@@ -649,11 +650,11 @@
649 ** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
650 ** <li> The application must not modify the SQL statement text passed into
651 ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
652 ** </ul>
653 */
654 SQLITE_API int SQLITE_STDCALL sqlite3_exec(
655 sqlite3*, /* An open database */
656 const char *sql, /* SQL to be evaluated */
657 int (*callback)(void*,int,char**,char**), /* Callback function */
658 void *, /* 1st argument to callback */
659 char **errmsg /* Error msg written here */
@@ -710,11 +711,12 @@
710 **
711 ** In its default configuration, SQLite API routines return one of 30 integer
712 ** [result codes]. However, experience has shown that many of
713 ** these result codes are too coarse-grained. They do not provide as
714 ** much information about problems as programmers might like. In an effort to
715 ** address this, newer versions of SQLite (version 3.3.8 and later) include
 
716 ** support for additional result codes that provide more detailed information
717 ** about errors. These [extended result codes] are enabled or disabled
718 ** on a per database connection basis using the
719 ** [sqlite3_extended_result_codes()] API. Or, the extended code for
720 ** the most recent error can be obtained using
@@ -1648,14 +1650,14 @@
1648 ** sqlite3_os_init() and sqlite3_os_end(). An application-supplied
1649 ** implementation of sqlite3_os_init() or sqlite3_os_end()
1650 ** must return [SQLITE_OK] on success and some other [error code] upon
1651 ** failure.
1652 */
1653 SQLITE_API int SQLITE_STDCALL sqlite3_initialize(void);
1654 SQLITE_API int SQLITE_STDCALL sqlite3_shutdown(void);
1655 SQLITE_API int SQLITE_STDCALL sqlite3_os_init(void);
1656 SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void);
1657
1658 /*
1659 ** CAPI3REF: Configuring The SQLite Library
1660 **
1661 ** The sqlite3_config() interface is used to make global configuration
@@ -1684,11 +1686,11 @@
1684 **
1685 ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
1686 ** ^If the option is unknown or SQLite is unable to set the option
1687 ** then this routine returns a non-zero [error code].
1688 */
1689 SQLITE_API int SQLITE_CDECL sqlite3_config(int, ...);
1690
1691 /*
1692 ** CAPI3REF: Configure database connections
1693 ** METHOD: sqlite3
1694 **
@@ -1703,11 +1705,11 @@
1703 ** Subsequent arguments vary depending on the configuration verb.
1704 **
1705 ** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
1706 ** the call is considered successful.
1707 */
1708 SQLITE_API int SQLITE_CDECL sqlite3_db_config(sqlite3*, int op, ...);
1709
1710 /*
1711 ** CAPI3REF: Memory Allocation Routines
1712 **
1713 ** An instance of this object defines the interface between SQLite
@@ -2254,11 +2256,11 @@
2254 **
2255 ** ^The sqlite3_extended_result_codes() routine enables or disables the
2256 ** [extended result codes] feature of SQLite. ^The extended result
2257 ** codes are disabled by default for historical compatibility.
2258 */
2259 SQLITE_API int SQLITE_STDCALL sqlite3_extended_result_codes(sqlite3*, int onoff);
2260
2261 /*
2262 ** CAPI3REF: Last Insert Rowid
2263 ** METHOD: sqlite3
2264 **
@@ -2306,11 +2308,11 @@
2306 ** function is running and thus changes the last insert [rowid],
2307 ** then the value returned by [sqlite3_last_insert_rowid()] is
2308 ** unpredictable and might not equal either the old or the new
2309 ** last insert [rowid].
2310 */
2311 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_last_insert_rowid(sqlite3*);
2312
2313 /*
2314 ** CAPI3REF: Count The Number Of Rows Modified
2315 ** METHOD: sqlite3
2316 **
@@ -2359,11 +2361,11 @@
2359 **
2360 ** If a separate thread makes changes on the same database connection
2361 ** while [sqlite3_changes()] is running then the value returned
2362 ** is unpredictable and not meaningful.
2363 */
2364 SQLITE_API int SQLITE_STDCALL sqlite3_changes(sqlite3*);
2365
2366 /*
2367 ** CAPI3REF: Total Number Of Rows Modified
2368 ** METHOD: sqlite3
2369 **
@@ -2383,11 +2385,11 @@
2383 **
2384 ** If a separate thread makes changes on the same database connection
2385 ** while [sqlite3_total_changes()] is running then the value
2386 ** returned is unpredictable and not meaningful.
2387 */
2388 SQLITE_API int SQLITE_STDCALL sqlite3_total_changes(sqlite3*);
2389
2390 /*
2391 ** CAPI3REF: Interrupt A Long-Running Query
2392 ** METHOD: sqlite3
2393 **
@@ -2423,11 +2425,11 @@
2423 ** that are started after the sqlite3_interrupt() call returns.
2424 **
2425 ** If the database connection closes while [sqlite3_interrupt()]
2426 ** is running then bad things will likely happen.
2427 */
2428 SQLITE_API void SQLITE_STDCALL sqlite3_interrupt(sqlite3*);
2429
2430 /*
2431 ** CAPI3REF: Determine If An SQL Statement Is Complete
2432 **
2433 ** These routines are useful during command-line input to determine if the
@@ -2458,12 +2460,12 @@
2458 ** UTF-8 string.
2459 **
2460 ** The input to [sqlite3_complete16()] must be a zero-terminated
2461 ** UTF-16 string in native byte order.
2462 */
2463 SQLITE_API int SQLITE_STDCALL sqlite3_complete(const char *sql);
2464 SQLITE_API int SQLITE_STDCALL sqlite3_complete16(const void *sql);
2465
2466 /*
2467 ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
2468 ** KEYWORDS: {busy-handler callback} {busy handler}
2469 ** METHOD: sqlite3
@@ -2520,11 +2522,11 @@
2520 ** result in undefined behavior.
2521 **
2522 ** A busy handler must not close the database connection
2523 ** or [prepared statement] that invoked the busy handler.
2524 */
2525 SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
2526
2527 /*
2528 ** CAPI3REF: Set A Busy Timeout
2529 ** METHOD: sqlite3
2530 **
@@ -2543,11 +2545,11 @@
2543 ** was defined (using [sqlite3_busy_handler()]) prior to calling
2544 ** this routine, that other busy handler is cleared.)^
2545 **
2546 ** See also: [PRAGMA busy_timeout]
2547 */
2548 SQLITE_API int SQLITE_STDCALL sqlite3_busy_timeout(sqlite3*, int ms);
2549
2550 /*
2551 ** CAPI3REF: Convenience Routines For Running Queries
2552 ** METHOD: sqlite3
2553 **
@@ -2618,19 +2620,19 @@
2618 ** interface defined here. As a consequence, errors that occur in the
2619 ** wrapper layer outside of the internal [sqlite3_exec()] call are not
2620 ** reflected in subsequent calls to [sqlite3_errcode()] or
2621 ** [sqlite3_errmsg()].
2622 */
2623 SQLITE_API int SQLITE_STDCALL sqlite3_get_table(
2624 sqlite3 *db, /* An open database */
2625 const char *zSql, /* SQL to be evaluated */
2626 char ***pazResult, /* Results of the query */
2627 int *pnRow, /* Number of result rows written here */
2628 int *pnColumn, /* Number of result columns written here */
2629 char **pzErrmsg /* Error msg written here */
2630 );
2631 SQLITE_API void SQLITE_STDCALL sqlite3_free_table(char **result);
2632
2633 /*
2634 ** CAPI3REF: Formatted String Printing Functions
2635 **
2636 ** These routines are work-alikes of the "printf()" family of functions
@@ -2732,14 +2734,14 @@
2732 **
2733 ** ^(The "%z" formatting option works like "%s" but with the
2734 ** addition that after the string has been read and copied into
2735 ** the result, [sqlite3_free()] is called on the input string.)^
2736 */
2737 SQLITE_API char *SQLITE_CDECL sqlite3_mprintf(const char*,...);
2738 SQLITE_API char *SQLITE_STDCALL sqlite3_vmprintf(const char*, va_list);
2739 SQLITE_API char *SQLITE_CDECL sqlite3_snprintf(int,char*,const char*, ...);
2740 SQLITE_API char *SQLITE_STDCALL sqlite3_vsnprintf(int,char*,const char*, va_list);
2741
2742 /*
2743 ** CAPI3REF: Memory Allocation Subsystem
2744 **
2745 ** The SQLite core uses these three routines for all of its own
@@ -2825,16 +2827,16 @@
2825 **
2826 ** The application must not read or write any part of
2827 ** a block of memory after it has been released using
2828 ** [sqlite3_free()] or [sqlite3_realloc()].
2829 */
2830 SQLITE_API void *SQLITE_STDCALL sqlite3_malloc(int);
2831 SQLITE_API void *SQLITE_STDCALL sqlite3_malloc64(sqlite3_uint64);
2832 SQLITE_API void *SQLITE_STDCALL sqlite3_realloc(void*, int);
2833 SQLITE_API void *SQLITE_STDCALL sqlite3_realloc64(void*, sqlite3_uint64);
2834 SQLITE_API void SQLITE_STDCALL sqlite3_free(void*);
2835 SQLITE_API sqlite3_uint64 SQLITE_STDCALL sqlite3_msize(void*);
2836
2837 /*
2838 ** CAPI3REF: Memory Allocator Statistics
2839 **
2840 ** SQLite provides these two interfaces for reporting on the status
@@ -2855,12 +2857,12 @@
2855 ** [sqlite3_memory_used()] if and only if the parameter to
2856 ** [sqlite3_memory_highwater()] is true. ^The value returned
2857 ** by [sqlite3_memory_highwater(1)] is the high-water mark
2858 ** prior to the reset.
2859 */
2860 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_used(void);
2861 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_highwater(int resetFlag);
2862
2863 /*
2864 ** CAPI3REF: Pseudo-Random Number Generator
2865 **
2866 ** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
@@ -2879,11 +2881,11 @@
2879 ** ^If the previous call to this routine had an N of 1 or more and a
2880 ** non-NULL P then the pseudo-randomness is generated
2881 ** internally and without recourse to the [sqlite3_vfs] xRandomness
2882 ** method.
2883 */
2884 SQLITE_API void SQLITE_STDCALL sqlite3_randomness(int N, void *P);
2885
2886 /*
2887 ** CAPI3REF: Compile-Time Authorization Callbacks
2888 ** METHOD: sqlite3
2889 **
@@ -2962,11 +2964,11 @@
2962 ** [sqlite3_prepare()] or its variants. Authorization is not
2963 ** performed during statement evaluation in [sqlite3_step()], unless
2964 ** as stated in the previous paragraph, sqlite3_step() invokes
2965 ** sqlite3_prepare_v2() to reprepare a statement after a schema change.
2966 */
2967 SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer(
2968 sqlite3*,
2969 int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
2970 void *pUserData
2971 );
2972
@@ -3070,13 +3072,13 @@
3070 ** digits in the time are meaningless. Future versions of SQLite
3071 ** might provide greater resolution on the profiler callback. The
3072 ** sqlite3_profile() function is considered experimental and is
3073 ** subject to change in future versions of SQLite.
3074 */
3075 SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_trace(sqlite3*,
3076 void(*xTrace)(void*,const char*), void*);
3077 SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_profile(sqlite3*,
3078 void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
3079
3080 /*
3081 ** CAPI3REF: SQL Trace Event Codes
3082 ** KEYWORDS: SQLITE_TRACE
@@ -3161,11 +3163,11 @@
3161 **
3162 ** The sqlite3_trace_v2() interface is intended to replace the legacy
3163 ** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which
3164 ** are deprecated.
3165 */
3166 SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2(
3167 sqlite3*,
3168 unsigned uMask,
3169 int(*xCallback)(unsigned,void*,void*,void*),
3170 void *pCtx
3171 );
@@ -3200,11 +3202,11 @@
3200 ** the database connection that invoked the progress handler.
3201 ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
3202 ** database connections for the meaning of "modify" in this paragraph.
3203 **
3204 */
3205 SQLITE_API void SQLITE_STDCALL sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
3206
3207 /*
3208 ** CAPI3REF: Opening A New Database Connection
3209 ** CONSTRUCTOR: sqlite3
3210 **
@@ -3429,19 +3431,19 @@
3429 ** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various
3430 ** features that require the use of temporary files may fail.
3431 **
3432 ** See also: [sqlite3_temp_directory]
3433 */
3434 SQLITE_API int SQLITE_STDCALL sqlite3_open(
3435 const char *filename, /* Database filename (UTF-8) */
3436 sqlite3 **ppDb /* OUT: SQLite db handle */
3437 );
3438 SQLITE_API int SQLITE_STDCALL sqlite3_open16(
3439 const void *filename, /* Database filename (UTF-16) */
3440 sqlite3 **ppDb /* OUT: SQLite db handle */
3441 );
3442 SQLITE_API int SQLITE_STDCALL sqlite3_open_v2(
3443 const char *filename, /* Database filename (UTF-8) */
3444 sqlite3 **ppDb, /* OUT: SQLite db handle */
3445 int flags, /* Flags */
3446 const char *zVfs /* Name of VFS module to use */
3447 );
@@ -3483,13 +3485,13 @@
3483 ** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
3484 ** is not a database file pathname pointer that SQLite passed into the xOpen
3485 ** VFS method, then the behavior of this routine is undefined and probably
3486 ** undesirable.
3487 */
3488 SQLITE_API const char *SQLITE_STDCALL sqlite3_uri_parameter(const char *zFilename, const char *zParam);
3489 SQLITE_API int SQLITE_STDCALL sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
3490 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
3491
3492
3493 /*
3494 ** CAPI3REF: Error Codes And Messages
3495 ** METHOD: sqlite3
@@ -3529,15 +3531,15 @@
3529 **
3530 ** If an interface fails with SQLITE_MISUSE, that means the interface
3531 ** was invoked incorrectly by the application. In that case, the
3532 ** error code and message may or may not be set.
3533 */
3534 SQLITE_API int SQLITE_STDCALL sqlite3_errcode(sqlite3 *db);
3535 SQLITE_API int SQLITE_STDCALL sqlite3_extended_errcode(sqlite3 *db);
3536 SQLITE_API const char *SQLITE_STDCALL sqlite3_errmsg(sqlite3*);
3537 SQLITE_API const void *SQLITE_STDCALL sqlite3_errmsg16(sqlite3*);
3538 SQLITE_API const char *SQLITE_STDCALL sqlite3_errstr(int);
3539
3540 /*
3541 ** CAPI3REF: Prepared Statement Object
3542 ** KEYWORDS: {prepared statement} {prepared statements}
3543 **
@@ -3601,11 +3603,11 @@
3601 ** created by an untrusted script can be contained using the
3602 ** [max_page_count] [PRAGMA].
3603 **
3604 ** New run-time limit categories may be added in future releases.
3605 */
3606 SQLITE_API int SQLITE_STDCALL sqlite3_limit(sqlite3*, int id, int newVal);
3607
3608 /*
3609 ** CAPI3REF: Run-Time Limit Categories
3610 ** KEYWORDS: {limit category} {*limit categories}
3611 **
@@ -3753,32 +3755,32 @@
3753 ** or [GLOB] operator or if the parameter is compared to an indexed column
3754 ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
3755 ** </li>
3756 ** </ol>
3757 */
3758 SQLITE_API int SQLITE_STDCALL sqlite3_prepare(
3759 sqlite3 *db, /* Database handle */
3760 const char *zSql, /* SQL statement, UTF-8 encoded */
3761 int nByte, /* Maximum length of zSql in bytes. */
3762 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3763 const char **pzTail /* OUT: Pointer to unused portion of zSql */
3764 );
3765 SQLITE_API int SQLITE_STDCALL sqlite3_prepare_v2(
3766 sqlite3 *db, /* Database handle */
3767 const char *zSql, /* SQL statement, UTF-8 encoded */
3768 int nByte, /* Maximum length of zSql in bytes. */
3769 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3770 const char **pzTail /* OUT: Pointer to unused portion of zSql */
3771 );
3772 SQLITE_API int SQLITE_STDCALL sqlite3_prepare16(
3773 sqlite3 *db, /* Database handle */
3774 const void *zSql, /* SQL statement, UTF-16 encoded */
3775 int nByte, /* Maximum length of zSql in bytes. */
3776 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3777 const void **pzTail /* OUT: Pointer to unused portion of zSql */
3778 );
3779 SQLITE_API int SQLITE_STDCALL sqlite3_prepare16_v2(
3780 sqlite3 *db, /* Database handle */
3781 const void *zSql, /* SQL statement, UTF-16 encoded */
3782 int nByte, /* Maximum length of zSql in bytes. */
3783 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3784 const void **pzTail /* OUT: Pointer to unused portion of zSql */
@@ -3813,12 +3815,12 @@
3813 ** automatically freed when the prepared statement is finalized.
3814 ** ^The string returned by sqlite3_expanded_sql(P), on the other hand,
3815 ** is obtained from [sqlite3_malloc()] and must be free by the application
3816 ** by passing it to [sqlite3_free()].
3817 */
3818 SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt);
3819 SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt);
3820
3821 /*
3822 ** CAPI3REF: Determine If An SQL Statement Writes The Database
3823 ** METHOD: sqlite3_stmt
3824 **
@@ -3846,11 +3848,11 @@
3846 ** database. ^The [ATTACH] and [DETACH] statements also cause
3847 ** sqlite3_stmt_readonly() to return true since, while those statements
3848 ** change the configuration of a database connection, they do not make
3849 ** changes to the content of the database files on disk.
3850 */
3851 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3852
3853 /*
3854 ** CAPI3REF: Determine If A Prepared Statement Has Been Reset
3855 ** METHOD: sqlite3_stmt
3856 **
@@ -3867,11 +3869,11 @@
3867 ** to locate all prepared statements associated with a database
3868 ** connection that are in need of being reset. This can be used,
3869 ** for example, in diagnostic routines to search for prepared
3870 ** statements that are holding a transaction open.
3871 */
3872 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_busy(sqlite3_stmt*);
3873
3874 /*
3875 ** CAPI3REF: Dynamically Typed Value Object
3876 ** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
3877 **
@@ -4031,24 +4033,24 @@
4031 ** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails.
4032 **
4033 ** See also: [sqlite3_bind_parameter_count()],
4034 ** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
4035 */
4036 SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
4037 SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
4038 void(*)(void*));
4039 SQLITE_API int SQLITE_STDCALL sqlite3_bind_double(sqlite3_stmt*, int, double);
4040 SQLITE_API int SQLITE_STDCALL sqlite3_bind_int(sqlite3_stmt*, int, int);
4041 SQLITE_API int SQLITE_STDCALL sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
4042 SQLITE_API int SQLITE_STDCALL sqlite3_bind_null(sqlite3_stmt*, int);
4043 SQLITE_API int SQLITE_STDCALL sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
4044 SQLITE_API int SQLITE_STDCALL sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
4045 SQLITE_API int SQLITE_STDCALL sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
4046 void(*)(void*), unsigned char encoding);
4047 SQLITE_API int SQLITE_STDCALL sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
4048 SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
4049 SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
4050
4051 /*
4052 ** CAPI3REF: Number Of SQL Parameters
4053 ** METHOD: sqlite3_stmt
4054 **
@@ -4065,11 +4067,11 @@
4065 **
4066 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
4067 ** [sqlite3_bind_parameter_name()], and
4068 ** [sqlite3_bind_parameter_index()].
4069 */
4070 SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_count(sqlite3_stmt*);
4071
4072 /*
4073 ** CAPI3REF: Name Of A Host Parameter
4074 ** METHOD: sqlite3_stmt
4075 **
@@ -4093,11 +4095,11 @@
4093 **
4094 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
4095 ** [sqlite3_bind_parameter_count()], and
4096 ** [sqlite3_bind_parameter_index()].
4097 */
4098 SQLITE_API const char *SQLITE_STDCALL sqlite3_bind_parameter_name(sqlite3_stmt*, int);
4099
4100 /*
4101 ** CAPI3REF: Index Of A Parameter With A Given Name
4102 ** METHOD: sqlite3_stmt
4103 **
@@ -4110,21 +4112,21 @@
4110 **
4111 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
4112 ** [sqlite3_bind_parameter_count()], and
4113 ** [sqlite3_bind_parameter_name()].
4114 */
4115 SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
4116
4117 /*
4118 ** CAPI3REF: Reset All Bindings On A Prepared Statement
4119 ** METHOD: sqlite3_stmt
4120 **
4121 ** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset
4122 ** the [sqlite3_bind_blob | bindings] on a [prepared statement].
4123 ** ^Use this routine to reset all host parameters to NULL.
4124 */
4125 SQLITE_API int SQLITE_STDCALL sqlite3_clear_bindings(sqlite3_stmt*);
4126
4127 /*
4128 ** CAPI3REF: Number Of Columns In A Result Set
4129 ** METHOD: sqlite3_stmt
4130 **
@@ -4132,11 +4134,11 @@
4132 ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
4133 ** statement that does not return data (for example an [UPDATE]).
4134 **
4135 ** See also: [sqlite3_data_count()]
4136 */
4137 SQLITE_API int SQLITE_STDCALL sqlite3_column_count(sqlite3_stmt *pStmt);
4138
4139 /*
4140 ** CAPI3REF: Column Names In A Result Set
4141 ** METHOD: sqlite3_stmt
4142 **
@@ -4161,12 +4163,12 @@
4161 ** ^The name of a result column is the value of the "AS" clause for
4162 ** that column, if there is an AS clause. If there is no AS clause
4163 ** then the name of the column is unspecified and may change from
4164 ** one release of SQLite to the next.
4165 */
4166 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_name(sqlite3_stmt*, int N);
4167 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_name16(sqlite3_stmt*, int N);
4168
4169 /*
4170 ** CAPI3REF: Source Of Data In A Query Result
4171 ** METHOD: sqlite3_stmt
4172 **
@@ -4210,16 +4212,16 @@
4210 ** If two or more threads call one or more
4211 ** [sqlite3_column_database_name | column metadata interfaces]
4212 ** for the same [prepared statement] and result column
4213 ** at the same time then the results are undefined.
4214 */
4215 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_database_name(sqlite3_stmt*,int);
4216 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_database_name16(sqlite3_stmt*,int);
4217 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_table_name(sqlite3_stmt*,int);
4218 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_table_name16(sqlite3_stmt*,int);
4219 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_origin_name(sqlite3_stmt*,int);
4220 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_origin_name16(sqlite3_stmt*,int);
4221
4222 /*
4223 ** CAPI3REF: Declared Datatype Of A Query Result
4224 ** METHOD: sqlite3_stmt
4225 **
@@ -4247,12 +4249,12 @@
4247 ** data stored in that column is of the declared type. SQLite is
4248 ** strongly typed, but the typing is dynamic not static. ^Type
4249 ** is associated with individual values, not with the containers
4250 ** used to hold those values.
4251 */
4252 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_decltype(sqlite3_stmt*,int);
4253 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_decltype16(sqlite3_stmt*,int);
4254
4255 /*
4256 ** CAPI3REF: Evaluate An SQL Statement
4257 ** METHOD: sqlite3_stmt
4258 **
@@ -4309,11 +4311,12 @@
4309 ** For all versions of SQLite up to and including 3.6.23.1, a call to
4310 ** [sqlite3_reset()] was required after sqlite3_step() returned anything
4311 ** other than [SQLITE_ROW] before any subsequent invocation of
4312 ** sqlite3_step(). Failure to reset the prepared statement using
4313 ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
4314 ** sqlite3_step(). But after version 3.6.23.1, sqlite3_step() began
 
4315 ** calling [sqlite3_reset()] automatically in this circumstance rather
4316 ** than returning [SQLITE_MISUSE]. This is not considered a compatibility
4317 ** break because any application that ever receives an SQLITE_MISUSE error
4318 ** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
4319 ** can be used to restore the legacy behavior.
@@ -4328,11 +4331,11 @@
4328 ** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
4329 ** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
4330 ** then the more specific [error codes] are returned directly
4331 ** by sqlite3_step(). The use of the "v2" interface is recommended.
4332 */
4333 SQLITE_API int SQLITE_STDCALL sqlite3_step(sqlite3_stmt*);
4334
4335 /*
4336 ** CAPI3REF: Number of columns in a result set
4337 ** METHOD: sqlite3_stmt
4338 **
@@ -4349,11 +4352,11 @@
4349 ** where it always returns zero since each step of that multi-step
4350 ** pragma returns 0 columns of data.
4351 **
4352 ** See also: [sqlite3_column_count()]
4353 */
4354 SQLITE_API int SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt);
4355
4356 /*
4357 ** CAPI3REF: Fundamental Datatypes
4358 ** KEYWORDS: SQLITE_TEXT
4359 **
@@ -4539,20 +4542,20 @@
4539 ** of these routines, a default value is returned. The default value
4540 ** is either the integer 0, the floating point number 0.0, or a NULL
4541 ** pointer. Subsequent calls to [sqlite3_errcode()] will return
4542 ** [SQLITE_NOMEM].)^
4543 */
4544 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_blob(sqlite3_stmt*, int iCol);
4545 SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes(sqlite3_stmt*, int iCol);
4546 SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
4547 SQLITE_API double SQLITE_STDCALL sqlite3_column_double(sqlite3_stmt*, int iCol);
4548 SQLITE_API int SQLITE_STDCALL sqlite3_column_int(sqlite3_stmt*, int iCol);
4549 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_column_int64(sqlite3_stmt*, int iCol);
4550 SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_column_text(sqlite3_stmt*, int iCol);
4551 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_text16(sqlite3_stmt*, int iCol);
4552 SQLITE_API int SQLITE_STDCALL sqlite3_column_type(sqlite3_stmt*, int iCol);
4553 SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_column_value(sqlite3_stmt*, int iCol);
4554
4555 /*
4556 ** CAPI3REF: Destroy A Prepared Statement Object
4557 ** DESTRUCTOR: sqlite3_stmt
4558 **
@@ -4576,11 +4579,11 @@
4576 ** resource leaks. It is a grievous error for the application to try to use
4577 ** a prepared statement after it has been finalized. Any use of a prepared
4578 ** statement after it has been finalized can result in undefined and
4579 ** undesirable behavior such as segfaults and heap corruption.
4580 */
4581 SQLITE_API int SQLITE_STDCALL sqlite3_finalize(sqlite3_stmt *pStmt);
4582
4583 /*
4584 ** CAPI3REF: Reset A Prepared Statement Object
4585 ** METHOD: sqlite3_stmt
4586 **
@@ -4603,11 +4606,11 @@
4603 ** [sqlite3_reset(S)] returns an appropriate [error code].
4604 **
4605 ** ^The [sqlite3_reset(S)] interface does not change the values
4606 ** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
4607 */
4608 SQLITE_API int SQLITE_STDCALL sqlite3_reset(sqlite3_stmt *pStmt);
4609
4610 /*
4611 ** CAPI3REF: Create Or Redefine SQL Functions
4612 ** KEYWORDS: {function creation routines}
4613 ** KEYWORDS: {application-defined SQL function}
@@ -4703,31 +4706,31 @@
4703 ** ^An application-defined function is permitted to call other
4704 ** SQLite interfaces. However, such calls must not
4705 ** close the database connection nor finalize or reset the prepared
4706 ** statement in which the function is running.
4707 */
4708 SQLITE_API int SQLITE_STDCALL sqlite3_create_function(
4709 sqlite3 *db,
4710 const char *zFunctionName,
4711 int nArg,
4712 int eTextRep,
4713 void *pApp,
4714 void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
4715 void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4716 void (*xFinal)(sqlite3_context*)
4717 );
4718 SQLITE_API int SQLITE_STDCALL sqlite3_create_function16(
4719 sqlite3 *db,
4720 const void *zFunctionName,
4721 int nArg,
4722 int eTextRep,
4723 void *pApp,
4724 void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
4725 void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4726 void (*xFinal)(sqlite3_context*)
4727 );
4728 SQLITE_API int SQLITE_STDCALL sqlite3_create_function_v2(
4729 sqlite3 *db,
4730 const char *zFunctionName,
4731 int nArg,
4732 int eTextRep,
4733 void *pApp,
@@ -4769,16 +4772,16 @@
4769 ** to be supported. However, new applications should avoid
4770 ** the use of these functions. To encourage programmers to avoid
4771 ** these functions, we will not explain what they do.
4772 */
4773 #ifndef SQLITE_OMIT_DEPRECATED
4774 SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_aggregate_count(sqlite3_context*);
4775 SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_expired(sqlite3_stmt*);
4776 SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
4777 SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_global_recover(void);
4778 SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_thread_cleanup(void);
4779 SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
4780 void*,sqlite3_int64);
4781 #endif
4782
4783 /*
4784 ** CAPI3REF: Obtaining SQL Values
@@ -4824,22 +4827,22 @@
4824 ** or [sqlite3_value_text16()].
4825 **
4826 ** These routines must be called from the same thread as
4827 ** the SQL function that supplied the [sqlite3_value*] parameters.
4828 */
4829 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_blob(sqlite3_value*);
4830 SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes(sqlite3_value*);
4831 SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes16(sqlite3_value*);
4832 SQLITE_API double SQLITE_STDCALL sqlite3_value_double(sqlite3_value*);
4833 SQLITE_API int SQLITE_STDCALL sqlite3_value_int(sqlite3_value*);
4834 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_value_int64(sqlite3_value*);
4835 SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_value_text(sqlite3_value*);
4836 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16(sqlite3_value*);
4837 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16le(sqlite3_value*);
4838 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16be(sqlite3_value*);
4839 SQLITE_API int SQLITE_STDCALL sqlite3_value_type(sqlite3_value*);
4840 SQLITE_API int SQLITE_STDCALL sqlite3_value_numeric_type(sqlite3_value*);
4841
4842 /*
4843 ** CAPI3REF: Finding The Subtype Of SQL Values
4844 ** METHOD: sqlite3_value
4845 **
@@ -4851,11 +4854,11 @@
4851 **
4852 ** SQLite makes no use of subtype itself. It merely passes the subtype
4853 ** from the result of one [application-defined SQL function] into the
4854 ** input of another.
4855 */
4856 SQLITE_API unsigned int SQLITE_STDCALL sqlite3_value_subtype(sqlite3_value*);
4857
4858 /*
4859 ** CAPI3REF: Copy And Free SQL Values
4860 ** METHOD: sqlite3_value
4861 **
@@ -4867,12 +4870,12 @@
4867 **
4868 ** ^The sqlite3_value_free(V) interface frees an [sqlite3_value] object
4869 ** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
4870 ** then sqlite3_value_free(V) is a harmless no-op.
4871 */
4872 SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_value_dup(const sqlite3_value*);
4873 SQLITE_API void SQLITE_STDCALL sqlite3_value_free(sqlite3_value*);
4874
4875 /*
4876 ** CAPI3REF: Obtain Aggregate Function Context
4877 ** METHOD: sqlite3_context
4878 **
@@ -4913,11 +4916,11 @@
4913 ** function.
4914 **
4915 ** This routine must be called from the same thread in which
4916 ** the aggregate SQL function is running.
4917 */
4918 SQLITE_API void *SQLITE_STDCALL sqlite3_aggregate_context(sqlite3_context*, int nBytes);
4919
4920 /*
4921 ** CAPI3REF: User Data For Functions
4922 ** METHOD: sqlite3_context
4923 **
@@ -4928,11 +4931,11 @@
4928 ** registered the application defined function.
4929 **
4930 ** This routine must be called from the same thread in which
4931 ** the application-defined function is running.
4932 */
4933 SQLITE_API void *SQLITE_STDCALL sqlite3_user_data(sqlite3_context*);
4934
4935 /*
4936 ** CAPI3REF: Database Connection For Functions
4937 ** METHOD: sqlite3_context
4938 **
@@ -4940,11 +4943,11 @@
4940 ** the pointer to the [database connection] (the 1st parameter)
4941 ** of the [sqlite3_create_function()]
4942 ** and [sqlite3_create_function16()] routines that originally
4943 ** registered the application defined function.
4944 */
4945 SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_context*);
4946
4947 /*
4948 ** CAPI3REF: Function Auxiliary Data
4949 ** METHOD: sqlite3_context
4950 **
@@ -4994,12 +4997,12 @@
4994 ** values and [parameters] and expressions composed from the same.)^
4995 **
4996 ** These routines must be called from the same thread in which
4997 ** the SQL function is running.
4998 */
4999 SQLITE_API void *SQLITE_STDCALL sqlite3_get_auxdata(sqlite3_context*, int N);
5000 SQLITE_API void SQLITE_STDCALL sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
5001
5002
5003 /*
5004 ** CAPI3REF: Constants Defining Special Destructor Behavior
5005 **
@@ -5131,31 +5134,31 @@
5131 **
5132 ** If these routines are called from within the different thread
5133 ** than the one containing the application-defined function that received
5134 ** the [sqlite3_context] pointer, the results are undefined.
5135 */
5136 SQLITE_API void SQLITE_STDCALL sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
5137 SQLITE_API void SQLITE_STDCALL sqlite3_result_blob64(sqlite3_context*,const void*,
5138 sqlite3_uint64,void(*)(void*));
5139 SQLITE_API void SQLITE_STDCALL sqlite3_result_double(sqlite3_context*, double);
5140 SQLITE_API void SQLITE_STDCALL sqlite3_result_error(sqlite3_context*, const char*, int);
5141 SQLITE_API void SQLITE_STDCALL sqlite3_result_error16(sqlite3_context*, const void*, int);
5142 SQLITE_API void SQLITE_STDCALL sqlite3_result_error_toobig(sqlite3_context*);
5143 SQLITE_API void SQLITE_STDCALL sqlite3_result_error_nomem(sqlite3_context*);
5144 SQLITE_API void SQLITE_STDCALL sqlite3_result_error_code(sqlite3_context*, int);
5145 SQLITE_API void SQLITE_STDCALL sqlite3_result_int(sqlite3_context*, int);
5146 SQLITE_API void SQLITE_STDCALL sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
5147 SQLITE_API void SQLITE_STDCALL sqlite3_result_null(sqlite3_context*);
5148 SQLITE_API void SQLITE_STDCALL sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
5149 SQLITE_API void SQLITE_STDCALL sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
5150 void(*)(void*), unsigned char encoding);
5151 SQLITE_API void SQLITE_STDCALL sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
5152 SQLITE_API void SQLITE_STDCALL sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
5153 SQLITE_API void SQLITE_STDCALL sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
5154 SQLITE_API void SQLITE_STDCALL sqlite3_result_value(sqlite3_context*, sqlite3_value*);
5155 SQLITE_API void SQLITE_STDCALL sqlite3_result_zeroblob(sqlite3_context*, int n);
5156 SQLITE_API int SQLITE_STDCALL sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
5157
5158
5159 /*
5160 ** CAPI3REF: Setting The Subtype Of An SQL Function
5161 ** METHOD: sqlite3_context
@@ -5166,11 +5169,11 @@
5166 ** of the subtype T are preserved in current versions of SQLite;
5167 ** higher order bits are discarded.
5168 ** The number of subtype bytes preserved by SQLite might increase
5169 ** in future releases of SQLite.
5170 */
5171 SQLITE_API void SQLITE_STDCALL sqlite3_result_subtype(sqlite3_context*,unsigned int);
5172
5173 /*
5174 ** CAPI3REF: Define New Collating Sequences
5175 ** METHOD: sqlite3
5176 **
@@ -5248,26 +5251,26 @@
5248 ** is unfortunate but cannot be changed without breaking backwards
5249 ** compatibility.
5250 **
5251 ** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
5252 */
5253 SQLITE_API int SQLITE_STDCALL sqlite3_create_collation(
5254 sqlite3*,
5255 const char *zName,
5256 int eTextRep,
5257 void *pArg,
5258 int(*xCompare)(void*,int,const void*,int,const void*)
5259 );
5260 SQLITE_API int SQLITE_STDCALL sqlite3_create_collation_v2(
5261 sqlite3*,
5262 const char *zName,
5263 int eTextRep,
5264 void *pArg,
5265 int(*xCompare)(void*,int,const void*,int,const void*),
5266 void(*xDestroy)(void*)
5267 );
5268 SQLITE_API int SQLITE_STDCALL sqlite3_create_collation16(
5269 sqlite3*,
5270 const void *zName,
5271 int eTextRep,
5272 void *pArg,
5273 int(*xCompare)(void*,int,const void*,int,const void*)
@@ -5298,16 +5301,16 @@
5298 **
5299 ** The callback function should register the desired collation using
5300 ** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
5301 ** [sqlite3_create_collation_v2()].
5302 */
5303 SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed(
5304 sqlite3*,
5305 void*,
5306 void(*)(void*,sqlite3*,int eTextRep,const char*)
5307 );
5308 SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed16(
5309 sqlite3*,
5310 void*,
5311 void(*)(void*,sqlite3*,int eTextRep,const void*)
5312 );
5313
@@ -5317,15 +5320,15 @@
5317 ** called right after sqlite3_open().
5318 **
5319 ** The code to implement this API is not available in the public release
5320 ** of SQLite.
5321 */
5322 SQLITE_API int SQLITE_STDCALL sqlite3_key(
5323 sqlite3 *db, /* Database to be rekeyed */
5324 const void *pKey, int nKey /* The key */
5325 );
5326 SQLITE_API int SQLITE_STDCALL sqlite3_key_v2(
5327 sqlite3 *db, /* Database to be rekeyed */
5328 const char *zDbName, /* Name of the database */
5329 const void *pKey, int nKey /* The key */
5330 );
5331
@@ -5335,35 +5338,35 @@
5335 ** database is decrypted.
5336 **
5337 ** The code to implement this API is not available in the public release
5338 ** of SQLite.
5339 */
5340 SQLITE_API int SQLITE_STDCALL sqlite3_rekey(
5341 sqlite3 *db, /* Database to be rekeyed */
5342 const void *pKey, int nKey /* The new key */
5343 );
5344 SQLITE_API int SQLITE_STDCALL sqlite3_rekey_v2(
5345 sqlite3 *db, /* Database to be rekeyed */
5346 const char *zDbName, /* Name of the database */
5347 const void *pKey, int nKey /* The new key */
5348 );
5349
5350 /*
5351 ** Specify the activation key for a SEE database. Unless
5352 ** activated, none of the SEE routines will work.
5353 */
5354 SQLITE_API void SQLITE_STDCALL sqlite3_activate_see(
5355 const char *zPassPhrase /* Activation phrase */
5356 );
5357 #endif
5358
5359 #ifdef SQLITE_ENABLE_CEROD
5360 /*
5361 ** Specify the activation key for a CEROD database. Unless
5362 ** activated, none of the CEROD routines will work.
5363 */
5364 SQLITE_API void SQLITE_STDCALL sqlite3_activate_cerod(
5365 const char *zPassPhrase /* Activation phrase */
5366 );
5367 #endif
5368
5369 /*
@@ -5381,11 +5384,11 @@
5381 ** method of the default [sqlite3_vfs] object. If the xSleep() method
5382 ** of the default VFS is not implemented correctly, or not implemented at
5383 ** all, then the behavior of sqlite3_sleep() may deviate from the description
5384 ** in the previous paragraphs.
5385 */
5386 SQLITE_API int SQLITE_STDCALL sqlite3_sleep(int);
5387
5388 /*
5389 ** CAPI3REF: Name Of The Folder Holding Temporary Files
5390 **
5391 ** ^(If this global variable is made to point to a string which is
@@ -5500,11 +5503,11 @@
5500 **
5501 ** If another thread changes the autocommit status of the database
5502 ** connection while this routine is running, then the return value
5503 ** is undefined.
5504 */
5505 SQLITE_API int SQLITE_STDCALL sqlite3_get_autocommit(sqlite3*);
5506
5507 /*
5508 ** CAPI3REF: Find The Database Handle Of A Prepared Statement
5509 ** METHOD: sqlite3_stmt
5510 **
@@ -5513,11 +5516,11 @@
5513 ** returned by sqlite3_db_handle is the same [database connection]
5514 ** that was the first argument
5515 ** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
5516 ** create the statement in the first place.
5517 */
5518 SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_db_handle(sqlite3_stmt*);
5519
5520 /*
5521 ** CAPI3REF: Return The Filename For A Database Connection
5522 ** METHOD: sqlite3
5523 **
@@ -5530,21 +5533,21 @@
5530 ** ^The filename returned by this function is the output of the
5531 ** xFullPathname method of the [VFS]. ^In other words, the filename
5532 ** will be an absolute pathname, even if the filename used
5533 ** to open the database originally was a URI or relative pathname.
5534 */
5535 SQLITE_API const char *SQLITE_STDCALL sqlite3_db_filename(sqlite3 *db, const char *zDbName);
5536
5537 /*
5538 ** CAPI3REF: Determine if a database is read-only
5539 ** METHOD: sqlite3
5540 **
5541 ** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N
5542 ** of connection D is read-only, 0 if it is read/write, or -1 if N is not
5543 ** the name of a database on connection D.
5544 */
5545 SQLITE_API int SQLITE_STDCALL sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
5546
5547 /*
5548 ** CAPI3REF: Find the next prepared statement
5549 ** METHOD: sqlite3
5550 **
@@ -5556,11 +5559,11 @@
5556 **
5557 ** The [database connection] pointer D in a call to
5558 ** [sqlite3_next_stmt(D,S)] must refer to an open database
5559 ** connection and in particular must not be a NULL pointer.
5560 */
5561 SQLITE_API sqlite3_stmt *SQLITE_STDCALL sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
5562
5563 /*
5564 ** CAPI3REF: Commit And Rollback Notification Callbacks
5565 ** METHOD: sqlite3
5566 **
@@ -5605,12 +5608,12 @@
5605 ** ^The rollback callback is not invoked if a transaction is
5606 ** automatically rolled back because the database connection is closed.
5607 **
5608 ** See also the [sqlite3_update_hook()] interface.
5609 */
5610 SQLITE_API void *SQLITE_STDCALL sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
5611 SQLITE_API void *SQLITE_STDCALL sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
5612
5613 /*
5614 ** CAPI3REF: Data Change Notification Callbacks
5615 ** METHOD: sqlite3
5616 **
@@ -5657,11 +5660,11 @@
5657 ** the first call on D.
5658 **
5659 ** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()],
5660 ** and [sqlite3_preupdate_hook()] interfaces.
5661 */
5662 SQLITE_API void *SQLITE_STDCALL sqlite3_update_hook(
5663 sqlite3*,
5664 void(*)(void *,int ,char const *,char const *,sqlite3_int64),
5665 void*
5666 );
5667
@@ -5672,11 +5675,12 @@
5672 ** and schema data structures between [database connection | connections]
5673 ** to the same database. Sharing is enabled if the argument is true
5674 ** and disabled if the argument is false.)^
5675 **
5676 ** ^Cache sharing is enabled and disabled for an entire process.
5677 ** This is a change as of SQLite version 3.5.0. In prior versions of SQLite,
 
5678 ** sharing was enabled or disabled for each thread separately.
5679 **
5680 ** ^(The cache sharing mode set by this interface effects all subsequent
5681 ** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
5682 ** Existing database connections continue use the sharing mode
@@ -5697,11 +5701,11 @@
5697 ** This interface is threadsafe on processors where writing a
5698 ** 32-bit integer is atomic.
5699 **
5700 ** See Also: [SQLite Shared-Cache Mode]
5701 */
5702 SQLITE_API int SQLITE_STDCALL sqlite3_enable_shared_cache(int);
5703
5704 /*
5705 ** CAPI3REF: Attempt To Free Heap Memory
5706 **
5707 ** ^The sqlite3_release_memory() interface attempts to free N bytes
@@ -5713,11 +5717,11 @@
5713 ** ^The sqlite3_release_memory() routine is a no-op returning zero
5714 ** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT].
5715 **
5716 ** See also: [sqlite3_db_release_memory()]
5717 */
5718 SQLITE_API int SQLITE_STDCALL sqlite3_release_memory(int);
5719
5720 /*
5721 ** CAPI3REF: Free Memory Used By A Database Connection
5722 ** METHOD: sqlite3
5723 **
@@ -5727,11 +5731,11 @@
5727 ** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is
5728 ** omitted.
5729 **
5730 ** See also: [sqlite3_release_memory()]
5731 */
5732 SQLITE_API int SQLITE_STDCALL sqlite3_db_release_memory(sqlite3*);
5733
5734 /*
5735 ** CAPI3REF: Impose A Limit On Heap Size
5736 **
5737 ** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
@@ -5766,11 +5770,12 @@
5766 ** <li> The page cache allocates from its own memory pool supplied
5767 ** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
5768 ** from the heap.
5769 ** </ul>)^
5770 **
5771 ** Beginning with SQLite version 3.7.3, the soft heap limit is enforced
 
5772 ** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT]
5773 ** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT],
5774 ** the soft heap limit is enforced on every memory allocation. Without
5775 ** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced
5776 ** when memory is allocated by the page cache. Testing suggests that because
@@ -5779,11 +5784,11 @@
5779 ** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT].
5780 **
5781 ** The circumstances under which SQLite will enforce the soft heap limit may
5782 ** changes in future releases of SQLite.
5783 */
5784 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_soft_heap_limit64(sqlite3_int64 N);
5785
5786 /*
5787 ** CAPI3REF: Deprecated Soft Heap Limit Interface
5788 ** DEPRECATED
5789 **
@@ -5790,11 +5795,11 @@
5790 ** This is a deprecated version of the [sqlite3_soft_heap_limit64()]
5791 ** interface. This routine is provided for historical compatibility
5792 ** only. All new applications should use the
5793 ** [sqlite3_soft_heap_limit64()] interface rather than this one.
5794 */
5795 SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_soft_heap_limit(int N);
5796
5797
5798 /*
5799 ** CAPI3REF: Extract Metadata About A Column Of A Table
5800 ** METHOD: sqlite3
@@ -5860,11 +5865,11 @@
5860 **
5861 ** ^This function causes all database schemas to be read from disk and
5862 ** parsed, if that has not already been done, and returns an error if
5863 ** any errors are encountered while loading the schema.
5864 */
5865 SQLITE_API int SQLITE_STDCALL sqlite3_table_column_metadata(
5866 sqlite3 *db, /* Connection handle */
5867 const char *zDbName, /* Database name or NULL */
5868 const char *zTableName, /* Table name */
5869 const char *zColumnName, /* Column name */
5870 char const **pzDataType, /* OUTPUT: Declared data type */
@@ -5916,11 +5921,11 @@
5916 ** disabled and prevent SQL injections from giving attackers
5917 ** access to extension loading capabilities.
5918 **
5919 ** See also the [load_extension() SQL function].
5920 */
5921 SQLITE_API int SQLITE_STDCALL sqlite3_load_extension(
5922 sqlite3 *db, /* Load the extension into this database connection */
5923 const char *zFile, /* Name of the shared library containing extension */
5924 const char *zProc, /* Entry point. Derived from zFile if 0 */
5925 char **pzErrMsg /* Put error message here if not 0 */
5926 );
@@ -5948,11 +5953,11 @@
5948 ** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method
5949 ** rather than this interface, so the [load_extension()] SQL function
5950 ** remains disabled. This will prevent SQL injections from giving attackers
5951 ** access to extension loading capabilities.
5952 */
5953 SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int onoff);
5954
5955 /*
5956 ** CAPI3REF: Automatically Load Statically Linked Extensions
5957 **
5958 ** ^This interface causes the xEntryPoint() function to be invoked for
@@ -5986,11 +5991,11 @@
5986 ** will be called more than once for each database connection that is opened.
5987 **
5988 ** See also: [sqlite3_reset_auto_extension()]
5989 ** and [sqlite3_cancel_auto_extension()]
5990 */
5991 SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void(*xEntryPoint)(void));
5992
5993 /*
5994 ** CAPI3REF: Cancel Automatic Extension Loading
5995 **
5996 ** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
@@ -5998,19 +6003,19 @@
5998 ** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)]
5999 ** routine returns 1 if initialization routine X was successfully
6000 ** unregistered and it returns 0 if X was not on the list of initialization
6001 ** routines.
6002 */
6003 SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
6004
6005 /*
6006 ** CAPI3REF: Reset Automatic Extension Loading
6007 **
6008 ** ^This interface disables all automatic extensions previously
6009 ** registered using [sqlite3_auto_extension()].
6010 */
6011 SQLITE_API void SQLITE_STDCALL sqlite3_reset_auto_extension(void);
6012
6013 /*
6014 ** The interface to the virtual-table mechanism is currently considered
6015 ** to be experimental. The interface might change in incompatible ways.
6016 ** If this is a problem for you, do not use the interface at this time.
@@ -6160,17 +6165,19 @@
6160 ** before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
6161 ** set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
6162 ** the xUpdate method are automatically rolled back by SQLite.
6163 **
6164 ** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
6165 ** structure for SQLite version 3.8.2. If a virtual table extension is
 
6166 ** used with an SQLite version earlier than 3.8.2, the results of attempting
6167 ** to read or write the estimatedRows field are undefined (but are likely
6168 ** to included crashing the application). The estimatedRows field should
6169 ** therefore only be used if [sqlite3_libversion_number()] returns a
6170 ** value greater than or equal to 3008002. Similarly, the idxFlags field
6171 ** was added for version 3.9.0. It may therefore only be used if
 
6172 ** sqlite3_libversion_number() returns a value greater than or equal to
6173 ** 3009000.
6174 */
6175 struct sqlite3_index_info {
6176 /* Inputs */
@@ -6251,17 +6258,17 @@
6251 ** be invoked if the call to sqlite3_create_module_v2() fails.
6252 ** ^The sqlite3_create_module()
6253 ** interface is equivalent to sqlite3_create_module_v2() with a NULL
6254 ** destructor.
6255 */
6256 SQLITE_API int SQLITE_STDCALL sqlite3_create_module(
6257 sqlite3 *db, /* SQLite connection to register module with */
6258 const char *zName, /* Name of the module */
6259 const sqlite3_module *p, /* Methods for the module */
6260 void *pClientData /* Client data for xCreate/xConnect */
6261 );
6262 SQLITE_API int SQLITE_STDCALL sqlite3_create_module_v2(
6263 sqlite3 *db, /* SQLite connection to register module with */
6264 const char *zName, /* Name of the module */
6265 const sqlite3_module *p, /* Methods for the module */
6266 void *pClientData, /* Client data for xCreate/xConnect */
6267 void(*xDestroy)(void*) /* Module destructor function */
@@ -6320,11 +6327,11 @@
6320 ** ^The [xCreate] and [xConnect] methods of a
6321 ** [virtual table module] call this interface
6322 ** to declare the format (the names and datatypes of the columns) of
6323 ** the virtual tables they implement.
6324 */
6325 SQLITE_API int SQLITE_STDCALL sqlite3_declare_vtab(sqlite3*, const char *zSQL);
6326
6327 /*
6328 ** CAPI3REF: Overload A Function For A Virtual Table
6329 ** METHOD: sqlite3
6330 **
@@ -6339,11 +6346,11 @@
6339 ** of the new function always causes an exception to be thrown. So
6340 ** the new function is not good for anything by itself. Its only
6341 ** purpose is to be a placeholder function that can be overloaded
6342 ** by a [virtual table].
6343 */
6344 SQLITE_API int SQLITE_STDCALL sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
6345
6346 /*
6347 ** The interface to the virtual-table mechanism defined above (back up
6348 ** to a comment remarkably similar to this one) is currently considered
6349 ** to be experimental. The interface might change in incompatible ways.
@@ -6438,11 +6445,11 @@
6438 ** zero-filled blob to read or write using the incremental-blob interface.
6439 **
6440 ** To avoid a resource leak, every open [BLOB handle] should eventually
6441 ** be released by a call to [sqlite3_blob_close()].
6442 */
6443 SQLITE_API int SQLITE_STDCALL sqlite3_blob_open(
6444 sqlite3*,
6445 const char *zDb,
6446 const char *zTable,
6447 const char *zColumn,
6448 sqlite3_int64 iRow,
@@ -6471,11 +6478,11 @@
6471 ** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle
6472 ** always returns zero.
6473 **
6474 ** ^This function sets the database handle error code and message.
6475 */
6476 SQLITE_API int SQLITE_STDCALL sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
6477
6478 /*
6479 ** CAPI3REF: Close A BLOB Handle
6480 ** DESTRUCTOR: sqlite3_blob
6481 **
@@ -6494,11 +6501,11 @@
6494 ** with a null pointer (such as would be returned by a failed call to
6495 ** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
6496 ** is passed a valid open blob handle, the values returned by the
6497 ** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
6498 */
6499 SQLITE_API int SQLITE_STDCALL sqlite3_blob_close(sqlite3_blob *);
6500
6501 /*
6502 ** CAPI3REF: Return The Size Of An Open BLOB
6503 ** METHOD: sqlite3_blob
6504 **
@@ -6510,11 +6517,11 @@
6510 ** This routine only works on a [BLOB handle] which has been created
6511 ** by a prior successful call to [sqlite3_blob_open()] and which has not
6512 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
6513 ** to this routine results in undefined and probably undesirable behavior.
6514 */
6515 SQLITE_API int SQLITE_STDCALL sqlite3_blob_bytes(sqlite3_blob *);
6516
6517 /*
6518 ** CAPI3REF: Read Data From A BLOB Incrementally
6519 ** METHOD: sqlite3_blob
6520 **
@@ -6539,11 +6546,11 @@
6539 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
6540 ** to this routine results in undefined and probably undesirable behavior.
6541 **
6542 ** See also: [sqlite3_blob_write()].
6543 */
6544 SQLITE_API int SQLITE_STDCALL sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
6545
6546 /*
6547 ** CAPI3REF: Write Data Into A BLOB Incrementally
6548 ** METHOD: sqlite3_blob
6549 **
@@ -6581,11 +6588,11 @@
6581 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
6582 ** to this routine results in undefined and probably undesirable behavior.
6583 **
6584 ** See also: [sqlite3_blob_read()].
6585 */
6586 SQLITE_API int SQLITE_STDCALL sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
6587
6588 /*
6589 ** CAPI3REF: Virtual File System Objects
6590 **
6591 ** A virtual filesystem (VFS) is an [sqlite3_vfs] object
@@ -6612,13 +6619,13 @@
6612 **
6613 ** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.
6614 ** ^(If the default VFS is unregistered, another VFS is chosen as
6615 ** the default. The choice for the new VFS is arbitrary.)^
6616 */
6617 SQLITE_API sqlite3_vfs *SQLITE_STDCALL sqlite3_vfs_find(const char *zVfsName);
6618 SQLITE_API int SQLITE_STDCALL sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
6619 SQLITE_API int SQLITE_STDCALL sqlite3_vfs_unregister(sqlite3_vfs*);
6620
6621 /*
6622 ** CAPI3REF: Mutexes
6623 **
6624 ** The SQLite core uses these routines for thread
@@ -6730,15 +6737,15 @@
6730 ** sqlite3_mutex_leave() is a NULL pointer, then all three routines
6731 ** behave as no-ops.
6732 **
6733 ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
6734 */
6735 SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_mutex_alloc(int);
6736 SQLITE_API void SQLITE_STDCALL sqlite3_mutex_free(sqlite3_mutex*);
6737 SQLITE_API void SQLITE_STDCALL sqlite3_mutex_enter(sqlite3_mutex*);
6738 SQLITE_API int SQLITE_STDCALL sqlite3_mutex_try(sqlite3_mutex*);
6739 SQLITE_API void SQLITE_STDCALL sqlite3_mutex_leave(sqlite3_mutex*);
6740
6741 /*
6742 ** CAPI3REF: Mutex Methods Object
6743 **
6744 ** An instance of this structure defines the low-level routines
@@ -6844,12 +6851,12 @@
6844 ** call to sqlite3_mutex_held() to fail, so a non-zero return is
6845 ** the appropriate thing to do. The sqlite3_mutex_notheld()
6846 ** interface should also return 1 when given a NULL pointer.
6847 */
6848 #ifndef NDEBUG
6849 SQLITE_API int SQLITE_STDCALL sqlite3_mutex_held(sqlite3_mutex*);
6850 SQLITE_API int SQLITE_STDCALL sqlite3_mutex_notheld(sqlite3_mutex*);
6851 #endif
6852
6853 /*
6854 ** CAPI3REF: Mutex Types
6855 **
@@ -6864,11 +6871,11 @@
6864 #define SQLITE_MUTEX_RECURSIVE 1
6865 #define SQLITE_MUTEX_STATIC_MASTER 2
6866 #define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */
6867 #define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */
6868 #define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */
6869 #define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */
6870 #define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
6871 #define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */
6872 #define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */
6873 #define SQLITE_MUTEX_STATIC_APP1 8 /* For use by application */
6874 #define SQLITE_MUTEX_STATIC_APP2 9 /* For use by application */
@@ -6885,11 +6892,11 @@
6885 ** serializes access to the [database connection] given in the argument
6886 ** when the [threading mode] is Serialized.
6887 ** ^If the [threading mode] is Single-thread or Multi-thread then this
6888 ** routine returns a NULL pointer.
6889 */
6890 SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_db_mutex(sqlite3*);
6891
6892 /*
6893 ** CAPI3REF: Low-Level Control Of Database Files
6894 ** METHOD: sqlite3
6895 **
@@ -6920,11 +6927,11 @@
6920 ** an incorrect zDbName and an SQLITE_ERROR return from the underlying
6921 ** xFileControl method.
6922 **
6923 ** See also: [SQLITE_FCNTL_LOCKSTATE]
6924 */
6925 SQLITE_API int SQLITE_STDCALL sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
6926
6927 /*
6928 ** CAPI3REF: Testing Interface
6929 **
6930 ** ^The sqlite3_test_control() interface is used to read out internal
@@ -6939,11 +6946,11 @@
6939 ** The details of the operation codes, their meanings, the parameters
6940 ** they take, and what they do are all subject to change without notice.
6941 ** Unlike most of the SQLite API, this function is not guaranteed to
6942 ** operate consistently from one release to the next.
6943 */
6944 SQLITE_API int SQLITE_CDECL sqlite3_test_control(int op, ...);
6945
6946 /*
6947 ** CAPI3REF: Testing Interface Operation Codes
6948 **
6949 ** These constants are the valid operation code parameters used
@@ -6968,10 +6975,11 @@
6968 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15
6969 #define SQLITE_TESTCTRL_ISKEYWORD 16
6970 #define SQLITE_TESTCTRL_SCRATCHMALLOC 17
6971 #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
6972 #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
 
6973 #define SQLITE_TESTCTRL_NEVER_CORRUPT 20
6974 #define SQLITE_TESTCTRL_VDBE_COVERAGE 21
6975 #define SQLITE_TESTCTRL_BYTEORDER 22
6976 #define SQLITE_TESTCTRL_ISINIT 23
6977 #define SQLITE_TESTCTRL_SORTER_MMAP 24
@@ -7002,12 +7010,12 @@
7002 ** be represented by a 32-bit integer, then the values returned by
7003 ** sqlite3_status() are undefined.
7004 **
7005 ** See also: [sqlite3_db_status()]
7006 */
7007 SQLITE_API int SQLITE_STDCALL sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
7008 SQLITE_API int SQLITE_STDCALL sqlite3_status64(
7009 int op,
7010 sqlite3_int64 *pCurrent,
7011 sqlite3_int64 *pHighwater,
7012 int resetFlag
7013 );
@@ -7128,11 +7136,11 @@
7128 ** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
7129 ** non-zero [error code] on failure.
7130 **
7131 ** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
7132 */
7133 SQLITE_API int SQLITE_STDCALL sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
7134
7135 /*
7136 ** CAPI3REF: Status Parameters for database connections
7137 ** KEYWORDS: {SQLITE_DBSTATUS options}
7138 **
@@ -7271,11 +7279,11 @@
7271 ** ^If the resetFlg is true, then the counter is reset to zero after this
7272 ** interface call returns.
7273 **
7274 ** See also: [sqlite3_status()] and [sqlite3_db_status()].
7275 */
7276 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
7277
7278 /*
7279 ** CAPI3REF: Status Parameters for prepared statements
7280 ** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters}
7281 **
@@ -7740,20 +7748,20 @@
7740 ** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()
7741 ** APIs are not strictly speaking threadsafe. If they are invoked at the
7742 ** same time as another thread is invoking sqlite3_backup_step() it is
7743 ** possible that they return invalid values.
7744 */
7745 SQLITE_API sqlite3_backup *SQLITE_STDCALL sqlite3_backup_init(
7746 sqlite3 *pDest, /* Destination database handle */
7747 const char *zDestName, /* Destination database name */
7748 sqlite3 *pSource, /* Source database handle */
7749 const char *zSourceName /* Source database name */
7750 );
7751 SQLITE_API int SQLITE_STDCALL sqlite3_backup_step(sqlite3_backup *p, int nPage);
7752 SQLITE_API int SQLITE_STDCALL sqlite3_backup_finish(sqlite3_backup *p);
7753 SQLITE_API int SQLITE_STDCALL sqlite3_backup_remaining(sqlite3_backup *p);
7754 SQLITE_API int SQLITE_STDCALL sqlite3_backup_pagecount(sqlite3_backup *p);
7755
7756 /*
7757 ** CAPI3REF: Unlock Notification
7758 ** METHOD: sqlite3
7759 **
@@ -7866,11 +7874,11 @@
7866 ** by an sqlite3_step() call. ^(If there is a blocking connection, then the
7867 ** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in
7868 ** the special "DROP TABLE/INDEX" case, the extended error code is just
7869 ** SQLITE_LOCKED.)^
7870 */
7871 SQLITE_API int SQLITE_STDCALL sqlite3_unlock_notify(
7872 sqlite3 *pBlocked, /* Waiting connection */
7873 void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */
7874 void *pNotifyArg /* Argument to pass to xNotify */
7875 );
7876
@@ -7881,12 +7889,12 @@
7881 ** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications
7882 ** and extensions to compare the contents of two buffers containing UTF-8
7883 ** strings in a case-independent fashion, using the same definition of "case
7884 ** independence" that SQLite uses internally when comparing identifiers.
7885 */
7886 SQLITE_API int SQLITE_STDCALL sqlite3_stricmp(const char *, const char *);
7887 SQLITE_API int SQLITE_STDCALL sqlite3_strnicmp(const char *, const char *, int);
7888
7889 /*
7890 ** CAPI3REF: String Globbing
7891 *
7892 ** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if
@@ -7899,11 +7907,11 @@
7899 ** Note that this routine returns zero on a match and non-zero if the strings
7900 ** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
7901 **
7902 ** See also: [sqlite3_strlike()].
7903 */
7904 SQLITE_API int SQLITE_STDCALL sqlite3_strglob(const char *zGlob, const char *zStr);
7905
7906 /*
7907 ** CAPI3REF: String LIKE Matching
7908 *
7909 ** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if
@@ -7922,11 +7930,11 @@
7922 ** Note that this routine returns zero on a match and non-zero if the strings
7923 ** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
7924 **
7925 ** See also: [sqlite3_strglob()].
7926 */
7927 SQLITE_API int SQLITE_STDCALL sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc);
7928
7929 /*
7930 ** CAPI3REF: Error Logging Interface
7931 **
7932 ** ^The [sqlite3_log()] interface writes a message into the [error log]
@@ -7945,11 +7953,11 @@
7945 ** will not use dynamically allocated memory. The log message is stored in
7946 ** a fixed-length buffer on the stack. If the log message is longer than
7947 ** a few hundred characters, it will be truncated to the length of the
7948 ** buffer.
7949 */
7950 SQLITE_API void SQLITE_CDECL sqlite3_log(int iErrCode, const char *zFormat, ...);
7951
7952 /*
7953 ** CAPI3REF: Write-Ahead Log Commit Hook
7954 ** METHOD: sqlite3
7955 **
@@ -7981,11 +7989,11 @@
7981 ** previously registered write-ahead log callback. ^Note that the
7982 ** [sqlite3_wal_autocheckpoint()] interface and the
7983 ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
7984 ** overwrite any prior [sqlite3_wal_hook()] settings.
7985 */
7986 SQLITE_API void *SQLITE_STDCALL sqlite3_wal_hook(
7987 sqlite3*,
7988 int(*)(void *,sqlite3*,const char*,int),
7989 void*
7990 );
7991
@@ -8016,11 +8024,11 @@
8016 ** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
8017 ** pages. The use of this interface
8018 ** is only necessary if the default setting is found to be suboptimal
8019 ** for a particular application.
8020 */
8021 SQLITE_API int SQLITE_STDCALL sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
8022
8023 /*
8024 ** CAPI3REF: Checkpoint a database
8025 ** METHOD: sqlite3
8026 **
@@ -8038,11 +8046,11 @@
8038 ** interface was added. This interface is retained for backwards
8039 ** compatibility and as a convenience for applications that need to manually
8040 ** start a callback but which do not need the full power (and corresponding
8041 ** complication) of [sqlite3_wal_checkpoint_v2()].
8042 */
8043 SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
8044
8045 /*
8046 ** CAPI3REF: Checkpoint a database
8047 ** METHOD: sqlite3
8048 **
@@ -8132,11 +8140,11 @@
8132 ** [sqlite3_errcode()] and [sqlite3_errmsg()].
8133 **
8134 ** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
8135 ** from SQL.
8136 */
8137 SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint_v2(
8138 sqlite3 *db, /* Database handle */
8139 const char *zDb, /* Name of attached database (or NULL) */
8140 int eMode, /* SQLITE_CHECKPOINT_* value */
8141 int *pnLog, /* OUT: Size of WAL log in frames */
8142 int *pnCkpt /* OUT: Total number of frames checkpointed */
@@ -8168,11 +8176,11 @@
8168 **
8169 ** At present, there is only one option that may be configured using
8170 ** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].) Further options
8171 ** may be added in the future.
8172 */
8173 SQLITE_API int SQLITE_CDECL sqlite3_vtab_config(sqlite3*, int op, ...);
8174
8175 /*
8176 ** CAPI3REF: Virtual Table Configuration Options
8177 **
8178 ** These macros define the various options to the
@@ -8221,11 +8229,11 @@
8221 ** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],
8222 ** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode
8223 ** of the SQL statement that triggered the call to the [xUpdate] method of the
8224 ** [virtual table].
8225 */
8226 SQLITE_API int SQLITE_STDCALL sqlite3_vtab_on_conflict(sqlite3 *);
8227
8228 /*
8229 ** CAPI3REF: Conflict resolution modes
8230 ** KEYWORDS: {conflict resolution mode}
8231 **
@@ -8326,11 +8334,11 @@
8326 ** as if the loop did not exist - it returns non-zero and leave the variable
8327 ** that pOut points to unchanged.
8328 **
8329 ** See also: [sqlite3_stmt_scanstatus_reset()]
8330 */
8331 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_scanstatus(
8332 sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
8333 int idx, /* Index of loop to report on */
8334 int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
8335 void *pOut /* Result written here */
8336 );
@@ -8342,11 +8350,11 @@
8342 ** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.
8343 **
8344 ** This API is only available if the library is built with pre-processor
8345 ** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
8346 */
8347 SQLITE_API void SQLITE_STDCALL sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
8348
8349 /*
8350 ** CAPI3REF: Flush caches to disk mid-transaction
8351 **
8352 ** ^If a write-transaction is open on [database connection] D when the
@@ -8374,11 +8382,11 @@
8374 ** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK.
8375 **
8376 ** ^This function does not set the database handle error code or message
8377 ** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.
8378 */
8379 SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*);
8380
8381 /*
8382 ** CAPI3REF: The pre-update hook.
8383 **
8384 ** ^These interfaces are only available if SQLite is compiled using the
@@ -8454,11 +8462,11 @@
8454 ** triggers; or 2 for changes resulting from triggers called by top-level
8455 ** triggers; and so forth.
8456 **
8457 ** See also: [sqlite3_update_hook()]
8458 */
8459 SQLITE_API SQLITE_EXPERIMENTAL void *SQLITE_STDCALL sqlite3_preupdate_hook(
8460 sqlite3 *db,
8461 void(*xPreUpdate)(
8462 void *pCtx, /* Copy of third arg to preupdate_hook() */
8463 sqlite3 *db, /* Database handle */
8464 int op, /* SQLITE_UPDATE, DELETE or INSERT */
@@ -8467,14 +8475,14 @@
8467 sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */
8468 sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */
8469 ),
8470 void*
8471 );
8472 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);
8473 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_count(sqlite3 *);
8474 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_depth(sqlite3 *);
8475 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
8476
8477 /*
8478 ** CAPI3REF: Low-level system error code
8479 **
8480 ** ^Attempt to return the underlying operating system error code or error
@@ -8482,11 +8490,11 @@
8482 ** The return value is OS-dependent. For example, on unix systems, after
8483 ** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be
8484 ** called to get back the underlying "errno" that caused the problem, such
8485 ** as ENOSPC, EAUTH, EISDIR, and so forth.
8486 */
8487 SQLITE_API int SQLITE_STDCALL sqlite3_system_errno(sqlite3*);
8488
8489 /*
8490 ** CAPI3REF: Database Snapshot
8491 ** KEYWORDS: {snapshot}
8492 ** EXPERIMENTAL
@@ -8532,11 +8540,11 @@
8532 ** to avoid a memory leak.
8533 **
8534 ** The [sqlite3_snapshot_get()] interface is only available when the
8535 ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8536 */
8537 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_get(
8538 sqlite3 *db,
8539 const char *zSchema,
8540 sqlite3_snapshot **ppSnapshot
8541 );
8542
@@ -8570,11 +8578,11 @@
8570 ** database connection in order to make it ready to use snapshots.)
8571 **
8572 ** The [sqlite3_snapshot_open()] interface is only available when the
8573 ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8574 */
8575 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_open(
8576 sqlite3 *db,
8577 const char *zSchema,
8578 sqlite3_snapshot *pSnapshot
8579 );
8580
@@ -8587,11 +8595,11 @@
8587 ** using this routine to avoid a memory leak.
8588 **
8589 ** The [sqlite3_snapshot_free()] interface is only available when the
8590 ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8591 */
8592 SQLITE_API SQLITE_EXPERIMENTAL void SQLITE_STDCALL sqlite3_snapshot_free(sqlite3_snapshot*);
8593
8594 /*
8595 ** CAPI3REF: Compare the ages of two snapshot handles.
8596 ** EXPERIMENTAL
8597 **
@@ -8611,11 +8619,11 @@
8611 **
8612 ** Otherwise, this API returns a negative value if P1 refers to an older
8613 ** snapshot than P2, zero if the two handles refer to the same database
8614 ** snapshot, and a positive value if P1 is a newer snapshot than P2.
8615 */
8616 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_cmp(
8617 sqlite3_snapshot *p1,
8618 sqlite3_snapshot *p2
8619 );
8620
8621 /*
@@ -8669,11 +8677,11 @@
8669 ** Register a geometry callback named zGeom that can be used as part of an
8670 ** R-Tree geometry query as follows:
8671 **
8672 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
8673 */
8674 SQLITE_API int SQLITE_STDCALL sqlite3_rtree_geometry_callback(
8675 sqlite3 *db,
8676 const char *zGeom,
8677 int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),
8678 void *pContext
8679 );
@@ -8695,11 +8703,11 @@
8695 ** Register a 2nd-generation geometry callback named zScore that can be
8696 ** used as part of an R-Tree geometry query as follows:
8697 **
8698 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
8699 */
8700 SQLITE_API int SQLITE_STDCALL sqlite3_rtree_query_callback(
8701 sqlite3 *db,
8702 const char *zQueryFunc,
8703 int (*xQueryFunc)(sqlite3_rtree_query_info*),
8704 void *pContext,
8705 void (*xDestructor)(void*)
@@ -11916,12 +11924,12 @@
11916 */
11917 #ifdef SQLITE_OMIT_WSD
11918 #define SQLITE_WSD const
11919 #define GLOBAL(t,v) (*(t*)sqlite3_wsd_find((void*)&(v), sizeof(v)))
11920 #define sqlite3GlobalConfig GLOBAL(struct Sqlite3Config, sqlite3Config)
11921 SQLITE_API int SQLITE_STDCALL sqlite3_wsd_init(int N, int J);
11922 SQLITE_API void *SQLITE_STDCALL sqlite3_wsd_find(void *K, int L);
11923 #else
11924 #define SQLITE_WSD
11925 #define GLOBAL(t,v) v
11926 #define sqlite3GlobalConfig sqlite3Config
11927 #endif
@@ -12462,11 +12470,10 @@
12462 struct SubProgram {
12463 VdbeOp *aOp; /* Array of opcodes for sub-program */
12464 int nOp; /* Elements in aOp[] */
12465 int nMem; /* Number of memory cells required */
12466 int nCsr; /* Number of cursors required */
12467 int nOnce; /* Number of OP_Once instructions */
12468 void *token; /* id that may be used to recursive triggers */
12469 SubProgram *pNext; /* Next sub-program already visited */
12470 };
12471
12472 /*
@@ -15514,11 +15521,10 @@
15514 int iRangeReg; /* First register in temporary register block */
15515 int nErr; /* Number of errors seen */
15516 int nTab; /* Number of previously allocated VDBE cursors */
15517 int nMem; /* Number of memory cells used so far */
15518 int nSet; /* Number of sets used so far */
15519 int nOnce; /* Number of OP_Once instructions so far */
15520 int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */
15521 int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
15522 int iFixedOp; /* Never back out opcodes iFixedOp-1 or earlier */
15523 int ckBase; /* Base register of data during check constraints */
15524 int iSelfTab; /* Table of an index whose exprs are being coded */
@@ -15848,10 +15854,11 @@
15848 #endif
15849 #ifndef SQLITE_OMIT_BUILTIN_TEST
15850 int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */
15851 #endif
15852 int bLocaltimeFault; /* True to fail localtime() calls */
 
15853 };
15854
15855 /*
15856 ** This macro is used inside of assert() statements to indicate that
15857 ** the assert is only valid on a well-formed database. Instead of:
@@ -16201,11 +16208,10 @@
16201 SQLITE_PRIVATE void sqlite3AddCollateType(Parse*, Token*);
16202 SQLITE_PRIVATE void sqlite3EndTable(Parse*,Token*,Token*,u8,Select*);
16203 SQLITE_PRIVATE int sqlite3ParseUri(const char*,const char*,unsigned int*,
16204 sqlite3_vfs**,char**,char **);
16205 SQLITE_PRIVATE Btree *sqlite3DbNameToBtree(sqlite3*,const char*);
16206 SQLITE_PRIVATE int sqlite3CodeOnce(Parse *);
16207
16208 #ifdef SQLITE_OMIT_BUILTIN_TEST
16209 # define sqlite3FaultSim(X) SQLITE_OK
16210 #else
16211 SQLITE_PRIVATE int sqlite3FaultSim(int);
@@ -17129,11 +17135,12 @@
17129 0, /* pVbeBranchArg */
17130 #endif
17131 #ifndef SQLITE_OMIT_BUILTIN_TEST
17132 0, /* xTestCallback */
17133 #endif
17134 0 /* bLocaltimeFault */
 
17135 };
17136
17137 /*
17138 ** Hash table for global functions - functions common to all
17139 ** database connections. After initialization, this table is
@@ -17601,11 +17608,11 @@
17601 ** was used and false if not.
17602 **
17603 ** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
17604 ** is not required for a match.
17605 */
17606 SQLITE_API int SQLITE_STDCALL sqlite3_compileoption_used(const char *zOptName){
17607 int i, n;
17608
17609 #if SQLITE_ENABLE_API_ARMOR
17610 if( zOptName==0 ){
17611 (void)SQLITE_MISUSE_BKPT;
@@ -17629,11 +17636,11 @@
17629
17630 /*
17631 ** Return the N-th compile-time option string. If N is out of range,
17632 ** return a NULL pointer.
17633 */
17634 SQLITE_API const char *SQLITE_STDCALL sqlite3_compileoption_get(int N){
17635 if( N>=0 && N<ArraySize(azCompileOpt) ){
17636 return azCompileOpt[N];
17637 }
17638 return 0;
17639 }
@@ -17817,20 +17824,18 @@
17817 Vdbe *v; /* VM this frame belongs to */
17818 VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */
17819 Op *aOp; /* Program instructions for parent frame */
17820 i64 *anExec; /* Event counters from parent frame */
17821 Mem *aMem; /* Array of memory cells for parent frame */
17822 u8 *aOnceFlag; /* Array of OP_Once flags for parent frame */
17823 VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */
17824 void *token; /* Copy of SubProgram.token */
17825 i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
17826 AuxData *pAuxData; /* Linked list of auxdata allocations */
17827 int nCursor; /* Number of entries in apCsr */
17828 int pc; /* Program Counter in parent (calling) frame */
17829 int nOp; /* Size of aOp array */
17830 int nMem; /* Number of entries in aMem */
17831 int nOnceFlag; /* Number of entries in aOnceFlag */
17832 int nChildMem; /* Number of memory cells for child frame */
17833 int nChildCsr; /* Number of cursors for child frame */
17834 int nChange; /* Statement changes (Vdbe.nChange) */
17835 int nDbChange; /* Value of db->nChange */
17836 };
@@ -18070,12 +18075,10 @@
18070 VdbeFrame *pFrame; /* Parent frame */
18071 VdbeFrame *pDelFrame; /* List of frame objects to free on VM reset */
18072 int nFrame; /* Number of frames in pFrame list */
18073 u32 expmask; /* Binding to these vars invalidates VM */
18074 SubProgram *pProgram; /* Linked list of all sub-programs used by VM */
18075 int nOnceFlag; /* Size of array aOnceFlag[] */
18076 u8 *aOnceFlag; /* Flags for OP_Once */
18077 AuxData *pAuxData; /* Linked list of auxdata allocations */
18078 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
18079 i64 *anExec; /* Number of times each op has been executed */
18080 int nScan; /* Entries in aScan[] */
18081 ScanStatus *aScan; /* Scan definitions for sqlite3_stmt_scanstatus() */
@@ -18339,11 +18342,11 @@
18339 }
18340
18341 /*
18342 ** Query status information.
18343 */
18344 SQLITE_API int SQLITE_STDCALL sqlite3_status64(
18345 int op,
18346 sqlite3_int64 *pCurrent,
18347 sqlite3_int64 *pHighwater,
18348 int resetFlag
18349 ){
@@ -18364,11 +18367,11 @@
18364 }
18365 sqlite3_mutex_leave(pMutex);
18366 (void)pMutex; /* Prevent warning when SQLITE_THREADSAFE=0 */
18367 return SQLITE_OK;
18368 }
18369 SQLITE_API int SQLITE_STDCALL sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){
18370 sqlite3_int64 iCur = 0, iHwtr = 0;
18371 int rc;
18372 #ifdef SQLITE_ENABLE_API_ARMOR
18373 if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT;
18374 #endif
@@ -18381,11 +18384,11 @@
18381 }
18382
18383 /*
18384 ** Query status information for a single database connection
18385 */
18386 SQLITE_API int SQLITE_STDCALL sqlite3_db_status(
18387 sqlite3 *db, /* The database connection whose status is desired */
18388 int op, /* Status verb */
18389 int *pCurrent, /* Write current value here */
18390 int *pHighwater, /* Write high-water mark here */
18391 int resetFlag /* Reset high-water mark if true */
@@ -20058,11 +20061,11 @@
20058
20059 /*
20060 ** Locate a VFS by name. If no name is given, simply return the
20061 ** first VFS on the list.
20062 */
20063 SQLITE_API sqlite3_vfs *SQLITE_STDCALL sqlite3_vfs_find(const char *zVfs){
20064 sqlite3_vfs *pVfs = 0;
20065 #if SQLITE_THREADSAFE
20066 sqlite3_mutex *mutex;
20067 #endif
20068 #ifndef SQLITE_OMIT_AUTOINIT
@@ -20104,11 +20107,11 @@
20104 /*
20105 ** Register a VFS with the system. It is harmless to register the same
20106 ** VFS multiple times. The new VFS becomes the default if makeDflt is
20107 ** true.
20108 */
20109 SQLITE_API int SQLITE_STDCALL sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){
20110 MUTEX_LOGIC(sqlite3_mutex *mutex;)
20111 #ifndef SQLITE_OMIT_AUTOINIT
20112 int rc = sqlite3_initialize();
20113 if( rc ) return rc;
20114 #endif
@@ -20132,11 +20135,11 @@
20132 }
20133
20134 /*
20135 ** Unregister a VFS so that it is no longer accessible.
20136 */
20137 SQLITE_API int SQLITE_STDCALL sqlite3_vfs_unregister(sqlite3_vfs *pVfs){
20138 #if SQLITE_THREADSAFE
20139 sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
20140 #endif
20141 sqlite3_mutex_enter(mutex);
20142 vfsUnlink(pVfs);
@@ -22483,11 +22486,11 @@
22483 }
22484
22485 /*
22486 ** Retrieve a pointer to a static mutex or allocate a new dynamic one.
22487 */
22488 SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_mutex_alloc(int id){
22489 #ifndef SQLITE_OMIT_AUTOINIT
22490 if( id<=SQLITE_MUTEX_RECURSIVE && sqlite3_initialize() ) return 0;
22491 if( id>SQLITE_MUTEX_RECURSIVE && sqlite3MutexInit() ) return 0;
22492 #endif
22493 assert( sqlite3GlobalConfig.mutex.xMutexAlloc );
@@ -22504,11 +22507,11 @@
22504 }
22505
22506 /*
22507 ** Free a dynamic mutex.
22508 */
22509 SQLITE_API void SQLITE_STDCALL sqlite3_mutex_free(sqlite3_mutex *p){
22510 if( p ){
22511 assert( sqlite3GlobalConfig.mutex.xMutexFree );
22512 sqlite3GlobalConfig.mutex.xMutexFree(p);
22513 }
22514 }
@@ -22515,11 +22518,11 @@
22515
22516 /*
22517 ** Obtain the mutex p. If some other thread already has the mutex, block
22518 ** until it can be obtained.
22519 */
22520 SQLITE_API void SQLITE_STDCALL sqlite3_mutex_enter(sqlite3_mutex *p){
22521 if( p ){
22522 assert( sqlite3GlobalConfig.mutex.xMutexEnter );
22523 sqlite3GlobalConfig.mutex.xMutexEnter(p);
22524 }
22525 }
@@ -22526,11 +22529,11 @@
22526
22527 /*
22528 ** Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another
22529 ** thread holds the mutex and it cannot be obtained, return SQLITE_BUSY.
22530 */
22531 SQLITE_API int SQLITE_STDCALL sqlite3_mutex_try(sqlite3_mutex *p){
22532 int rc = SQLITE_OK;
22533 if( p ){
22534 assert( sqlite3GlobalConfig.mutex.xMutexTry );
22535 return sqlite3GlobalConfig.mutex.xMutexTry(p);
22536 }
@@ -22541,11 +22544,11 @@
22541 ** The sqlite3_mutex_leave() routine exits a mutex that was previously
22542 ** entered by the same thread. The behavior is undefined if the mutex
22543 ** is not currently entered. If a NULL pointer is passed as an argument
22544 ** this function is a no-op.
22545 */
22546 SQLITE_API void SQLITE_STDCALL sqlite3_mutex_leave(sqlite3_mutex *p){
22547 if( p ){
22548 assert( sqlite3GlobalConfig.mutex.xMutexLeave );
22549 sqlite3GlobalConfig.mutex.xMutexLeave(p);
22550 }
22551 }
@@ -22553,15 +22556,15 @@
22553 #ifndef NDEBUG
22554 /*
22555 ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are
22556 ** intended for use inside assert() statements.
22557 */
22558 SQLITE_API int SQLITE_STDCALL sqlite3_mutex_held(sqlite3_mutex *p){
22559 assert( p==0 || sqlite3GlobalConfig.mutex.xMutexHeld );
22560 return p==0 || sqlite3GlobalConfig.mutex.xMutexHeld(p);
22561 }
22562 SQLITE_API int SQLITE_STDCALL sqlite3_mutex_notheld(sqlite3_mutex *p){
22563 assert( p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld );
22564 return p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld(p);
22565 }
22566 #endif
22567
@@ -23589,12 +23592,12 @@
23589 ** of the sqlite3_initialize() and sqlite3_shutdown() processing, the
23590 ** "interlocked" magic used here is probably not strictly necessary.
23591 */
23592 static LONG SQLITE_WIN32_VOLATILE winMutex_lock = 0;
23593
23594 SQLITE_API int SQLITE_STDCALL sqlite3_win32_is_nt(void); /* os_win.c */
23595 SQLITE_API void SQLITE_STDCALL sqlite3_win32_sleep(DWORD milliseconds); /* os_win.c */
23596
23597 static int winMutexInit(void){
23598 /* The first to increment to 1 does actual initialization */
23599 if( InterlockedCompareExchange(&winMutex_lock, 1, 0)==0 ){
23600 int i;
@@ -23890,11 +23893,11 @@
23890 /*
23891 ** Attempt to release up to n bytes of non-essential memory currently
23892 ** held by SQLite. An example of non-essential memory is memory used to
23893 ** cache database pages that are not currently in use.
23894 */
23895 SQLITE_API int SQLITE_STDCALL sqlite3_release_memory(int n){
23896 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
23897 return sqlite3PcacheReleaseMemory(n);
23898 #else
23899 /* IMPLEMENTATION-OF: R-34391-24921 The sqlite3_release_memory() routine
23900 ** is a no-op returning zero if SQLite is not compiled with
@@ -23949,11 +23952,11 @@
23949 /*
23950 ** Deprecated external interface. It used to set an alarm callback
23951 ** that was invoked when memory usage grew too large. Now it is a
23952 ** no-op.
23953 */
23954 SQLITE_API int SQLITE_STDCALL sqlite3_memory_alarm(
23955 void(*xCallback)(void *pArg, sqlite3_int64 used,int N),
23956 void *pArg,
23957 sqlite3_int64 iThreshold
23958 ){
23959 (void)xCallback;
@@ -23965,11 +23968,11 @@
23965
23966 /*
23967 ** Set the soft heap-size limit for the library. Passing a zero or
23968 ** negative value indicates no limit.
23969 */
23970 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_soft_heap_limit64(sqlite3_int64 n){
23971 sqlite3_int64 priorLimit;
23972 sqlite3_int64 excess;
23973 sqlite3_int64 nUsed;
23974 #ifndef SQLITE_OMIT_AUTOINIT
23975 int rc = sqlite3_initialize();
@@ -23987,11 +23990,11 @@
23987 sqlite3_mutex_leave(mem0.mutex);
23988 excess = sqlite3_memory_used() - n;
23989 if( excess>0 ) sqlite3_release_memory((int)(excess & 0x7fffffff));
23990 return priorLimit;
23991 }
23992 SQLITE_API void SQLITE_STDCALL sqlite3_soft_heap_limit(int n){
23993 if( n<0 ) n = 0;
23994 sqlite3_soft_heap_limit64(n);
23995 }
23996
23997 /*
@@ -24056,11 +24059,11 @@
24056 }
24057
24058 /*
24059 ** Return the amount of memory currently checked out.
24060 */
24061 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_used(void){
24062 sqlite3_int64 res, mx;
24063 sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, 0);
24064 return res;
24065 }
24066
@@ -24067,11 +24070,11 @@
24067 /*
24068 ** Return the maximum amount of memory that has ever been
24069 ** checked out since either the beginning of this process
24070 ** or since the most recent reset.
24071 */
24072 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_highwater(int resetFlag){
24073 sqlite3_int64 res, mx;
24074 sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, resetFlag);
24075 return mx;
24076 }
24077
@@ -24147,17 +24150,17 @@
24147 /*
24148 ** This version of the memory allocation is for use by the application.
24149 ** First make sure the memory subsystem is initialized, then do the
24150 ** allocation.
24151 */
24152 SQLITE_API void *SQLITE_STDCALL sqlite3_malloc(int n){
24153 #ifndef SQLITE_OMIT_AUTOINIT
24154 if( sqlite3_initialize() ) return 0;
24155 #endif
24156 return n<=0 ? 0 : sqlite3Malloc(n);
24157 }
24158 SQLITE_API void *SQLITE_STDCALL sqlite3_malloc64(sqlite3_uint64 n){
24159 #ifndef SQLITE_OMIT_AUTOINIT
24160 if( sqlite3_initialize() ) return 0;
24161 #endif
24162 return sqlite3Malloc(n);
24163 }
@@ -24296,20 +24299,20 @@
24296 }else{
24297 assert( sqlite3_mutex_held(db->mutex) );
24298 return db->lookaside.sz;
24299 }
24300 }
24301 SQLITE_API sqlite3_uint64 SQLITE_STDCALL sqlite3_msize(void *p){
24302 assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
24303 assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
24304 return p ? sqlite3GlobalConfig.m.xSize(p) : 0;
24305 }
24306
24307 /*
24308 ** Free memory previously obtained from sqlite3Malloc().
24309 */
24310 SQLITE_API void SQLITE_STDCALL sqlite3_free(void *p){
24311 if( p==0 ) return; /* IMP: R-49053-54554 */
24312 assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
24313 assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
24314 if( sqlite3GlobalConfig.bMemstat ){
24315 sqlite3_mutex_enter(mem0.mutex);
@@ -24414,18 +24417,18 @@
24414
24415 /*
24416 ** The public interface to sqlite3Realloc. Make sure that the memory
24417 ** subsystem is initialized prior to invoking sqliteRealloc.
24418 */
24419 SQLITE_API void *SQLITE_STDCALL sqlite3_realloc(void *pOld, int n){
24420 #ifndef SQLITE_OMIT_AUTOINIT
24421 if( sqlite3_initialize() ) return 0;
24422 #endif
24423 if( n<0 ) n = 0; /* IMP: R-26507-47431 */
24424 return sqlite3Realloc(pOld, n);
24425 }
24426 SQLITE_API void *SQLITE_STDCALL sqlite3_realloc64(void *pOld, sqlite3_uint64 n){
24427 #ifndef SQLITE_OMIT_AUTOINIT
24428 if( sqlite3_initialize() ) return 0;
24429 #endif
24430 return sqlite3Realloc(pOld, n);
24431 }
@@ -25648,11 +25651,11 @@
25648
25649 /*
25650 ** Print into memory obtained from sqlite3_malloc(). Omit the internal
25651 ** %-conversion extensions.
25652 */
25653 SQLITE_API char *SQLITE_STDCALL sqlite3_vmprintf(const char *zFormat, va_list ap){
25654 char *z;
25655 char zBase[SQLITE_PRINT_BUF_SIZE];
25656 StrAccum acc;
25657
25658 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -25672,11 +25675,11 @@
25672
25673 /*
25674 ** Print into memory obtained from sqlite3_malloc()(). Omit the internal
25675 ** %-conversion extensions.
25676 */
25677 SQLITE_API char *SQLITE_CDECL sqlite3_mprintf(const char *zFormat, ...){
25678 va_list ap;
25679 char *z;
25680 #ifndef SQLITE_OMIT_AUTOINIT
25681 if( sqlite3_initialize() ) return 0;
25682 #endif
@@ -25697,11 +25700,11 @@
25697 ** this without breaking compatibility, so we just have to live with the
25698 ** mistake.
25699 **
25700 ** sqlite3_vsnprintf() is the varargs version.
25701 */
25702 SQLITE_API char *SQLITE_STDCALL sqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_list ap){
25703 StrAccum acc;
25704 if( n<=0 ) return zBuf;
25705 #ifdef SQLITE_ENABLE_API_ARMOR
25706 if( zBuf==0 || zFormat==0 ) {
25707 (void)SQLITE_MISUSE_BKPT;
@@ -25711,11 +25714,11 @@
25711 #endif
25712 sqlite3StrAccumInit(&acc, 0, zBuf, n, 0);
25713 sqlite3VXPrintf(&acc, zFormat, ap);
25714 return sqlite3StrAccumFinish(&acc);
25715 }
25716 SQLITE_API char *SQLITE_CDECL sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
25717 char *z;
25718 va_list ap;
25719 va_start(ap,zFormat);
25720 z = sqlite3_vsnprintf(n, zBuf, zFormat, ap);
25721 va_end(ap);
@@ -25747,11 +25750,11 @@
25747 }
25748
25749 /*
25750 ** Format and write a message to the log if logging is enabled.
25751 */
25752 SQLITE_API void SQLITE_CDECL sqlite3_log(int iErrCode, const char *zFormat, ...){
25753 va_list ap; /* Vararg list */
25754 if( sqlite3GlobalConfig.xLog ){
25755 va_start(ap, zFormat);
25756 renderLogMsg(iErrCode, zFormat, ap);
25757 va_end(ap);
@@ -26341,11 +26344,11 @@
26341 } sqlite3Prng;
26342
26343 /*
26344 ** Return N random bytes.
26345 */
26346 SQLITE_API void SQLITE_STDCALL sqlite3_randomness(int N, void *pBuf){
26347 unsigned char t;
26348 unsigned char *zBuf = pBuf;
26349
26350 /* The "wsdPrng" macro will resolve to the pseudo-random number generator
26351 ** state vector. If writable static data is unsupported on the target,
@@ -27544,11 +27547,11 @@
27544 ** sqlite3_strnicmp() APIs allow applications and extensions to compare
27545 ** the contents of two buffers containing UTF-8 strings in a
27546 ** case-independent fashion, using the same definition of "case
27547 ** independence" that SQLite uses internally when comparing identifiers.
27548 */
27549 SQLITE_API int SQLITE_STDCALL sqlite3_stricmp(const char *zLeft, const char *zRight){
27550 if( zLeft==0 ){
27551 return zRight ? -1 : 0;
27552 }else if( zRight==0 ){
27553 return 1;
27554 }
@@ -27565,11 +27568,11 @@
27565 a++;
27566 b++;
27567 }
27568 return c;
27569 }
27570 SQLITE_API int SQLITE_STDCALL sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){
27571 register unsigned char *a, *b;
27572 if( zLeft==0 ){
27573 return zRight ? -1 : 0;
27574 }else if( zRight==0 ){
27575 return 1;
@@ -28563,40 +28566,25 @@
28563 return 0;
28564 }else{
28565 return sqlite3AddInt64(pA, -iB);
28566 }
28567 }
28568 #define TWOPOWER32 (((i64)1)<<32)
28569 #define TWOPOWER31 (((i64)1)<<31)
28570 SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){
28571 i64 iA = *pA;
28572 i64 iA1, iA0, iB1, iB0, r;
28573
28574 iA1 = iA/TWOPOWER32;
28575 iA0 = iA % TWOPOWER32;
28576 iB1 = iB/TWOPOWER32;
28577 iB0 = iB % TWOPOWER32;
28578 if( iA1==0 ){
28579 if( iB1==0 ){
28580 *pA *= iB;
28581 return 0;
28582 }
28583 r = iA0*iB1;
28584 }else if( iB1==0 ){
28585 r = iA1*iB0;
28586 }else{
28587 /* If both iA1 and iB1 are non-zero, overflow will result */
28588 return 1;
28589 }
28590 testcase( r==(-TWOPOWER31)-1 );
28591 testcase( r==(-TWOPOWER31) );
28592 testcase( r==TWOPOWER31 );
28593 testcase( r==TWOPOWER31-1 );
28594 if( r<(-TWOPOWER31) || r>=TWOPOWER31 ) return 1;
28595 r *= TWOPOWER32;
28596 if( sqlite3AddInt64(&r, iA0*iB0) ) return 1;
28597 *pA = r;
28598 return 0;
28599 }
28600
28601 /*
28602 ** Compute the absolute value of a 32-bit signed integer, of possible. Or
@@ -36888,11 +36876,11 @@
36888 ** This routine is called once during SQLite initialization and by a
36889 ** single thread. The memory allocation and mutex subsystems have not
36890 ** necessarily been initialized when this routine is called, and so they
36891 ** should not be used.
36892 */
36893 SQLITE_API int SQLITE_STDCALL sqlite3_os_init(void){
36894 /*
36895 ** The following macro defines an initializer for an sqlite3_vfs object.
36896 ** The name of the VFS is NAME. The pAppData is a pointer to a pointer
36897 ** to the "finder" function. (pAppData is a pointer to a pointer because
36898 ** silly C90 rules prohibit a void* from being cast to a function pointer
@@ -36987,11 +36975,11 @@
36987 **
36988 ** Some operating systems might need to do some cleanup in this routine,
36989 ** to release dynamically allocated objects. But not on unix.
36990 ** This routine is a no-op for unix.
36991 */
36992 SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void){
36993 return SQLITE_OK;
36994 }
36995
36996 #endif /* SQLITE_OS_UNIX */
36997
@@ -38422,11 +38410,11 @@
38422 ** compact it. Upon success, SQLITE_OK will be returned. Upon failure, one
38423 ** of SQLITE_NOMEM, SQLITE_ERROR, or SQLITE_NOTFOUND will be returned. The
38424 ** "pnLargest" argument, if non-zero, will be used to return the size of the
38425 ** largest committed free block in the heap, in bytes.
38426 */
38427 SQLITE_API int SQLITE_STDCALL sqlite3_win32_compact_heap(LPUINT pnLargest){
38428 int rc = SQLITE_OK;
38429 UINT nLargest = 0;
38430 HANDLE hHeap;
38431
38432 winMemAssertMagic();
@@ -38462,11 +38450,11 @@
38462 ** If a Win32 native heap has been configured, this function will attempt to
38463 ** destroy and recreate it. If the Win32 native heap is not isolated and/or
38464 ** the sqlite3_memory_used() function does not return zero, SQLITE_BUSY will
38465 ** be returned and no changes will be made to the Win32 native heap.
38466 */
38467 SQLITE_API int SQLITE_STDCALL sqlite3_win32_reset_heap(){
38468 int rc;
38469 MUTEX_LOGIC( sqlite3_mutex *pMaster; ) /* The main static mutex */
38470 MUTEX_LOGIC( sqlite3_mutex *pMem; ) /* The memsys static mutex */
38471 MUTEX_LOGIC( pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); )
38472 MUTEX_LOGIC( pMem = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); )
@@ -38507,11 +38495,11 @@
38507 /*
38508 ** This function outputs the specified (ANSI) string to the Win32 debugger
38509 ** (if available).
38510 */
38511
38512 SQLITE_API void SQLITE_STDCALL sqlite3_win32_write_debug(const char *zBuf, int nBuf){
38513 char zDbgBuf[SQLITE_WIN32_DBG_BUF_SIZE];
38514 int nMin = MIN(nBuf, (SQLITE_WIN32_DBG_BUF_SIZE - 1)); /* may be negative. */
38515 if( nMin<-1 ) nMin = -1; /* all negative values become -1. */
38516 assert( nMin==-1 || nMin==0 || nMin<SQLITE_WIN32_DBG_BUF_SIZE );
38517 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -38553,11 +38541,11 @@
38553 */
38554 #if SQLITE_OS_WINRT
38555 static HANDLE sleepObj = NULL;
38556 #endif
38557
38558 SQLITE_API void SQLITE_STDCALL sqlite3_win32_sleep(DWORD milliseconds){
38559 #if SQLITE_OS_WINRT
38560 if ( sleepObj==NULL ){
38561 sleepObj = osCreateEventExW(NULL, NULL, CREATE_EVENT_MANUAL_RESET,
38562 SYNCHRONIZE);
38563 }
@@ -38602,11 +38590,11 @@
38602
38603 /*
38604 ** This function determines if the machine is running a version of Windows
38605 ** based on the NT kernel.
38606 */
38607 SQLITE_API int SQLITE_STDCALL sqlite3_win32_is_nt(void){
38608 #if SQLITE_OS_WINRT
38609 /*
38610 ** NOTE: The WinRT sub-platform is always assumed to be based on the NT
38611 ** kernel.
38612 */
@@ -38990,11 +38978,11 @@
38990 }
38991
38992 /*
38993 ** This is a public wrapper for the winUtf8ToUnicode() function.
38994 */
38995 SQLITE_API LPWSTR SQLITE_STDCALL sqlite3_win32_utf8_to_unicode(const char *zText){
38996 #ifdef SQLITE_ENABLE_API_ARMOR
38997 if( !zText ){
38998 (void)SQLITE_MISUSE_BKPT;
38999 return 0;
39000 }
@@ -39006,11 +38994,11 @@
39006 }
39007
39008 /*
39009 ** This is a public wrapper for the winUnicodeToUtf8() function.
39010 */
39011 SQLITE_API char *SQLITE_STDCALL sqlite3_win32_unicode_to_utf8(LPCWSTR zWideText){
39012 #ifdef SQLITE_ENABLE_API_ARMOR
39013 if( !zWideText ){
39014 (void)SQLITE_MISUSE_BKPT;
39015 return 0;
39016 }
@@ -39022,11 +39010,11 @@
39022 }
39023
39024 /*
39025 ** This is a public wrapper for the winMbcsToUtf8() function.
39026 */
39027 SQLITE_API char *SQLITE_STDCALL sqlite3_win32_mbcs_to_utf8(const char *zText){
39028 #ifdef SQLITE_ENABLE_API_ARMOR
39029 if( !zText ){
39030 (void)SQLITE_MISUSE_BKPT;
39031 return 0;
39032 }
@@ -39038,11 +39026,11 @@
39038 }
39039
39040 /*
39041 ** This is a public wrapper for the winMbcsToUtf8() function.
39042 */
39043 SQLITE_API char *SQLITE_STDCALL sqlite3_win32_mbcs_to_utf8_v2(const char *zText, int useAnsi){
39044 #ifdef SQLITE_ENABLE_API_ARMOR
39045 if( !zText ){
39046 (void)SQLITE_MISUSE_BKPT;
39047 return 0;
39048 }
@@ -39054,11 +39042,11 @@
39054 }
39055
39056 /*
39057 ** This is a public wrapper for the winUtf8ToMbcs() function.
39058 */
39059 SQLITE_API char *SQLITE_STDCALL sqlite3_win32_utf8_to_mbcs(const char *zText){
39060 #ifdef SQLITE_ENABLE_API_ARMOR
39061 if( !zText ){
39062 (void)SQLITE_MISUSE_BKPT;
39063 return 0;
39064 }
@@ -39070,11 +39058,11 @@
39070 }
39071
39072 /*
39073 ** This is a public wrapper for the winUtf8ToMbcs() function.
39074 */
39075 SQLITE_API char *SQLITE_STDCALL sqlite3_win32_utf8_to_mbcs_v2(const char *zText, int useAnsi){
39076 #ifdef SQLITE_ENABLE_API_ARMOR
39077 if( !zText ){
39078 (void)SQLITE_MISUSE_BKPT;
39079 return 0;
39080 }
@@ -39090,11 +39078,11 @@
39090 ** the provided arguments. The type argument must be 1 in order to set the
39091 ** data directory or 2 in order to set the temporary directory. The zValue
39092 ** argument is the name of the directory to use. The return value will be
39093 ** SQLITE_OK if successful.
39094 */
39095 SQLITE_API int SQLITE_STDCALL sqlite3_win32_set_directory(DWORD type, LPCWSTR zValue){
39096 char **ppDirectory = 0;
39097 #ifndef SQLITE_OMIT_AUTOINIT
39098 int rc = sqlite3_initialize();
39099 if( rc ) return rc;
39100 #endif
@@ -43008,11 +42996,11 @@
43008 }
43009
43010 /*
43011 ** Initialize and deinitialize the operating system interface.
43012 */
43013 SQLITE_API int SQLITE_STDCALL sqlite3_os_init(void){
43014 static sqlite3_vfs winVfs = {
43015 3, /* iVersion */
43016 sizeof(winFile), /* szOsFile */
43017 SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */
43018 0, /* pNext */
@@ -43139,11 +43127,11 @@
43139 #endif
43140
43141 return SQLITE_OK;
43142 }
43143
43144 SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void){
43145 #if SQLITE_OS_WINRT
43146 if( sleepObj!=NULL ){
43147 osCloseHandle(sleepObj);
43148 sleepObj = NULL;
43149 }
@@ -57182,11 +57170,11 @@
57182
57183 /*
57184 ** Return a +ve value if snapshot p1 is newer than p2. A -ve value if
57185 ** p1 is older than p2 and zero if p1 and p2 are the same snapshot.
57186 */
57187 SQLITE_API int SQLITE_STDCALL sqlite3_snapshot_cmp(sqlite3_snapshot *p1, sqlite3_snapshot *p2){
57188 WalIndexHdr *pHdr1 = (WalIndexHdr*)p1;
57189 WalIndexHdr *pHdr2 = (WalIndexHdr*)p2;
57190
57191 /* aSalt[0] is a copy of the value stored in the wal file header. It
57192 ** is incremented each time the wal file is restarted. */
@@ -58319,11 +58307,11 @@
58319 **
58320 ** This routine has no effect on existing database connections.
58321 ** The shared cache setting effects only future calls to
58322 ** sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2().
58323 */
58324 SQLITE_API int SQLITE_STDCALL sqlite3_enable_shared_cache(int enable){
58325 sqlite3GlobalConfig.sharedCacheEnabled = enable;
58326 return SQLITE_OK;
58327 }
58328 #endif
58329
@@ -59838,12 +59826,15 @@
59838 hdr = pPage->hdrOffset;
59839 iPtr = hdr + 1;
59840 if( data[iPtr+1]==0 && data[iPtr]==0 ){
59841 iFreeBlk = 0; /* Shortcut for the case when the freelist is empty */
59842 }else{
59843 while( (iFreeBlk = get2byte(&data[iPtr]))>0 && iFreeBlk<iStart ){
59844 if( iFreeBlk<iPtr+4 ) return SQLITE_CORRUPT_BKPT;
 
 
 
59845 iPtr = iFreeBlk;
59846 }
59847 if( iFreeBlk>iLast ) return SQLITE_CORRUPT_BKPT;
59848 assert( iFreeBlk>iPtr || iFreeBlk==0 );
59849
@@ -68092,11 +68083,11 @@
68092 ** a pointer to the new sqlite3_backup object.
68093 **
68094 ** If an error occurs, NULL is returned and an error code and error message
68095 ** stored in database handle pDestDb.
68096 */
68097 SQLITE_API sqlite3_backup *SQLITE_STDCALL sqlite3_backup_init(
68098 sqlite3* pDestDb, /* Database to write to */
68099 const char *zDestDb, /* Name of database within pDestDb */
68100 sqlite3* pSrcDb, /* Database connection to read from */
68101 const char *zSrcDb /* Name of database within pSrcDb */
68102 ){
@@ -68299,11 +68290,11 @@
68299 }
68300
68301 /*
68302 ** Copy nPage pages from the source b-tree to the destination.
68303 */
68304 SQLITE_API int SQLITE_STDCALL sqlite3_backup_step(sqlite3_backup *p, int nPage){
68305 int rc;
68306 int destMode; /* Destination journal mode */
68307 int pgszSrc = 0; /* Source page size */
68308 int pgszDest = 0; /* Destination page size */
68309
@@ -68553,11 +68544,11 @@
68553 }
68554
68555 /*
68556 ** Release all resources associated with an sqlite3_backup* handle.
68557 */
68558 SQLITE_API int SQLITE_STDCALL sqlite3_backup_finish(sqlite3_backup *p){
68559 sqlite3_backup **pp; /* Ptr to head of pagers backup list */
68560 sqlite3 *pSrcDb; /* Source database connection */
68561 int rc; /* Value to return */
68562
68563 /* Enter the mutexes */
@@ -68605,11 +68596,11 @@
68605
68606 /*
68607 ** Return the number of pages still to be backed up as of the most recent
68608 ** call to sqlite3_backup_step().
68609 */
68610 SQLITE_API int SQLITE_STDCALL sqlite3_backup_remaining(sqlite3_backup *p){
68611 #ifdef SQLITE_ENABLE_API_ARMOR
68612 if( p==0 ){
68613 (void)SQLITE_MISUSE_BKPT;
68614 return 0;
68615 }
@@ -68619,11 +68610,11 @@
68619
68620 /*
68621 ** Return the total number of pages in the source database as of the most
68622 ** recent call to sqlite3_backup_step().
68623 */
68624 SQLITE_API int SQLITE_STDCALL sqlite3_backup_pagecount(sqlite3_backup *p){
68625 #ifdef SQLITE_ENABLE_API_ARMOR
68626 if( p==0 ){
68627 (void)SQLITE_MISUSE_BKPT;
68628 return 0;
68629 }
@@ -68946,22 +68937,22 @@
68946 ** MEM.zMalloc, where it can be safely written.
68947 **
68948 ** Return SQLITE_OK on success or SQLITE_NOMEM if malloc fails.
68949 */
68950 SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){
68951 int f;
68952 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
68953 assert( (pMem->flags&MEM_RowSet)==0 );
68954 (void)ExpandBlob(pMem);
68955 f = pMem->flags;
68956 if( (f&(MEM_Str|MEM_Blob)) && (pMem->szMalloc==0 || pMem->z!=pMem->zMalloc) ){
68957 if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){
68958 return SQLITE_NOMEM_BKPT;
68959 }
68960 pMem->z[pMem->n] = 0;
68961 pMem->z[pMem->n+1] = 0;
68962 pMem->flags |= MEM_Term;
 
68963 }
68964 pMem->flags &= ~MEM_Ephem;
68965 #ifdef SQLITE_DEBUG
68966 pMem->pScopyFrom = 0;
68967 #endif
@@ -68973,29 +68964,28 @@
68973 ** If the given Mem* has a zero-filled tail, turn it into an ordinary
68974 ** blob stored in dynamically allocated space.
68975 */
68976 #ifndef SQLITE_OMIT_INCRBLOB
68977 SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){
68978 if( pMem->flags & MEM_Zero ){
68979 int nByte;
68980 assert( pMem->flags&MEM_Blob );
68981 assert( (pMem->flags&MEM_RowSet)==0 );
68982 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
68983
68984 /* Set nByte to the number of bytes required to store the expanded blob. */
68985 nByte = pMem->n + pMem->u.nZero;
68986 if( nByte<=0 ){
68987 nByte = 1;
68988 }
68989 if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){
68990 return SQLITE_NOMEM_BKPT;
68991 }
68992
68993 memset(&pMem->z[pMem->n], 0, pMem->u.nZero);
68994 pMem->n += pMem->u.nZero;
68995 pMem->flags &= ~(MEM_Zero|MEM_Term);
68996 }
68997 return SQLITE_OK;
68998 }
68999 #endif
69000
69001 /*
@@ -72345,11 +72335,10 @@
72345 sqlite3 *db; /* The database connection */
72346 int nVar; /* Number of parameters */
72347 int nMem; /* Number of VM memory registers */
72348 int nCursor; /* Number of cursors required */
72349 int nArg; /* Number of arguments in subprograms */
72350 int nOnce; /* Number of OP_Once instructions */
72351 int n; /* Loop counter */
72352 struct ReusableSpace x; /* Reusable bulk memory */
72353
72354 assert( p!=0 );
72355 assert( p->nOp>0 );
@@ -72360,12 +72349,10 @@
72360 assert( db->mallocFailed==0 );
72361 nVar = pParse->nVar;
72362 nMem = pParse->nMem;
72363 nCursor = pParse->nTab;
72364 nArg = pParse->nMaxArg;
72365 nOnce = pParse->nOnce;
72366 if( nOnce==0 ) nOnce = 1; /* Ensure at least one byte in p->aOnceFlag[] */
72367
72368 /* Each cursor uses a memory cell. The first cursor (cursor 0) can
72369 ** use aMem[0] which is not otherwise used by the VDBE program. Allocate
72370 ** space at the end of aMem[] for cursors 1 and greater.
72371 ** See also: allocateCursor().
@@ -72408,21 +72395,19 @@
72408 x.nNeeded = 0;
72409 p->aMem = allocSpace(&x, p->aMem, nMem*sizeof(Mem));
72410 p->aVar = allocSpace(&x, p->aVar, nVar*sizeof(Mem));
72411 p->apArg = allocSpace(&x, p->apArg, nArg*sizeof(Mem*));
72412 p->apCsr = allocSpace(&x, p->apCsr, nCursor*sizeof(VdbeCursor*));
72413 p->aOnceFlag = allocSpace(&x, p->aOnceFlag, nOnce);
72414 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
72415 p->anExec = allocSpace(&x, p->anExec, p->nOp*sizeof(i64));
72416 #endif
72417 if( x.nNeeded==0 ) break;
72418 x.pSpace = p->pFree = sqlite3DbMallocZero(db, x.nNeeded);
72419 x.nFree = x.nNeeded;
72420 }while( !db->mallocFailed );
72421
72422 p->nCursor = nCursor;
72423 p->nOnceFlag = nOnce;
72424 if( p->aVar ){
72425 p->nVar = (ynVar)nVar;
72426 for(n=0; n<nVar; n++){
72427 p->aVar[n].flags = MEM_Null;
72428 p->aVar[n].db = db;
@@ -72506,12 +72491,10 @@
72506 Vdbe *v = pFrame->v;
72507 closeCursorsInFrame(v);
72508 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
72509 v->anExec = pFrame->anExec;
72510 #endif
72511 v->aOnceFlag = pFrame->aOnceFlag;
72512 v->nOnceFlag = pFrame->nOnceFlag;
72513 v->aOp = pFrame->aOp;
72514 v->nOp = pFrame->nOp;
72515 v->aMem = pFrame->aMem;
72516 v->nMem = pFrame->nMem;
72517 v->apCsr = pFrame->apCsr;
@@ -73048,11 +73031,10 @@
73048 */
73049
73050 if( db->mallocFailed ){
73051 p->rc = SQLITE_NOMEM_BKPT;
73052 }
73053 if( p->aOnceFlag ) memset(p->aOnceFlag, 0, p->nOnceFlag);
73054 closeAllCursors(p);
73055 if( p->magic!=VDBE_MAGIC_RUN ){
73056 return SQLITE_OK;
73057 }
73058 checkActiveVdbeCnt(db);
@@ -74196,14 +74178,16 @@
74196
74197 /*
74198 ** The input pBlob is guaranteed to be a Blob that is not marked
74199 ** with MEM_Zero. Return true if it could be a zero-blob.
74200 */
74201 static int isZeroBlob(const Mem *pBlob){
74202 int i;
74203 for(i=0; i<pBlob->n && pBlob->z[i]==0; i++){}
74204 return i==pBlob->n;
 
 
74205 }
74206
74207 /*
74208 ** Compare two blobs. Return negative, zero, or positive if the first
74209 ** is less than, equal to, or greater than the second, respectively.
@@ -74223,14 +74207,14 @@
74223
74224 if( (pB1->flags|pB2->flags) & MEM_Zero ){
74225 if( pB1->flags & pB2->flags & MEM_Zero ){
74226 return pB1->u.nZero - pB2->u.nZero;
74227 }else if( pB1->flags & MEM_Zero ){
74228 if( !isZeroBlob(pB2) ) return -1;
74229 return pB1->u.nZero - n2;
74230 }else{
74231 if( !isZeroBlob(pB1) ) return +1;
74232 return n1 - pB2->u.nZero;
74233 }
74234 }
74235 c = memcmp(pB1->z, pB2->z, n1>n2 ? n2 : n1);
74236 if( c ) return c;
@@ -74538,10 +74522,11 @@
74538 }
74539 }
74540
74541 /* RHS is a blob */
74542 else if( pRhs->flags & MEM_Blob ){
 
74543 getVarint32(&aKey1[idx1], serial_type);
74544 testcase( serial_type==12 );
74545 if( serial_type<12 || (serial_type & 0x01) ){
74546 rc = -1;
74547 }else{
@@ -74549,10 +74534,16 @@
74549 testcase( (d1+nStr)==(unsigned)nKey1 );
74550 testcase( (d1+nStr+1)==(unsigned)nKey1 );
74551 if( (d1+nStr) > (unsigned)nKey1 ){
74552 pPKey2->errCode = (u8)SQLITE_CORRUPT_BKPT;
74553 return 0; /* Corruption */
 
 
 
 
 
 
74554 }else{
74555 int nCmp = MIN(nStr, pRhs->n);
74556 rc = memcmp(&aKey1[d1], pRhs->z, nCmp);
74557 if( rc==0 ) rc = nStr - pRhs->n;
74558 }
@@ -74619,11 +74610,11 @@
74619 const u8 *aKey = &((const u8*)pKey1)[*(const u8*)pKey1 & 0x3F];
74620 int serial_type = ((const u8*)pKey1)[1];
74621 int res;
74622 u32 y;
74623 u64 x;
74624 i64 v = pPKey2->aMem[0].u.i;
74625 i64 lhs;
74626
74627 vdbeAssertFieldCountWithinLimits(nKey1, pKey1, pPKey2->pKeyInfo);
74628 assert( (*(u8*)pKey1)<=0x3F || CORRUPT_DB );
74629 switch( serial_type ){
@@ -74678,10 +74669,11 @@
74678
74679 default:
74680 return sqlite3VdbeRecordCompare(nKey1, pKey1, pPKey2);
74681 }
74682
 
74683 if( v>lhs ){
74684 res = pPKey2->r1;
74685 }else if( v<lhs ){
74686 res = pPKey2->r2;
74687 }else if( pPKey2->nField>1 ){
@@ -75128,11 +75120,11 @@
75128 ** execution environment changes in a way that would alter the program
75129 ** that sqlite3_prepare() generates. For example, if new functions or
75130 ** collating sequences are registered or if an authorizer function is
75131 ** added or changed.
75132 */
75133 SQLITE_API int SQLITE_STDCALL sqlite3_expired(sqlite3_stmt *pStmt){
75134 Vdbe *p = (Vdbe*)pStmt;
75135 return p==0 || p->expired;
75136 }
75137 #endif
75138
@@ -75197,11 +75189,11 @@
75197 ** machine.
75198 **
75199 ** This routine sets the error code and string returned by
75200 ** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
75201 */
75202 SQLITE_API int SQLITE_STDCALL sqlite3_finalize(sqlite3_stmt *pStmt){
75203 int rc;
75204 if( pStmt==0 ){
75205 /* IMPLEMENTATION-OF: R-57228-12904 Invoking sqlite3_finalize() on a NULL
75206 ** pointer is a harmless no-op. */
75207 rc = SQLITE_OK;
@@ -75224,11 +75216,11 @@
75224 ** the prior execution is returned.
75225 **
75226 ** This routine sets the error code and string returned by
75227 ** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
75228 */
75229 SQLITE_API int SQLITE_STDCALL sqlite3_reset(sqlite3_stmt *pStmt){
75230 int rc;
75231 if( pStmt==0 ){
75232 rc = SQLITE_OK;
75233 }else{
75234 Vdbe *v = (Vdbe*)pStmt;
@@ -75245,11 +75237,11 @@
75245 }
75246
75247 /*
75248 ** Set all the parameters in the compiled SQL statement to NULL.
75249 */
75250 SQLITE_API int SQLITE_STDCALL sqlite3_clear_bindings(sqlite3_stmt *pStmt){
75251 int i;
75252 int rc = SQLITE_OK;
75253 Vdbe *p = (Vdbe*)pStmt;
75254 #if SQLITE_THREADSAFE
75255 sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex;
@@ -75269,61 +75261,61 @@
75269
75270 /**************************** sqlite3_value_ *******************************
75271 ** The following routines extract information from a Mem or sqlite3_value
75272 ** structure.
75273 */
75274 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_blob(sqlite3_value *pVal){
75275 Mem *p = (Mem*)pVal;
75276 if( p->flags & (MEM_Blob|MEM_Str) ){
75277 if( sqlite3VdbeMemExpandBlob(p)!=SQLITE_OK ){
75278 assert( p->flags==MEM_Null && p->z==0 );
75279 return 0;
75280 }
75281 p->flags |= MEM_Blob;
75282 return p->n ? p->z : 0;
75283 }else{
75284 return sqlite3_value_text(pVal);
75285 }
75286 }
75287 SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes(sqlite3_value *pVal){
75288 return sqlite3ValueBytes(pVal, SQLITE_UTF8);
75289 }
75290 SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes16(sqlite3_value *pVal){
75291 return sqlite3ValueBytes(pVal, SQLITE_UTF16NATIVE);
75292 }
75293 SQLITE_API double SQLITE_STDCALL sqlite3_value_double(sqlite3_value *pVal){
75294 return sqlite3VdbeRealValue((Mem*)pVal);
75295 }
75296 SQLITE_API int SQLITE_STDCALL sqlite3_value_int(sqlite3_value *pVal){
75297 return (int)sqlite3VdbeIntValue((Mem*)pVal);
75298 }
75299 SQLITE_API sqlite_int64 SQLITE_STDCALL sqlite3_value_int64(sqlite3_value *pVal){
75300 return sqlite3VdbeIntValue((Mem*)pVal);
75301 }
75302 SQLITE_API unsigned int SQLITE_STDCALL sqlite3_value_subtype(sqlite3_value *pVal){
75303 Mem *pMem = (Mem*)pVal;
75304 return ((pMem->flags & MEM_Subtype) ? pMem->eSubtype : 0);
75305 }
75306 SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_value_text(sqlite3_value *pVal){
75307 return (const unsigned char *)sqlite3ValueText(pVal, SQLITE_UTF8);
75308 }
75309 #ifndef SQLITE_OMIT_UTF16
75310 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16(sqlite3_value* pVal){
75311 return sqlite3ValueText(pVal, SQLITE_UTF16NATIVE);
75312 }
75313 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16be(sqlite3_value *pVal){
75314 return sqlite3ValueText(pVal, SQLITE_UTF16BE);
75315 }
75316 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16le(sqlite3_value *pVal){
75317 return sqlite3ValueText(pVal, SQLITE_UTF16LE);
75318 }
75319 #endif /* SQLITE_OMIT_UTF16 */
75320 /* EVIDENCE-OF: R-12793-43283 Every value in SQLite has one of five
75321 ** fundamental datatypes: 64-bit signed integer 64-bit IEEE floating
75322 ** point number string BLOB NULL
75323 */
75324 SQLITE_API int SQLITE_STDCALL sqlite3_value_type(sqlite3_value* pVal){
75325 static const u8 aType[] = {
75326 SQLITE_BLOB, /* 0x00 */
75327 SQLITE_NULL, /* 0x01 */
75328 SQLITE_TEXT, /* 0x02 */
75329 SQLITE_NULL, /* 0x03 */
@@ -75359,11 +75351,11 @@
75359 return aType[pVal->flags&MEM_AffMask];
75360 }
75361
75362 /* Make a copy of an sqlite3_value object
75363 */
75364 SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_value_dup(const sqlite3_value *pOrig){
75365 sqlite3_value *pNew;
75366 if( pOrig==0 ) return 0;
75367 pNew = sqlite3_malloc( sizeof(*pNew) );
75368 if( pNew==0 ) return 0;
75369 memset(pNew, 0, sizeof(*pNew));
@@ -75382,11 +75374,11 @@
75382 }
75383
75384 /* Destroy an sqlite3_value object previously obtained from
75385 ** sqlite3_value_dup().
75386 */
75387 SQLITE_API void SQLITE_STDCALL sqlite3_value_free(sqlite3_value *pOld){
75388 sqlite3ValueFree(pOld);
75389 }
75390
75391
75392 /**************************** sqlite3_result_ *******************************
@@ -75425,21 +75417,21 @@
75425 xDel((void*)p);
75426 }
75427 if( pCtx ) sqlite3_result_error_toobig(pCtx);
75428 return SQLITE_TOOBIG;
75429 }
75430 SQLITE_API void SQLITE_STDCALL sqlite3_result_blob(
75431 sqlite3_context *pCtx,
75432 const void *z,
75433 int n,
75434 void (*xDel)(void *)
75435 ){
75436 assert( n>=0 );
75437 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75438 setResultStrOrError(pCtx, z, n, 0, xDel);
75439 }
75440 SQLITE_API void SQLITE_STDCALL sqlite3_result_blob64(
75441 sqlite3_context *pCtx,
75442 const void *z,
75443 sqlite3_uint64 n,
75444 void (*xDel)(void *)
75445 ){
@@ -75449,56 +75441,56 @@
75449 (void)invokeValueDestructor(z, xDel, pCtx);
75450 }else{
75451 setResultStrOrError(pCtx, z, (int)n, 0, xDel);
75452 }
75453 }
75454 SQLITE_API void SQLITE_STDCALL sqlite3_result_double(sqlite3_context *pCtx, double rVal){
75455 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75456 sqlite3VdbeMemSetDouble(pCtx->pOut, rVal);
75457 }
75458 SQLITE_API void SQLITE_STDCALL sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){
75459 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75460 pCtx->isError = SQLITE_ERROR;
75461 pCtx->fErrorOrAux = 1;
75462 sqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF8, SQLITE_TRANSIENT);
75463 }
75464 #ifndef SQLITE_OMIT_UTF16
75465 SQLITE_API void SQLITE_STDCALL sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){
75466 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75467 pCtx->isError = SQLITE_ERROR;
75468 pCtx->fErrorOrAux = 1;
75469 sqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF16NATIVE, SQLITE_TRANSIENT);
75470 }
75471 #endif
75472 SQLITE_API void SQLITE_STDCALL sqlite3_result_int(sqlite3_context *pCtx, int iVal){
75473 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75474 sqlite3VdbeMemSetInt64(pCtx->pOut, (i64)iVal);
75475 }
75476 SQLITE_API void SQLITE_STDCALL sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){
75477 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75478 sqlite3VdbeMemSetInt64(pCtx->pOut, iVal);
75479 }
75480 SQLITE_API void SQLITE_STDCALL sqlite3_result_null(sqlite3_context *pCtx){
75481 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75482 sqlite3VdbeMemSetNull(pCtx->pOut);
75483 }
75484 SQLITE_API void SQLITE_STDCALL sqlite3_result_subtype(sqlite3_context *pCtx, unsigned int eSubtype){
75485 Mem *pOut = pCtx->pOut;
75486 assert( sqlite3_mutex_held(pOut->db->mutex) );
75487 pOut->eSubtype = eSubtype & 0xff;
75488 pOut->flags |= MEM_Subtype;
75489 }
75490 SQLITE_API void SQLITE_STDCALL sqlite3_result_text(
75491 sqlite3_context *pCtx,
75492 const char *z,
75493 int n,
75494 void (*xDel)(void *)
75495 ){
75496 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75497 setResultStrOrError(pCtx, z, n, SQLITE_UTF8, xDel);
75498 }
75499 SQLITE_API void SQLITE_STDCALL sqlite3_result_text64(
75500 sqlite3_context *pCtx,
75501 const char *z,
75502 sqlite3_uint64 n,
75503 void (*xDel)(void *),
75504 unsigned char enc
@@ -75511,56 +75503,56 @@
75511 }else{
75512 setResultStrOrError(pCtx, z, (int)n, enc, xDel);
75513 }
75514 }
75515 #ifndef SQLITE_OMIT_UTF16
75516 SQLITE_API void SQLITE_STDCALL sqlite3_result_text16(
75517 sqlite3_context *pCtx,
75518 const void *z,
75519 int n,
75520 void (*xDel)(void *)
75521 ){
75522 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75523 setResultStrOrError(pCtx, z, n, SQLITE_UTF16NATIVE, xDel);
75524 }
75525 SQLITE_API void SQLITE_STDCALL sqlite3_result_text16be(
75526 sqlite3_context *pCtx,
75527 const void *z,
75528 int n,
75529 void (*xDel)(void *)
75530 ){
75531 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75532 setResultStrOrError(pCtx, z, n, SQLITE_UTF16BE, xDel);
75533 }
75534 SQLITE_API void SQLITE_STDCALL sqlite3_result_text16le(
75535 sqlite3_context *pCtx,
75536 const void *z,
75537 int n,
75538 void (*xDel)(void *)
75539 ){
75540 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75541 setResultStrOrError(pCtx, z, n, SQLITE_UTF16LE, xDel);
75542 }
75543 #endif /* SQLITE_OMIT_UTF16 */
75544 SQLITE_API void SQLITE_STDCALL sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){
75545 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75546 sqlite3VdbeMemCopy(pCtx->pOut, pValue);
75547 }
75548 SQLITE_API void SQLITE_STDCALL sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){
75549 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75550 sqlite3VdbeMemSetZeroBlob(pCtx->pOut, n);
75551 }
75552 SQLITE_API int SQLITE_STDCALL sqlite3_result_zeroblob64(sqlite3_context *pCtx, u64 n){
75553 Mem *pOut = pCtx->pOut;
75554 assert( sqlite3_mutex_held(pOut->db->mutex) );
75555 if( n>(u64)pOut->db->aLimit[SQLITE_LIMIT_LENGTH] ){
75556 return SQLITE_TOOBIG;
75557 }
75558 sqlite3VdbeMemSetZeroBlob(pCtx->pOut, (int)n);
75559 return SQLITE_OK;
75560 }
75561 SQLITE_API void SQLITE_STDCALL sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){
75562 pCtx->isError = errCode;
75563 pCtx->fErrorOrAux = 1;
75564 #ifdef SQLITE_DEBUG
75565 if( pCtx->pVdbe ) pCtx->pVdbe->rcApp = errCode;
75566 #endif
@@ -75569,20 +75561,20 @@
75569 SQLITE_UTF8, SQLITE_STATIC);
75570 }
75571 }
75572
75573 /* Force an SQLITE_TOOBIG error. */
75574 SQLITE_API void SQLITE_STDCALL sqlite3_result_error_toobig(sqlite3_context *pCtx){
75575 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75576 pCtx->isError = SQLITE_TOOBIG;
75577 pCtx->fErrorOrAux = 1;
75578 sqlite3VdbeMemSetStr(pCtx->pOut, "string or blob too big", -1,
75579 SQLITE_UTF8, SQLITE_STATIC);
75580 }
75581
75582 /* An SQLITE_NOMEM error. */
75583 SQLITE_API void SQLITE_STDCALL sqlite3_result_error_nomem(sqlite3_context *pCtx){
75584 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75585 sqlite3VdbeMemSetNull(pCtx->pOut);
75586 pCtx->isError = SQLITE_NOMEM_BKPT;
75587 pCtx->fErrorOrAux = 1;
75588 sqlite3OomFault(pCtx->pOut->db);
@@ -75750,11 +75742,11 @@
75750 /*
75751 ** This is the top-level implementation of sqlite3_step(). Call
75752 ** sqlite3Step() to do most of the work. If a schema error occurs,
75753 ** call sqlite3Reprepare() and try again.
75754 */
75755 SQLITE_API int SQLITE_STDCALL sqlite3_step(sqlite3_stmt *pStmt){
75756 int rc = SQLITE_OK; /* Result from sqlite3Step() */
75757 int rc2 = SQLITE_OK; /* Result from sqlite3Reprepare() */
75758 Vdbe *v = (Vdbe*)pStmt; /* the prepared statement */
75759 int cnt = 0; /* Counter to prevent infinite loop of reprepares */
75760 sqlite3 *db; /* The database connection */
@@ -75801,11 +75793,11 @@
75801
75802 /*
75803 ** Extract the user data from a sqlite3_context structure and return a
75804 ** pointer to it.
75805 */
75806 SQLITE_API void *SQLITE_STDCALL sqlite3_user_data(sqlite3_context *p){
75807 assert( p && p->pFunc );
75808 return p->pFunc->pUserData;
75809 }
75810
75811 /*
@@ -75816,11 +75808,11 @@
75816 ** returns a copy of the pointer to the database connection (the 1st
75817 ** parameter) of the sqlite3_create_function() and
75818 ** sqlite3_create_function16() routines that originally registered the
75819 ** application defined function.
75820 */
75821 SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_context *p){
75822 assert( p && p->pOut );
75823 return p->pOut->db;
75824 }
75825
75826 /*
@@ -75892,11 +75884,11 @@
75892 /*
75893 ** Allocate or return the aggregate context for a user function. A new
75894 ** context is allocated on the first call. Subsequent calls return the
75895 ** same context that was returned on prior calls.
75896 */
75897 SQLITE_API void *SQLITE_STDCALL sqlite3_aggregate_context(sqlite3_context *p, int nByte){
75898 assert( p && p->pFunc && p->pFunc->xFinalize );
75899 assert( sqlite3_mutex_held(p->pOut->db->mutex) );
75900 testcase( nByte<0 );
75901 if( (p->pMem->flags & MEM_Agg)==0 ){
75902 return createAggContext(p, nByte);
@@ -75907,11 +75899,11 @@
75907
75908 /*
75909 ** Return the auxiliary data pointer, if any, for the iArg'th argument to
75910 ** the user-function defined by pCtx.
75911 */
75912 SQLITE_API void *SQLITE_STDCALL sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
75913 AuxData *pAuxData;
75914
75915 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75916 #if SQLITE_ENABLE_STAT3_OR_STAT4
75917 if( pCtx->pVdbe==0 ) return 0;
@@ -75928,11 +75920,11 @@
75928 /*
75929 ** Set the auxiliary data pointer and delete function, for the iArg'th
75930 ** argument to the user-function defined by pCtx. Any previous value is
75931 ** deleted by calling the delete function specified when it was set.
75932 */
75933 SQLITE_API void SQLITE_STDCALL sqlite3_set_auxdata(
75934 sqlite3_context *pCtx,
75935 int iArg,
75936 void *pAux,
75937 void (*xDelete)(void*)
75938 ){
@@ -75983,29 +75975,29 @@
75983 ** This function is deprecated. Do not use it for new code. It is
75984 ** provide only to avoid breaking legacy code. New aggregate function
75985 ** implementations should keep their own counts within their aggregate
75986 ** context.
75987 */
75988 SQLITE_API int SQLITE_STDCALL sqlite3_aggregate_count(sqlite3_context *p){
75989 assert( p && p->pMem && p->pFunc && p->pFunc->xFinalize );
75990 return p->pMem->n;
75991 }
75992 #endif
75993
75994 /*
75995 ** Return the number of columns in the result set for the statement pStmt.
75996 */
75997 SQLITE_API int SQLITE_STDCALL sqlite3_column_count(sqlite3_stmt *pStmt){
75998 Vdbe *pVm = (Vdbe *)pStmt;
75999 return pVm ? pVm->nResColumn : 0;
76000 }
76001
76002 /*
76003 ** Return the number of values available from the current row of the
76004 ** currently executing statement pStmt.
76005 */
76006 SQLITE_API int SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt){
76007 Vdbe *pVm = (Vdbe *)pStmt;
76008 if( pVm==0 || pVm->pResultSet==0 ) return 0;
76009 return pVm->nResColumn;
76010 }
76011
@@ -76104,67 +76096,67 @@
76104
76105 /**************************** sqlite3_column_ *******************************
76106 ** The following routines are used to access elements of the current row
76107 ** in the result set.
76108 */
76109 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_blob(sqlite3_stmt *pStmt, int i){
76110 const void *val;
76111 val = sqlite3_value_blob( columnMem(pStmt,i) );
76112 /* Even though there is no encoding conversion, value_blob() might
76113 ** need to call malloc() to expand the result of a zeroblob()
76114 ** expression.
76115 */
76116 columnMallocFailure(pStmt);
76117 return val;
76118 }
76119 SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes(sqlite3_stmt *pStmt, int i){
76120 int val = sqlite3_value_bytes( columnMem(pStmt,i) );
76121 columnMallocFailure(pStmt);
76122 return val;
76123 }
76124 SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes16(sqlite3_stmt *pStmt, int i){
76125 int val = sqlite3_value_bytes16( columnMem(pStmt,i) );
76126 columnMallocFailure(pStmt);
76127 return val;
76128 }
76129 SQLITE_API double SQLITE_STDCALL sqlite3_column_double(sqlite3_stmt *pStmt, int i){
76130 double val = sqlite3_value_double( columnMem(pStmt,i) );
76131 columnMallocFailure(pStmt);
76132 return val;
76133 }
76134 SQLITE_API int SQLITE_STDCALL sqlite3_column_int(sqlite3_stmt *pStmt, int i){
76135 int val = sqlite3_value_int( columnMem(pStmt,i) );
76136 columnMallocFailure(pStmt);
76137 return val;
76138 }
76139 SQLITE_API sqlite_int64 SQLITE_STDCALL sqlite3_column_int64(sqlite3_stmt *pStmt, int i){
76140 sqlite_int64 val = sqlite3_value_int64( columnMem(pStmt,i) );
76141 columnMallocFailure(pStmt);
76142 return val;
76143 }
76144 SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_column_text(sqlite3_stmt *pStmt, int i){
76145 const unsigned char *val = sqlite3_value_text( columnMem(pStmt,i) );
76146 columnMallocFailure(pStmt);
76147 return val;
76148 }
76149 SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_column_value(sqlite3_stmt *pStmt, int i){
76150 Mem *pOut = columnMem(pStmt, i);
76151 if( pOut->flags&MEM_Static ){
76152 pOut->flags &= ~MEM_Static;
76153 pOut->flags |= MEM_Ephem;
76154 }
76155 columnMallocFailure(pStmt);
76156 return (sqlite3_value *)pOut;
76157 }
76158 #ifndef SQLITE_OMIT_UTF16
76159 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_text16(sqlite3_stmt *pStmt, int i){
76160 const void *val = sqlite3_value_text16( columnMem(pStmt,i) );
76161 columnMallocFailure(pStmt);
76162 return val;
76163 }
76164 #endif /* SQLITE_OMIT_UTF16 */
76165 SQLITE_API int SQLITE_STDCALL sqlite3_column_type(sqlite3_stmt *pStmt, int i){
76166 int iType = sqlite3_value_type( columnMem(pStmt,i) );
76167 columnMallocFailure(pStmt);
76168 return iType;
76169 }
76170
@@ -76224,16 +76216,16 @@
76224
76225 /*
76226 ** Return the name of the Nth column of the result set returned by SQL
76227 ** statement pStmt.
76228 */
76229 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_name(sqlite3_stmt *pStmt, int N){
76230 return columnName(
76231 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_NAME);
76232 }
76233 #ifndef SQLITE_OMIT_UTF16
76234 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_name16(sqlite3_stmt *pStmt, int N){
76235 return columnName(
76236 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_NAME);
76237 }
76238 #endif
76239
@@ -76249,16 +76241,16 @@
76249 #ifndef SQLITE_OMIT_DECLTYPE
76250 /*
76251 ** Return the column declaration type (if applicable) of the 'i'th column
76252 ** of the result set of SQL statement pStmt.
76253 */
76254 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){
76255 return columnName(
76256 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DECLTYPE);
76257 }
76258 #ifndef SQLITE_OMIT_UTF16
76259 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){
76260 return columnName(
76261 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DECLTYPE);
76262 }
76263 #endif /* SQLITE_OMIT_UTF16 */
76264 #endif /* SQLITE_OMIT_DECLTYPE */
@@ -76267,16 +76259,16 @@
76267 /*
76268 ** Return the name of the database from which a result column derives.
76269 ** NULL is returned if the result column is an expression or constant or
76270 ** anything else which is not an unambiguous reference to a database column.
76271 */
76272 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_database_name(sqlite3_stmt *pStmt, int N){
76273 return columnName(
76274 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DATABASE);
76275 }
76276 #ifndef SQLITE_OMIT_UTF16
76277 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N){
76278 return columnName(
76279 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DATABASE);
76280 }
76281 #endif /* SQLITE_OMIT_UTF16 */
76282
@@ -76283,16 +76275,16 @@
76283 /*
76284 ** Return the name of the table from which a result column derives.
76285 ** NULL is returned if the result column is an expression or constant or
76286 ** anything else which is not an unambiguous reference to a database column.
76287 */
76288 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_table_name(sqlite3_stmt *pStmt, int N){
76289 return columnName(
76290 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_TABLE);
76291 }
76292 #ifndef SQLITE_OMIT_UTF16
76293 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){
76294 return columnName(
76295 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_TABLE);
76296 }
76297 #endif /* SQLITE_OMIT_UTF16 */
76298
@@ -76299,16 +76291,16 @@
76299 /*
76300 ** Return the name of the table column from which a result column derives.
76301 ** NULL is returned if the result column is an expression or constant or
76302 ** anything else which is not an unambiguous reference to a database column.
76303 */
76304 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N){
76305 return columnName(
76306 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_COLUMN);
76307 }
76308 #ifndef SQLITE_OMIT_UTF16
76309 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){
76310 return columnName(
76311 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_COLUMN);
76312 }
76313 #endif /* SQLITE_OMIT_UTF16 */
76314 #endif /* SQLITE_ENABLE_COLUMN_METADATA */
@@ -76405,11 +76397,11 @@
76405
76406
76407 /*
76408 ** Bind a blob value to an SQL statement variable.
76409 */
76410 SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob(
76411 sqlite3_stmt *pStmt,
76412 int i,
76413 const void *zData,
76414 int nData,
76415 void (*xDel)(void*)
@@ -76417,11 +76409,11 @@
76417 #ifdef SQLITE_ENABLE_API_ARMOR
76418 if( nData<0 ) return SQLITE_MISUSE_BKPT;
76419 #endif
76420 return bindText(pStmt, i, zData, nData, xDel, 0);
76421 }
76422 SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob64(
76423 sqlite3_stmt *pStmt,
76424 int i,
76425 const void *zData,
76426 sqlite3_uint64 nData,
76427 void (*xDel)(void*)
@@ -76431,52 +76423,52 @@
76431 return invokeValueDestructor(zData, xDel, 0);
76432 }else{
76433 return bindText(pStmt, i, zData, (int)nData, xDel, 0);
76434 }
76435 }
76436 SQLITE_API int SQLITE_STDCALL sqlite3_bind_double(sqlite3_stmt *pStmt, int i, double rValue){
76437 int rc;
76438 Vdbe *p = (Vdbe *)pStmt;
76439 rc = vdbeUnbind(p, i);
76440 if( rc==SQLITE_OK ){
76441 sqlite3VdbeMemSetDouble(&p->aVar[i-1], rValue);
76442 sqlite3_mutex_leave(p->db->mutex);
76443 }
76444 return rc;
76445 }
76446 SQLITE_API int SQLITE_STDCALL sqlite3_bind_int(sqlite3_stmt *p, int i, int iValue){
76447 return sqlite3_bind_int64(p, i, (i64)iValue);
76448 }
76449 SQLITE_API int SQLITE_STDCALL sqlite3_bind_int64(sqlite3_stmt *pStmt, int i, sqlite_int64 iValue){
76450 int rc;
76451 Vdbe *p = (Vdbe *)pStmt;
76452 rc = vdbeUnbind(p, i);
76453 if( rc==SQLITE_OK ){
76454 sqlite3VdbeMemSetInt64(&p->aVar[i-1], iValue);
76455 sqlite3_mutex_leave(p->db->mutex);
76456 }
76457 return rc;
76458 }
76459 SQLITE_API int SQLITE_STDCALL sqlite3_bind_null(sqlite3_stmt *pStmt, int i){
76460 int rc;
76461 Vdbe *p = (Vdbe*)pStmt;
76462 rc = vdbeUnbind(p, i);
76463 if( rc==SQLITE_OK ){
76464 sqlite3_mutex_leave(p->db->mutex);
76465 }
76466 return rc;
76467 }
76468 SQLITE_API int SQLITE_STDCALL sqlite3_bind_text(
76469 sqlite3_stmt *pStmt,
76470 int i,
76471 const char *zData,
76472 int nData,
76473 void (*xDel)(void*)
76474 ){
76475 return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF8);
76476 }
76477 SQLITE_API int SQLITE_STDCALL sqlite3_bind_text64(
76478 sqlite3_stmt *pStmt,
76479 int i,
76480 const char *zData,
76481 sqlite3_uint64 nData,
76482 void (*xDel)(void*),
@@ -76489,21 +76481,21 @@
76489 if( enc==SQLITE_UTF16 ) enc = SQLITE_UTF16NATIVE;
76490 return bindText(pStmt, i, zData, (int)nData, xDel, enc);
76491 }
76492 }
76493 #ifndef SQLITE_OMIT_UTF16
76494 SQLITE_API int SQLITE_STDCALL sqlite3_bind_text16(
76495 sqlite3_stmt *pStmt,
76496 int i,
76497 const void *zData,
76498 int nData,
76499 void (*xDel)(void*)
76500 ){
76501 return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF16NATIVE);
76502 }
76503 #endif /* SQLITE_OMIT_UTF16 */
76504 SQLITE_API int SQLITE_STDCALL sqlite3_bind_value(sqlite3_stmt *pStmt, int i, const sqlite3_value *pValue){
76505 int rc;
76506 switch( sqlite3_value_type((sqlite3_value*)pValue) ){
76507 case SQLITE_INTEGER: {
76508 rc = sqlite3_bind_int64(pStmt, i, pValue->u.i);
76509 break;
@@ -76530,21 +76522,21 @@
76530 break;
76531 }
76532 }
76533 return rc;
76534 }
76535 SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){
76536 int rc;
76537 Vdbe *p = (Vdbe *)pStmt;
76538 rc = vdbeUnbind(p, i);
76539 if( rc==SQLITE_OK ){
76540 sqlite3VdbeMemSetZeroBlob(&p->aVar[i-1], n);
76541 sqlite3_mutex_leave(p->db->mutex);
76542 }
76543 return rc;
76544 }
76545 SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob64(sqlite3_stmt *pStmt, int i, sqlite3_uint64 n){
76546 int rc;
76547 Vdbe *p = (Vdbe *)pStmt;
76548 sqlite3_mutex_enter(p->db->mutex);
76549 if( n>(u64)p->db->aLimit[SQLITE_LIMIT_LENGTH] ){
76550 rc = SQLITE_TOOBIG;
@@ -76559,11 +76551,11 @@
76559
76560 /*
76561 ** Return the number of wildcards that can be potentially bound to.
76562 ** This routine is added to support DBD::SQLite.
76563 */
76564 SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){
76565 Vdbe *p = (Vdbe*)pStmt;
76566 return p ? p->nVar : 0;
76567 }
76568
76569 /*
@@ -76570,11 +76562,11 @@
76570 ** Return the name of a wildcard parameter. Return NULL if the index
76571 ** is out of range or if the wildcard is unnamed.
76572 **
76573 ** The result is always UTF-8.
76574 */
76575 SQLITE_API const char *SQLITE_STDCALL sqlite3_bind_parameter_name(sqlite3_stmt *pStmt, int i){
76576 Vdbe *p = (Vdbe*)pStmt;
76577 if( p==0 || i<1 || i>p->nzVar ){
76578 return 0;
76579 }
76580 return p->azVar[i-1];
@@ -76598,11 +76590,11 @@
76598 }
76599 }
76600 }
76601 return 0;
76602 }
76603 SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const char *zName){
76604 return sqlite3VdbeParameterIndex((Vdbe*)pStmt, zName, sqlite3Strlen30(zName));
76605 }
76606
76607 /*
76608 ** Transfer all bindings from the first statement over to the second.
@@ -76632,11 +76624,11 @@
76632 **
76633 ** If the two statements contain a different number of bindings, then
76634 ** an SQLITE_ERROR is returned. Nothing else can go wrong, so otherwise
76635 ** SQLITE_OK is returned.
76636 */
76637 SQLITE_API int SQLITE_STDCALL sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){
76638 Vdbe *pFrom = (Vdbe*)pFromStmt;
76639 Vdbe *pTo = (Vdbe*)pToStmt;
76640 if( pFrom->nVar!=pTo->nVar ){
76641 return SQLITE_ERROR;
76642 }
@@ -76654,26 +76646,26 @@
76654 ** Return the sqlite3* database handle to which the prepared statement given
76655 ** in the argument belongs. This is the same database handle that was
76656 ** the first argument to the sqlite3_prepare() that was used to create
76657 ** the statement in the first place.
76658 */
76659 SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_db_handle(sqlite3_stmt *pStmt){
76660 return pStmt ? ((Vdbe*)pStmt)->db : 0;
76661 }
76662
76663 /*
76664 ** Return true if the prepared statement is guaranteed to not modify the
76665 ** database.
76666 */
76667 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_readonly(sqlite3_stmt *pStmt){
76668 return pStmt ? ((Vdbe*)pStmt)->readOnly : 1;
76669 }
76670
76671 /*
76672 ** Return true if the prepared statement is in need of being reset.
76673 */
76674 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_busy(sqlite3_stmt *pStmt){
76675 Vdbe *v = (Vdbe*)pStmt;
76676 return v!=0 && v->pc>=0 && v->magic==VDBE_MAGIC_RUN;
76677 }
76678
76679 /*
@@ -76680,11 +76672,11 @@
76680 ** Return a pointer to the next prepared statement after pStmt associated
76681 ** with database connection pDb. If pStmt is NULL, return the first
76682 ** prepared statement for the database connection. Return NULL if there
76683 ** are no more.
76684 */
76685 SQLITE_API sqlite3_stmt *SQLITE_STDCALL sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt){
76686 sqlite3_stmt *pNext;
76687 #ifdef SQLITE_ENABLE_API_ARMOR
76688 if( !sqlite3SafetyCheckOk(pDb) ){
76689 (void)SQLITE_MISUSE_BKPT;
76690 return 0;
@@ -76701,11 +76693,11 @@
76701 }
76702
76703 /*
76704 ** Return the value of a status counter for a prepared statement
76705 */
76706 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){
76707 Vdbe *pVdbe = (Vdbe*)pStmt;
76708 u32 v;
76709 #ifdef SQLITE_ENABLE_API_ARMOR
76710 if( !pStmt ){
76711 (void)SQLITE_MISUSE_BKPT;
@@ -76718,11 +76710,11 @@
76718 }
76719
76720 /*
76721 ** Return the SQL associated with a prepared statement
76722 */
76723 SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt){
76724 Vdbe *p = (Vdbe *)pStmt;
76725 return p ? p->zSql : 0;
76726 }
76727
76728 /*
@@ -76732,11 +76724,11 @@
76732 ** freeing the returned string by passing it to sqlite3_free().
76733 **
76734 ** The SQLITE_TRACE_SIZE_LIMIT puts an upper bound on the size of
76735 ** expanded bound parameters.
76736 */
76737 SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt){
76738 #ifdef SQLITE_OMIT_TRACE
76739 return 0;
76740 #else
76741 char *z = 0;
76742 const char *zSql = sqlite3_sql(pStmt);
@@ -76774,11 +76766,11 @@
76774
76775 /*
76776 ** This function is called from within a pre-update callback to retrieve
76777 ** a field of the row currently being updated or deleted.
76778 */
76779 SQLITE_API int SQLITE_STDCALL sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppValue){
76780 PreUpdate *p = db->pPreUpdate;
76781 int rc = SQLITE_OK;
76782
76783 /* Test that this call is being made from within an SQLITE_DELETE or
76784 ** SQLITE_UPDATE pre-update callback, and that iIdx is within range. */
@@ -76829,11 +76821,11 @@
76829 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
76830 /*
76831 ** This function is called from within a pre-update callback to retrieve
76832 ** the number of columns in the row being updated, deleted or inserted.
76833 */
76834 SQLITE_API int SQLITE_STDCALL sqlite3_preupdate_count(sqlite3 *db){
76835 PreUpdate *p = db->pPreUpdate;
76836 return (p ? p->keyinfo.nField : 0);
76837 }
76838 #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
76839
@@ -76847,11 +76839,11 @@
76847 ** top-level trigger etc.).
76848 **
76849 ** For the purposes of the previous paragraph, a foreign key CASCADE, SET NULL
76850 ** or SET DEFAULT action is considered a trigger.
76851 */
76852 SQLITE_API int SQLITE_STDCALL sqlite3_preupdate_depth(sqlite3 *db){
76853 PreUpdate *p = db->pPreUpdate;
76854 return (p ? p->v->nFrame : 0);
76855 }
76856 #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
76857
@@ -76858,11 +76850,11 @@
76858 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
76859 /*
76860 ** This function is called from within a pre-update callback to retrieve
76861 ** a field of the row currently being updated or inserted.
76862 */
76863 SQLITE_API int SQLITE_STDCALL sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppValue){
76864 PreUpdate *p = db->pPreUpdate;
76865 int rc = SQLITE_OK;
76866 Mem *pMem;
76867
76868 if( !p || p->op==SQLITE_DELETE ){
@@ -76878,11 +76870,11 @@
76878 /* For an INSERT, memory cell p->iNewReg contains the serialized record
76879 ** that is being inserted. Deserialize it. */
76880 UnpackedRecord *pUnpack = p->pNewUnpacked;
76881 if( !pUnpack ){
76882 Mem *pData = &p->v->aMem[p->iNewReg];
76883 rc = sqlite3VdbeMemExpandBlob(pData);
76884 if( rc!=SQLITE_OK ) goto preupdate_new_out;
76885 pUnpack = vdbeUnpackRecord(&p->keyinfo, pData->n, pData->z);
76886 if( !pUnpack ){
76887 rc = SQLITE_NOMEM;
76888 goto preupdate_new_out;
@@ -76932,11 +76924,11 @@
76932
76933 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
76934 /*
76935 ** Return status data for a single loop within query pStmt.
76936 */
76937 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_scanstatus(
76938 sqlite3_stmt *pStmt, /* Prepared statement being queried */
76939 int idx, /* Index of loop to report on */
76940 int iScanStatusOp, /* Which metric to return */
76941 void *pOut /* OUT: Write the answer here */
76942 ){
@@ -76991,11 +76983,11 @@
76991 }
76992
76993 /*
76994 ** Zero all counters associated with the sqlite3_stmt_scanstatus() data.
76995 */
76996 SQLITE_API void SQLITE_STDCALL sqlite3_stmt_scanstatus_reset(sqlite3_stmt *pStmt){
76997 Vdbe *p = (Vdbe*)pStmt;
76998 memset(p->anExec, 0, p->nOp * sizeof(i64));
76999 }
77000 #endif /* SQLITE_ENABLE_STMT_SCANSTATUS */
77001
@@ -77518,11 +77510,11 @@
77518 ** Try to convert the type of a function argument or a result column
77519 ** into a numeric representation. Use either INTEGER or REAL whichever
77520 ** is appropriate. But only do the conversion if it is possible without
77521 ** loss of information and return the revised type of the argument.
77522 */
77523 SQLITE_API int SQLITE_STDCALL sqlite3_value_numeric_type(sqlite3_value *pVal){
77524 int eType = sqlite3_value_type(pVal);
77525 if( eType==SQLITE_TEXT ){
77526 Mem *pMem = (Mem*)pVal;
77527 applyNumericAffinity(pMem, 0);
77528 eType = sqlite3_value_type(pVal);
@@ -79344,12 +79336,11 @@
79344 testcase( pIn1->flags & MEM_Int );
79345 testcase( pIn1->flags & MEM_Real );
79346 sqlite3VdbeMemStringify(pIn1, encoding, 1);
79347 testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) );
79348 flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask);
79349 testcase( flags3!=pIn3->flags ); /* Possible if pIn1==pIn3 */
79350 flags3 = pIn3->flags;
79351 }
79352 if( (flags3 & MEM_Str)==0 && (flags3 & (MEM_Int|MEM_Real))!=0 ){
79353 testcase( pIn3->flags & MEM_Int );
79354 testcase( pIn3->flags & MEM_Real );
79355 sqlite3VdbeMemStringify(pIn3, encoding, 1);
@@ -79409,15 +79400,15 @@
79409 break;
79410 }
79411
79412 /* Opcode: ElseNotEq * P2 * * *
79413 **
79414 ** This opcode must immediately follow an Lt or Gt comparison operator.
79415 ** If the operands in that previous comparison had been used with an Eq
79416 ** operator and if the result of that Eq would be NULL or false (0), then
79417 ** then jump to P2. If the result of comparing the two previous operands
79418 ** using Eq would have been true (1), then fall through.
79419 */
79420 case OP_ElseNotEq: { /* same as TK_ESCAPE, jump */
79421 assert( pOp>aOp );
79422 assert( pOp[-1].opcode==OP_Lt || pOp[-1].opcode==OP_Gt );
79423 assert( pOp[-1].p5 & SQLITE_STOREP2 );
@@ -79620,26 +79611,22 @@
79620 break;
79621 }
79622
79623 /* Opcode: Once P1 P2 * * *
79624 **
79625 ** Check the "once" flag number P1. If it is set, jump to instruction P2.
79626 ** Otherwise, set the flag and fall through to the next instruction.
79627 ** In other words, this opcode causes all following opcodes up through P2
79628 ** (but not including P2) to run just once and to be skipped on subsequent
79629 ** times through the loop.
79630 **
79631 ** All "once" flags are initially cleared whenever a prepared statement
79632 ** first begins to run.
79633 */
79634 case OP_Once: { /* jump */
79635 assert( pOp->p1<p->nOnceFlag );
79636 VdbeBranchTaken(p->aOnceFlag[pOp->p1]!=0, 2);
79637 if( p->aOnceFlag[pOp->p1] ){
79638 goto jump_to_p2;
79639 }else{
79640 p->aOnceFlag[pOp->p1] = 1;
79641 }
79642 break;
79643 }
79644
79645 /* Opcode: If P1 P2 P3 * *
@@ -80468,16 +80455,16 @@
80468
80469 if( pBt ){
80470 rc = sqlite3BtreeBeginTrans(pBt, pOp->p2);
80471 testcase( rc==SQLITE_BUSY_SNAPSHOT );
80472 testcase( rc==SQLITE_BUSY_RECOVERY );
80473 if( (rc&0xff)==SQLITE_BUSY ){
80474 p->pc = (int)(pOp - aOp);
80475 p->rc = rc;
80476 goto vdbe_return;
80477 }
80478 if( rc!=SQLITE_OK ){
 
 
 
 
 
80479 goto abort_due_to_error;
80480 }
80481
80482 if( pOp->p2 && p->usesStmtJournal
80483 && (db->autoCommit==0 || db->nVdbeRead>1)
@@ -81164,11 +81151,10 @@
81164
81165 r.aMem = &aMem[pOp->p3];
81166 #ifdef SQLITE_DEBUG
81167 { int i; for(i=0; i<r.nField; i++) assert( memIsValid(&r.aMem[i]) ); }
81168 #endif
81169 (void)ExpandBlob(r.aMem);
81170 r.eqSeen = 0;
81171 rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, &r, 0, 0, &res);
81172 if( rc!=SQLITE_OK ){
81173 goto abort_due_to_error;
81174 }
@@ -81305,17 +81291,17 @@
81305 pFree = 0;
81306 if( pOp->p4.i>0 ){
81307 r.pKeyInfo = pC->pKeyInfo;
81308 r.nField = (u16)pOp->p4.i;
81309 r.aMem = pIn3;
 
81310 for(ii=0; ii<r.nField; ii++){
81311 assert( memIsValid(&r.aMem[ii]) );
81312 (void)ExpandBlob(&r.aMem[ii]);
81313 #ifdef SQLITE_DEBUG
81314 if( ii ) REGISTER_TRACE(pOp->p3+ii, &r.aMem[ii]);
 
81315 #endif
81316 }
81317 pIdxKey = &r;
81318 }else{
81319 pIdxKey = sqlite3VdbeAllocUnpackedRecord(
81320 pC->pKeyInfo, aTempRec, sizeof(aTempRec), &pFree
81321 );
@@ -83078,12 +83064,11 @@
83078 nMem = pProgram->nMem + pProgram->nCsr;
83079 assert( nMem>0 );
83080 if( pProgram->nCsr==0 ) nMem++;
83081 nByte = ROUND8(sizeof(VdbeFrame))
83082 + nMem * sizeof(Mem)
83083 + pProgram->nCsr * sizeof(VdbeCursor *)
83084 + pProgram->nOnce * sizeof(u8);
83085 pFrame = sqlite3DbMallocZero(db, nByte);
83086 if( !pFrame ){
83087 goto no_mem;
83088 }
83089 sqlite3VdbeMemRelease(pRt);
@@ -83099,12 +83084,10 @@
83099 pFrame->apCsr = p->apCsr;
83100 pFrame->nCursor = p->nCursor;
83101 pFrame->aOp = p->aOp;
83102 pFrame->nOp = p->nOp;
83103 pFrame->token = pProgram->token;
83104 pFrame->aOnceFlag = p->aOnceFlag;
83105 pFrame->nOnceFlag = p->nOnceFlag;
83106 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
83107 pFrame->anExec = p->anExec;
83108 #endif
83109
83110 pEnd = &VdbeFrameMem(pFrame)[pFrame->nChildMem];
@@ -83134,17 +83117,14 @@
83134 p->nMem = pFrame->nChildMem;
83135 p->nCursor = (u16)pFrame->nChildCsr;
83136 p->apCsr = (VdbeCursor **)&aMem[p->nMem];
83137 p->aOp = aOp = pProgram->aOp;
83138 p->nOp = pProgram->nOp;
83139 p->aOnceFlag = (u8 *)&p->apCsr[p->nCursor];
83140 p->nOnceFlag = pProgram->nOnce;
83141 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
83142 p->anExec = 0;
83143 #endif
83144 pOp = &aOp[-1];
83145 memset(p->aOnceFlag, 0, p->nOnceFlag);
83146
83147 break;
83148 }
83149
83150 /* Opcode: Param P1 P2 * * *
@@ -84107,11 +84087,11 @@
84107 break;
84108 }
84109 #endif
84110
84111
84112 /* Opcode: Init * P2 * P4 *
84113 ** Synopsis: Start at P2
84114 **
84115 ** Programs contain a single instance of this opcode as the very first
84116 ** opcode.
84117 **
@@ -84118,13 +84098,17 @@
84118 ** If tracing is enabled (by the sqlite3_trace()) interface, then
84119 ** the UTF-8 string contained in P4 is emitted on the trace callback.
84120 ** Or if P4 is blank, use the string returned by sqlite3_sql().
84121 **
84122 ** If P2 is not zero, jump to instruction P2.
 
 
 
84123 */
84124 case OP_Init: { /* jump */
84125 char *zTrace;
 
84126
84127 /* If the P4 argument is not NULL, then it must be an SQL comment string.
84128 ** The "--" string is broken up to prevent false-positives with srcck1.c.
84129 **
84130 ** This assert() provides evidence for:
@@ -84132,10 +84116,11 @@
84132 ** would have been returned by the legacy sqlite3_trace() interface by
84133 ** using the X argument when X begins with "--" and invoking
84134 ** sqlite3_expanded_sql(P) otherwise.
84135 */
84136 assert( pOp->p4.z==0 || strncmp(pOp->p4.z, "-" "- ", 3)==0 );
 
84137
84138 #ifndef SQLITE_OMIT_TRACE
84139 if( (db->mTrace & (SQLITE_TRACE_STMT|SQLITE_TRACE_LEGACY))!=0
84140 && !p->doingRerun
84141 && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0
@@ -84153,14 +84138,14 @@
84153 }
84154 }
84155 #ifdef SQLITE_USE_FCNTL_TRACE
84156 zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql);
84157 if( zTrace ){
84158 int i;
84159 for(i=0; i<db->nDb; i++){
84160 if( DbMaskTest(p->btreeMask, i)==0 ) continue;
84161 sqlite3_file_control(db, db->aDb[i].zDbSName, SQLITE_FCNTL_TRACE, zTrace);
84162 }
84163 }
84164 #endif /* SQLITE_USE_FCNTL_TRACE */
84165 #ifdef SQLITE_DEBUG
84166 if( (db->flags & SQLITE_SqlTrace)!=0
@@ -84169,10 +84154,17 @@
84169 sqlite3DebugPrintf("SQL-trace: %s\n", zTrace);
84170 }
84171 #endif /* SQLITE_DEBUG */
84172 #endif /* SQLITE_OMIT_TRACE */
84173 assert( pOp->p2>0 );
 
 
 
 
 
 
 
84174 goto jump_to_p2;
84175 }
84176
84177 #ifdef SQLITE_ENABLE_CURSOR_HINTS
84178 /* Opcode: CursorHint P1 * * P4 *
@@ -84422,11 +84414,11 @@
84422 }
84423
84424 /*
84425 ** Open a blob handle.
84426 */
84427 SQLITE_API int SQLITE_STDCALL sqlite3_blob_open(
84428 sqlite3* db, /* The database connection */
84429 const char *zDb, /* The attached database containing the blob */
84430 const char *zTable, /* The table containing the blob */
84431 const char *zColumn, /* The column containing the blob */
84432 sqlite_int64 iRow, /* The row containing the glob */
@@ -84663,11 +84655,11 @@
84663
84664 /*
84665 ** Close a blob handle that was previously created using
84666 ** sqlite3_blob_open().
84667 */
84668 SQLITE_API int SQLITE_STDCALL sqlite3_blob_close(sqlite3_blob *pBlob){
84669 Incrblob *p = (Incrblob *)pBlob;
84670 int rc;
84671 sqlite3 *db;
84672
84673 if( p ){
@@ -84756,28 +84748,28 @@
84756 }
84757
84758 /*
84759 ** Read data from a blob handle.
84760 */
84761 SQLITE_API int SQLITE_STDCALL sqlite3_blob_read(sqlite3_blob *pBlob, void *z, int n, int iOffset){
84762 return blobReadWrite(pBlob, z, n, iOffset, sqlite3BtreeData);
84763 }
84764
84765 /*
84766 ** Write data to a blob handle.
84767 */
84768 SQLITE_API int SQLITE_STDCALL sqlite3_blob_write(sqlite3_blob *pBlob, const void *z, int n, int iOffset){
84769 return blobReadWrite(pBlob, (void *)z, n, iOffset, sqlite3BtreePutData);
84770 }
84771
84772 /*
84773 ** Query a blob handle for the size of the data.
84774 **
84775 ** The Incrblob.nByte field is fixed for the lifetime of the Incrblob
84776 ** so no mutex is required for access.
84777 */
84778 SQLITE_API int SQLITE_STDCALL sqlite3_blob_bytes(sqlite3_blob *pBlob){
84779 Incrblob *p = (Incrblob *)pBlob;
84780 return (p && p->pStmt) ? p->nByte : 0;
84781 }
84782
84783 /*
@@ -84788,11 +84780,11 @@
84788 ** contain a blob or text value, then an error code is returned and the
84789 ** database handle error code and message set. If this happens, then all
84790 ** subsequent calls to sqlite3_blob_xxx() functions (except blob_close())
84791 ** immediately return SQLITE_ABORT.
84792 */
84793 SQLITE_API int SQLITE_STDCALL sqlite3_blob_reopen(sqlite3_blob *pBlob, sqlite3_int64 iRow){
84794 int rc;
84795 Incrblob *p = (Incrblob *)pBlob;
84796 sqlite3 *db;
84797
84798 if( p==0 ) return SQLITE_MISUSE_BKPT;
@@ -88049,11 +88041,11 @@
88049 if( rc || ExprHasProperty(pExpr,EP_TokenOnly) ) return rc & WRC_Abort;
88050 if( pExpr->pLeft && walkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;
88051 if( pExpr->pRight && walkExpr(pWalker, pExpr->pRight) ) return WRC_Abort;
88052 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
88053 if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;
88054 }else{
88055 if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
88056 }
88057 return WRC_Continue;
88058 }
88059 SQLITE_PRIVATE int sqlite3WalkExpr(Walker *pWalker, Expr *pExpr){
@@ -88811,11 +88803,10 @@
88811 ExprList *pList = pExpr->x.pList; /* The argument list */
88812 int n = pList ? pList->nExpr : 0; /* Number of arguments */
88813 int no_such_func = 0; /* True if no such function exists */
88814 int wrong_num_args = 0; /* True if wrong number of arguments */
88815 int is_agg = 0; /* True if is an aggregate function */
88816 int auth; /* Authorization to use the function */
88817 int nId; /* Number of characters in function name */
88818 const char *zId; /* The function name. */
88819 FuncDef *pDef; /* Information about the function */
88820 u8 enc = ENC(pParse->db); /* The database encoding */
88821
@@ -88855,19 +88846,21 @@
88855 /* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */
88856 pExpr->iTable = pDef->zName[0]=='u' ? 8388608 : 125829120;
88857 }
88858 }
88859 #ifndef SQLITE_OMIT_AUTHORIZATION
88860 auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0, pDef->zName, 0);
88861 if( auth!=SQLITE_OK ){
88862 if( auth==SQLITE_DENY ){
88863 sqlite3ErrorMsg(pParse, "not authorized to use function: %s",
88864 pDef->zName);
88865 pNC->nErr++;
88866 }
88867 pExpr->op = TK_NULL;
88868 return WRC_Prune;
 
 
88869 }
88870 #endif
88871 if( pDef->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG) ){
88872 /* For the purposes of the EP_ConstFunc flag, date and time
88873 ** functions and other functions that change slowly are considered
@@ -91664,19 +91657,10 @@
91664 }
91665 return p;
91666 }
91667 #endif /* SQLITE_OMIT_SUBQUERY */
91668
91669 /*
91670 ** Code an OP_Once instruction and allocate space for its flag. Return the
91671 ** address of the new instruction.
91672 */
91673 SQLITE_PRIVATE int sqlite3CodeOnce(Parse *pParse){
91674 Vdbe *v = sqlite3GetVdbe(pParse); /* Virtual machine being coded */
91675 return sqlite3VdbeAddOp1(v, OP_Once, pParse->nOnce++);
91676 }
91677
91678 #ifndef SQLITE_OMIT_SUBQUERY
91679 /*
91680 ** Generate code that checks the left-most column of index table iCur to see if
91681 ** it contains any NULL entries. Cause the register at regHasNull to be set
91682 ** to a non-NULL value if iCur contains no NULLs. Cause register regHasNull
@@ -91846,11 +91830,11 @@
91846 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
91847
91848 assert(v); /* sqlite3GetVdbe() has always been previously called */
91849 if( nExpr==1 && pEList->a[0].pExpr->iColumn<0 ){
91850 /* The "x IN (SELECT rowid FROM table)" case */
91851 int iAddr = sqlite3CodeOnce(pParse);
91852 VdbeCoverage(v);
91853
91854 sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);
91855 eType = IN_INDEX_ROWID;
91856
@@ -91929,11 +91913,11 @@
91929 }
91930
91931 assert( i==nExpr || colUsed!=(MASKBIT(nExpr)-1) );
91932 if( colUsed==(MASKBIT(nExpr)-1) ){
91933 /* If we reach this point, that means the index pIdx is usable */
91934 int iAddr = sqlite3CodeOnce(pParse); VdbeCoverage(v);
91935 #ifndef SQLITE_OMIT_EXPLAIN
91936 sqlite3VdbeAddOp4(v, OP_Explain, 0, 0, 0,
91937 sqlite3MPrintf(db, "USING INDEX %s FOR IN-OPERATOR",pIdx->zName),
91938 P4_DYNAMIC);
91939 #endif
@@ -92104,11 +92088,11 @@
92104 **
92105 ** If all of the above are false, then we can run this code just once
92106 ** save the results, and reuse the same result on subsequent invocations.
92107 */
92108 if( !ExprHasProperty(pExpr, EP_VarSelect) ){
92109 jmpIfDynamic = sqlite3CodeOnce(pParse); VdbeCoverage(v);
92110 }
92111
92112 #ifndef SQLITE_OMIT_EXPLAIN
92113 if( pParse->explain==2 ){
92114 char *zMsg = sqlite3MPrintf(pParse->db, "EXECUTE %s%s SUBQUERY %d",
@@ -93044,11 +93028,10 @@
93044 int op; /* The opcode being coded */
93045 int inReg = target; /* Results stored in register inReg */
93046 int regFree1 = 0; /* If non-zero free this temporary register */
93047 int regFree2 = 0; /* If non-zero free this temporary register */
93048 int r1, r2; /* Various register numbers */
93049 sqlite3 *db = pParse->db; /* The database connection */
93050 Expr tempX; /* Temporary expression node */
93051 int p5 = 0;
93052
93053 assert( target>0 && target<=pParse->nMem );
93054 if( v==0 ){
@@ -93065,56 +93048,53 @@
93065 case TK_AGG_COLUMN: {
93066 AggInfo *pAggInfo = pExpr->pAggInfo;
93067 struct AggInfo_col *pCol = &pAggInfo->aCol[pExpr->iAgg];
93068 if( !pAggInfo->directMode ){
93069 assert( pCol->iMem>0 );
93070 inReg = pCol->iMem;
93071 break;
93072 }else if( pAggInfo->useSortingIdx ){
93073 sqlite3VdbeAddOp3(v, OP_Column, pAggInfo->sortingIdxPTab,
93074 pCol->iSorterColumn, target);
93075 break;
93076 }
93077 /* Otherwise, fall thru into the TK_COLUMN case */
93078 }
93079 case TK_COLUMN: {
93080 int iTab = pExpr->iTable;
93081 if( iTab<0 ){
93082 if( pParse->ckBase>0 ){
93083 /* Generating CHECK constraints or inserting into partial index */
93084 inReg = pExpr->iColumn + pParse->ckBase;
93085 break;
93086 }else{
93087 /* Coding an expression that is part of an index where column names
93088 ** in the index refer to the table to which the index belongs */
93089 iTab = pParse->iSelfTab;
93090 }
93091 }
93092 inReg = sqlite3ExprCodeGetColumn(pParse, pExpr->pTab,
93093 pExpr->iColumn, iTab, target,
93094 pExpr->op2);
93095 break;
93096 }
93097 case TK_INTEGER: {
93098 codeInteger(pParse, pExpr, 0, target);
93099 break;
93100 }
93101 #ifndef SQLITE_OMIT_FLOATING_POINT
93102 case TK_FLOAT: {
93103 assert( !ExprHasProperty(pExpr, EP_IntValue) );
93104 codeReal(v, pExpr->u.zToken, 0, target);
93105 break;
93106 }
93107 #endif
93108 case TK_STRING: {
93109 assert( !ExprHasProperty(pExpr, EP_IntValue) );
93110 sqlite3VdbeLoadString(v, target, pExpr->u.zToken);
93111 break;
93112 }
93113 case TK_NULL: {
93114 sqlite3VdbeAddOp2(v, OP_Null, 0, target);
93115 break;
93116 }
93117 #ifndef SQLITE_OMIT_BLOB_LITERAL
93118 case TK_BLOB: {
93119 int n;
93120 const char *z;
@@ -93125,11 +93105,11 @@
93125 z = &pExpr->u.zToken[2];
93126 n = sqlite3Strlen30(z) - 1;
93127 assert( z[n]=='\'' );
93128 zBlob = sqlite3HexToBlob(sqlite3VdbeDb(v), z, n);
93129 sqlite3VdbeAddOp4(v, OP_Blob, n/2, target, 0, zBlob, P4_DYNAMIC);
93130 break;
93131 }
93132 #endif
93133 case TK_VARIABLE: {
93134 assert( !ExprHasProperty(pExpr, EP_IntValue) );
93135 assert( pExpr->u.zToken!=0 );
@@ -93138,15 +93118,14 @@
93138 if( pExpr->u.zToken[1]!=0 ){
93139 assert( pExpr->u.zToken[0]=='?'
93140 || strcmp(pExpr->u.zToken, pParse->azVar[pExpr->iColumn-1])==0 );
93141 sqlite3VdbeChangeP4(v, -1, pParse->azVar[pExpr->iColumn-1], P4_STATIC);
93142 }
93143 break;
93144 }
93145 case TK_REGISTER: {
93146 inReg = pExpr->iTable;
93147 break;
93148 }
93149 #ifndef SQLITE_OMIT_CAST
93150 case TK_CAST: {
93151 /* Expressions of the form: CAST(pLeft AS token) */
93152 inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
@@ -93156,11 +93135,11 @@
93156 }
93157 sqlite3VdbeAddOp2(v, OP_Cast, target,
93158 sqlite3AffinityType(pExpr->u.zToken, 0));
93159 testcase( usedAsColumnCache(pParse, inReg, inReg) );
93160 sqlite3ExprCacheAffinityChange(pParse, inReg, 1);
93161 break;
93162 }
93163 #endif /* SQLITE_OMIT_CAST */
93164 case TK_IS:
93165 case TK_ISNOT:
93166 op = (op==TK_IS) ? TK_EQ : TK_NE;
@@ -93224,14 +93203,16 @@
93224 case TK_UMINUS: {
93225 Expr *pLeft = pExpr->pLeft;
93226 assert( pLeft );
93227 if( pLeft->op==TK_INTEGER ){
93228 codeInteger(pParse, pLeft, 1, target);
 
93229 #ifndef SQLITE_OMIT_FLOATING_POINT
93230 }else if( pLeft->op==TK_FLOAT ){
93231 assert( !ExprHasProperty(pExpr, EP_IntValue) );
93232 codeReal(v, pLeft->u.zToken, 1, target);
 
93233 #endif
93234 }else{
93235 tempX.op = TK_INTEGER;
93236 tempX.flags = EP_IntValue|EP_TokenOnly;
93237 tempX.u.iValue = 0;
@@ -93238,20 +93219,18 @@
93238 r1 = sqlite3ExprCodeTemp(pParse, &tempX, &regFree1);
93239 r2 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree2);
93240 sqlite3VdbeAddOp3(v, OP_Subtract, r2, r1, target);
93241 testcase( regFree2==0 );
93242 }
93243 inReg = target;
93244 break;
93245 }
93246 case TK_BITNOT:
93247 case TK_NOT: {
93248 assert( TK_BITNOT==OP_BitNot ); testcase( op==TK_BITNOT );
93249 assert( TK_NOT==OP_Not ); testcase( op==TK_NOT );
93250 r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
93251 testcase( regFree1==0 );
93252 inReg = target;
93253 sqlite3VdbeAddOp2(v, op, r1, inReg);
93254 break;
93255 }
93256 case TK_ISNULL:
93257 case TK_NOTNULL: {
@@ -93272,11 +93251,11 @@
93272 AggInfo *pInfo = pExpr->pAggInfo;
93273 if( pInfo==0 ){
93274 assert( !ExprHasProperty(pExpr, EP_IntValue) );
93275 sqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken);
93276 }else{
93277 inReg = pInfo->aFunc[pExpr->iAgg].iMem;
93278 }
93279 break;
93280 }
93281 case TK_FUNCTION: {
93282 ExprList *pFarg; /* List of function arguments */
@@ -93283,10 +93262,11 @@
93283 int nFarg; /* Number of function arguments */
93284 FuncDef *pDef; /* The function definition object */
93285 const char *zId; /* The function name */
93286 u32 constMask = 0; /* Mask of function arguments that are constant */
93287 int i; /* Loop counter */
 
93288 u8 enc = ENC(db); /* The text encoding used by this database */
93289 CollSeq *pColl = 0; /* A collating sequence */
93290
93291 assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
93292 if( ExprHasProperty(pExpr, EP_TokenOnly) ){
@@ -93331,12 +93311,11 @@
93331 /* The UNLIKELY() function is a no-op. The result is the value
93332 ** of the first argument.
93333 */
93334 if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){
93335 assert( nFarg>=1 );
93336 inReg = sqlite3ExprCodeTarget(pParse, pFarg->a[0].pExpr, target);
93337 break;
93338 }
93339
93340 for(i=0; i<nFarg; i++){
93341 if( i<32 && sqlite3ExprIsConstant(pFarg->a[i].pExpr) ){
93342 testcase( i==31 );
@@ -93407,11 +93386,11 @@
93407 (char*)pDef, P4_FUNCDEF);
93408 sqlite3VdbeChangeP5(v, (u8)nFarg);
93409 if( nFarg && constMask==0 ){
93410 sqlite3ReleaseTempRange(pParse, r1, nFarg);
93411 }
93412 break;
93413 }
93414 #ifndef SQLITE_OMIT_SUBQUERY
93415 case TK_EXISTS:
93416 case TK_SELECT: {
93417 int nCol;
@@ -93418,20 +93397,19 @@
93418 testcase( op==TK_EXISTS );
93419 testcase( op==TK_SELECT );
93420 if( op==TK_SELECT && (nCol = pExpr->x.pSelect->pEList->nExpr)!=1 ){
93421 sqlite3SubselectError(pParse, nCol, 1);
93422 }else{
93423 inReg = sqlite3CodeSubselect(pParse, pExpr, 0, 0);
93424 }
93425 break;
93426 }
93427 case TK_SELECT_COLUMN: {
93428 if( pExpr->pLeft->iTable==0 ){
93429 pExpr->pLeft->iTable = sqlite3CodeSubselect(pParse, pExpr->pLeft, 0, 0);
93430 }
93431 inReg = pExpr->pLeft->iTable + pExpr->iColumn;
93432 break;
93433 }
93434 case TK_IN: {
93435 int destIfFalse = sqlite3VdbeMakeLabel(v);
93436 int destIfNull = sqlite3VdbeMakeLabel(v);
93437 sqlite3VdbeAddOp2(v, OP_Null, 0, target);
@@ -93438,11 +93416,11 @@
93438 sqlite3ExprCodeIN(pParse, pExpr, destIfFalse, destIfNull);
93439 sqlite3VdbeAddOp2(v, OP_Integer, 1, target);
93440 sqlite3VdbeResolveLabel(v, destIfFalse);
93441 sqlite3VdbeAddOp2(v, OP_AddImm, target, 0);
93442 sqlite3VdbeResolveLabel(v, destIfNull);
93443 break;
93444 }
93445 #endif /* SQLITE_OMIT_SUBQUERY */
93446
93447
93448 /*
@@ -93456,17 +93434,16 @@
93456 ** Y is stored in pExpr->pList->a[0].pExpr.
93457 ** Z is stored in pExpr->pList->a[1].pExpr.
93458 */
93459 case TK_BETWEEN: {
93460 exprCodeBetween(pParse, pExpr, target, 0, 0);
93461 break;
93462 }
93463 case TK_SPAN:
93464 case TK_COLLATE:
93465 case TK_UPLUS: {
93466 inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
93467 break;
93468 }
93469
93470 case TK_TRIGGER: {
93471 /* If the opcode is TK_TRIGGER, then the expression is a reference
93472 ** to a column in the new.* or old.* pseudo-tables available to
@@ -93604,11 +93581,11 @@
93604 sqlite3ExprCode(pParse, pEList->a[nExpr-1].pExpr, target);
93605 sqlite3ExprCachePop(pParse);
93606 }else{
93607 sqlite3VdbeAddOp2(v, OP_Null, 0, target);
93608 }
93609 assert( db->mallocFailed || pParse->nErr>0
93610 || pParse->iCacheLevel==iCacheLevel );
93611 sqlite3VdbeResolveLabel(v, endLabel);
93612 break;
93613 }
93614 #ifndef SQLITE_OMIT_TRIGGER
@@ -97644,11 +97621,11 @@
97644 break;
97645
97646 case SQLITE_NULL:
97647 /* No key specified. Use the key from the main database */
97648 sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);
97649 if( nKey>0 || sqlite3BtreeGetOptimalReserve(db->aDb[0].pBt)>0 ){
97650 rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
97651 }
97652 break;
97653 }
97654 }
@@ -98103,11 +98080,11 @@
98103 ** and attempts to write the column will be ignored.
98104 **
98105 ** Setting the auth function to NULL disables this hook. The default
98106 ** setting of the auth function is NULL.
98107 */
98108 SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer(
98109 sqlite3 *db,
98110 int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
98111 void *pArg
98112 ){
98113 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -100441,11 +100418,13 @@
100441 Table *pSelTab; /* A fake table from which we get the result set */
100442 Select *pSel; /* Copy of the SELECT that implements the view */
100443 int nErr = 0; /* Number of errors encountered */
100444 int n; /* Temporarily holds the number of cursors assigned */
100445 sqlite3 *db = pParse->db; /* Database connection for malloc errors */
 
100446 sqlite3_xauth xAuth; /* Saved xAuth pointer */
 
100447
100448 assert( pTable );
100449
100450 #ifndef SQLITE_OMIT_VIRTUALTABLE
100451 if( sqlite3VtabCallConnect(pParse, pTable) ){
@@ -103434,11 +103413,10 @@
103434 SrcList *pTabList, /* The table from which we should delete things */
103435 Expr *pWhere /* The WHERE clause. May be null */
103436 ){
103437 Vdbe *v; /* The virtual database engine */
103438 Table *pTab; /* The table from which records will be deleted */
103439 const char *zDb; /* Name of database holding pTab */
103440 int i; /* Loop counter */
103441 WhereInfo *pWInfo; /* Information about the WHERE clause */
103442 Index *pIdx; /* For looping over indices of the table */
103443 int iTabCur; /* Cursor number for the table */
103444 int iDataCur = 0; /* VDBE cursor for the canonical data source */
@@ -103511,12 +103489,12 @@
103511 if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){
103512 goto delete_from_cleanup;
103513 }
103514 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
103515 assert( iDb<db->nDb );
103516 zDb = db->aDb[iDb].zDbSName;
103517 rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb);
103518 assert( rcauth==SQLITE_OK || rcauth==SQLITE_DENY || rcauth==SQLITE_IGNORE );
103519 if( rcauth==SQLITE_DENY ){
103520 goto delete_from_cleanup;
103521 }
103522 assert(!isView || pTrigger);
@@ -103696,11 +103674,11 @@
103696 ** triggers.
103697 */
103698 if( !isView ){
103699 int iAddrOnce = 0;
103700 if( eOnePass==ONEPASS_MULTI ){
103701 iAddrOnce = sqlite3CodeOnce(pParse); VdbeCoverage(v);
103702 }
103703 testcase( IsVirtual(pTab) );
103704 sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, OPFLAG_FORDELETE,
103705 iTabCur, aToOpen, &iDataCur, &iIdxCur);
103706 assert( pPk || IsVirtual(pTab) || iDataCur==iTabCur );
@@ -104874,18 +104852,18 @@
104874 }
104875
104876 /*
104877 ** The sqlite3_strglob() interface.
104878 */
104879 SQLITE_API int SQLITE_STDCALL sqlite3_strglob(const char *zGlobPattern, const char *zString){
104880 return patternCompare((u8*)zGlobPattern, (u8*)zString, &globInfo, '[')==0;
104881 }
104882
104883 /*
104884 ** The sqlite3_strlike() interface.
104885 */
104886 SQLITE_API int SQLITE_STDCALL sqlite3_strlike(const char *zPattern, const char *zStr, unsigned int esc){
104887 return patternCompare((u8*)zPattern, (u8*)zStr, &likeInfoNorm, esc)==0;
104888 }
104889
104890 /*
104891 ** Count the number of times that the LIKE operator (or GLOB which is
@@ -107868,11 +107846,10 @@
107868 int onError /* How to handle constraint errors */
107869 ){
107870 sqlite3 *db; /* The main database structure */
107871 Table *pTab; /* The table to insert into. aka TABLE */
107872 char *zTab; /* Name of the table into which we are inserting */
107873 const char *zDb; /* Name of the database holding this table */
107874 int i, j, idx; /* Loop counters */
107875 Vdbe *v; /* Generate code into this virtual machine */
107876 Index *pIdx; /* For looping over indices of the table */
107877 int nColumn; /* Number of columns in the data */
107878 int nHidden = 0; /* Number of hidden columns if TABLE is virtual */
@@ -107883,11 +107860,10 @@
107883 int srcTab = 0; /* Data comes from this temporary cursor if >=0 */
107884 int addrInsTop = 0; /* Jump to label "D" */
107885 int addrCont = 0; /* Top of insert loop. Label "C" in templates 3 and 4 */
107886 SelectDest dest; /* Destination for SELECT on rhs of INSERT */
107887 int iDb; /* Index of database holding TABLE */
107888 Db *pDb; /* The database containing table being inserted into */
107889 u8 useTempTable = 0; /* Store SELECT results in intermediate table */
107890 u8 appendFlag = 0; /* True if the insert is likely to be an append */
107891 u8 withoutRowid; /* 0 for normal table. 1 for WITHOUT ROWID table */
107892 u8 bIdListInOrder; /* True if IDLIST is in table order */
107893 ExprList *pList = 0; /* List of VALUES() to be inserted */
@@ -107933,13 +107909,12 @@
107933 if( pTab==0 ){
107934 goto insert_cleanup;
107935 }
107936 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
107937 assert( iDb<db->nDb );
107938 pDb = &db->aDb[iDb];
107939 zDb = pDb->zDbSName;
107940 if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0, zDb) ){
107941 goto insert_cleanup;
107942 }
107943 withoutRowid = !HasRowid(pTab);
107944
107945 /* Figure out if we have any triggers and if the table being
@@ -109604,11 +109579,11 @@
109604 ** If the SQL is a query, then for each row in the query result
109605 ** the xCallback() function is called. pArg becomes the first
109606 ** argument to xCallback(). If xCallback=NULL then no callback
109607 ** is invoked, even for queries.
109608 */
109609 SQLITE_API int SQLITE_STDCALL sqlite3_exec(
109610 sqlite3 *db, /* The database on which the SQL executes */
109611 const char *zSql, /* The SQL to be executed */
109612 sqlite3_callback xCallback, /* Invoke this callback routine */
109613 void *pArg, /* First argument to xCallback() */
109614 char **pzErrMsg /* Write error messages here */
@@ -110866,11 +110841,11 @@
110866 db->aExtension = aHandle;
110867
110868 db->aExtension[db->nExtension++] = handle;
110869 return SQLITE_OK;
110870 }
110871 SQLITE_API int SQLITE_STDCALL sqlite3_load_extension(
110872 sqlite3 *db, /* Load the extension into this database connection */
110873 const char *zFile, /* Name of the shared library containing extension */
110874 const char *zProc, /* Entry point. Use "sqlite3_extension_init" if 0 */
110875 char **pzErrMsg /* Put error message here if not 0 */
110876 ){
@@ -110897,11 +110872,11 @@
110897
110898 /*
110899 ** Enable or disable extension loading. Extension loading is disabled by
110900 ** default so as not to open security holes in older applications.
110901 */
110902 SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int onoff){
110903 sqlite3_mutex_enter(db->mutex);
110904 if( onoff ){
110905 db->flags |= SQLITE_LoadExtension|SQLITE_LoadExtFunc;
110906 }else{
110907 db->flags &= ~(SQLITE_LoadExtension|SQLITE_LoadExtFunc);
@@ -110908,22 +110883,11 @@
110908 }
110909 sqlite3_mutex_leave(db->mutex);
110910 return SQLITE_OK;
110911 }
110912
110913 #endif /* SQLITE_OMIT_LOAD_EXTENSION */
110914
110915 /*
110916 ** The auto-extension code added regardless of whether or not extension
110917 ** loading is supported. We need a dummy sqlite3Apis pointer for that
110918 ** code if regular extension loading is not available. This is that
110919 ** dummy pointer.
110920 */
110921 #ifdef SQLITE_OMIT_LOAD_EXTENSION
110922 static const sqlite3_api_routines sqlite3Apis = { 0 };
110923 #endif
110924
110925
110926 /*
110927 ** The following object holds the list of automatically loaded
110928 ** extensions.
110929 **
@@ -110954,11 +110918,11 @@
110954
110955 /*
110956 ** Register a statically linked extension that is automatically
110957 ** loaded by every new database connection.
110958 */
110959 SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(
110960 void (*xInit)(void)
110961 ){
110962 int rc = SQLITE_OK;
110963 #ifndef SQLITE_OMIT_AUTOINIT
110964 rc = sqlite3_initialize();
@@ -111001,11 +110965,11 @@
111001 ** routine is a no-op.
111002 **
111003 ** Return 1 if xInit was found on the list and removed. Return 0 if xInit
111004 ** was not on the list.
111005 */
111006 SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(
111007 void (*xInit)(void)
111008 ){
111009 #if SQLITE_THREADSAFE
111010 sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
111011 #endif
@@ -111026,11 +110990,11 @@
111026 }
111027
111028 /*
111029 ** Reset the automatic extension loading mechanism.
111030 */
111031 SQLITE_API void SQLITE_STDCALL sqlite3_reset_auto_extension(void){
111032 #ifndef SQLITE_OMIT_AUTOINIT
111033 if( sqlite3_initialize()==SQLITE_OK )
111034 #endif
111035 {
111036 #if SQLITE_THREADSAFE
@@ -111064,20 +111028,25 @@
111064 for(i=0; go; i++){
111065 char *zErrmsg;
111066 #if SQLITE_THREADSAFE
111067 sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
111068 #endif
 
 
 
 
 
111069 sqlite3_mutex_enter(mutex);
111070 if( i>=wsdAutoext.nExt ){
111071 xInit = 0;
111072 go = 0;
111073 }else{
111074 xInit = (sqlite3_loadext_entry)wsdAutoext.aExt[i];
111075 }
111076 sqlite3_mutex_leave(mutex);
111077 zErrmsg = 0;
111078 if( xInit && (rc = xInit(db, &zErrmsg, &sqlite3Apis))!=0 ){
111079 sqlite3ErrorWithMsg(db, rc,
111080 "automatic extension loading failed: %s", zErrmsg);
111081 go = 0;
111082 }
111083 sqlite3_free(zErrmsg);
@@ -114289,11 +114258,11 @@
114289 ** and so if a schema change occurs, SQLITE_SCHEMA is returned by
114290 ** sqlite3_step(). In the new version, the original SQL text is retained
114291 ** and the statement is automatically recompiled if an schema change
114292 ** occurs.
114293 */
114294 SQLITE_API int SQLITE_STDCALL sqlite3_prepare(
114295 sqlite3 *db, /* Database handle. */
114296 const char *zSql, /* UTF-8 encoded SQL statement. */
114297 int nBytes, /* Length of zSql in bytes. */
114298 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
114299 const char **pzTail /* OUT: End of parsed string */
@@ -114301,11 +114270,11 @@
114301 int rc;
114302 rc = sqlite3LockAndPrepare(db,zSql,nBytes,0,0,ppStmt,pzTail);
114303 assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */
114304 return rc;
114305 }
114306 SQLITE_API int SQLITE_STDCALL sqlite3_prepare_v2(
114307 sqlite3 *db, /* Database handle. */
114308 const char *zSql, /* UTF-8 encoded SQL statement. */
114309 int nBytes, /* Length of zSql in bytes. */
114310 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
114311 const char **pzTail /* OUT: End of parsed string */
@@ -114377,11 +114346,11 @@
114377 ** and so if a schema change occurs, SQLITE_SCHEMA is returned by
114378 ** sqlite3_step(). In the new version, the original SQL text is retained
114379 ** and the statement is automatically recompiled if an schema change
114380 ** occurs.
114381 */
114382 SQLITE_API int SQLITE_STDCALL sqlite3_prepare16(
114383 sqlite3 *db, /* Database handle. */
114384 const void *zSql, /* UTF-16 encoded SQL statement. */
114385 int nBytes, /* Length of zSql in bytes. */
114386 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
114387 const void **pzTail /* OUT: End of parsed string */
@@ -114389,11 +114358,11 @@
114389 int rc;
114390 rc = sqlite3Prepare16(db,zSql,nBytes,0,ppStmt,pzTail);
114391 assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */
114392 return rc;
114393 }
114394 SQLITE_API int SQLITE_STDCALL sqlite3_prepare16_v2(
114395 sqlite3 *db, /* Database handle. */
114396 const void *zSql, /* UTF-16 encoded SQL statement. */
114397 int nBytes, /* Length of zSql in bytes. */
114398 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
114399 const void **pzTail /* OUT: End of parsed string */
@@ -115640,11 +115609,11 @@
115640 nKey = pOrderBy->nExpr - pSort->nOBSat;
115641 if( pSort->sortFlags & SORTFLAG_UseSorter ){
115642 int regSortOut = ++pParse->nMem;
115643 iSortTab = pParse->nTab++;
115644 if( pSort->labelBkOut ){
115645 addrOnce = sqlite3CodeOnce(pParse); VdbeCoverage(v);
115646 }
115647 sqlite3VdbeAddOp3(v, OP_OpenPseudo, iSortTab, regSortOut, nKey+1+nSortData);
115648 if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce);
115649 addr = 1 + sqlite3VdbeAddOp2(v, OP_SorterSort, iTab, addrBreak);
115650 VdbeCoverage(v);
@@ -119435,11 +119404,11 @@
119435 pItem->addrFillSub = topAddr+1;
119436 if( pItem->fg.isCorrelated==0 ){
119437 /* If the subquery is not correlated and if we are not inside of
119438 ** a trigger, then we only need to compute the value of the subquery
119439 ** once. */
119440 onceAddr = sqlite3CodeOnce(pParse); VdbeCoverage(v);
119441 VdbeComment((v, "materialize \"%s\"", pItem->pTab->zName));
119442 }else{
119443 VdbeNoopComment((v, "materialize \"%s\"", pItem->pTab->zName));
119444 }
119445 sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor);
@@ -120198,11 +120167,11 @@
120198 ** The result that is written to ***pazResult is held in memory obtained
120199 ** from malloc(). But the caller cannot free this memory directly.
120200 ** Instead, the entire table should be passed to sqlite3_free_table() when
120201 ** the calling procedure is finished using it.
120202 */
120203 SQLITE_API int SQLITE_STDCALL sqlite3_get_table(
120204 sqlite3 *db, /* The database on which the SQL executes */
120205 const char *zSql, /* The SQL to be executed */
120206 char ***pazResult, /* Write the result table here */
120207 int *pnRow, /* Write the number of rows in the result here */
120208 int *pnColumn, /* Write the number of columns of result here */
@@ -120267,11 +120236,11 @@
120267 }
120268
120269 /*
120270 ** This routine frees the space the sqlite3_get_table() malloced.
120271 */
120272 SQLITE_API void SQLITE_STDCALL sqlite3_free_table(
120273 char **azResult /* Result returned from sqlite3_get_table() */
120274 ){
120275 if( azResult ){
120276 int i, n;
120277 azResult--;
@@ -120382,11 +120351,10 @@
120382 char *zName = 0; /* Name of the trigger */
120383 sqlite3 *db = pParse->db; /* The database connection */
120384 int iDb; /* The database to store the trigger in */
120385 Token *pName; /* The unqualified db name */
120386 DbFixer sFix; /* State vector for the DB fixer */
120387 int iTabDb; /* Index of the database holding pTab */
120388
120389 assert( pName1!=0 ); /* pName1->z might be NULL, but not pName1 itself */
120390 assert( pName2!=0 );
120391 assert( op==TK_INSERT || op==TK_UPDATE || op==TK_DELETE );
120392 assert( op>0 && op<0xff );
@@ -120495,14 +120463,14 @@
120495 if( !pTab->pSelect && tr_tm==TK_INSTEAD ){
120496 sqlite3ErrorMsg(pParse, "cannot create INSTEAD OF"
120497 " trigger on table: %S", pTableName, 0);
120498 goto trigger_cleanup;
120499 }
120500 iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
120501
120502 #ifndef SQLITE_OMIT_AUTHORIZATION
120503 {
 
120504 int code = SQLITE_CREATE_TRIGGER;
120505 const char *zDb = db->aDb[iTabDb].zDbSName;
120506 const char *zDbTrig = isTemp ? db->aDb[1].zDbSName : zDb;
120507 if( iTabDb==1 || isTemp ) code = SQLITE_CREATE_TEMP_TRIGGER;
120508 if( sqlite3AuthCheck(pParse, code, zName, pTab->zName, zDbTrig) ){
@@ -121166,11 +121134,10 @@
121166 if( db->mallocFailed==0 ){
121167 pProgram->aOp = sqlite3VdbeTakeOpArray(v, &pProgram->nOp, &pTop->nMaxArg);
121168 }
121169 pProgram->nMem = pSubParse->nMem;
121170 pProgram->nCsr = pSubParse->nTab;
121171 pProgram->nOnce = pSubParse->nOnce;
121172 pProgram->token = (void *)pTrigger;
121173 pPrg->aColmask[0] = pSubParse->oldmask;
121174 pPrg->aColmask[1] = pSubParse->newmask;
121175 sqlite3VdbeDelete(v);
121176 }
@@ -122655,11 +122622,11 @@
122655
122656
122657 /*
122658 ** External API function used to create a new virtual-table module.
122659 */
122660 SQLITE_API int SQLITE_STDCALL sqlite3_create_module(
122661 sqlite3 *db, /* Database in which module is registered */
122662 const char *zName, /* Name assigned to this module */
122663 const sqlite3_module *pModule, /* The definition of the module */
122664 void *pAux /* Context pointer for xCreate/xConnect */
122665 ){
@@ -122670,11 +122637,11 @@
122670 }
122671
122672 /*
122673 ** External API function used to create a new virtual-table module.
122674 */
122675 SQLITE_API int SQLITE_STDCALL sqlite3_create_module_v2(
122676 sqlite3 *db, /* Database in which module is registered */
122677 const char *zName, /* Name assigned to this module */
122678 const sqlite3_module *pModule, /* The definition of the module */
122679 void *pAux, /* Context pointer for xCreate/xConnect */
122680 void (*xDestroy)(void *) /* Module destructor function */
@@ -123294,11 +123261,11 @@
123294 /*
123295 ** This function is used to set the schema of a virtual table. It is only
123296 ** valid to call this function from within the xCreate() or xConnect() of a
123297 ** virtual table module.
123298 */
123299 SQLITE_API int SQLITE_STDCALL sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
123300 VtabCtx *pCtx;
123301 Parse *pParse;
123302 int rc = SQLITE_OK;
123303 Table *pTab;
123304 char *zErr = 0;
@@ -123751,11 +123718,11 @@
123751 ** table update operation currently in progress.
123752 **
123753 ** The results of this routine are undefined unless it is called from
123754 ** within an xUpdate method.
123755 */
123756 SQLITE_API int SQLITE_STDCALL sqlite3_vtab_on_conflict(sqlite3 *db){
123757 static const unsigned char aMap[] = {
123758 SQLITE_ROLLBACK, SQLITE_ABORT, SQLITE_FAIL, SQLITE_IGNORE, SQLITE_REPLACE
123759 };
123760 #ifdef SQLITE_ENABLE_API_ARMOR
123761 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
@@ -123769,11 +123736,11 @@
123769 /*
123770 ** Call from within the xCreate() or xConnect() methods to provide
123771 ** the SQLite core with additional information about the behavior
123772 ** of the virtual table being implemented.
123773 */
123774 SQLITE_API int SQLITE_CDECL sqlite3_vtab_config(sqlite3 *db, int op, ...){
123775 va_list ap;
123776 int rc = SQLITE_OK;
123777
123778 #ifdef SQLITE_ENABLE_API_ARMOR
123779 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
@@ -124886,18 +124853,17 @@
124886 pIn = pLevel->u.in.aInLoop;
124887 if( pIn ){
124888 int iMap = 0; /* Index in aiMap[] */
124889 pIn += i;
124890 for(i=iEq;i<pLoop->nLTerm; i++){
124891 int iOut = iReg;
124892 if( pLoop->aLTerm[i]->pExpr==pX ){
 
124893 if( eType==IN_INDEX_ROWID ){
124894 assert( nEq==1 && i==iEq );
124895 pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iReg);
124896 }else{
124897 int iCol = aiMap ? aiMap[iMap++] : 0;
124898 iOut = iReg + i - iEq;
124899 pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut);
124900 }
124901 sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v);
124902 if( i==iEq ){
124903 pIn->iCur = iTab;
@@ -128496,11 +128462,11 @@
128496
128497 /* Generate code to skip over the creation and initialization of the
128498 ** transient index on 2nd and subsequent iterations of the loop. */
128499 v = pParse->pVdbe;
128500 assert( v!=0 );
128501 addrInit = sqlite3CodeOnce(pParse); VdbeCoverage(v);
128502
128503 /* Count the number of columns that will be added to the index
128504 ** and used to match WHERE clause constraints */
128505 nKeyCol = 0;
128506 pTable = pSrc->pTab;
@@ -130167,10 +130133,12 @@
130167 LogEst rLogSize; /* Logarithm of table size */
130168 WhereTerm *pTop = 0, *pBtm = 0; /* Top and bottom range constraints */
130169
130170 pNew = pBuilder->pNew;
130171 if( db->mallocFailed ) return SQLITE_NOMEM_BKPT;
 
 
130172
130173 assert( (pNew->wsFlags & WHERE_VIRTUALTABLE)==0 );
130174 assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 );
130175 if( pNew->wsFlags & WHERE_BTM_LIMIT ){
130176 opMask = WO_LT|WO_LE;
@@ -130253,11 +130221,11 @@
130253 ** In this case there is a separate term for each of (x) and (y).
130254 ** However, the nIn multiplier should only be applied once, not once
130255 ** for each such term. The following loop checks that pTerm is the
130256 ** first such term in use, and sets nIn back to 0 if it is not. */
130257 for(i=0; i<pNew->nLTerm-1; i++){
130258 if( pNew->aLTerm[i]->pExpr==pExpr ) nIn = 0;
130259 }
130260 }else if( ALWAYS(pExpr->x.pList && pExpr->x.pList->nExpr) ){
130261 /* "x IN (value, value, ...)" */
130262 nIn = sqlite3LogEst(pExpr->x.pList->nExpr);
130263 assert( nIn>0 ); /* RHS always has 2 or more terms... The parser
@@ -130445,10 +130413,12 @@
130445 pNew->u.btree.nEq = saved_nEq;
130446 pNew->nSkip = saved_nSkip;
130447 pNew->wsFlags = saved_wsFlags;
130448 }
130449
 
 
130450 return rc;
130451 }
130452
130453 /*
130454 ** Return True if it is possible that pIndex might be useful in
@@ -137554,11 +137524,11 @@
137554 **
137555 ** If we compile with SQLITE_OMIT_TRIGGER, all of the computation needed
137556 ** to recognize the end of a trigger can be omitted. All we have to do
137557 ** is look for a semicolon that is not part of an string or comment.
137558 */
137559 SQLITE_API int SQLITE_STDCALL sqlite3_complete(const char *zSql){
137560 u8 state = 0; /* Current state, using numbers defined in header comment */
137561 u8 token; /* Value of the next token */
137562
137563 #ifndef SQLITE_OMIT_TRIGGER
137564 /* A complex statement machine used to detect the end of a CREATE TRIGGER
@@ -137719,11 +137689,11 @@
137719 /*
137720 ** This routine is the same as the sqlite3_complete() routine described
137721 ** above, except that the parameter is required to be UTF-16 encoded, not
137722 ** UTF-8.
137723 */
137724 SQLITE_API int SQLITE_STDCALL sqlite3_complete16(const void *zSql){
137725 sqlite3_value *pVal;
137726 char const *zSql8;
137727 int rc;
137728
137729 #ifndef SQLITE_OMIT_AUTOINIT
@@ -137879,28 +137849,28 @@
137879 #endif
137880
137881 /* IMPLEMENTATION-OF: R-53536-42575 The sqlite3_libversion() function returns
137882 ** a pointer to the to the sqlite3_version[] string constant.
137883 */
137884 SQLITE_API const char *SQLITE_STDCALL sqlite3_libversion(void){ return sqlite3_version; }
137885
137886 /* IMPLEMENTATION-OF: R-63124-39300 The sqlite3_sourceid() function returns a
137887 ** pointer to a string constant whose value is the same as the
137888 ** SQLITE_SOURCE_ID C preprocessor macro.
137889 */
137890 SQLITE_API const char *SQLITE_STDCALL sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
137891
137892 /* IMPLEMENTATION-OF: R-35210-63508 The sqlite3_libversion_number() function
137893 ** returns an integer equal to SQLITE_VERSION_NUMBER.
137894 */
137895 SQLITE_API int SQLITE_STDCALL sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; }
137896
137897 /* IMPLEMENTATION-OF: R-20790-14025 The sqlite3_threadsafe() function returns
137898 ** zero if and only if SQLite was compiled with mutexing code omitted due to
137899 ** the SQLITE_THREADSAFE compile-time option being set to 0.
137900 */
137901 SQLITE_API int SQLITE_STDCALL sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; }
137902
137903 /*
137904 ** When compiling the test fixture or with debugging enabled (on Win32),
137905 ** this variable being set to non-zero will cause OSTRACE macros to emit
137906 ** extra diagnostic information.
@@ -137969,11 +137939,11 @@
137969 ** call by X completes.
137970 **
137971 ** * Recursive calls to this routine from thread X return immediately
137972 ** without blocking.
137973 */
137974 SQLITE_API int SQLITE_STDCALL sqlite3_initialize(void){
137975 MUTEX_LOGIC( sqlite3_mutex *pMaster; ) /* The main static mutex */
137976 int rc; /* Result code */
137977 #ifdef SQLITE_EXTRA_INIT
137978 int bRunExtraInit = 0; /* Extra initialization needed */
137979 #endif
@@ -138135,11 +138105,11 @@
138135 ** while any part of SQLite is otherwise in use in any thread. This
138136 ** routine is not threadsafe. But it is safe to invoke this routine
138137 ** on when SQLite is already shut down. If SQLite is already shut down
138138 ** when this routine is invoked, then this routine is a harmless no-op.
138139 */
138140 SQLITE_API int SQLITE_STDCALL sqlite3_shutdown(void){
138141 #ifdef SQLITE_OMIT_WSD
138142 int rc = sqlite3_wsd_init(4096, 24);
138143 if( rc!=SQLITE_OK ){
138144 return rc;
138145 }
@@ -138189,11 +138159,11 @@
138189 ** This routine should only be called when there are no outstanding
138190 ** database connections or memory allocations. This routine is not
138191 ** threadsafe. Failure to heed these warnings can lead to unpredictable
138192 ** behavior.
138193 */
138194 SQLITE_API int SQLITE_CDECL sqlite3_config(int op, ...){
138195 va_list ap;
138196 int rc = SQLITE_OK;
138197
138198 /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while
138199 ** the SQLite library is in use. */
@@ -138554,11 +138524,11 @@
138554 }
138555
138556 /*
138557 ** Return the mutex associated with a database connection.
138558 */
138559 SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_db_mutex(sqlite3 *db){
138560 #ifdef SQLITE_ENABLE_API_ARMOR
138561 if( !sqlite3SafetyCheckOk(db) ){
138562 (void)SQLITE_MISUSE_BKPT;
138563 return 0;
138564 }
@@ -138568,11 +138538,11 @@
138568
138569 /*
138570 ** Free up as much memory as we can from the given database
138571 ** connection.
138572 */
138573 SQLITE_API int SQLITE_STDCALL sqlite3_db_release_memory(sqlite3 *db){
138574 int i;
138575
138576 #ifdef SQLITE_ENABLE_API_ARMOR
138577 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
138578 #endif
@@ -138592,11 +138562,11 @@
138592
138593 /*
138594 ** Flush any dirty pages in the pager-cache for any attached database
138595 ** to disk.
138596 */
138597 SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3 *db){
138598 int i;
138599 int rc = SQLITE_OK;
138600 int bSeenBusy = 0;
138601
138602 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -138621,11 +138591,11 @@
138621 }
138622
138623 /*
138624 ** Configuration settings for an individual database connection
138625 */
138626 SQLITE_API int SQLITE_CDECL sqlite3_db_config(sqlite3 *db, int op, ...){
138627 va_list ap;
138628 int rc;
138629 va_start(ap, op);
138630 switch( op ){
138631 case SQLITE_DBCONFIG_MAINDBNAME: {
@@ -138747,11 +138717,11 @@
138747 }
138748
138749 /*
138750 ** Return the ROWID of the most recent insert
138751 */
138752 SQLITE_API sqlite_int64 SQLITE_STDCALL sqlite3_last_insert_rowid(sqlite3 *db){
138753 #ifdef SQLITE_ENABLE_API_ARMOR
138754 if( !sqlite3SafetyCheckOk(db) ){
138755 (void)SQLITE_MISUSE_BKPT;
138756 return 0;
138757 }
@@ -138760,11 +138730,11 @@
138760 }
138761
138762 /*
138763 ** Return the number of changes in the most recent call to sqlite3_exec().
138764 */
138765 SQLITE_API int SQLITE_STDCALL sqlite3_changes(sqlite3 *db){
138766 #ifdef SQLITE_ENABLE_API_ARMOR
138767 if( !sqlite3SafetyCheckOk(db) ){
138768 (void)SQLITE_MISUSE_BKPT;
138769 return 0;
138770 }
@@ -138773,11 +138743,11 @@
138773 }
138774
138775 /*
138776 ** Return the number of changes since the database handle was opened.
138777 */
138778 SQLITE_API int SQLITE_STDCALL sqlite3_total_changes(sqlite3 *db){
138779 #ifdef SQLITE_ENABLE_API_ARMOR
138780 if( !sqlite3SafetyCheckOk(db) ){
138781 (void)SQLITE_MISUSE_BKPT;
138782 return 0;
138783 }
@@ -138924,12 +138894,12 @@
138924 ** statements or unfinished sqlite3_backups. The sqlite3_close_v2()
138925 ** version forces the connection to become a zombie if there are
138926 ** unclosed resources, and arranges for deallocation when the last
138927 ** prepare statement or sqlite3_backup closes.
138928 */
138929 SQLITE_API int SQLITE_STDCALL sqlite3_close(sqlite3 *db){ return sqlite3Close(db,0); }
138930 SQLITE_API int SQLITE_STDCALL sqlite3_close_v2(sqlite3 *db){ return sqlite3Close(db,1); }
138931
138932
138933 /*
138934 ** Close the mutex on database connection db.
138935 **
@@ -139332,11 +139302,11 @@
139332
139333 /*
139334 ** This routine sets the busy callback for an Sqlite database to the
139335 ** given callback function with the given argument.
139336 */
139337 SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(
139338 sqlite3 *db,
139339 int (*xBusy)(void*,int),
139340 void *pArg
139341 ){
139342 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -139355,11 +139325,11 @@
139355 /*
139356 ** This routine sets the progress callback for an Sqlite database to the
139357 ** given callback function with the given argument. The progress callback will
139358 ** be invoked every nOps opcodes.
139359 */
139360 SQLITE_API void SQLITE_STDCALL sqlite3_progress_handler(
139361 sqlite3 *db,
139362 int nOps,
139363 int (*xProgress)(void*),
139364 void *pArg
139365 ){
@@ -139386,11 +139356,11 @@
139386
139387 /*
139388 ** This routine installs a default busy handler that waits for the
139389 ** specified number of milliseconds before returning 0.
139390 */
139391 SQLITE_API int SQLITE_STDCALL sqlite3_busy_timeout(sqlite3 *db, int ms){
139392 #ifdef SQLITE_ENABLE_API_ARMOR
139393 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
139394 #endif
139395 if( ms>0 ){
139396 sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db);
@@ -139402,11 +139372,11 @@
139402 }
139403
139404 /*
139405 ** Cause any pending operation to stop at its earliest opportunity.
139406 */
139407 SQLITE_API void SQLITE_STDCALL sqlite3_interrupt(sqlite3 *db){
139408 #ifdef SQLITE_ENABLE_API_ARMOR
139409 if( !sqlite3SafetyCheckOk(db) ){
139410 (void)SQLITE_MISUSE_BKPT;
139411 return;
139412 }
@@ -139518,11 +139488,11 @@
139518 }
139519
139520 /*
139521 ** Create new user functions.
139522 */
139523 SQLITE_API int SQLITE_STDCALL sqlite3_create_function(
139524 sqlite3 *db,
139525 const char *zFunc,
139526 int nArg,
139527 int enc,
139528 void *p,
@@ -139532,11 +139502,11 @@
139532 ){
139533 return sqlite3_create_function_v2(db, zFunc, nArg, enc, p, xSFunc, xStep,
139534 xFinal, 0);
139535 }
139536
139537 SQLITE_API int SQLITE_STDCALL sqlite3_create_function_v2(
139538 sqlite3 *db,
139539 const char *zFunc,
139540 int nArg,
139541 int enc,
139542 void *p,
@@ -139575,11 +139545,11 @@
139575 sqlite3_mutex_leave(db->mutex);
139576 return rc;
139577 }
139578
139579 #ifndef SQLITE_OMIT_UTF16
139580 SQLITE_API int SQLITE_STDCALL sqlite3_create_function16(
139581 sqlite3 *db,
139582 const void *zFunctionName,
139583 int nArg,
139584 int eTextRep,
139585 void *p,
@@ -139615,11 +139585,11 @@
139615 ** When virtual tables intend to provide an overloaded function, they
139616 ** should call this routine to make sure the global function exists.
139617 ** A global function must exist in order for name resolution to work
139618 ** properly.
139619 */
139620 SQLITE_API int SQLITE_STDCALL sqlite3_overload_function(
139621 sqlite3 *db,
139622 const char *zName,
139623 int nArg
139624 ){
139625 int rc = SQLITE_OK;
@@ -139647,11 +139617,11 @@
139647 ** A NULL trace function means that no tracing is executes. A non-NULL
139648 ** trace is a pointer to a function that is invoked at the start of each
139649 ** SQL statement.
139650 */
139651 #ifndef SQLITE_OMIT_DEPRECATED
139652 SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3 *db, void(*xTrace)(void*,const char*), void *pArg){
139653 void *pOld;
139654
139655 #ifdef SQLITE_ENABLE_API_ARMOR
139656 if( !sqlite3SafetyCheckOk(db) ){
139657 (void)SQLITE_MISUSE_BKPT;
@@ -139668,11 +139638,11 @@
139668 }
139669 #endif /* SQLITE_OMIT_DEPRECATED */
139670
139671 /* Register a trace callback using the version-2 interface.
139672 */
139673 SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2(
139674 sqlite3 *db, /* Trace this connection */
139675 unsigned mTrace, /* Mask of events to be traced */
139676 int(*xTrace)(unsigned,void*,void*,void*), /* Callback to invoke */
139677 void *pArg /* Context */
139678 ){
@@ -139698,11 +139668,11 @@
139698 **
139699 ** A NULL profile function means that no profiling is executes. A non-NULL
139700 ** profile is a pointer to a function that is invoked at the conclusion of
139701 ** each SQL statement that is run.
139702 */
139703 SQLITE_API void *SQLITE_STDCALL sqlite3_profile(
139704 sqlite3 *db,
139705 void (*xProfile)(void*,const char*,sqlite_uint64),
139706 void *pArg
139707 ){
139708 void *pOld;
@@ -139726,11 +139696,11 @@
139726 /*
139727 ** Register a function to be invoked when a transaction commits.
139728 ** If the invoked function returns non-zero, then the commit becomes a
139729 ** rollback.
139730 */
139731 SQLITE_API void *SQLITE_STDCALL sqlite3_commit_hook(
139732 sqlite3 *db, /* Attach the hook to this database */
139733 int (*xCallback)(void*), /* Function to invoke on each commit */
139734 void *pArg /* Argument to the function */
139735 ){
139736 void *pOld;
@@ -139751,11 +139721,11 @@
139751
139752 /*
139753 ** Register a callback to be invoked each time a row is updated,
139754 ** inserted or deleted using this database connection.
139755 */
139756 SQLITE_API void *SQLITE_STDCALL sqlite3_update_hook(
139757 sqlite3 *db, /* Attach the hook to this database */
139758 void (*xCallback)(void*,int,char const *,char const *,sqlite_int64),
139759 void *pArg /* Argument to the function */
139760 ){
139761 void *pRet;
@@ -139776,11 +139746,11 @@
139776
139777 /*
139778 ** Register a callback to be invoked each time a transaction is rolled
139779 ** back by this database connection.
139780 */
139781 SQLITE_API void *SQLITE_STDCALL sqlite3_rollback_hook(
139782 sqlite3 *db, /* Attach the hook to this database */
139783 void (*xCallback)(void*), /* Callback function */
139784 void *pArg /* Argument to the function */
139785 ){
139786 void *pRet;
@@ -139802,11 +139772,11 @@
139802 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
139803 /*
139804 ** Register a callback to be invoked each time a row is updated,
139805 ** inserted or deleted using this database connection.
139806 */
139807 SQLITE_API void *SQLITE_STDCALL sqlite3_preupdate_hook(
139808 sqlite3 *db, /* Attach the hook to this database */
139809 void(*xCallback)( /* Callback function */
139810 void*,sqlite3*,int,char const*,char const*,sqlite3_int64,sqlite3_int64),
139811 void *pArg /* First callback argument */
139812 ){
@@ -139851,11 +139821,11 @@
139851 ** The callback registered by this function replaces any existing callback
139852 ** registered using sqlite3_wal_hook(). Likewise, registering a callback
139853 ** using sqlite3_wal_hook() disables the automatic checkpoint mechanism
139854 ** configured by this function.
139855 */
139856 SQLITE_API int SQLITE_STDCALL sqlite3_wal_autocheckpoint(sqlite3 *db, int nFrame){
139857 #ifdef SQLITE_OMIT_WAL
139858 UNUSED_PARAMETER(db);
139859 UNUSED_PARAMETER(nFrame);
139860 #else
139861 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -139872,11 +139842,11 @@
139872
139873 /*
139874 ** Register a callback to be invoked each time a transaction is written
139875 ** into the write-ahead-log by this database connection.
139876 */
139877 SQLITE_API void *SQLITE_STDCALL sqlite3_wal_hook(
139878 sqlite3 *db, /* Attach the hook to this db handle */
139879 int(*xCallback)(void *, sqlite3*, const char*, int),
139880 void *pArg /* First argument passed to xCallback() */
139881 ){
139882 #ifndef SQLITE_OMIT_WAL
@@ -139899,11 +139869,11 @@
139899 }
139900
139901 /*
139902 ** Checkpoint database zDb.
139903 */
139904 SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint_v2(
139905 sqlite3 *db, /* Database handle */
139906 const char *zDb, /* Name of attached database (or NULL) */
139907 int eMode, /* SQLITE_CHECKPOINT_* value */
139908 int *pnLog, /* OUT: Size of WAL log in frames */
139909 int *pnCkpt /* OUT: Total number of frames checkpointed */
@@ -139954,11 +139924,11 @@
139954 /*
139955 ** Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points
139956 ** to contains a zero-length string, all attached databases are
139957 ** checkpointed.
139958 */
139959 SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){
139960 /* EVIDENCE-OF: R-41613-20553 The sqlite3_wal_checkpoint(D,X) is equivalent to
139961 ** sqlite3_wal_checkpoint_v2(D,X,SQLITE_CHECKPOINT_PASSIVE,0,0). */
139962 return sqlite3_wal_checkpoint_v2(db,zDb,SQLITE_CHECKPOINT_PASSIVE,0,0);
139963 }
139964
@@ -140045,11 +140015,11 @@
140045
140046 /*
140047 ** Return UTF-8 encoded English language explanation of the most recent
140048 ** error.
140049 */
140050 SQLITE_API const char *SQLITE_STDCALL sqlite3_errmsg(sqlite3 *db){
140051 const char *z;
140052 if( !db ){
140053 return sqlite3ErrStr(SQLITE_NOMEM_BKPT);
140054 }
140055 if( !sqlite3SafetyCheckSickOrOk(db) ){
@@ -140073,11 +140043,11 @@
140073 #ifndef SQLITE_OMIT_UTF16
140074 /*
140075 ** Return UTF-16 encoded English language explanation of the most recent
140076 ** error.
140077 */
140078 SQLITE_API const void *SQLITE_STDCALL sqlite3_errmsg16(sqlite3 *db){
140079 static const u16 outOfMem[] = {
140080 'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0
140081 };
140082 static const u16 misuse[] = {
140083 'l', 'i', 'b', 'r', 'a', 'r', 'y', ' ',
@@ -140118,38 +140088,38 @@
140118
140119 /*
140120 ** Return the most recent error code generated by an SQLite routine. If NULL is
140121 ** passed to this function, we assume a malloc() failed during sqlite3_open().
140122 */
140123 SQLITE_API int SQLITE_STDCALL sqlite3_errcode(sqlite3 *db){
140124 if( db && !sqlite3SafetyCheckSickOrOk(db) ){
140125 return SQLITE_MISUSE_BKPT;
140126 }
140127 if( !db || db->mallocFailed ){
140128 return SQLITE_NOMEM_BKPT;
140129 }
140130 return db->errCode & db->errMask;
140131 }
140132 SQLITE_API int SQLITE_STDCALL sqlite3_extended_errcode(sqlite3 *db){
140133 if( db && !sqlite3SafetyCheckSickOrOk(db) ){
140134 return SQLITE_MISUSE_BKPT;
140135 }
140136 if( !db || db->mallocFailed ){
140137 return SQLITE_NOMEM_BKPT;
140138 }
140139 return db->errCode;
140140 }
140141 SQLITE_API int SQLITE_STDCALL sqlite3_system_errno(sqlite3 *db){
140142 return db ? db->iSysErrno : 0;
140143 }
140144
140145 /*
140146 ** Return a string that describes the kind of error specified in the
140147 ** argument. For now, this simply calls the internal sqlite3ErrStr()
140148 ** function.
140149 */
140150 SQLITE_API const char *SQLITE_STDCALL sqlite3_errstr(int rc){
140151 return sqlite3ErrStr(rc);
140152 }
140153
140154 /*
140155 ** Create a new collating function for database "db". The name is zName
@@ -140293,11 +140263,11 @@
140293 **
140294 ** A new lower limit does not shrink existing constructs.
140295 ** It merely prevents new constructs that exceed the limit
140296 ** from forming.
140297 */
140298 SQLITE_API int SQLITE_STDCALL sqlite3_limit(sqlite3 *db, int limitId, int newLimit){
140299 int oldLimit;
140300
140301 #ifdef SQLITE_ENABLE_API_ARMOR
140302 if( !sqlite3SafetyCheckOk(db) ){
140303 (void)SQLITE_MISUSE_BKPT;
@@ -140920,18 +140890,18 @@
140920 }
140921
140922 /*
140923 ** Open a new database handle.
140924 */
140925 SQLITE_API int SQLITE_STDCALL sqlite3_open(
140926 const char *zFilename,
140927 sqlite3 **ppDb
140928 ){
140929 return openDatabase(zFilename, ppDb,
140930 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);
140931 }
140932 SQLITE_API int SQLITE_STDCALL sqlite3_open_v2(
140933 const char *filename, /* Database filename (UTF-8) */
140934 sqlite3 **ppDb, /* OUT: SQLite db handle */
140935 int flags, /* Flags */
140936 const char *zVfs /* Name of VFS module to use */
140937 ){
@@ -140940,11 +140910,11 @@
140940
140941 #ifndef SQLITE_OMIT_UTF16
140942 /*
140943 ** Open a new database handle.
140944 */
140945 SQLITE_API int SQLITE_STDCALL sqlite3_open16(
140946 const void *zFilename,
140947 sqlite3 **ppDb
140948 ){
140949 char const *zFilename8; /* zFilename encoded in UTF-8 instead of UTF-16 */
140950 sqlite3_value *pVal;
@@ -140979,11 +140949,11 @@
140979 #endif /* SQLITE_OMIT_UTF16 */
140980
140981 /*
140982 ** Register a new collation sequence with the database handle db.
140983 */
140984 SQLITE_API int SQLITE_STDCALL sqlite3_create_collation(
140985 sqlite3* db,
140986 const char *zName,
140987 int enc,
140988 void* pCtx,
140989 int(*xCompare)(void*,int,const void*,int,const void*)
@@ -140992,11 +140962,11 @@
140992 }
140993
140994 /*
140995 ** Register a new collation sequence with the database handle db.
140996 */
140997 SQLITE_API int SQLITE_STDCALL sqlite3_create_collation_v2(
140998 sqlite3* db,
140999 const char *zName,
141000 int enc,
141001 void* pCtx,
141002 int(*xCompare)(void*,int,const void*,int,const void*),
@@ -141017,11 +140987,11 @@
141017
141018 #ifndef SQLITE_OMIT_UTF16
141019 /*
141020 ** Register a new collation sequence with the database handle db.
141021 */
141022 SQLITE_API int SQLITE_STDCALL sqlite3_create_collation16(
141023 sqlite3* db,
141024 const void *zName,
141025 int enc,
141026 void* pCtx,
141027 int(*xCompare)(void*,int,const void*,int,const void*)
@@ -141047,11 +141017,11 @@
141047
141048 /*
141049 ** Register a collation sequence factory callback with the database handle
141050 ** db. Replace any previously installed collation sequence factory.
141051 */
141052 SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed(
141053 sqlite3 *db,
141054 void *pCollNeededArg,
141055 void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*)
141056 ){
141057 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -141068,11 +141038,11 @@
141068 #ifndef SQLITE_OMIT_UTF16
141069 /*
141070 ** Register a collation sequence factory callback with the database handle
141071 ** db. Replace any previously installed collation sequence factory.
141072 */
141073 SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed16(
141074 sqlite3 *db,
141075 void *pCollNeededArg,
141076 void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*)
141077 ){
141078 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -141090,11 +141060,11 @@
141090 #ifndef SQLITE_OMIT_DEPRECATED
141091 /*
141092 ** This function is now an anachronism. It used to be used to recover from a
141093 ** malloc() failure, but SQLite now does this automatically.
141094 */
141095 SQLITE_API int SQLITE_STDCALL sqlite3_global_recover(void){
141096 return SQLITE_OK;
141097 }
141098 #endif
141099
141100 /*
@@ -141101,11 +141071,11 @@
141101 ** Test to see whether or not the database connection is in autocommit
141102 ** mode. Return TRUE if it is and FALSE if not. Autocommit mode is on
141103 ** by default. Autocommit is disabled by a BEGIN statement and reenabled
141104 ** by the next COMMIT or ROLLBACK.
141105 */
141106 SQLITE_API int SQLITE_STDCALL sqlite3_get_autocommit(sqlite3 *db){
141107 #ifdef SQLITE_ENABLE_API_ARMOR
141108 if( !sqlite3SafetyCheckOk(db) ){
141109 (void)SQLITE_MISUSE_BKPT;
141110 return 0;
141111 }
@@ -141158,19 +141128,19 @@
141158 ** data for this thread has been deallocated.
141159 **
141160 ** SQLite no longer uses thread-specific data so this routine is now a
141161 ** no-op. It is retained for historical compatibility.
141162 */
141163 SQLITE_API void SQLITE_STDCALL sqlite3_thread_cleanup(void){
141164 }
141165 #endif
141166
141167 /*
141168 ** Return meta information about a specific column of a database table.
141169 ** See comment in sqlite3.h (sqlite.h.in) for details.
141170 */
141171 SQLITE_API int SQLITE_STDCALL sqlite3_table_column_metadata(
141172 sqlite3 *db, /* Connection handle */
141173 const char *zDbName, /* Database name or NULL */
141174 const char *zTableName, /* Table name */
141175 const char *zColumnName, /* Column name */
141176 char const **pzDataType, /* OUTPUT: Declared data type */
@@ -141284,11 +141254,11 @@
141284 }
141285
141286 /*
141287 ** Sleep for a little while. Return the amount of time slept.
141288 */
141289 SQLITE_API int SQLITE_STDCALL sqlite3_sleep(int ms){
141290 sqlite3_vfs *pVfs;
141291 int rc;
141292 pVfs = sqlite3_vfs_find(0);
141293 if( pVfs==0 ) return 0;
141294
@@ -141300,11 +141270,11 @@
141300 }
141301
141302 /*
141303 ** Enable or disable the extended result codes.
141304 */
141305 SQLITE_API int SQLITE_STDCALL sqlite3_extended_result_codes(sqlite3 *db, int onoff){
141306 #ifdef SQLITE_ENABLE_API_ARMOR
141307 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
141308 #endif
141309 sqlite3_mutex_enter(db->mutex);
141310 db->errMask = onoff ? 0xffffffff : 0xff;
@@ -141313,11 +141283,11 @@
141313 }
141314
141315 /*
141316 ** Invoke the xFileControl method on a particular database.
141317 */
141318 SQLITE_API int SQLITE_STDCALL sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){
141319 int rc = SQLITE_ERROR;
141320 Btree *pBtree;
141321
141322 #ifdef SQLITE_ENABLE_API_ARMOR
141323 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
@@ -141353,11 +141323,11 @@
141353 }
141354
141355 /*
141356 ** Interface to the testing logic.
141357 */
141358 SQLITE_API int SQLITE_CDECL sqlite3_test_control(int op, ...){
141359 int rc = 0;
141360 #ifdef SQLITE_OMIT_BUILTIN_TEST
141361 UNUSED_PARAMETER(op);
141362 #else
141363 va_list ap;
@@ -141621,10 +141591,19 @@
141621 case SQLITE_TESTCTRL_NEVER_CORRUPT: {
141622 sqlite3GlobalConfig.neverCorrupt = va_arg(ap, int);
141623 break;
141624 }
141625
 
 
 
 
 
 
 
 
 
141626
141627 /* sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE, xCallback, ptr);
141628 **
141629 ** Set the VDBE coverage callback function to xCallback with context
141630 ** pointer ptr.
@@ -141698,11 +141677,11 @@
141698 ** method of a VFS implementation. The zParam argument is the name of the
141699 ** query parameter we seek. This routine returns the value of the zParam
141700 ** parameter if it exists. If the parameter does not exist, this routine
141701 ** returns a NULL pointer.
141702 */
141703 SQLITE_API const char *SQLITE_STDCALL sqlite3_uri_parameter(const char *zFilename, const char *zParam){
141704 if( zFilename==0 || zParam==0 ) return 0;
141705 zFilename += sqlite3Strlen30(zFilename) + 1;
141706 while( zFilename[0] ){
141707 int x = strcmp(zFilename, zParam);
141708 zFilename += sqlite3Strlen30(zFilename) + 1;
@@ -141713,20 +141692,20 @@
141713 }
141714
141715 /*
141716 ** Return a boolean value for a query parameter.
141717 */
141718 SQLITE_API int SQLITE_STDCALL sqlite3_uri_boolean(const char *zFilename, const char *zParam, int bDflt){
141719 const char *z = sqlite3_uri_parameter(zFilename, zParam);
141720 bDflt = bDflt!=0;
141721 return z ? sqlite3GetBoolean(z, bDflt) : bDflt;
141722 }
141723
141724 /*
141725 ** Return a 64-bit integer value for a query parameter.
141726 */
141727 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_uri_int64(
141728 const char *zFilename, /* Filename as passed to xOpen */
141729 const char *zParam, /* URI parameter sought */
141730 sqlite3_int64 bDflt /* return if parameter is missing */
141731 ){
141732 const char *z = sqlite3_uri_parameter(zFilename, zParam);
@@ -141754,11 +141733,11 @@
141754
141755 /*
141756 ** Return the filename of the database associated with a database
141757 ** connection.
141758 */
141759 SQLITE_API const char *SQLITE_STDCALL sqlite3_db_filename(sqlite3 *db, const char *zDbName){
141760 Btree *pBt;
141761 #ifdef SQLITE_ENABLE_API_ARMOR
141762 if( !sqlite3SafetyCheckOk(db) ){
141763 (void)SQLITE_MISUSE_BKPT;
141764 return 0;
@@ -141770,11 +141749,11 @@
141770
141771 /*
141772 ** Return 1 if database is read-only or 0 if read/write. Return -1 if
141773 ** no such database exists.
141774 */
141775 SQLITE_API int SQLITE_STDCALL sqlite3_db_readonly(sqlite3 *db, const char *zDbName){
141776 Btree *pBt;
141777 #ifdef SQLITE_ENABLE_API_ARMOR
141778 if( !sqlite3SafetyCheckOk(db) ){
141779 (void)SQLITE_MISUSE_BKPT;
141780 return -1;
@@ -141787,11 +141766,11 @@
141787 #ifdef SQLITE_ENABLE_SNAPSHOT
141788 /*
141789 ** Obtain a snapshot handle for the snapshot of database zDb currently
141790 ** being read by handle db.
141791 */
141792 SQLITE_API int SQLITE_STDCALL sqlite3_snapshot_get(
141793 sqlite3 *db,
141794 const char *zDb,
141795 sqlite3_snapshot **ppSnapshot
141796 ){
141797 int rc = SQLITE_ERROR;
@@ -141822,11 +141801,11 @@
141822 }
141823
141824 /*
141825 ** Open a read-transaction on the snapshot idendified by pSnapshot.
141826 */
141827 SQLITE_API int SQLITE_STDCALL sqlite3_snapshot_open(
141828 sqlite3 *db,
141829 const char *zDb,
141830 sqlite3_snapshot *pSnapshot
141831 ){
141832 int rc = SQLITE_ERROR;
@@ -141859,11 +141838,11 @@
141859 }
141860
141861 /*
141862 ** Free a snapshot handle obtained from sqlite3_snapshot_get().
141863 */
141864 SQLITE_API void SQLITE_STDCALL sqlite3_snapshot_free(sqlite3_snapshot *pSnapshot){
141865 sqlite3_free(pSnapshot);
141866 }
141867 #endif /* SQLITE_ENABLE_SNAPSHOT */
141868
141869 /************** End of main.c ************************************************/
@@ -142013,11 +141992,11 @@
142013 **
142014 ** Each call to this routine overrides any prior callbacks registered
142015 ** on the same "db". If xNotify==0 then any prior callbacks are immediately
142016 ** cancelled.
142017 */
142018 SQLITE_API int SQLITE_STDCALL sqlite3_unlock_notify(
142019 sqlite3 *db,
142020 void (*xNotify)(void **, int),
142021 void *pArg
142022 ){
142023 int rc = SQLITE_OK;
@@ -149016,11 +148995,11 @@
149016 ** Initialize API pointer table, if required.
149017 */
149018 #ifdef _WIN32
149019 __declspec(dllexport)
149020 #endif
149021 SQLITE_API int SQLITE_STDCALL sqlite3_fts3_init(
149022 sqlite3 *db,
149023 char **pzErrMsg,
149024 const sqlite3_api_routines *pApi
149025 ){
149026 SQLITE_EXTENSION_INIT2(pApi)
@@ -164817,11 +164796,11 @@
164817 }
164818
164819 /*
164820 ** Register a new geometry function for use with the r-tree MATCH operator.
164821 */
164822 SQLITE_API int SQLITE_STDCALL sqlite3_rtree_geometry_callback(
164823 sqlite3 *db, /* Register SQL function on this connection */
164824 const char *zGeom, /* Name of the new SQL function */
164825 int (*xGeom)(sqlite3_rtree_geometry*,int,RtreeDValue*,int*), /* Callback */
164826 void *pContext /* Extra data associated with the callback */
164827 ){
@@ -164841,11 +164820,11 @@
164841
164842 /*
164843 ** Register a new 2nd-generation geometry function for use with the
164844 ** r-tree MATCH operator.
164845 */
164846 SQLITE_API int SQLITE_STDCALL sqlite3_rtree_query_callback(
164847 sqlite3 *db, /* Register SQL function on this connection */
164848 const char *zQueryFunc, /* Name of new SQL function */
164849 int (*xQueryFunc)(sqlite3_rtree_query_info*), /* Callback */
164850 void *pContext, /* Extra data passed into the callback */
164851 void (*xDestructor)(void*) /* Destructor for the extra data */
@@ -164866,11 +164845,11 @@
164866
164867 #if !SQLITE_CORE
164868 #ifdef _WIN32
164869 __declspec(dllexport)
164870 #endif
164871 SQLITE_API int SQLITE_STDCALL sqlite3_rtree_init(
164872 sqlite3 *db,
164873 char **pzErrMsg,
164874 const sqlite3_api_routines *pApi
164875 ){
164876 SQLITE_EXTENSION_INIT2(pApi)
@@ -165417,11 +165396,11 @@
165417
165418 #if !SQLITE_CORE
165419 #ifdef _WIN32
165420 __declspec(dllexport)
165421 #endif
165422 SQLITE_API int SQLITE_STDCALL sqlite3_icu_init(
165423 sqlite3 *db,
165424 char **pzErrMsg,
165425 const sqlite3_api_routines *pApi
165426 ){
165427 SQLITE_EXTENSION_INIT2(pApi)
@@ -166097,11 +166076,11 @@
166097 ** IMPORTANT NOTE FOR ZIPVFS USERS: The RBU extension works with all of
166098 ** SQLite's built-in VFSs, including the multiplexor VFS. However it does
166099 ** not work out of the box with zipvfs. Refer to the comment describing
166100 ** the zipvfs_create_vfs() API below for details on using RBU with zipvfs.
166101 */
166102 SQLITE_API sqlite3rbu *SQLITE_STDCALL sqlite3rbu_open(
166103 const char *zTarget,
166104 const char *zRbu,
166105 const char *zState
166106 );
166107
@@ -166136,11 +166115,11 @@
166136 ** As with sqlite3rbu_open(), Zipvfs users should rever to the comment
166137 ** describing the sqlite3rbu_create_vfs() API function below for
166138 ** a description of the complications associated with using RBU with
166139 ** zipvfs databases.
166140 */
166141 SQLITE_API sqlite3rbu *SQLITE_STDCALL sqlite3rbu_vacuum(
166142 const char *zTarget,
166143 const char *zState
166144 );
166145
166146 /*
@@ -166172,11 +166151,11 @@
166172 ** when sqlite3rbu_close() is called.
166173 **
166174 ** Database handles returned by this function remain valid until the next
166175 ** call to any sqlite3rbu_xxx() function other than sqlite3rbu_db().
166176 */
166177 SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3rbu_db(sqlite3rbu*, int bRbu);
166178
166179 /*
166180 ** Do some work towards applying the RBU update to the target db.
166181 **
166182 ** Return SQLITE_DONE if the update has been completely applied, or
@@ -166186,11 +166165,11 @@
166186 **
166187 ** Once a call to sqlite3rbu_step() has returned a value other than
166188 ** SQLITE_OK, all subsequent calls on the same RBU handle are no-ops
166189 ** that immediately return the same value.
166190 */
166191 SQLITE_API int SQLITE_STDCALL sqlite3rbu_step(sqlite3rbu *pRbu);
166192
166193 /*
166194 ** Force RBU to save its state to disk.
166195 **
166196 ** If a power failure or application crash occurs during an update, following
@@ -166198,11 +166177,11 @@
166198 ** was last saved. In other words, from the most recent successful call to
166199 ** sqlite3rbu_close() or this function.
166200 **
166201 ** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
166202 */
166203 SQLITE_API int SQLITE_STDCALL sqlite3rbu_savestate(sqlite3rbu *pRbu);
166204
166205 /*
166206 ** Close an RBU handle.
166207 **
166208 ** If the RBU update has been completely applied, mark the RBU database
@@ -166218,18 +166197,18 @@
166218 **
166219 ** Otherwise, if no error occurs, this function returns SQLITE_OK if the
166220 ** update has been partially applied, or SQLITE_DONE if it has been
166221 ** completely applied.
166222 */
166223 SQLITE_API int SQLITE_STDCALL sqlite3rbu_close(sqlite3rbu *pRbu, char **pzErrmsg);
166224
166225 /*
166226 ** Return the total number of key-value operations (inserts, deletes or
166227 ** updates) that have been performed on the target database since the
166228 ** current RBU update was started.
166229 */
166230 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3rbu_progress(sqlite3rbu *pRbu);
166231
166232 /*
166233 ** Obtain permyriadage (permyriadage is to 10000 as percentage is to 100)
166234 ** progress indications for the two stages of an RBU update. This API may
166235 ** be useful for driving GUI progress indicators and similar.
@@ -166267,11 +166246,11 @@
166267 ** permyriadage progress of the same stage. If the rbu_count table does
166268 ** not exist, then (*pnOne) is set to -1 during stage 1. If the rbu_count
166269 ** table exists but is not correctly populated, the value of the *pnOne
166270 ** output variable during stage 1 is undefined.
166271 */
166272 SQLITE_API void SQLITE_STDCALL sqlite3rbu_bp_progress(sqlite3rbu *pRbu, int *pnOne, int *pnTwo);
166273
166274 /*
166275 ** Obtain an indication as to the current stage of an RBU update or vacuum.
166276 ** This function always returns one of the SQLITE_RBU_STATE_XXX constants
166277 ** defined in this file. Return values should be interpreted as follows:
@@ -166305,11 +166284,11 @@
166305 #define SQLITE_RBU_STATE_MOVE 2
166306 #define SQLITE_RBU_STATE_CHECKPOINT 3
166307 #define SQLITE_RBU_STATE_DONE 4
166308 #define SQLITE_RBU_STATE_ERROR 5
166309
166310 SQLITE_API int SQLITE_STDCALL sqlite3rbu_state(sqlite3rbu *pRbu);
166311
166312 /*
166313 ** Create an RBU VFS named zName that accesses the underlying file-system
166314 ** via existing VFS zParent. Or, if the zParent parameter is passed NULL,
166315 ** then the new RBU VFS uses the default system VFS to access the file-system.
@@ -166349,21 +166328,21 @@
166349 ** The overhead of adding the "rbu" VFS to the system is negligible for
166350 ** non-RBU users. There is no harm in an application accessing the
166351 ** file-system via "rbu" all the time, even if it only uses RBU functionality
166352 ** occasionally.
166353 */
166354 SQLITE_API int SQLITE_STDCALL sqlite3rbu_create_vfs(const char *zName, const char *zParent);
166355
166356 /*
166357 ** Deregister and destroy an RBU vfs created by an earlier call to
166358 ** sqlite3rbu_create_vfs().
166359 **
166360 ** VFS objects are not reference counted. If a VFS object is destroyed
166361 ** before all database handles that use it have been closed, the results
166362 ** are undefined.
166363 */
166364 SQLITE_API void SQLITE_STDCALL sqlite3rbu_destroy_vfs(const char *zName);
166365
166366 #if 0
166367 } /* end of the 'extern "C"' block */
166368 #endif
166369
@@ -169456,11 +169435,11 @@
169456 }
169457
169458 /*
169459 ** Step the RBU object.
169460 */
169461 SQLITE_API int SQLITE_STDCALL sqlite3rbu_step(sqlite3rbu *p){
169462 if( p ){
169463 switch( p->eStage ){
169464 case RBU_STAGE_OAL: {
169465 RbuObjIter *pIter = &p->objiter;
169466
@@ -169910,11 +169889,11 @@
169910 }
169911
169912 /*
169913 ** Open and return a new RBU handle.
169914 */
169915 SQLITE_API sqlite3rbu *SQLITE_STDCALL sqlite3rbu_open(
169916 const char *zTarget,
169917 const char *zRbu,
169918 const char *zState
169919 ){
169920 if( zTarget==0 || zRbu==0 ){ return rbuMisuseError(); }
@@ -169923,11 +169902,11 @@
169923 }
169924
169925 /*
169926 ** Open a handle to begin or resume an RBU VACUUM operation.
169927 */
169928 SQLITE_API sqlite3rbu *SQLITE_STDCALL sqlite3rbu_vacuum(
169929 const char *zTarget,
169930 const char *zState
169931 ){
169932 if( zTarget==0 ){ return rbuMisuseError(); }
169933 /* TODO: Check that both arguments are non-NULL */
@@ -169935,11 +169914,11 @@
169935 }
169936
169937 /*
169938 ** Return the database handle used by pRbu.
169939 */
169940 SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3rbu_db(sqlite3rbu *pRbu, int bRbu){
169941 sqlite3 *db = 0;
169942 if( pRbu ){
169943 db = (bRbu ? pRbu->dbRbu : pRbu->dbMain);
169944 }
169945 return db;
@@ -169967,11 +169946,11 @@
169967 }
169968
169969 /*
169970 ** Close the RBU handle.
169971 */
169972 SQLITE_API int SQLITE_STDCALL sqlite3rbu_close(sqlite3rbu *p, char **pzErrmsg){
169973 int rc;
169974 if( p ){
169975
169976 /* Commit the transaction to the *-oal file. */
169977 if( p->rc==SQLITE_OK && p->eStage==RBU_STAGE_OAL ){
@@ -170019,19 +169998,19 @@
170019 /*
170020 ** Return the total number of key-value operations (inserts, deletes or
170021 ** updates) that have been performed on the target database since the
170022 ** current RBU update was started.
170023 */
170024 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3rbu_progress(sqlite3rbu *pRbu){
170025 return pRbu->nProgress;
170026 }
170027
170028 /*
170029 ** Return permyriadage progress indications for the two main stages of
170030 ** an RBU update.
170031 */
170032 SQLITE_API void SQLITE_STDCALL sqlite3rbu_bp_progress(sqlite3rbu *p, int *pnOne, int *pnTwo){
170033 const int MAX_PROGRESS = 10000;
170034 switch( p->eStage ){
170035 case RBU_STAGE_OAL:
170036 if( p->nPhaseOneStep>0 ){
170037 *pnOne = (int)(MAX_PROGRESS * (i64)p->nProgress/(i64)p->nPhaseOneStep);
@@ -170062,11 +170041,11 @@
170062 }
170063
170064 /*
170065 ** Return the current state of the RBU vacuum or update operation.
170066 */
170067 SQLITE_API int SQLITE_STDCALL sqlite3rbu_state(sqlite3rbu *p){
170068 int aRes[] = {
170069 0, SQLITE_RBU_STATE_OAL, SQLITE_RBU_STATE_MOVE,
170070 0, SQLITE_RBU_STATE_CHECKPOINT, SQLITE_RBU_STATE_DONE
170071 };
170072
@@ -170090,11 +170069,11 @@
170090 );
170091 return aRes[p->eStage];
170092 }
170093 }
170094
170095 SQLITE_API int SQLITE_STDCALL sqlite3rbu_savestate(sqlite3rbu *p){
170096 int rc = p->rc;
170097 if( rc==SQLITE_DONE ) return SQLITE_OK;
170098
170099 assert( p->eStage>=RBU_STAGE_OAL && p->eStage<=RBU_STAGE_DONE );
170100 if( p->eStage==RBU_STAGE_OAL ){
@@ -170917,11 +170896,11 @@
170917
170918 /*
170919 ** Deregister and destroy an RBU vfs created by an earlier call to
170920 ** sqlite3rbu_create_vfs().
170921 */
170922 SQLITE_API void SQLITE_STDCALL sqlite3rbu_destroy_vfs(const char *zName){
170923 sqlite3_vfs *pVfs = sqlite3_vfs_find(zName);
170924 if( pVfs && pVfs->xOpen==rbuVfsOpen ){
170925 sqlite3_mutex_free(((rbu_vfs*)pVfs)->mutex);
170926 sqlite3_vfs_unregister(pVfs);
170927 sqlite3_free(pVfs);
@@ -170931,11 +170910,11 @@
170931 /*
170932 ** Create an RBU VFS named zName that accesses the underlying file-system
170933 ** via existing VFS zParent. The new object is registered as a non-default
170934 ** VFS with SQLite before returning.
170935 */
170936 SQLITE_API int SQLITE_STDCALL sqlite3rbu_create_vfs(const char *zName, const char *zParent){
170937
170938 /* Template for VFS */
170939 static sqlite3_vfs vfs_template = {
170940 1, /* iVersion */
170941 0, /* szOsFile */
@@ -173176,11 +173155,11 @@
173176 }
173177
173178 return rc;
173179 }
173180
173181 SQLITE_API int SQLITE_STDCALL sqlite3session_diff(
173182 sqlite3_session *pSession,
173183 const char *zFrom,
173184 const char *zTbl,
173185 char **pzErrMsg
173186 ){
@@ -173270,11 +173249,11 @@
173270
173271 /*
173272 ** Create a session object. This session object will record changes to
173273 ** database zDb attached to connection db.
173274 */
173275 SQLITE_API int SQLITE_STDCALL sqlite3session_create(
173276 sqlite3 *db, /* Database handle */
173277 const char *zDb, /* Name of db (e.g. "main") */
173278 sqlite3_session **ppSession /* OUT: New session object */
173279 ){
173280 sqlite3_session *pNew; /* Newly allocated session object */
@@ -173332,11 +173311,11 @@
173332 }
173333
173334 /*
173335 ** Delete a session object previously allocated using sqlite3session_create().
173336 */
173337 SQLITE_API void SQLITE_STDCALL sqlite3session_delete(sqlite3_session *pSession){
173338 sqlite3 *db = pSession->db;
173339 sqlite3_session *pHead;
173340 sqlite3_session **pp;
173341
173342 /* Unlink the session from the linked list of sessions attached to the
@@ -173361,11 +173340,11 @@
173361 }
173362
173363 /*
173364 ** Set a table filter on a Session Object.
173365 */
173366 SQLITE_API void SQLITE_STDCALL sqlite3session_table_filter(
173367 sqlite3_session *pSession,
173368 int(*xFilter)(void*, const char*),
173369 void *pCtx /* First argument passed to xFilter */
173370 ){
173371 pSession->bAutoAttach = 1;
@@ -173379,11 +173358,11 @@
173379 **
173380 ** Only tables that have a PRIMARY KEY defined may be attached. It does
173381 ** not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias)
173382 ** or not.
173383 */
173384 SQLITE_API int SQLITE_STDCALL sqlite3session_attach(
173385 sqlite3_session *pSession, /* Session object */
173386 const char *zName /* Table name */
173387 ){
173388 int rc = SQLITE_OK;
173389 sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db));
@@ -174069,11 +174048,11 @@
174069 ** session object passed as the first argument.
174070 **
174071 ** It is the responsibility of the caller to eventually free the buffer
174072 ** using sqlite3_free().
174073 */
174074 SQLITE_API int SQLITE_STDCALL sqlite3session_changeset(
174075 sqlite3_session *pSession, /* Session object */
174076 int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
174077 void **ppChangeset /* OUT: Buffer containing changeset */
174078 ){
174079 return sessionGenerateChangeset(pSession, 0, 0, 0, pnChangeset, ppChangeset);
@@ -174080,11 +174059,11 @@
174080 }
174081
174082 /*
174083 ** Streaming version of sqlite3session_changeset().
174084 */
174085 SQLITE_API int SQLITE_STDCALL sqlite3session_changeset_strm(
174086 sqlite3_session *pSession,
174087 int (*xOutput)(void *pOut, const void *pData, int nData),
174088 void *pOut
174089 ){
174090 return sessionGenerateChangeset(pSession, 0, xOutput, pOut, 0, 0);
@@ -174091,11 +174070,11 @@
174091 }
174092
174093 /*
174094 ** Streaming version of sqlite3session_patchset().
174095 */
174096 SQLITE_API int SQLITE_STDCALL sqlite3session_patchset_strm(
174097 sqlite3_session *pSession,
174098 int (*xOutput)(void *pOut, const void *pData, int nData),
174099 void *pOut
174100 ){
174101 return sessionGenerateChangeset(pSession, 1, xOutput, pOut, 0, 0);
@@ -174106,11 +174085,11 @@
174106 ** session object passed as the first argument.
174107 **
174108 ** It is the responsibility of the caller to eventually free the buffer
174109 ** using sqlite3_free().
174110 */
174111 SQLITE_API int SQLITE_STDCALL sqlite3session_patchset(
174112 sqlite3_session *pSession, /* Session object */
174113 int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */
174114 void **ppPatchset /* OUT: Buffer containing changeset */
174115 ){
174116 return sessionGenerateChangeset(pSession, 1, 0, 0, pnPatchset, ppPatchset);
@@ -174117,11 +174096,11 @@
174117 }
174118
174119 /*
174120 ** Enable or disable the session object passed as the first argument.
174121 */
174122 SQLITE_API int SQLITE_STDCALL sqlite3session_enable(sqlite3_session *pSession, int bEnable){
174123 int ret;
174124 sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db));
174125 if( bEnable>=0 ){
174126 pSession->bEnable = bEnable;
174127 }
@@ -174131,11 +174110,11 @@
174131 }
174132
174133 /*
174134 ** Enable or disable the session object passed as the first argument.
174135 */
174136 SQLITE_API int SQLITE_STDCALL sqlite3session_indirect(sqlite3_session *pSession, int bIndirect){
174137 int ret;
174138 sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db));
174139 if( bIndirect>=0 ){
174140 pSession->bIndirect = bIndirect;
174141 }
@@ -174146,11 +174125,11 @@
174146
174147 /*
174148 ** Return true if there have been no changes to monitored tables recorded
174149 ** by the session object passed as the only argument.
174150 */
174151 SQLITE_API int SQLITE_STDCALL sqlite3session_isempty(sqlite3_session *pSession){
174152 int ret = 0;
174153 SessionTable *pTab;
174154
174155 sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db));
174156 for(pTab=pSession->pTable; pTab && ret==0; pTab=pTab->pNext){
@@ -174196,11 +174175,11 @@
174196 }
174197
174198 /*
174199 ** Create an iterator used to iterate through the contents of a changeset.
174200 */
174201 SQLITE_API int SQLITE_STDCALL sqlite3changeset_start(
174202 sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
174203 int nChangeset, /* Size of buffer pChangeset in bytes */
174204 void *pChangeset /* Pointer to buffer containing changeset */
174205 ){
174206 return sessionChangesetStart(pp, 0, 0, nChangeset, pChangeset);
@@ -174207,11 +174186,11 @@
174207 }
174208
174209 /*
174210 ** Streaming version of sqlite3changeset_start().
174211 */
174212 SQLITE_API int SQLITE_STDCALL sqlite3changeset_start_strm(
174213 sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
174214 int (*xInput)(void *pIn, void *pData, int *pnData),
174215 void *pIn
174216 ){
174217 return sessionChangesetStart(pp, xInput, pIn, 0, 0);
@@ -174628,20 +174607,20 @@
174628 ** or SQLITE_CORRUPT.
174629 **
174630 ** This function may not be called on iterators passed to a conflict handler
174631 ** callback by changeset_apply().
174632 */
174633 SQLITE_API int SQLITE_STDCALL sqlite3changeset_next(sqlite3_changeset_iter *p){
174634 return sessionChangesetNext(p, 0, 0);
174635 }
174636
174637 /*
174638 ** The following function extracts information on the current change
174639 ** from a changeset iterator. It may only be called after changeset_next()
174640 ** has returned SQLITE_ROW.
174641 */
174642 SQLITE_API int SQLITE_STDCALL sqlite3changeset_op(
174643 sqlite3_changeset_iter *pIter, /* Iterator handle */
174644 const char **pzTab, /* OUT: Pointer to table name */
174645 int *pnCol, /* OUT: Number of columns in table */
174646 int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */
174647 int *pbIndirect /* OUT: True if change is indirect */
@@ -174657,11 +174636,11 @@
174657 ** Return information regarding the PRIMARY KEY and number of columns in
174658 ** the database table affected by the change that pIter currently points
174659 ** to. This function may only be called after changeset_next() returns
174660 ** SQLITE_ROW.
174661 */
174662 SQLITE_API int SQLITE_STDCALL sqlite3changeset_pk(
174663 sqlite3_changeset_iter *pIter, /* Iterator object */
174664 unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */
174665 int *pnCol /* OUT: Number of entries in output array */
174666 ){
174667 *pabPK = pIter->abPK;
@@ -174680,11 +174659,11 @@
174680 ** was not modified and is not a PK column), set *ppValue to NULL.
174681 **
174682 ** If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is
174683 ** not modified. Otherwise, SQLITE_OK.
174684 */
174685 SQLITE_API int SQLITE_STDCALL sqlite3changeset_old(
174686 sqlite3_changeset_iter *pIter, /* Changeset iterator */
174687 int iVal, /* Index of old.* value to retrieve */
174688 sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */
174689 ){
174690 if( pIter->op!=SQLITE_UPDATE && pIter->op!=SQLITE_DELETE ){
@@ -174708,11 +174687,11 @@
174708 ** was not modified), set *ppValue to NULL.
174709 **
174710 ** If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is
174711 ** not modified. Otherwise, SQLITE_OK.
174712 */
174713 SQLITE_API int SQLITE_STDCALL sqlite3changeset_new(
174714 sqlite3_changeset_iter *pIter, /* Changeset iterator */
174715 int iVal, /* Index of new.* value to retrieve */
174716 sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */
174717 ){
174718 if( pIter->op!=SQLITE_UPDATE && pIter->op!=SQLITE_INSERT ){
@@ -174742,11 +174721,11 @@
174742 ** containing the iVal'th value of the conflicting record.
174743 **
174744 ** If value iVal is out-of-range or some other error occurs, an SQLite error
174745 ** code is returned. Otherwise, SQLITE_OK.
174746 */
174747 SQLITE_API int SQLITE_STDCALL sqlite3changeset_conflict(
174748 sqlite3_changeset_iter *pIter, /* Changeset iterator */
174749 int iVal, /* Index of conflict record value to fetch */
174750 sqlite3_value **ppValue /* OUT: Value from conflicting row */
174751 ){
174752 if( !pIter->pConflict ){
@@ -174765,11 +174744,11 @@
174765 ** it sets the output variable to the total number of known foreign key
174766 ** violations in the destination database and returns SQLITE_OK.
174767 **
174768 ** In all other cases this function returns SQLITE_MISUSE.
174769 */
174770 SQLITE_API int SQLITE_STDCALL sqlite3changeset_fk_conflicts(
174771 sqlite3_changeset_iter *pIter, /* Changeset iterator */
174772 int *pnOut /* OUT: Number of FK violations */
174773 ){
174774 if( pIter->pConflict || pIter->apValue ){
174775 return SQLITE_MISUSE;
@@ -174783,11 +174762,11 @@
174783 ** Finalize an iterator allocated with sqlite3changeset_start().
174784 **
174785 ** This function may not be called on iterators passed to a conflict handler
174786 ** callback by changeset_apply().
174787 */
174788 SQLITE_API int SQLITE_STDCALL sqlite3changeset_finalize(sqlite3_changeset_iter *p){
174789 int rc = SQLITE_OK;
174790 if( p ){
174791 int i; /* Used to iterate through p->apValue[] */
174792 rc = p->rc;
174793 if( p->apValue ){
@@ -174957,11 +174936,11 @@
174957
174958
174959 /*
174960 ** Invert a changeset object.
174961 */
174962 SQLITE_API int SQLITE_STDCALL sqlite3changeset_invert(
174963 int nChangeset, /* Number of bytes in input */
174964 const void *pChangeset, /* Input changeset */
174965 int *pnInverted, /* OUT: Number of bytes in output changeset */
174966 void **ppInverted /* OUT: Inverse of pChangeset */
174967 ){
@@ -174976,11 +174955,11 @@
174976 }
174977
174978 /*
174979 ** Streaming version of sqlite3changeset_invert().
174980 */
174981 SQLITE_API int SQLITE_STDCALL sqlite3changeset_invert_strm(
174982 int (*xInput)(void *pIn, void *pData, int *pnData),
174983 void *pIn,
174984 int (*xOutput)(void *pOut, const void *pData, int nData),
174985 void *pOut
174986 ){
@@ -175856,11 +175835,11 @@
175856 /*
175857 ** Apply the changeset passed via pChangeset/nChangeset to the main database
175858 ** attached to handle "db". Invoke the supplied conflict handler callback
175859 ** to resolve any conflicts encountered while applying the change.
175860 */
175861 SQLITE_API int SQLITE_STDCALL sqlite3changeset_apply(
175862 sqlite3 *db, /* Apply change to "main" db of this handle */
175863 int nChangeset, /* Size of changeset in bytes */
175864 void *pChangeset, /* Changeset blob */
175865 int(*xFilter)(
175866 void *pCtx, /* Copy of sixth arg to _apply() */
@@ -175884,11 +175863,11 @@
175884 /*
175885 ** Apply the changeset passed via xInput/pIn to the main database
175886 ** attached to handle "db". Invoke the supplied conflict handler callback
175887 ** to resolve any conflicts encountered while applying the change.
175888 */
175889 SQLITE_API int SQLITE_STDCALL sqlite3changeset_apply_strm(
175890 sqlite3 *db, /* Apply change to "main" db of this handle */
175891 int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
175892 void *pIn, /* First arg for xInput */
175893 int(*xFilter)(
175894 void *pCtx, /* Copy of sixth arg to _apply() */
@@ -176219,11 +176198,11 @@
176219 }
176220
176221 /*
176222 ** Allocate a new, empty, sqlite3_changegroup.
176223 */
176224 SQLITE_API int SQLITE_STDCALL sqlite3changegroup_new(sqlite3_changegroup **pp){
176225 int rc = SQLITE_OK; /* Return code */
176226 sqlite3_changegroup *p; /* New object */
176227 p = (sqlite3_changegroup*)sqlite3_malloc(sizeof(sqlite3_changegroup));
176228 if( p==0 ){
176229 rc = SQLITE_NOMEM;
@@ -176236,11 +176215,11 @@
176236
176237 /*
176238 ** Add the changeset currently stored in buffer pData, size nData bytes,
176239 ** to changeset-group p.
176240 */
176241 SQLITE_API int SQLITE_STDCALL sqlite3changegroup_add(sqlite3_changegroup *pGrp, int nData, void *pData){
176242 sqlite3_changeset_iter *pIter; /* Iterator opened on pData/nData */
176243 int rc; /* Return code */
176244
176245 rc = sqlite3changeset_start(&pIter, nData, pData);
176246 if( rc==SQLITE_OK ){
@@ -176252,11 +176231,11 @@
176252
176253 /*
176254 ** Obtain a buffer containing a changeset representing the concatenation
176255 ** of all changesets added to the group so far.
176256 */
176257 SQLITE_API int SQLITE_STDCALL sqlite3changegroup_output(
176258 sqlite3_changegroup *pGrp,
176259 int *pnData,
176260 void **ppData
176261 ){
176262 return sessionChangegroupOutput(pGrp, 0, 0, pnData, ppData);
@@ -176263,11 +176242,11 @@
176263 }
176264
176265 /*
176266 ** Streaming versions of changegroup_add().
176267 */
176268 SQLITE_API int SQLITE_STDCALL sqlite3changegroup_add_strm(
176269 sqlite3_changegroup *pGrp,
176270 int (*xInput)(void *pIn, void *pData, int *pnData),
176271 void *pIn
176272 ){
176273 sqlite3_changeset_iter *pIter; /* Iterator opened on pData/nData */
@@ -176282,11 +176261,11 @@
176282 }
176283
176284 /*
176285 ** Streaming versions of changegroup_output().
176286 */
176287 SQLITE_API int SQLITE_STDCALL sqlite3changegroup_output_strm(
176288 sqlite3_changegroup *pGrp,
176289 int (*xOutput)(void *pOut, const void *pData, int nData),
176290 void *pOut
176291 ){
176292 return sessionChangegroupOutput(pGrp, xOutput, pOut, 0, 0);
@@ -176293,21 +176272,21 @@
176293 }
176294
176295 /*
176296 ** Delete a changegroup object.
176297 */
176298 SQLITE_API void SQLITE_STDCALL sqlite3changegroup_delete(sqlite3_changegroup *pGrp){
176299 if( pGrp ){
176300 sessionDeleteTable(pGrp->pList);
176301 sqlite3_free(pGrp);
176302 }
176303 }
176304
176305 /*
176306 ** Combine two changesets together.
176307 */
176308 SQLITE_API int SQLITE_STDCALL sqlite3changeset_concat(
176309 int nLeft, /* Number of bytes in lhs input */
176310 void *pLeft, /* Lhs input changeset */
176311 int nRight /* Number of bytes in rhs input */,
176312 void *pRight, /* Rhs input changeset */
176313 int *pnOut, /* OUT: Number of bytes in output changeset */
@@ -176332,11 +176311,11 @@
176332 }
176333
176334 /*
176335 ** Streaming version of sqlite3changeset_concat().
176336 */
176337 SQLITE_API int SQLITE_STDCALL sqlite3changeset_concat_strm(
176338 int (*xInputA)(void *pIn, void *pData, int *pnData),
176339 void *pInA,
176340 int (*xInputB)(void *pIn, void *pData, int *pnData),
176341 void *pInB,
176342 int (*xOutput)(void *pOut, const void *pData, int nData),
@@ -178564,11 +178543,11 @@
178564
178565 #ifndef SQLITE_CORE
178566 #ifdef _WIN32
178567 __declspec(dllexport)
178568 #endif
178569 SQLITE_API int SQLITE_STDCALL sqlite3_json_init(
178570 sqlite3 *db,
178571 char **pzErrMsg,
178572 const sqlite3_api_routines *pApi
178573 ){
178574 SQLITE_EXTENSION_INIT2(pApi);
@@ -184048,18 +184027,18 @@
184048 Fts5ExprNode *pNode
184049 ){
184050 Fts5ExprNearset *pNear = pNode->pNear;
184051 int i, j;
184052 int rc = SQLITE_OK;
 
184053
184054 assert( pNode->bNomatch==0 );
184055 for(i=0; rc==SQLITE_OK && i<pNear->nPhrase; i++){
184056 Fts5ExprPhrase *pPhrase = pNear->apPhrase[i];
184057 for(j=0; j<pPhrase->nTerm; j++){
184058 Fts5ExprTerm *pTerm = &pPhrase->aTerm[j];
184059 Fts5ExprTerm *p;
184060 int bEof = 1;
184061
184062 for(p=pTerm; p && rc==SQLITE_OK; p=p->pSynonym){
184063 if( p->pIter ){
184064 sqlite3Fts5IterClose(p->pIter);
184065 p->pIter = 0;
@@ -184075,17 +184054,16 @@
184075 if( p->pIter && 0==sqlite3Fts5IterEof(p->pIter) ){
184076 bEof = 0;
184077 }
184078 }
184079
184080 if( bEof ){
184081 pNode->bEof = 1;
184082 return rc;
184083 }
184084 }
 
184085 }
184086
 
184087 return rc;
184088 }
184089
184090 /*
184091 ** If pExpr is an ASC iterator, this function returns a value with the
@@ -184932,11 +184910,10 @@
184932 int iPhrase,
184933 Fts5Expr **ppNew
184934 ){
184935 int rc = SQLITE_OK; /* Return code */
184936 Fts5ExprPhrase *pOrig; /* The phrase extracted from pExpr */
184937 int i; /* Used to iterate through phrase terms */
184938 Fts5Expr *pNew = 0; /* Expression to return via *ppNew */
184939 TokenCtx sCtx = {0,0}; /* Context object for fts5ParseTokenize */
184940
184941 pOrig = pExpr->apExprPhrase[iPhrase];
184942 pNew = (Fts5Expr*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Expr));
@@ -184962,22 +184939,29 @@
184962 }
184963 pNew->pRoot->pNear->pColset = pColset;
184964 }
184965 }
184966
184967 for(i=0; rc==SQLITE_OK && i<pOrig->nTerm; i++){
184968 int tflags = 0;
184969 Fts5ExprTerm *p;
184970 for(p=&pOrig->aTerm[i]; p && rc==SQLITE_OK; p=p->pSynonym){
184971 const char *zTerm = p->zTerm;
184972 rc = fts5ParseTokenize((void*)&sCtx, tflags, zTerm, (int)strlen(zTerm),
184973 0, 0);
184974 tflags = FTS5_TOKEN_COLOCATED;
184975 }
184976 if( rc==SQLITE_OK ){
184977 sCtx.pPhrase->aTerm[i].bPrefix = pOrig->aTerm[i].bPrefix;
184978 }
 
 
 
 
 
 
 
184979 }
184980
184981 if( rc==SQLITE_OK ){
184982 /* All the allocations succeeded. Put the expression object together. */
184983 pNew->pIndex = pExpr->pIndex;
@@ -195613,11 +195597,11 @@
195613 int nArg, /* Number of args */
195614 sqlite3_value **apUnused /* Function arguments */
195615 ){
195616 assert( nArg==0 );
195617 UNUSED_PARAM2(nArg, apUnused);
195618 sqlite3_result_text(pCtx, "fts5: 2016-09-10 14:43:07 8a9d128119fde36c175735be56876d30e5c8586f", -1, SQLITE_TRANSIENT);
195619 }
195620
195621 static int fts5Init(sqlite3 *db){
195622 static const sqlite3_module fts5Mod = {
195623 /* iVersion */ 2,
@@ -195701,11 +195685,11 @@
195701 */
195702 #ifndef SQLITE_CORE
195703 #ifdef _WIN32
195704 __declspec(dllexport)
195705 #endif
195706 SQLITE_API int SQLITE_STDCALL sqlite3_fts_init(
195707 sqlite3 *db,
195708 char **pzErrMsg,
195709 const sqlite3_api_routines *pApi
195710 ){
195711 SQLITE_EXTENSION_INIT2(pApi);
@@ -195714,11 +195698,11 @@
195714 }
195715
195716 #ifdef _WIN32
195717 __declspec(dllexport)
195718 #endif
195719 SQLITE_API int SQLITE_STDCALL sqlite3_fts5_init(
195720 sqlite3 *db,
195721 char **pzErrMsg,
195722 const sqlite3_api_routines *pApi
195723 ){
195724 SQLITE_EXTENSION_INIT2(pApi);
@@ -199095,12 +199079,23 @@
199095 pInfo->aConstraintUsage[iTermLe].argvIndex = ++nArg;
199096 pInfo->estimatedCost = pInfo->estimatedCost / 2;
199097 }
199098 }
199099
199100 pInfo->idxNum = idxNum;
 
 
 
 
 
 
 
 
 
 
199101
 
199102 return SQLITE_OK;
199103 }
199104
199105 /*
199106 ** Implementation of xOpen method.
199107
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,17 +1,17 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.15.0. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
9 **
10 ** This file is all you need to compile SQLite. To use SQLite in other
11 ** programs, you need this file and the "sqlite3.h" header file that defines
12 ** the programming interface to the SQLite library. (If you do not have
13 ** the "sqlite3.h" header file at hand, you will find a copy embedded within
14 ** the text of this file. Search for "Begin file sqlite3.h" to find the start
15 ** of the embedded sqlite3.h header file.) Additional code files may be needed
16 ** if you want a wrapper to interface SQLite with your choice of programming
17 ** language. The code for the "sqlite3" command-line shell is also in a
@@ -366,11 +366,12 @@
366 ** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
367 ** be larger than the release from which it is derived. Either Y will
368 ** be held constant and Z will be incremented or else Y will be incremented
369 ** and Z will be reset to zero.
370 **
371 ** Since [version 3.6.18] ([dateof:3.6.18]),
372 ** SQLite source code has been stored in the
373 ** <a href="http://www.fossil-scm.org/">Fossil configuration management
374 ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
375 ** a string which identifies a particular check-in of SQLite
376 ** within its configuration management system. ^The SQLITE_SOURCE_ID
377 ** string contains the date and time of the check-in (UTC) and an SHA1
@@ -380,11 +381,11 @@
381 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
382 ** [sqlite_version()] and [sqlite_source_id()].
383 */
384 #define SQLITE_VERSION "3.15.0"
385 #define SQLITE_VERSION_NUMBER 3015000
386 #define SQLITE_SOURCE_ID "2016-09-22 18:53:13 c3774c6a5fe48af91fda28e9e18c6ed9053ea992"
387
388 /*
389 ** CAPI3REF: Run-Time Library Version Numbers
390 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
391 **
@@ -413,13 +414,13 @@
414 ** [SQLITE_SOURCE_ID] C preprocessor macro.
415 **
416 ** See also: [sqlite_version()] and [sqlite_source_id()].
417 */
418 SQLITE_API const char sqlite3_version[] = SQLITE_VERSION;
419 SQLITE_API const char *sqlite3_libversion(void);
420 SQLITE_API const char *sqlite3_sourceid(void);
421 SQLITE_API int sqlite3_libversion_number(void);
422
423 /*
424 ** CAPI3REF: Run-Time Library Compilation Options Diagnostics
425 **
426 ** ^The sqlite3_compileoption_used() function returns 0 or 1
@@ -440,12 +441,12 @@
441 **
442 ** See also: SQL functions [sqlite_compileoption_used()] and
443 ** [sqlite_compileoption_get()] and the [compile_options pragma].
444 */
445 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
446 SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
447 SQLITE_API const char *sqlite3_compileoption_get(int N);
448 #endif
449
450 /*
451 ** CAPI3REF: Test To See If The Library Is Threadsafe
452 **
@@ -480,11 +481,11 @@
481 ** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
482 ** is unchanged by calls to sqlite3_config().)^
483 **
484 ** See the [threading mode] documentation for additional information.
485 */
486 SQLITE_API int sqlite3_threadsafe(void);
487
488 /*
489 ** CAPI3REF: Database Connection Handle
490 ** KEYWORDS: {database connection} {database connections}
491 **
@@ -577,12 +578,12 @@
578 ** from [sqlite3_open()], [sqlite3_open16()], or
579 ** [sqlite3_open_v2()], and not previously closed.
580 ** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer
581 ** argument is a harmless no-op.
582 */
583 SQLITE_API int sqlite3_close(sqlite3*);
584 SQLITE_API int sqlite3_close_v2(sqlite3*);
585
586 /*
587 ** The type for a callback function.
588 ** This is legacy and deprecated. It is included for historical
589 ** compatibility and is not documented.
@@ -649,11 +650,11 @@
650 ** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
651 ** <li> The application must not modify the SQL statement text passed into
652 ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
653 ** </ul>
654 */
655 SQLITE_API int sqlite3_exec(
656 sqlite3*, /* An open database */
657 const char *sql, /* SQL to be evaluated */
658 int (*callback)(void*,int,char**,char**), /* Callback function */
659 void *, /* 1st argument to callback */
660 char **errmsg /* Error msg written here */
@@ -710,11 +711,12 @@
711 **
712 ** In its default configuration, SQLite API routines return one of 30 integer
713 ** [result codes]. However, experience has shown that many of
714 ** these result codes are too coarse-grained. They do not provide as
715 ** much information about problems as programmers might like. In an effort to
716 ** address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]
717 ** and later) include
718 ** support for additional result codes that provide more detailed information
719 ** about errors. These [extended result codes] are enabled or disabled
720 ** on a per database connection basis using the
721 ** [sqlite3_extended_result_codes()] API. Or, the extended code for
722 ** the most recent error can be obtained using
@@ -1648,14 +1650,14 @@
1650 ** sqlite3_os_init() and sqlite3_os_end(). An application-supplied
1651 ** implementation of sqlite3_os_init() or sqlite3_os_end()
1652 ** must return [SQLITE_OK] on success and some other [error code] upon
1653 ** failure.
1654 */
1655 SQLITE_API int sqlite3_initialize(void);
1656 SQLITE_API int sqlite3_shutdown(void);
1657 SQLITE_API int sqlite3_os_init(void);
1658 SQLITE_API int sqlite3_os_end(void);
1659
1660 /*
1661 ** CAPI3REF: Configuring The SQLite Library
1662 **
1663 ** The sqlite3_config() interface is used to make global configuration
@@ -1684,11 +1686,11 @@
1686 **
1687 ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
1688 ** ^If the option is unknown or SQLite is unable to set the option
1689 ** then this routine returns a non-zero [error code].
1690 */
1691 SQLITE_API int sqlite3_config(int, ...);
1692
1693 /*
1694 ** CAPI3REF: Configure database connections
1695 ** METHOD: sqlite3
1696 **
@@ -1703,11 +1705,11 @@
1705 ** Subsequent arguments vary depending on the configuration verb.
1706 **
1707 ** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
1708 ** the call is considered successful.
1709 */
1710 SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...);
1711
1712 /*
1713 ** CAPI3REF: Memory Allocation Routines
1714 **
1715 ** An instance of this object defines the interface between SQLite
@@ -2254,11 +2256,11 @@
2256 **
2257 ** ^The sqlite3_extended_result_codes() routine enables or disables the
2258 ** [extended result codes] feature of SQLite. ^The extended result
2259 ** codes are disabled by default for historical compatibility.
2260 */
2261 SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);
2262
2263 /*
2264 ** CAPI3REF: Last Insert Rowid
2265 ** METHOD: sqlite3
2266 **
@@ -2306,11 +2308,11 @@
2308 ** function is running and thus changes the last insert [rowid],
2309 ** then the value returned by [sqlite3_last_insert_rowid()] is
2310 ** unpredictable and might not equal either the old or the new
2311 ** last insert [rowid].
2312 */
2313 SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
2314
2315 /*
2316 ** CAPI3REF: Count The Number Of Rows Modified
2317 ** METHOD: sqlite3
2318 **
@@ -2359,11 +2361,11 @@
2361 **
2362 ** If a separate thread makes changes on the same database connection
2363 ** while [sqlite3_changes()] is running then the value returned
2364 ** is unpredictable and not meaningful.
2365 */
2366 SQLITE_API int sqlite3_changes(sqlite3*);
2367
2368 /*
2369 ** CAPI3REF: Total Number Of Rows Modified
2370 ** METHOD: sqlite3
2371 **
@@ -2383,11 +2385,11 @@
2385 **
2386 ** If a separate thread makes changes on the same database connection
2387 ** while [sqlite3_total_changes()] is running then the value
2388 ** returned is unpredictable and not meaningful.
2389 */
2390 SQLITE_API int sqlite3_total_changes(sqlite3*);
2391
2392 /*
2393 ** CAPI3REF: Interrupt A Long-Running Query
2394 ** METHOD: sqlite3
2395 **
@@ -2423,11 +2425,11 @@
2425 ** that are started after the sqlite3_interrupt() call returns.
2426 **
2427 ** If the database connection closes while [sqlite3_interrupt()]
2428 ** is running then bad things will likely happen.
2429 */
2430 SQLITE_API void sqlite3_interrupt(sqlite3*);
2431
2432 /*
2433 ** CAPI3REF: Determine If An SQL Statement Is Complete
2434 **
2435 ** These routines are useful during command-line input to determine if the
@@ -2458,12 +2460,12 @@
2460 ** UTF-8 string.
2461 **
2462 ** The input to [sqlite3_complete16()] must be a zero-terminated
2463 ** UTF-16 string in native byte order.
2464 */
2465 SQLITE_API int sqlite3_complete(const char *sql);
2466 SQLITE_API int sqlite3_complete16(const void *sql);
2467
2468 /*
2469 ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
2470 ** KEYWORDS: {busy-handler callback} {busy handler}
2471 ** METHOD: sqlite3
@@ -2520,11 +2522,11 @@
2522 ** result in undefined behavior.
2523 **
2524 ** A busy handler must not close the database connection
2525 ** or [prepared statement] that invoked the busy handler.
2526 */
2527 SQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
2528
2529 /*
2530 ** CAPI3REF: Set A Busy Timeout
2531 ** METHOD: sqlite3
2532 **
@@ -2543,11 +2545,11 @@
2545 ** was defined (using [sqlite3_busy_handler()]) prior to calling
2546 ** this routine, that other busy handler is cleared.)^
2547 **
2548 ** See also: [PRAGMA busy_timeout]
2549 */
2550 SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
2551
2552 /*
2553 ** CAPI3REF: Convenience Routines For Running Queries
2554 ** METHOD: sqlite3
2555 **
@@ -2618,19 +2620,19 @@
2620 ** interface defined here. As a consequence, errors that occur in the
2621 ** wrapper layer outside of the internal [sqlite3_exec()] call are not
2622 ** reflected in subsequent calls to [sqlite3_errcode()] or
2623 ** [sqlite3_errmsg()].
2624 */
2625 SQLITE_API int sqlite3_get_table(
2626 sqlite3 *db, /* An open database */
2627 const char *zSql, /* SQL to be evaluated */
2628 char ***pazResult, /* Results of the query */
2629 int *pnRow, /* Number of result rows written here */
2630 int *pnColumn, /* Number of result columns written here */
2631 char **pzErrmsg /* Error msg written here */
2632 );
2633 SQLITE_API void sqlite3_free_table(char **result);
2634
2635 /*
2636 ** CAPI3REF: Formatted String Printing Functions
2637 **
2638 ** These routines are work-alikes of the "printf()" family of functions
@@ -2732,14 +2734,14 @@
2734 **
2735 ** ^(The "%z" formatting option works like "%s" but with the
2736 ** addition that after the string has been read and copied into
2737 ** the result, [sqlite3_free()] is called on the input string.)^
2738 */
2739 SQLITE_API char *sqlite3_mprintf(const char*,...);
2740 SQLITE_API char *sqlite3_vmprintf(const char*, va_list);
2741 SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);
2742 SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
2743
2744 /*
2745 ** CAPI3REF: Memory Allocation Subsystem
2746 **
2747 ** The SQLite core uses these three routines for all of its own
@@ -2825,16 +2827,16 @@
2827 **
2828 ** The application must not read or write any part of
2829 ** a block of memory after it has been released using
2830 ** [sqlite3_free()] or [sqlite3_realloc()].
2831 */
2832 SQLITE_API void *sqlite3_malloc(int);
2833 SQLITE_API void *sqlite3_malloc64(sqlite3_uint64);
2834 SQLITE_API void *sqlite3_realloc(void*, int);
2835 SQLITE_API void *sqlite3_realloc64(void*, sqlite3_uint64);
2836 SQLITE_API void sqlite3_free(void*);
2837 SQLITE_API sqlite3_uint64 sqlite3_msize(void*);
2838
2839 /*
2840 ** CAPI3REF: Memory Allocator Statistics
2841 **
2842 ** SQLite provides these two interfaces for reporting on the status
@@ -2855,12 +2857,12 @@
2857 ** [sqlite3_memory_used()] if and only if the parameter to
2858 ** [sqlite3_memory_highwater()] is true. ^The value returned
2859 ** by [sqlite3_memory_highwater(1)] is the high-water mark
2860 ** prior to the reset.
2861 */
2862 SQLITE_API sqlite3_int64 sqlite3_memory_used(void);
2863 SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
2864
2865 /*
2866 ** CAPI3REF: Pseudo-Random Number Generator
2867 **
2868 ** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
@@ -2879,11 +2881,11 @@
2881 ** ^If the previous call to this routine had an N of 1 or more and a
2882 ** non-NULL P then the pseudo-randomness is generated
2883 ** internally and without recourse to the [sqlite3_vfs] xRandomness
2884 ** method.
2885 */
2886 SQLITE_API void sqlite3_randomness(int N, void *P);
2887
2888 /*
2889 ** CAPI3REF: Compile-Time Authorization Callbacks
2890 ** METHOD: sqlite3
2891 **
@@ -2962,11 +2964,11 @@
2964 ** [sqlite3_prepare()] or its variants. Authorization is not
2965 ** performed during statement evaluation in [sqlite3_step()], unless
2966 ** as stated in the previous paragraph, sqlite3_step() invokes
2967 ** sqlite3_prepare_v2() to reprepare a statement after a schema change.
2968 */
2969 SQLITE_API int sqlite3_set_authorizer(
2970 sqlite3*,
2971 int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
2972 void *pUserData
2973 );
2974
@@ -3070,13 +3072,13 @@
3072 ** digits in the time are meaningless. Future versions of SQLite
3073 ** might provide greater resolution on the profiler callback. The
3074 ** sqlite3_profile() function is considered experimental and is
3075 ** subject to change in future versions of SQLite.
3076 */
3077 SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*,
3078 void(*xTrace)(void*,const char*), void*);
3079 SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,
3080 void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
3081
3082 /*
3083 ** CAPI3REF: SQL Trace Event Codes
3084 ** KEYWORDS: SQLITE_TRACE
@@ -3161,11 +3163,11 @@
3163 **
3164 ** The sqlite3_trace_v2() interface is intended to replace the legacy
3165 ** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which
3166 ** are deprecated.
3167 */
3168 SQLITE_API int sqlite3_trace_v2(
3169 sqlite3*,
3170 unsigned uMask,
3171 int(*xCallback)(unsigned,void*,void*,void*),
3172 void *pCtx
3173 );
@@ -3200,11 +3202,11 @@
3202 ** the database connection that invoked the progress handler.
3203 ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
3204 ** database connections for the meaning of "modify" in this paragraph.
3205 **
3206 */
3207 SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
3208
3209 /*
3210 ** CAPI3REF: Opening A New Database Connection
3211 ** CONSTRUCTOR: sqlite3
3212 **
@@ -3429,19 +3431,19 @@
3431 ** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various
3432 ** features that require the use of temporary files may fail.
3433 **
3434 ** See also: [sqlite3_temp_directory]
3435 */
3436 SQLITE_API int sqlite3_open(
3437 const char *filename, /* Database filename (UTF-8) */
3438 sqlite3 **ppDb /* OUT: SQLite db handle */
3439 );
3440 SQLITE_API int sqlite3_open16(
3441 const void *filename, /* Database filename (UTF-16) */
3442 sqlite3 **ppDb /* OUT: SQLite db handle */
3443 );
3444 SQLITE_API int sqlite3_open_v2(
3445 const char *filename, /* Database filename (UTF-8) */
3446 sqlite3 **ppDb, /* OUT: SQLite db handle */
3447 int flags, /* Flags */
3448 const char *zVfs /* Name of VFS module to use */
3449 );
@@ -3483,13 +3485,13 @@
3485 ** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
3486 ** is not a database file pathname pointer that SQLite passed into the xOpen
3487 ** VFS method, then the behavior of this routine is undefined and probably
3488 ** undesirable.
3489 */
3490 SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
3491 SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
3492 SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
3493
3494
3495 /*
3496 ** CAPI3REF: Error Codes And Messages
3497 ** METHOD: sqlite3
@@ -3529,15 +3531,15 @@
3531 **
3532 ** If an interface fails with SQLITE_MISUSE, that means the interface
3533 ** was invoked incorrectly by the application. In that case, the
3534 ** error code and message may or may not be set.
3535 */
3536 SQLITE_API int sqlite3_errcode(sqlite3 *db);
3537 SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
3538 SQLITE_API const char *sqlite3_errmsg(sqlite3*);
3539 SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
3540 SQLITE_API const char *sqlite3_errstr(int);
3541
3542 /*
3543 ** CAPI3REF: Prepared Statement Object
3544 ** KEYWORDS: {prepared statement} {prepared statements}
3545 **
@@ -3601,11 +3603,11 @@
3603 ** created by an untrusted script can be contained using the
3604 ** [max_page_count] [PRAGMA].
3605 **
3606 ** New run-time limit categories may be added in future releases.
3607 */
3608 SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
3609
3610 /*
3611 ** CAPI3REF: Run-Time Limit Categories
3612 ** KEYWORDS: {limit category} {*limit categories}
3613 **
@@ -3753,32 +3755,32 @@
3755 ** or [GLOB] operator or if the parameter is compared to an indexed column
3756 ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
3757 ** </li>
3758 ** </ol>
3759 */
3760 SQLITE_API int sqlite3_prepare(
3761 sqlite3 *db, /* Database handle */
3762 const char *zSql, /* SQL statement, UTF-8 encoded */
3763 int nByte, /* Maximum length of zSql in bytes. */
3764 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3765 const char **pzTail /* OUT: Pointer to unused portion of zSql */
3766 );
3767 SQLITE_API int sqlite3_prepare_v2(
3768 sqlite3 *db, /* Database handle */
3769 const char *zSql, /* SQL statement, UTF-8 encoded */
3770 int nByte, /* Maximum length of zSql in bytes. */
3771 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3772 const char **pzTail /* OUT: Pointer to unused portion of zSql */
3773 );
3774 SQLITE_API int sqlite3_prepare16(
3775 sqlite3 *db, /* Database handle */
3776 const void *zSql, /* SQL statement, UTF-16 encoded */
3777 int nByte, /* Maximum length of zSql in bytes. */
3778 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3779 const void **pzTail /* OUT: Pointer to unused portion of zSql */
3780 );
3781 SQLITE_API int sqlite3_prepare16_v2(
3782 sqlite3 *db, /* Database handle */
3783 const void *zSql, /* SQL statement, UTF-16 encoded */
3784 int nByte, /* Maximum length of zSql in bytes. */
3785 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3786 const void **pzTail /* OUT: Pointer to unused portion of zSql */
@@ -3813,12 +3815,12 @@
3815 ** automatically freed when the prepared statement is finalized.
3816 ** ^The string returned by sqlite3_expanded_sql(P), on the other hand,
3817 ** is obtained from [sqlite3_malloc()] and must be free by the application
3818 ** by passing it to [sqlite3_free()].
3819 */
3820 SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
3821 SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt);
3822
3823 /*
3824 ** CAPI3REF: Determine If An SQL Statement Writes The Database
3825 ** METHOD: sqlite3_stmt
3826 **
@@ -3846,11 +3848,11 @@
3848 ** database. ^The [ATTACH] and [DETACH] statements also cause
3849 ** sqlite3_stmt_readonly() to return true since, while those statements
3850 ** change the configuration of a database connection, they do not make
3851 ** changes to the content of the database files on disk.
3852 */
3853 SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3854
3855 /*
3856 ** CAPI3REF: Determine If A Prepared Statement Has Been Reset
3857 ** METHOD: sqlite3_stmt
3858 **
@@ -3867,11 +3869,11 @@
3869 ** to locate all prepared statements associated with a database
3870 ** connection that are in need of being reset. This can be used,
3871 ** for example, in diagnostic routines to search for prepared
3872 ** statements that are holding a transaction open.
3873 */
3874 SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
3875
3876 /*
3877 ** CAPI3REF: Dynamically Typed Value Object
3878 ** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
3879 **
@@ -4031,24 +4033,24 @@
4033 ** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails.
4034 **
4035 ** See also: [sqlite3_bind_parameter_count()],
4036 ** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
4037 */
4038 SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
4039 SQLITE_API int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
4040 void(*)(void*));
4041 SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);
4042 SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int);
4043 SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
4044 SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);
4045 SQLITE_API int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
4046 SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
4047 SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
4048 void(*)(void*), unsigned char encoding);
4049 SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
4050 SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
4051 SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
4052
4053 /*
4054 ** CAPI3REF: Number Of SQL Parameters
4055 ** METHOD: sqlite3_stmt
4056 **
@@ -4065,11 +4067,11 @@
4067 **
4068 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
4069 ** [sqlite3_bind_parameter_name()], and
4070 ** [sqlite3_bind_parameter_index()].
4071 */
4072 SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);
4073
4074 /*
4075 ** CAPI3REF: Name Of A Host Parameter
4076 ** METHOD: sqlite3_stmt
4077 **
@@ -4093,11 +4095,11 @@
4095 **
4096 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
4097 ** [sqlite3_bind_parameter_count()], and
4098 ** [sqlite3_bind_parameter_index()].
4099 */
4100 SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
4101
4102 /*
4103 ** CAPI3REF: Index Of A Parameter With A Given Name
4104 ** METHOD: sqlite3_stmt
4105 **
@@ -4110,21 +4112,21 @@
4112 **
4113 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
4114 ** [sqlite3_bind_parameter_count()], and
4115 ** [sqlite3_bind_parameter_name()].
4116 */
4117 SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
4118
4119 /*
4120 ** CAPI3REF: Reset All Bindings On A Prepared Statement
4121 ** METHOD: sqlite3_stmt
4122 **
4123 ** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset
4124 ** the [sqlite3_bind_blob | bindings] on a [prepared statement].
4125 ** ^Use this routine to reset all host parameters to NULL.
4126 */
4127 SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);
4128
4129 /*
4130 ** CAPI3REF: Number Of Columns In A Result Set
4131 ** METHOD: sqlite3_stmt
4132 **
@@ -4132,11 +4134,11 @@
4134 ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
4135 ** statement that does not return data (for example an [UPDATE]).
4136 **
4137 ** See also: [sqlite3_data_count()]
4138 */
4139 SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
4140
4141 /*
4142 ** CAPI3REF: Column Names In A Result Set
4143 ** METHOD: sqlite3_stmt
4144 **
@@ -4161,12 +4163,12 @@
4163 ** ^The name of a result column is the value of the "AS" clause for
4164 ** that column, if there is an AS clause. If there is no AS clause
4165 ** then the name of the column is unspecified and may change from
4166 ** one release of SQLite to the next.
4167 */
4168 SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);
4169 SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
4170
4171 /*
4172 ** CAPI3REF: Source Of Data In A Query Result
4173 ** METHOD: sqlite3_stmt
4174 **
@@ -4210,16 +4212,16 @@
4212 ** If two or more threads call one or more
4213 ** [sqlite3_column_database_name | column metadata interfaces]
4214 ** for the same [prepared statement] and result column
4215 ** at the same time then the results are undefined.
4216 */
4217 SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);
4218 SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
4219 SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int);
4220 SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int);
4221 SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int);
4222 SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);
4223
4224 /*
4225 ** CAPI3REF: Declared Datatype Of A Query Result
4226 ** METHOD: sqlite3_stmt
4227 **
@@ -4247,12 +4249,12 @@
4249 ** data stored in that column is of the declared type. SQLite is
4250 ** strongly typed, but the typing is dynamic not static. ^Type
4251 ** is associated with individual values, not with the containers
4252 ** used to hold those values.
4253 */
4254 SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int);
4255 SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
4256
4257 /*
4258 ** CAPI3REF: Evaluate An SQL Statement
4259 ** METHOD: sqlite3_stmt
4260 **
@@ -4309,11 +4311,12 @@
4311 ** For all versions of SQLite up to and including 3.6.23.1, a call to
4312 ** [sqlite3_reset()] was required after sqlite3_step() returned anything
4313 ** other than [SQLITE_ROW] before any subsequent invocation of
4314 ** sqlite3_step(). Failure to reset the prepared statement using
4315 ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
4316 ** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
4317 ** sqlite3_step() began
4318 ** calling [sqlite3_reset()] automatically in this circumstance rather
4319 ** than returning [SQLITE_MISUSE]. This is not considered a compatibility
4320 ** break because any application that ever receives an SQLITE_MISUSE error
4321 ** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
4322 ** can be used to restore the legacy behavior.
@@ -4328,11 +4331,11 @@
4331 ** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
4332 ** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
4333 ** then the more specific [error codes] are returned directly
4334 ** by sqlite3_step(). The use of the "v2" interface is recommended.
4335 */
4336 SQLITE_API int sqlite3_step(sqlite3_stmt*);
4337
4338 /*
4339 ** CAPI3REF: Number of columns in a result set
4340 ** METHOD: sqlite3_stmt
4341 **
@@ -4349,11 +4352,11 @@
4352 ** where it always returns zero since each step of that multi-step
4353 ** pragma returns 0 columns of data.
4354 **
4355 ** See also: [sqlite3_column_count()]
4356 */
4357 SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
4358
4359 /*
4360 ** CAPI3REF: Fundamental Datatypes
4361 ** KEYWORDS: SQLITE_TEXT
4362 **
@@ -4539,20 +4542,20 @@
4542 ** of these routines, a default value is returned. The default value
4543 ** is either the integer 0, the floating point number 0.0, or a NULL
4544 ** pointer. Subsequent calls to [sqlite3_errcode()] will return
4545 ** [SQLITE_NOMEM].)^
4546 */
4547 SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
4548 SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
4549 SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
4550 SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
4551 SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
4552 SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
4553 SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
4554 SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
4555 SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
4556 SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
4557
4558 /*
4559 ** CAPI3REF: Destroy A Prepared Statement Object
4560 ** DESTRUCTOR: sqlite3_stmt
4561 **
@@ -4576,11 +4579,11 @@
4579 ** resource leaks. It is a grievous error for the application to try to use
4580 ** a prepared statement after it has been finalized. Any use of a prepared
4581 ** statement after it has been finalized can result in undefined and
4582 ** undesirable behavior such as segfaults and heap corruption.
4583 */
4584 SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
4585
4586 /*
4587 ** CAPI3REF: Reset A Prepared Statement Object
4588 ** METHOD: sqlite3_stmt
4589 **
@@ -4603,11 +4606,11 @@
4606 ** [sqlite3_reset(S)] returns an appropriate [error code].
4607 **
4608 ** ^The [sqlite3_reset(S)] interface does not change the values
4609 ** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
4610 */
4611 SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
4612
4613 /*
4614 ** CAPI3REF: Create Or Redefine SQL Functions
4615 ** KEYWORDS: {function creation routines}
4616 ** KEYWORDS: {application-defined SQL function}
@@ -4703,31 +4706,31 @@
4706 ** ^An application-defined function is permitted to call other
4707 ** SQLite interfaces. However, such calls must not
4708 ** close the database connection nor finalize or reset the prepared
4709 ** statement in which the function is running.
4710 */
4711 SQLITE_API int sqlite3_create_function(
4712 sqlite3 *db,
4713 const char *zFunctionName,
4714 int nArg,
4715 int eTextRep,
4716 void *pApp,
4717 void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
4718 void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4719 void (*xFinal)(sqlite3_context*)
4720 );
4721 SQLITE_API int sqlite3_create_function16(
4722 sqlite3 *db,
4723 const void *zFunctionName,
4724 int nArg,
4725 int eTextRep,
4726 void *pApp,
4727 void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
4728 void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4729 void (*xFinal)(sqlite3_context*)
4730 );
4731 SQLITE_API int sqlite3_create_function_v2(
4732 sqlite3 *db,
4733 const char *zFunctionName,
4734 int nArg,
4735 int eTextRep,
4736 void *pApp,
@@ -4769,16 +4772,16 @@
4772 ** to be supported. However, new applications should avoid
4773 ** the use of these functions. To encourage programmers to avoid
4774 ** these functions, we will not explain what they do.
4775 */
4776 #ifndef SQLITE_OMIT_DEPRECATED
4777 SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);
4778 SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);
4779 SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
4780 SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);
4781 SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
4782 SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
4783 void*,sqlite3_int64);
4784 #endif
4785
4786 /*
4787 ** CAPI3REF: Obtaining SQL Values
@@ -4824,22 +4827,22 @@
4827 ** or [sqlite3_value_text16()].
4828 **
4829 ** These routines must be called from the same thread as
4830 ** the SQL function that supplied the [sqlite3_value*] parameters.
4831 */
4832 SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
4833 SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
4834 SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
4835 SQLITE_API double sqlite3_value_double(sqlite3_value*);
4836 SQLITE_API int sqlite3_value_int(sqlite3_value*);
4837 SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
4838 SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
4839 SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
4840 SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
4841 SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
4842 SQLITE_API int sqlite3_value_type(sqlite3_value*);
4843 SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
4844
4845 /*
4846 ** CAPI3REF: Finding The Subtype Of SQL Values
4847 ** METHOD: sqlite3_value
4848 **
@@ -4851,11 +4854,11 @@
4854 **
4855 ** SQLite makes no use of subtype itself. It merely passes the subtype
4856 ** from the result of one [application-defined SQL function] into the
4857 ** input of another.
4858 */
4859 SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
4860
4861 /*
4862 ** CAPI3REF: Copy And Free SQL Values
4863 ** METHOD: sqlite3_value
4864 **
@@ -4867,12 +4870,12 @@
4870 **
4871 ** ^The sqlite3_value_free(V) interface frees an [sqlite3_value] object
4872 ** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
4873 ** then sqlite3_value_free(V) is a harmless no-op.
4874 */
4875 SQLITE_API sqlite3_value *sqlite3_value_dup(const sqlite3_value*);
4876 SQLITE_API void sqlite3_value_free(sqlite3_value*);
4877
4878 /*
4879 ** CAPI3REF: Obtain Aggregate Function Context
4880 ** METHOD: sqlite3_context
4881 **
@@ -4913,11 +4916,11 @@
4916 ** function.
4917 **
4918 ** This routine must be called from the same thread in which
4919 ** the aggregate SQL function is running.
4920 */
4921 SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
4922
4923 /*
4924 ** CAPI3REF: User Data For Functions
4925 ** METHOD: sqlite3_context
4926 **
@@ -4928,11 +4931,11 @@
4931 ** registered the application defined function.
4932 **
4933 ** This routine must be called from the same thread in which
4934 ** the application-defined function is running.
4935 */
4936 SQLITE_API void *sqlite3_user_data(sqlite3_context*);
4937
4938 /*
4939 ** CAPI3REF: Database Connection For Functions
4940 ** METHOD: sqlite3_context
4941 **
@@ -4940,11 +4943,11 @@
4943 ** the pointer to the [database connection] (the 1st parameter)
4944 ** of the [sqlite3_create_function()]
4945 ** and [sqlite3_create_function16()] routines that originally
4946 ** registered the application defined function.
4947 */
4948 SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
4949
4950 /*
4951 ** CAPI3REF: Function Auxiliary Data
4952 ** METHOD: sqlite3_context
4953 **
@@ -4994,12 +4997,12 @@
4997 ** values and [parameters] and expressions composed from the same.)^
4998 **
4999 ** These routines must be called from the same thread in which
5000 ** the SQL function is running.
5001 */
5002 SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);
5003 SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
5004
5005
5006 /*
5007 ** CAPI3REF: Constants Defining Special Destructor Behavior
5008 **
@@ -5131,31 +5134,31 @@
5134 **
5135 ** If these routines are called from within the different thread
5136 ** than the one containing the application-defined function that received
5137 ** the [sqlite3_context] pointer, the results are undefined.
5138 */
5139 SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
5140 SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,
5141 sqlite3_uint64,void(*)(void*));
5142 SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
5143 SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
5144 SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
5145 SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
5146 SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
5147 SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int);
5148 SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
5149 SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
5150 SQLITE_API void sqlite3_result_null(sqlite3_context*);
5151 SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
5152 SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
5153 void(*)(void*), unsigned char encoding);
5154 SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
5155 SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
5156 SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
5157 SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
5158 SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
5159 SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
5160
5161
5162 /*
5163 ** CAPI3REF: Setting The Subtype Of An SQL Function
5164 ** METHOD: sqlite3_context
@@ -5166,11 +5169,11 @@
5169 ** of the subtype T are preserved in current versions of SQLite;
5170 ** higher order bits are discarded.
5171 ** The number of subtype bytes preserved by SQLite might increase
5172 ** in future releases of SQLite.
5173 */
5174 SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int);
5175
5176 /*
5177 ** CAPI3REF: Define New Collating Sequences
5178 ** METHOD: sqlite3
5179 **
@@ -5248,26 +5251,26 @@
5251 ** is unfortunate but cannot be changed without breaking backwards
5252 ** compatibility.
5253 **
5254 ** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
5255 */
5256 SQLITE_API int sqlite3_create_collation(
5257 sqlite3*,
5258 const char *zName,
5259 int eTextRep,
5260 void *pArg,
5261 int(*xCompare)(void*,int,const void*,int,const void*)
5262 );
5263 SQLITE_API int sqlite3_create_collation_v2(
5264 sqlite3*,
5265 const char *zName,
5266 int eTextRep,
5267 void *pArg,
5268 int(*xCompare)(void*,int,const void*,int,const void*),
5269 void(*xDestroy)(void*)
5270 );
5271 SQLITE_API int sqlite3_create_collation16(
5272 sqlite3*,
5273 const void *zName,
5274 int eTextRep,
5275 void *pArg,
5276 int(*xCompare)(void*,int,const void*,int,const void*)
@@ -5298,16 +5301,16 @@
5301 **
5302 ** The callback function should register the desired collation using
5303 ** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
5304 ** [sqlite3_create_collation_v2()].
5305 */
5306 SQLITE_API int sqlite3_collation_needed(
5307 sqlite3*,
5308 void*,
5309 void(*)(void*,sqlite3*,int eTextRep,const char*)
5310 );
5311 SQLITE_API int sqlite3_collation_needed16(
5312 sqlite3*,
5313 void*,
5314 void(*)(void*,sqlite3*,int eTextRep,const void*)
5315 );
5316
@@ -5317,15 +5320,15 @@
5320 ** called right after sqlite3_open().
5321 **
5322 ** The code to implement this API is not available in the public release
5323 ** of SQLite.
5324 */
5325 SQLITE_API int sqlite3_key(
5326 sqlite3 *db, /* Database to be rekeyed */
5327 const void *pKey, int nKey /* The key */
5328 );
5329 SQLITE_API int sqlite3_key_v2(
5330 sqlite3 *db, /* Database to be rekeyed */
5331 const char *zDbName, /* Name of the database */
5332 const void *pKey, int nKey /* The key */
5333 );
5334
@@ -5335,35 +5338,35 @@
5338 ** database is decrypted.
5339 **
5340 ** The code to implement this API is not available in the public release
5341 ** of SQLite.
5342 */
5343 SQLITE_API int sqlite3_rekey(
5344 sqlite3 *db, /* Database to be rekeyed */
5345 const void *pKey, int nKey /* The new key */
5346 );
5347 SQLITE_API int sqlite3_rekey_v2(
5348 sqlite3 *db, /* Database to be rekeyed */
5349 const char *zDbName, /* Name of the database */
5350 const void *pKey, int nKey /* The new key */
5351 );
5352
5353 /*
5354 ** Specify the activation key for a SEE database. Unless
5355 ** activated, none of the SEE routines will work.
5356 */
5357 SQLITE_API void sqlite3_activate_see(
5358 const char *zPassPhrase /* Activation phrase */
5359 );
5360 #endif
5361
5362 #ifdef SQLITE_ENABLE_CEROD
5363 /*
5364 ** Specify the activation key for a CEROD database. Unless
5365 ** activated, none of the CEROD routines will work.
5366 */
5367 SQLITE_API void sqlite3_activate_cerod(
5368 const char *zPassPhrase /* Activation phrase */
5369 );
5370 #endif
5371
5372 /*
@@ -5381,11 +5384,11 @@
5384 ** method of the default [sqlite3_vfs] object. If the xSleep() method
5385 ** of the default VFS is not implemented correctly, or not implemented at
5386 ** all, then the behavior of sqlite3_sleep() may deviate from the description
5387 ** in the previous paragraphs.
5388 */
5389 SQLITE_API int sqlite3_sleep(int);
5390
5391 /*
5392 ** CAPI3REF: Name Of The Folder Holding Temporary Files
5393 **
5394 ** ^(If this global variable is made to point to a string which is
@@ -5500,11 +5503,11 @@
5503 **
5504 ** If another thread changes the autocommit status of the database
5505 ** connection while this routine is running, then the return value
5506 ** is undefined.
5507 */
5508 SQLITE_API int sqlite3_get_autocommit(sqlite3*);
5509
5510 /*
5511 ** CAPI3REF: Find The Database Handle Of A Prepared Statement
5512 ** METHOD: sqlite3_stmt
5513 **
@@ -5513,11 +5516,11 @@
5516 ** returned by sqlite3_db_handle is the same [database connection]
5517 ** that was the first argument
5518 ** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
5519 ** create the statement in the first place.
5520 */
5521 SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
5522
5523 /*
5524 ** CAPI3REF: Return The Filename For A Database Connection
5525 ** METHOD: sqlite3
5526 **
@@ -5530,21 +5533,21 @@
5533 ** ^The filename returned by this function is the output of the
5534 ** xFullPathname method of the [VFS]. ^In other words, the filename
5535 ** will be an absolute pathname, even if the filename used
5536 ** to open the database originally was a URI or relative pathname.
5537 */
5538 SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);
5539
5540 /*
5541 ** CAPI3REF: Determine if a database is read-only
5542 ** METHOD: sqlite3
5543 **
5544 ** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N
5545 ** of connection D is read-only, 0 if it is read/write, or -1 if N is not
5546 ** the name of a database on connection D.
5547 */
5548 SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
5549
5550 /*
5551 ** CAPI3REF: Find the next prepared statement
5552 ** METHOD: sqlite3
5553 **
@@ -5556,11 +5559,11 @@
5559 **
5560 ** The [database connection] pointer D in a call to
5561 ** [sqlite3_next_stmt(D,S)] must refer to an open database
5562 ** connection and in particular must not be a NULL pointer.
5563 */
5564 SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
5565
5566 /*
5567 ** CAPI3REF: Commit And Rollback Notification Callbacks
5568 ** METHOD: sqlite3
5569 **
@@ -5605,12 +5608,12 @@
5608 ** ^The rollback callback is not invoked if a transaction is
5609 ** automatically rolled back because the database connection is closed.
5610 **
5611 ** See also the [sqlite3_update_hook()] interface.
5612 */
5613 SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
5614 SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
5615
5616 /*
5617 ** CAPI3REF: Data Change Notification Callbacks
5618 ** METHOD: sqlite3
5619 **
@@ -5657,11 +5660,11 @@
5660 ** the first call on D.
5661 **
5662 ** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()],
5663 ** and [sqlite3_preupdate_hook()] interfaces.
5664 */
5665 SQLITE_API void *sqlite3_update_hook(
5666 sqlite3*,
5667 void(*)(void *,int ,char const *,char const *,sqlite3_int64),
5668 void*
5669 );
5670
@@ -5672,11 +5675,12 @@
5675 ** and schema data structures between [database connection | connections]
5676 ** to the same database. Sharing is enabled if the argument is true
5677 ** and disabled if the argument is false.)^
5678 **
5679 ** ^Cache sharing is enabled and disabled for an entire process.
5680 ** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]).
5681 ** In prior versions of SQLite,
5682 ** sharing was enabled or disabled for each thread separately.
5683 **
5684 ** ^(The cache sharing mode set by this interface effects all subsequent
5685 ** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
5686 ** Existing database connections continue use the sharing mode
@@ -5697,11 +5701,11 @@
5701 ** This interface is threadsafe on processors where writing a
5702 ** 32-bit integer is atomic.
5703 **
5704 ** See Also: [SQLite Shared-Cache Mode]
5705 */
5706 SQLITE_API int sqlite3_enable_shared_cache(int);
5707
5708 /*
5709 ** CAPI3REF: Attempt To Free Heap Memory
5710 **
5711 ** ^The sqlite3_release_memory() interface attempts to free N bytes
@@ -5713,11 +5717,11 @@
5717 ** ^The sqlite3_release_memory() routine is a no-op returning zero
5718 ** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT].
5719 **
5720 ** See also: [sqlite3_db_release_memory()]
5721 */
5722 SQLITE_API int sqlite3_release_memory(int);
5723
5724 /*
5725 ** CAPI3REF: Free Memory Used By A Database Connection
5726 ** METHOD: sqlite3
5727 **
@@ -5727,11 +5731,11 @@
5731 ** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is
5732 ** omitted.
5733 **
5734 ** See also: [sqlite3_release_memory()]
5735 */
5736 SQLITE_API int sqlite3_db_release_memory(sqlite3*);
5737
5738 /*
5739 ** CAPI3REF: Impose A Limit On Heap Size
5740 **
5741 ** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
@@ -5766,11 +5770,12 @@
5770 ** <li> The page cache allocates from its own memory pool supplied
5771 ** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
5772 ** from the heap.
5773 ** </ul>)^
5774 **
5775 ** Beginning with SQLite [version 3.7.3] ([dateof:3.7.3]),
5776 ** the soft heap limit is enforced
5777 ** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT]
5778 ** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT],
5779 ** the soft heap limit is enforced on every memory allocation. Without
5780 ** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced
5781 ** when memory is allocated by the page cache. Testing suggests that because
@@ -5779,11 +5784,11 @@
5784 ** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT].
5785 **
5786 ** The circumstances under which SQLite will enforce the soft heap limit may
5787 ** changes in future releases of SQLite.
5788 */
5789 SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
5790
5791 /*
5792 ** CAPI3REF: Deprecated Soft Heap Limit Interface
5793 ** DEPRECATED
5794 **
@@ -5790,11 +5795,11 @@
5795 ** This is a deprecated version of the [sqlite3_soft_heap_limit64()]
5796 ** interface. This routine is provided for historical compatibility
5797 ** only. All new applications should use the
5798 ** [sqlite3_soft_heap_limit64()] interface rather than this one.
5799 */
5800 SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
5801
5802
5803 /*
5804 ** CAPI3REF: Extract Metadata About A Column Of A Table
5805 ** METHOD: sqlite3
@@ -5860,11 +5865,11 @@
5865 **
5866 ** ^This function causes all database schemas to be read from disk and
5867 ** parsed, if that has not already been done, and returns an error if
5868 ** any errors are encountered while loading the schema.
5869 */
5870 SQLITE_API int sqlite3_table_column_metadata(
5871 sqlite3 *db, /* Connection handle */
5872 const char *zDbName, /* Database name or NULL */
5873 const char *zTableName, /* Table name */
5874 const char *zColumnName, /* Column name */
5875 char const **pzDataType, /* OUTPUT: Declared data type */
@@ -5916,11 +5921,11 @@
5921 ** disabled and prevent SQL injections from giving attackers
5922 ** access to extension loading capabilities.
5923 **
5924 ** See also the [load_extension() SQL function].
5925 */
5926 SQLITE_API int sqlite3_load_extension(
5927 sqlite3 *db, /* Load the extension into this database connection */
5928 const char *zFile, /* Name of the shared library containing extension */
5929 const char *zProc, /* Entry point. Derived from zFile if 0 */
5930 char **pzErrMsg /* Put error message here if not 0 */
5931 );
@@ -5948,11 +5953,11 @@
5953 ** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method
5954 ** rather than this interface, so the [load_extension()] SQL function
5955 ** remains disabled. This will prevent SQL injections from giving attackers
5956 ** access to extension loading capabilities.
5957 */
5958 SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
5959
5960 /*
5961 ** CAPI3REF: Automatically Load Statically Linked Extensions
5962 **
5963 ** ^This interface causes the xEntryPoint() function to be invoked for
@@ -5986,11 +5991,11 @@
5991 ** will be called more than once for each database connection that is opened.
5992 **
5993 ** See also: [sqlite3_reset_auto_extension()]
5994 ** and [sqlite3_cancel_auto_extension()]
5995 */
5996 SQLITE_API int sqlite3_auto_extension(void(*xEntryPoint)(void));
5997
5998 /*
5999 ** CAPI3REF: Cancel Automatic Extension Loading
6000 **
6001 ** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
@@ -5998,19 +6003,19 @@
6003 ** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)]
6004 ** routine returns 1 if initialization routine X was successfully
6005 ** unregistered and it returns 0 if X was not on the list of initialization
6006 ** routines.
6007 */
6008 SQLITE_API int sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
6009
6010 /*
6011 ** CAPI3REF: Reset Automatic Extension Loading
6012 **
6013 ** ^This interface disables all automatic extensions previously
6014 ** registered using [sqlite3_auto_extension()].
6015 */
6016 SQLITE_API void sqlite3_reset_auto_extension(void);
6017
6018 /*
6019 ** The interface to the virtual-table mechanism is currently considered
6020 ** to be experimental. The interface might change in incompatible ways.
6021 ** If this is a problem for you, do not use the interface at this time.
@@ -6160,17 +6165,19 @@
6165 ** before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
6166 ** set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
6167 ** the xUpdate method are automatically rolled back by SQLite.
6168 **
6169 ** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
6170 ** structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
6171 ** If a virtual table extension is
6172 ** used with an SQLite version earlier than 3.8.2, the results of attempting
6173 ** to read or write the estimatedRows field are undefined (but are likely
6174 ** to included crashing the application). The estimatedRows field should
6175 ** therefore only be used if [sqlite3_libversion_number()] returns a
6176 ** value greater than or equal to 3008002. Similarly, the idxFlags field
6177 ** was added for [version 3.9.0] ([dateof:3.9.0]).
6178 ** It may therefore only be used if
6179 ** sqlite3_libversion_number() returns a value greater than or equal to
6180 ** 3009000.
6181 */
6182 struct sqlite3_index_info {
6183 /* Inputs */
@@ -6251,17 +6258,17 @@
6258 ** be invoked if the call to sqlite3_create_module_v2() fails.
6259 ** ^The sqlite3_create_module()
6260 ** interface is equivalent to sqlite3_create_module_v2() with a NULL
6261 ** destructor.
6262 */
6263 SQLITE_API int sqlite3_create_module(
6264 sqlite3 *db, /* SQLite connection to register module with */
6265 const char *zName, /* Name of the module */
6266 const sqlite3_module *p, /* Methods for the module */
6267 void *pClientData /* Client data for xCreate/xConnect */
6268 );
6269 SQLITE_API int sqlite3_create_module_v2(
6270 sqlite3 *db, /* SQLite connection to register module with */
6271 const char *zName, /* Name of the module */
6272 const sqlite3_module *p, /* Methods for the module */
6273 void *pClientData, /* Client data for xCreate/xConnect */
6274 void(*xDestroy)(void*) /* Module destructor function */
@@ -6320,11 +6327,11 @@
6327 ** ^The [xCreate] and [xConnect] methods of a
6328 ** [virtual table module] call this interface
6329 ** to declare the format (the names and datatypes of the columns) of
6330 ** the virtual tables they implement.
6331 */
6332 SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
6333
6334 /*
6335 ** CAPI3REF: Overload A Function For A Virtual Table
6336 ** METHOD: sqlite3
6337 **
@@ -6339,11 +6346,11 @@
6346 ** of the new function always causes an exception to be thrown. So
6347 ** the new function is not good for anything by itself. Its only
6348 ** purpose is to be a placeholder function that can be overloaded
6349 ** by a [virtual table].
6350 */
6351 SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
6352
6353 /*
6354 ** The interface to the virtual-table mechanism defined above (back up
6355 ** to a comment remarkably similar to this one) is currently considered
6356 ** to be experimental. The interface might change in incompatible ways.
@@ -6438,11 +6445,11 @@
6445 ** zero-filled blob to read or write using the incremental-blob interface.
6446 **
6447 ** To avoid a resource leak, every open [BLOB handle] should eventually
6448 ** be released by a call to [sqlite3_blob_close()].
6449 */
6450 SQLITE_API int sqlite3_blob_open(
6451 sqlite3*,
6452 const char *zDb,
6453 const char *zTable,
6454 const char *zColumn,
6455 sqlite3_int64 iRow,
@@ -6471,11 +6478,11 @@
6478 ** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle
6479 ** always returns zero.
6480 **
6481 ** ^This function sets the database handle error code and message.
6482 */
6483 SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
6484
6485 /*
6486 ** CAPI3REF: Close A BLOB Handle
6487 ** DESTRUCTOR: sqlite3_blob
6488 **
@@ -6494,11 +6501,11 @@
6501 ** with a null pointer (such as would be returned by a failed call to
6502 ** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
6503 ** is passed a valid open blob handle, the values returned by the
6504 ** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
6505 */
6506 SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
6507
6508 /*
6509 ** CAPI3REF: Return The Size Of An Open BLOB
6510 ** METHOD: sqlite3_blob
6511 **
@@ -6510,11 +6517,11 @@
6517 ** This routine only works on a [BLOB handle] which has been created
6518 ** by a prior successful call to [sqlite3_blob_open()] and which has not
6519 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
6520 ** to this routine results in undefined and probably undesirable behavior.
6521 */
6522 SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);
6523
6524 /*
6525 ** CAPI3REF: Read Data From A BLOB Incrementally
6526 ** METHOD: sqlite3_blob
6527 **
@@ -6539,11 +6546,11 @@
6546 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
6547 ** to this routine results in undefined and probably undesirable behavior.
6548 **
6549 ** See also: [sqlite3_blob_write()].
6550 */
6551 SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
6552
6553 /*
6554 ** CAPI3REF: Write Data Into A BLOB Incrementally
6555 ** METHOD: sqlite3_blob
6556 **
@@ -6581,11 +6588,11 @@
6588 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
6589 ** to this routine results in undefined and probably undesirable behavior.
6590 **
6591 ** See also: [sqlite3_blob_read()].
6592 */
6593 SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
6594
6595 /*
6596 ** CAPI3REF: Virtual File System Objects
6597 **
6598 ** A virtual filesystem (VFS) is an [sqlite3_vfs] object
@@ -6612,13 +6619,13 @@
6619 **
6620 ** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.
6621 ** ^(If the default VFS is unregistered, another VFS is chosen as
6622 ** the default. The choice for the new VFS is arbitrary.)^
6623 */
6624 SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
6625 SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
6626 SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
6627
6628 /*
6629 ** CAPI3REF: Mutexes
6630 **
6631 ** The SQLite core uses these routines for thread
@@ -6730,15 +6737,15 @@
6737 ** sqlite3_mutex_leave() is a NULL pointer, then all three routines
6738 ** behave as no-ops.
6739 **
6740 ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
6741 */
6742 SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
6743 SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
6744 SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*);
6745 SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*);
6746 SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
6747
6748 /*
6749 ** CAPI3REF: Mutex Methods Object
6750 **
6751 ** An instance of this structure defines the low-level routines
@@ -6844,12 +6851,12 @@
6851 ** call to sqlite3_mutex_held() to fail, so a non-zero return is
6852 ** the appropriate thing to do. The sqlite3_mutex_notheld()
6853 ** interface should also return 1 when given a NULL pointer.
6854 */
6855 #ifndef NDEBUG
6856 SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
6857 SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
6858 #endif
6859
6860 /*
6861 ** CAPI3REF: Mutex Types
6862 **
@@ -6864,11 +6871,11 @@
6871 #define SQLITE_MUTEX_RECURSIVE 1
6872 #define SQLITE_MUTEX_STATIC_MASTER 2
6873 #define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */
6874 #define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */
6875 #define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */
6876 #define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_randomness() */
6877 #define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
6878 #define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */
6879 #define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */
6880 #define SQLITE_MUTEX_STATIC_APP1 8 /* For use by application */
6881 #define SQLITE_MUTEX_STATIC_APP2 9 /* For use by application */
@@ -6885,11 +6892,11 @@
6892 ** serializes access to the [database connection] given in the argument
6893 ** when the [threading mode] is Serialized.
6894 ** ^If the [threading mode] is Single-thread or Multi-thread then this
6895 ** routine returns a NULL pointer.
6896 */
6897 SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
6898
6899 /*
6900 ** CAPI3REF: Low-Level Control Of Database Files
6901 ** METHOD: sqlite3
6902 **
@@ -6920,11 +6927,11 @@
6927 ** an incorrect zDbName and an SQLITE_ERROR return from the underlying
6928 ** xFileControl method.
6929 **
6930 ** See also: [SQLITE_FCNTL_LOCKSTATE]
6931 */
6932 SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
6933
6934 /*
6935 ** CAPI3REF: Testing Interface
6936 **
6937 ** ^The sqlite3_test_control() interface is used to read out internal
@@ -6939,11 +6946,11 @@
6946 ** The details of the operation codes, their meanings, the parameters
6947 ** they take, and what they do are all subject to change without notice.
6948 ** Unlike most of the SQLite API, this function is not guaranteed to
6949 ** operate consistently from one release to the next.
6950 */
6951 SQLITE_API int sqlite3_test_control(int op, ...);
6952
6953 /*
6954 ** CAPI3REF: Testing Interface Operation Codes
6955 **
6956 ** These constants are the valid operation code parameters used
@@ -6968,10 +6975,11 @@
6975 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15
6976 #define SQLITE_TESTCTRL_ISKEYWORD 16
6977 #define SQLITE_TESTCTRL_SCRATCHMALLOC 17
6978 #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
6979 #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
6980 #define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
6981 #define SQLITE_TESTCTRL_NEVER_CORRUPT 20
6982 #define SQLITE_TESTCTRL_VDBE_COVERAGE 21
6983 #define SQLITE_TESTCTRL_BYTEORDER 22
6984 #define SQLITE_TESTCTRL_ISINIT 23
6985 #define SQLITE_TESTCTRL_SORTER_MMAP 24
@@ -7002,12 +7010,12 @@
7010 ** be represented by a 32-bit integer, then the values returned by
7011 ** sqlite3_status() are undefined.
7012 **
7013 ** See also: [sqlite3_db_status()]
7014 */
7015 SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
7016 SQLITE_API int sqlite3_status64(
7017 int op,
7018 sqlite3_int64 *pCurrent,
7019 sqlite3_int64 *pHighwater,
7020 int resetFlag
7021 );
@@ -7128,11 +7136,11 @@
7136 ** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
7137 ** non-zero [error code] on failure.
7138 **
7139 ** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
7140 */
7141 SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
7142
7143 /*
7144 ** CAPI3REF: Status Parameters for database connections
7145 ** KEYWORDS: {SQLITE_DBSTATUS options}
7146 **
@@ -7271,11 +7279,11 @@
7279 ** ^If the resetFlg is true, then the counter is reset to zero after this
7280 ** interface call returns.
7281 **
7282 ** See also: [sqlite3_status()] and [sqlite3_db_status()].
7283 */
7284 SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
7285
7286 /*
7287 ** CAPI3REF: Status Parameters for prepared statements
7288 ** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters}
7289 **
@@ -7740,20 +7748,20 @@
7748 ** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()
7749 ** APIs are not strictly speaking threadsafe. If they are invoked at the
7750 ** same time as another thread is invoking sqlite3_backup_step() it is
7751 ** possible that they return invalid values.
7752 */
7753 SQLITE_API sqlite3_backup *sqlite3_backup_init(
7754 sqlite3 *pDest, /* Destination database handle */
7755 const char *zDestName, /* Destination database name */
7756 sqlite3 *pSource, /* Source database handle */
7757 const char *zSourceName /* Source database name */
7758 );
7759 SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage);
7760 SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p);
7761 SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p);
7762 SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
7763
7764 /*
7765 ** CAPI3REF: Unlock Notification
7766 ** METHOD: sqlite3
7767 **
@@ -7866,11 +7874,11 @@
7874 ** by an sqlite3_step() call. ^(If there is a blocking connection, then the
7875 ** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in
7876 ** the special "DROP TABLE/INDEX" case, the extended error code is just
7877 ** SQLITE_LOCKED.)^
7878 */
7879 SQLITE_API int sqlite3_unlock_notify(
7880 sqlite3 *pBlocked, /* Waiting connection */
7881 void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */
7882 void *pNotifyArg /* Argument to pass to xNotify */
7883 );
7884
@@ -7881,12 +7889,12 @@
7889 ** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications
7890 ** and extensions to compare the contents of two buffers containing UTF-8
7891 ** strings in a case-independent fashion, using the same definition of "case
7892 ** independence" that SQLite uses internally when comparing identifiers.
7893 */
7894 SQLITE_API int sqlite3_stricmp(const char *, const char *);
7895 SQLITE_API int sqlite3_strnicmp(const char *, const char *, int);
7896
7897 /*
7898 ** CAPI3REF: String Globbing
7899 *
7900 ** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if
@@ -7899,11 +7907,11 @@
7907 ** Note that this routine returns zero on a match and non-zero if the strings
7908 ** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
7909 **
7910 ** See also: [sqlite3_strlike()].
7911 */
7912 SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr);
7913
7914 /*
7915 ** CAPI3REF: String LIKE Matching
7916 *
7917 ** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if
@@ -7922,11 +7930,11 @@
7930 ** Note that this routine returns zero on a match and non-zero if the strings
7931 ** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
7932 **
7933 ** See also: [sqlite3_strglob()].
7934 */
7935 SQLITE_API int sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc);
7936
7937 /*
7938 ** CAPI3REF: Error Logging Interface
7939 **
7940 ** ^The [sqlite3_log()] interface writes a message into the [error log]
@@ -7945,11 +7953,11 @@
7953 ** will not use dynamically allocated memory. The log message is stored in
7954 ** a fixed-length buffer on the stack. If the log message is longer than
7955 ** a few hundred characters, it will be truncated to the length of the
7956 ** buffer.
7957 */
7958 SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
7959
7960 /*
7961 ** CAPI3REF: Write-Ahead Log Commit Hook
7962 ** METHOD: sqlite3
7963 **
@@ -7981,11 +7989,11 @@
7989 ** previously registered write-ahead log callback. ^Note that the
7990 ** [sqlite3_wal_autocheckpoint()] interface and the
7991 ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
7992 ** overwrite any prior [sqlite3_wal_hook()] settings.
7993 */
7994 SQLITE_API void *sqlite3_wal_hook(
7995 sqlite3*,
7996 int(*)(void *,sqlite3*,const char*,int),
7997 void*
7998 );
7999
@@ -8016,11 +8024,11 @@
8024 ** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
8025 ** pages. The use of this interface
8026 ** is only necessary if the default setting is found to be suboptimal
8027 ** for a particular application.
8028 */
8029 SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
8030
8031 /*
8032 ** CAPI3REF: Checkpoint a database
8033 ** METHOD: sqlite3
8034 **
@@ -8038,11 +8046,11 @@
8046 ** interface was added. This interface is retained for backwards
8047 ** compatibility and as a convenience for applications that need to manually
8048 ** start a callback but which do not need the full power (and corresponding
8049 ** complication) of [sqlite3_wal_checkpoint_v2()].
8050 */
8051 SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
8052
8053 /*
8054 ** CAPI3REF: Checkpoint a database
8055 ** METHOD: sqlite3
8056 **
@@ -8132,11 +8140,11 @@
8140 ** [sqlite3_errcode()] and [sqlite3_errmsg()].
8141 **
8142 ** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
8143 ** from SQL.
8144 */
8145 SQLITE_API int sqlite3_wal_checkpoint_v2(
8146 sqlite3 *db, /* Database handle */
8147 const char *zDb, /* Name of attached database (or NULL) */
8148 int eMode, /* SQLITE_CHECKPOINT_* value */
8149 int *pnLog, /* OUT: Size of WAL log in frames */
8150 int *pnCkpt /* OUT: Total number of frames checkpointed */
@@ -8168,11 +8176,11 @@
8176 **
8177 ** At present, there is only one option that may be configured using
8178 ** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].) Further options
8179 ** may be added in the future.
8180 */
8181 SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
8182
8183 /*
8184 ** CAPI3REF: Virtual Table Configuration Options
8185 **
8186 ** These macros define the various options to the
@@ -8221,11 +8229,11 @@
8229 ** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],
8230 ** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode
8231 ** of the SQL statement that triggered the call to the [xUpdate] method of the
8232 ** [virtual table].
8233 */
8234 SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);
8235
8236 /*
8237 ** CAPI3REF: Conflict resolution modes
8238 ** KEYWORDS: {conflict resolution mode}
8239 **
@@ -8326,11 +8334,11 @@
8334 ** as if the loop did not exist - it returns non-zero and leave the variable
8335 ** that pOut points to unchanged.
8336 **
8337 ** See also: [sqlite3_stmt_scanstatus_reset()]
8338 */
8339 SQLITE_API int sqlite3_stmt_scanstatus(
8340 sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
8341 int idx, /* Index of loop to report on */
8342 int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
8343 void *pOut /* Result written here */
8344 );
@@ -8342,11 +8350,11 @@
8350 ** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.
8351 **
8352 ** This API is only available if the library is built with pre-processor
8353 ** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
8354 */
8355 SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
8356
8357 /*
8358 ** CAPI3REF: Flush caches to disk mid-transaction
8359 **
8360 ** ^If a write-transaction is open on [database connection] D when the
@@ -8374,11 +8382,11 @@
8382 ** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK.
8383 **
8384 ** ^This function does not set the database handle error code or message
8385 ** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.
8386 */
8387 SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
8388
8389 /*
8390 ** CAPI3REF: The pre-update hook.
8391 **
8392 ** ^These interfaces are only available if SQLite is compiled using the
@@ -8454,11 +8462,11 @@
8462 ** triggers; or 2 for changes resulting from triggers called by top-level
8463 ** triggers; and so forth.
8464 **
8465 ** See also: [sqlite3_update_hook()]
8466 */
8467 SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_preupdate_hook(
8468 sqlite3 *db,
8469 void(*xPreUpdate)(
8470 void *pCtx, /* Copy of third arg to preupdate_hook() */
8471 sqlite3 *db, /* Database handle */
8472 int op, /* SQLITE_UPDATE, DELETE or INSERT */
@@ -8467,14 +8475,14 @@
8475 sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */
8476 sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */
8477 ),
8478 void*
8479 );
8480 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);
8481 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_count(sqlite3 *);
8482 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_depth(sqlite3 *);
8483 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
8484
8485 /*
8486 ** CAPI3REF: Low-level system error code
8487 **
8488 ** ^Attempt to return the underlying operating system error code or error
@@ -8482,11 +8490,11 @@
8490 ** The return value is OS-dependent. For example, on unix systems, after
8491 ** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be
8492 ** called to get back the underlying "errno" that caused the problem, such
8493 ** as ENOSPC, EAUTH, EISDIR, and so forth.
8494 */
8495 SQLITE_API int sqlite3_system_errno(sqlite3*);
8496
8497 /*
8498 ** CAPI3REF: Database Snapshot
8499 ** KEYWORDS: {snapshot}
8500 ** EXPERIMENTAL
@@ -8532,11 +8540,11 @@
8540 ** to avoid a memory leak.
8541 **
8542 ** The [sqlite3_snapshot_get()] interface is only available when the
8543 ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8544 */
8545 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
8546 sqlite3 *db,
8547 const char *zSchema,
8548 sqlite3_snapshot **ppSnapshot
8549 );
8550
@@ -8570,11 +8578,11 @@
8578 ** database connection in order to make it ready to use snapshots.)
8579 **
8580 ** The [sqlite3_snapshot_open()] interface is only available when the
8581 ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8582 */
8583 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(
8584 sqlite3 *db,
8585 const char *zSchema,
8586 sqlite3_snapshot *pSnapshot
8587 );
8588
@@ -8587,11 +8595,11 @@
8595 ** using this routine to avoid a memory leak.
8596 **
8597 ** The [sqlite3_snapshot_free()] interface is only available when the
8598 ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8599 */
8600 SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);
8601
8602 /*
8603 ** CAPI3REF: Compare the ages of two snapshot handles.
8604 ** EXPERIMENTAL
8605 **
@@ -8611,11 +8619,11 @@
8619 **
8620 ** Otherwise, this API returns a negative value if P1 refers to an older
8621 ** snapshot than P2, zero if the two handles refer to the same database
8622 ** snapshot, and a positive value if P1 is a newer snapshot than P2.
8623 */
8624 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(
8625 sqlite3_snapshot *p1,
8626 sqlite3_snapshot *p2
8627 );
8628
8629 /*
@@ -8669,11 +8677,11 @@
8677 ** Register a geometry callback named zGeom that can be used as part of an
8678 ** R-Tree geometry query as follows:
8679 **
8680 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
8681 */
8682 SQLITE_API int sqlite3_rtree_geometry_callback(
8683 sqlite3 *db,
8684 const char *zGeom,
8685 int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),
8686 void *pContext
8687 );
@@ -8695,11 +8703,11 @@
8703 ** Register a 2nd-generation geometry callback named zScore that can be
8704 ** used as part of an R-Tree geometry query as follows:
8705 **
8706 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
8707 */
8708 SQLITE_API int sqlite3_rtree_query_callback(
8709 sqlite3 *db,
8710 const char *zQueryFunc,
8711 int (*xQueryFunc)(sqlite3_rtree_query_info*),
8712 void *pContext,
8713 void (*xDestructor)(void*)
@@ -11916,12 +11924,12 @@
11924 */
11925 #ifdef SQLITE_OMIT_WSD
11926 #define SQLITE_WSD const
11927 #define GLOBAL(t,v) (*(t*)sqlite3_wsd_find((void*)&(v), sizeof(v)))
11928 #define sqlite3GlobalConfig GLOBAL(struct Sqlite3Config, sqlite3Config)
11929 SQLITE_API int sqlite3_wsd_init(int N, int J);
11930 SQLITE_API void *sqlite3_wsd_find(void *K, int L);
11931 #else
11932 #define SQLITE_WSD
11933 #define GLOBAL(t,v) v
11934 #define sqlite3GlobalConfig sqlite3Config
11935 #endif
@@ -12462,11 +12470,10 @@
12470 struct SubProgram {
12471 VdbeOp *aOp; /* Array of opcodes for sub-program */
12472 int nOp; /* Elements in aOp[] */
12473 int nMem; /* Number of memory cells required */
12474 int nCsr; /* Number of cursors required */
 
12475 void *token; /* id that may be used to recursive triggers */
12476 SubProgram *pNext; /* Next sub-program already visited */
12477 };
12478
12479 /*
@@ -15514,11 +15521,10 @@
15521 int iRangeReg; /* First register in temporary register block */
15522 int nErr; /* Number of errors seen */
15523 int nTab; /* Number of previously allocated VDBE cursors */
15524 int nMem; /* Number of memory cells used so far */
15525 int nSet; /* Number of sets used so far */
 
15526 int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */
15527 int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
15528 int iFixedOp; /* Never back out opcodes iFixedOp-1 or earlier */
15529 int ckBase; /* Base register of data during check constraints */
15530 int iSelfTab; /* Table of an index whose exprs are being coded */
@@ -15848,10 +15854,11 @@
15854 #endif
15855 #ifndef SQLITE_OMIT_BUILTIN_TEST
15856 int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */
15857 #endif
15858 int bLocaltimeFault; /* True to fail localtime() calls */
15859 int iOnceResetThreshold; /* When to reset OP_Once counters */
15860 };
15861
15862 /*
15863 ** This macro is used inside of assert() statements to indicate that
15864 ** the assert is only valid on a well-formed database. Instead of:
@@ -16201,11 +16208,10 @@
16208 SQLITE_PRIVATE void sqlite3AddCollateType(Parse*, Token*);
16209 SQLITE_PRIVATE void sqlite3EndTable(Parse*,Token*,Token*,u8,Select*);
16210 SQLITE_PRIVATE int sqlite3ParseUri(const char*,const char*,unsigned int*,
16211 sqlite3_vfs**,char**,char **);
16212 SQLITE_PRIVATE Btree *sqlite3DbNameToBtree(sqlite3*,const char*);
 
16213
16214 #ifdef SQLITE_OMIT_BUILTIN_TEST
16215 # define sqlite3FaultSim(X) SQLITE_OK
16216 #else
16217 SQLITE_PRIVATE int sqlite3FaultSim(int);
@@ -17129,11 +17135,12 @@
17135 0, /* pVbeBranchArg */
17136 #endif
17137 #ifndef SQLITE_OMIT_BUILTIN_TEST
17138 0, /* xTestCallback */
17139 #endif
17140 0, /* bLocaltimeFault */
17141 0x7ffffffe /* iOnceResetThreshold */
17142 };
17143
17144 /*
17145 ** Hash table for global functions - functions common to all
17146 ** database connections. After initialization, this table is
@@ -17601,11 +17608,11 @@
17608 ** was used and false if not.
17609 **
17610 ** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
17611 ** is not required for a match.
17612 */
17613 SQLITE_API int sqlite3_compileoption_used(const char *zOptName){
17614 int i, n;
17615
17616 #if SQLITE_ENABLE_API_ARMOR
17617 if( zOptName==0 ){
17618 (void)SQLITE_MISUSE_BKPT;
@@ -17629,11 +17636,11 @@
17636
17637 /*
17638 ** Return the N-th compile-time option string. If N is out of range,
17639 ** return a NULL pointer.
17640 */
17641 SQLITE_API const char *sqlite3_compileoption_get(int N){
17642 if( N>=0 && N<ArraySize(azCompileOpt) ){
17643 return azCompileOpt[N];
17644 }
17645 return 0;
17646 }
@@ -17817,20 +17824,18 @@
17824 Vdbe *v; /* VM this frame belongs to */
17825 VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */
17826 Op *aOp; /* Program instructions for parent frame */
17827 i64 *anExec; /* Event counters from parent frame */
17828 Mem *aMem; /* Array of memory cells for parent frame */
 
17829 VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */
17830 void *token; /* Copy of SubProgram.token */
17831 i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
17832 AuxData *pAuxData; /* Linked list of auxdata allocations */
17833 int nCursor; /* Number of entries in apCsr */
17834 int pc; /* Program Counter in parent (calling) frame */
17835 int nOp; /* Size of aOp array */
17836 int nMem; /* Number of entries in aMem */
 
17837 int nChildMem; /* Number of memory cells for child frame */
17838 int nChildCsr; /* Number of cursors for child frame */
17839 int nChange; /* Statement changes (Vdbe.nChange) */
17840 int nDbChange; /* Value of db->nChange */
17841 };
@@ -18070,12 +18075,10 @@
18075 VdbeFrame *pFrame; /* Parent frame */
18076 VdbeFrame *pDelFrame; /* List of frame objects to free on VM reset */
18077 int nFrame; /* Number of frames in pFrame list */
18078 u32 expmask; /* Binding to these vars invalidates VM */
18079 SubProgram *pProgram; /* Linked list of all sub-programs used by VM */
 
 
18080 AuxData *pAuxData; /* Linked list of auxdata allocations */
18081 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
18082 i64 *anExec; /* Number of times each op has been executed */
18083 int nScan; /* Entries in aScan[] */
18084 ScanStatus *aScan; /* Scan definitions for sqlite3_stmt_scanstatus() */
@@ -18339,11 +18342,11 @@
18342 }
18343
18344 /*
18345 ** Query status information.
18346 */
18347 SQLITE_API int sqlite3_status64(
18348 int op,
18349 sqlite3_int64 *pCurrent,
18350 sqlite3_int64 *pHighwater,
18351 int resetFlag
18352 ){
@@ -18364,11 +18367,11 @@
18367 }
18368 sqlite3_mutex_leave(pMutex);
18369 (void)pMutex; /* Prevent warning when SQLITE_THREADSAFE=0 */
18370 return SQLITE_OK;
18371 }
18372 SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){
18373 sqlite3_int64 iCur = 0, iHwtr = 0;
18374 int rc;
18375 #ifdef SQLITE_ENABLE_API_ARMOR
18376 if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT;
18377 #endif
@@ -18381,11 +18384,11 @@
18384 }
18385
18386 /*
18387 ** Query status information for a single database connection
18388 */
18389 SQLITE_API int sqlite3_db_status(
18390 sqlite3 *db, /* The database connection whose status is desired */
18391 int op, /* Status verb */
18392 int *pCurrent, /* Write current value here */
18393 int *pHighwater, /* Write high-water mark here */
18394 int resetFlag /* Reset high-water mark if true */
@@ -20058,11 +20061,11 @@
20061
20062 /*
20063 ** Locate a VFS by name. If no name is given, simply return the
20064 ** first VFS on the list.
20065 */
20066 SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfs){
20067 sqlite3_vfs *pVfs = 0;
20068 #if SQLITE_THREADSAFE
20069 sqlite3_mutex *mutex;
20070 #endif
20071 #ifndef SQLITE_OMIT_AUTOINIT
@@ -20104,11 +20107,11 @@
20107 /*
20108 ** Register a VFS with the system. It is harmless to register the same
20109 ** VFS multiple times. The new VFS becomes the default if makeDflt is
20110 ** true.
20111 */
20112 SQLITE_API int sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){
20113 MUTEX_LOGIC(sqlite3_mutex *mutex;)
20114 #ifndef SQLITE_OMIT_AUTOINIT
20115 int rc = sqlite3_initialize();
20116 if( rc ) return rc;
20117 #endif
@@ -20132,11 +20135,11 @@
20135 }
20136
20137 /*
20138 ** Unregister a VFS so that it is no longer accessible.
20139 */
20140 SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs *pVfs){
20141 #if SQLITE_THREADSAFE
20142 sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
20143 #endif
20144 sqlite3_mutex_enter(mutex);
20145 vfsUnlink(pVfs);
@@ -22483,11 +22486,11 @@
22486 }
22487
22488 /*
22489 ** Retrieve a pointer to a static mutex or allocate a new dynamic one.
22490 */
22491 SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int id){
22492 #ifndef SQLITE_OMIT_AUTOINIT
22493 if( id<=SQLITE_MUTEX_RECURSIVE && sqlite3_initialize() ) return 0;
22494 if( id>SQLITE_MUTEX_RECURSIVE && sqlite3MutexInit() ) return 0;
22495 #endif
22496 assert( sqlite3GlobalConfig.mutex.xMutexAlloc );
@@ -22504,11 +22507,11 @@
22507 }
22508
22509 /*
22510 ** Free a dynamic mutex.
22511 */
22512 SQLITE_API void sqlite3_mutex_free(sqlite3_mutex *p){
22513 if( p ){
22514 assert( sqlite3GlobalConfig.mutex.xMutexFree );
22515 sqlite3GlobalConfig.mutex.xMutexFree(p);
22516 }
22517 }
@@ -22515,11 +22518,11 @@
22518
22519 /*
22520 ** Obtain the mutex p. If some other thread already has the mutex, block
22521 ** until it can be obtained.
22522 */
22523 SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex *p){
22524 if( p ){
22525 assert( sqlite3GlobalConfig.mutex.xMutexEnter );
22526 sqlite3GlobalConfig.mutex.xMutexEnter(p);
22527 }
22528 }
@@ -22526,11 +22529,11 @@
22529
22530 /*
22531 ** Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another
22532 ** thread holds the mutex and it cannot be obtained, return SQLITE_BUSY.
22533 */
22534 SQLITE_API int sqlite3_mutex_try(sqlite3_mutex *p){
22535 int rc = SQLITE_OK;
22536 if( p ){
22537 assert( sqlite3GlobalConfig.mutex.xMutexTry );
22538 return sqlite3GlobalConfig.mutex.xMutexTry(p);
22539 }
@@ -22541,11 +22544,11 @@
22544 ** The sqlite3_mutex_leave() routine exits a mutex that was previously
22545 ** entered by the same thread. The behavior is undefined if the mutex
22546 ** is not currently entered. If a NULL pointer is passed as an argument
22547 ** this function is a no-op.
22548 */
22549 SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex *p){
22550 if( p ){
22551 assert( sqlite3GlobalConfig.mutex.xMutexLeave );
22552 sqlite3GlobalConfig.mutex.xMutexLeave(p);
22553 }
22554 }
@@ -22553,15 +22556,15 @@
22556 #ifndef NDEBUG
22557 /*
22558 ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are
22559 ** intended for use inside assert() statements.
22560 */
22561 SQLITE_API int sqlite3_mutex_held(sqlite3_mutex *p){
22562 assert( p==0 || sqlite3GlobalConfig.mutex.xMutexHeld );
22563 return p==0 || sqlite3GlobalConfig.mutex.xMutexHeld(p);
22564 }
22565 SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex *p){
22566 assert( p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld );
22567 return p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld(p);
22568 }
22569 #endif
22570
@@ -23589,12 +23592,12 @@
23592 ** of the sqlite3_initialize() and sqlite3_shutdown() processing, the
23593 ** "interlocked" magic used here is probably not strictly necessary.
23594 */
23595 static LONG SQLITE_WIN32_VOLATILE winMutex_lock = 0;
23596
23597 SQLITE_API int sqlite3_win32_is_nt(void); /* os_win.c */
23598 SQLITE_API void sqlite3_win32_sleep(DWORD milliseconds); /* os_win.c */
23599
23600 static int winMutexInit(void){
23601 /* The first to increment to 1 does actual initialization */
23602 if( InterlockedCompareExchange(&winMutex_lock, 1, 0)==0 ){
23603 int i;
@@ -23890,11 +23893,11 @@
23893 /*
23894 ** Attempt to release up to n bytes of non-essential memory currently
23895 ** held by SQLite. An example of non-essential memory is memory used to
23896 ** cache database pages that are not currently in use.
23897 */
23898 SQLITE_API int sqlite3_release_memory(int n){
23899 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
23900 return sqlite3PcacheReleaseMemory(n);
23901 #else
23902 /* IMPLEMENTATION-OF: R-34391-24921 The sqlite3_release_memory() routine
23903 ** is a no-op returning zero if SQLite is not compiled with
@@ -23949,11 +23952,11 @@
23952 /*
23953 ** Deprecated external interface. It used to set an alarm callback
23954 ** that was invoked when memory usage grew too large. Now it is a
23955 ** no-op.
23956 */
23957 SQLITE_API int sqlite3_memory_alarm(
23958 void(*xCallback)(void *pArg, sqlite3_int64 used,int N),
23959 void *pArg,
23960 sqlite3_int64 iThreshold
23961 ){
23962 (void)xCallback;
@@ -23965,11 +23968,11 @@
23968
23969 /*
23970 ** Set the soft heap-size limit for the library. Passing a zero or
23971 ** negative value indicates no limit.
23972 */
23973 SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 n){
23974 sqlite3_int64 priorLimit;
23975 sqlite3_int64 excess;
23976 sqlite3_int64 nUsed;
23977 #ifndef SQLITE_OMIT_AUTOINIT
23978 int rc = sqlite3_initialize();
@@ -23987,11 +23990,11 @@
23990 sqlite3_mutex_leave(mem0.mutex);
23991 excess = sqlite3_memory_used() - n;
23992 if( excess>0 ) sqlite3_release_memory((int)(excess & 0x7fffffff));
23993 return priorLimit;
23994 }
23995 SQLITE_API void sqlite3_soft_heap_limit(int n){
23996 if( n<0 ) n = 0;
23997 sqlite3_soft_heap_limit64(n);
23998 }
23999
24000 /*
@@ -24056,11 +24059,11 @@
24059 }
24060
24061 /*
24062 ** Return the amount of memory currently checked out.
24063 */
24064 SQLITE_API sqlite3_int64 sqlite3_memory_used(void){
24065 sqlite3_int64 res, mx;
24066 sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, 0);
24067 return res;
24068 }
24069
@@ -24067,11 +24070,11 @@
24070 /*
24071 ** Return the maximum amount of memory that has ever been
24072 ** checked out since either the beginning of this process
24073 ** or since the most recent reset.
24074 */
24075 SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag){
24076 sqlite3_int64 res, mx;
24077 sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, resetFlag);
24078 return mx;
24079 }
24080
@@ -24147,17 +24150,17 @@
24150 /*
24151 ** This version of the memory allocation is for use by the application.
24152 ** First make sure the memory subsystem is initialized, then do the
24153 ** allocation.
24154 */
24155 SQLITE_API void *sqlite3_malloc(int n){
24156 #ifndef SQLITE_OMIT_AUTOINIT
24157 if( sqlite3_initialize() ) return 0;
24158 #endif
24159 return n<=0 ? 0 : sqlite3Malloc(n);
24160 }
24161 SQLITE_API void *sqlite3_malloc64(sqlite3_uint64 n){
24162 #ifndef SQLITE_OMIT_AUTOINIT
24163 if( sqlite3_initialize() ) return 0;
24164 #endif
24165 return sqlite3Malloc(n);
24166 }
@@ -24296,20 +24299,20 @@
24299 }else{
24300 assert( sqlite3_mutex_held(db->mutex) );
24301 return db->lookaside.sz;
24302 }
24303 }
24304 SQLITE_API sqlite3_uint64 sqlite3_msize(void *p){
24305 assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
24306 assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
24307 return p ? sqlite3GlobalConfig.m.xSize(p) : 0;
24308 }
24309
24310 /*
24311 ** Free memory previously obtained from sqlite3Malloc().
24312 */
24313 SQLITE_API void sqlite3_free(void *p){
24314 if( p==0 ) return; /* IMP: R-49053-54554 */
24315 assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
24316 assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
24317 if( sqlite3GlobalConfig.bMemstat ){
24318 sqlite3_mutex_enter(mem0.mutex);
@@ -24414,18 +24417,18 @@
24417
24418 /*
24419 ** The public interface to sqlite3Realloc. Make sure that the memory
24420 ** subsystem is initialized prior to invoking sqliteRealloc.
24421 */
24422 SQLITE_API void *sqlite3_realloc(void *pOld, int n){
24423 #ifndef SQLITE_OMIT_AUTOINIT
24424 if( sqlite3_initialize() ) return 0;
24425 #endif
24426 if( n<0 ) n = 0; /* IMP: R-26507-47431 */
24427 return sqlite3Realloc(pOld, n);
24428 }
24429 SQLITE_API void *sqlite3_realloc64(void *pOld, sqlite3_uint64 n){
24430 #ifndef SQLITE_OMIT_AUTOINIT
24431 if( sqlite3_initialize() ) return 0;
24432 #endif
24433 return sqlite3Realloc(pOld, n);
24434 }
@@ -25648,11 +25651,11 @@
25651
25652 /*
25653 ** Print into memory obtained from sqlite3_malloc(). Omit the internal
25654 ** %-conversion extensions.
25655 */
25656 SQLITE_API char *sqlite3_vmprintf(const char *zFormat, va_list ap){
25657 char *z;
25658 char zBase[SQLITE_PRINT_BUF_SIZE];
25659 StrAccum acc;
25660
25661 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -25672,11 +25675,11 @@
25675
25676 /*
25677 ** Print into memory obtained from sqlite3_malloc()(). Omit the internal
25678 ** %-conversion extensions.
25679 */
25680 SQLITE_API char *sqlite3_mprintf(const char *zFormat, ...){
25681 va_list ap;
25682 char *z;
25683 #ifndef SQLITE_OMIT_AUTOINIT
25684 if( sqlite3_initialize() ) return 0;
25685 #endif
@@ -25697,11 +25700,11 @@
25700 ** this without breaking compatibility, so we just have to live with the
25701 ** mistake.
25702 **
25703 ** sqlite3_vsnprintf() is the varargs version.
25704 */
25705 SQLITE_API char *sqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_list ap){
25706 StrAccum acc;
25707 if( n<=0 ) return zBuf;
25708 #ifdef SQLITE_ENABLE_API_ARMOR
25709 if( zBuf==0 || zFormat==0 ) {
25710 (void)SQLITE_MISUSE_BKPT;
@@ -25711,11 +25714,11 @@
25714 #endif
25715 sqlite3StrAccumInit(&acc, 0, zBuf, n, 0);
25716 sqlite3VXPrintf(&acc, zFormat, ap);
25717 return sqlite3StrAccumFinish(&acc);
25718 }
25719 SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
25720 char *z;
25721 va_list ap;
25722 va_start(ap,zFormat);
25723 z = sqlite3_vsnprintf(n, zBuf, zFormat, ap);
25724 va_end(ap);
@@ -25747,11 +25750,11 @@
25750 }
25751
25752 /*
25753 ** Format and write a message to the log if logging is enabled.
25754 */
25755 SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...){
25756 va_list ap; /* Vararg list */
25757 if( sqlite3GlobalConfig.xLog ){
25758 va_start(ap, zFormat);
25759 renderLogMsg(iErrCode, zFormat, ap);
25760 va_end(ap);
@@ -26341,11 +26344,11 @@
26344 } sqlite3Prng;
26345
26346 /*
26347 ** Return N random bytes.
26348 */
26349 SQLITE_API void sqlite3_randomness(int N, void *pBuf){
26350 unsigned char t;
26351 unsigned char *zBuf = pBuf;
26352
26353 /* The "wsdPrng" macro will resolve to the pseudo-random number generator
26354 ** state vector. If writable static data is unsupported on the target,
@@ -27544,11 +27547,11 @@
27547 ** sqlite3_strnicmp() APIs allow applications and extensions to compare
27548 ** the contents of two buffers containing UTF-8 strings in a
27549 ** case-independent fashion, using the same definition of "case
27550 ** independence" that SQLite uses internally when comparing identifiers.
27551 */
27552 SQLITE_API int sqlite3_stricmp(const char *zLeft, const char *zRight){
27553 if( zLeft==0 ){
27554 return zRight ? -1 : 0;
27555 }else if( zRight==0 ){
27556 return 1;
27557 }
@@ -27565,11 +27568,11 @@
27568 a++;
27569 b++;
27570 }
27571 return c;
27572 }
27573 SQLITE_API int sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){
27574 register unsigned char *a, *b;
27575 if( zLeft==0 ){
27576 return zRight ? -1 : 0;
27577 }else if( zRight==0 ){
27578 return 1;
@@ -28563,40 +28566,25 @@
28566 return 0;
28567 }else{
28568 return sqlite3AddInt64(pA, -iB);
28569 }
28570 }
 
 
28571 SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){
28572 i64 iA = *pA;
28573 if( iB>0 ){
28574 if( iA>LARGEST_INT64/iB ) return 1;
28575 if( iA<SMALLEST_INT64/iB ) return 1;
28576 }else if( iB<0 ){
28577 if( iA>0 ){
28578 if( iB<SMALLEST_INT64/iA ) return 1;
28579 }else if( iA<0 ){
28580 if( iB==SMALLEST_INT64 ) return 1;
28581 if( iA==SMALLEST_INT64 ) return 1;
28582 if( -iA>LARGEST_INT64/-iB ) return 1;
28583 }
28584 }
28585 *pA = iA*iB;
 
 
 
 
 
 
 
 
 
 
 
 
 
28586 return 0;
28587 }
28588
28589 /*
28590 ** Compute the absolute value of a 32-bit signed integer, of possible. Or
@@ -36888,11 +36876,11 @@
36876 ** This routine is called once during SQLite initialization and by a
36877 ** single thread. The memory allocation and mutex subsystems have not
36878 ** necessarily been initialized when this routine is called, and so they
36879 ** should not be used.
36880 */
36881 SQLITE_API int sqlite3_os_init(void){
36882 /*
36883 ** The following macro defines an initializer for an sqlite3_vfs object.
36884 ** The name of the VFS is NAME. The pAppData is a pointer to a pointer
36885 ** to the "finder" function. (pAppData is a pointer to a pointer because
36886 ** silly C90 rules prohibit a void* from being cast to a function pointer
@@ -36987,11 +36975,11 @@
36975 **
36976 ** Some operating systems might need to do some cleanup in this routine,
36977 ** to release dynamically allocated objects. But not on unix.
36978 ** This routine is a no-op for unix.
36979 */
36980 SQLITE_API int sqlite3_os_end(void){
36981 return SQLITE_OK;
36982 }
36983
36984 #endif /* SQLITE_OS_UNIX */
36985
@@ -38422,11 +38410,11 @@
38410 ** compact it. Upon success, SQLITE_OK will be returned. Upon failure, one
38411 ** of SQLITE_NOMEM, SQLITE_ERROR, or SQLITE_NOTFOUND will be returned. The
38412 ** "pnLargest" argument, if non-zero, will be used to return the size of the
38413 ** largest committed free block in the heap, in bytes.
38414 */
38415 SQLITE_API int sqlite3_win32_compact_heap(LPUINT pnLargest){
38416 int rc = SQLITE_OK;
38417 UINT nLargest = 0;
38418 HANDLE hHeap;
38419
38420 winMemAssertMagic();
@@ -38462,11 +38450,11 @@
38450 ** If a Win32 native heap has been configured, this function will attempt to
38451 ** destroy and recreate it. If the Win32 native heap is not isolated and/or
38452 ** the sqlite3_memory_used() function does not return zero, SQLITE_BUSY will
38453 ** be returned and no changes will be made to the Win32 native heap.
38454 */
38455 SQLITE_API int sqlite3_win32_reset_heap(){
38456 int rc;
38457 MUTEX_LOGIC( sqlite3_mutex *pMaster; ) /* The main static mutex */
38458 MUTEX_LOGIC( sqlite3_mutex *pMem; ) /* The memsys static mutex */
38459 MUTEX_LOGIC( pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); )
38460 MUTEX_LOGIC( pMem = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); )
@@ -38507,11 +38495,11 @@
38495 /*
38496 ** This function outputs the specified (ANSI) string to the Win32 debugger
38497 ** (if available).
38498 */
38499
38500 SQLITE_API void sqlite3_win32_write_debug(const char *zBuf, int nBuf){
38501 char zDbgBuf[SQLITE_WIN32_DBG_BUF_SIZE];
38502 int nMin = MIN(nBuf, (SQLITE_WIN32_DBG_BUF_SIZE - 1)); /* may be negative. */
38503 if( nMin<-1 ) nMin = -1; /* all negative values become -1. */
38504 assert( nMin==-1 || nMin==0 || nMin<SQLITE_WIN32_DBG_BUF_SIZE );
38505 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -38553,11 +38541,11 @@
38541 */
38542 #if SQLITE_OS_WINRT
38543 static HANDLE sleepObj = NULL;
38544 #endif
38545
38546 SQLITE_API void sqlite3_win32_sleep(DWORD milliseconds){
38547 #if SQLITE_OS_WINRT
38548 if ( sleepObj==NULL ){
38549 sleepObj = osCreateEventExW(NULL, NULL, CREATE_EVENT_MANUAL_RESET,
38550 SYNCHRONIZE);
38551 }
@@ -38602,11 +38590,11 @@
38590
38591 /*
38592 ** This function determines if the machine is running a version of Windows
38593 ** based on the NT kernel.
38594 */
38595 SQLITE_API int sqlite3_win32_is_nt(void){
38596 #if SQLITE_OS_WINRT
38597 /*
38598 ** NOTE: The WinRT sub-platform is always assumed to be based on the NT
38599 ** kernel.
38600 */
@@ -38990,11 +38978,11 @@
38978 }
38979
38980 /*
38981 ** This is a public wrapper for the winUtf8ToUnicode() function.
38982 */
38983 SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char *zText){
38984 #ifdef SQLITE_ENABLE_API_ARMOR
38985 if( !zText ){
38986 (void)SQLITE_MISUSE_BKPT;
38987 return 0;
38988 }
@@ -39006,11 +38994,11 @@
38994 }
38995
38996 /*
38997 ** This is a public wrapper for the winUnicodeToUtf8() function.
38998 */
38999 SQLITE_API char *sqlite3_win32_unicode_to_utf8(LPCWSTR zWideText){
39000 #ifdef SQLITE_ENABLE_API_ARMOR
39001 if( !zWideText ){
39002 (void)SQLITE_MISUSE_BKPT;
39003 return 0;
39004 }
@@ -39022,11 +39010,11 @@
39010 }
39011
39012 /*
39013 ** This is a public wrapper for the winMbcsToUtf8() function.
39014 */
39015 SQLITE_API char *sqlite3_win32_mbcs_to_utf8(const char *zText){
39016 #ifdef SQLITE_ENABLE_API_ARMOR
39017 if( !zText ){
39018 (void)SQLITE_MISUSE_BKPT;
39019 return 0;
39020 }
@@ -39038,11 +39026,11 @@
39026 }
39027
39028 /*
39029 ** This is a public wrapper for the winMbcsToUtf8() function.
39030 */
39031 SQLITE_API char *sqlite3_win32_mbcs_to_utf8_v2(const char *zText, int useAnsi){
39032 #ifdef SQLITE_ENABLE_API_ARMOR
39033 if( !zText ){
39034 (void)SQLITE_MISUSE_BKPT;
39035 return 0;
39036 }
@@ -39054,11 +39042,11 @@
39042 }
39043
39044 /*
39045 ** This is a public wrapper for the winUtf8ToMbcs() function.
39046 */
39047 SQLITE_API char *sqlite3_win32_utf8_to_mbcs(const char *zText){
39048 #ifdef SQLITE_ENABLE_API_ARMOR
39049 if( !zText ){
39050 (void)SQLITE_MISUSE_BKPT;
39051 return 0;
39052 }
@@ -39070,11 +39058,11 @@
39058 }
39059
39060 /*
39061 ** This is a public wrapper for the winUtf8ToMbcs() function.
39062 */
39063 SQLITE_API char *sqlite3_win32_utf8_to_mbcs_v2(const char *zText, int useAnsi){
39064 #ifdef SQLITE_ENABLE_API_ARMOR
39065 if( !zText ){
39066 (void)SQLITE_MISUSE_BKPT;
39067 return 0;
39068 }
@@ -39090,11 +39078,11 @@
39078 ** the provided arguments. The type argument must be 1 in order to set the
39079 ** data directory or 2 in order to set the temporary directory. The zValue
39080 ** argument is the name of the directory to use. The return value will be
39081 ** SQLITE_OK if successful.
39082 */
39083 SQLITE_API int sqlite3_win32_set_directory(DWORD type, LPCWSTR zValue){
39084 char **ppDirectory = 0;
39085 #ifndef SQLITE_OMIT_AUTOINIT
39086 int rc = sqlite3_initialize();
39087 if( rc ) return rc;
39088 #endif
@@ -43008,11 +42996,11 @@
42996 }
42997
42998 /*
42999 ** Initialize and deinitialize the operating system interface.
43000 */
43001 SQLITE_API int sqlite3_os_init(void){
43002 static sqlite3_vfs winVfs = {
43003 3, /* iVersion */
43004 sizeof(winFile), /* szOsFile */
43005 SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */
43006 0, /* pNext */
@@ -43139,11 +43127,11 @@
43127 #endif
43128
43129 return SQLITE_OK;
43130 }
43131
43132 SQLITE_API int sqlite3_os_end(void){
43133 #if SQLITE_OS_WINRT
43134 if( sleepObj!=NULL ){
43135 osCloseHandle(sleepObj);
43136 sleepObj = NULL;
43137 }
@@ -57182,11 +57170,11 @@
57170
57171 /*
57172 ** Return a +ve value if snapshot p1 is newer than p2. A -ve value if
57173 ** p1 is older than p2 and zero if p1 and p2 are the same snapshot.
57174 */
57175 SQLITE_API int sqlite3_snapshot_cmp(sqlite3_snapshot *p1, sqlite3_snapshot *p2){
57176 WalIndexHdr *pHdr1 = (WalIndexHdr*)p1;
57177 WalIndexHdr *pHdr2 = (WalIndexHdr*)p2;
57178
57179 /* aSalt[0] is a copy of the value stored in the wal file header. It
57180 ** is incremented each time the wal file is restarted. */
@@ -58319,11 +58307,11 @@
58307 **
58308 ** This routine has no effect on existing database connections.
58309 ** The shared cache setting effects only future calls to
58310 ** sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2().
58311 */
58312 SQLITE_API int sqlite3_enable_shared_cache(int enable){
58313 sqlite3GlobalConfig.sharedCacheEnabled = enable;
58314 return SQLITE_OK;
58315 }
58316 #endif
58317
@@ -59838,12 +59826,15 @@
59826 hdr = pPage->hdrOffset;
59827 iPtr = hdr + 1;
59828 if( data[iPtr+1]==0 && data[iPtr]==0 ){
59829 iFreeBlk = 0; /* Shortcut for the case when the freelist is empty */
59830 }else{
59831 while( (iFreeBlk = get2byte(&data[iPtr]))<iStart ){
59832 if( iFreeBlk<iPtr+4 ){
59833 if( iFreeBlk==0 ) break;
59834 return SQLITE_CORRUPT_BKPT;
59835 }
59836 iPtr = iFreeBlk;
59837 }
59838 if( iFreeBlk>iLast ) return SQLITE_CORRUPT_BKPT;
59839 assert( iFreeBlk>iPtr || iFreeBlk==0 );
59840
@@ -68092,11 +68083,11 @@
68083 ** a pointer to the new sqlite3_backup object.
68084 **
68085 ** If an error occurs, NULL is returned and an error code and error message
68086 ** stored in database handle pDestDb.
68087 */
68088 SQLITE_API sqlite3_backup *sqlite3_backup_init(
68089 sqlite3* pDestDb, /* Database to write to */
68090 const char *zDestDb, /* Name of database within pDestDb */
68091 sqlite3* pSrcDb, /* Database connection to read from */
68092 const char *zSrcDb /* Name of database within pSrcDb */
68093 ){
@@ -68299,11 +68290,11 @@
68290 }
68291
68292 /*
68293 ** Copy nPage pages from the source b-tree to the destination.
68294 */
68295 SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){
68296 int rc;
68297 int destMode; /* Destination journal mode */
68298 int pgszSrc = 0; /* Source page size */
68299 int pgszDest = 0; /* Destination page size */
68300
@@ -68553,11 +68544,11 @@
68544 }
68545
68546 /*
68547 ** Release all resources associated with an sqlite3_backup* handle.
68548 */
68549 SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p){
68550 sqlite3_backup **pp; /* Ptr to head of pagers backup list */
68551 sqlite3 *pSrcDb; /* Source database connection */
68552 int rc; /* Value to return */
68553
68554 /* Enter the mutexes */
@@ -68605,11 +68596,11 @@
68596
68597 /*
68598 ** Return the number of pages still to be backed up as of the most recent
68599 ** call to sqlite3_backup_step().
68600 */
68601 SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p){
68602 #ifdef SQLITE_ENABLE_API_ARMOR
68603 if( p==0 ){
68604 (void)SQLITE_MISUSE_BKPT;
68605 return 0;
68606 }
@@ -68619,11 +68610,11 @@
68610
68611 /*
68612 ** Return the total number of pages in the source database as of the most
68613 ** recent call to sqlite3_backup_step().
68614 */
68615 SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p){
68616 #ifdef SQLITE_ENABLE_API_ARMOR
68617 if( p==0 ){
68618 (void)SQLITE_MISUSE_BKPT;
68619 return 0;
68620 }
@@ -68946,22 +68937,22 @@
68937 ** MEM.zMalloc, where it can be safely written.
68938 **
68939 ** Return SQLITE_OK on success or SQLITE_NOMEM if malloc fails.
68940 */
68941 SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){
 
68942 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
68943 assert( (pMem->flags&MEM_RowSet)==0 );
68944 if( (pMem->flags & (MEM_Str|MEM_Blob))!=0 ){
68945 if( ExpandBlob(pMem) ) return SQLITE_NOMEM;
68946 if( pMem->szMalloc==0 || pMem->z!=pMem->zMalloc ){
68947 if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){
68948 return SQLITE_NOMEM_BKPT;
68949 }
68950 pMem->z[pMem->n] = 0;
68951 pMem->z[pMem->n+1] = 0;
68952 pMem->flags |= MEM_Term;
68953 }
68954 }
68955 pMem->flags &= ~MEM_Ephem;
68956 #ifdef SQLITE_DEBUG
68957 pMem->pScopyFrom = 0;
68958 #endif
@@ -68973,29 +68964,28 @@
68964 ** If the given Mem* has a zero-filled tail, turn it into an ordinary
68965 ** blob stored in dynamically allocated space.
68966 */
68967 #ifndef SQLITE_OMIT_INCRBLOB
68968 SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){
68969 int nByte;
68970 assert( pMem->flags & MEM_Zero );
68971 assert( pMem->flags&MEM_Blob );
68972 assert( (pMem->flags&MEM_RowSet)==0 );
68973 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
68974
68975 /* Set nByte to the number of bytes required to store the expanded blob. */
68976 nByte = pMem->n + pMem->u.nZero;
68977 if( nByte<=0 ){
68978 nByte = 1;
68979 }
68980 if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){
68981 return SQLITE_NOMEM_BKPT;
68982 }
68983
68984 memset(&pMem->z[pMem->n], 0, pMem->u.nZero);
68985 pMem->n += pMem->u.nZero;
68986 pMem->flags &= ~(MEM_Zero|MEM_Term);
 
68987 return SQLITE_OK;
68988 }
68989 #endif
68990
68991 /*
@@ -72345,11 +72335,10 @@
72335 sqlite3 *db; /* The database connection */
72336 int nVar; /* Number of parameters */
72337 int nMem; /* Number of VM memory registers */
72338 int nCursor; /* Number of cursors required */
72339 int nArg; /* Number of arguments in subprograms */
 
72340 int n; /* Loop counter */
72341 struct ReusableSpace x; /* Reusable bulk memory */
72342
72343 assert( p!=0 );
72344 assert( p->nOp>0 );
@@ -72360,12 +72349,10 @@
72349 assert( db->mallocFailed==0 );
72350 nVar = pParse->nVar;
72351 nMem = pParse->nMem;
72352 nCursor = pParse->nTab;
72353 nArg = pParse->nMaxArg;
 
 
72354
72355 /* Each cursor uses a memory cell. The first cursor (cursor 0) can
72356 ** use aMem[0] which is not otherwise used by the VDBE program. Allocate
72357 ** space at the end of aMem[] for cursors 1 and greater.
72358 ** See also: allocateCursor().
@@ -72408,21 +72395,19 @@
72395 x.nNeeded = 0;
72396 p->aMem = allocSpace(&x, p->aMem, nMem*sizeof(Mem));
72397 p->aVar = allocSpace(&x, p->aVar, nVar*sizeof(Mem));
72398 p->apArg = allocSpace(&x, p->apArg, nArg*sizeof(Mem*));
72399 p->apCsr = allocSpace(&x, p->apCsr, nCursor*sizeof(VdbeCursor*));
 
72400 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
72401 p->anExec = allocSpace(&x, p->anExec, p->nOp*sizeof(i64));
72402 #endif
72403 if( x.nNeeded==0 ) break;
72404 x.pSpace = p->pFree = sqlite3DbMallocZero(db, x.nNeeded);
72405 x.nFree = x.nNeeded;
72406 }while( !db->mallocFailed );
72407
72408 p->nCursor = nCursor;
 
72409 if( p->aVar ){
72410 p->nVar = (ynVar)nVar;
72411 for(n=0; n<nVar; n++){
72412 p->aVar[n].flags = MEM_Null;
72413 p->aVar[n].db = db;
@@ -72506,12 +72491,10 @@
72491 Vdbe *v = pFrame->v;
72492 closeCursorsInFrame(v);
72493 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
72494 v->anExec = pFrame->anExec;
72495 #endif
 
 
72496 v->aOp = pFrame->aOp;
72497 v->nOp = pFrame->nOp;
72498 v->aMem = pFrame->aMem;
72499 v->nMem = pFrame->nMem;
72500 v->apCsr = pFrame->apCsr;
@@ -73048,11 +73031,10 @@
73031 */
73032
73033 if( db->mallocFailed ){
73034 p->rc = SQLITE_NOMEM_BKPT;
73035 }
 
73036 closeAllCursors(p);
73037 if( p->magic!=VDBE_MAGIC_RUN ){
73038 return SQLITE_OK;
73039 }
73040 checkActiveVdbeCnt(db);
@@ -74196,14 +74178,16 @@
74178
74179 /*
74180 ** The input pBlob is guaranteed to be a Blob that is not marked
74181 ** with MEM_Zero. Return true if it could be a zero-blob.
74182 */
74183 static int isAllZero(const char *z, int n){
74184 int i;
74185 for(i=0; i<n; i++){
74186 if( z[i] ) return 0;
74187 }
74188 return 1;
74189 }
74190
74191 /*
74192 ** Compare two blobs. Return negative, zero, or positive if the first
74193 ** is less than, equal to, or greater than the second, respectively.
@@ -74223,14 +74207,14 @@
74207
74208 if( (pB1->flags|pB2->flags) & MEM_Zero ){
74209 if( pB1->flags & pB2->flags & MEM_Zero ){
74210 return pB1->u.nZero - pB2->u.nZero;
74211 }else if( pB1->flags & MEM_Zero ){
74212 if( !isAllZero(pB2->z, pB2->n) ) return -1;
74213 return pB1->u.nZero - n2;
74214 }else{
74215 if( !isAllZero(pB1->z, pB1->n) ) return +1;
74216 return n1 - pB2->u.nZero;
74217 }
74218 }
74219 c = memcmp(pB1->z, pB2->z, n1>n2 ? n2 : n1);
74220 if( c ) return c;
@@ -74538,10 +74522,11 @@
74522 }
74523 }
74524
74525 /* RHS is a blob */
74526 else if( pRhs->flags & MEM_Blob ){
74527 assert( (pRhs->flags & MEM_Zero)==0 || pRhs->n==0 );
74528 getVarint32(&aKey1[idx1], serial_type);
74529 testcase( serial_type==12 );
74530 if( serial_type<12 || (serial_type & 0x01) ){
74531 rc = -1;
74532 }else{
@@ -74549,10 +74534,16 @@
74534 testcase( (d1+nStr)==(unsigned)nKey1 );
74535 testcase( (d1+nStr+1)==(unsigned)nKey1 );
74536 if( (d1+nStr) > (unsigned)nKey1 ){
74537 pPKey2->errCode = (u8)SQLITE_CORRUPT_BKPT;
74538 return 0; /* Corruption */
74539 }else if( pRhs->flags & MEM_Zero ){
74540 if( !isAllZero((const char*)&aKey1[d1],nStr) ){
74541 rc = 1;
74542 }else{
74543 rc = nStr - pRhs->u.nZero;
74544 }
74545 }else{
74546 int nCmp = MIN(nStr, pRhs->n);
74547 rc = memcmp(&aKey1[d1], pRhs->z, nCmp);
74548 if( rc==0 ) rc = nStr - pRhs->n;
74549 }
@@ -74619,11 +74610,11 @@
74610 const u8 *aKey = &((const u8*)pKey1)[*(const u8*)pKey1 & 0x3F];
74611 int serial_type = ((const u8*)pKey1)[1];
74612 int res;
74613 u32 y;
74614 u64 x;
74615 i64 v;
74616 i64 lhs;
74617
74618 vdbeAssertFieldCountWithinLimits(nKey1, pKey1, pPKey2->pKeyInfo);
74619 assert( (*(u8*)pKey1)<=0x3F || CORRUPT_DB );
74620 switch( serial_type ){
@@ -74678,10 +74669,11 @@
74669
74670 default:
74671 return sqlite3VdbeRecordCompare(nKey1, pKey1, pPKey2);
74672 }
74673
74674 v = pPKey2->aMem[0].u.i;
74675 if( v>lhs ){
74676 res = pPKey2->r1;
74677 }else if( v<lhs ){
74678 res = pPKey2->r2;
74679 }else if( pPKey2->nField>1 ){
@@ -75128,11 +75120,11 @@
75120 ** execution environment changes in a way that would alter the program
75121 ** that sqlite3_prepare() generates. For example, if new functions or
75122 ** collating sequences are registered or if an authorizer function is
75123 ** added or changed.
75124 */
75125 SQLITE_API int sqlite3_expired(sqlite3_stmt *pStmt){
75126 Vdbe *p = (Vdbe*)pStmt;
75127 return p==0 || p->expired;
75128 }
75129 #endif
75130
@@ -75197,11 +75189,11 @@
75189 ** machine.
75190 **
75191 ** This routine sets the error code and string returned by
75192 ** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
75193 */
75194 SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt){
75195 int rc;
75196 if( pStmt==0 ){
75197 /* IMPLEMENTATION-OF: R-57228-12904 Invoking sqlite3_finalize() on a NULL
75198 ** pointer is a harmless no-op. */
75199 rc = SQLITE_OK;
@@ -75224,11 +75216,11 @@
75216 ** the prior execution is returned.
75217 **
75218 ** This routine sets the error code and string returned by
75219 ** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
75220 */
75221 SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt){
75222 int rc;
75223 if( pStmt==0 ){
75224 rc = SQLITE_OK;
75225 }else{
75226 Vdbe *v = (Vdbe*)pStmt;
@@ -75245,11 +75237,11 @@
75237 }
75238
75239 /*
75240 ** Set all the parameters in the compiled SQL statement to NULL.
75241 */
75242 SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt *pStmt){
75243 int i;
75244 int rc = SQLITE_OK;
75245 Vdbe *p = (Vdbe*)pStmt;
75246 #if SQLITE_THREADSAFE
75247 sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex;
@@ -75269,61 +75261,61 @@
75261
75262 /**************************** sqlite3_value_ *******************************
75263 ** The following routines extract information from a Mem or sqlite3_value
75264 ** structure.
75265 */
75266 SQLITE_API const void *sqlite3_value_blob(sqlite3_value *pVal){
75267 Mem *p = (Mem*)pVal;
75268 if( p->flags & (MEM_Blob|MEM_Str) ){
75269 if( ExpandBlob(p)!=SQLITE_OK ){
75270 assert( p->flags==MEM_Null && p->z==0 );
75271 return 0;
75272 }
75273 p->flags |= MEM_Blob;
75274 return p->n ? p->z : 0;
75275 }else{
75276 return sqlite3_value_text(pVal);
75277 }
75278 }
75279 SQLITE_API int sqlite3_value_bytes(sqlite3_value *pVal){
75280 return sqlite3ValueBytes(pVal, SQLITE_UTF8);
75281 }
75282 SQLITE_API int sqlite3_value_bytes16(sqlite3_value *pVal){
75283 return sqlite3ValueBytes(pVal, SQLITE_UTF16NATIVE);
75284 }
75285 SQLITE_API double sqlite3_value_double(sqlite3_value *pVal){
75286 return sqlite3VdbeRealValue((Mem*)pVal);
75287 }
75288 SQLITE_API int sqlite3_value_int(sqlite3_value *pVal){
75289 return (int)sqlite3VdbeIntValue((Mem*)pVal);
75290 }
75291 SQLITE_API sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){
75292 return sqlite3VdbeIntValue((Mem*)pVal);
75293 }
75294 SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value *pVal){
75295 Mem *pMem = (Mem*)pVal;
75296 return ((pMem->flags & MEM_Subtype) ? pMem->eSubtype : 0);
75297 }
75298 SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value *pVal){
75299 return (const unsigned char *)sqlite3ValueText(pVal, SQLITE_UTF8);
75300 }
75301 #ifndef SQLITE_OMIT_UTF16
75302 SQLITE_API const void *sqlite3_value_text16(sqlite3_value* pVal){
75303 return sqlite3ValueText(pVal, SQLITE_UTF16NATIVE);
75304 }
75305 SQLITE_API const void *sqlite3_value_text16be(sqlite3_value *pVal){
75306 return sqlite3ValueText(pVal, SQLITE_UTF16BE);
75307 }
75308 SQLITE_API const void *sqlite3_value_text16le(sqlite3_value *pVal){
75309 return sqlite3ValueText(pVal, SQLITE_UTF16LE);
75310 }
75311 #endif /* SQLITE_OMIT_UTF16 */
75312 /* EVIDENCE-OF: R-12793-43283 Every value in SQLite has one of five
75313 ** fundamental datatypes: 64-bit signed integer 64-bit IEEE floating
75314 ** point number string BLOB NULL
75315 */
75316 SQLITE_API int sqlite3_value_type(sqlite3_value* pVal){
75317 static const u8 aType[] = {
75318 SQLITE_BLOB, /* 0x00 */
75319 SQLITE_NULL, /* 0x01 */
75320 SQLITE_TEXT, /* 0x02 */
75321 SQLITE_NULL, /* 0x03 */
@@ -75359,11 +75351,11 @@
75351 return aType[pVal->flags&MEM_AffMask];
75352 }
75353
75354 /* Make a copy of an sqlite3_value object
75355 */
75356 SQLITE_API sqlite3_value *sqlite3_value_dup(const sqlite3_value *pOrig){
75357 sqlite3_value *pNew;
75358 if( pOrig==0 ) return 0;
75359 pNew = sqlite3_malloc( sizeof(*pNew) );
75360 if( pNew==0 ) return 0;
75361 memset(pNew, 0, sizeof(*pNew));
@@ -75382,11 +75374,11 @@
75374 }
75375
75376 /* Destroy an sqlite3_value object previously obtained from
75377 ** sqlite3_value_dup().
75378 */
75379 SQLITE_API void sqlite3_value_free(sqlite3_value *pOld){
75380 sqlite3ValueFree(pOld);
75381 }
75382
75383
75384 /**************************** sqlite3_result_ *******************************
@@ -75425,21 +75417,21 @@
75417 xDel((void*)p);
75418 }
75419 if( pCtx ) sqlite3_result_error_toobig(pCtx);
75420 return SQLITE_TOOBIG;
75421 }
75422 SQLITE_API void sqlite3_result_blob(
75423 sqlite3_context *pCtx,
75424 const void *z,
75425 int n,
75426 void (*xDel)(void *)
75427 ){
75428 assert( n>=0 );
75429 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75430 setResultStrOrError(pCtx, z, n, 0, xDel);
75431 }
75432 SQLITE_API void sqlite3_result_blob64(
75433 sqlite3_context *pCtx,
75434 const void *z,
75435 sqlite3_uint64 n,
75436 void (*xDel)(void *)
75437 ){
@@ -75449,56 +75441,56 @@
75441 (void)invokeValueDestructor(z, xDel, pCtx);
75442 }else{
75443 setResultStrOrError(pCtx, z, (int)n, 0, xDel);
75444 }
75445 }
75446 SQLITE_API void sqlite3_result_double(sqlite3_context *pCtx, double rVal){
75447 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75448 sqlite3VdbeMemSetDouble(pCtx->pOut, rVal);
75449 }
75450 SQLITE_API void sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){
75451 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75452 pCtx->isError = SQLITE_ERROR;
75453 pCtx->fErrorOrAux = 1;
75454 sqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF8, SQLITE_TRANSIENT);
75455 }
75456 #ifndef SQLITE_OMIT_UTF16
75457 SQLITE_API void sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){
75458 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75459 pCtx->isError = SQLITE_ERROR;
75460 pCtx->fErrorOrAux = 1;
75461 sqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF16NATIVE, SQLITE_TRANSIENT);
75462 }
75463 #endif
75464 SQLITE_API void sqlite3_result_int(sqlite3_context *pCtx, int iVal){
75465 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75466 sqlite3VdbeMemSetInt64(pCtx->pOut, (i64)iVal);
75467 }
75468 SQLITE_API void sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){
75469 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75470 sqlite3VdbeMemSetInt64(pCtx->pOut, iVal);
75471 }
75472 SQLITE_API void sqlite3_result_null(sqlite3_context *pCtx){
75473 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75474 sqlite3VdbeMemSetNull(pCtx->pOut);
75475 }
75476 SQLITE_API void sqlite3_result_subtype(sqlite3_context *pCtx, unsigned int eSubtype){
75477 Mem *pOut = pCtx->pOut;
75478 assert( sqlite3_mutex_held(pOut->db->mutex) );
75479 pOut->eSubtype = eSubtype & 0xff;
75480 pOut->flags |= MEM_Subtype;
75481 }
75482 SQLITE_API void sqlite3_result_text(
75483 sqlite3_context *pCtx,
75484 const char *z,
75485 int n,
75486 void (*xDel)(void *)
75487 ){
75488 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75489 setResultStrOrError(pCtx, z, n, SQLITE_UTF8, xDel);
75490 }
75491 SQLITE_API void sqlite3_result_text64(
75492 sqlite3_context *pCtx,
75493 const char *z,
75494 sqlite3_uint64 n,
75495 void (*xDel)(void *),
75496 unsigned char enc
@@ -75511,56 +75503,56 @@
75503 }else{
75504 setResultStrOrError(pCtx, z, (int)n, enc, xDel);
75505 }
75506 }
75507 #ifndef SQLITE_OMIT_UTF16
75508 SQLITE_API void sqlite3_result_text16(
75509 sqlite3_context *pCtx,
75510 const void *z,
75511 int n,
75512 void (*xDel)(void *)
75513 ){
75514 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75515 setResultStrOrError(pCtx, z, n, SQLITE_UTF16NATIVE, xDel);
75516 }
75517 SQLITE_API void sqlite3_result_text16be(
75518 sqlite3_context *pCtx,
75519 const void *z,
75520 int n,
75521 void (*xDel)(void *)
75522 ){
75523 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75524 setResultStrOrError(pCtx, z, n, SQLITE_UTF16BE, xDel);
75525 }
75526 SQLITE_API void sqlite3_result_text16le(
75527 sqlite3_context *pCtx,
75528 const void *z,
75529 int n,
75530 void (*xDel)(void *)
75531 ){
75532 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75533 setResultStrOrError(pCtx, z, n, SQLITE_UTF16LE, xDel);
75534 }
75535 #endif /* SQLITE_OMIT_UTF16 */
75536 SQLITE_API void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){
75537 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75538 sqlite3VdbeMemCopy(pCtx->pOut, pValue);
75539 }
75540 SQLITE_API void sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){
75541 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75542 sqlite3VdbeMemSetZeroBlob(pCtx->pOut, n);
75543 }
75544 SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context *pCtx, u64 n){
75545 Mem *pOut = pCtx->pOut;
75546 assert( sqlite3_mutex_held(pOut->db->mutex) );
75547 if( n>(u64)pOut->db->aLimit[SQLITE_LIMIT_LENGTH] ){
75548 return SQLITE_TOOBIG;
75549 }
75550 sqlite3VdbeMemSetZeroBlob(pCtx->pOut, (int)n);
75551 return SQLITE_OK;
75552 }
75553 SQLITE_API void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){
75554 pCtx->isError = errCode;
75555 pCtx->fErrorOrAux = 1;
75556 #ifdef SQLITE_DEBUG
75557 if( pCtx->pVdbe ) pCtx->pVdbe->rcApp = errCode;
75558 #endif
@@ -75569,20 +75561,20 @@
75561 SQLITE_UTF8, SQLITE_STATIC);
75562 }
75563 }
75564
75565 /* Force an SQLITE_TOOBIG error. */
75566 SQLITE_API void sqlite3_result_error_toobig(sqlite3_context *pCtx){
75567 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75568 pCtx->isError = SQLITE_TOOBIG;
75569 pCtx->fErrorOrAux = 1;
75570 sqlite3VdbeMemSetStr(pCtx->pOut, "string or blob too big", -1,
75571 SQLITE_UTF8, SQLITE_STATIC);
75572 }
75573
75574 /* An SQLITE_NOMEM error. */
75575 SQLITE_API void sqlite3_result_error_nomem(sqlite3_context *pCtx){
75576 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75577 sqlite3VdbeMemSetNull(pCtx->pOut);
75578 pCtx->isError = SQLITE_NOMEM_BKPT;
75579 pCtx->fErrorOrAux = 1;
75580 sqlite3OomFault(pCtx->pOut->db);
@@ -75750,11 +75742,11 @@
75742 /*
75743 ** This is the top-level implementation of sqlite3_step(). Call
75744 ** sqlite3Step() to do most of the work. If a schema error occurs,
75745 ** call sqlite3Reprepare() and try again.
75746 */
75747 SQLITE_API int sqlite3_step(sqlite3_stmt *pStmt){
75748 int rc = SQLITE_OK; /* Result from sqlite3Step() */
75749 int rc2 = SQLITE_OK; /* Result from sqlite3Reprepare() */
75750 Vdbe *v = (Vdbe*)pStmt; /* the prepared statement */
75751 int cnt = 0; /* Counter to prevent infinite loop of reprepares */
75752 sqlite3 *db; /* The database connection */
@@ -75801,11 +75793,11 @@
75793
75794 /*
75795 ** Extract the user data from a sqlite3_context structure and return a
75796 ** pointer to it.
75797 */
75798 SQLITE_API void *sqlite3_user_data(sqlite3_context *p){
75799 assert( p && p->pFunc );
75800 return p->pFunc->pUserData;
75801 }
75802
75803 /*
@@ -75816,11 +75808,11 @@
75808 ** returns a copy of the pointer to the database connection (the 1st
75809 ** parameter) of the sqlite3_create_function() and
75810 ** sqlite3_create_function16() routines that originally registered the
75811 ** application defined function.
75812 */
75813 SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context *p){
75814 assert( p && p->pOut );
75815 return p->pOut->db;
75816 }
75817
75818 /*
@@ -75892,11 +75884,11 @@
75884 /*
75885 ** Allocate or return the aggregate context for a user function. A new
75886 ** context is allocated on the first call. Subsequent calls return the
75887 ** same context that was returned on prior calls.
75888 */
75889 SQLITE_API void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){
75890 assert( p && p->pFunc && p->pFunc->xFinalize );
75891 assert( sqlite3_mutex_held(p->pOut->db->mutex) );
75892 testcase( nByte<0 );
75893 if( (p->pMem->flags & MEM_Agg)==0 ){
75894 return createAggContext(p, nByte);
@@ -75907,11 +75899,11 @@
75899
75900 /*
75901 ** Return the auxiliary data pointer, if any, for the iArg'th argument to
75902 ** the user-function defined by pCtx.
75903 */
75904 SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
75905 AuxData *pAuxData;
75906
75907 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
75908 #if SQLITE_ENABLE_STAT3_OR_STAT4
75909 if( pCtx->pVdbe==0 ) return 0;
@@ -75928,11 +75920,11 @@
75920 /*
75921 ** Set the auxiliary data pointer and delete function, for the iArg'th
75922 ** argument to the user-function defined by pCtx. Any previous value is
75923 ** deleted by calling the delete function specified when it was set.
75924 */
75925 SQLITE_API void sqlite3_set_auxdata(
75926 sqlite3_context *pCtx,
75927 int iArg,
75928 void *pAux,
75929 void (*xDelete)(void*)
75930 ){
@@ -75983,29 +75975,29 @@
75975 ** This function is deprecated. Do not use it for new code. It is
75976 ** provide only to avoid breaking legacy code. New aggregate function
75977 ** implementations should keep their own counts within their aggregate
75978 ** context.
75979 */
75980 SQLITE_API int sqlite3_aggregate_count(sqlite3_context *p){
75981 assert( p && p->pMem && p->pFunc && p->pFunc->xFinalize );
75982 return p->pMem->n;
75983 }
75984 #endif
75985
75986 /*
75987 ** Return the number of columns in the result set for the statement pStmt.
75988 */
75989 SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt){
75990 Vdbe *pVm = (Vdbe *)pStmt;
75991 return pVm ? pVm->nResColumn : 0;
75992 }
75993
75994 /*
75995 ** Return the number of values available from the current row of the
75996 ** currently executing statement pStmt.
75997 */
75998 SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt){
75999 Vdbe *pVm = (Vdbe *)pStmt;
76000 if( pVm==0 || pVm->pResultSet==0 ) return 0;
76001 return pVm->nResColumn;
76002 }
76003
@@ -76104,67 +76096,67 @@
76096
76097 /**************************** sqlite3_column_ *******************************
76098 ** The following routines are used to access elements of the current row
76099 ** in the result set.
76100 */
76101 SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt *pStmt, int i){
76102 const void *val;
76103 val = sqlite3_value_blob( columnMem(pStmt,i) );
76104 /* Even though there is no encoding conversion, value_blob() might
76105 ** need to call malloc() to expand the result of a zeroblob()
76106 ** expression.
76107 */
76108 columnMallocFailure(pStmt);
76109 return val;
76110 }
76111 SQLITE_API int sqlite3_column_bytes(sqlite3_stmt *pStmt, int i){
76112 int val = sqlite3_value_bytes( columnMem(pStmt,i) );
76113 columnMallocFailure(pStmt);
76114 return val;
76115 }
76116 SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt *pStmt, int i){
76117 int val = sqlite3_value_bytes16( columnMem(pStmt,i) );
76118 columnMallocFailure(pStmt);
76119 return val;
76120 }
76121 SQLITE_API double sqlite3_column_double(sqlite3_stmt *pStmt, int i){
76122 double val = sqlite3_value_double( columnMem(pStmt,i) );
76123 columnMallocFailure(pStmt);
76124 return val;
76125 }
76126 SQLITE_API int sqlite3_column_int(sqlite3_stmt *pStmt, int i){
76127 int val = sqlite3_value_int( columnMem(pStmt,i) );
76128 columnMallocFailure(pStmt);
76129 return val;
76130 }
76131 SQLITE_API sqlite_int64 sqlite3_column_int64(sqlite3_stmt *pStmt, int i){
76132 sqlite_int64 val = sqlite3_value_int64( columnMem(pStmt,i) );
76133 columnMallocFailure(pStmt);
76134 return val;
76135 }
76136 SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt *pStmt, int i){
76137 const unsigned char *val = sqlite3_value_text( columnMem(pStmt,i) );
76138 columnMallocFailure(pStmt);
76139 return val;
76140 }
76141 SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt *pStmt, int i){
76142 Mem *pOut = columnMem(pStmt, i);
76143 if( pOut->flags&MEM_Static ){
76144 pOut->flags &= ~MEM_Static;
76145 pOut->flags |= MEM_Ephem;
76146 }
76147 columnMallocFailure(pStmt);
76148 return (sqlite3_value *)pOut;
76149 }
76150 #ifndef SQLITE_OMIT_UTF16
76151 SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt *pStmt, int i){
76152 const void *val = sqlite3_value_text16( columnMem(pStmt,i) );
76153 columnMallocFailure(pStmt);
76154 return val;
76155 }
76156 #endif /* SQLITE_OMIT_UTF16 */
76157 SQLITE_API int sqlite3_column_type(sqlite3_stmt *pStmt, int i){
76158 int iType = sqlite3_value_type( columnMem(pStmt,i) );
76159 columnMallocFailure(pStmt);
76160 return iType;
76161 }
76162
@@ -76224,16 +76216,16 @@
76216
76217 /*
76218 ** Return the name of the Nth column of the result set returned by SQL
76219 ** statement pStmt.
76220 */
76221 SQLITE_API const char *sqlite3_column_name(sqlite3_stmt *pStmt, int N){
76222 return columnName(
76223 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_NAME);
76224 }
76225 #ifndef SQLITE_OMIT_UTF16
76226 SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){
76227 return columnName(
76228 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_NAME);
76229 }
76230 #endif
76231
@@ -76249,16 +76241,16 @@
76241 #ifndef SQLITE_OMIT_DECLTYPE
76242 /*
76243 ** Return the column declaration type (if applicable) of the 'i'th column
76244 ** of the result set of SQL statement pStmt.
76245 */
76246 SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){
76247 return columnName(
76248 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DECLTYPE);
76249 }
76250 #ifndef SQLITE_OMIT_UTF16
76251 SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){
76252 return columnName(
76253 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DECLTYPE);
76254 }
76255 #endif /* SQLITE_OMIT_UTF16 */
76256 #endif /* SQLITE_OMIT_DECLTYPE */
@@ -76267,16 +76259,16 @@
76259 /*
76260 ** Return the name of the database from which a result column derives.
76261 ** NULL is returned if the result column is an expression or constant or
76262 ** anything else which is not an unambiguous reference to a database column.
76263 */
76264 SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt *pStmt, int N){
76265 return columnName(
76266 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DATABASE);
76267 }
76268 #ifndef SQLITE_OMIT_UTF16
76269 SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N){
76270 return columnName(
76271 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DATABASE);
76272 }
76273 #endif /* SQLITE_OMIT_UTF16 */
76274
@@ -76283,16 +76275,16 @@
76275 /*
76276 ** Return the name of the table from which a result column derives.
76277 ** NULL is returned if the result column is an expression or constant or
76278 ** anything else which is not an unambiguous reference to a database column.
76279 */
76280 SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt *pStmt, int N){
76281 return columnName(
76282 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_TABLE);
76283 }
76284 #ifndef SQLITE_OMIT_UTF16
76285 SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){
76286 return columnName(
76287 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_TABLE);
76288 }
76289 #endif /* SQLITE_OMIT_UTF16 */
76290
@@ -76299,16 +76291,16 @@
76291 /*
76292 ** Return the name of the table column from which a result column derives.
76293 ** NULL is returned if the result column is an expression or constant or
76294 ** anything else which is not an unambiguous reference to a database column.
76295 */
76296 SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N){
76297 return columnName(
76298 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_COLUMN);
76299 }
76300 #ifndef SQLITE_OMIT_UTF16
76301 SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){
76302 return columnName(
76303 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_COLUMN);
76304 }
76305 #endif /* SQLITE_OMIT_UTF16 */
76306 #endif /* SQLITE_ENABLE_COLUMN_METADATA */
@@ -76405,11 +76397,11 @@
76397
76398
76399 /*
76400 ** Bind a blob value to an SQL statement variable.
76401 */
76402 SQLITE_API int sqlite3_bind_blob(
76403 sqlite3_stmt *pStmt,
76404 int i,
76405 const void *zData,
76406 int nData,
76407 void (*xDel)(void*)
@@ -76417,11 +76409,11 @@
76409 #ifdef SQLITE_ENABLE_API_ARMOR
76410 if( nData<0 ) return SQLITE_MISUSE_BKPT;
76411 #endif
76412 return bindText(pStmt, i, zData, nData, xDel, 0);
76413 }
76414 SQLITE_API int sqlite3_bind_blob64(
76415 sqlite3_stmt *pStmt,
76416 int i,
76417 const void *zData,
76418 sqlite3_uint64 nData,
76419 void (*xDel)(void*)
@@ -76431,52 +76423,52 @@
76423 return invokeValueDestructor(zData, xDel, 0);
76424 }else{
76425 return bindText(pStmt, i, zData, (int)nData, xDel, 0);
76426 }
76427 }
76428 SQLITE_API int sqlite3_bind_double(sqlite3_stmt *pStmt, int i, double rValue){
76429 int rc;
76430 Vdbe *p = (Vdbe *)pStmt;
76431 rc = vdbeUnbind(p, i);
76432 if( rc==SQLITE_OK ){
76433 sqlite3VdbeMemSetDouble(&p->aVar[i-1], rValue);
76434 sqlite3_mutex_leave(p->db->mutex);
76435 }
76436 return rc;
76437 }
76438 SQLITE_API int sqlite3_bind_int(sqlite3_stmt *p, int i, int iValue){
76439 return sqlite3_bind_int64(p, i, (i64)iValue);
76440 }
76441 SQLITE_API int sqlite3_bind_int64(sqlite3_stmt *pStmt, int i, sqlite_int64 iValue){
76442 int rc;
76443 Vdbe *p = (Vdbe *)pStmt;
76444 rc = vdbeUnbind(p, i);
76445 if( rc==SQLITE_OK ){
76446 sqlite3VdbeMemSetInt64(&p->aVar[i-1], iValue);
76447 sqlite3_mutex_leave(p->db->mutex);
76448 }
76449 return rc;
76450 }
76451 SQLITE_API int sqlite3_bind_null(sqlite3_stmt *pStmt, int i){
76452 int rc;
76453 Vdbe *p = (Vdbe*)pStmt;
76454 rc = vdbeUnbind(p, i);
76455 if( rc==SQLITE_OK ){
76456 sqlite3_mutex_leave(p->db->mutex);
76457 }
76458 return rc;
76459 }
76460 SQLITE_API int sqlite3_bind_text(
76461 sqlite3_stmt *pStmt,
76462 int i,
76463 const char *zData,
76464 int nData,
76465 void (*xDel)(void*)
76466 ){
76467 return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF8);
76468 }
76469 SQLITE_API int sqlite3_bind_text64(
76470 sqlite3_stmt *pStmt,
76471 int i,
76472 const char *zData,
76473 sqlite3_uint64 nData,
76474 void (*xDel)(void*),
@@ -76489,21 +76481,21 @@
76481 if( enc==SQLITE_UTF16 ) enc = SQLITE_UTF16NATIVE;
76482 return bindText(pStmt, i, zData, (int)nData, xDel, enc);
76483 }
76484 }
76485 #ifndef SQLITE_OMIT_UTF16
76486 SQLITE_API int sqlite3_bind_text16(
76487 sqlite3_stmt *pStmt,
76488 int i,
76489 const void *zData,
76490 int nData,
76491 void (*xDel)(void*)
76492 ){
76493 return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF16NATIVE);
76494 }
76495 #endif /* SQLITE_OMIT_UTF16 */
76496 SQLITE_API int sqlite3_bind_value(sqlite3_stmt *pStmt, int i, const sqlite3_value *pValue){
76497 int rc;
76498 switch( sqlite3_value_type((sqlite3_value*)pValue) ){
76499 case SQLITE_INTEGER: {
76500 rc = sqlite3_bind_int64(pStmt, i, pValue->u.i);
76501 break;
@@ -76530,21 +76522,21 @@
76522 break;
76523 }
76524 }
76525 return rc;
76526 }
76527 SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){
76528 int rc;
76529 Vdbe *p = (Vdbe *)pStmt;
76530 rc = vdbeUnbind(p, i);
76531 if( rc==SQLITE_OK ){
76532 sqlite3VdbeMemSetZeroBlob(&p->aVar[i-1], n);
76533 sqlite3_mutex_leave(p->db->mutex);
76534 }
76535 return rc;
76536 }
76537 SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt *pStmt, int i, sqlite3_uint64 n){
76538 int rc;
76539 Vdbe *p = (Vdbe *)pStmt;
76540 sqlite3_mutex_enter(p->db->mutex);
76541 if( n>(u64)p->db->aLimit[SQLITE_LIMIT_LENGTH] ){
76542 rc = SQLITE_TOOBIG;
@@ -76559,11 +76551,11 @@
76551
76552 /*
76553 ** Return the number of wildcards that can be potentially bound to.
76554 ** This routine is added to support DBD::SQLite.
76555 */
76556 SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){
76557 Vdbe *p = (Vdbe*)pStmt;
76558 return p ? p->nVar : 0;
76559 }
76560
76561 /*
@@ -76570,11 +76562,11 @@
76562 ** Return the name of a wildcard parameter. Return NULL if the index
76563 ** is out of range or if the wildcard is unnamed.
76564 **
76565 ** The result is always UTF-8.
76566 */
76567 SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt *pStmt, int i){
76568 Vdbe *p = (Vdbe*)pStmt;
76569 if( p==0 || i<1 || i>p->nzVar ){
76570 return 0;
76571 }
76572 return p->azVar[i-1];
@@ -76598,11 +76590,11 @@
76590 }
76591 }
76592 }
76593 return 0;
76594 }
76595 SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const char *zName){
76596 return sqlite3VdbeParameterIndex((Vdbe*)pStmt, zName, sqlite3Strlen30(zName));
76597 }
76598
76599 /*
76600 ** Transfer all bindings from the first statement over to the second.
@@ -76632,11 +76624,11 @@
76624 **
76625 ** If the two statements contain a different number of bindings, then
76626 ** an SQLITE_ERROR is returned. Nothing else can go wrong, so otherwise
76627 ** SQLITE_OK is returned.
76628 */
76629 SQLITE_API int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){
76630 Vdbe *pFrom = (Vdbe*)pFromStmt;
76631 Vdbe *pTo = (Vdbe*)pToStmt;
76632 if( pFrom->nVar!=pTo->nVar ){
76633 return SQLITE_ERROR;
76634 }
@@ -76654,26 +76646,26 @@
76646 ** Return the sqlite3* database handle to which the prepared statement given
76647 ** in the argument belongs. This is the same database handle that was
76648 ** the first argument to the sqlite3_prepare() that was used to create
76649 ** the statement in the first place.
76650 */
76651 SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt *pStmt){
76652 return pStmt ? ((Vdbe*)pStmt)->db : 0;
76653 }
76654
76655 /*
76656 ** Return true if the prepared statement is guaranteed to not modify the
76657 ** database.
76658 */
76659 SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt){
76660 return pStmt ? ((Vdbe*)pStmt)->readOnly : 1;
76661 }
76662
76663 /*
76664 ** Return true if the prepared statement is in need of being reset.
76665 */
76666 SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt *pStmt){
76667 Vdbe *v = (Vdbe*)pStmt;
76668 return v!=0 && v->pc>=0 && v->magic==VDBE_MAGIC_RUN;
76669 }
76670
76671 /*
@@ -76680,11 +76672,11 @@
76672 ** Return a pointer to the next prepared statement after pStmt associated
76673 ** with database connection pDb. If pStmt is NULL, return the first
76674 ** prepared statement for the database connection. Return NULL if there
76675 ** are no more.
76676 */
76677 SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt){
76678 sqlite3_stmt *pNext;
76679 #ifdef SQLITE_ENABLE_API_ARMOR
76680 if( !sqlite3SafetyCheckOk(pDb) ){
76681 (void)SQLITE_MISUSE_BKPT;
76682 return 0;
@@ -76701,11 +76693,11 @@
76693 }
76694
76695 /*
76696 ** Return the value of a status counter for a prepared statement
76697 */
76698 SQLITE_API int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){
76699 Vdbe *pVdbe = (Vdbe*)pStmt;
76700 u32 v;
76701 #ifdef SQLITE_ENABLE_API_ARMOR
76702 if( !pStmt ){
76703 (void)SQLITE_MISUSE_BKPT;
@@ -76718,11 +76710,11 @@
76710 }
76711
76712 /*
76713 ** Return the SQL associated with a prepared statement
76714 */
76715 SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt){
76716 Vdbe *p = (Vdbe *)pStmt;
76717 return p ? p->zSql : 0;
76718 }
76719
76720 /*
@@ -76732,11 +76724,11 @@
76724 ** freeing the returned string by passing it to sqlite3_free().
76725 **
76726 ** The SQLITE_TRACE_SIZE_LIMIT puts an upper bound on the size of
76727 ** expanded bound parameters.
76728 */
76729 SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt){
76730 #ifdef SQLITE_OMIT_TRACE
76731 return 0;
76732 #else
76733 char *z = 0;
76734 const char *zSql = sqlite3_sql(pStmt);
@@ -76774,11 +76766,11 @@
76766
76767 /*
76768 ** This function is called from within a pre-update callback to retrieve
76769 ** a field of the row currently being updated or deleted.
76770 */
76771 SQLITE_API int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppValue){
76772 PreUpdate *p = db->pPreUpdate;
76773 int rc = SQLITE_OK;
76774
76775 /* Test that this call is being made from within an SQLITE_DELETE or
76776 ** SQLITE_UPDATE pre-update callback, and that iIdx is within range. */
@@ -76829,11 +76821,11 @@
76821 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
76822 /*
76823 ** This function is called from within a pre-update callback to retrieve
76824 ** the number of columns in the row being updated, deleted or inserted.
76825 */
76826 SQLITE_API int sqlite3_preupdate_count(sqlite3 *db){
76827 PreUpdate *p = db->pPreUpdate;
76828 return (p ? p->keyinfo.nField : 0);
76829 }
76830 #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
76831
@@ -76847,11 +76839,11 @@
76839 ** top-level trigger etc.).
76840 **
76841 ** For the purposes of the previous paragraph, a foreign key CASCADE, SET NULL
76842 ** or SET DEFAULT action is considered a trigger.
76843 */
76844 SQLITE_API int sqlite3_preupdate_depth(sqlite3 *db){
76845 PreUpdate *p = db->pPreUpdate;
76846 return (p ? p->v->nFrame : 0);
76847 }
76848 #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
76849
@@ -76858,11 +76850,11 @@
76850 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
76851 /*
76852 ** This function is called from within a pre-update callback to retrieve
76853 ** a field of the row currently being updated or inserted.
76854 */
76855 SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppValue){
76856 PreUpdate *p = db->pPreUpdate;
76857 int rc = SQLITE_OK;
76858 Mem *pMem;
76859
76860 if( !p || p->op==SQLITE_DELETE ){
@@ -76878,11 +76870,11 @@
76870 /* For an INSERT, memory cell p->iNewReg contains the serialized record
76871 ** that is being inserted. Deserialize it. */
76872 UnpackedRecord *pUnpack = p->pNewUnpacked;
76873 if( !pUnpack ){
76874 Mem *pData = &p->v->aMem[p->iNewReg];
76875 rc = ExpandBlob(pData);
76876 if( rc!=SQLITE_OK ) goto preupdate_new_out;
76877 pUnpack = vdbeUnpackRecord(&p->keyinfo, pData->n, pData->z);
76878 if( !pUnpack ){
76879 rc = SQLITE_NOMEM;
76880 goto preupdate_new_out;
@@ -76932,11 +76924,11 @@
76924
76925 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
76926 /*
76927 ** Return status data for a single loop within query pStmt.
76928 */
76929 SQLITE_API int sqlite3_stmt_scanstatus(
76930 sqlite3_stmt *pStmt, /* Prepared statement being queried */
76931 int idx, /* Index of loop to report on */
76932 int iScanStatusOp, /* Which metric to return */
76933 void *pOut /* OUT: Write the answer here */
76934 ){
@@ -76991,11 +76983,11 @@
76983 }
76984
76985 /*
76986 ** Zero all counters associated with the sqlite3_stmt_scanstatus() data.
76987 */
76988 SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt *pStmt){
76989 Vdbe *p = (Vdbe*)pStmt;
76990 memset(p->anExec, 0, p->nOp * sizeof(i64));
76991 }
76992 #endif /* SQLITE_ENABLE_STMT_SCANSTATUS */
76993
@@ -77518,11 +77510,11 @@
77510 ** Try to convert the type of a function argument or a result column
77511 ** into a numeric representation. Use either INTEGER or REAL whichever
77512 ** is appropriate. But only do the conversion if it is possible without
77513 ** loss of information and return the revised type of the argument.
77514 */
77515 SQLITE_API int sqlite3_value_numeric_type(sqlite3_value *pVal){
77516 int eType = sqlite3_value_type(pVal);
77517 if( eType==SQLITE_TEXT ){
77518 Mem *pMem = (Mem*)pVal;
77519 applyNumericAffinity(pMem, 0);
77520 eType = sqlite3_value_type(pVal);
@@ -79344,12 +79336,11 @@
79336 testcase( pIn1->flags & MEM_Int );
79337 testcase( pIn1->flags & MEM_Real );
79338 sqlite3VdbeMemStringify(pIn1, encoding, 1);
79339 testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) );
79340 flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask);
79341 assert( pIn1!=pIn3 );
 
79342 }
79343 if( (flags3 & MEM_Str)==0 && (flags3 & (MEM_Int|MEM_Real))!=0 ){
79344 testcase( pIn3->flags & MEM_Int );
79345 testcase( pIn3->flags & MEM_Real );
79346 sqlite3VdbeMemStringify(pIn3, encoding, 1);
@@ -79409,15 +79400,15 @@
79400 break;
79401 }
79402
79403 /* Opcode: ElseNotEq * P2 * * *
79404 **
79405 ** This opcode must immediately follow an OP_Lt or OP_Gt comparison operator.
79406 ** If result of an OP_Eq comparison on the same two operands
79407 ** would have be NULL or false (0), then then jump to P2.
79408 ** If the result of an OP_Eq comparison on the two previous operands
79409 ** would have been true (1), then fall through.
79410 */
79411 case OP_ElseNotEq: { /* same as TK_ESCAPE, jump */
79412 assert( pOp>aOp );
79413 assert( pOp[-1].opcode==OP_Lt || pOp[-1].opcode==OP_Gt );
79414 assert( pOp[-1].p5 & SQLITE_STOREP2 );
@@ -79620,26 +79611,22 @@
79611 break;
79612 }
79613
79614 /* Opcode: Once P1 P2 * * *
79615 **
79616 ** If the P1 value is equal to the P1 value on the OP_Init opcode at
79617 ** instruction 0, then jump to P2. If the two P1 values differ, then
79618 ** set the P1 value on this opcode to equal the P1 value on the OP_Init
79619 ** and fall through.
 
 
 
 
79620 */
79621 case OP_Once: { /* jump */
79622 assert( p->aOp[0].opcode==OP_Init );
79623 VdbeBranchTaken(p->aOp[0].p1==pOp->p1, 2);
79624 if( p->aOp[0].p1==pOp->p1 ){
79625 goto jump_to_p2;
79626 }else{
79627 pOp->p1 = p->aOp[0].p1;
79628 }
79629 break;
79630 }
79631
79632 /* Opcode: If P1 P2 P3 * *
@@ -80468,16 +80455,16 @@
80455
80456 if( pBt ){
80457 rc = sqlite3BtreeBeginTrans(pBt, pOp->p2);
80458 testcase( rc==SQLITE_BUSY_SNAPSHOT );
80459 testcase( rc==SQLITE_BUSY_RECOVERY );
 
 
 
 
 
80460 if( rc!=SQLITE_OK ){
80461 if( (rc&0xff)==SQLITE_BUSY ){
80462 p->pc = (int)(pOp - aOp);
80463 p->rc = rc;
80464 goto vdbe_return;
80465 }
80466 goto abort_due_to_error;
80467 }
80468
80469 if( pOp->p2 && p->usesStmtJournal
80470 && (db->autoCommit==0 || db->nVdbeRead>1)
@@ -81164,11 +81151,10 @@
81151
81152 r.aMem = &aMem[pOp->p3];
81153 #ifdef SQLITE_DEBUG
81154 { int i; for(i=0; i<r.nField; i++) assert( memIsValid(&r.aMem[i]) ); }
81155 #endif
 
81156 r.eqSeen = 0;
81157 rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, &r, 0, 0, &res);
81158 if( rc!=SQLITE_OK ){
81159 goto abort_due_to_error;
81160 }
@@ -81305,17 +81291,17 @@
81291 pFree = 0;
81292 if( pOp->p4.i>0 ){
81293 r.pKeyInfo = pC->pKeyInfo;
81294 r.nField = (u16)pOp->p4.i;
81295 r.aMem = pIn3;
81296 #ifdef SQLITE_DEBUG
81297 for(ii=0; ii<r.nField; ii++){
81298 assert( memIsValid(&r.aMem[ii]) );
81299 assert( (r.aMem[ii].flags & MEM_Zero)==0 || r.aMem[ii].n==0 );
 
81300 if( ii ) REGISTER_TRACE(pOp->p3+ii, &r.aMem[ii]);
81301 }
81302 #endif
 
81303 pIdxKey = &r;
81304 }else{
81305 pIdxKey = sqlite3VdbeAllocUnpackedRecord(
81306 pC->pKeyInfo, aTempRec, sizeof(aTempRec), &pFree
81307 );
@@ -83078,12 +83064,11 @@
83064 nMem = pProgram->nMem + pProgram->nCsr;
83065 assert( nMem>0 );
83066 if( pProgram->nCsr==0 ) nMem++;
83067 nByte = ROUND8(sizeof(VdbeFrame))
83068 + nMem * sizeof(Mem)
83069 + pProgram->nCsr * sizeof(VdbeCursor *);
 
83070 pFrame = sqlite3DbMallocZero(db, nByte);
83071 if( !pFrame ){
83072 goto no_mem;
83073 }
83074 sqlite3VdbeMemRelease(pRt);
@@ -83099,12 +83084,10 @@
83084 pFrame->apCsr = p->apCsr;
83085 pFrame->nCursor = p->nCursor;
83086 pFrame->aOp = p->aOp;
83087 pFrame->nOp = p->nOp;
83088 pFrame->token = pProgram->token;
 
 
83089 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
83090 pFrame->anExec = p->anExec;
83091 #endif
83092
83093 pEnd = &VdbeFrameMem(pFrame)[pFrame->nChildMem];
@@ -83134,17 +83117,14 @@
83117 p->nMem = pFrame->nChildMem;
83118 p->nCursor = (u16)pFrame->nChildCsr;
83119 p->apCsr = (VdbeCursor **)&aMem[p->nMem];
83120 p->aOp = aOp = pProgram->aOp;
83121 p->nOp = pProgram->nOp;
 
 
83122 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
83123 p->anExec = 0;
83124 #endif
83125 pOp = &aOp[-1];
 
83126
83127 break;
83128 }
83129
83130 /* Opcode: Param P1 P2 * * *
@@ -84107,11 +84087,11 @@
84087 break;
84088 }
84089 #endif
84090
84091
84092 /* Opcode: Init P1 P2 * P4 *
84093 ** Synopsis: Start at P2
84094 **
84095 ** Programs contain a single instance of this opcode as the very first
84096 ** opcode.
84097 **
@@ -84118,13 +84098,17 @@
84098 ** If tracing is enabled (by the sqlite3_trace()) interface, then
84099 ** the UTF-8 string contained in P4 is emitted on the trace callback.
84100 ** Or if P4 is blank, use the string returned by sqlite3_sql().
84101 **
84102 ** If P2 is not zero, jump to instruction P2.
84103 **
84104 ** Increment the value of P1 so that OP_Once opcodes will jump the
84105 ** first time they are evaluated for this run.
84106 */
84107 case OP_Init: { /* jump */
84108 char *zTrace;
84109 int i;
84110
84111 /* If the P4 argument is not NULL, then it must be an SQL comment string.
84112 ** The "--" string is broken up to prevent false-positives with srcck1.c.
84113 **
84114 ** This assert() provides evidence for:
@@ -84132,10 +84116,11 @@
84116 ** would have been returned by the legacy sqlite3_trace() interface by
84117 ** using the X argument when X begins with "--" and invoking
84118 ** sqlite3_expanded_sql(P) otherwise.
84119 */
84120 assert( pOp->p4.z==0 || strncmp(pOp->p4.z, "-" "- ", 3)==0 );
84121 assert( pOp==p->aOp ); /* Always instruction 0 */
84122
84123 #ifndef SQLITE_OMIT_TRACE
84124 if( (db->mTrace & (SQLITE_TRACE_STMT|SQLITE_TRACE_LEGACY))!=0
84125 && !p->doingRerun
84126 && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0
@@ -84153,14 +84138,14 @@
84138 }
84139 }
84140 #ifdef SQLITE_USE_FCNTL_TRACE
84141 zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql);
84142 if( zTrace ){
84143 int j;
84144 for(j=0; j<db->nDb; j++){
84145 if( DbMaskTest(p->btreeMask, j)==0 ) continue;
84146 sqlite3_file_control(db, db->aDb[j].zDbSName, SQLITE_FCNTL_TRACE, zTrace);
84147 }
84148 }
84149 #endif /* SQLITE_USE_FCNTL_TRACE */
84150 #ifdef SQLITE_DEBUG
84151 if( (db->flags & SQLITE_SqlTrace)!=0
@@ -84169,10 +84154,17 @@
84154 sqlite3DebugPrintf("SQL-trace: %s\n", zTrace);
84155 }
84156 #endif /* SQLITE_DEBUG */
84157 #endif /* SQLITE_OMIT_TRACE */
84158 assert( pOp->p2>0 );
84159 if( pOp->p1>=sqlite3GlobalConfig.iOnceResetThreshold ){
84160 for(i=1; i<p->nOp; i++){
84161 if( p->aOp[i].opcode==OP_Once ) p->aOp[i].p1 = 0;
84162 }
84163 pOp->p1 = 0;
84164 }
84165 pOp->p1++;
84166 goto jump_to_p2;
84167 }
84168
84169 #ifdef SQLITE_ENABLE_CURSOR_HINTS
84170 /* Opcode: CursorHint P1 * * P4 *
@@ -84422,11 +84414,11 @@
84414 }
84415
84416 /*
84417 ** Open a blob handle.
84418 */
84419 SQLITE_API int sqlite3_blob_open(
84420 sqlite3* db, /* The database connection */
84421 const char *zDb, /* The attached database containing the blob */
84422 const char *zTable, /* The table containing the blob */
84423 const char *zColumn, /* The column containing the blob */
84424 sqlite_int64 iRow, /* The row containing the glob */
@@ -84663,11 +84655,11 @@
84655
84656 /*
84657 ** Close a blob handle that was previously created using
84658 ** sqlite3_blob_open().
84659 */
84660 SQLITE_API int sqlite3_blob_close(sqlite3_blob *pBlob){
84661 Incrblob *p = (Incrblob *)pBlob;
84662 int rc;
84663 sqlite3 *db;
84664
84665 if( p ){
@@ -84756,28 +84748,28 @@
84748 }
84749
84750 /*
84751 ** Read data from a blob handle.
84752 */
84753 SQLITE_API int sqlite3_blob_read(sqlite3_blob *pBlob, void *z, int n, int iOffset){
84754 return blobReadWrite(pBlob, z, n, iOffset, sqlite3BtreeData);
84755 }
84756
84757 /*
84758 ** Write data to a blob handle.
84759 */
84760 SQLITE_API int sqlite3_blob_write(sqlite3_blob *pBlob, const void *z, int n, int iOffset){
84761 return blobReadWrite(pBlob, (void *)z, n, iOffset, sqlite3BtreePutData);
84762 }
84763
84764 /*
84765 ** Query a blob handle for the size of the data.
84766 **
84767 ** The Incrblob.nByte field is fixed for the lifetime of the Incrblob
84768 ** so no mutex is required for access.
84769 */
84770 SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *pBlob){
84771 Incrblob *p = (Incrblob *)pBlob;
84772 return (p && p->pStmt) ? p->nByte : 0;
84773 }
84774
84775 /*
@@ -84788,11 +84780,11 @@
84780 ** contain a blob or text value, then an error code is returned and the
84781 ** database handle error code and message set. If this happens, then all
84782 ** subsequent calls to sqlite3_blob_xxx() functions (except blob_close())
84783 ** immediately return SQLITE_ABORT.
84784 */
84785 SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *pBlob, sqlite3_int64 iRow){
84786 int rc;
84787 Incrblob *p = (Incrblob *)pBlob;
84788 sqlite3 *db;
84789
84790 if( p==0 ) return SQLITE_MISUSE_BKPT;
@@ -88049,11 +88041,11 @@
88041 if( rc || ExprHasProperty(pExpr,EP_TokenOnly) ) return rc & WRC_Abort;
88042 if( pExpr->pLeft && walkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;
88043 if( pExpr->pRight && walkExpr(pWalker, pExpr->pRight) ) return WRC_Abort;
88044 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
88045 if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;
88046 }else if( pExpr->x.pList ){
88047 if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
88048 }
88049 return WRC_Continue;
88050 }
88051 SQLITE_PRIVATE int sqlite3WalkExpr(Walker *pWalker, Expr *pExpr){
@@ -88811,11 +88803,10 @@
88803 ExprList *pList = pExpr->x.pList; /* The argument list */
88804 int n = pList ? pList->nExpr : 0; /* Number of arguments */
88805 int no_such_func = 0; /* True if no such function exists */
88806 int wrong_num_args = 0; /* True if wrong number of arguments */
88807 int is_agg = 0; /* True if is an aggregate function */
 
88808 int nId; /* Number of characters in function name */
88809 const char *zId; /* The function name. */
88810 FuncDef *pDef; /* Information about the function */
88811 u8 enc = ENC(pParse->db); /* The database encoding */
88812
@@ -88855,19 +88846,21 @@
88846 /* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */
88847 pExpr->iTable = pDef->zName[0]=='u' ? 8388608 : 125829120;
88848 }
88849 }
88850 #ifndef SQLITE_OMIT_AUTHORIZATION
88851 {
88852 int auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0,pDef->zName,0);
88853 if( auth!=SQLITE_OK ){
88854 if( auth==SQLITE_DENY ){
88855 sqlite3ErrorMsg(pParse, "not authorized to use function: %s",
88856 pDef->zName);
88857 pNC->nErr++;
88858 }
88859 pExpr->op = TK_NULL;
88860 return WRC_Prune;
88861 }
88862 }
88863 #endif
88864 if( pDef->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG) ){
88865 /* For the purposes of the EP_ConstFunc flag, date and time
88866 ** functions and other functions that change slowly are considered
@@ -91664,19 +91657,10 @@
91657 }
91658 return p;
91659 }
91660 #endif /* SQLITE_OMIT_SUBQUERY */
91661
 
 
 
 
 
 
 
 
 
91662 #ifndef SQLITE_OMIT_SUBQUERY
91663 /*
91664 ** Generate code that checks the left-most column of index table iCur to see if
91665 ** it contains any NULL entries. Cause the register at regHasNull to be set
91666 ** to a non-NULL value if iCur contains no NULLs. Cause register regHasNull
@@ -91846,11 +91830,11 @@
91830 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
91831
91832 assert(v); /* sqlite3GetVdbe() has always been previously called */
91833 if( nExpr==1 && pEList->a[0].pExpr->iColumn<0 ){
91834 /* The "x IN (SELECT rowid FROM table)" case */
91835 int iAddr = sqlite3VdbeAddOp0(v, OP_Once);
91836 VdbeCoverage(v);
91837
91838 sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);
91839 eType = IN_INDEX_ROWID;
91840
@@ -91929,11 +91913,11 @@
91913 }
91914
91915 assert( i==nExpr || colUsed!=(MASKBIT(nExpr)-1) );
91916 if( colUsed==(MASKBIT(nExpr)-1) ){
91917 /* If we reach this point, that means the index pIdx is usable */
91918 int iAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
91919 #ifndef SQLITE_OMIT_EXPLAIN
91920 sqlite3VdbeAddOp4(v, OP_Explain, 0, 0, 0,
91921 sqlite3MPrintf(db, "USING INDEX %s FOR IN-OPERATOR",pIdx->zName),
91922 P4_DYNAMIC);
91923 #endif
@@ -92104,11 +92088,11 @@
92088 **
92089 ** If all of the above are false, then we can run this code just once
92090 ** save the results, and reuse the same result on subsequent invocations.
92091 */
92092 if( !ExprHasProperty(pExpr, EP_VarSelect) ){
92093 jmpIfDynamic = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
92094 }
92095
92096 #ifndef SQLITE_OMIT_EXPLAIN
92097 if( pParse->explain==2 ){
92098 char *zMsg = sqlite3MPrintf(pParse->db, "EXECUTE %s%s SUBQUERY %d",
@@ -93044,11 +93028,10 @@
93028 int op; /* The opcode being coded */
93029 int inReg = target; /* Results stored in register inReg */
93030 int regFree1 = 0; /* If non-zero free this temporary register */
93031 int regFree2 = 0; /* If non-zero free this temporary register */
93032 int r1, r2; /* Various register numbers */
 
93033 Expr tempX; /* Temporary expression node */
93034 int p5 = 0;
93035
93036 assert( target>0 && target<=pParse->nMem );
93037 if( v==0 ){
@@ -93065,56 +93048,53 @@
93048 case TK_AGG_COLUMN: {
93049 AggInfo *pAggInfo = pExpr->pAggInfo;
93050 struct AggInfo_col *pCol = &pAggInfo->aCol[pExpr->iAgg];
93051 if( !pAggInfo->directMode ){
93052 assert( pCol->iMem>0 );
93053 return pCol->iMem;
 
93054 }else if( pAggInfo->useSortingIdx ){
93055 sqlite3VdbeAddOp3(v, OP_Column, pAggInfo->sortingIdxPTab,
93056 pCol->iSorterColumn, target);
93057 return target;
93058 }
93059 /* Otherwise, fall thru into the TK_COLUMN case */
93060 }
93061 case TK_COLUMN: {
93062 int iTab = pExpr->iTable;
93063 if( iTab<0 ){
93064 if( pParse->ckBase>0 ){
93065 /* Generating CHECK constraints or inserting into partial index */
93066 return pExpr->iColumn + pParse->ckBase;
 
93067 }else{
93068 /* Coding an expression that is part of an index where column names
93069 ** in the index refer to the table to which the index belongs */
93070 iTab = pParse->iSelfTab;
93071 }
93072 }
93073 return sqlite3ExprCodeGetColumn(pParse, pExpr->pTab,
93074 pExpr->iColumn, iTab, target,
93075 pExpr->op2);
 
93076 }
93077 case TK_INTEGER: {
93078 codeInteger(pParse, pExpr, 0, target);
93079 return target;
93080 }
93081 #ifndef SQLITE_OMIT_FLOATING_POINT
93082 case TK_FLOAT: {
93083 assert( !ExprHasProperty(pExpr, EP_IntValue) );
93084 codeReal(v, pExpr->u.zToken, 0, target);
93085 return target;
93086 }
93087 #endif
93088 case TK_STRING: {
93089 assert( !ExprHasProperty(pExpr, EP_IntValue) );
93090 sqlite3VdbeLoadString(v, target, pExpr->u.zToken);
93091 return target;
93092 }
93093 case TK_NULL: {
93094 sqlite3VdbeAddOp2(v, OP_Null, 0, target);
93095 return target;
93096 }
93097 #ifndef SQLITE_OMIT_BLOB_LITERAL
93098 case TK_BLOB: {
93099 int n;
93100 const char *z;
@@ -93125,11 +93105,11 @@
93105 z = &pExpr->u.zToken[2];
93106 n = sqlite3Strlen30(z) - 1;
93107 assert( z[n]=='\'' );
93108 zBlob = sqlite3HexToBlob(sqlite3VdbeDb(v), z, n);
93109 sqlite3VdbeAddOp4(v, OP_Blob, n/2, target, 0, zBlob, P4_DYNAMIC);
93110 return target;
93111 }
93112 #endif
93113 case TK_VARIABLE: {
93114 assert( !ExprHasProperty(pExpr, EP_IntValue) );
93115 assert( pExpr->u.zToken!=0 );
@@ -93138,15 +93118,14 @@
93118 if( pExpr->u.zToken[1]!=0 ){
93119 assert( pExpr->u.zToken[0]=='?'
93120 || strcmp(pExpr->u.zToken, pParse->azVar[pExpr->iColumn-1])==0 );
93121 sqlite3VdbeChangeP4(v, -1, pParse->azVar[pExpr->iColumn-1], P4_STATIC);
93122 }
93123 return target;
93124 }
93125 case TK_REGISTER: {
93126 return pExpr->iTable;
 
93127 }
93128 #ifndef SQLITE_OMIT_CAST
93129 case TK_CAST: {
93130 /* Expressions of the form: CAST(pLeft AS token) */
93131 inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
@@ -93156,11 +93135,11 @@
93135 }
93136 sqlite3VdbeAddOp2(v, OP_Cast, target,
93137 sqlite3AffinityType(pExpr->u.zToken, 0));
93138 testcase( usedAsColumnCache(pParse, inReg, inReg) );
93139 sqlite3ExprCacheAffinityChange(pParse, inReg, 1);
93140 return inReg;
93141 }
93142 #endif /* SQLITE_OMIT_CAST */
93143 case TK_IS:
93144 case TK_ISNOT:
93145 op = (op==TK_IS) ? TK_EQ : TK_NE;
@@ -93224,14 +93203,16 @@
93203 case TK_UMINUS: {
93204 Expr *pLeft = pExpr->pLeft;
93205 assert( pLeft );
93206 if( pLeft->op==TK_INTEGER ){
93207 codeInteger(pParse, pLeft, 1, target);
93208 return target;
93209 #ifndef SQLITE_OMIT_FLOATING_POINT
93210 }else if( pLeft->op==TK_FLOAT ){
93211 assert( !ExprHasProperty(pExpr, EP_IntValue) );
93212 codeReal(v, pLeft->u.zToken, 1, target);
93213 return target;
93214 #endif
93215 }else{
93216 tempX.op = TK_INTEGER;
93217 tempX.flags = EP_IntValue|EP_TokenOnly;
93218 tempX.u.iValue = 0;
@@ -93238,20 +93219,18 @@
93219 r1 = sqlite3ExprCodeTemp(pParse, &tempX, &regFree1);
93220 r2 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree2);
93221 sqlite3VdbeAddOp3(v, OP_Subtract, r2, r1, target);
93222 testcase( regFree2==0 );
93223 }
 
93224 break;
93225 }
93226 case TK_BITNOT:
93227 case TK_NOT: {
93228 assert( TK_BITNOT==OP_BitNot ); testcase( op==TK_BITNOT );
93229 assert( TK_NOT==OP_Not ); testcase( op==TK_NOT );
93230 r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
93231 testcase( regFree1==0 );
 
93232 sqlite3VdbeAddOp2(v, op, r1, inReg);
93233 break;
93234 }
93235 case TK_ISNULL:
93236 case TK_NOTNULL: {
@@ -93272,11 +93251,11 @@
93251 AggInfo *pInfo = pExpr->pAggInfo;
93252 if( pInfo==0 ){
93253 assert( !ExprHasProperty(pExpr, EP_IntValue) );
93254 sqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken);
93255 }else{
93256 return pInfo->aFunc[pExpr->iAgg].iMem;
93257 }
93258 break;
93259 }
93260 case TK_FUNCTION: {
93261 ExprList *pFarg; /* List of function arguments */
@@ -93283,10 +93262,11 @@
93262 int nFarg; /* Number of function arguments */
93263 FuncDef *pDef; /* The function definition object */
93264 const char *zId; /* The function name */
93265 u32 constMask = 0; /* Mask of function arguments that are constant */
93266 int i; /* Loop counter */
93267 sqlite3 *db = pParse->db; /* The database connection */
93268 u8 enc = ENC(db); /* The text encoding used by this database */
93269 CollSeq *pColl = 0; /* A collating sequence */
93270
93271 assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
93272 if( ExprHasProperty(pExpr, EP_TokenOnly) ){
@@ -93331,12 +93311,11 @@
93311 /* The UNLIKELY() function is a no-op. The result is the value
93312 ** of the first argument.
93313 */
93314 if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){
93315 assert( nFarg>=1 );
93316 return sqlite3ExprCodeTarget(pParse, pFarg->a[0].pExpr, target);
 
93317 }
93318
93319 for(i=0; i<nFarg; i++){
93320 if( i<32 && sqlite3ExprIsConstant(pFarg->a[i].pExpr) ){
93321 testcase( i==31 );
@@ -93407,11 +93386,11 @@
93386 (char*)pDef, P4_FUNCDEF);
93387 sqlite3VdbeChangeP5(v, (u8)nFarg);
93388 if( nFarg && constMask==0 ){
93389 sqlite3ReleaseTempRange(pParse, r1, nFarg);
93390 }
93391 return target;
93392 }
93393 #ifndef SQLITE_OMIT_SUBQUERY
93394 case TK_EXISTS:
93395 case TK_SELECT: {
93396 int nCol;
@@ -93418,20 +93397,19 @@
93397 testcase( op==TK_EXISTS );
93398 testcase( op==TK_SELECT );
93399 if( op==TK_SELECT && (nCol = pExpr->x.pSelect->pEList->nExpr)!=1 ){
93400 sqlite3SubselectError(pParse, nCol, 1);
93401 }else{
93402 return sqlite3CodeSubselect(pParse, pExpr, 0, 0);
93403 }
93404 break;
93405 }
93406 case TK_SELECT_COLUMN: {
93407 if( pExpr->pLeft->iTable==0 ){
93408 pExpr->pLeft->iTable = sqlite3CodeSubselect(pParse, pExpr->pLeft, 0, 0);
93409 }
93410 return pExpr->pLeft->iTable + pExpr->iColumn;
 
93411 }
93412 case TK_IN: {
93413 int destIfFalse = sqlite3VdbeMakeLabel(v);
93414 int destIfNull = sqlite3VdbeMakeLabel(v);
93415 sqlite3VdbeAddOp2(v, OP_Null, 0, target);
@@ -93438,11 +93416,11 @@
93416 sqlite3ExprCodeIN(pParse, pExpr, destIfFalse, destIfNull);
93417 sqlite3VdbeAddOp2(v, OP_Integer, 1, target);
93418 sqlite3VdbeResolveLabel(v, destIfFalse);
93419 sqlite3VdbeAddOp2(v, OP_AddImm, target, 0);
93420 sqlite3VdbeResolveLabel(v, destIfNull);
93421 return target;
93422 }
93423 #endif /* SQLITE_OMIT_SUBQUERY */
93424
93425
93426 /*
@@ -93456,17 +93434,16 @@
93434 ** Y is stored in pExpr->pList->a[0].pExpr.
93435 ** Z is stored in pExpr->pList->a[1].pExpr.
93436 */
93437 case TK_BETWEEN: {
93438 exprCodeBetween(pParse, pExpr, target, 0, 0);
93439 return target;
93440 }
93441 case TK_SPAN:
93442 case TK_COLLATE:
93443 case TK_UPLUS: {
93444 return sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
 
93445 }
93446
93447 case TK_TRIGGER: {
93448 /* If the opcode is TK_TRIGGER, then the expression is a reference
93449 ** to a column in the new.* or old.* pseudo-tables available to
@@ -93604,11 +93581,11 @@
93581 sqlite3ExprCode(pParse, pEList->a[nExpr-1].pExpr, target);
93582 sqlite3ExprCachePop(pParse);
93583 }else{
93584 sqlite3VdbeAddOp2(v, OP_Null, 0, target);
93585 }
93586 assert( pParse->db->mallocFailed || pParse->nErr>0
93587 || pParse->iCacheLevel==iCacheLevel );
93588 sqlite3VdbeResolveLabel(v, endLabel);
93589 break;
93590 }
93591 #ifndef SQLITE_OMIT_TRIGGER
@@ -97644,11 +97621,11 @@
97621 break;
97622
97623 case SQLITE_NULL:
97624 /* No key specified. Use the key from the main database */
97625 sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);
97626 if( nKey || sqlite3BtreeGetOptimalReserve(db->aDb[0].pBt)>0 ){
97627 rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
97628 }
97629 break;
97630 }
97631 }
@@ -98103,11 +98080,11 @@
98080 ** and attempts to write the column will be ignored.
98081 **
98082 ** Setting the auth function to NULL disables this hook. The default
98083 ** setting of the auth function is NULL.
98084 */
98085 SQLITE_API int sqlite3_set_authorizer(
98086 sqlite3 *db,
98087 int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
98088 void *pArg
98089 ){
98090 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -100441,11 +100418,13 @@
100418 Table *pSelTab; /* A fake table from which we get the result set */
100419 Select *pSel; /* Copy of the SELECT that implements the view */
100420 int nErr = 0; /* Number of errors encountered */
100421 int n; /* Temporarily holds the number of cursors assigned */
100422 sqlite3 *db = pParse->db; /* Database connection for malloc errors */
100423 #ifndef SQLITE_OMIT_AUTHORIZATION
100424 sqlite3_xauth xAuth; /* Saved xAuth pointer */
100425 #endif
100426
100427 assert( pTable );
100428
100429 #ifndef SQLITE_OMIT_VIRTUALTABLE
100430 if( sqlite3VtabCallConnect(pParse, pTable) ){
@@ -103434,11 +103413,10 @@
103413 SrcList *pTabList, /* The table from which we should delete things */
103414 Expr *pWhere /* The WHERE clause. May be null */
103415 ){
103416 Vdbe *v; /* The virtual database engine */
103417 Table *pTab; /* The table from which records will be deleted */
 
103418 int i; /* Loop counter */
103419 WhereInfo *pWInfo; /* Information about the WHERE clause */
103420 Index *pIdx; /* For looping over indices of the table */
103421 int iTabCur; /* Cursor number for the table */
103422 int iDataCur = 0; /* VDBE cursor for the canonical data source */
@@ -103511,12 +103489,12 @@
103489 if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){
103490 goto delete_from_cleanup;
103491 }
103492 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
103493 assert( iDb<db->nDb );
103494 rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0,
103495 db->aDb[iDb].zDbSName);
103496 assert( rcauth==SQLITE_OK || rcauth==SQLITE_DENY || rcauth==SQLITE_IGNORE );
103497 if( rcauth==SQLITE_DENY ){
103498 goto delete_from_cleanup;
103499 }
103500 assert(!isView || pTrigger);
@@ -103696,11 +103674,11 @@
103674 ** triggers.
103675 */
103676 if( !isView ){
103677 int iAddrOnce = 0;
103678 if( eOnePass==ONEPASS_MULTI ){
103679 iAddrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
103680 }
103681 testcase( IsVirtual(pTab) );
103682 sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, OPFLAG_FORDELETE,
103683 iTabCur, aToOpen, &iDataCur, &iIdxCur);
103684 assert( pPk || IsVirtual(pTab) || iDataCur==iTabCur );
@@ -104874,18 +104852,18 @@
104852 }
104853
104854 /*
104855 ** The sqlite3_strglob() interface.
104856 */
104857 SQLITE_API int sqlite3_strglob(const char *zGlobPattern, const char *zString){
104858 return patternCompare((u8*)zGlobPattern, (u8*)zString, &globInfo, '[')==0;
104859 }
104860
104861 /*
104862 ** The sqlite3_strlike() interface.
104863 */
104864 SQLITE_API int sqlite3_strlike(const char *zPattern, const char *zStr, unsigned int esc){
104865 return patternCompare((u8*)zPattern, (u8*)zStr, &likeInfoNorm, esc)==0;
104866 }
104867
104868 /*
104869 ** Count the number of times that the LIKE operator (or GLOB which is
@@ -107868,11 +107846,10 @@
107846 int onError /* How to handle constraint errors */
107847 ){
107848 sqlite3 *db; /* The main database structure */
107849 Table *pTab; /* The table to insert into. aka TABLE */
107850 char *zTab; /* Name of the table into which we are inserting */
 
107851 int i, j, idx; /* Loop counters */
107852 Vdbe *v; /* Generate code into this virtual machine */
107853 Index *pIdx; /* For looping over indices of the table */
107854 int nColumn; /* Number of columns in the data */
107855 int nHidden = 0; /* Number of hidden columns if TABLE is virtual */
@@ -107883,11 +107860,10 @@
107860 int srcTab = 0; /* Data comes from this temporary cursor if >=0 */
107861 int addrInsTop = 0; /* Jump to label "D" */
107862 int addrCont = 0; /* Top of insert loop. Label "C" in templates 3 and 4 */
107863 SelectDest dest; /* Destination for SELECT on rhs of INSERT */
107864 int iDb; /* Index of database holding TABLE */
 
107865 u8 useTempTable = 0; /* Store SELECT results in intermediate table */
107866 u8 appendFlag = 0; /* True if the insert is likely to be an append */
107867 u8 withoutRowid; /* 0 for normal table. 1 for WITHOUT ROWID table */
107868 u8 bIdListInOrder; /* True if IDLIST is in table order */
107869 ExprList *pList = 0; /* List of VALUES() to be inserted */
@@ -107933,13 +107909,12 @@
107909 if( pTab==0 ){
107910 goto insert_cleanup;
107911 }
107912 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
107913 assert( iDb<db->nDb );
107914 if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0,
107915 db->aDb[iDb].zDbSName) ){
 
107916 goto insert_cleanup;
107917 }
107918 withoutRowid = !HasRowid(pTab);
107919
107920 /* Figure out if we have any triggers and if the table being
@@ -109604,11 +109579,11 @@
109579 ** If the SQL is a query, then for each row in the query result
109580 ** the xCallback() function is called. pArg becomes the first
109581 ** argument to xCallback(). If xCallback=NULL then no callback
109582 ** is invoked, even for queries.
109583 */
109584 SQLITE_API int sqlite3_exec(
109585 sqlite3 *db, /* The database on which the SQL executes */
109586 const char *zSql, /* The SQL to be executed */
109587 sqlite3_callback xCallback, /* Invoke this callback routine */
109588 void *pArg, /* First argument to xCallback() */
109589 char **pzErrMsg /* Write error messages here */
@@ -110866,11 +110841,11 @@
110841 db->aExtension = aHandle;
110842
110843 db->aExtension[db->nExtension++] = handle;
110844 return SQLITE_OK;
110845 }
110846 SQLITE_API int sqlite3_load_extension(
110847 sqlite3 *db, /* Load the extension into this database connection */
110848 const char *zFile, /* Name of the shared library containing extension */
110849 const char *zProc, /* Entry point. Use "sqlite3_extension_init" if 0 */
110850 char **pzErrMsg /* Put error message here if not 0 */
110851 ){
@@ -110897,11 +110872,11 @@
110872
110873 /*
110874 ** Enable or disable extension loading. Extension loading is disabled by
110875 ** default so as not to open security holes in older applications.
110876 */
110877 SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff){
110878 sqlite3_mutex_enter(db->mutex);
110879 if( onoff ){
110880 db->flags |= SQLITE_LoadExtension|SQLITE_LoadExtFunc;
110881 }else{
110882 db->flags &= ~(SQLITE_LoadExtension|SQLITE_LoadExtFunc);
@@ -110908,22 +110883,11 @@
110883 }
110884 sqlite3_mutex_leave(db->mutex);
110885 return SQLITE_OK;
110886 }
110887
110888 #endif /* !defined(SQLITE_OMIT_LOAD_EXTENSION) */
 
 
 
 
 
 
 
 
 
 
 
110889
110890 /*
110891 ** The following object holds the list of automatically loaded
110892 ** extensions.
110893 **
@@ -110954,11 +110918,11 @@
110918
110919 /*
110920 ** Register a statically linked extension that is automatically
110921 ** loaded by every new database connection.
110922 */
110923 SQLITE_API int sqlite3_auto_extension(
110924 void (*xInit)(void)
110925 ){
110926 int rc = SQLITE_OK;
110927 #ifndef SQLITE_OMIT_AUTOINIT
110928 rc = sqlite3_initialize();
@@ -111001,11 +110965,11 @@
110965 ** routine is a no-op.
110966 **
110967 ** Return 1 if xInit was found on the list and removed. Return 0 if xInit
110968 ** was not on the list.
110969 */
110970 SQLITE_API int sqlite3_cancel_auto_extension(
110971 void (*xInit)(void)
110972 ){
110973 #if SQLITE_THREADSAFE
110974 sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
110975 #endif
@@ -111026,11 +110990,11 @@
110990 }
110991
110992 /*
110993 ** Reset the automatic extension loading mechanism.
110994 */
110995 SQLITE_API void sqlite3_reset_auto_extension(void){
110996 #ifndef SQLITE_OMIT_AUTOINIT
110997 if( sqlite3_initialize()==SQLITE_OK )
110998 #endif
110999 {
111000 #if SQLITE_THREADSAFE
@@ -111064,20 +111028,25 @@
111028 for(i=0; go; i++){
111029 char *zErrmsg;
111030 #if SQLITE_THREADSAFE
111031 sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
111032 #endif
111033 #ifdef SQLITE_OMIT_LOAD_EXTENSION
111034 const sqlite3_api_routines *pThunk = 0;
111035 #else
111036 const sqlite3_api_routines *pThunk = &sqlite3Apis;
111037 #endif
111038 sqlite3_mutex_enter(mutex);
111039 if( i>=wsdAutoext.nExt ){
111040 xInit = 0;
111041 go = 0;
111042 }else{
111043 xInit = (sqlite3_loadext_entry)wsdAutoext.aExt[i];
111044 }
111045 sqlite3_mutex_leave(mutex);
111046 zErrmsg = 0;
111047 if( xInit && (rc = xInit(db, &zErrmsg, pThunk))!=0 ){
111048 sqlite3ErrorWithMsg(db, rc,
111049 "automatic extension loading failed: %s", zErrmsg);
111050 go = 0;
111051 }
111052 sqlite3_free(zErrmsg);
@@ -114289,11 +114258,11 @@
114258 ** and so if a schema change occurs, SQLITE_SCHEMA is returned by
114259 ** sqlite3_step(). In the new version, the original SQL text is retained
114260 ** and the statement is automatically recompiled if an schema change
114261 ** occurs.
114262 */
114263 SQLITE_API int sqlite3_prepare(
114264 sqlite3 *db, /* Database handle. */
114265 const char *zSql, /* UTF-8 encoded SQL statement. */
114266 int nBytes, /* Length of zSql in bytes. */
114267 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
114268 const char **pzTail /* OUT: End of parsed string */
@@ -114301,11 +114270,11 @@
114270 int rc;
114271 rc = sqlite3LockAndPrepare(db,zSql,nBytes,0,0,ppStmt,pzTail);
114272 assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */
114273 return rc;
114274 }
114275 SQLITE_API int sqlite3_prepare_v2(
114276 sqlite3 *db, /* Database handle. */
114277 const char *zSql, /* UTF-8 encoded SQL statement. */
114278 int nBytes, /* Length of zSql in bytes. */
114279 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
114280 const char **pzTail /* OUT: End of parsed string */
@@ -114377,11 +114346,11 @@
114346 ** and so if a schema change occurs, SQLITE_SCHEMA is returned by
114347 ** sqlite3_step(). In the new version, the original SQL text is retained
114348 ** and the statement is automatically recompiled if an schema change
114349 ** occurs.
114350 */
114351 SQLITE_API int sqlite3_prepare16(
114352 sqlite3 *db, /* Database handle. */
114353 const void *zSql, /* UTF-16 encoded SQL statement. */
114354 int nBytes, /* Length of zSql in bytes. */
114355 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
114356 const void **pzTail /* OUT: End of parsed string */
@@ -114389,11 +114358,11 @@
114358 int rc;
114359 rc = sqlite3Prepare16(db,zSql,nBytes,0,ppStmt,pzTail);
114360 assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */
114361 return rc;
114362 }
114363 SQLITE_API int sqlite3_prepare16_v2(
114364 sqlite3 *db, /* Database handle. */
114365 const void *zSql, /* UTF-16 encoded SQL statement. */
114366 int nBytes, /* Length of zSql in bytes. */
114367 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
114368 const void **pzTail /* OUT: End of parsed string */
@@ -115640,11 +115609,11 @@
115609 nKey = pOrderBy->nExpr - pSort->nOBSat;
115610 if( pSort->sortFlags & SORTFLAG_UseSorter ){
115611 int regSortOut = ++pParse->nMem;
115612 iSortTab = pParse->nTab++;
115613 if( pSort->labelBkOut ){
115614 addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
115615 }
115616 sqlite3VdbeAddOp3(v, OP_OpenPseudo, iSortTab, regSortOut, nKey+1+nSortData);
115617 if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce);
115618 addr = 1 + sqlite3VdbeAddOp2(v, OP_SorterSort, iTab, addrBreak);
115619 VdbeCoverage(v);
@@ -119435,11 +119404,11 @@
119404 pItem->addrFillSub = topAddr+1;
119405 if( pItem->fg.isCorrelated==0 ){
119406 /* If the subquery is not correlated and if we are not inside of
119407 ** a trigger, then we only need to compute the value of the subquery
119408 ** once. */
119409 onceAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
119410 VdbeComment((v, "materialize \"%s\"", pItem->pTab->zName));
119411 }else{
119412 VdbeNoopComment((v, "materialize \"%s\"", pItem->pTab->zName));
119413 }
119414 sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor);
@@ -120198,11 +120167,11 @@
120167 ** The result that is written to ***pazResult is held in memory obtained
120168 ** from malloc(). But the caller cannot free this memory directly.
120169 ** Instead, the entire table should be passed to sqlite3_free_table() when
120170 ** the calling procedure is finished using it.
120171 */
120172 SQLITE_API int sqlite3_get_table(
120173 sqlite3 *db, /* The database on which the SQL executes */
120174 const char *zSql, /* The SQL to be executed */
120175 char ***pazResult, /* Write the result table here */
120176 int *pnRow, /* Write the number of rows in the result here */
120177 int *pnColumn, /* Write the number of columns of result here */
@@ -120267,11 +120236,11 @@
120236 }
120237
120238 /*
120239 ** This routine frees the space the sqlite3_get_table() malloced.
120240 */
120241 SQLITE_API void sqlite3_free_table(
120242 char **azResult /* Result returned from sqlite3_get_table() */
120243 ){
120244 if( azResult ){
120245 int i, n;
120246 azResult--;
@@ -120382,11 +120351,10 @@
120351 char *zName = 0; /* Name of the trigger */
120352 sqlite3 *db = pParse->db; /* The database connection */
120353 int iDb; /* The database to store the trigger in */
120354 Token *pName; /* The unqualified db name */
120355 DbFixer sFix; /* State vector for the DB fixer */
 
120356
120357 assert( pName1!=0 ); /* pName1->z might be NULL, but not pName1 itself */
120358 assert( pName2!=0 );
120359 assert( op==TK_INSERT || op==TK_UPDATE || op==TK_DELETE );
120360 assert( op>0 && op<0xff );
@@ -120495,14 +120463,14 @@
120463 if( !pTab->pSelect && tr_tm==TK_INSTEAD ){
120464 sqlite3ErrorMsg(pParse, "cannot create INSTEAD OF"
120465 " trigger on table: %S", pTableName, 0);
120466 goto trigger_cleanup;
120467 }
 
120468
120469 #ifndef SQLITE_OMIT_AUTHORIZATION
120470 {
120471 int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
120472 int code = SQLITE_CREATE_TRIGGER;
120473 const char *zDb = db->aDb[iTabDb].zDbSName;
120474 const char *zDbTrig = isTemp ? db->aDb[1].zDbSName : zDb;
120475 if( iTabDb==1 || isTemp ) code = SQLITE_CREATE_TEMP_TRIGGER;
120476 if( sqlite3AuthCheck(pParse, code, zName, pTab->zName, zDbTrig) ){
@@ -121166,11 +121134,10 @@
121134 if( db->mallocFailed==0 ){
121135 pProgram->aOp = sqlite3VdbeTakeOpArray(v, &pProgram->nOp, &pTop->nMaxArg);
121136 }
121137 pProgram->nMem = pSubParse->nMem;
121138 pProgram->nCsr = pSubParse->nTab;
 
121139 pProgram->token = (void *)pTrigger;
121140 pPrg->aColmask[0] = pSubParse->oldmask;
121141 pPrg->aColmask[1] = pSubParse->newmask;
121142 sqlite3VdbeDelete(v);
121143 }
@@ -122655,11 +122622,11 @@
122622
122623
122624 /*
122625 ** External API function used to create a new virtual-table module.
122626 */
122627 SQLITE_API int sqlite3_create_module(
122628 sqlite3 *db, /* Database in which module is registered */
122629 const char *zName, /* Name assigned to this module */
122630 const sqlite3_module *pModule, /* The definition of the module */
122631 void *pAux /* Context pointer for xCreate/xConnect */
122632 ){
@@ -122670,11 +122637,11 @@
122637 }
122638
122639 /*
122640 ** External API function used to create a new virtual-table module.
122641 */
122642 SQLITE_API int sqlite3_create_module_v2(
122643 sqlite3 *db, /* Database in which module is registered */
122644 const char *zName, /* Name assigned to this module */
122645 const sqlite3_module *pModule, /* The definition of the module */
122646 void *pAux, /* Context pointer for xCreate/xConnect */
122647 void (*xDestroy)(void *) /* Module destructor function */
@@ -123294,11 +123261,11 @@
123261 /*
123262 ** This function is used to set the schema of a virtual table. It is only
123263 ** valid to call this function from within the xCreate() or xConnect() of a
123264 ** virtual table module.
123265 */
123266 SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
123267 VtabCtx *pCtx;
123268 Parse *pParse;
123269 int rc = SQLITE_OK;
123270 Table *pTab;
123271 char *zErr = 0;
@@ -123751,11 +123718,11 @@
123718 ** table update operation currently in progress.
123719 **
123720 ** The results of this routine are undefined unless it is called from
123721 ** within an xUpdate method.
123722 */
123723 SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *db){
123724 static const unsigned char aMap[] = {
123725 SQLITE_ROLLBACK, SQLITE_ABORT, SQLITE_FAIL, SQLITE_IGNORE, SQLITE_REPLACE
123726 };
123727 #ifdef SQLITE_ENABLE_API_ARMOR
123728 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
@@ -123769,11 +123736,11 @@
123736 /*
123737 ** Call from within the xCreate() or xConnect() methods to provide
123738 ** the SQLite core with additional information about the behavior
123739 ** of the virtual table being implemented.
123740 */
123741 SQLITE_API int sqlite3_vtab_config(sqlite3 *db, int op, ...){
123742 va_list ap;
123743 int rc = SQLITE_OK;
123744
123745 #ifdef SQLITE_ENABLE_API_ARMOR
123746 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
@@ -124886,18 +124853,17 @@
124853 pIn = pLevel->u.in.aInLoop;
124854 if( pIn ){
124855 int iMap = 0; /* Index in aiMap[] */
124856 pIn += i;
124857 for(i=iEq;i<pLoop->nLTerm; i++){
 
124858 if( pLoop->aLTerm[i]->pExpr==pX ){
124859 int iOut = iReg + i - iEq;
124860 if( eType==IN_INDEX_ROWID ){
124861 testcase( nEq>1 ); /* Happens with a UNIQUE index on ROWID */
124862 pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut);
124863 }else{
124864 int iCol = aiMap ? aiMap[iMap++] : 0;
 
124865 pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut);
124866 }
124867 sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v);
124868 if( i==iEq ){
124869 pIn->iCur = iTab;
@@ -128496,11 +128462,11 @@
128462
128463 /* Generate code to skip over the creation and initialization of the
128464 ** transient index on 2nd and subsequent iterations of the loop. */
128465 v = pParse->pVdbe;
128466 assert( v!=0 );
128467 addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
128468
128469 /* Count the number of columns that will be added to the index
128470 ** and used to match WHERE clause constraints */
128471 nKeyCol = 0;
128472 pTable = pSrc->pTab;
@@ -130167,10 +130133,12 @@
130133 LogEst rLogSize; /* Logarithm of table size */
130134 WhereTerm *pTop = 0, *pBtm = 0; /* Top and bottom range constraints */
130135
130136 pNew = pBuilder->pNew;
130137 if( db->mallocFailed ) return SQLITE_NOMEM_BKPT;
130138 WHERETRACE(0x800, ("BEGIN addBtreeIdx(%s), nEq=%d\n",
130139 pProbe->zName, pNew->u.btree.nEq));
130140
130141 assert( (pNew->wsFlags & WHERE_VIRTUALTABLE)==0 );
130142 assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 );
130143 if( pNew->wsFlags & WHERE_BTM_LIMIT ){
130144 opMask = WO_LT|WO_LE;
@@ -130253,11 +130221,11 @@
130221 ** In this case there is a separate term for each of (x) and (y).
130222 ** However, the nIn multiplier should only be applied once, not once
130223 ** for each such term. The following loop checks that pTerm is the
130224 ** first such term in use, and sets nIn back to 0 if it is not. */
130225 for(i=0; i<pNew->nLTerm-1; i++){
130226 if( pNew->aLTerm[i] && pNew->aLTerm[i]->pExpr==pExpr ) nIn = 0;
130227 }
130228 }else if( ALWAYS(pExpr->x.pList && pExpr->x.pList->nExpr) ){
130229 /* "x IN (value, value, ...)" */
130230 nIn = sqlite3LogEst(pExpr->x.pList->nExpr);
130231 assert( nIn>0 ); /* RHS always has 2 or more terms... The parser
@@ -130445,10 +130413,12 @@
130413 pNew->u.btree.nEq = saved_nEq;
130414 pNew->nSkip = saved_nSkip;
130415 pNew->wsFlags = saved_wsFlags;
130416 }
130417
130418 WHERETRACE(0x800, ("END addBtreeIdx(%s), nEq=%d, rc=%d\n",
130419 pProbe->zName, saved_nEq, rc));
130420 return rc;
130421 }
130422
130423 /*
130424 ** Return True if it is possible that pIndex might be useful in
@@ -137554,11 +137524,11 @@
137524 **
137525 ** If we compile with SQLITE_OMIT_TRIGGER, all of the computation needed
137526 ** to recognize the end of a trigger can be omitted. All we have to do
137527 ** is look for a semicolon that is not part of an string or comment.
137528 */
137529 SQLITE_API int sqlite3_complete(const char *zSql){
137530 u8 state = 0; /* Current state, using numbers defined in header comment */
137531 u8 token; /* Value of the next token */
137532
137533 #ifndef SQLITE_OMIT_TRIGGER
137534 /* A complex statement machine used to detect the end of a CREATE TRIGGER
@@ -137719,11 +137689,11 @@
137689 /*
137690 ** This routine is the same as the sqlite3_complete() routine described
137691 ** above, except that the parameter is required to be UTF-16 encoded, not
137692 ** UTF-8.
137693 */
137694 SQLITE_API int sqlite3_complete16(const void *zSql){
137695 sqlite3_value *pVal;
137696 char const *zSql8;
137697 int rc;
137698
137699 #ifndef SQLITE_OMIT_AUTOINIT
@@ -137879,28 +137849,28 @@
137849 #endif
137850
137851 /* IMPLEMENTATION-OF: R-53536-42575 The sqlite3_libversion() function returns
137852 ** a pointer to the to the sqlite3_version[] string constant.
137853 */
137854 SQLITE_API const char *sqlite3_libversion(void){ return sqlite3_version; }
137855
137856 /* IMPLEMENTATION-OF: R-63124-39300 The sqlite3_sourceid() function returns a
137857 ** pointer to a string constant whose value is the same as the
137858 ** SQLITE_SOURCE_ID C preprocessor macro.
137859 */
137860 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
137861
137862 /* IMPLEMENTATION-OF: R-35210-63508 The sqlite3_libversion_number() function
137863 ** returns an integer equal to SQLITE_VERSION_NUMBER.
137864 */
137865 SQLITE_API int sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; }
137866
137867 /* IMPLEMENTATION-OF: R-20790-14025 The sqlite3_threadsafe() function returns
137868 ** zero if and only if SQLite was compiled with mutexing code omitted due to
137869 ** the SQLITE_THREADSAFE compile-time option being set to 0.
137870 */
137871 SQLITE_API int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; }
137872
137873 /*
137874 ** When compiling the test fixture or with debugging enabled (on Win32),
137875 ** this variable being set to non-zero will cause OSTRACE macros to emit
137876 ** extra diagnostic information.
@@ -137969,11 +137939,11 @@
137939 ** call by X completes.
137940 **
137941 ** * Recursive calls to this routine from thread X return immediately
137942 ** without blocking.
137943 */
137944 SQLITE_API int sqlite3_initialize(void){
137945 MUTEX_LOGIC( sqlite3_mutex *pMaster; ) /* The main static mutex */
137946 int rc; /* Result code */
137947 #ifdef SQLITE_EXTRA_INIT
137948 int bRunExtraInit = 0; /* Extra initialization needed */
137949 #endif
@@ -138135,11 +138105,11 @@
138105 ** while any part of SQLite is otherwise in use in any thread. This
138106 ** routine is not threadsafe. But it is safe to invoke this routine
138107 ** on when SQLite is already shut down. If SQLite is already shut down
138108 ** when this routine is invoked, then this routine is a harmless no-op.
138109 */
138110 SQLITE_API int sqlite3_shutdown(void){
138111 #ifdef SQLITE_OMIT_WSD
138112 int rc = sqlite3_wsd_init(4096, 24);
138113 if( rc!=SQLITE_OK ){
138114 return rc;
138115 }
@@ -138189,11 +138159,11 @@
138159 ** This routine should only be called when there are no outstanding
138160 ** database connections or memory allocations. This routine is not
138161 ** threadsafe. Failure to heed these warnings can lead to unpredictable
138162 ** behavior.
138163 */
138164 SQLITE_API int sqlite3_config(int op, ...){
138165 va_list ap;
138166 int rc = SQLITE_OK;
138167
138168 /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while
138169 ** the SQLite library is in use. */
@@ -138554,11 +138524,11 @@
138524 }
138525
138526 /*
138527 ** Return the mutex associated with a database connection.
138528 */
138529 SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3 *db){
138530 #ifdef SQLITE_ENABLE_API_ARMOR
138531 if( !sqlite3SafetyCheckOk(db) ){
138532 (void)SQLITE_MISUSE_BKPT;
138533 return 0;
138534 }
@@ -138568,11 +138538,11 @@
138538
138539 /*
138540 ** Free up as much memory as we can from the given database
138541 ** connection.
138542 */
138543 SQLITE_API int sqlite3_db_release_memory(sqlite3 *db){
138544 int i;
138545
138546 #ifdef SQLITE_ENABLE_API_ARMOR
138547 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
138548 #endif
@@ -138592,11 +138562,11 @@
138562
138563 /*
138564 ** Flush any dirty pages in the pager-cache for any attached database
138565 ** to disk.
138566 */
138567 SQLITE_API int sqlite3_db_cacheflush(sqlite3 *db){
138568 int i;
138569 int rc = SQLITE_OK;
138570 int bSeenBusy = 0;
138571
138572 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -138621,11 +138591,11 @@
138591 }
138592
138593 /*
138594 ** Configuration settings for an individual database connection
138595 */
138596 SQLITE_API int sqlite3_db_config(sqlite3 *db, int op, ...){
138597 va_list ap;
138598 int rc;
138599 va_start(ap, op);
138600 switch( op ){
138601 case SQLITE_DBCONFIG_MAINDBNAME: {
@@ -138747,11 +138717,11 @@
138717 }
138718
138719 /*
138720 ** Return the ROWID of the most recent insert
138721 */
138722 SQLITE_API sqlite_int64 sqlite3_last_insert_rowid(sqlite3 *db){
138723 #ifdef SQLITE_ENABLE_API_ARMOR
138724 if( !sqlite3SafetyCheckOk(db) ){
138725 (void)SQLITE_MISUSE_BKPT;
138726 return 0;
138727 }
@@ -138760,11 +138730,11 @@
138730 }
138731
138732 /*
138733 ** Return the number of changes in the most recent call to sqlite3_exec().
138734 */
138735 SQLITE_API int sqlite3_changes(sqlite3 *db){
138736 #ifdef SQLITE_ENABLE_API_ARMOR
138737 if( !sqlite3SafetyCheckOk(db) ){
138738 (void)SQLITE_MISUSE_BKPT;
138739 return 0;
138740 }
@@ -138773,11 +138743,11 @@
138743 }
138744
138745 /*
138746 ** Return the number of changes since the database handle was opened.
138747 */
138748 SQLITE_API int sqlite3_total_changes(sqlite3 *db){
138749 #ifdef SQLITE_ENABLE_API_ARMOR
138750 if( !sqlite3SafetyCheckOk(db) ){
138751 (void)SQLITE_MISUSE_BKPT;
138752 return 0;
138753 }
@@ -138924,12 +138894,12 @@
138894 ** statements or unfinished sqlite3_backups. The sqlite3_close_v2()
138895 ** version forces the connection to become a zombie if there are
138896 ** unclosed resources, and arranges for deallocation when the last
138897 ** prepare statement or sqlite3_backup closes.
138898 */
138899 SQLITE_API int sqlite3_close(sqlite3 *db){ return sqlite3Close(db,0); }
138900 SQLITE_API int sqlite3_close_v2(sqlite3 *db){ return sqlite3Close(db,1); }
138901
138902
138903 /*
138904 ** Close the mutex on database connection db.
138905 **
@@ -139332,11 +139302,11 @@
139302
139303 /*
139304 ** This routine sets the busy callback for an Sqlite database to the
139305 ** given callback function with the given argument.
139306 */
139307 SQLITE_API int sqlite3_busy_handler(
139308 sqlite3 *db,
139309 int (*xBusy)(void*,int),
139310 void *pArg
139311 ){
139312 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -139355,11 +139325,11 @@
139325 /*
139326 ** This routine sets the progress callback for an Sqlite database to the
139327 ** given callback function with the given argument. The progress callback will
139328 ** be invoked every nOps opcodes.
139329 */
139330 SQLITE_API void sqlite3_progress_handler(
139331 sqlite3 *db,
139332 int nOps,
139333 int (*xProgress)(void*),
139334 void *pArg
139335 ){
@@ -139386,11 +139356,11 @@
139356
139357 /*
139358 ** This routine installs a default busy handler that waits for the
139359 ** specified number of milliseconds before returning 0.
139360 */
139361 SQLITE_API int sqlite3_busy_timeout(sqlite3 *db, int ms){
139362 #ifdef SQLITE_ENABLE_API_ARMOR
139363 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
139364 #endif
139365 if( ms>0 ){
139366 sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db);
@@ -139402,11 +139372,11 @@
139372 }
139373
139374 /*
139375 ** Cause any pending operation to stop at its earliest opportunity.
139376 */
139377 SQLITE_API void sqlite3_interrupt(sqlite3 *db){
139378 #ifdef SQLITE_ENABLE_API_ARMOR
139379 if( !sqlite3SafetyCheckOk(db) ){
139380 (void)SQLITE_MISUSE_BKPT;
139381 return;
139382 }
@@ -139518,11 +139488,11 @@
139488 }
139489
139490 /*
139491 ** Create new user functions.
139492 */
139493 SQLITE_API int sqlite3_create_function(
139494 sqlite3 *db,
139495 const char *zFunc,
139496 int nArg,
139497 int enc,
139498 void *p,
@@ -139532,11 +139502,11 @@
139502 ){
139503 return sqlite3_create_function_v2(db, zFunc, nArg, enc, p, xSFunc, xStep,
139504 xFinal, 0);
139505 }
139506
139507 SQLITE_API int sqlite3_create_function_v2(
139508 sqlite3 *db,
139509 const char *zFunc,
139510 int nArg,
139511 int enc,
139512 void *p,
@@ -139575,11 +139545,11 @@
139545 sqlite3_mutex_leave(db->mutex);
139546 return rc;
139547 }
139548
139549 #ifndef SQLITE_OMIT_UTF16
139550 SQLITE_API int sqlite3_create_function16(
139551 sqlite3 *db,
139552 const void *zFunctionName,
139553 int nArg,
139554 int eTextRep,
139555 void *p,
@@ -139615,11 +139585,11 @@
139585 ** When virtual tables intend to provide an overloaded function, they
139586 ** should call this routine to make sure the global function exists.
139587 ** A global function must exist in order for name resolution to work
139588 ** properly.
139589 */
139590 SQLITE_API int sqlite3_overload_function(
139591 sqlite3 *db,
139592 const char *zName,
139593 int nArg
139594 ){
139595 int rc = SQLITE_OK;
@@ -139647,11 +139617,11 @@
139617 ** A NULL trace function means that no tracing is executes. A non-NULL
139618 ** trace is a pointer to a function that is invoked at the start of each
139619 ** SQL statement.
139620 */
139621 #ifndef SQLITE_OMIT_DEPRECATED
139622 SQLITE_API void *sqlite3_trace(sqlite3 *db, void(*xTrace)(void*,const char*), void *pArg){
139623 void *pOld;
139624
139625 #ifdef SQLITE_ENABLE_API_ARMOR
139626 if( !sqlite3SafetyCheckOk(db) ){
139627 (void)SQLITE_MISUSE_BKPT;
@@ -139668,11 +139638,11 @@
139638 }
139639 #endif /* SQLITE_OMIT_DEPRECATED */
139640
139641 /* Register a trace callback using the version-2 interface.
139642 */
139643 SQLITE_API int sqlite3_trace_v2(
139644 sqlite3 *db, /* Trace this connection */
139645 unsigned mTrace, /* Mask of events to be traced */
139646 int(*xTrace)(unsigned,void*,void*,void*), /* Callback to invoke */
139647 void *pArg /* Context */
139648 ){
@@ -139698,11 +139668,11 @@
139668 **
139669 ** A NULL profile function means that no profiling is executes. A non-NULL
139670 ** profile is a pointer to a function that is invoked at the conclusion of
139671 ** each SQL statement that is run.
139672 */
139673 SQLITE_API void *sqlite3_profile(
139674 sqlite3 *db,
139675 void (*xProfile)(void*,const char*,sqlite_uint64),
139676 void *pArg
139677 ){
139678 void *pOld;
@@ -139726,11 +139696,11 @@
139696 /*
139697 ** Register a function to be invoked when a transaction commits.
139698 ** If the invoked function returns non-zero, then the commit becomes a
139699 ** rollback.
139700 */
139701 SQLITE_API void *sqlite3_commit_hook(
139702 sqlite3 *db, /* Attach the hook to this database */
139703 int (*xCallback)(void*), /* Function to invoke on each commit */
139704 void *pArg /* Argument to the function */
139705 ){
139706 void *pOld;
@@ -139751,11 +139721,11 @@
139721
139722 /*
139723 ** Register a callback to be invoked each time a row is updated,
139724 ** inserted or deleted using this database connection.
139725 */
139726 SQLITE_API void *sqlite3_update_hook(
139727 sqlite3 *db, /* Attach the hook to this database */
139728 void (*xCallback)(void*,int,char const *,char const *,sqlite_int64),
139729 void *pArg /* Argument to the function */
139730 ){
139731 void *pRet;
@@ -139776,11 +139746,11 @@
139746
139747 /*
139748 ** Register a callback to be invoked each time a transaction is rolled
139749 ** back by this database connection.
139750 */
139751 SQLITE_API void *sqlite3_rollback_hook(
139752 sqlite3 *db, /* Attach the hook to this database */
139753 void (*xCallback)(void*), /* Callback function */
139754 void *pArg /* Argument to the function */
139755 ){
139756 void *pRet;
@@ -139802,11 +139772,11 @@
139772 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
139773 /*
139774 ** Register a callback to be invoked each time a row is updated,
139775 ** inserted or deleted using this database connection.
139776 */
139777 SQLITE_API void *sqlite3_preupdate_hook(
139778 sqlite3 *db, /* Attach the hook to this database */
139779 void(*xCallback)( /* Callback function */
139780 void*,sqlite3*,int,char const*,char const*,sqlite3_int64,sqlite3_int64),
139781 void *pArg /* First callback argument */
139782 ){
@@ -139851,11 +139821,11 @@
139821 ** The callback registered by this function replaces any existing callback
139822 ** registered using sqlite3_wal_hook(). Likewise, registering a callback
139823 ** using sqlite3_wal_hook() disables the automatic checkpoint mechanism
139824 ** configured by this function.
139825 */
139826 SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int nFrame){
139827 #ifdef SQLITE_OMIT_WAL
139828 UNUSED_PARAMETER(db);
139829 UNUSED_PARAMETER(nFrame);
139830 #else
139831 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -139872,11 +139842,11 @@
139842
139843 /*
139844 ** Register a callback to be invoked each time a transaction is written
139845 ** into the write-ahead-log by this database connection.
139846 */
139847 SQLITE_API void *sqlite3_wal_hook(
139848 sqlite3 *db, /* Attach the hook to this db handle */
139849 int(*xCallback)(void *, sqlite3*, const char*, int),
139850 void *pArg /* First argument passed to xCallback() */
139851 ){
139852 #ifndef SQLITE_OMIT_WAL
@@ -139899,11 +139869,11 @@
139869 }
139870
139871 /*
139872 ** Checkpoint database zDb.
139873 */
139874 SQLITE_API int sqlite3_wal_checkpoint_v2(
139875 sqlite3 *db, /* Database handle */
139876 const char *zDb, /* Name of attached database (or NULL) */
139877 int eMode, /* SQLITE_CHECKPOINT_* value */
139878 int *pnLog, /* OUT: Size of WAL log in frames */
139879 int *pnCkpt /* OUT: Total number of frames checkpointed */
@@ -139954,11 +139924,11 @@
139924 /*
139925 ** Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points
139926 ** to contains a zero-length string, all attached databases are
139927 ** checkpointed.
139928 */
139929 SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){
139930 /* EVIDENCE-OF: R-41613-20553 The sqlite3_wal_checkpoint(D,X) is equivalent to
139931 ** sqlite3_wal_checkpoint_v2(D,X,SQLITE_CHECKPOINT_PASSIVE,0,0). */
139932 return sqlite3_wal_checkpoint_v2(db,zDb,SQLITE_CHECKPOINT_PASSIVE,0,0);
139933 }
139934
@@ -140045,11 +140015,11 @@
140015
140016 /*
140017 ** Return UTF-8 encoded English language explanation of the most recent
140018 ** error.
140019 */
140020 SQLITE_API const char *sqlite3_errmsg(sqlite3 *db){
140021 const char *z;
140022 if( !db ){
140023 return sqlite3ErrStr(SQLITE_NOMEM_BKPT);
140024 }
140025 if( !sqlite3SafetyCheckSickOrOk(db) ){
@@ -140073,11 +140043,11 @@
140043 #ifndef SQLITE_OMIT_UTF16
140044 /*
140045 ** Return UTF-16 encoded English language explanation of the most recent
140046 ** error.
140047 */
140048 SQLITE_API const void *sqlite3_errmsg16(sqlite3 *db){
140049 static const u16 outOfMem[] = {
140050 'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0
140051 };
140052 static const u16 misuse[] = {
140053 'l', 'i', 'b', 'r', 'a', 'r', 'y', ' ',
@@ -140118,38 +140088,38 @@
140088
140089 /*
140090 ** Return the most recent error code generated by an SQLite routine. If NULL is
140091 ** passed to this function, we assume a malloc() failed during sqlite3_open().
140092 */
140093 SQLITE_API int sqlite3_errcode(sqlite3 *db){
140094 if( db && !sqlite3SafetyCheckSickOrOk(db) ){
140095 return SQLITE_MISUSE_BKPT;
140096 }
140097 if( !db || db->mallocFailed ){
140098 return SQLITE_NOMEM_BKPT;
140099 }
140100 return db->errCode & db->errMask;
140101 }
140102 SQLITE_API int sqlite3_extended_errcode(sqlite3 *db){
140103 if( db && !sqlite3SafetyCheckSickOrOk(db) ){
140104 return SQLITE_MISUSE_BKPT;
140105 }
140106 if( !db || db->mallocFailed ){
140107 return SQLITE_NOMEM_BKPT;
140108 }
140109 return db->errCode;
140110 }
140111 SQLITE_API int sqlite3_system_errno(sqlite3 *db){
140112 return db ? db->iSysErrno : 0;
140113 }
140114
140115 /*
140116 ** Return a string that describes the kind of error specified in the
140117 ** argument. For now, this simply calls the internal sqlite3ErrStr()
140118 ** function.
140119 */
140120 SQLITE_API const char *sqlite3_errstr(int rc){
140121 return sqlite3ErrStr(rc);
140122 }
140123
140124 /*
140125 ** Create a new collating function for database "db". The name is zName
@@ -140293,11 +140263,11 @@
140263 **
140264 ** A new lower limit does not shrink existing constructs.
140265 ** It merely prevents new constructs that exceed the limit
140266 ** from forming.
140267 */
140268 SQLITE_API int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){
140269 int oldLimit;
140270
140271 #ifdef SQLITE_ENABLE_API_ARMOR
140272 if( !sqlite3SafetyCheckOk(db) ){
140273 (void)SQLITE_MISUSE_BKPT;
@@ -140920,18 +140890,18 @@
140890 }
140891
140892 /*
140893 ** Open a new database handle.
140894 */
140895 SQLITE_API int sqlite3_open(
140896 const char *zFilename,
140897 sqlite3 **ppDb
140898 ){
140899 return openDatabase(zFilename, ppDb,
140900 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);
140901 }
140902 SQLITE_API int sqlite3_open_v2(
140903 const char *filename, /* Database filename (UTF-8) */
140904 sqlite3 **ppDb, /* OUT: SQLite db handle */
140905 int flags, /* Flags */
140906 const char *zVfs /* Name of VFS module to use */
140907 ){
@@ -140940,11 +140910,11 @@
140910
140911 #ifndef SQLITE_OMIT_UTF16
140912 /*
140913 ** Open a new database handle.
140914 */
140915 SQLITE_API int sqlite3_open16(
140916 const void *zFilename,
140917 sqlite3 **ppDb
140918 ){
140919 char const *zFilename8; /* zFilename encoded in UTF-8 instead of UTF-16 */
140920 sqlite3_value *pVal;
@@ -140979,11 +140949,11 @@
140949 #endif /* SQLITE_OMIT_UTF16 */
140950
140951 /*
140952 ** Register a new collation sequence with the database handle db.
140953 */
140954 SQLITE_API int sqlite3_create_collation(
140955 sqlite3* db,
140956 const char *zName,
140957 int enc,
140958 void* pCtx,
140959 int(*xCompare)(void*,int,const void*,int,const void*)
@@ -140992,11 +140962,11 @@
140962 }
140963
140964 /*
140965 ** Register a new collation sequence with the database handle db.
140966 */
140967 SQLITE_API int sqlite3_create_collation_v2(
140968 sqlite3* db,
140969 const char *zName,
140970 int enc,
140971 void* pCtx,
140972 int(*xCompare)(void*,int,const void*,int,const void*),
@@ -141017,11 +140987,11 @@
140987
140988 #ifndef SQLITE_OMIT_UTF16
140989 /*
140990 ** Register a new collation sequence with the database handle db.
140991 */
140992 SQLITE_API int sqlite3_create_collation16(
140993 sqlite3* db,
140994 const void *zName,
140995 int enc,
140996 void* pCtx,
140997 int(*xCompare)(void*,int,const void*,int,const void*)
@@ -141047,11 +141017,11 @@
141017
141018 /*
141019 ** Register a collation sequence factory callback with the database handle
141020 ** db. Replace any previously installed collation sequence factory.
141021 */
141022 SQLITE_API int sqlite3_collation_needed(
141023 sqlite3 *db,
141024 void *pCollNeededArg,
141025 void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*)
141026 ){
141027 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -141068,11 +141038,11 @@
141038 #ifndef SQLITE_OMIT_UTF16
141039 /*
141040 ** Register a collation sequence factory callback with the database handle
141041 ** db. Replace any previously installed collation sequence factory.
141042 */
141043 SQLITE_API int sqlite3_collation_needed16(
141044 sqlite3 *db,
141045 void *pCollNeededArg,
141046 void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*)
141047 ){
141048 #ifdef SQLITE_ENABLE_API_ARMOR
@@ -141090,11 +141060,11 @@
141060 #ifndef SQLITE_OMIT_DEPRECATED
141061 /*
141062 ** This function is now an anachronism. It used to be used to recover from a
141063 ** malloc() failure, but SQLite now does this automatically.
141064 */
141065 SQLITE_API int sqlite3_global_recover(void){
141066 return SQLITE_OK;
141067 }
141068 #endif
141069
141070 /*
@@ -141101,11 +141071,11 @@
141071 ** Test to see whether or not the database connection is in autocommit
141072 ** mode. Return TRUE if it is and FALSE if not. Autocommit mode is on
141073 ** by default. Autocommit is disabled by a BEGIN statement and reenabled
141074 ** by the next COMMIT or ROLLBACK.
141075 */
141076 SQLITE_API int sqlite3_get_autocommit(sqlite3 *db){
141077 #ifdef SQLITE_ENABLE_API_ARMOR
141078 if( !sqlite3SafetyCheckOk(db) ){
141079 (void)SQLITE_MISUSE_BKPT;
141080 return 0;
141081 }
@@ -141158,19 +141128,19 @@
141128 ** data for this thread has been deallocated.
141129 **
141130 ** SQLite no longer uses thread-specific data so this routine is now a
141131 ** no-op. It is retained for historical compatibility.
141132 */
141133 SQLITE_API void sqlite3_thread_cleanup(void){
141134 }
141135 #endif
141136
141137 /*
141138 ** Return meta information about a specific column of a database table.
141139 ** See comment in sqlite3.h (sqlite.h.in) for details.
141140 */
141141 SQLITE_API int sqlite3_table_column_metadata(
141142 sqlite3 *db, /* Connection handle */
141143 const char *zDbName, /* Database name or NULL */
141144 const char *zTableName, /* Table name */
141145 const char *zColumnName, /* Column name */
141146 char const **pzDataType, /* OUTPUT: Declared data type */
@@ -141284,11 +141254,11 @@
141254 }
141255
141256 /*
141257 ** Sleep for a little while. Return the amount of time slept.
141258 */
141259 SQLITE_API int sqlite3_sleep(int ms){
141260 sqlite3_vfs *pVfs;
141261 int rc;
141262 pVfs = sqlite3_vfs_find(0);
141263 if( pVfs==0 ) return 0;
141264
@@ -141300,11 +141270,11 @@
141270 }
141271
141272 /*
141273 ** Enable or disable the extended result codes.
141274 */
141275 SQLITE_API int sqlite3_extended_result_codes(sqlite3 *db, int onoff){
141276 #ifdef SQLITE_ENABLE_API_ARMOR
141277 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
141278 #endif
141279 sqlite3_mutex_enter(db->mutex);
141280 db->errMask = onoff ? 0xffffffff : 0xff;
@@ -141313,11 +141283,11 @@
141283 }
141284
141285 /*
141286 ** Invoke the xFileControl method on a particular database.
141287 */
141288 SQLITE_API int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){
141289 int rc = SQLITE_ERROR;
141290 Btree *pBtree;
141291
141292 #ifdef SQLITE_ENABLE_API_ARMOR
141293 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
@@ -141353,11 +141323,11 @@
141323 }
141324
141325 /*
141326 ** Interface to the testing logic.
141327 */
141328 SQLITE_API int sqlite3_test_control(int op, ...){
141329 int rc = 0;
141330 #ifdef SQLITE_OMIT_BUILTIN_TEST
141331 UNUSED_PARAMETER(op);
141332 #else
141333 va_list ap;
@@ -141621,10 +141591,19 @@
141591 case SQLITE_TESTCTRL_NEVER_CORRUPT: {
141592 sqlite3GlobalConfig.neverCorrupt = va_arg(ap, int);
141593 break;
141594 }
141595
141596 /* Set the threshold at which OP_Once counters reset back to zero.
141597 ** By default this is 0x7ffffffe (over 2 billion), but that value is
141598 ** too big to test in a reasonable amount of time, so this control is
141599 ** provided to set a small and easily reachable reset value.
141600 */
141601 case SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD: {
141602 sqlite3GlobalConfig.iOnceResetThreshold = va_arg(ap, int);
141603 break;
141604 }
141605
141606 /* sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE, xCallback, ptr);
141607 **
141608 ** Set the VDBE coverage callback function to xCallback with context
141609 ** pointer ptr.
@@ -141698,11 +141677,11 @@
141677 ** method of a VFS implementation. The zParam argument is the name of the
141678 ** query parameter we seek. This routine returns the value of the zParam
141679 ** parameter if it exists. If the parameter does not exist, this routine
141680 ** returns a NULL pointer.
141681 */
141682 SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam){
141683 if( zFilename==0 || zParam==0 ) return 0;
141684 zFilename += sqlite3Strlen30(zFilename) + 1;
141685 while( zFilename[0] ){
141686 int x = strcmp(zFilename, zParam);
141687 zFilename += sqlite3Strlen30(zFilename) + 1;
@@ -141713,20 +141692,20 @@
141692 }
141693
141694 /*
141695 ** Return a boolean value for a query parameter.
141696 */
141697 SQLITE_API int sqlite3_uri_boolean(const char *zFilename, const char *zParam, int bDflt){
141698 const char *z = sqlite3_uri_parameter(zFilename, zParam);
141699 bDflt = bDflt!=0;
141700 return z ? sqlite3GetBoolean(z, bDflt) : bDflt;
141701 }
141702
141703 /*
141704 ** Return a 64-bit integer value for a query parameter.
141705 */
141706 SQLITE_API sqlite3_int64 sqlite3_uri_int64(
141707 const char *zFilename, /* Filename as passed to xOpen */
141708 const char *zParam, /* URI parameter sought */
141709 sqlite3_int64 bDflt /* return if parameter is missing */
141710 ){
141711 const char *z = sqlite3_uri_parameter(zFilename, zParam);
@@ -141754,11 +141733,11 @@
141733
141734 /*
141735 ** Return the filename of the database associated with a database
141736 ** connection.
141737 */
141738 SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName){
141739 Btree *pBt;
141740 #ifdef SQLITE_ENABLE_API_ARMOR
141741 if( !sqlite3SafetyCheckOk(db) ){
141742 (void)SQLITE_MISUSE_BKPT;
141743 return 0;
@@ -141770,11 +141749,11 @@
141749
141750 /*
141751 ** Return 1 if database is read-only or 0 if read/write. Return -1 if
141752 ** no such database exists.
141753 */
141754 SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName){
141755 Btree *pBt;
141756 #ifdef SQLITE_ENABLE_API_ARMOR
141757 if( !sqlite3SafetyCheckOk(db) ){
141758 (void)SQLITE_MISUSE_BKPT;
141759 return -1;
@@ -141787,11 +141766,11 @@
141766 #ifdef SQLITE_ENABLE_SNAPSHOT
141767 /*
141768 ** Obtain a snapshot handle for the snapshot of database zDb currently
141769 ** being read by handle db.
141770 */
141771 SQLITE_API int sqlite3_snapshot_get(
141772 sqlite3 *db,
141773 const char *zDb,
141774 sqlite3_snapshot **ppSnapshot
141775 ){
141776 int rc = SQLITE_ERROR;
@@ -141822,11 +141801,11 @@
141801 }
141802
141803 /*
141804 ** Open a read-transaction on the snapshot idendified by pSnapshot.
141805 */
141806 SQLITE_API int sqlite3_snapshot_open(
141807 sqlite3 *db,
141808 const char *zDb,
141809 sqlite3_snapshot *pSnapshot
141810 ){
141811 int rc = SQLITE_ERROR;
@@ -141859,11 +141838,11 @@
141838 }
141839
141840 /*
141841 ** Free a snapshot handle obtained from sqlite3_snapshot_get().
141842 */
141843 SQLITE_API void sqlite3_snapshot_free(sqlite3_snapshot *pSnapshot){
141844 sqlite3_free(pSnapshot);
141845 }
141846 #endif /* SQLITE_ENABLE_SNAPSHOT */
141847
141848 /************** End of main.c ************************************************/
@@ -142013,11 +141992,11 @@
141992 **
141993 ** Each call to this routine overrides any prior callbacks registered
141994 ** on the same "db". If xNotify==0 then any prior callbacks are immediately
141995 ** cancelled.
141996 */
141997 SQLITE_API int sqlite3_unlock_notify(
141998 sqlite3 *db,
141999 void (*xNotify)(void **, int),
142000 void *pArg
142001 ){
142002 int rc = SQLITE_OK;
@@ -149016,11 +148995,11 @@
148995 ** Initialize API pointer table, if required.
148996 */
148997 #ifdef _WIN32
148998 __declspec(dllexport)
148999 #endif
149000 SQLITE_API int sqlite3_fts3_init(
149001 sqlite3 *db,
149002 char **pzErrMsg,
149003 const sqlite3_api_routines *pApi
149004 ){
149005 SQLITE_EXTENSION_INIT2(pApi)
@@ -164817,11 +164796,11 @@
164796 }
164797
164798 /*
164799 ** Register a new geometry function for use with the r-tree MATCH operator.
164800 */
164801 SQLITE_API int sqlite3_rtree_geometry_callback(
164802 sqlite3 *db, /* Register SQL function on this connection */
164803 const char *zGeom, /* Name of the new SQL function */
164804 int (*xGeom)(sqlite3_rtree_geometry*,int,RtreeDValue*,int*), /* Callback */
164805 void *pContext /* Extra data associated with the callback */
164806 ){
@@ -164841,11 +164820,11 @@
164820
164821 /*
164822 ** Register a new 2nd-generation geometry function for use with the
164823 ** r-tree MATCH operator.
164824 */
164825 SQLITE_API int sqlite3_rtree_query_callback(
164826 sqlite3 *db, /* Register SQL function on this connection */
164827 const char *zQueryFunc, /* Name of new SQL function */
164828 int (*xQueryFunc)(sqlite3_rtree_query_info*), /* Callback */
164829 void *pContext, /* Extra data passed into the callback */
164830 void (*xDestructor)(void*) /* Destructor for the extra data */
@@ -164866,11 +164845,11 @@
164845
164846 #if !SQLITE_CORE
164847 #ifdef _WIN32
164848 __declspec(dllexport)
164849 #endif
164850 SQLITE_API int sqlite3_rtree_init(
164851 sqlite3 *db,
164852 char **pzErrMsg,
164853 const sqlite3_api_routines *pApi
164854 ){
164855 SQLITE_EXTENSION_INIT2(pApi)
@@ -165417,11 +165396,11 @@
165396
165397 #if !SQLITE_CORE
165398 #ifdef _WIN32
165399 __declspec(dllexport)
165400 #endif
165401 SQLITE_API int sqlite3_icu_init(
165402 sqlite3 *db,
165403 char **pzErrMsg,
165404 const sqlite3_api_routines *pApi
165405 ){
165406 SQLITE_EXTENSION_INIT2(pApi)
@@ -166097,11 +166076,11 @@
166076 ** IMPORTANT NOTE FOR ZIPVFS USERS: The RBU extension works with all of
166077 ** SQLite's built-in VFSs, including the multiplexor VFS. However it does
166078 ** not work out of the box with zipvfs. Refer to the comment describing
166079 ** the zipvfs_create_vfs() API below for details on using RBU with zipvfs.
166080 */
166081 SQLITE_API sqlite3rbu *sqlite3rbu_open(
166082 const char *zTarget,
166083 const char *zRbu,
166084 const char *zState
166085 );
166086
@@ -166136,11 +166115,11 @@
166115 ** As with sqlite3rbu_open(), Zipvfs users should rever to the comment
166116 ** describing the sqlite3rbu_create_vfs() API function below for
166117 ** a description of the complications associated with using RBU with
166118 ** zipvfs databases.
166119 */
166120 SQLITE_API sqlite3rbu *sqlite3rbu_vacuum(
166121 const char *zTarget,
166122 const char *zState
166123 );
166124
166125 /*
@@ -166172,11 +166151,11 @@
166151 ** when sqlite3rbu_close() is called.
166152 **
166153 ** Database handles returned by this function remain valid until the next
166154 ** call to any sqlite3rbu_xxx() function other than sqlite3rbu_db().
166155 */
166156 SQLITE_API sqlite3 *sqlite3rbu_db(sqlite3rbu*, int bRbu);
166157
166158 /*
166159 ** Do some work towards applying the RBU update to the target db.
166160 **
166161 ** Return SQLITE_DONE if the update has been completely applied, or
@@ -166186,11 +166165,11 @@
166165 **
166166 ** Once a call to sqlite3rbu_step() has returned a value other than
166167 ** SQLITE_OK, all subsequent calls on the same RBU handle are no-ops
166168 ** that immediately return the same value.
166169 */
166170 SQLITE_API int sqlite3rbu_step(sqlite3rbu *pRbu);
166171
166172 /*
166173 ** Force RBU to save its state to disk.
166174 **
166175 ** If a power failure or application crash occurs during an update, following
@@ -166198,11 +166177,11 @@
166177 ** was last saved. In other words, from the most recent successful call to
166178 ** sqlite3rbu_close() or this function.
166179 **
166180 ** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
166181 */
166182 SQLITE_API int sqlite3rbu_savestate(sqlite3rbu *pRbu);
166183
166184 /*
166185 ** Close an RBU handle.
166186 **
166187 ** If the RBU update has been completely applied, mark the RBU database
@@ -166218,18 +166197,18 @@
166197 **
166198 ** Otherwise, if no error occurs, this function returns SQLITE_OK if the
166199 ** update has been partially applied, or SQLITE_DONE if it has been
166200 ** completely applied.
166201 */
166202 SQLITE_API int sqlite3rbu_close(sqlite3rbu *pRbu, char **pzErrmsg);
166203
166204 /*
166205 ** Return the total number of key-value operations (inserts, deletes or
166206 ** updates) that have been performed on the target database since the
166207 ** current RBU update was started.
166208 */
166209 SQLITE_API sqlite3_int64 sqlite3rbu_progress(sqlite3rbu *pRbu);
166210
166211 /*
166212 ** Obtain permyriadage (permyriadage is to 10000 as percentage is to 100)
166213 ** progress indications for the two stages of an RBU update. This API may
166214 ** be useful for driving GUI progress indicators and similar.
@@ -166267,11 +166246,11 @@
166246 ** permyriadage progress of the same stage. If the rbu_count table does
166247 ** not exist, then (*pnOne) is set to -1 during stage 1. If the rbu_count
166248 ** table exists but is not correctly populated, the value of the *pnOne
166249 ** output variable during stage 1 is undefined.
166250 */
166251 SQLITE_API void sqlite3rbu_bp_progress(sqlite3rbu *pRbu, int *pnOne, int *pnTwo);
166252
166253 /*
166254 ** Obtain an indication as to the current stage of an RBU update or vacuum.
166255 ** This function always returns one of the SQLITE_RBU_STATE_XXX constants
166256 ** defined in this file. Return values should be interpreted as follows:
@@ -166305,11 +166284,11 @@
166284 #define SQLITE_RBU_STATE_MOVE 2
166285 #define SQLITE_RBU_STATE_CHECKPOINT 3
166286 #define SQLITE_RBU_STATE_DONE 4
166287 #define SQLITE_RBU_STATE_ERROR 5
166288
166289 SQLITE_API int sqlite3rbu_state(sqlite3rbu *pRbu);
166290
166291 /*
166292 ** Create an RBU VFS named zName that accesses the underlying file-system
166293 ** via existing VFS zParent. Or, if the zParent parameter is passed NULL,
166294 ** then the new RBU VFS uses the default system VFS to access the file-system.
@@ -166349,21 +166328,21 @@
166328 ** The overhead of adding the "rbu" VFS to the system is negligible for
166329 ** non-RBU users. There is no harm in an application accessing the
166330 ** file-system via "rbu" all the time, even if it only uses RBU functionality
166331 ** occasionally.
166332 */
166333 SQLITE_API int sqlite3rbu_create_vfs(const char *zName, const char *zParent);
166334
166335 /*
166336 ** Deregister and destroy an RBU vfs created by an earlier call to
166337 ** sqlite3rbu_create_vfs().
166338 **
166339 ** VFS objects are not reference counted. If a VFS object is destroyed
166340 ** before all database handles that use it have been closed, the results
166341 ** are undefined.
166342 */
166343 SQLITE_API void sqlite3rbu_destroy_vfs(const char *zName);
166344
166345 #if 0
166346 } /* end of the 'extern "C"' block */
166347 #endif
166348
@@ -169456,11 +169435,11 @@
169435 }
169436
169437 /*
169438 ** Step the RBU object.
169439 */
169440 SQLITE_API int sqlite3rbu_step(sqlite3rbu *p){
169441 if( p ){
169442 switch( p->eStage ){
169443 case RBU_STAGE_OAL: {
169444 RbuObjIter *pIter = &p->objiter;
169445
@@ -169910,11 +169889,11 @@
169889 }
169890
169891 /*
169892 ** Open and return a new RBU handle.
169893 */
169894 SQLITE_API sqlite3rbu *sqlite3rbu_open(
169895 const char *zTarget,
169896 const char *zRbu,
169897 const char *zState
169898 ){
169899 if( zTarget==0 || zRbu==0 ){ return rbuMisuseError(); }
@@ -169923,11 +169902,11 @@
169902 }
169903
169904 /*
169905 ** Open a handle to begin or resume an RBU VACUUM operation.
169906 */
169907 SQLITE_API sqlite3rbu *sqlite3rbu_vacuum(
169908 const char *zTarget,
169909 const char *zState
169910 ){
169911 if( zTarget==0 ){ return rbuMisuseError(); }
169912 /* TODO: Check that both arguments are non-NULL */
@@ -169935,11 +169914,11 @@
169914 }
169915
169916 /*
169917 ** Return the database handle used by pRbu.
169918 */
169919 SQLITE_API sqlite3 *sqlite3rbu_db(sqlite3rbu *pRbu, int bRbu){
169920 sqlite3 *db = 0;
169921 if( pRbu ){
169922 db = (bRbu ? pRbu->dbRbu : pRbu->dbMain);
169923 }
169924 return db;
@@ -169967,11 +169946,11 @@
169946 }
169947
169948 /*
169949 ** Close the RBU handle.
169950 */
169951 SQLITE_API int sqlite3rbu_close(sqlite3rbu *p, char **pzErrmsg){
169952 int rc;
169953 if( p ){
169954
169955 /* Commit the transaction to the *-oal file. */
169956 if( p->rc==SQLITE_OK && p->eStage==RBU_STAGE_OAL ){
@@ -170019,19 +169998,19 @@
169998 /*
169999 ** Return the total number of key-value operations (inserts, deletes or
170000 ** updates) that have been performed on the target database since the
170001 ** current RBU update was started.
170002 */
170003 SQLITE_API sqlite3_int64 sqlite3rbu_progress(sqlite3rbu *pRbu){
170004 return pRbu->nProgress;
170005 }
170006
170007 /*
170008 ** Return permyriadage progress indications for the two main stages of
170009 ** an RBU update.
170010 */
170011 SQLITE_API void sqlite3rbu_bp_progress(sqlite3rbu *p, int *pnOne, int *pnTwo){
170012 const int MAX_PROGRESS = 10000;
170013 switch( p->eStage ){
170014 case RBU_STAGE_OAL:
170015 if( p->nPhaseOneStep>0 ){
170016 *pnOne = (int)(MAX_PROGRESS * (i64)p->nProgress/(i64)p->nPhaseOneStep);
@@ -170062,11 +170041,11 @@
170041 }
170042
170043 /*
170044 ** Return the current state of the RBU vacuum or update operation.
170045 */
170046 SQLITE_API int sqlite3rbu_state(sqlite3rbu *p){
170047 int aRes[] = {
170048 0, SQLITE_RBU_STATE_OAL, SQLITE_RBU_STATE_MOVE,
170049 0, SQLITE_RBU_STATE_CHECKPOINT, SQLITE_RBU_STATE_DONE
170050 };
170051
@@ -170090,11 +170069,11 @@
170069 );
170070 return aRes[p->eStage];
170071 }
170072 }
170073
170074 SQLITE_API int sqlite3rbu_savestate(sqlite3rbu *p){
170075 int rc = p->rc;
170076 if( rc==SQLITE_DONE ) return SQLITE_OK;
170077
170078 assert( p->eStage>=RBU_STAGE_OAL && p->eStage<=RBU_STAGE_DONE );
170079 if( p->eStage==RBU_STAGE_OAL ){
@@ -170917,11 +170896,11 @@
170896
170897 /*
170898 ** Deregister and destroy an RBU vfs created by an earlier call to
170899 ** sqlite3rbu_create_vfs().
170900 */
170901 SQLITE_API void sqlite3rbu_destroy_vfs(const char *zName){
170902 sqlite3_vfs *pVfs = sqlite3_vfs_find(zName);
170903 if( pVfs && pVfs->xOpen==rbuVfsOpen ){
170904 sqlite3_mutex_free(((rbu_vfs*)pVfs)->mutex);
170905 sqlite3_vfs_unregister(pVfs);
170906 sqlite3_free(pVfs);
@@ -170931,11 +170910,11 @@
170910 /*
170911 ** Create an RBU VFS named zName that accesses the underlying file-system
170912 ** via existing VFS zParent. The new object is registered as a non-default
170913 ** VFS with SQLite before returning.
170914 */
170915 SQLITE_API int sqlite3rbu_create_vfs(const char *zName, const char *zParent){
170916
170917 /* Template for VFS */
170918 static sqlite3_vfs vfs_template = {
170919 1, /* iVersion */
170920 0, /* szOsFile */
@@ -173176,11 +173155,11 @@
173155 }
173156
173157 return rc;
173158 }
173159
173160 SQLITE_API int sqlite3session_diff(
173161 sqlite3_session *pSession,
173162 const char *zFrom,
173163 const char *zTbl,
173164 char **pzErrMsg
173165 ){
@@ -173270,11 +173249,11 @@
173249
173250 /*
173251 ** Create a session object. This session object will record changes to
173252 ** database zDb attached to connection db.
173253 */
173254 SQLITE_API int sqlite3session_create(
173255 sqlite3 *db, /* Database handle */
173256 const char *zDb, /* Name of db (e.g. "main") */
173257 sqlite3_session **ppSession /* OUT: New session object */
173258 ){
173259 sqlite3_session *pNew; /* Newly allocated session object */
@@ -173332,11 +173311,11 @@
173311 }
173312
173313 /*
173314 ** Delete a session object previously allocated using sqlite3session_create().
173315 */
173316 SQLITE_API void sqlite3session_delete(sqlite3_session *pSession){
173317 sqlite3 *db = pSession->db;
173318 sqlite3_session *pHead;
173319 sqlite3_session **pp;
173320
173321 /* Unlink the session from the linked list of sessions attached to the
@@ -173361,11 +173340,11 @@
173340 }
173341
173342 /*
173343 ** Set a table filter on a Session Object.
173344 */
173345 SQLITE_API void sqlite3session_table_filter(
173346 sqlite3_session *pSession,
173347 int(*xFilter)(void*, const char*),
173348 void *pCtx /* First argument passed to xFilter */
173349 ){
173350 pSession->bAutoAttach = 1;
@@ -173379,11 +173358,11 @@
173358 **
173359 ** Only tables that have a PRIMARY KEY defined may be attached. It does
173360 ** not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias)
173361 ** or not.
173362 */
173363 SQLITE_API int sqlite3session_attach(
173364 sqlite3_session *pSession, /* Session object */
173365 const char *zName /* Table name */
173366 ){
173367 int rc = SQLITE_OK;
173368 sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db));
@@ -174069,11 +174048,11 @@
174048 ** session object passed as the first argument.
174049 **
174050 ** It is the responsibility of the caller to eventually free the buffer
174051 ** using sqlite3_free().
174052 */
174053 SQLITE_API int sqlite3session_changeset(
174054 sqlite3_session *pSession, /* Session object */
174055 int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
174056 void **ppChangeset /* OUT: Buffer containing changeset */
174057 ){
174058 return sessionGenerateChangeset(pSession, 0, 0, 0, pnChangeset, ppChangeset);
@@ -174080,11 +174059,11 @@
174059 }
174060
174061 /*
174062 ** Streaming version of sqlite3session_changeset().
174063 */
174064 SQLITE_API int sqlite3session_changeset_strm(
174065 sqlite3_session *pSession,
174066 int (*xOutput)(void *pOut, const void *pData, int nData),
174067 void *pOut
174068 ){
174069 return sessionGenerateChangeset(pSession, 0, xOutput, pOut, 0, 0);
@@ -174091,11 +174070,11 @@
174070 }
174071
174072 /*
174073 ** Streaming version of sqlite3session_patchset().
174074 */
174075 SQLITE_API int sqlite3session_patchset_strm(
174076 sqlite3_session *pSession,
174077 int (*xOutput)(void *pOut, const void *pData, int nData),
174078 void *pOut
174079 ){
174080 return sessionGenerateChangeset(pSession, 1, xOutput, pOut, 0, 0);
@@ -174106,11 +174085,11 @@
174085 ** session object passed as the first argument.
174086 **
174087 ** It is the responsibility of the caller to eventually free the buffer
174088 ** using sqlite3_free().
174089 */
174090 SQLITE_API int sqlite3session_patchset(
174091 sqlite3_session *pSession, /* Session object */
174092 int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */
174093 void **ppPatchset /* OUT: Buffer containing changeset */
174094 ){
174095 return sessionGenerateChangeset(pSession, 1, 0, 0, pnPatchset, ppPatchset);
@@ -174117,11 +174096,11 @@
174096 }
174097
174098 /*
174099 ** Enable or disable the session object passed as the first argument.
174100 */
174101 SQLITE_API int sqlite3session_enable(sqlite3_session *pSession, int bEnable){
174102 int ret;
174103 sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db));
174104 if( bEnable>=0 ){
174105 pSession->bEnable = bEnable;
174106 }
@@ -174131,11 +174110,11 @@
174110 }
174111
174112 /*
174113 ** Enable or disable the session object passed as the first argument.
174114 */
174115 SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect){
174116 int ret;
174117 sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db));
174118 if( bIndirect>=0 ){
174119 pSession->bIndirect = bIndirect;
174120 }
@@ -174146,11 +174125,11 @@
174125
174126 /*
174127 ** Return true if there have been no changes to monitored tables recorded
174128 ** by the session object passed as the only argument.
174129 */
174130 SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession){
174131 int ret = 0;
174132 SessionTable *pTab;
174133
174134 sqlite3_mutex_enter(sqlite3_db_mutex(pSession->db));
174135 for(pTab=pSession->pTable; pTab && ret==0; pTab=pTab->pNext){
@@ -174196,11 +174175,11 @@
174175 }
174176
174177 /*
174178 ** Create an iterator used to iterate through the contents of a changeset.
174179 */
174180 SQLITE_API int sqlite3changeset_start(
174181 sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
174182 int nChangeset, /* Size of buffer pChangeset in bytes */
174183 void *pChangeset /* Pointer to buffer containing changeset */
174184 ){
174185 return sessionChangesetStart(pp, 0, 0, nChangeset, pChangeset);
@@ -174207,11 +174186,11 @@
174186 }
174187
174188 /*
174189 ** Streaming version of sqlite3changeset_start().
174190 */
174191 SQLITE_API int sqlite3changeset_start_strm(
174192 sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
174193 int (*xInput)(void *pIn, void *pData, int *pnData),
174194 void *pIn
174195 ){
174196 return sessionChangesetStart(pp, xInput, pIn, 0, 0);
@@ -174628,20 +174607,20 @@
174607 ** or SQLITE_CORRUPT.
174608 **
174609 ** This function may not be called on iterators passed to a conflict handler
174610 ** callback by changeset_apply().
174611 */
174612 SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *p){
174613 return sessionChangesetNext(p, 0, 0);
174614 }
174615
174616 /*
174617 ** The following function extracts information on the current change
174618 ** from a changeset iterator. It may only be called after changeset_next()
174619 ** has returned SQLITE_ROW.
174620 */
174621 SQLITE_API int sqlite3changeset_op(
174622 sqlite3_changeset_iter *pIter, /* Iterator handle */
174623 const char **pzTab, /* OUT: Pointer to table name */
174624 int *pnCol, /* OUT: Number of columns in table */
174625 int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */
174626 int *pbIndirect /* OUT: True if change is indirect */
@@ -174657,11 +174636,11 @@
174636 ** Return information regarding the PRIMARY KEY and number of columns in
174637 ** the database table affected by the change that pIter currently points
174638 ** to. This function may only be called after changeset_next() returns
174639 ** SQLITE_ROW.
174640 */
174641 SQLITE_API int sqlite3changeset_pk(
174642 sqlite3_changeset_iter *pIter, /* Iterator object */
174643 unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */
174644 int *pnCol /* OUT: Number of entries in output array */
174645 ){
174646 *pabPK = pIter->abPK;
@@ -174680,11 +174659,11 @@
174659 ** was not modified and is not a PK column), set *ppValue to NULL.
174660 **
174661 ** If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is
174662 ** not modified. Otherwise, SQLITE_OK.
174663 */
174664 SQLITE_API int sqlite3changeset_old(
174665 sqlite3_changeset_iter *pIter, /* Changeset iterator */
174666 int iVal, /* Index of old.* value to retrieve */
174667 sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */
174668 ){
174669 if( pIter->op!=SQLITE_UPDATE && pIter->op!=SQLITE_DELETE ){
@@ -174708,11 +174687,11 @@
174687 ** was not modified), set *ppValue to NULL.
174688 **
174689 ** If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is
174690 ** not modified. Otherwise, SQLITE_OK.
174691 */
174692 SQLITE_API int sqlite3changeset_new(
174693 sqlite3_changeset_iter *pIter, /* Changeset iterator */
174694 int iVal, /* Index of new.* value to retrieve */
174695 sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */
174696 ){
174697 if( pIter->op!=SQLITE_UPDATE && pIter->op!=SQLITE_INSERT ){
@@ -174742,11 +174721,11 @@
174721 ** containing the iVal'th value of the conflicting record.
174722 **
174723 ** If value iVal is out-of-range or some other error occurs, an SQLite error
174724 ** code is returned. Otherwise, SQLITE_OK.
174725 */
174726 SQLITE_API int sqlite3changeset_conflict(
174727 sqlite3_changeset_iter *pIter, /* Changeset iterator */
174728 int iVal, /* Index of conflict record value to fetch */
174729 sqlite3_value **ppValue /* OUT: Value from conflicting row */
174730 ){
174731 if( !pIter->pConflict ){
@@ -174765,11 +174744,11 @@
174744 ** it sets the output variable to the total number of known foreign key
174745 ** violations in the destination database and returns SQLITE_OK.
174746 **
174747 ** In all other cases this function returns SQLITE_MISUSE.
174748 */
174749 SQLITE_API int sqlite3changeset_fk_conflicts(
174750 sqlite3_changeset_iter *pIter, /* Changeset iterator */
174751 int *pnOut /* OUT: Number of FK violations */
174752 ){
174753 if( pIter->pConflict || pIter->apValue ){
174754 return SQLITE_MISUSE;
@@ -174783,11 +174762,11 @@
174762 ** Finalize an iterator allocated with sqlite3changeset_start().
174763 **
174764 ** This function may not be called on iterators passed to a conflict handler
174765 ** callback by changeset_apply().
174766 */
174767 SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *p){
174768 int rc = SQLITE_OK;
174769 if( p ){
174770 int i; /* Used to iterate through p->apValue[] */
174771 rc = p->rc;
174772 if( p->apValue ){
@@ -174957,11 +174936,11 @@
174936
174937
174938 /*
174939 ** Invert a changeset object.
174940 */
174941 SQLITE_API int sqlite3changeset_invert(
174942 int nChangeset, /* Number of bytes in input */
174943 const void *pChangeset, /* Input changeset */
174944 int *pnInverted, /* OUT: Number of bytes in output changeset */
174945 void **ppInverted /* OUT: Inverse of pChangeset */
174946 ){
@@ -174976,11 +174955,11 @@
174955 }
174956
174957 /*
174958 ** Streaming version of sqlite3changeset_invert().
174959 */
174960 SQLITE_API int sqlite3changeset_invert_strm(
174961 int (*xInput)(void *pIn, void *pData, int *pnData),
174962 void *pIn,
174963 int (*xOutput)(void *pOut, const void *pData, int nData),
174964 void *pOut
174965 ){
@@ -175856,11 +175835,11 @@
175835 /*
175836 ** Apply the changeset passed via pChangeset/nChangeset to the main database
175837 ** attached to handle "db". Invoke the supplied conflict handler callback
175838 ** to resolve any conflicts encountered while applying the change.
175839 */
175840 SQLITE_API int sqlite3changeset_apply(
175841 sqlite3 *db, /* Apply change to "main" db of this handle */
175842 int nChangeset, /* Size of changeset in bytes */
175843 void *pChangeset, /* Changeset blob */
175844 int(*xFilter)(
175845 void *pCtx, /* Copy of sixth arg to _apply() */
@@ -175884,11 +175863,11 @@
175863 /*
175864 ** Apply the changeset passed via xInput/pIn to the main database
175865 ** attached to handle "db". Invoke the supplied conflict handler callback
175866 ** to resolve any conflicts encountered while applying the change.
175867 */
175868 SQLITE_API int sqlite3changeset_apply_strm(
175869 sqlite3 *db, /* Apply change to "main" db of this handle */
175870 int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
175871 void *pIn, /* First arg for xInput */
175872 int(*xFilter)(
175873 void *pCtx, /* Copy of sixth arg to _apply() */
@@ -176219,11 +176198,11 @@
176198 }
176199
176200 /*
176201 ** Allocate a new, empty, sqlite3_changegroup.
176202 */
176203 SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp){
176204 int rc = SQLITE_OK; /* Return code */
176205 sqlite3_changegroup *p; /* New object */
176206 p = (sqlite3_changegroup*)sqlite3_malloc(sizeof(sqlite3_changegroup));
176207 if( p==0 ){
176208 rc = SQLITE_NOMEM;
@@ -176236,11 +176215,11 @@
176215
176216 /*
176217 ** Add the changeset currently stored in buffer pData, size nData bytes,
176218 ** to changeset-group p.
176219 */
176220 SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup *pGrp, int nData, void *pData){
176221 sqlite3_changeset_iter *pIter; /* Iterator opened on pData/nData */
176222 int rc; /* Return code */
176223
176224 rc = sqlite3changeset_start(&pIter, nData, pData);
176225 if( rc==SQLITE_OK ){
@@ -176252,11 +176231,11 @@
176231
176232 /*
176233 ** Obtain a buffer containing a changeset representing the concatenation
176234 ** of all changesets added to the group so far.
176235 */
176236 SQLITE_API int sqlite3changegroup_output(
176237 sqlite3_changegroup *pGrp,
176238 int *pnData,
176239 void **ppData
176240 ){
176241 return sessionChangegroupOutput(pGrp, 0, 0, pnData, ppData);
@@ -176263,11 +176242,11 @@
176242 }
176243
176244 /*
176245 ** Streaming versions of changegroup_add().
176246 */
176247 SQLITE_API int sqlite3changegroup_add_strm(
176248 sqlite3_changegroup *pGrp,
176249 int (*xInput)(void *pIn, void *pData, int *pnData),
176250 void *pIn
176251 ){
176252 sqlite3_changeset_iter *pIter; /* Iterator opened on pData/nData */
@@ -176282,11 +176261,11 @@
176261 }
176262
176263 /*
176264 ** Streaming versions of changegroup_output().
176265 */
176266 SQLITE_API int sqlite3changegroup_output_strm(
176267 sqlite3_changegroup *pGrp,
176268 int (*xOutput)(void *pOut, const void *pData, int nData),
176269 void *pOut
176270 ){
176271 return sessionChangegroupOutput(pGrp, xOutput, pOut, 0, 0);
@@ -176293,21 +176272,21 @@
176272 }
176273
176274 /*
176275 ** Delete a changegroup object.
176276 */
176277 SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup *pGrp){
176278 if( pGrp ){
176279 sessionDeleteTable(pGrp->pList);
176280 sqlite3_free(pGrp);
176281 }
176282 }
176283
176284 /*
176285 ** Combine two changesets together.
176286 */
176287 SQLITE_API int sqlite3changeset_concat(
176288 int nLeft, /* Number of bytes in lhs input */
176289 void *pLeft, /* Lhs input changeset */
176290 int nRight /* Number of bytes in rhs input */,
176291 void *pRight, /* Rhs input changeset */
176292 int *pnOut, /* OUT: Number of bytes in output changeset */
@@ -176332,11 +176311,11 @@
176311 }
176312
176313 /*
176314 ** Streaming version of sqlite3changeset_concat().
176315 */
176316 SQLITE_API int sqlite3changeset_concat_strm(
176317 int (*xInputA)(void *pIn, void *pData, int *pnData),
176318 void *pInA,
176319 int (*xInputB)(void *pIn, void *pData, int *pnData),
176320 void *pInB,
176321 int (*xOutput)(void *pOut, const void *pData, int nData),
@@ -178564,11 +178543,11 @@
178543
178544 #ifndef SQLITE_CORE
178545 #ifdef _WIN32
178546 __declspec(dllexport)
178547 #endif
178548 SQLITE_API int sqlite3_json_init(
178549 sqlite3 *db,
178550 char **pzErrMsg,
178551 const sqlite3_api_routines *pApi
178552 ){
178553 SQLITE_EXTENSION_INIT2(pApi);
@@ -184048,18 +184027,18 @@
184027 Fts5ExprNode *pNode
184028 ){
184029 Fts5ExprNearset *pNear = pNode->pNear;
184030 int i, j;
184031 int rc = SQLITE_OK;
184032 int bEof = 1;
184033
184034 assert( pNode->bNomatch==0 );
184035 for(i=0; rc==SQLITE_OK && i<pNear->nPhrase; i++){
184036 Fts5ExprPhrase *pPhrase = pNear->apPhrase[i];
184037 for(j=0; j<pPhrase->nTerm; j++){
184038 Fts5ExprTerm *pTerm = &pPhrase->aTerm[j];
184039 Fts5ExprTerm *p;
 
184040
184041 for(p=pTerm; p && rc==SQLITE_OK; p=p->pSynonym){
184042 if( p->pIter ){
184043 sqlite3Fts5IterClose(p->pIter);
184044 p->pIter = 0;
@@ -184075,17 +184054,16 @@
184054 if( p->pIter && 0==sqlite3Fts5IterEof(p->pIter) ){
184055 bEof = 0;
184056 }
184057 }
184058
184059 if( bEof ) break;
 
 
 
184060 }
184061 if( bEof ) break;
184062 }
184063
184064 pNode->bEof = bEof;
184065 return rc;
184066 }
184067
184068 /*
184069 ** If pExpr is an ASC iterator, this function returns a value with the
@@ -184932,11 +184910,10 @@
184910 int iPhrase,
184911 Fts5Expr **ppNew
184912 ){
184913 int rc = SQLITE_OK; /* Return code */
184914 Fts5ExprPhrase *pOrig; /* The phrase extracted from pExpr */
 
184915 Fts5Expr *pNew = 0; /* Expression to return via *ppNew */
184916 TokenCtx sCtx = {0,0}; /* Context object for fts5ParseTokenize */
184917
184918 pOrig = pExpr->apExprPhrase[iPhrase];
184919 pNew = (Fts5Expr*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Expr));
@@ -184962,22 +184939,29 @@
184939 }
184940 pNew->pRoot->pNear->pColset = pColset;
184941 }
184942 }
184943
184944 if( pOrig->nTerm ){
184945 int i; /* Used to iterate through phrase terms */
184946 for(i=0; rc==SQLITE_OK && i<pOrig->nTerm; i++){
184947 int tflags = 0;
184948 Fts5ExprTerm *p;
184949 for(p=&pOrig->aTerm[i]; p && rc==SQLITE_OK; p=p->pSynonym){
184950 const char *zTerm = p->zTerm;
184951 rc = fts5ParseTokenize((void*)&sCtx, tflags, zTerm, (int)strlen(zTerm),
184952 0, 0);
184953 tflags = FTS5_TOKEN_COLOCATED;
184954 }
184955 if( rc==SQLITE_OK ){
184956 sCtx.pPhrase->aTerm[i].bPrefix = pOrig->aTerm[i].bPrefix;
184957 }
184958 }
184959 }else{
184960 /* This happens when parsing a token or quoted phrase that contains
184961 ** no token characters at all. (e.g ... MATCH '""'). */
184962 sCtx.pPhrase = sqlite3Fts5MallocZero(&rc, sizeof(Fts5ExprPhrase));
184963 }
184964
184965 if( rc==SQLITE_OK ){
184966 /* All the allocations succeeded. Put the expression object together. */
184967 pNew->pIndex = pExpr->pIndex;
@@ -195613,11 +195597,11 @@
195597 int nArg, /* Number of args */
195598 sqlite3_value **apUnused /* Function arguments */
195599 ){
195600 assert( nArg==0 );
195601 UNUSED_PARAM2(nArg, apUnused);
195602 sqlite3_result_text(pCtx, "fts5: 2016-09-21 19:43:34 0741812d7fcd558479e4849fbb3ba8d03738d018", -1, SQLITE_TRANSIENT);
195603 }
195604
195605 static int fts5Init(sqlite3 *db){
195606 static const sqlite3_module fts5Mod = {
195607 /* iVersion */ 2,
@@ -195701,11 +195685,11 @@
195685 */
195686 #ifndef SQLITE_CORE
195687 #ifdef _WIN32
195688 __declspec(dllexport)
195689 #endif
195690 SQLITE_API int sqlite3_fts_init(
195691 sqlite3 *db,
195692 char **pzErrMsg,
195693 const sqlite3_api_routines *pApi
195694 ){
195695 SQLITE_EXTENSION_INIT2(pApi);
@@ -195714,11 +195698,11 @@
195698 }
195699
195700 #ifdef _WIN32
195701 __declspec(dllexport)
195702 #endif
195703 SQLITE_API int sqlite3_fts5_init(
195704 sqlite3 *db,
195705 char **pzErrMsg,
195706 const sqlite3_api_routines *pApi
195707 ){
195708 SQLITE_EXTENSION_INIT2(pApi);
@@ -199095,12 +199079,23 @@
199079 pInfo->aConstraintUsage[iTermLe].argvIndex = ++nArg;
199080 pInfo->estimatedCost = pInfo->estimatedCost / 2;
199081 }
199082 }
199083
199084 /* This virtual table always delivers results in ascending order of
199085 ** the "term" column (column 0). So if the user has requested this
199086 ** specifically - "ORDER BY term" or "ORDER BY term ASC" - set the
199087 ** sqlite3_index_info.orderByConsumed flag to tell the core the results
199088 ** are already in sorted order. */
199089 if( pInfo->nOrderBy==1
199090 && pInfo->aOrderBy[0].iColumn==0
199091 && pInfo->aOrderBy[0].desc==0
199092 ){
199093 pInfo->orderByConsumed = 1;
199094 }
199095
199096 pInfo->idxNum = idxNum;
199097 return SQLITE_OK;
199098 }
199099
199100 /*
199101 ** Implementation of xOpen method.
199102
+261 -253
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -106,11 +106,12 @@
106106
** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
107107
** be larger than the release from which it is derived. Either Y will
108108
** be held constant and Z will be incremented or else Y will be incremented
109109
** and Z will be reset to zero.
110110
**
111
-** Since version 3.6.18, SQLite source code has been stored in the
111
+** Since [version 3.6.18] ([dateof:3.6.18]),
112
+** SQLite source code has been stored in the
112113
** <a href="http://www.fossil-scm.org/">Fossil configuration management
113114
** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
114115
** a string which identifies a particular check-in of SQLite
115116
** within its configuration management system. ^The SQLITE_SOURCE_ID
116117
** string contains the date and time of the check-in (UTC) and an SHA1
@@ -120,11 +121,11 @@
120121
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
121122
** [sqlite_version()] and [sqlite_source_id()].
122123
*/
123124
#define SQLITE_VERSION "3.15.0"
124125
#define SQLITE_VERSION_NUMBER 3015000
125
-#define SQLITE_SOURCE_ID "2016-09-10 19:51:40 711c59171b22df04224183a713e6c36e0bb3bba8"
126
+#define SQLITE_SOURCE_ID "2016-09-22 18:53:13 c3774c6a5fe48af91fda28e9e18c6ed9053ea992"
126127
127128
/*
128129
** CAPI3REF: Run-Time Library Version Numbers
129130
** KEYWORDS: sqlite3_version, sqlite3_sourceid
130131
**
@@ -153,13 +154,13 @@
153154
** [SQLITE_SOURCE_ID] C preprocessor macro.
154155
**
155156
** See also: [sqlite_version()] and [sqlite_source_id()].
156157
*/
157158
SQLITE_API SQLITE_EXTERN const char sqlite3_version[];
158
-SQLITE_API const char *SQLITE_STDCALL sqlite3_libversion(void);
159
-SQLITE_API const char *SQLITE_STDCALL sqlite3_sourceid(void);
160
-SQLITE_API int SQLITE_STDCALL sqlite3_libversion_number(void);
159
+SQLITE_API const char *sqlite3_libversion(void);
160
+SQLITE_API const char *sqlite3_sourceid(void);
161
+SQLITE_API int sqlite3_libversion_number(void);
161162
162163
/*
163164
** CAPI3REF: Run-Time Library Compilation Options Diagnostics
164165
**
165166
** ^The sqlite3_compileoption_used() function returns 0 or 1
@@ -180,12 +181,12 @@
180181
**
181182
** See also: SQL functions [sqlite_compileoption_used()] and
182183
** [sqlite_compileoption_get()] and the [compile_options pragma].
183184
*/
184185
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
185
-SQLITE_API int SQLITE_STDCALL sqlite3_compileoption_used(const char *zOptName);
186
-SQLITE_API const char *SQLITE_STDCALL sqlite3_compileoption_get(int N);
186
+SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
187
+SQLITE_API const char *sqlite3_compileoption_get(int N);
187188
#endif
188189
189190
/*
190191
** CAPI3REF: Test To See If The Library Is Threadsafe
191192
**
@@ -220,11 +221,11 @@
220221
** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
221222
** is unchanged by calls to sqlite3_config().)^
222223
**
223224
** See the [threading mode] documentation for additional information.
224225
*/
225
-SQLITE_API int SQLITE_STDCALL sqlite3_threadsafe(void);
226
+SQLITE_API int sqlite3_threadsafe(void);
226227
227228
/*
228229
** CAPI3REF: Database Connection Handle
229230
** KEYWORDS: {database connection} {database connections}
230231
**
@@ -317,12 +318,12 @@
317318
** from [sqlite3_open()], [sqlite3_open16()], or
318319
** [sqlite3_open_v2()], and not previously closed.
319320
** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer
320321
** argument is a harmless no-op.
321322
*/
322
-SQLITE_API int SQLITE_STDCALL sqlite3_close(sqlite3*);
323
-SQLITE_API int SQLITE_STDCALL sqlite3_close_v2(sqlite3*);
323
+SQLITE_API int sqlite3_close(sqlite3*);
324
+SQLITE_API int sqlite3_close_v2(sqlite3*);
324325
325326
/*
326327
** The type for a callback function.
327328
** This is legacy and deprecated. It is included for historical
328329
** compatibility and is not documented.
@@ -389,11 +390,11 @@
389390
** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
390391
** <li> The application must not modify the SQL statement text passed into
391392
** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
392393
** </ul>
393394
*/
394
-SQLITE_API int SQLITE_STDCALL sqlite3_exec(
395
+SQLITE_API int sqlite3_exec(
395396
sqlite3*, /* An open database */
396397
const char *sql, /* SQL to be evaluated */
397398
int (*callback)(void*,int,char**,char**), /* Callback function */
398399
void *, /* 1st argument to callback */
399400
char **errmsg /* Error msg written here */
@@ -450,11 +451,12 @@
450451
**
451452
** In its default configuration, SQLite API routines return one of 30 integer
452453
** [result codes]. However, experience has shown that many of
453454
** these result codes are too coarse-grained. They do not provide as
454455
** much information about problems as programmers might like. In an effort to
455
-** address this, newer versions of SQLite (version 3.3.8 and later) include
456
+** address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]
457
+** and later) include
456458
** support for additional result codes that provide more detailed information
457459
** about errors. These [extended result codes] are enabled or disabled
458460
** on a per database connection basis using the
459461
** [sqlite3_extended_result_codes()] API. Or, the extended code for
460462
** the most recent error can be obtained using
@@ -1388,14 +1390,14 @@
13881390
** sqlite3_os_init() and sqlite3_os_end(). An application-supplied
13891391
** implementation of sqlite3_os_init() or sqlite3_os_end()
13901392
** must return [SQLITE_OK] on success and some other [error code] upon
13911393
** failure.
13921394
*/
1393
-SQLITE_API int SQLITE_STDCALL sqlite3_initialize(void);
1394
-SQLITE_API int SQLITE_STDCALL sqlite3_shutdown(void);
1395
-SQLITE_API int SQLITE_STDCALL sqlite3_os_init(void);
1396
-SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void);
1395
+SQLITE_API int sqlite3_initialize(void);
1396
+SQLITE_API int sqlite3_shutdown(void);
1397
+SQLITE_API int sqlite3_os_init(void);
1398
+SQLITE_API int sqlite3_os_end(void);
13971399
13981400
/*
13991401
** CAPI3REF: Configuring The SQLite Library
14001402
**
14011403
** The sqlite3_config() interface is used to make global configuration
@@ -1424,11 +1426,11 @@
14241426
**
14251427
** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
14261428
** ^If the option is unknown or SQLite is unable to set the option
14271429
** then this routine returns a non-zero [error code].
14281430
*/
1429
-SQLITE_API int SQLITE_CDECL sqlite3_config(int, ...);
1431
+SQLITE_API int sqlite3_config(int, ...);
14301432
14311433
/*
14321434
** CAPI3REF: Configure database connections
14331435
** METHOD: sqlite3
14341436
**
@@ -1443,11 +1445,11 @@
14431445
** Subsequent arguments vary depending on the configuration verb.
14441446
**
14451447
** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
14461448
** the call is considered successful.
14471449
*/
1448
-SQLITE_API int SQLITE_CDECL sqlite3_db_config(sqlite3*, int op, ...);
1450
+SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...);
14491451
14501452
/*
14511453
** CAPI3REF: Memory Allocation Routines
14521454
**
14531455
** An instance of this object defines the interface between SQLite
@@ -1994,11 +1996,11 @@
19941996
**
19951997
** ^The sqlite3_extended_result_codes() routine enables or disables the
19961998
** [extended result codes] feature of SQLite. ^The extended result
19971999
** codes are disabled by default for historical compatibility.
19982000
*/
1999
-SQLITE_API int SQLITE_STDCALL sqlite3_extended_result_codes(sqlite3*, int onoff);
2001
+SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);
20002002
20012003
/*
20022004
** CAPI3REF: Last Insert Rowid
20032005
** METHOD: sqlite3
20042006
**
@@ -2046,11 +2048,11 @@
20462048
** function is running and thus changes the last insert [rowid],
20472049
** then the value returned by [sqlite3_last_insert_rowid()] is
20482050
** unpredictable and might not equal either the old or the new
20492051
** last insert [rowid].
20502052
*/
2051
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_last_insert_rowid(sqlite3*);
2053
+SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
20522054
20532055
/*
20542056
** CAPI3REF: Count The Number Of Rows Modified
20552057
** METHOD: sqlite3
20562058
**
@@ -2099,11 +2101,11 @@
20992101
**
21002102
** If a separate thread makes changes on the same database connection
21012103
** while [sqlite3_changes()] is running then the value returned
21022104
** is unpredictable and not meaningful.
21032105
*/
2104
-SQLITE_API int SQLITE_STDCALL sqlite3_changes(sqlite3*);
2106
+SQLITE_API int sqlite3_changes(sqlite3*);
21052107
21062108
/*
21072109
** CAPI3REF: Total Number Of Rows Modified
21082110
** METHOD: sqlite3
21092111
**
@@ -2123,11 +2125,11 @@
21232125
**
21242126
** If a separate thread makes changes on the same database connection
21252127
** while [sqlite3_total_changes()] is running then the value
21262128
** returned is unpredictable and not meaningful.
21272129
*/
2128
-SQLITE_API int SQLITE_STDCALL sqlite3_total_changes(sqlite3*);
2130
+SQLITE_API int sqlite3_total_changes(sqlite3*);
21292131
21302132
/*
21312133
** CAPI3REF: Interrupt A Long-Running Query
21322134
** METHOD: sqlite3
21332135
**
@@ -2163,11 +2165,11 @@
21632165
** that are started after the sqlite3_interrupt() call returns.
21642166
**
21652167
** If the database connection closes while [sqlite3_interrupt()]
21662168
** is running then bad things will likely happen.
21672169
*/
2168
-SQLITE_API void SQLITE_STDCALL sqlite3_interrupt(sqlite3*);
2170
+SQLITE_API void sqlite3_interrupt(sqlite3*);
21692171
21702172
/*
21712173
** CAPI3REF: Determine If An SQL Statement Is Complete
21722174
**
21732175
** These routines are useful during command-line input to determine if the
@@ -2198,12 +2200,12 @@
21982200
** UTF-8 string.
21992201
**
22002202
** The input to [sqlite3_complete16()] must be a zero-terminated
22012203
** UTF-16 string in native byte order.
22022204
*/
2203
-SQLITE_API int SQLITE_STDCALL sqlite3_complete(const char *sql);
2204
-SQLITE_API int SQLITE_STDCALL sqlite3_complete16(const void *sql);
2205
+SQLITE_API int sqlite3_complete(const char *sql);
2206
+SQLITE_API int sqlite3_complete16(const void *sql);
22052207
22062208
/*
22072209
** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
22082210
** KEYWORDS: {busy-handler callback} {busy handler}
22092211
** METHOD: sqlite3
@@ -2260,11 +2262,11 @@
22602262
** result in undefined behavior.
22612263
**
22622264
** A busy handler must not close the database connection
22632265
** or [prepared statement] that invoked the busy handler.
22642266
*/
2265
-SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
2267
+SQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
22662268
22672269
/*
22682270
** CAPI3REF: Set A Busy Timeout
22692271
** METHOD: sqlite3
22702272
**
@@ -2283,11 +2285,11 @@
22832285
** was defined (using [sqlite3_busy_handler()]) prior to calling
22842286
** this routine, that other busy handler is cleared.)^
22852287
**
22862288
** See also: [PRAGMA busy_timeout]
22872289
*/
2288
-SQLITE_API int SQLITE_STDCALL sqlite3_busy_timeout(sqlite3*, int ms);
2290
+SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
22892291
22902292
/*
22912293
** CAPI3REF: Convenience Routines For Running Queries
22922294
** METHOD: sqlite3
22932295
**
@@ -2358,19 +2360,19 @@
23582360
** interface defined here. As a consequence, errors that occur in the
23592361
** wrapper layer outside of the internal [sqlite3_exec()] call are not
23602362
** reflected in subsequent calls to [sqlite3_errcode()] or
23612363
** [sqlite3_errmsg()].
23622364
*/
2363
-SQLITE_API int SQLITE_STDCALL sqlite3_get_table(
2365
+SQLITE_API int sqlite3_get_table(
23642366
sqlite3 *db, /* An open database */
23652367
const char *zSql, /* SQL to be evaluated */
23662368
char ***pazResult, /* Results of the query */
23672369
int *pnRow, /* Number of result rows written here */
23682370
int *pnColumn, /* Number of result columns written here */
23692371
char **pzErrmsg /* Error msg written here */
23702372
);
2371
-SQLITE_API void SQLITE_STDCALL sqlite3_free_table(char **result);
2373
+SQLITE_API void sqlite3_free_table(char **result);
23722374
23732375
/*
23742376
** CAPI3REF: Formatted String Printing Functions
23752377
**
23762378
** These routines are work-alikes of the "printf()" family of functions
@@ -2472,14 +2474,14 @@
24722474
**
24732475
** ^(The "%z" formatting option works like "%s" but with the
24742476
** addition that after the string has been read and copied into
24752477
** the result, [sqlite3_free()] is called on the input string.)^
24762478
*/
2477
-SQLITE_API char *SQLITE_CDECL sqlite3_mprintf(const char*,...);
2478
-SQLITE_API char *SQLITE_STDCALL sqlite3_vmprintf(const char*, va_list);
2479
-SQLITE_API char *SQLITE_CDECL sqlite3_snprintf(int,char*,const char*, ...);
2480
-SQLITE_API char *SQLITE_STDCALL sqlite3_vsnprintf(int,char*,const char*, va_list);
2479
+SQLITE_API char *sqlite3_mprintf(const char*,...);
2480
+SQLITE_API char *sqlite3_vmprintf(const char*, va_list);
2481
+SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);
2482
+SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
24812483
24822484
/*
24832485
** CAPI3REF: Memory Allocation Subsystem
24842486
**
24852487
** The SQLite core uses these three routines for all of its own
@@ -2565,16 +2567,16 @@
25652567
**
25662568
** The application must not read or write any part of
25672569
** a block of memory after it has been released using
25682570
** [sqlite3_free()] or [sqlite3_realloc()].
25692571
*/
2570
-SQLITE_API void *SQLITE_STDCALL sqlite3_malloc(int);
2571
-SQLITE_API void *SQLITE_STDCALL sqlite3_malloc64(sqlite3_uint64);
2572
-SQLITE_API void *SQLITE_STDCALL sqlite3_realloc(void*, int);
2573
-SQLITE_API void *SQLITE_STDCALL sqlite3_realloc64(void*, sqlite3_uint64);
2574
-SQLITE_API void SQLITE_STDCALL sqlite3_free(void*);
2575
-SQLITE_API sqlite3_uint64 SQLITE_STDCALL sqlite3_msize(void*);
2572
+SQLITE_API void *sqlite3_malloc(int);
2573
+SQLITE_API void *sqlite3_malloc64(sqlite3_uint64);
2574
+SQLITE_API void *sqlite3_realloc(void*, int);
2575
+SQLITE_API void *sqlite3_realloc64(void*, sqlite3_uint64);
2576
+SQLITE_API void sqlite3_free(void*);
2577
+SQLITE_API sqlite3_uint64 sqlite3_msize(void*);
25762578
25772579
/*
25782580
** CAPI3REF: Memory Allocator Statistics
25792581
**
25802582
** SQLite provides these two interfaces for reporting on the status
@@ -2595,12 +2597,12 @@
25952597
** [sqlite3_memory_used()] if and only if the parameter to
25962598
** [sqlite3_memory_highwater()] is true. ^The value returned
25972599
** by [sqlite3_memory_highwater(1)] is the high-water mark
25982600
** prior to the reset.
25992601
*/
2600
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_used(void);
2601
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_highwater(int resetFlag);
2602
+SQLITE_API sqlite3_int64 sqlite3_memory_used(void);
2603
+SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
26022604
26032605
/*
26042606
** CAPI3REF: Pseudo-Random Number Generator
26052607
**
26062608
** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
@@ -2619,11 +2621,11 @@
26192621
** ^If the previous call to this routine had an N of 1 or more and a
26202622
** non-NULL P then the pseudo-randomness is generated
26212623
** internally and without recourse to the [sqlite3_vfs] xRandomness
26222624
** method.
26232625
*/
2624
-SQLITE_API void SQLITE_STDCALL sqlite3_randomness(int N, void *P);
2626
+SQLITE_API void sqlite3_randomness(int N, void *P);
26252627
26262628
/*
26272629
** CAPI3REF: Compile-Time Authorization Callbacks
26282630
** METHOD: sqlite3
26292631
**
@@ -2702,11 +2704,11 @@
27022704
** [sqlite3_prepare()] or its variants. Authorization is not
27032705
** performed during statement evaluation in [sqlite3_step()], unless
27042706
** as stated in the previous paragraph, sqlite3_step() invokes
27052707
** sqlite3_prepare_v2() to reprepare a statement after a schema change.
27062708
*/
2707
-SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer(
2709
+SQLITE_API int sqlite3_set_authorizer(
27082710
sqlite3*,
27092711
int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
27102712
void *pUserData
27112713
);
27122714
@@ -2810,13 +2812,13 @@
28102812
** digits in the time are meaningless. Future versions of SQLite
28112813
** might provide greater resolution on the profiler callback. The
28122814
** sqlite3_profile() function is considered experimental and is
28132815
** subject to change in future versions of SQLite.
28142816
*/
2815
-SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_trace(sqlite3*,
2817
+SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*,
28162818
void(*xTrace)(void*,const char*), void*);
2817
-SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_profile(sqlite3*,
2819
+SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,
28182820
void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
28192821
28202822
/*
28212823
** CAPI3REF: SQL Trace Event Codes
28222824
** KEYWORDS: SQLITE_TRACE
@@ -2901,11 +2903,11 @@
29012903
**
29022904
** The sqlite3_trace_v2() interface is intended to replace the legacy
29032905
** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which
29042906
** are deprecated.
29052907
*/
2906
-SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2(
2908
+SQLITE_API int sqlite3_trace_v2(
29072909
sqlite3*,
29082910
unsigned uMask,
29092911
int(*xCallback)(unsigned,void*,void*,void*),
29102912
void *pCtx
29112913
);
@@ -2940,11 +2942,11 @@
29402942
** the database connection that invoked the progress handler.
29412943
** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
29422944
** database connections for the meaning of "modify" in this paragraph.
29432945
**
29442946
*/
2945
-SQLITE_API void SQLITE_STDCALL sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
2947
+SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
29462948
29472949
/*
29482950
** CAPI3REF: Opening A New Database Connection
29492951
** CONSTRUCTOR: sqlite3
29502952
**
@@ -3169,19 +3171,19 @@
31693171
** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various
31703172
** features that require the use of temporary files may fail.
31713173
**
31723174
** See also: [sqlite3_temp_directory]
31733175
*/
3174
-SQLITE_API int SQLITE_STDCALL sqlite3_open(
3176
+SQLITE_API int sqlite3_open(
31753177
const char *filename, /* Database filename (UTF-8) */
31763178
sqlite3 **ppDb /* OUT: SQLite db handle */
31773179
);
3178
-SQLITE_API int SQLITE_STDCALL sqlite3_open16(
3180
+SQLITE_API int sqlite3_open16(
31793181
const void *filename, /* Database filename (UTF-16) */
31803182
sqlite3 **ppDb /* OUT: SQLite db handle */
31813183
);
3182
-SQLITE_API int SQLITE_STDCALL sqlite3_open_v2(
3184
+SQLITE_API int sqlite3_open_v2(
31833185
const char *filename, /* Database filename (UTF-8) */
31843186
sqlite3 **ppDb, /* OUT: SQLite db handle */
31853187
int flags, /* Flags */
31863188
const char *zVfs /* Name of VFS module to use */
31873189
);
@@ -3223,13 +3225,13 @@
32233225
** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
32243226
** is not a database file pathname pointer that SQLite passed into the xOpen
32253227
** VFS method, then the behavior of this routine is undefined and probably
32263228
** undesirable.
32273229
*/
3228
-SQLITE_API const char *SQLITE_STDCALL sqlite3_uri_parameter(const char *zFilename, const char *zParam);
3229
-SQLITE_API int SQLITE_STDCALL sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
3230
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
3230
+SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
3231
+SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
3232
+SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
32313233
32323234
32333235
/*
32343236
** CAPI3REF: Error Codes And Messages
32353237
** METHOD: sqlite3
@@ -3269,15 +3271,15 @@
32693271
**
32703272
** If an interface fails with SQLITE_MISUSE, that means the interface
32713273
** was invoked incorrectly by the application. In that case, the
32723274
** error code and message may or may not be set.
32733275
*/
3274
-SQLITE_API int SQLITE_STDCALL sqlite3_errcode(sqlite3 *db);
3275
-SQLITE_API int SQLITE_STDCALL sqlite3_extended_errcode(sqlite3 *db);
3276
-SQLITE_API const char *SQLITE_STDCALL sqlite3_errmsg(sqlite3*);
3277
-SQLITE_API const void *SQLITE_STDCALL sqlite3_errmsg16(sqlite3*);
3278
-SQLITE_API const char *SQLITE_STDCALL sqlite3_errstr(int);
3276
+SQLITE_API int sqlite3_errcode(sqlite3 *db);
3277
+SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
3278
+SQLITE_API const char *sqlite3_errmsg(sqlite3*);
3279
+SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
3280
+SQLITE_API const char *sqlite3_errstr(int);
32793281
32803282
/*
32813283
** CAPI3REF: Prepared Statement Object
32823284
** KEYWORDS: {prepared statement} {prepared statements}
32833285
**
@@ -3341,11 +3343,11 @@
33413343
** created by an untrusted script can be contained using the
33423344
** [max_page_count] [PRAGMA].
33433345
**
33443346
** New run-time limit categories may be added in future releases.
33453347
*/
3346
-SQLITE_API int SQLITE_STDCALL sqlite3_limit(sqlite3*, int id, int newVal);
3348
+SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
33473349
33483350
/*
33493351
** CAPI3REF: Run-Time Limit Categories
33503352
** KEYWORDS: {limit category} {*limit categories}
33513353
**
@@ -3493,32 +3495,32 @@
34933495
** or [GLOB] operator or if the parameter is compared to an indexed column
34943496
** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
34953497
** </li>
34963498
** </ol>
34973499
*/
3498
-SQLITE_API int SQLITE_STDCALL sqlite3_prepare(
3500
+SQLITE_API int sqlite3_prepare(
34993501
sqlite3 *db, /* Database handle */
35003502
const char *zSql, /* SQL statement, UTF-8 encoded */
35013503
int nByte, /* Maximum length of zSql in bytes. */
35023504
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
35033505
const char **pzTail /* OUT: Pointer to unused portion of zSql */
35043506
);
3505
-SQLITE_API int SQLITE_STDCALL sqlite3_prepare_v2(
3507
+SQLITE_API int sqlite3_prepare_v2(
35063508
sqlite3 *db, /* Database handle */
35073509
const char *zSql, /* SQL statement, UTF-8 encoded */
35083510
int nByte, /* Maximum length of zSql in bytes. */
35093511
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
35103512
const char **pzTail /* OUT: Pointer to unused portion of zSql */
35113513
);
3512
-SQLITE_API int SQLITE_STDCALL sqlite3_prepare16(
3514
+SQLITE_API int sqlite3_prepare16(
35133515
sqlite3 *db, /* Database handle */
35143516
const void *zSql, /* SQL statement, UTF-16 encoded */
35153517
int nByte, /* Maximum length of zSql in bytes. */
35163518
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
35173519
const void **pzTail /* OUT: Pointer to unused portion of zSql */
35183520
);
3519
-SQLITE_API int SQLITE_STDCALL sqlite3_prepare16_v2(
3521
+SQLITE_API int sqlite3_prepare16_v2(
35203522
sqlite3 *db, /* Database handle */
35213523
const void *zSql, /* SQL statement, UTF-16 encoded */
35223524
int nByte, /* Maximum length of zSql in bytes. */
35233525
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
35243526
const void **pzTail /* OUT: Pointer to unused portion of zSql */
@@ -3553,12 +3555,12 @@
35533555
** automatically freed when the prepared statement is finalized.
35543556
** ^The string returned by sqlite3_expanded_sql(P), on the other hand,
35553557
** is obtained from [sqlite3_malloc()] and must be free by the application
35563558
** by passing it to [sqlite3_free()].
35573559
*/
3558
-SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt);
3559
-SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt);
3560
+SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
3561
+SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt);
35603562
35613563
/*
35623564
** CAPI3REF: Determine If An SQL Statement Writes The Database
35633565
** METHOD: sqlite3_stmt
35643566
**
@@ -3586,11 +3588,11 @@
35863588
** database. ^The [ATTACH] and [DETACH] statements also cause
35873589
** sqlite3_stmt_readonly() to return true since, while those statements
35883590
** change the configuration of a database connection, they do not make
35893591
** changes to the content of the database files on disk.
35903592
*/
3591
-SQLITE_API int SQLITE_STDCALL sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3593
+SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
35923594
35933595
/*
35943596
** CAPI3REF: Determine If A Prepared Statement Has Been Reset
35953597
** METHOD: sqlite3_stmt
35963598
**
@@ -3607,11 +3609,11 @@
36073609
** to locate all prepared statements associated with a database
36083610
** connection that are in need of being reset. This can be used,
36093611
** for example, in diagnostic routines to search for prepared
36103612
** statements that are holding a transaction open.
36113613
*/
3612
-SQLITE_API int SQLITE_STDCALL sqlite3_stmt_busy(sqlite3_stmt*);
3614
+SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
36133615
36143616
/*
36153617
** CAPI3REF: Dynamically Typed Value Object
36163618
** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
36173619
**
@@ -3771,24 +3773,24 @@
37713773
** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails.
37723774
**
37733775
** See also: [sqlite3_bind_parameter_count()],
37743776
** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
37753777
*/
3776
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
3777
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
3778
+SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
3779
+SQLITE_API int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
37783780
void(*)(void*));
3779
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_double(sqlite3_stmt*, int, double);
3780
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_int(sqlite3_stmt*, int, int);
3781
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
3782
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_null(sqlite3_stmt*, int);
3783
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
3784
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
3785
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
3781
+SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);
3782
+SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int);
3783
+SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
3784
+SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);
3785
+SQLITE_API int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
3786
+SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
3787
+SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
37863788
void(*)(void*), unsigned char encoding);
3787
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
3788
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
3789
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
3789
+SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
3790
+SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
3791
+SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
37903792
37913793
/*
37923794
** CAPI3REF: Number Of SQL Parameters
37933795
** METHOD: sqlite3_stmt
37943796
**
@@ -3805,11 +3807,11 @@
38053807
**
38063808
** See also: [sqlite3_bind_blob|sqlite3_bind()],
38073809
** [sqlite3_bind_parameter_name()], and
38083810
** [sqlite3_bind_parameter_index()].
38093811
*/
3810
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_count(sqlite3_stmt*);
3812
+SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);
38113813
38123814
/*
38133815
** CAPI3REF: Name Of A Host Parameter
38143816
** METHOD: sqlite3_stmt
38153817
**
@@ -3833,11 +3835,11 @@
38333835
**
38343836
** See also: [sqlite3_bind_blob|sqlite3_bind()],
38353837
** [sqlite3_bind_parameter_count()], and
38363838
** [sqlite3_bind_parameter_index()].
38373839
*/
3838
-SQLITE_API const char *SQLITE_STDCALL sqlite3_bind_parameter_name(sqlite3_stmt*, int);
3840
+SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
38393841
38403842
/*
38413843
** CAPI3REF: Index Of A Parameter With A Given Name
38423844
** METHOD: sqlite3_stmt
38433845
**
@@ -3850,21 +3852,21 @@
38503852
**
38513853
** See also: [sqlite3_bind_blob|sqlite3_bind()],
38523854
** [sqlite3_bind_parameter_count()], and
38533855
** [sqlite3_bind_parameter_name()].
38543856
*/
3855
-SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
3857
+SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
38563858
38573859
/*
38583860
** CAPI3REF: Reset All Bindings On A Prepared Statement
38593861
** METHOD: sqlite3_stmt
38603862
**
38613863
** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset
38623864
** the [sqlite3_bind_blob | bindings] on a [prepared statement].
38633865
** ^Use this routine to reset all host parameters to NULL.
38643866
*/
3865
-SQLITE_API int SQLITE_STDCALL sqlite3_clear_bindings(sqlite3_stmt*);
3867
+SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);
38663868
38673869
/*
38683870
** CAPI3REF: Number Of Columns In A Result Set
38693871
** METHOD: sqlite3_stmt
38703872
**
@@ -3872,11 +3874,11 @@
38723874
** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
38733875
** statement that does not return data (for example an [UPDATE]).
38743876
**
38753877
** See also: [sqlite3_data_count()]
38763878
*/
3877
-SQLITE_API int SQLITE_STDCALL sqlite3_column_count(sqlite3_stmt *pStmt);
3879
+SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
38783880
38793881
/*
38803882
** CAPI3REF: Column Names In A Result Set
38813883
** METHOD: sqlite3_stmt
38823884
**
@@ -3901,12 +3903,12 @@
39013903
** ^The name of a result column is the value of the "AS" clause for
39023904
** that column, if there is an AS clause. If there is no AS clause
39033905
** then the name of the column is unspecified and may change from
39043906
** one release of SQLite to the next.
39053907
*/
3906
-SQLITE_API const char *SQLITE_STDCALL sqlite3_column_name(sqlite3_stmt*, int N);
3907
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_name16(sqlite3_stmt*, int N);
3908
+SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);
3909
+SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
39083910
39093911
/*
39103912
** CAPI3REF: Source Of Data In A Query Result
39113913
** METHOD: sqlite3_stmt
39123914
**
@@ -3950,16 +3952,16 @@
39503952
** If two or more threads call one or more
39513953
** [sqlite3_column_database_name | column metadata interfaces]
39523954
** for the same [prepared statement] and result column
39533955
** at the same time then the results are undefined.
39543956
*/
3955
-SQLITE_API const char *SQLITE_STDCALL sqlite3_column_database_name(sqlite3_stmt*,int);
3956
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_database_name16(sqlite3_stmt*,int);
3957
-SQLITE_API const char *SQLITE_STDCALL sqlite3_column_table_name(sqlite3_stmt*,int);
3958
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_table_name16(sqlite3_stmt*,int);
3959
-SQLITE_API const char *SQLITE_STDCALL sqlite3_column_origin_name(sqlite3_stmt*,int);
3960
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_origin_name16(sqlite3_stmt*,int);
3957
+SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);
3958
+SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
3959
+SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int);
3960
+SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int);
3961
+SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int);
3962
+SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);
39613963
39623964
/*
39633965
** CAPI3REF: Declared Datatype Of A Query Result
39643966
** METHOD: sqlite3_stmt
39653967
**
@@ -3987,12 +3989,12 @@
39873989
** data stored in that column is of the declared type. SQLite is
39883990
** strongly typed, but the typing is dynamic not static. ^Type
39893991
** is associated with individual values, not with the containers
39903992
** used to hold those values.
39913993
*/
3992
-SQLITE_API const char *SQLITE_STDCALL sqlite3_column_decltype(sqlite3_stmt*,int);
3993
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_decltype16(sqlite3_stmt*,int);
3994
+SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int);
3995
+SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
39943996
39953997
/*
39963998
** CAPI3REF: Evaluate An SQL Statement
39973999
** METHOD: sqlite3_stmt
39984000
**
@@ -4049,11 +4051,12 @@
40494051
** For all versions of SQLite up to and including 3.6.23.1, a call to
40504052
** [sqlite3_reset()] was required after sqlite3_step() returned anything
40514053
** other than [SQLITE_ROW] before any subsequent invocation of
40524054
** sqlite3_step(). Failure to reset the prepared statement using
40534055
** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
4054
-** sqlite3_step(). But after version 3.6.23.1, sqlite3_step() began
4056
+** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
4057
+** sqlite3_step() began
40554058
** calling [sqlite3_reset()] automatically in this circumstance rather
40564059
** than returning [SQLITE_MISUSE]. This is not considered a compatibility
40574060
** break because any application that ever receives an SQLITE_MISUSE error
40584061
** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
40594062
** can be used to restore the legacy behavior.
@@ -4068,11 +4071,11 @@
40684071
** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
40694072
** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
40704073
** then the more specific [error codes] are returned directly
40714074
** by sqlite3_step(). The use of the "v2" interface is recommended.
40724075
*/
4073
-SQLITE_API int SQLITE_STDCALL sqlite3_step(sqlite3_stmt*);
4076
+SQLITE_API int sqlite3_step(sqlite3_stmt*);
40744077
40754078
/*
40764079
** CAPI3REF: Number of columns in a result set
40774080
** METHOD: sqlite3_stmt
40784081
**
@@ -4089,11 +4092,11 @@
40894092
** where it always returns zero since each step of that multi-step
40904093
** pragma returns 0 columns of data.
40914094
**
40924095
** See also: [sqlite3_column_count()]
40934096
*/
4094
-SQLITE_API int SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt);
4097
+SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
40954098
40964099
/*
40974100
** CAPI3REF: Fundamental Datatypes
40984101
** KEYWORDS: SQLITE_TEXT
40994102
**
@@ -4279,20 +4282,20 @@
42794282
** of these routines, a default value is returned. The default value
42804283
** is either the integer 0, the floating point number 0.0, or a NULL
42814284
** pointer. Subsequent calls to [sqlite3_errcode()] will return
42824285
** [SQLITE_NOMEM].)^
42834286
*/
4284
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_blob(sqlite3_stmt*, int iCol);
4285
-SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes(sqlite3_stmt*, int iCol);
4286
-SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
4287
-SQLITE_API double SQLITE_STDCALL sqlite3_column_double(sqlite3_stmt*, int iCol);
4288
-SQLITE_API int SQLITE_STDCALL sqlite3_column_int(sqlite3_stmt*, int iCol);
4289
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_column_int64(sqlite3_stmt*, int iCol);
4290
-SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_column_text(sqlite3_stmt*, int iCol);
4291
-SQLITE_API const void *SQLITE_STDCALL sqlite3_column_text16(sqlite3_stmt*, int iCol);
4292
-SQLITE_API int SQLITE_STDCALL sqlite3_column_type(sqlite3_stmt*, int iCol);
4293
-SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_column_value(sqlite3_stmt*, int iCol);
4287
+SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
4288
+SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
4289
+SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
4290
+SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
4291
+SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
4292
+SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
4293
+SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
4294
+SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
4295
+SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
4296
+SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
42944297
42954298
/*
42964299
** CAPI3REF: Destroy A Prepared Statement Object
42974300
** DESTRUCTOR: sqlite3_stmt
42984301
**
@@ -4316,11 +4319,11 @@
43164319
** resource leaks. It is a grievous error for the application to try to use
43174320
** a prepared statement after it has been finalized. Any use of a prepared
43184321
** statement after it has been finalized can result in undefined and
43194322
** undesirable behavior such as segfaults and heap corruption.
43204323
*/
4321
-SQLITE_API int SQLITE_STDCALL sqlite3_finalize(sqlite3_stmt *pStmt);
4324
+SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
43224325
43234326
/*
43244327
** CAPI3REF: Reset A Prepared Statement Object
43254328
** METHOD: sqlite3_stmt
43264329
**
@@ -4343,11 +4346,11 @@
43434346
** [sqlite3_reset(S)] returns an appropriate [error code].
43444347
**
43454348
** ^The [sqlite3_reset(S)] interface does not change the values
43464349
** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
43474350
*/
4348
-SQLITE_API int SQLITE_STDCALL sqlite3_reset(sqlite3_stmt *pStmt);
4351
+SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
43494352
43504353
/*
43514354
** CAPI3REF: Create Or Redefine SQL Functions
43524355
** KEYWORDS: {function creation routines}
43534356
** KEYWORDS: {application-defined SQL function}
@@ -4443,31 +4446,31 @@
44434446
** ^An application-defined function is permitted to call other
44444447
** SQLite interfaces. However, such calls must not
44454448
** close the database connection nor finalize or reset the prepared
44464449
** statement in which the function is running.
44474450
*/
4448
-SQLITE_API int SQLITE_STDCALL sqlite3_create_function(
4451
+SQLITE_API int sqlite3_create_function(
44494452
sqlite3 *db,
44504453
const char *zFunctionName,
44514454
int nArg,
44524455
int eTextRep,
44534456
void *pApp,
44544457
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
44554458
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
44564459
void (*xFinal)(sqlite3_context*)
44574460
);
4458
-SQLITE_API int SQLITE_STDCALL sqlite3_create_function16(
4461
+SQLITE_API int sqlite3_create_function16(
44594462
sqlite3 *db,
44604463
const void *zFunctionName,
44614464
int nArg,
44624465
int eTextRep,
44634466
void *pApp,
44644467
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
44654468
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
44664469
void (*xFinal)(sqlite3_context*)
44674470
);
4468
-SQLITE_API int SQLITE_STDCALL sqlite3_create_function_v2(
4471
+SQLITE_API int sqlite3_create_function_v2(
44694472
sqlite3 *db,
44704473
const char *zFunctionName,
44714474
int nArg,
44724475
int eTextRep,
44734476
void *pApp,
@@ -4509,16 +4512,16 @@
45094512
** to be supported. However, new applications should avoid
45104513
** the use of these functions. To encourage programmers to avoid
45114514
** these functions, we will not explain what they do.
45124515
*/
45134516
#ifndef SQLITE_OMIT_DEPRECATED
4514
-SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_aggregate_count(sqlite3_context*);
4515
-SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_expired(sqlite3_stmt*);
4516
-SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
4517
-SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_global_recover(void);
4518
-SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_thread_cleanup(void);
4519
-SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
4517
+SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);
4518
+SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);
4519
+SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
4520
+SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);
4521
+SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
4522
+SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
45204523
void*,sqlite3_int64);
45214524
#endif
45224525
45234526
/*
45244527
** CAPI3REF: Obtaining SQL Values
@@ -4564,22 +4567,22 @@
45644567
** or [sqlite3_value_text16()].
45654568
**
45664569
** These routines must be called from the same thread as
45674570
** the SQL function that supplied the [sqlite3_value*] parameters.
45684571
*/
4569
-SQLITE_API const void *SQLITE_STDCALL sqlite3_value_blob(sqlite3_value*);
4570
-SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes(sqlite3_value*);
4571
-SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes16(sqlite3_value*);
4572
-SQLITE_API double SQLITE_STDCALL sqlite3_value_double(sqlite3_value*);
4573
-SQLITE_API int SQLITE_STDCALL sqlite3_value_int(sqlite3_value*);
4574
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_value_int64(sqlite3_value*);
4575
-SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_value_text(sqlite3_value*);
4576
-SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16(sqlite3_value*);
4577
-SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16le(sqlite3_value*);
4578
-SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16be(sqlite3_value*);
4579
-SQLITE_API int SQLITE_STDCALL sqlite3_value_type(sqlite3_value*);
4580
-SQLITE_API int SQLITE_STDCALL sqlite3_value_numeric_type(sqlite3_value*);
4572
+SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
4573
+SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
4574
+SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
4575
+SQLITE_API double sqlite3_value_double(sqlite3_value*);
4576
+SQLITE_API int sqlite3_value_int(sqlite3_value*);
4577
+SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
4578
+SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
4579
+SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
4580
+SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
4581
+SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
4582
+SQLITE_API int sqlite3_value_type(sqlite3_value*);
4583
+SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
45814584
45824585
/*
45834586
** CAPI3REF: Finding The Subtype Of SQL Values
45844587
** METHOD: sqlite3_value
45854588
**
@@ -4591,11 +4594,11 @@
45914594
**
45924595
** SQLite makes no use of subtype itself. It merely passes the subtype
45934596
** from the result of one [application-defined SQL function] into the
45944597
** input of another.
45954598
*/
4596
-SQLITE_API unsigned int SQLITE_STDCALL sqlite3_value_subtype(sqlite3_value*);
4599
+SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
45974600
45984601
/*
45994602
** CAPI3REF: Copy And Free SQL Values
46004603
** METHOD: sqlite3_value
46014604
**
@@ -4607,12 +4610,12 @@
46074610
**
46084611
** ^The sqlite3_value_free(V) interface frees an [sqlite3_value] object
46094612
** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
46104613
** then sqlite3_value_free(V) is a harmless no-op.
46114614
*/
4612
-SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_value_dup(const sqlite3_value*);
4613
-SQLITE_API void SQLITE_STDCALL sqlite3_value_free(sqlite3_value*);
4615
+SQLITE_API sqlite3_value *sqlite3_value_dup(const sqlite3_value*);
4616
+SQLITE_API void sqlite3_value_free(sqlite3_value*);
46144617
46154618
/*
46164619
** CAPI3REF: Obtain Aggregate Function Context
46174620
** METHOD: sqlite3_context
46184621
**
@@ -4653,11 +4656,11 @@
46534656
** function.
46544657
**
46554658
** This routine must be called from the same thread in which
46564659
** the aggregate SQL function is running.
46574660
*/
4658
-SQLITE_API void *SQLITE_STDCALL sqlite3_aggregate_context(sqlite3_context*, int nBytes);
4661
+SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
46594662
46604663
/*
46614664
** CAPI3REF: User Data For Functions
46624665
** METHOD: sqlite3_context
46634666
**
@@ -4668,11 +4671,11 @@
46684671
** registered the application defined function.
46694672
**
46704673
** This routine must be called from the same thread in which
46714674
** the application-defined function is running.
46724675
*/
4673
-SQLITE_API void *SQLITE_STDCALL sqlite3_user_data(sqlite3_context*);
4676
+SQLITE_API void *sqlite3_user_data(sqlite3_context*);
46744677
46754678
/*
46764679
** CAPI3REF: Database Connection For Functions
46774680
** METHOD: sqlite3_context
46784681
**
@@ -4680,11 +4683,11 @@
46804683
** the pointer to the [database connection] (the 1st parameter)
46814684
** of the [sqlite3_create_function()]
46824685
** and [sqlite3_create_function16()] routines that originally
46834686
** registered the application defined function.
46844687
*/
4685
-SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_context*);
4688
+SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
46864689
46874690
/*
46884691
** CAPI3REF: Function Auxiliary Data
46894692
** METHOD: sqlite3_context
46904693
**
@@ -4734,12 +4737,12 @@
47344737
** values and [parameters] and expressions composed from the same.)^
47354738
**
47364739
** These routines must be called from the same thread in which
47374740
** the SQL function is running.
47384741
*/
4739
-SQLITE_API void *SQLITE_STDCALL sqlite3_get_auxdata(sqlite3_context*, int N);
4740
-SQLITE_API void SQLITE_STDCALL sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
4742
+SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);
4743
+SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
47414744
47424745
47434746
/*
47444747
** CAPI3REF: Constants Defining Special Destructor Behavior
47454748
**
@@ -4871,31 +4874,31 @@
48714874
**
48724875
** If these routines are called from within the different thread
48734876
** than the one containing the application-defined function that received
48744877
** the [sqlite3_context] pointer, the results are undefined.
48754878
*/
4876
-SQLITE_API void SQLITE_STDCALL sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
4877
-SQLITE_API void SQLITE_STDCALL sqlite3_result_blob64(sqlite3_context*,const void*,
4879
+SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
4880
+SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,
48784881
sqlite3_uint64,void(*)(void*));
4879
-SQLITE_API void SQLITE_STDCALL sqlite3_result_double(sqlite3_context*, double);
4880
-SQLITE_API void SQLITE_STDCALL sqlite3_result_error(sqlite3_context*, const char*, int);
4881
-SQLITE_API void SQLITE_STDCALL sqlite3_result_error16(sqlite3_context*, const void*, int);
4882
-SQLITE_API void SQLITE_STDCALL sqlite3_result_error_toobig(sqlite3_context*);
4883
-SQLITE_API void SQLITE_STDCALL sqlite3_result_error_nomem(sqlite3_context*);
4884
-SQLITE_API void SQLITE_STDCALL sqlite3_result_error_code(sqlite3_context*, int);
4885
-SQLITE_API void SQLITE_STDCALL sqlite3_result_int(sqlite3_context*, int);
4886
-SQLITE_API void SQLITE_STDCALL sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
4887
-SQLITE_API void SQLITE_STDCALL sqlite3_result_null(sqlite3_context*);
4888
-SQLITE_API void SQLITE_STDCALL sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
4889
-SQLITE_API void SQLITE_STDCALL sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
4882
+SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
4883
+SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
4884
+SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
4885
+SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
4886
+SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
4887
+SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int);
4888
+SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
4889
+SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
4890
+SQLITE_API void sqlite3_result_null(sqlite3_context*);
4891
+SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
4892
+SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
48904893
void(*)(void*), unsigned char encoding);
4891
-SQLITE_API void SQLITE_STDCALL sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
4892
-SQLITE_API void SQLITE_STDCALL sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
4893
-SQLITE_API void SQLITE_STDCALL sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
4894
-SQLITE_API void SQLITE_STDCALL sqlite3_result_value(sqlite3_context*, sqlite3_value*);
4895
-SQLITE_API void SQLITE_STDCALL sqlite3_result_zeroblob(sqlite3_context*, int n);
4896
-SQLITE_API int SQLITE_STDCALL sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
4894
+SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
4895
+SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
4896
+SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
4897
+SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
4898
+SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
4899
+SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
48974900
48984901
48994902
/*
49004903
** CAPI3REF: Setting The Subtype Of An SQL Function
49014904
** METHOD: sqlite3_context
@@ -4906,11 +4909,11 @@
49064909
** of the subtype T are preserved in current versions of SQLite;
49074910
** higher order bits are discarded.
49084911
** The number of subtype bytes preserved by SQLite might increase
49094912
** in future releases of SQLite.
49104913
*/
4911
-SQLITE_API void SQLITE_STDCALL sqlite3_result_subtype(sqlite3_context*,unsigned int);
4914
+SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int);
49124915
49134916
/*
49144917
** CAPI3REF: Define New Collating Sequences
49154918
** METHOD: sqlite3
49164919
**
@@ -4988,26 +4991,26 @@
49884991
** is unfortunate but cannot be changed without breaking backwards
49894992
** compatibility.
49904993
**
49914994
** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
49924995
*/
4993
-SQLITE_API int SQLITE_STDCALL sqlite3_create_collation(
4996
+SQLITE_API int sqlite3_create_collation(
49944997
sqlite3*,
49954998
const char *zName,
49964999
int eTextRep,
49975000
void *pArg,
49985001
int(*xCompare)(void*,int,const void*,int,const void*)
49995002
);
5000
-SQLITE_API int SQLITE_STDCALL sqlite3_create_collation_v2(
5003
+SQLITE_API int sqlite3_create_collation_v2(
50015004
sqlite3*,
50025005
const char *zName,
50035006
int eTextRep,
50045007
void *pArg,
50055008
int(*xCompare)(void*,int,const void*,int,const void*),
50065009
void(*xDestroy)(void*)
50075010
);
5008
-SQLITE_API int SQLITE_STDCALL sqlite3_create_collation16(
5011
+SQLITE_API int sqlite3_create_collation16(
50095012
sqlite3*,
50105013
const void *zName,
50115014
int eTextRep,
50125015
void *pArg,
50135016
int(*xCompare)(void*,int,const void*,int,const void*)
@@ -5038,16 +5041,16 @@
50385041
**
50395042
** The callback function should register the desired collation using
50405043
** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
50415044
** [sqlite3_create_collation_v2()].
50425045
*/
5043
-SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed(
5046
+SQLITE_API int sqlite3_collation_needed(
50445047
sqlite3*,
50455048
void*,
50465049
void(*)(void*,sqlite3*,int eTextRep,const char*)
50475050
);
5048
-SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed16(
5051
+SQLITE_API int sqlite3_collation_needed16(
50495052
sqlite3*,
50505053
void*,
50515054
void(*)(void*,sqlite3*,int eTextRep,const void*)
50525055
);
50535056
@@ -5057,15 +5060,15 @@
50575060
** called right after sqlite3_open().
50585061
**
50595062
** The code to implement this API is not available in the public release
50605063
** of SQLite.
50615064
*/
5062
-SQLITE_API int SQLITE_STDCALL sqlite3_key(
5065
+SQLITE_API int sqlite3_key(
50635066
sqlite3 *db, /* Database to be rekeyed */
50645067
const void *pKey, int nKey /* The key */
50655068
);
5066
-SQLITE_API int SQLITE_STDCALL sqlite3_key_v2(
5069
+SQLITE_API int sqlite3_key_v2(
50675070
sqlite3 *db, /* Database to be rekeyed */
50685071
const char *zDbName, /* Name of the database */
50695072
const void *pKey, int nKey /* The key */
50705073
);
50715074
@@ -5075,35 +5078,35 @@
50755078
** database is decrypted.
50765079
**
50775080
** The code to implement this API is not available in the public release
50785081
** of SQLite.
50795082
*/
5080
-SQLITE_API int SQLITE_STDCALL sqlite3_rekey(
5083
+SQLITE_API int sqlite3_rekey(
50815084
sqlite3 *db, /* Database to be rekeyed */
50825085
const void *pKey, int nKey /* The new key */
50835086
);
5084
-SQLITE_API int SQLITE_STDCALL sqlite3_rekey_v2(
5087
+SQLITE_API int sqlite3_rekey_v2(
50855088
sqlite3 *db, /* Database to be rekeyed */
50865089
const char *zDbName, /* Name of the database */
50875090
const void *pKey, int nKey /* The new key */
50885091
);
50895092
50905093
/*
50915094
** Specify the activation key for a SEE database. Unless
50925095
** activated, none of the SEE routines will work.
50935096
*/
5094
-SQLITE_API void SQLITE_STDCALL sqlite3_activate_see(
5097
+SQLITE_API void sqlite3_activate_see(
50955098
const char *zPassPhrase /* Activation phrase */
50965099
);
50975100
#endif
50985101
50995102
#ifdef SQLITE_ENABLE_CEROD
51005103
/*
51015104
** Specify the activation key for a CEROD database. Unless
51025105
** activated, none of the CEROD routines will work.
51035106
*/
5104
-SQLITE_API void SQLITE_STDCALL sqlite3_activate_cerod(
5107
+SQLITE_API void sqlite3_activate_cerod(
51055108
const char *zPassPhrase /* Activation phrase */
51065109
);
51075110
#endif
51085111
51095112
/*
@@ -5121,11 +5124,11 @@
51215124
** method of the default [sqlite3_vfs] object. If the xSleep() method
51225125
** of the default VFS is not implemented correctly, or not implemented at
51235126
** all, then the behavior of sqlite3_sleep() may deviate from the description
51245127
** in the previous paragraphs.
51255128
*/
5126
-SQLITE_API int SQLITE_STDCALL sqlite3_sleep(int);
5129
+SQLITE_API int sqlite3_sleep(int);
51275130
51285131
/*
51295132
** CAPI3REF: Name Of The Folder Holding Temporary Files
51305133
**
51315134
** ^(If this global variable is made to point to a string which is
@@ -5240,11 +5243,11 @@
52405243
**
52415244
** If another thread changes the autocommit status of the database
52425245
** connection while this routine is running, then the return value
52435246
** is undefined.
52445247
*/
5245
-SQLITE_API int SQLITE_STDCALL sqlite3_get_autocommit(sqlite3*);
5248
+SQLITE_API int sqlite3_get_autocommit(sqlite3*);
52465249
52475250
/*
52485251
** CAPI3REF: Find The Database Handle Of A Prepared Statement
52495252
** METHOD: sqlite3_stmt
52505253
**
@@ -5253,11 +5256,11 @@
52535256
** returned by sqlite3_db_handle is the same [database connection]
52545257
** that was the first argument
52555258
** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
52565259
** create the statement in the first place.
52575260
*/
5258
-SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_db_handle(sqlite3_stmt*);
5261
+SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
52595262
52605263
/*
52615264
** CAPI3REF: Return The Filename For A Database Connection
52625265
** METHOD: sqlite3
52635266
**
@@ -5270,21 +5273,21 @@
52705273
** ^The filename returned by this function is the output of the
52715274
** xFullPathname method of the [VFS]. ^In other words, the filename
52725275
** will be an absolute pathname, even if the filename used
52735276
** to open the database originally was a URI or relative pathname.
52745277
*/
5275
-SQLITE_API const char *SQLITE_STDCALL sqlite3_db_filename(sqlite3 *db, const char *zDbName);
5278
+SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);
52765279
52775280
/*
52785281
** CAPI3REF: Determine if a database is read-only
52795282
** METHOD: sqlite3
52805283
**
52815284
** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N
52825285
** of connection D is read-only, 0 if it is read/write, or -1 if N is not
52835286
** the name of a database on connection D.
52845287
*/
5285
-SQLITE_API int SQLITE_STDCALL sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
5288
+SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
52865289
52875290
/*
52885291
** CAPI3REF: Find the next prepared statement
52895292
** METHOD: sqlite3
52905293
**
@@ -5296,11 +5299,11 @@
52965299
**
52975300
** The [database connection] pointer D in a call to
52985301
** [sqlite3_next_stmt(D,S)] must refer to an open database
52995302
** connection and in particular must not be a NULL pointer.
53005303
*/
5301
-SQLITE_API sqlite3_stmt *SQLITE_STDCALL sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
5304
+SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
53025305
53035306
/*
53045307
** CAPI3REF: Commit And Rollback Notification Callbacks
53055308
** METHOD: sqlite3
53065309
**
@@ -5345,12 +5348,12 @@
53455348
** ^The rollback callback is not invoked if a transaction is
53465349
** automatically rolled back because the database connection is closed.
53475350
**
53485351
** See also the [sqlite3_update_hook()] interface.
53495352
*/
5350
-SQLITE_API void *SQLITE_STDCALL sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
5351
-SQLITE_API void *SQLITE_STDCALL sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
5353
+SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
5354
+SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
53525355
53535356
/*
53545357
** CAPI3REF: Data Change Notification Callbacks
53555358
** METHOD: sqlite3
53565359
**
@@ -5397,11 +5400,11 @@
53975400
** the first call on D.
53985401
**
53995402
** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()],
54005403
** and [sqlite3_preupdate_hook()] interfaces.
54015404
*/
5402
-SQLITE_API void *SQLITE_STDCALL sqlite3_update_hook(
5405
+SQLITE_API void *sqlite3_update_hook(
54035406
sqlite3*,
54045407
void(*)(void *,int ,char const *,char const *,sqlite3_int64),
54055408
void*
54065409
);
54075410
@@ -5412,11 +5415,12 @@
54125415
** and schema data structures between [database connection | connections]
54135416
** to the same database. Sharing is enabled if the argument is true
54145417
** and disabled if the argument is false.)^
54155418
**
54165419
** ^Cache sharing is enabled and disabled for an entire process.
5417
-** This is a change as of SQLite version 3.5.0. In prior versions of SQLite,
5420
+** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]).
5421
+** In prior versions of SQLite,
54185422
** sharing was enabled or disabled for each thread separately.
54195423
**
54205424
** ^(The cache sharing mode set by this interface effects all subsequent
54215425
** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
54225426
** Existing database connections continue use the sharing mode
@@ -5437,11 +5441,11 @@
54375441
** This interface is threadsafe on processors where writing a
54385442
** 32-bit integer is atomic.
54395443
**
54405444
** See Also: [SQLite Shared-Cache Mode]
54415445
*/
5442
-SQLITE_API int SQLITE_STDCALL sqlite3_enable_shared_cache(int);
5446
+SQLITE_API int sqlite3_enable_shared_cache(int);
54435447
54445448
/*
54455449
** CAPI3REF: Attempt To Free Heap Memory
54465450
**
54475451
** ^The sqlite3_release_memory() interface attempts to free N bytes
@@ -5453,11 +5457,11 @@
54535457
** ^The sqlite3_release_memory() routine is a no-op returning zero
54545458
** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT].
54555459
**
54565460
** See also: [sqlite3_db_release_memory()]
54575461
*/
5458
-SQLITE_API int SQLITE_STDCALL sqlite3_release_memory(int);
5462
+SQLITE_API int sqlite3_release_memory(int);
54595463
54605464
/*
54615465
** CAPI3REF: Free Memory Used By A Database Connection
54625466
** METHOD: sqlite3
54635467
**
@@ -5467,11 +5471,11 @@
54675471
** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is
54685472
** omitted.
54695473
**
54705474
** See also: [sqlite3_release_memory()]
54715475
*/
5472
-SQLITE_API int SQLITE_STDCALL sqlite3_db_release_memory(sqlite3*);
5476
+SQLITE_API int sqlite3_db_release_memory(sqlite3*);
54735477
54745478
/*
54755479
** CAPI3REF: Impose A Limit On Heap Size
54765480
**
54775481
** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
@@ -5506,11 +5510,12 @@
55065510
** <li> The page cache allocates from its own memory pool supplied
55075511
** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
55085512
** from the heap.
55095513
** </ul>)^
55105514
**
5511
-** Beginning with SQLite version 3.7.3, the soft heap limit is enforced
5515
+** Beginning with SQLite [version 3.7.3] ([dateof:3.7.3]),
5516
+** the soft heap limit is enforced
55125517
** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT]
55135518
** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT],
55145519
** the soft heap limit is enforced on every memory allocation. Without
55155520
** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced
55165521
** when memory is allocated by the page cache. Testing suggests that because
@@ -5519,11 +5524,11 @@
55195524
** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT].
55205525
**
55215526
** The circumstances under which SQLite will enforce the soft heap limit may
55225527
** changes in future releases of SQLite.
55235528
*/
5524
-SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_soft_heap_limit64(sqlite3_int64 N);
5529
+SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
55255530
55265531
/*
55275532
** CAPI3REF: Deprecated Soft Heap Limit Interface
55285533
** DEPRECATED
55295534
**
@@ -5530,11 +5535,11 @@
55305535
** This is a deprecated version of the [sqlite3_soft_heap_limit64()]
55315536
** interface. This routine is provided for historical compatibility
55325537
** only. All new applications should use the
55335538
** [sqlite3_soft_heap_limit64()] interface rather than this one.
55345539
*/
5535
-SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_soft_heap_limit(int N);
5540
+SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
55365541
55375542
55385543
/*
55395544
** CAPI3REF: Extract Metadata About A Column Of A Table
55405545
** METHOD: sqlite3
@@ -5600,11 +5605,11 @@
56005605
**
56015606
** ^This function causes all database schemas to be read from disk and
56025607
** parsed, if that has not already been done, and returns an error if
56035608
** any errors are encountered while loading the schema.
56045609
*/
5605
-SQLITE_API int SQLITE_STDCALL sqlite3_table_column_metadata(
5610
+SQLITE_API int sqlite3_table_column_metadata(
56065611
sqlite3 *db, /* Connection handle */
56075612
const char *zDbName, /* Database name or NULL */
56085613
const char *zTableName, /* Table name */
56095614
const char *zColumnName, /* Column name */
56105615
char const **pzDataType, /* OUTPUT: Declared data type */
@@ -5656,11 +5661,11 @@
56565661
** disabled and prevent SQL injections from giving attackers
56575662
** access to extension loading capabilities.
56585663
**
56595664
** See also the [load_extension() SQL function].
56605665
*/
5661
-SQLITE_API int SQLITE_STDCALL sqlite3_load_extension(
5666
+SQLITE_API int sqlite3_load_extension(
56625667
sqlite3 *db, /* Load the extension into this database connection */
56635668
const char *zFile, /* Name of the shared library containing extension */
56645669
const char *zProc, /* Entry point. Derived from zFile if 0 */
56655670
char **pzErrMsg /* Put error message here if not 0 */
56665671
);
@@ -5688,11 +5693,11 @@
56885693
** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method
56895694
** rather than this interface, so the [load_extension()] SQL function
56905695
** remains disabled. This will prevent SQL injections from giving attackers
56915696
** access to extension loading capabilities.
56925697
*/
5693
-SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int onoff);
5698
+SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
56945699
56955700
/*
56965701
** CAPI3REF: Automatically Load Statically Linked Extensions
56975702
**
56985703
** ^This interface causes the xEntryPoint() function to be invoked for
@@ -5726,11 +5731,11 @@
57265731
** will be called more than once for each database connection that is opened.
57275732
**
57285733
** See also: [sqlite3_reset_auto_extension()]
57295734
** and [sqlite3_cancel_auto_extension()]
57305735
*/
5731
-SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void(*xEntryPoint)(void));
5736
+SQLITE_API int sqlite3_auto_extension(void(*xEntryPoint)(void));
57325737
57335738
/*
57345739
** CAPI3REF: Cancel Automatic Extension Loading
57355740
**
57365741
** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
@@ -5738,19 +5743,19 @@
57385743
** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)]
57395744
** routine returns 1 if initialization routine X was successfully
57405745
** unregistered and it returns 0 if X was not on the list of initialization
57415746
** routines.
57425747
*/
5743
-SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
5748
+SQLITE_API int sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
57445749
57455750
/*
57465751
** CAPI3REF: Reset Automatic Extension Loading
57475752
**
57485753
** ^This interface disables all automatic extensions previously
57495754
** registered using [sqlite3_auto_extension()].
57505755
*/
5751
-SQLITE_API void SQLITE_STDCALL sqlite3_reset_auto_extension(void);
5756
+SQLITE_API void sqlite3_reset_auto_extension(void);
57525757
57535758
/*
57545759
** The interface to the virtual-table mechanism is currently considered
57555760
** to be experimental. The interface might change in incompatible ways.
57565761
** If this is a problem for you, do not use the interface at this time.
@@ -5900,17 +5905,19 @@
59005905
** before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
59015906
** set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
59025907
** the xUpdate method are automatically rolled back by SQLite.
59035908
**
59045909
** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
5905
-** structure for SQLite version 3.8.2. If a virtual table extension is
5910
+** structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
5911
+** If a virtual table extension is
59065912
** used with an SQLite version earlier than 3.8.2, the results of attempting
59075913
** to read or write the estimatedRows field are undefined (but are likely
59085914
** to included crashing the application). The estimatedRows field should
59095915
** therefore only be used if [sqlite3_libversion_number()] returns a
59105916
** value greater than or equal to 3008002. Similarly, the idxFlags field
5911
-** was added for version 3.9.0. It may therefore only be used if
5917
+** was added for [version 3.9.0] ([dateof:3.9.0]).
5918
+** It may therefore only be used if
59125919
** sqlite3_libversion_number() returns a value greater than or equal to
59135920
** 3009000.
59145921
*/
59155922
struct sqlite3_index_info {
59165923
/* Inputs */
@@ -5991,17 +5998,17 @@
59915998
** be invoked if the call to sqlite3_create_module_v2() fails.
59925999
** ^The sqlite3_create_module()
59936000
** interface is equivalent to sqlite3_create_module_v2() with a NULL
59946001
** destructor.
59956002
*/
5996
-SQLITE_API int SQLITE_STDCALL sqlite3_create_module(
6003
+SQLITE_API int sqlite3_create_module(
59976004
sqlite3 *db, /* SQLite connection to register module with */
59986005
const char *zName, /* Name of the module */
59996006
const sqlite3_module *p, /* Methods for the module */
60006007
void *pClientData /* Client data for xCreate/xConnect */
60016008
);
6002
-SQLITE_API int SQLITE_STDCALL sqlite3_create_module_v2(
6009
+SQLITE_API int sqlite3_create_module_v2(
60036010
sqlite3 *db, /* SQLite connection to register module with */
60046011
const char *zName, /* Name of the module */
60056012
const sqlite3_module *p, /* Methods for the module */
60066013
void *pClientData, /* Client data for xCreate/xConnect */
60076014
void(*xDestroy)(void*) /* Module destructor function */
@@ -6060,11 +6067,11 @@
60606067
** ^The [xCreate] and [xConnect] methods of a
60616068
** [virtual table module] call this interface
60626069
** to declare the format (the names and datatypes of the columns) of
60636070
** the virtual tables they implement.
60646071
*/
6065
-SQLITE_API int SQLITE_STDCALL sqlite3_declare_vtab(sqlite3*, const char *zSQL);
6072
+SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
60666073
60676074
/*
60686075
** CAPI3REF: Overload A Function For A Virtual Table
60696076
** METHOD: sqlite3
60706077
**
@@ -6079,11 +6086,11 @@
60796086
** of the new function always causes an exception to be thrown. So
60806087
** the new function is not good for anything by itself. Its only
60816088
** purpose is to be a placeholder function that can be overloaded
60826089
** by a [virtual table].
60836090
*/
6084
-SQLITE_API int SQLITE_STDCALL sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
6091
+SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
60856092
60866093
/*
60876094
** The interface to the virtual-table mechanism defined above (back up
60886095
** to a comment remarkably similar to this one) is currently considered
60896096
** to be experimental. The interface might change in incompatible ways.
@@ -6178,11 +6185,11 @@
61786185
** zero-filled blob to read or write using the incremental-blob interface.
61796186
**
61806187
** To avoid a resource leak, every open [BLOB handle] should eventually
61816188
** be released by a call to [sqlite3_blob_close()].
61826189
*/
6183
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_open(
6190
+SQLITE_API int sqlite3_blob_open(
61846191
sqlite3*,
61856192
const char *zDb,
61866193
const char *zTable,
61876194
const char *zColumn,
61886195
sqlite3_int64 iRow,
@@ -6211,11 +6218,11 @@
62116218
** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle
62126219
** always returns zero.
62136220
**
62146221
** ^This function sets the database handle error code and message.
62156222
*/
6216
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
6223
+SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
62176224
62186225
/*
62196226
** CAPI3REF: Close A BLOB Handle
62206227
** DESTRUCTOR: sqlite3_blob
62216228
**
@@ -6234,11 +6241,11 @@
62346241
** with a null pointer (such as would be returned by a failed call to
62356242
** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
62366243
** is passed a valid open blob handle, the values returned by the
62376244
** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
62386245
*/
6239
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_close(sqlite3_blob *);
6246
+SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
62406247
62416248
/*
62426249
** CAPI3REF: Return The Size Of An Open BLOB
62436250
** METHOD: sqlite3_blob
62446251
**
@@ -6250,11 +6257,11 @@
62506257
** This routine only works on a [BLOB handle] which has been created
62516258
** by a prior successful call to [sqlite3_blob_open()] and which has not
62526259
** been closed by [sqlite3_blob_close()]. Passing any other pointer in
62536260
** to this routine results in undefined and probably undesirable behavior.
62546261
*/
6255
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_bytes(sqlite3_blob *);
6262
+SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);
62566263
62576264
/*
62586265
** CAPI3REF: Read Data From A BLOB Incrementally
62596266
** METHOD: sqlite3_blob
62606267
**
@@ -6279,11 +6286,11 @@
62796286
** been closed by [sqlite3_blob_close()]. Passing any other pointer in
62806287
** to this routine results in undefined and probably undesirable behavior.
62816288
**
62826289
** See also: [sqlite3_blob_write()].
62836290
*/
6284
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
6291
+SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
62856292
62866293
/*
62876294
** CAPI3REF: Write Data Into A BLOB Incrementally
62886295
** METHOD: sqlite3_blob
62896296
**
@@ -6321,11 +6328,11 @@
63216328
** been closed by [sqlite3_blob_close()]. Passing any other pointer in
63226329
** to this routine results in undefined and probably undesirable behavior.
63236330
**
63246331
** See also: [sqlite3_blob_read()].
63256332
*/
6326
-SQLITE_API int SQLITE_STDCALL sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
6333
+SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
63276334
63286335
/*
63296336
** CAPI3REF: Virtual File System Objects
63306337
**
63316338
** A virtual filesystem (VFS) is an [sqlite3_vfs] object
@@ -6352,13 +6359,13 @@
63526359
**
63536360
** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.
63546361
** ^(If the default VFS is unregistered, another VFS is chosen as
63556362
** the default. The choice for the new VFS is arbitrary.)^
63566363
*/
6357
-SQLITE_API sqlite3_vfs *SQLITE_STDCALL sqlite3_vfs_find(const char *zVfsName);
6358
-SQLITE_API int SQLITE_STDCALL sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
6359
-SQLITE_API int SQLITE_STDCALL sqlite3_vfs_unregister(sqlite3_vfs*);
6364
+SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
6365
+SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
6366
+SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
63606367
63616368
/*
63626369
** CAPI3REF: Mutexes
63636370
**
63646371
** The SQLite core uses these routines for thread
@@ -6470,15 +6477,15 @@
64706477
** sqlite3_mutex_leave() is a NULL pointer, then all three routines
64716478
** behave as no-ops.
64726479
**
64736480
** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
64746481
*/
6475
-SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_mutex_alloc(int);
6476
-SQLITE_API void SQLITE_STDCALL sqlite3_mutex_free(sqlite3_mutex*);
6477
-SQLITE_API void SQLITE_STDCALL sqlite3_mutex_enter(sqlite3_mutex*);
6478
-SQLITE_API int SQLITE_STDCALL sqlite3_mutex_try(sqlite3_mutex*);
6479
-SQLITE_API void SQLITE_STDCALL sqlite3_mutex_leave(sqlite3_mutex*);
6482
+SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
6483
+SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
6484
+SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*);
6485
+SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*);
6486
+SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
64806487
64816488
/*
64826489
** CAPI3REF: Mutex Methods Object
64836490
**
64846491
** An instance of this structure defines the low-level routines
@@ -6584,12 +6591,12 @@
65846591
** call to sqlite3_mutex_held() to fail, so a non-zero return is
65856592
** the appropriate thing to do. The sqlite3_mutex_notheld()
65866593
** interface should also return 1 when given a NULL pointer.
65876594
*/
65886595
#ifndef NDEBUG
6589
-SQLITE_API int SQLITE_STDCALL sqlite3_mutex_held(sqlite3_mutex*);
6590
-SQLITE_API int SQLITE_STDCALL sqlite3_mutex_notheld(sqlite3_mutex*);
6596
+SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
6597
+SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
65916598
#endif
65926599
65936600
/*
65946601
** CAPI3REF: Mutex Types
65956602
**
@@ -6604,11 +6611,11 @@
66046611
#define SQLITE_MUTEX_RECURSIVE 1
66056612
#define SQLITE_MUTEX_STATIC_MASTER 2
66066613
#define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */
66076614
#define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */
66086615
#define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */
6609
-#define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */
6616
+#define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_randomness() */
66106617
#define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
66116618
#define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */
66126619
#define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */
66136620
#define SQLITE_MUTEX_STATIC_APP1 8 /* For use by application */
66146621
#define SQLITE_MUTEX_STATIC_APP2 9 /* For use by application */
@@ -6625,11 +6632,11 @@
66256632
** serializes access to the [database connection] given in the argument
66266633
** when the [threading mode] is Serialized.
66276634
** ^If the [threading mode] is Single-thread or Multi-thread then this
66286635
** routine returns a NULL pointer.
66296636
*/
6630
-SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_db_mutex(sqlite3*);
6637
+SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
66316638
66326639
/*
66336640
** CAPI3REF: Low-Level Control Of Database Files
66346641
** METHOD: sqlite3
66356642
**
@@ -6660,11 +6667,11 @@
66606667
** an incorrect zDbName and an SQLITE_ERROR return from the underlying
66616668
** xFileControl method.
66626669
**
66636670
** See also: [SQLITE_FCNTL_LOCKSTATE]
66646671
*/
6665
-SQLITE_API int SQLITE_STDCALL sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
6672
+SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
66666673
66676674
/*
66686675
** CAPI3REF: Testing Interface
66696676
**
66706677
** ^The sqlite3_test_control() interface is used to read out internal
@@ -6679,11 +6686,11 @@
66796686
** The details of the operation codes, their meanings, the parameters
66806687
** they take, and what they do are all subject to change without notice.
66816688
** Unlike most of the SQLite API, this function is not guaranteed to
66826689
** operate consistently from one release to the next.
66836690
*/
6684
-SQLITE_API int SQLITE_CDECL sqlite3_test_control(int op, ...);
6691
+SQLITE_API int sqlite3_test_control(int op, ...);
66856692
66866693
/*
66876694
** CAPI3REF: Testing Interface Operation Codes
66886695
**
66896696
** These constants are the valid operation code parameters used
@@ -6708,10 +6715,11 @@
67086715
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
67096716
#define SQLITE_TESTCTRL_ISKEYWORD 16
67106717
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17
67116718
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
67126719
#define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
6720
+#define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
67136721
#define SQLITE_TESTCTRL_NEVER_CORRUPT 20
67146722
#define SQLITE_TESTCTRL_VDBE_COVERAGE 21
67156723
#define SQLITE_TESTCTRL_BYTEORDER 22
67166724
#define SQLITE_TESTCTRL_ISINIT 23
67176725
#define SQLITE_TESTCTRL_SORTER_MMAP 24
@@ -6742,12 +6750,12 @@
67426750
** be represented by a 32-bit integer, then the values returned by
67436751
** sqlite3_status() are undefined.
67446752
**
67456753
** See also: [sqlite3_db_status()]
67466754
*/
6747
-SQLITE_API int SQLITE_STDCALL sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
6748
-SQLITE_API int SQLITE_STDCALL sqlite3_status64(
6755
+SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
6756
+SQLITE_API int sqlite3_status64(
67496757
int op,
67506758
sqlite3_int64 *pCurrent,
67516759
sqlite3_int64 *pHighwater,
67526760
int resetFlag
67536761
);
@@ -6868,11 +6876,11 @@
68686876
** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
68696877
** non-zero [error code] on failure.
68706878
**
68716879
** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
68726880
*/
6873
-SQLITE_API int SQLITE_STDCALL sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
6881
+SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
68746882
68756883
/*
68766884
** CAPI3REF: Status Parameters for database connections
68776885
** KEYWORDS: {SQLITE_DBSTATUS options}
68786886
**
@@ -7011,11 +7019,11 @@
70117019
** ^If the resetFlg is true, then the counter is reset to zero after this
70127020
** interface call returns.
70137021
**
70147022
** See also: [sqlite3_status()] and [sqlite3_db_status()].
70157023
*/
7016
-SQLITE_API int SQLITE_STDCALL sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
7024
+SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
70177025
70187026
/*
70197027
** CAPI3REF: Status Parameters for prepared statements
70207028
** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters}
70217029
**
@@ -7480,20 +7488,20 @@
74807488
** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()
74817489
** APIs are not strictly speaking threadsafe. If they are invoked at the
74827490
** same time as another thread is invoking sqlite3_backup_step() it is
74837491
** possible that they return invalid values.
74847492
*/
7485
-SQLITE_API sqlite3_backup *SQLITE_STDCALL sqlite3_backup_init(
7493
+SQLITE_API sqlite3_backup *sqlite3_backup_init(
74867494
sqlite3 *pDest, /* Destination database handle */
74877495
const char *zDestName, /* Destination database name */
74887496
sqlite3 *pSource, /* Source database handle */
74897497
const char *zSourceName /* Source database name */
74907498
);
7491
-SQLITE_API int SQLITE_STDCALL sqlite3_backup_step(sqlite3_backup *p, int nPage);
7492
-SQLITE_API int SQLITE_STDCALL sqlite3_backup_finish(sqlite3_backup *p);
7493
-SQLITE_API int SQLITE_STDCALL sqlite3_backup_remaining(sqlite3_backup *p);
7494
-SQLITE_API int SQLITE_STDCALL sqlite3_backup_pagecount(sqlite3_backup *p);
7499
+SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage);
7500
+SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p);
7501
+SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p);
7502
+SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
74957503
74967504
/*
74977505
** CAPI3REF: Unlock Notification
74987506
** METHOD: sqlite3
74997507
**
@@ -7606,11 +7614,11 @@
76067614
** by an sqlite3_step() call. ^(If there is a blocking connection, then the
76077615
** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in
76087616
** the special "DROP TABLE/INDEX" case, the extended error code is just
76097617
** SQLITE_LOCKED.)^
76107618
*/
7611
-SQLITE_API int SQLITE_STDCALL sqlite3_unlock_notify(
7619
+SQLITE_API int sqlite3_unlock_notify(
76127620
sqlite3 *pBlocked, /* Waiting connection */
76137621
void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */
76147622
void *pNotifyArg /* Argument to pass to xNotify */
76157623
);
76167624
@@ -7621,12 +7629,12 @@
76217629
** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications
76227630
** and extensions to compare the contents of two buffers containing UTF-8
76237631
** strings in a case-independent fashion, using the same definition of "case
76247632
** independence" that SQLite uses internally when comparing identifiers.
76257633
*/
7626
-SQLITE_API int SQLITE_STDCALL sqlite3_stricmp(const char *, const char *);
7627
-SQLITE_API int SQLITE_STDCALL sqlite3_strnicmp(const char *, const char *, int);
7634
+SQLITE_API int sqlite3_stricmp(const char *, const char *);
7635
+SQLITE_API int sqlite3_strnicmp(const char *, const char *, int);
76287636
76297637
/*
76307638
** CAPI3REF: String Globbing
76317639
*
76327640
** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if
@@ -7639,11 +7647,11 @@
76397647
** Note that this routine returns zero on a match and non-zero if the strings
76407648
** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
76417649
**
76427650
** See also: [sqlite3_strlike()].
76437651
*/
7644
-SQLITE_API int SQLITE_STDCALL sqlite3_strglob(const char *zGlob, const char *zStr);
7652
+SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr);
76457653
76467654
/*
76477655
** CAPI3REF: String LIKE Matching
76487656
*
76497657
** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if
@@ -7662,11 +7670,11 @@
76627670
** Note that this routine returns zero on a match and non-zero if the strings
76637671
** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
76647672
**
76657673
** See also: [sqlite3_strglob()].
76667674
*/
7667
-SQLITE_API int SQLITE_STDCALL sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc);
7675
+SQLITE_API int sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc);
76687676
76697677
/*
76707678
** CAPI3REF: Error Logging Interface
76717679
**
76727680
** ^The [sqlite3_log()] interface writes a message into the [error log]
@@ -7685,11 +7693,11 @@
76857693
** will not use dynamically allocated memory. The log message is stored in
76867694
** a fixed-length buffer on the stack. If the log message is longer than
76877695
** a few hundred characters, it will be truncated to the length of the
76887696
** buffer.
76897697
*/
7690
-SQLITE_API void SQLITE_CDECL sqlite3_log(int iErrCode, const char *zFormat, ...);
7698
+SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
76917699
76927700
/*
76937701
** CAPI3REF: Write-Ahead Log Commit Hook
76947702
** METHOD: sqlite3
76957703
**
@@ -7721,11 +7729,11 @@
77217729
** previously registered write-ahead log callback. ^Note that the
77227730
** [sqlite3_wal_autocheckpoint()] interface and the
77237731
** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
77247732
** overwrite any prior [sqlite3_wal_hook()] settings.
77257733
*/
7726
-SQLITE_API void *SQLITE_STDCALL sqlite3_wal_hook(
7734
+SQLITE_API void *sqlite3_wal_hook(
77277735
sqlite3*,
77287736
int(*)(void *,sqlite3*,const char*,int),
77297737
void*
77307738
);
77317739
@@ -7756,11 +7764,11 @@
77567764
** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
77577765
** pages. The use of this interface
77587766
** is only necessary if the default setting is found to be suboptimal
77597767
** for a particular application.
77607768
*/
7761
-SQLITE_API int SQLITE_STDCALL sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
7769
+SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
77627770
77637771
/*
77647772
** CAPI3REF: Checkpoint a database
77657773
** METHOD: sqlite3
77667774
**
@@ -7778,11 +7786,11 @@
77787786
** interface was added. This interface is retained for backwards
77797787
** compatibility and as a convenience for applications that need to manually
77807788
** start a callback but which do not need the full power (and corresponding
77817789
** complication) of [sqlite3_wal_checkpoint_v2()].
77827790
*/
7783
-SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
7791
+SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
77847792
77857793
/*
77867794
** CAPI3REF: Checkpoint a database
77877795
** METHOD: sqlite3
77887796
**
@@ -7872,11 +7880,11 @@
78727880
** [sqlite3_errcode()] and [sqlite3_errmsg()].
78737881
**
78747882
** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
78757883
** from SQL.
78767884
*/
7877
-SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint_v2(
7885
+SQLITE_API int sqlite3_wal_checkpoint_v2(
78787886
sqlite3 *db, /* Database handle */
78797887
const char *zDb, /* Name of attached database (or NULL) */
78807888
int eMode, /* SQLITE_CHECKPOINT_* value */
78817889
int *pnLog, /* OUT: Size of WAL log in frames */
78827890
int *pnCkpt /* OUT: Total number of frames checkpointed */
@@ -7908,11 +7916,11 @@
79087916
**
79097917
** At present, there is only one option that may be configured using
79107918
** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].) Further options
79117919
** may be added in the future.
79127920
*/
7913
-SQLITE_API int SQLITE_CDECL sqlite3_vtab_config(sqlite3*, int op, ...);
7921
+SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
79147922
79157923
/*
79167924
** CAPI3REF: Virtual Table Configuration Options
79177925
**
79187926
** These macros define the various options to the
@@ -7961,11 +7969,11 @@
79617969
** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],
79627970
** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode
79637971
** of the SQL statement that triggered the call to the [xUpdate] method of the
79647972
** [virtual table].
79657973
*/
7966
-SQLITE_API int SQLITE_STDCALL sqlite3_vtab_on_conflict(sqlite3 *);
7974
+SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);
79677975
79687976
/*
79697977
** CAPI3REF: Conflict resolution modes
79707978
** KEYWORDS: {conflict resolution mode}
79717979
**
@@ -8066,11 +8074,11 @@
80668074
** as if the loop did not exist - it returns non-zero and leave the variable
80678075
** that pOut points to unchanged.
80688076
**
80698077
** See also: [sqlite3_stmt_scanstatus_reset()]
80708078
*/
8071
-SQLITE_API int SQLITE_STDCALL sqlite3_stmt_scanstatus(
8079
+SQLITE_API int sqlite3_stmt_scanstatus(
80728080
sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
80738081
int idx, /* Index of loop to report on */
80748082
int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
80758083
void *pOut /* Result written here */
80768084
);
@@ -8082,11 +8090,11 @@
80828090
** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.
80838091
**
80848092
** This API is only available if the library is built with pre-processor
80858093
** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
80868094
*/
8087
-SQLITE_API void SQLITE_STDCALL sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
8095
+SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
80888096
80898097
/*
80908098
** CAPI3REF: Flush caches to disk mid-transaction
80918099
**
80928100
** ^If a write-transaction is open on [database connection] D when the
@@ -8114,11 +8122,11 @@
81148122
** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK.
81158123
**
81168124
** ^This function does not set the database handle error code or message
81178125
** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.
81188126
*/
8119
-SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*);
8127
+SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
81208128
81218129
/*
81228130
** CAPI3REF: The pre-update hook.
81238131
**
81248132
** ^These interfaces are only available if SQLite is compiled using the
@@ -8194,11 +8202,11 @@
81948202
** triggers; or 2 for changes resulting from triggers called by top-level
81958203
** triggers; and so forth.
81968204
**
81978205
** See also: [sqlite3_update_hook()]
81988206
*/
8199
-SQLITE_API SQLITE_EXPERIMENTAL void *SQLITE_STDCALL sqlite3_preupdate_hook(
8207
+SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_preupdate_hook(
82008208
sqlite3 *db,
82018209
void(*xPreUpdate)(
82028210
void *pCtx, /* Copy of third arg to preupdate_hook() */
82038211
sqlite3 *db, /* Database handle */
82048212
int op, /* SQLITE_UPDATE, DELETE or INSERT */
@@ -8207,14 +8215,14 @@
82078215
sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */
82088216
sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */
82098217
),
82108218
void*
82118219
);
8212
-SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);
8213
-SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_count(sqlite3 *);
8214
-SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_depth(sqlite3 *);
8215
-SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
8220
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);
8221
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_count(sqlite3 *);
8222
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_depth(sqlite3 *);
8223
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
82168224
82178225
/*
82188226
** CAPI3REF: Low-level system error code
82198227
**
82208228
** ^Attempt to return the underlying operating system error code or error
@@ -8222,11 +8230,11 @@
82228230
** The return value is OS-dependent. For example, on unix systems, after
82238231
** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be
82248232
** called to get back the underlying "errno" that caused the problem, such
82258233
** as ENOSPC, EAUTH, EISDIR, and so forth.
82268234
*/
8227
-SQLITE_API int SQLITE_STDCALL sqlite3_system_errno(sqlite3*);
8235
+SQLITE_API int sqlite3_system_errno(sqlite3*);
82288236
82298237
/*
82308238
** CAPI3REF: Database Snapshot
82318239
** KEYWORDS: {snapshot}
82328240
** EXPERIMENTAL
@@ -8272,11 +8280,11 @@
82728280
** to avoid a memory leak.
82738281
**
82748282
** The [sqlite3_snapshot_get()] interface is only available when the
82758283
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
82768284
*/
8277
-SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_get(
8285
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
82788286
sqlite3 *db,
82798287
const char *zSchema,
82808288
sqlite3_snapshot **ppSnapshot
82818289
);
82828290
@@ -8310,11 +8318,11 @@
83108318
** database connection in order to make it ready to use snapshots.)
83118319
**
83128320
** The [sqlite3_snapshot_open()] interface is only available when the
83138321
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
83148322
*/
8315
-SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_open(
8323
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(
83168324
sqlite3 *db,
83178325
const char *zSchema,
83188326
sqlite3_snapshot *pSnapshot
83198327
);
83208328
@@ -8327,11 +8335,11 @@
83278335
** using this routine to avoid a memory leak.
83288336
**
83298337
** The [sqlite3_snapshot_free()] interface is only available when the
83308338
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
83318339
*/
8332
-SQLITE_API SQLITE_EXPERIMENTAL void SQLITE_STDCALL sqlite3_snapshot_free(sqlite3_snapshot*);
8340
+SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);
83338341
83348342
/*
83358343
** CAPI3REF: Compare the ages of two snapshot handles.
83368344
** EXPERIMENTAL
83378345
**
@@ -8351,11 +8359,11 @@
83518359
**
83528360
** Otherwise, this API returns a negative value if P1 refers to an older
83538361
** snapshot than P2, zero if the two handles refer to the same database
83548362
** snapshot, and a positive value if P1 is a newer snapshot than P2.
83558363
*/
8356
-SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_cmp(
8364
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(
83578365
sqlite3_snapshot *p1,
83588366
sqlite3_snapshot *p2
83598367
);
83608368
83618369
/*
@@ -8409,11 +8417,11 @@
84098417
** Register a geometry callback named zGeom that can be used as part of an
84108418
** R-Tree geometry query as follows:
84118419
**
84128420
** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
84138421
*/
8414
-SQLITE_API int SQLITE_STDCALL sqlite3_rtree_geometry_callback(
8422
+SQLITE_API int sqlite3_rtree_geometry_callback(
84158423
sqlite3 *db,
84168424
const char *zGeom,
84178425
int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),
84188426
void *pContext
84198427
);
@@ -8435,11 +8443,11 @@
84358443
** Register a 2nd-generation geometry callback named zScore that can be
84368444
** used as part of an R-Tree geometry query as follows:
84378445
**
84388446
** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
84398447
*/
8440
-SQLITE_API int SQLITE_STDCALL sqlite3_rtree_query_callback(
8448
+SQLITE_API int sqlite3_rtree_query_callback(
84418449
sqlite3 *db,
84428450
const char *zQueryFunc,
84438451
int (*xQueryFunc)(sqlite3_rtree_query_info*),
84448452
void *pContext,
84458453
void (*xDestructor)(void*)
84468454
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -106,11 +106,12 @@
106 ** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
107 ** be larger than the release from which it is derived. Either Y will
108 ** be held constant and Z will be incremented or else Y will be incremented
109 ** and Z will be reset to zero.
110 **
111 ** Since version 3.6.18, SQLite source code has been stored in the
 
112 ** <a href="http://www.fossil-scm.org/">Fossil configuration management
113 ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
114 ** a string which identifies a particular check-in of SQLite
115 ** within its configuration management system. ^The SQLITE_SOURCE_ID
116 ** string contains the date and time of the check-in (UTC) and an SHA1
@@ -120,11 +121,11 @@
120 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
121 ** [sqlite_version()] and [sqlite_source_id()].
122 */
123 #define SQLITE_VERSION "3.15.0"
124 #define SQLITE_VERSION_NUMBER 3015000
125 #define SQLITE_SOURCE_ID "2016-09-10 19:51:40 711c59171b22df04224183a713e6c36e0bb3bba8"
126
127 /*
128 ** CAPI3REF: Run-Time Library Version Numbers
129 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
130 **
@@ -153,13 +154,13 @@
153 ** [SQLITE_SOURCE_ID] C preprocessor macro.
154 **
155 ** See also: [sqlite_version()] and [sqlite_source_id()].
156 */
157 SQLITE_API SQLITE_EXTERN const char sqlite3_version[];
158 SQLITE_API const char *SQLITE_STDCALL sqlite3_libversion(void);
159 SQLITE_API const char *SQLITE_STDCALL sqlite3_sourceid(void);
160 SQLITE_API int SQLITE_STDCALL sqlite3_libversion_number(void);
161
162 /*
163 ** CAPI3REF: Run-Time Library Compilation Options Diagnostics
164 **
165 ** ^The sqlite3_compileoption_used() function returns 0 or 1
@@ -180,12 +181,12 @@
180 **
181 ** See also: SQL functions [sqlite_compileoption_used()] and
182 ** [sqlite_compileoption_get()] and the [compile_options pragma].
183 */
184 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
185 SQLITE_API int SQLITE_STDCALL sqlite3_compileoption_used(const char *zOptName);
186 SQLITE_API const char *SQLITE_STDCALL sqlite3_compileoption_get(int N);
187 #endif
188
189 /*
190 ** CAPI3REF: Test To See If The Library Is Threadsafe
191 **
@@ -220,11 +221,11 @@
220 ** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
221 ** is unchanged by calls to sqlite3_config().)^
222 **
223 ** See the [threading mode] documentation for additional information.
224 */
225 SQLITE_API int SQLITE_STDCALL sqlite3_threadsafe(void);
226
227 /*
228 ** CAPI3REF: Database Connection Handle
229 ** KEYWORDS: {database connection} {database connections}
230 **
@@ -317,12 +318,12 @@
317 ** from [sqlite3_open()], [sqlite3_open16()], or
318 ** [sqlite3_open_v2()], and not previously closed.
319 ** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer
320 ** argument is a harmless no-op.
321 */
322 SQLITE_API int SQLITE_STDCALL sqlite3_close(sqlite3*);
323 SQLITE_API int SQLITE_STDCALL sqlite3_close_v2(sqlite3*);
324
325 /*
326 ** The type for a callback function.
327 ** This is legacy and deprecated. It is included for historical
328 ** compatibility and is not documented.
@@ -389,11 +390,11 @@
389 ** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
390 ** <li> The application must not modify the SQL statement text passed into
391 ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
392 ** </ul>
393 */
394 SQLITE_API int SQLITE_STDCALL sqlite3_exec(
395 sqlite3*, /* An open database */
396 const char *sql, /* SQL to be evaluated */
397 int (*callback)(void*,int,char**,char**), /* Callback function */
398 void *, /* 1st argument to callback */
399 char **errmsg /* Error msg written here */
@@ -450,11 +451,12 @@
450 **
451 ** In its default configuration, SQLite API routines return one of 30 integer
452 ** [result codes]. However, experience has shown that many of
453 ** these result codes are too coarse-grained. They do not provide as
454 ** much information about problems as programmers might like. In an effort to
455 ** address this, newer versions of SQLite (version 3.3.8 and later) include
 
456 ** support for additional result codes that provide more detailed information
457 ** about errors. These [extended result codes] are enabled or disabled
458 ** on a per database connection basis using the
459 ** [sqlite3_extended_result_codes()] API. Or, the extended code for
460 ** the most recent error can be obtained using
@@ -1388,14 +1390,14 @@
1388 ** sqlite3_os_init() and sqlite3_os_end(). An application-supplied
1389 ** implementation of sqlite3_os_init() or sqlite3_os_end()
1390 ** must return [SQLITE_OK] on success and some other [error code] upon
1391 ** failure.
1392 */
1393 SQLITE_API int SQLITE_STDCALL sqlite3_initialize(void);
1394 SQLITE_API int SQLITE_STDCALL sqlite3_shutdown(void);
1395 SQLITE_API int SQLITE_STDCALL sqlite3_os_init(void);
1396 SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void);
1397
1398 /*
1399 ** CAPI3REF: Configuring The SQLite Library
1400 **
1401 ** The sqlite3_config() interface is used to make global configuration
@@ -1424,11 +1426,11 @@
1424 **
1425 ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
1426 ** ^If the option is unknown or SQLite is unable to set the option
1427 ** then this routine returns a non-zero [error code].
1428 */
1429 SQLITE_API int SQLITE_CDECL sqlite3_config(int, ...);
1430
1431 /*
1432 ** CAPI3REF: Configure database connections
1433 ** METHOD: sqlite3
1434 **
@@ -1443,11 +1445,11 @@
1443 ** Subsequent arguments vary depending on the configuration verb.
1444 **
1445 ** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
1446 ** the call is considered successful.
1447 */
1448 SQLITE_API int SQLITE_CDECL sqlite3_db_config(sqlite3*, int op, ...);
1449
1450 /*
1451 ** CAPI3REF: Memory Allocation Routines
1452 **
1453 ** An instance of this object defines the interface between SQLite
@@ -1994,11 +1996,11 @@
1994 **
1995 ** ^The sqlite3_extended_result_codes() routine enables or disables the
1996 ** [extended result codes] feature of SQLite. ^The extended result
1997 ** codes are disabled by default for historical compatibility.
1998 */
1999 SQLITE_API int SQLITE_STDCALL sqlite3_extended_result_codes(sqlite3*, int onoff);
2000
2001 /*
2002 ** CAPI3REF: Last Insert Rowid
2003 ** METHOD: sqlite3
2004 **
@@ -2046,11 +2048,11 @@
2046 ** function is running and thus changes the last insert [rowid],
2047 ** then the value returned by [sqlite3_last_insert_rowid()] is
2048 ** unpredictable and might not equal either the old or the new
2049 ** last insert [rowid].
2050 */
2051 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_last_insert_rowid(sqlite3*);
2052
2053 /*
2054 ** CAPI3REF: Count The Number Of Rows Modified
2055 ** METHOD: sqlite3
2056 **
@@ -2099,11 +2101,11 @@
2099 **
2100 ** If a separate thread makes changes on the same database connection
2101 ** while [sqlite3_changes()] is running then the value returned
2102 ** is unpredictable and not meaningful.
2103 */
2104 SQLITE_API int SQLITE_STDCALL sqlite3_changes(sqlite3*);
2105
2106 /*
2107 ** CAPI3REF: Total Number Of Rows Modified
2108 ** METHOD: sqlite3
2109 **
@@ -2123,11 +2125,11 @@
2123 **
2124 ** If a separate thread makes changes on the same database connection
2125 ** while [sqlite3_total_changes()] is running then the value
2126 ** returned is unpredictable and not meaningful.
2127 */
2128 SQLITE_API int SQLITE_STDCALL sqlite3_total_changes(sqlite3*);
2129
2130 /*
2131 ** CAPI3REF: Interrupt A Long-Running Query
2132 ** METHOD: sqlite3
2133 **
@@ -2163,11 +2165,11 @@
2163 ** that are started after the sqlite3_interrupt() call returns.
2164 **
2165 ** If the database connection closes while [sqlite3_interrupt()]
2166 ** is running then bad things will likely happen.
2167 */
2168 SQLITE_API void SQLITE_STDCALL sqlite3_interrupt(sqlite3*);
2169
2170 /*
2171 ** CAPI3REF: Determine If An SQL Statement Is Complete
2172 **
2173 ** These routines are useful during command-line input to determine if the
@@ -2198,12 +2200,12 @@
2198 ** UTF-8 string.
2199 **
2200 ** The input to [sqlite3_complete16()] must be a zero-terminated
2201 ** UTF-16 string in native byte order.
2202 */
2203 SQLITE_API int SQLITE_STDCALL sqlite3_complete(const char *sql);
2204 SQLITE_API int SQLITE_STDCALL sqlite3_complete16(const void *sql);
2205
2206 /*
2207 ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
2208 ** KEYWORDS: {busy-handler callback} {busy handler}
2209 ** METHOD: sqlite3
@@ -2260,11 +2262,11 @@
2260 ** result in undefined behavior.
2261 **
2262 ** A busy handler must not close the database connection
2263 ** or [prepared statement] that invoked the busy handler.
2264 */
2265 SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
2266
2267 /*
2268 ** CAPI3REF: Set A Busy Timeout
2269 ** METHOD: sqlite3
2270 **
@@ -2283,11 +2285,11 @@
2283 ** was defined (using [sqlite3_busy_handler()]) prior to calling
2284 ** this routine, that other busy handler is cleared.)^
2285 **
2286 ** See also: [PRAGMA busy_timeout]
2287 */
2288 SQLITE_API int SQLITE_STDCALL sqlite3_busy_timeout(sqlite3*, int ms);
2289
2290 /*
2291 ** CAPI3REF: Convenience Routines For Running Queries
2292 ** METHOD: sqlite3
2293 **
@@ -2358,19 +2360,19 @@
2358 ** interface defined here. As a consequence, errors that occur in the
2359 ** wrapper layer outside of the internal [sqlite3_exec()] call are not
2360 ** reflected in subsequent calls to [sqlite3_errcode()] or
2361 ** [sqlite3_errmsg()].
2362 */
2363 SQLITE_API int SQLITE_STDCALL sqlite3_get_table(
2364 sqlite3 *db, /* An open database */
2365 const char *zSql, /* SQL to be evaluated */
2366 char ***pazResult, /* Results of the query */
2367 int *pnRow, /* Number of result rows written here */
2368 int *pnColumn, /* Number of result columns written here */
2369 char **pzErrmsg /* Error msg written here */
2370 );
2371 SQLITE_API void SQLITE_STDCALL sqlite3_free_table(char **result);
2372
2373 /*
2374 ** CAPI3REF: Formatted String Printing Functions
2375 **
2376 ** These routines are work-alikes of the "printf()" family of functions
@@ -2472,14 +2474,14 @@
2472 **
2473 ** ^(The "%z" formatting option works like "%s" but with the
2474 ** addition that after the string has been read and copied into
2475 ** the result, [sqlite3_free()] is called on the input string.)^
2476 */
2477 SQLITE_API char *SQLITE_CDECL sqlite3_mprintf(const char*,...);
2478 SQLITE_API char *SQLITE_STDCALL sqlite3_vmprintf(const char*, va_list);
2479 SQLITE_API char *SQLITE_CDECL sqlite3_snprintf(int,char*,const char*, ...);
2480 SQLITE_API char *SQLITE_STDCALL sqlite3_vsnprintf(int,char*,const char*, va_list);
2481
2482 /*
2483 ** CAPI3REF: Memory Allocation Subsystem
2484 **
2485 ** The SQLite core uses these three routines for all of its own
@@ -2565,16 +2567,16 @@
2565 **
2566 ** The application must not read or write any part of
2567 ** a block of memory after it has been released using
2568 ** [sqlite3_free()] or [sqlite3_realloc()].
2569 */
2570 SQLITE_API void *SQLITE_STDCALL sqlite3_malloc(int);
2571 SQLITE_API void *SQLITE_STDCALL sqlite3_malloc64(sqlite3_uint64);
2572 SQLITE_API void *SQLITE_STDCALL sqlite3_realloc(void*, int);
2573 SQLITE_API void *SQLITE_STDCALL sqlite3_realloc64(void*, sqlite3_uint64);
2574 SQLITE_API void SQLITE_STDCALL sqlite3_free(void*);
2575 SQLITE_API sqlite3_uint64 SQLITE_STDCALL sqlite3_msize(void*);
2576
2577 /*
2578 ** CAPI3REF: Memory Allocator Statistics
2579 **
2580 ** SQLite provides these two interfaces for reporting on the status
@@ -2595,12 +2597,12 @@
2595 ** [sqlite3_memory_used()] if and only if the parameter to
2596 ** [sqlite3_memory_highwater()] is true. ^The value returned
2597 ** by [sqlite3_memory_highwater(1)] is the high-water mark
2598 ** prior to the reset.
2599 */
2600 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_used(void);
2601 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_highwater(int resetFlag);
2602
2603 /*
2604 ** CAPI3REF: Pseudo-Random Number Generator
2605 **
2606 ** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
@@ -2619,11 +2621,11 @@
2619 ** ^If the previous call to this routine had an N of 1 or more and a
2620 ** non-NULL P then the pseudo-randomness is generated
2621 ** internally and without recourse to the [sqlite3_vfs] xRandomness
2622 ** method.
2623 */
2624 SQLITE_API void SQLITE_STDCALL sqlite3_randomness(int N, void *P);
2625
2626 /*
2627 ** CAPI3REF: Compile-Time Authorization Callbacks
2628 ** METHOD: sqlite3
2629 **
@@ -2702,11 +2704,11 @@
2702 ** [sqlite3_prepare()] or its variants. Authorization is not
2703 ** performed during statement evaluation in [sqlite3_step()], unless
2704 ** as stated in the previous paragraph, sqlite3_step() invokes
2705 ** sqlite3_prepare_v2() to reprepare a statement after a schema change.
2706 */
2707 SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer(
2708 sqlite3*,
2709 int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
2710 void *pUserData
2711 );
2712
@@ -2810,13 +2812,13 @@
2810 ** digits in the time are meaningless. Future versions of SQLite
2811 ** might provide greater resolution on the profiler callback. The
2812 ** sqlite3_profile() function is considered experimental and is
2813 ** subject to change in future versions of SQLite.
2814 */
2815 SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_trace(sqlite3*,
2816 void(*xTrace)(void*,const char*), void*);
2817 SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_profile(sqlite3*,
2818 void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
2819
2820 /*
2821 ** CAPI3REF: SQL Trace Event Codes
2822 ** KEYWORDS: SQLITE_TRACE
@@ -2901,11 +2903,11 @@
2901 **
2902 ** The sqlite3_trace_v2() interface is intended to replace the legacy
2903 ** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which
2904 ** are deprecated.
2905 */
2906 SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2(
2907 sqlite3*,
2908 unsigned uMask,
2909 int(*xCallback)(unsigned,void*,void*,void*),
2910 void *pCtx
2911 );
@@ -2940,11 +2942,11 @@
2940 ** the database connection that invoked the progress handler.
2941 ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
2942 ** database connections for the meaning of "modify" in this paragraph.
2943 **
2944 */
2945 SQLITE_API void SQLITE_STDCALL sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
2946
2947 /*
2948 ** CAPI3REF: Opening A New Database Connection
2949 ** CONSTRUCTOR: sqlite3
2950 **
@@ -3169,19 +3171,19 @@
3169 ** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various
3170 ** features that require the use of temporary files may fail.
3171 **
3172 ** See also: [sqlite3_temp_directory]
3173 */
3174 SQLITE_API int SQLITE_STDCALL sqlite3_open(
3175 const char *filename, /* Database filename (UTF-8) */
3176 sqlite3 **ppDb /* OUT: SQLite db handle */
3177 );
3178 SQLITE_API int SQLITE_STDCALL sqlite3_open16(
3179 const void *filename, /* Database filename (UTF-16) */
3180 sqlite3 **ppDb /* OUT: SQLite db handle */
3181 );
3182 SQLITE_API int SQLITE_STDCALL sqlite3_open_v2(
3183 const char *filename, /* Database filename (UTF-8) */
3184 sqlite3 **ppDb, /* OUT: SQLite db handle */
3185 int flags, /* Flags */
3186 const char *zVfs /* Name of VFS module to use */
3187 );
@@ -3223,13 +3225,13 @@
3223 ** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
3224 ** is not a database file pathname pointer that SQLite passed into the xOpen
3225 ** VFS method, then the behavior of this routine is undefined and probably
3226 ** undesirable.
3227 */
3228 SQLITE_API const char *SQLITE_STDCALL sqlite3_uri_parameter(const char *zFilename, const char *zParam);
3229 SQLITE_API int SQLITE_STDCALL sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
3230 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
3231
3232
3233 /*
3234 ** CAPI3REF: Error Codes And Messages
3235 ** METHOD: sqlite3
@@ -3269,15 +3271,15 @@
3269 **
3270 ** If an interface fails with SQLITE_MISUSE, that means the interface
3271 ** was invoked incorrectly by the application. In that case, the
3272 ** error code and message may or may not be set.
3273 */
3274 SQLITE_API int SQLITE_STDCALL sqlite3_errcode(sqlite3 *db);
3275 SQLITE_API int SQLITE_STDCALL sqlite3_extended_errcode(sqlite3 *db);
3276 SQLITE_API const char *SQLITE_STDCALL sqlite3_errmsg(sqlite3*);
3277 SQLITE_API const void *SQLITE_STDCALL sqlite3_errmsg16(sqlite3*);
3278 SQLITE_API const char *SQLITE_STDCALL sqlite3_errstr(int);
3279
3280 /*
3281 ** CAPI3REF: Prepared Statement Object
3282 ** KEYWORDS: {prepared statement} {prepared statements}
3283 **
@@ -3341,11 +3343,11 @@
3341 ** created by an untrusted script can be contained using the
3342 ** [max_page_count] [PRAGMA].
3343 **
3344 ** New run-time limit categories may be added in future releases.
3345 */
3346 SQLITE_API int SQLITE_STDCALL sqlite3_limit(sqlite3*, int id, int newVal);
3347
3348 /*
3349 ** CAPI3REF: Run-Time Limit Categories
3350 ** KEYWORDS: {limit category} {*limit categories}
3351 **
@@ -3493,32 +3495,32 @@
3493 ** or [GLOB] operator or if the parameter is compared to an indexed column
3494 ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
3495 ** </li>
3496 ** </ol>
3497 */
3498 SQLITE_API int SQLITE_STDCALL sqlite3_prepare(
3499 sqlite3 *db, /* Database handle */
3500 const char *zSql, /* SQL statement, UTF-8 encoded */
3501 int nByte, /* Maximum length of zSql in bytes. */
3502 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3503 const char **pzTail /* OUT: Pointer to unused portion of zSql */
3504 );
3505 SQLITE_API int SQLITE_STDCALL sqlite3_prepare_v2(
3506 sqlite3 *db, /* Database handle */
3507 const char *zSql, /* SQL statement, UTF-8 encoded */
3508 int nByte, /* Maximum length of zSql in bytes. */
3509 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3510 const char **pzTail /* OUT: Pointer to unused portion of zSql */
3511 );
3512 SQLITE_API int SQLITE_STDCALL sqlite3_prepare16(
3513 sqlite3 *db, /* Database handle */
3514 const void *zSql, /* SQL statement, UTF-16 encoded */
3515 int nByte, /* Maximum length of zSql in bytes. */
3516 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3517 const void **pzTail /* OUT: Pointer to unused portion of zSql */
3518 );
3519 SQLITE_API int SQLITE_STDCALL sqlite3_prepare16_v2(
3520 sqlite3 *db, /* Database handle */
3521 const void *zSql, /* SQL statement, UTF-16 encoded */
3522 int nByte, /* Maximum length of zSql in bytes. */
3523 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3524 const void **pzTail /* OUT: Pointer to unused portion of zSql */
@@ -3553,12 +3555,12 @@
3553 ** automatically freed when the prepared statement is finalized.
3554 ** ^The string returned by sqlite3_expanded_sql(P), on the other hand,
3555 ** is obtained from [sqlite3_malloc()] and must be free by the application
3556 ** by passing it to [sqlite3_free()].
3557 */
3558 SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt);
3559 SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt);
3560
3561 /*
3562 ** CAPI3REF: Determine If An SQL Statement Writes The Database
3563 ** METHOD: sqlite3_stmt
3564 **
@@ -3586,11 +3588,11 @@
3586 ** database. ^The [ATTACH] and [DETACH] statements also cause
3587 ** sqlite3_stmt_readonly() to return true since, while those statements
3588 ** change the configuration of a database connection, they do not make
3589 ** changes to the content of the database files on disk.
3590 */
3591 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3592
3593 /*
3594 ** CAPI3REF: Determine If A Prepared Statement Has Been Reset
3595 ** METHOD: sqlite3_stmt
3596 **
@@ -3607,11 +3609,11 @@
3607 ** to locate all prepared statements associated with a database
3608 ** connection that are in need of being reset. This can be used,
3609 ** for example, in diagnostic routines to search for prepared
3610 ** statements that are holding a transaction open.
3611 */
3612 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_busy(sqlite3_stmt*);
3613
3614 /*
3615 ** CAPI3REF: Dynamically Typed Value Object
3616 ** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
3617 **
@@ -3771,24 +3773,24 @@
3771 ** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails.
3772 **
3773 ** See also: [sqlite3_bind_parameter_count()],
3774 ** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
3775 */
3776 SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
3777 SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
3778 void(*)(void*));
3779 SQLITE_API int SQLITE_STDCALL sqlite3_bind_double(sqlite3_stmt*, int, double);
3780 SQLITE_API int SQLITE_STDCALL sqlite3_bind_int(sqlite3_stmt*, int, int);
3781 SQLITE_API int SQLITE_STDCALL sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
3782 SQLITE_API int SQLITE_STDCALL sqlite3_bind_null(sqlite3_stmt*, int);
3783 SQLITE_API int SQLITE_STDCALL sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
3784 SQLITE_API int SQLITE_STDCALL sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
3785 SQLITE_API int SQLITE_STDCALL sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
3786 void(*)(void*), unsigned char encoding);
3787 SQLITE_API int SQLITE_STDCALL sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
3788 SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
3789 SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
3790
3791 /*
3792 ** CAPI3REF: Number Of SQL Parameters
3793 ** METHOD: sqlite3_stmt
3794 **
@@ -3805,11 +3807,11 @@
3805 **
3806 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
3807 ** [sqlite3_bind_parameter_name()], and
3808 ** [sqlite3_bind_parameter_index()].
3809 */
3810 SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_count(sqlite3_stmt*);
3811
3812 /*
3813 ** CAPI3REF: Name Of A Host Parameter
3814 ** METHOD: sqlite3_stmt
3815 **
@@ -3833,11 +3835,11 @@
3833 **
3834 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
3835 ** [sqlite3_bind_parameter_count()], and
3836 ** [sqlite3_bind_parameter_index()].
3837 */
3838 SQLITE_API const char *SQLITE_STDCALL sqlite3_bind_parameter_name(sqlite3_stmt*, int);
3839
3840 /*
3841 ** CAPI3REF: Index Of A Parameter With A Given Name
3842 ** METHOD: sqlite3_stmt
3843 **
@@ -3850,21 +3852,21 @@
3850 **
3851 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
3852 ** [sqlite3_bind_parameter_count()], and
3853 ** [sqlite3_bind_parameter_name()].
3854 */
3855 SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
3856
3857 /*
3858 ** CAPI3REF: Reset All Bindings On A Prepared Statement
3859 ** METHOD: sqlite3_stmt
3860 **
3861 ** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset
3862 ** the [sqlite3_bind_blob | bindings] on a [prepared statement].
3863 ** ^Use this routine to reset all host parameters to NULL.
3864 */
3865 SQLITE_API int SQLITE_STDCALL sqlite3_clear_bindings(sqlite3_stmt*);
3866
3867 /*
3868 ** CAPI3REF: Number Of Columns In A Result Set
3869 ** METHOD: sqlite3_stmt
3870 **
@@ -3872,11 +3874,11 @@
3872 ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
3873 ** statement that does not return data (for example an [UPDATE]).
3874 **
3875 ** See also: [sqlite3_data_count()]
3876 */
3877 SQLITE_API int SQLITE_STDCALL sqlite3_column_count(sqlite3_stmt *pStmt);
3878
3879 /*
3880 ** CAPI3REF: Column Names In A Result Set
3881 ** METHOD: sqlite3_stmt
3882 **
@@ -3901,12 +3903,12 @@
3901 ** ^The name of a result column is the value of the "AS" clause for
3902 ** that column, if there is an AS clause. If there is no AS clause
3903 ** then the name of the column is unspecified and may change from
3904 ** one release of SQLite to the next.
3905 */
3906 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_name(sqlite3_stmt*, int N);
3907 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_name16(sqlite3_stmt*, int N);
3908
3909 /*
3910 ** CAPI3REF: Source Of Data In A Query Result
3911 ** METHOD: sqlite3_stmt
3912 **
@@ -3950,16 +3952,16 @@
3950 ** If two or more threads call one or more
3951 ** [sqlite3_column_database_name | column metadata interfaces]
3952 ** for the same [prepared statement] and result column
3953 ** at the same time then the results are undefined.
3954 */
3955 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_database_name(sqlite3_stmt*,int);
3956 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_database_name16(sqlite3_stmt*,int);
3957 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_table_name(sqlite3_stmt*,int);
3958 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_table_name16(sqlite3_stmt*,int);
3959 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_origin_name(sqlite3_stmt*,int);
3960 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_origin_name16(sqlite3_stmt*,int);
3961
3962 /*
3963 ** CAPI3REF: Declared Datatype Of A Query Result
3964 ** METHOD: sqlite3_stmt
3965 **
@@ -3987,12 +3989,12 @@
3987 ** data stored in that column is of the declared type. SQLite is
3988 ** strongly typed, but the typing is dynamic not static. ^Type
3989 ** is associated with individual values, not with the containers
3990 ** used to hold those values.
3991 */
3992 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_decltype(sqlite3_stmt*,int);
3993 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_decltype16(sqlite3_stmt*,int);
3994
3995 /*
3996 ** CAPI3REF: Evaluate An SQL Statement
3997 ** METHOD: sqlite3_stmt
3998 **
@@ -4049,11 +4051,12 @@
4049 ** For all versions of SQLite up to and including 3.6.23.1, a call to
4050 ** [sqlite3_reset()] was required after sqlite3_step() returned anything
4051 ** other than [SQLITE_ROW] before any subsequent invocation of
4052 ** sqlite3_step(). Failure to reset the prepared statement using
4053 ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
4054 ** sqlite3_step(). But after version 3.6.23.1, sqlite3_step() began
 
4055 ** calling [sqlite3_reset()] automatically in this circumstance rather
4056 ** than returning [SQLITE_MISUSE]. This is not considered a compatibility
4057 ** break because any application that ever receives an SQLITE_MISUSE error
4058 ** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
4059 ** can be used to restore the legacy behavior.
@@ -4068,11 +4071,11 @@
4068 ** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
4069 ** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
4070 ** then the more specific [error codes] are returned directly
4071 ** by sqlite3_step(). The use of the "v2" interface is recommended.
4072 */
4073 SQLITE_API int SQLITE_STDCALL sqlite3_step(sqlite3_stmt*);
4074
4075 /*
4076 ** CAPI3REF: Number of columns in a result set
4077 ** METHOD: sqlite3_stmt
4078 **
@@ -4089,11 +4092,11 @@
4089 ** where it always returns zero since each step of that multi-step
4090 ** pragma returns 0 columns of data.
4091 **
4092 ** See also: [sqlite3_column_count()]
4093 */
4094 SQLITE_API int SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt);
4095
4096 /*
4097 ** CAPI3REF: Fundamental Datatypes
4098 ** KEYWORDS: SQLITE_TEXT
4099 **
@@ -4279,20 +4282,20 @@
4279 ** of these routines, a default value is returned. The default value
4280 ** is either the integer 0, the floating point number 0.0, or a NULL
4281 ** pointer. Subsequent calls to [sqlite3_errcode()] will return
4282 ** [SQLITE_NOMEM].)^
4283 */
4284 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_blob(sqlite3_stmt*, int iCol);
4285 SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes(sqlite3_stmt*, int iCol);
4286 SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
4287 SQLITE_API double SQLITE_STDCALL sqlite3_column_double(sqlite3_stmt*, int iCol);
4288 SQLITE_API int SQLITE_STDCALL sqlite3_column_int(sqlite3_stmt*, int iCol);
4289 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_column_int64(sqlite3_stmt*, int iCol);
4290 SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_column_text(sqlite3_stmt*, int iCol);
4291 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_text16(sqlite3_stmt*, int iCol);
4292 SQLITE_API int SQLITE_STDCALL sqlite3_column_type(sqlite3_stmt*, int iCol);
4293 SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_column_value(sqlite3_stmt*, int iCol);
4294
4295 /*
4296 ** CAPI3REF: Destroy A Prepared Statement Object
4297 ** DESTRUCTOR: sqlite3_stmt
4298 **
@@ -4316,11 +4319,11 @@
4316 ** resource leaks. It is a grievous error for the application to try to use
4317 ** a prepared statement after it has been finalized. Any use of a prepared
4318 ** statement after it has been finalized can result in undefined and
4319 ** undesirable behavior such as segfaults and heap corruption.
4320 */
4321 SQLITE_API int SQLITE_STDCALL sqlite3_finalize(sqlite3_stmt *pStmt);
4322
4323 /*
4324 ** CAPI3REF: Reset A Prepared Statement Object
4325 ** METHOD: sqlite3_stmt
4326 **
@@ -4343,11 +4346,11 @@
4343 ** [sqlite3_reset(S)] returns an appropriate [error code].
4344 **
4345 ** ^The [sqlite3_reset(S)] interface does not change the values
4346 ** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
4347 */
4348 SQLITE_API int SQLITE_STDCALL sqlite3_reset(sqlite3_stmt *pStmt);
4349
4350 /*
4351 ** CAPI3REF: Create Or Redefine SQL Functions
4352 ** KEYWORDS: {function creation routines}
4353 ** KEYWORDS: {application-defined SQL function}
@@ -4443,31 +4446,31 @@
4443 ** ^An application-defined function is permitted to call other
4444 ** SQLite interfaces. However, such calls must not
4445 ** close the database connection nor finalize or reset the prepared
4446 ** statement in which the function is running.
4447 */
4448 SQLITE_API int SQLITE_STDCALL sqlite3_create_function(
4449 sqlite3 *db,
4450 const char *zFunctionName,
4451 int nArg,
4452 int eTextRep,
4453 void *pApp,
4454 void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
4455 void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4456 void (*xFinal)(sqlite3_context*)
4457 );
4458 SQLITE_API int SQLITE_STDCALL sqlite3_create_function16(
4459 sqlite3 *db,
4460 const void *zFunctionName,
4461 int nArg,
4462 int eTextRep,
4463 void *pApp,
4464 void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
4465 void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4466 void (*xFinal)(sqlite3_context*)
4467 );
4468 SQLITE_API int SQLITE_STDCALL sqlite3_create_function_v2(
4469 sqlite3 *db,
4470 const char *zFunctionName,
4471 int nArg,
4472 int eTextRep,
4473 void *pApp,
@@ -4509,16 +4512,16 @@
4509 ** to be supported. However, new applications should avoid
4510 ** the use of these functions. To encourage programmers to avoid
4511 ** these functions, we will not explain what they do.
4512 */
4513 #ifndef SQLITE_OMIT_DEPRECATED
4514 SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_aggregate_count(sqlite3_context*);
4515 SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_expired(sqlite3_stmt*);
4516 SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
4517 SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_global_recover(void);
4518 SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_thread_cleanup(void);
4519 SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
4520 void*,sqlite3_int64);
4521 #endif
4522
4523 /*
4524 ** CAPI3REF: Obtaining SQL Values
@@ -4564,22 +4567,22 @@
4564 ** or [sqlite3_value_text16()].
4565 **
4566 ** These routines must be called from the same thread as
4567 ** the SQL function that supplied the [sqlite3_value*] parameters.
4568 */
4569 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_blob(sqlite3_value*);
4570 SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes(sqlite3_value*);
4571 SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes16(sqlite3_value*);
4572 SQLITE_API double SQLITE_STDCALL sqlite3_value_double(sqlite3_value*);
4573 SQLITE_API int SQLITE_STDCALL sqlite3_value_int(sqlite3_value*);
4574 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_value_int64(sqlite3_value*);
4575 SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_value_text(sqlite3_value*);
4576 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16(sqlite3_value*);
4577 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16le(sqlite3_value*);
4578 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16be(sqlite3_value*);
4579 SQLITE_API int SQLITE_STDCALL sqlite3_value_type(sqlite3_value*);
4580 SQLITE_API int SQLITE_STDCALL sqlite3_value_numeric_type(sqlite3_value*);
4581
4582 /*
4583 ** CAPI3REF: Finding The Subtype Of SQL Values
4584 ** METHOD: sqlite3_value
4585 **
@@ -4591,11 +4594,11 @@
4591 **
4592 ** SQLite makes no use of subtype itself. It merely passes the subtype
4593 ** from the result of one [application-defined SQL function] into the
4594 ** input of another.
4595 */
4596 SQLITE_API unsigned int SQLITE_STDCALL sqlite3_value_subtype(sqlite3_value*);
4597
4598 /*
4599 ** CAPI3REF: Copy And Free SQL Values
4600 ** METHOD: sqlite3_value
4601 **
@@ -4607,12 +4610,12 @@
4607 **
4608 ** ^The sqlite3_value_free(V) interface frees an [sqlite3_value] object
4609 ** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
4610 ** then sqlite3_value_free(V) is a harmless no-op.
4611 */
4612 SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_value_dup(const sqlite3_value*);
4613 SQLITE_API void SQLITE_STDCALL sqlite3_value_free(sqlite3_value*);
4614
4615 /*
4616 ** CAPI3REF: Obtain Aggregate Function Context
4617 ** METHOD: sqlite3_context
4618 **
@@ -4653,11 +4656,11 @@
4653 ** function.
4654 **
4655 ** This routine must be called from the same thread in which
4656 ** the aggregate SQL function is running.
4657 */
4658 SQLITE_API void *SQLITE_STDCALL sqlite3_aggregate_context(sqlite3_context*, int nBytes);
4659
4660 /*
4661 ** CAPI3REF: User Data For Functions
4662 ** METHOD: sqlite3_context
4663 **
@@ -4668,11 +4671,11 @@
4668 ** registered the application defined function.
4669 **
4670 ** This routine must be called from the same thread in which
4671 ** the application-defined function is running.
4672 */
4673 SQLITE_API void *SQLITE_STDCALL sqlite3_user_data(sqlite3_context*);
4674
4675 /*
4676 ** CAPI3REF: Database Connection For Functions
4677 ** METHOD: sqlite3_context
4678 **
@@ -4680,11 +4683,11 @@
4680 ** the pointer to the [database connection] (the 1st parameter)
4681 ** of the [sqlite3_create_function()]
4682 ** and [sqlite3_create_function16()] routines that originally
4683 ** registered the application defined function.
4684 */
4685 SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_context*);
4686
4687 /*
4688 ** CAPI3REF: Function Auxiliary Data
4689 ** METHOD: sqlite3_context
4690 **
@@ -4734,12 +4737,12 @@
4734 ** values and [parameters] and expressions composed from the same.)^
4735 **
4736 ** These routines must be called from the same thread in which
4737 ** the SQL function is running.
4738 */
4739 SQLITE_API void *SQLITE_STDCALL sqlite3_get_auxdata(sqlite3_context*, int N);
4740 SQLITE_API void SQLITE_STDCALL sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
4741
4742
4743 /*
4744 ** CAPI3REF: Constants Defining Special Destructor Behavior
4745 **
@@ -4871,31 +4874,31 @@
4871 **
4872 ** If these routines are called from within the different thread
4873 ** than the one containing the application-defined function that received
4874 ** the [sqlite3_context] pointer, the results are undefined.
4875 */
4876 SQLITE_API void SQLITE_STDCALL sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
4877 SQLITE_API void SQLITE_STDCALL sqlite3_result_blob64(sqlite3_context*,const void*,
4878 sqlite3_uint64,void(*)(void*));
4879 SQLITE_API void SQLITE_STDCALL sqlite3_result_double(sqlite3_context*, double);
4880 SQLITE_API void SQLITE_STDCALL sqlite3_result_error(sqlite3_context*, const char*, int);
4881 SQLITE_API void SQLITE_STDCALL sqlite3_result_error16(sqlite3_context*, const void*, int);
4882 SQLITE_API void SQLITE_STDCALL sqlite3_result_error_toobig(sqlite3_context*);
4883 SQLITE_API void SQLITE_STDCALL sqlite3_result_error_nomem(sqlite3_context*);
4884 SQLITE_API void SQLITE_STDCALL sqlite3_result_error_code(sqlite3_context*, int);
4885 SQLITE_API void SQLITE_STDCALL sqlite3_result_int(sqlite3_context*, int);
4886 SQLITE_API void SQLITE_STDCALL sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
4887 SQLITE_API void SQLITE_STDCALL sqlite3_result_null(sqlite3_context*);
4888 SQLITE_API void SQLITE_STDCALL sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
4889 SQLITE_API void SQLITE_STDCALL sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
4890 void(*)(void*), unsigned char encoding);
4891 SQLITE_API void SQLITE_STDCALL sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
4892 SQLITE_API void SQLITE_STDCALL sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
4893 SQLITE_API void SQLITE_STDCALL sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
4894 SQLITE_API void SQLITE_STDCALL sqlite3_result_value(sqlite3_context*, sqlite3_value*);
4895 SQLITE_API void SQLITE_STDCALL sqlite3_result_zeroblob(sqlite3_context*, int n);
4896 SQLITE_API int SQLITE_STDCALL sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
4897
4898
4899 /*
4900 ** CAPI3REF: Setting The Subtype Of An SQL Function
4901 ** METHOD: sqlite3_context
@@ -4906,11 +4909,11 @@
4906 ** of the subtype T are preserved in current versions of SQLite;
4907 ** higher order bits are discarded.
4908 ** The number of subtype bytes preserved by SQLite might increase
4909 ** in future releases of SQLite.
4910 */
4911 SQLITE_API void SQLITE_STDCALL sqlite3_result_subtype(sqlite3_context*,unsigned int);
4912
4913 /*
4914 ** CAPI3REF: Define New Collating Sequences
4915 ** METHOD: sqlite3
4916 **
@@ -4988,26 +4991,26 @@
4988 ** is unfortunate but cannot be changed without breaking backwards
4989 ** compatibility.
4990 **
4991 ** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
4992 */
4993 SQLITE_API int SQLITE_STDCALL sqlite3_create_collation(
4994 sqlite3*,
4995 const char *zName,
4996 int eTextRep,
4997 void *pArg,
4998 int(*xCompare)(void*,int,const void*,int,const void*)
4999 );
5000 SQLITE_API int SQLITE_STDCALL sqlite3_create_collation_v2(
5001 sqlite3*,
5002 const char *zName,
5003 int eTextRep,
5004 void *pArg,
5005 int(*xCompare)(void*,int,const void*,int,const void*),
5006 void(*xDestroy)(void*)
5007 );
5008 SQLITE_API int SQLITE_STDCALL sqlite3_create_collation16(
5009 sqlite3*,
5010 const void *zName,
5011 int eTextRep,
5012 void *pArg,
5013 int(*xCompare)(void*,int,const void*,int,const void*)
@@ -5038,16 +5041,16 @@
5038 **
5039 ** The callback function should register the desired collation using
5040 ** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
5041 ** [sqlite3_create_collation_v2()].
5042 */
5043 SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed(
5044 sqlite3*,
5045 void*,
5046 void(*)(void*,sqlite3*,int eTextRep,const char*)
5047 );
5048 SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed16(
5049 sqlite3*,
5050 void*,
5051 void(*)(void*,sqlite3*,int eTextRep,const void*)
5052 );
5053
@@ -5057,15 +5060,15 @@
5057 ** called right after sqlite3_open().
5058 **
5059 ** The code to implement this API is not available in the public release
5060 ** of SQLite.
5061 */
5062 SQLITE_API int SQLITE_STDCALL sqlite3_key(
5063 sqlite3 *db, /* Database to be rekeyed */
5064 const void *pKey, int nKey /* The key */
5065 );
5066 SQLITE_API int SQLITE_STDCALL sqlite3_key_v2(
5067 sqlite3 *db, /* Database to be rekeyed */
5068 const char *zDbName, /* Name of the database */
5069 const void *pKey, int nKey /* The key */
5070 );
5071
@@ -5075,35 +5078,35 @@
5075 ** database is decrypted.
5076 **
5077 ** The code to implement this API is not available in the public release
5078 ** of SQLite.
5079 */
5080 SQLITE_API int SQLITE_STDCALL sqlite3_rekey(
5081 sqlite3 *db, /* Database to be rekeyed */
5082 const void *pKey, int nKey /* The new key */
5083 );
5084 SQLITE_API int SQLITE_STDCALL sqlite3_rekey_v2(
5085 sqlite3 *db, /* Database to be rekeyed */
5086 const char *zDbName, /* Name of the database */
5087 const void *pKey, int nKey /* The new key */
5088 );
5089
5090 /*
5091 ** Specify the activation key for a SEE database. Unless
5092 ** activated, none of the SEE routines will work.
5093 */
5094 SQLITE_API void SQLITE_STDCALL sqlite3_activate_see(
5095 const char *zPassPhrase /* Activation phrase */
5096 );
5097 #endif
5098
5099 #ifdef SQLITE_ENABLE_CEROD
5100 /*
5101 ** Specify the activation key for a CEROD database. Unless
5102 ** activated, none of the CEROD routines will work.
5103 */
5104 SQLITE_API void SQLITE_STDCALL sqlite3_activate_cerod(
5105 const char *zPassPhrase /* Activation phrase */
5106 );
5107 #endif
5108
5109 /*
@@ -5121,11 +5124,11 @@
5121 ** method of the default [sqlite3_vfs] object. If the xSleep() method
5122 ** of the default VFS is not implemented correctly, or not implemented at
5123 ** all, then the behavior of sqlite3_sleep() may deviate from the description
5124 ** in the previous paragraphs.
5125 */
5126 SQLITE_API int SQLITE_STDCALL sqlite3_sleep(int);
5127
5128 /*
5129 ** CAPI3REF: Name Of The Folder Holding Temporary Files
5130 **
5131 ** ^(If this global variable is made to point to a string which is
@@ -5240,11 +5243,11 @@
5240 **
5241 ** If another thread changes the autocommit status of the database
5242 ** connection while this routine is running, then the return value
5243 ** is undefined.
5244 */
5245 SQLITE_API int SQLITE_STDCALL sqlite3_get_autocommit(sqlite3*);
5246
5247 /*
5248 ** CAPI3REF: Find The Database Handle Of A Prepared Statement
5249 ** METHOD: sqlite3_stmt
5250 **
@@ -5253,11 +5256,11 @@
5253 ** returned by sqlite3_db_handle is the same [database connection]
5254 ** that was the first argument
5255 ** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
5256 ** create the statement in the first place.
5257 */
5258 SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_db_handle(sqlite3_stmt*);
5259
5260 /*
5261 ** CAPI3REF: Return The Filename For A Database Connection
5262 ** METHOD: sqlite3
5263 **
@@ -5270,21 +5273,21 @@
5270 ** ^The filename returned by this function is the output of the
5271 ** xFullPathname method of the [VFS]. ^In other words, the filename
5272 ** will be an absolute pathname, even if the filename used
5273 ** to open the database originally was a URI or relative pathname.
5274 */
5275 SQLITE_API const char *SQLITE_STDCALL sqlite3_db_filename(sqlite3 *db, const char *zDbName);
5276
5277 /*
5278 ** CAPI3REF: Determine if a database is read-only
5279 ** METHOD: sqlite3
5280 **
5281 ** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N
5282 ** of connection D is read-only, 0 if it is read/write, or -1 if N is not
5283 ** the name of a database on connection D.
5284 */
5285 SQLITE_API int SQLITE_STDCALL sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
5286
5287 /*
5288 ** CAPI3REF: Find the next prepared statement
5289 ** METHOD: sqlite3
5290 **
@@ -5296,11 +5299,11 @@
5296 **
5297 ** The [database connection] pointer D in a call to
5298 ** [sqlite3_next_stmt(D,S)] must refer to an open database
5299 ** connection and in particular must not be a NULL pointer.
5300 */
5301 SQLITE_API sqlite3_stmt *SQLITE_STDCALL sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
5302
5303 /*
5304 ** CAPI3REF: Commit And Rollback Notification Callbacks
5305 ** METHOD: sqlite3
5306 **
@@ -5345,12 +5348,12 @@
5345 ** ^The rollback callback is not invoked if a transaction is
5346 ** automatically rolled back because the database connection is closed.
5347 **
5348 ** See also the [sqlite3_update_hook()] interface.
5349 */
5350 SQLITE_API void *SQLITE_STDCALL sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
5351 SQLITE_API void *SQLITE_STDCALL sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
5352
5353 /*
5354 ** CAPI3REF: Data Change Notification Callbacks
5355 ** METHOD: sqlite3
5356 **
@@ -5397,11 +5400,11 @@
5397 ** the first call on D.
5398 **
5399 ** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()],
5400 ** and [sqlite3_preupdate_hook()] interfaces.
5401 */
5402 SQLITE_API void *SQLITE_STDCALL sqlite3_update_hook(
5403 sqlite3*,
5404 void(*)(void *,int ,char const *,char const *,sqlite3_int64),
5405 void*
5406 );
5407
@@ -5412,11 +5415,12 @@
5412 ** and schema data structures between [database connection | connections]
5413 ** to the same database. Sharing is enabled if the argument is true
5414 ** and disabled if the argument is false.)^
5415 **
5416 ** ^Cache sharing is enabled and disabled for an entire process.
5417 ** This is a change as of SQLite version 3.5.0. In prior versions of SQLite,
 
5418 ** sharing was enabled or disabled for each thread separately.
5419 **
5420 ** ^(The cache sharing mode set by this interface effects all subsequent
5421 ** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
5422 ** Existing database connections continue use the sharing mode
@@ -5437,11 +5441,11 @@
5437 ** This interface is threadsafe on processors where writing a
5438 ** 32-bit integer is atomic.
5439 **
5440 ** See Also: [SQLite Shared-Cache Mode]
5441 */
5442 SQLITE_API int SQLITE_STDCALL sqlite3_enable_shared_cache(int);
5443
5444 /*
5445 ** CAPI3REF: Attempt To Free Heap Memory
5446 **
5447 ** ^The sqlite3_release_memory() interface attempts to free N bytes
@@ -5453,11 +5457,11 @@
5453 ** ^The sqlite3_release_memory() routine is a no-op returning zero
5454 ** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT].
5455 **
5456 ** See also: [sqlite3_db_release_memory()]
5457 */
5458 SQLITE_API int SQLITE_STDCALL sqlite3_release_memory(int);
5459
5460 /*
5461 ** CAPI3REF: Free Memory Used By A Database Connection
5462 ** METHOD: sqlite3
5463 **
@@ -5467,11 +5471,11 @@
5467 ** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is
5468 ** omitted.
5469 **
5470 ** See also: [sqlite3_release_memory()]
5471 */
5472 SQLITE_API int SQLITE_STDCALL sqlite3_db_release_memory(sqlite3*);
5473
5474 /*
5475 ** CAPI3REF: Impose A Limit On Heap Size
5476 **
5477 ** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
@@ -5506,11 +5510,12 @@
5506 ** <li> The page cache allocates from its own memory pool supplied
5507 ** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
5508 ** from the heap.
5509 ** </ul>)^
5510 **
5511 ** Beginning with SQLite version 3.7.3, the soft heap limit is enforced
 
5512 ** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT]
5513 ** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT],
5514 ** the soft heap limit is enforced on every memory allocation. Without
5515 ** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced
5516 ** when memory is allocated by the page cache. Testing suggests that because
@@ -5519,11 +5524,11 @@
5519 ** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT].
5520 **
5521 ** The circumstances under which SQLite will enforce the soft heap limit may
5522 ** changes in future releases of SQLite.
5523 */
5524 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_soft_heap_limit64(sqlite3_int64 N);
5525
5526 /*
5527 ** CAPI3REF: Deprecated Soft Heap Limit Interface
5528 ** DEPRECATED
5529 **
@@ -5530,11 +5535,11 @@
5530 ** This is a deprecated version of the [sqlite3_soft_heap_limit64()]
5531 ** interface. This routine is provided for historical compatibility
5532 ** only. All new applications should use the
5533 ** [sqlite3_soft_heap_limit64()] interface rather than this one.
5534 */
5535 SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_soft_heap_limit(int N);
5536
5537
5538 /*
5539 ** CAPI3REF: Extract Metadata About A Column Of A Table
5540 ** METHOD: sqlite3
@@ -5600,11 +5605,11 @@
5600 **
5601 ** ^This function causes all database schemas to be read from disk and
5602 ** parsed, if that has not already been done, and returns an error if
5603 ** any errors are encountered while loading the schema.
5604 */
5605 SQLITE_API int SQLITE_STDCALL sqlite3_table_column_metadata(
5606 sqlite3 *db, /* Connection handle */
5607 const char *zDbName, /* Database name or NULL */
5608 const char *zTableName, /* Table name */
5609 const char *zColumnName, /* Column name */
5610 char const **pzDataType, /* OUTPUT: Declared data type */
@@ -5656,11 +5661,11 @@
5656 ** disabled and prevent SQL injections from giving attackers
5657 ** access to extension loading capabilities.
5658 **
5659 ** See also the [load_extension() SQL function].
5660 */
5661 SQLITE_API int SQLITE_STDCALL sqlite3_load_extension(
5662 sqlite3 *db, /* Load the extension into this database connection */
5663 const char *zFile, /* Name of the shared library containing extension */
5664 const char *zProc, /* Entry point. Derived from zFile if 0 */
5665 char **pzErrMsg /* Put error message here if not 0 */
5666 );
@@ -5688,11 +5693,11 @@
5688 ** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method
5689 ** rather than this interface, so the [load_extension()] SQL function
5690 ** remains disabled. This will prevent SQL injections from giving attackers
5691 ** access to extension loading capabilities.
5692 */
5693 SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int onoff);
5694
5695 /*
5696 ** CAPI3REF: Automatically Load Statically Linked Extensions
5697 **
5698 ** ^This interface causes the xEntryPoint() function to be invoked for
@@ -5726,11 +5731,11 @@
5726 ** will be called more than once for each database connection that is opened.
5727 **
5728 ** See also: [sqlite3_reset_auto_extension()]
5729 ** and [sqlite3_cancel_auto_extension()]
5730 */
5731 SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void(*xEntryPoint)(void));
5732
5733 /*
5734 ** CAPI3REF: Cancel Automatic Extension Loading
5735 **
5736 ** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
@@ -5738,19 +5743,19 @@
5738 ** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)]
5739 ** routine returns 1 if initialization routine X was successfully
5740 ** unregistered and it returns 0 if X was not on the list of initialization
5741 ** routines.
5742 */
5743 SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
5744
5745 /*
5746 ** CAPI3REF: Reset Automatic Extension Loading
5747 **
5748 ** ^This interface disables all automatic extensions previously
5749 ** registered using [sqlite3_auto_extension()].
5750 */
5751 SQLITE_API void SQLITE_STDCALL sqlite3_reset_auto_extension(void);
5752
5753 /*
5754 ** The interface to the virtual-table mechanism is currently considered
5755 ** to be experimental. The interface might change in incompatible ways.
5756 ** If this is a problem for you, do not use the interface at this time.
@@ -5900,17 +5905,19 @@
5900 ** before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
5901 ** set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
5902 ** the xUpdate method are automatically rolled back by SQLite.
5903 **
5904 ** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
5905 ** structure for SQLite version 3.8.2. If a virtual table extension is
 
5906 ** used with an SQLite version earlier than 3.8.2, the results of attempting
5907 ** to read or write the estimatedRows field are undefined (but are likely
5908 ** to included crashing the application). The estimatedRows field should
5909 ** therefore only be used if [sqlite3_libversion_number()] returns a
5910 ** value greater than or equal to 3008002. Similarly, the idxFlags field
5911 ** was added for version 3.9.0. It may therefore only be used if
 
5912 ** sqlite3_libversion_number() returns a value greater than or equal to
5913 ** 3009000.
5914 */
5915 struct sqlite3_index_info {
5916 /* Inputs */
@@ -5991,17 +5998,17 @@
5991 ** be invoked if the call to sqlite3_create_module_v2() fails.
5992 ** ^The sqlite3_create_module()
5993 ** interface is equivalent to sqlite3_create_module_v2() with a NULL
5994 ** destructor.
5995 */
5996 SQLITE_API int SQLITE_STDCALL sqlite3_create_module(
5997 sqlite3 *db, /* SQLite connection to register module with */
5998 const char *zName, /* Name of the module */
5999 const sqlite3_module *p, /* Methods for the module */
6000 void *pClientData /* Client data for xCreate/xConnect */
6001 );
6002 SQLITE_API int SQLITE_STDCALL sqlite3_create_module_v2(
6003 sqlite3 *db, /* SQLite connection to register module with */
6004 const char *zName, /* Name of the module */
6005 const sqlite3_module *p, /* Methods for the module */
6006 void *pClientData, /* Client data for xCreate/xConnect */
6007 void(*xDestroy)(void*) /* Module destructor function */
@@ -6060,11 +6067,11 @@
6060 ** ^The [xCreate] and [xConnect] methods of a
6061 ** [virtual table module] call this interface
6062 ** to declare the format (the names and datatypes of the columns) of
6063 ** the virtual tables they implement.
6064 */
6065 SQLITE_API int SQLITE_STDCALL sqlite3_declare_vtab(sqlite3*, const char *zSQL);
6066
6067 /*
6068 ** CAPI3REF: Overload A Function For A Virtual Table
6069 ** METHOD: sqlite3
6070 **
@@ -6079,11 +6086,11 @@
6079 ** of the new function always causes an exception to be thrown. So
6080 ** the new function is not good for anything by itself. Its only
6081 ** purpose is to be a placeholder function that can be overloaded
6082 ** by a [virtual table].
6083 */
6084 SQLITE_API int SQLITE_STDCALL sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
6085
6086 /*
6087 ** The interface to the virtual-table mechanism defined above (back up
6088 ** to a comment remarkably similar to this one) is currently considered
6089 ** to be experimental. The interface might change in incompatible ways.
@@ -6178,11 +6185,11 @@
6178 ** zero-filled blob to read or write using the incremental-blob interface.
6179 **
6180 ** To avoid a resource leak, every open [BLOB handle] should eventually
6181 ** be released by a call to [sqlite3_blob_close()].
6182 */
6183 SQLITE_API int SQLITE_STDCALL sqlite3_blob_open(
6184 sqlite3*,
6185 const char *zDb,
6186 const char *zTable,
6187 const char *zColumn,
6188 sqlite3_int64 iRow,
@@ -6211,11 +6218,11 @@
6211 ** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle
6212 ** always returns zero.
6213 **
6214 ** ^This function sets the database handle error code and message.
6215 */
6216 SQLITE_API int SQLITE_STDCALL sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
6217
6218 /*
6219 ** CAPI3REF: Close A BLOB Handle
6220 ** DESTRUCTOR: sqlite3_blob
6221 **
@@ -6234,11 +6241,11 @@
6234 ** with a null pointer (such as would be returned by a failed call to
6235 ** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
6236 ** is passed a valid open blob handle, the values returned by the
6237 ** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
6238 */
6239 SQLITE_API int SQLITE_STDCALL sqlite3_blob_close(sqlite3_blob *);
6240
6241 /*
6242 ** CAPI3REF: Return The Size Of An Open BLOB
6243 ** METHOD: sqlite3_blob
6244 **
@@ -6250,11 +6257,11 @@
6250 ** This routine only works on a [BLOB handle] which has been created
6251 ** by a prior successful call to [sqlite3_blob_open()] and which has not
6252 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
6253 ** to this routine results in undefined and probably undesirable behavior.
6254 */
6255 SQLITE_API int SQLITE_STDCALL sqlite3_blob_bytes(sqlite3_blob *);
6256
6257 /*
6258 ** CAPI3REF: Read Data From A BLOB Incrementally
6259 ** METHOD: sqlite3_blob
6260 **
@@ -6279,11 +6286,11 @@
6279 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
6280 ** to this routine results in undefined and probably undesirable behavior.
6281 **
6282 ** See also: [sqlite3_blob_write()].
6283 */
6284 SQLITE_API int SQLITE_STDCALL sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
6285
6286 /*
6287 ** CAPI3REF: Write Data Into A BLOB Incrementally
6288 ** METHOD: sqlite3_blob
6289 **
@@ -6321,11 +6328,11 @@
6321 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
6322 ** to this routine results in undefined and probably undesirable behavior.
6323 **
6324 ** See also: [sqlite3_blob_read()].
6325 */
6326 SQLITE_API int SQLITE_STDCALL sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
6327
6328 /*
6329 ** CAPI3REF: Virtual File System Objects
6330 **
6331 ** A virtual filesystem (VFS) is an [sqlite3_vfs] object
@@ -6352,13 +6359,13 @@
6352 **
6353 ** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.
6354 ** ^(If the default VFS is unregistered, another VFS is chosen as
6355 ** the default. The choice for the new VFS is arbitrary.)^
6356 */
6357 SQLITE_API sqlite3_vfs *SQLITE_STDCALL sqlite3_vfs_find(const char *zVfsName);
6358 SQLITE_API int SQLITE_STDCALL sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
6359 SQLITE_API int SQLITE_STDCALL sqlite3_vfs_unregister(sqlite3_vfs*);
6360
6361 /*
6362 ** CAPI3REF: Mutexes
6363 **
6364 ** The SQLite core uses these routines for thread
@@ -6470,15 +6477,15 @@
6470 ** sqlite3_mutex_leave() is a NULL pointer, then all three routines
6471 ** behave as no-ops.
6472 **
6473 ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
6474 */
6475 SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_mutex_alloc(int);
6476 SQLITE_API void SQLITE_STDCALL sqlite3_mutex_free(sqlite3_mutex*);
6477 SQLITE_API void SQLITE_STDCALL sqlite3_mutex_enter(sqlite3_mutex*);
6478 SQLITE_API int SQLITE_STDCALL sqlite3_mutex_try(sqlite3_mutex*);
6479 SQLITE_API void SQLITE_STDCALL sqlite3_mutex_leave(sqlite3_mutex*);
6480
6481 /*
6482 ** CAPI3REF: Mutex Methods Object
6483 **
6484 ** An instance of this structure defines the low-level routines
@@ -6584,12 +6591,12 @@
6584 ** call to sqlite3_mutex_held() to fail, so a non-zero return is
6585 ** the appropriate thing to do. The sqlite3_mutex_notheld()
6586 ** interface should also return 1 when given a NULL pointer.
6587 */
6588 #ifndef NDEBUG
6589 SQLITE_API int SQLITE_STDCALL sqlite3_mutex_held(sqlite3_mutex*);
6590 SQLITE_API int SQLITE_STDCALL sqlite3_mutex_notheld(sqlite3_mutex*);
6591 #endif
6592
6593 /*
6594 ** CAPI3REF: Mutex Types
6595 **
@@ -6604,11 +6611,11 @@
6604 #define SQLITE_MUTEX_RECURSIVE 1
6605 #define SQLITE_MUTEX_STATIC_MASTER 2
6606 #define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */
6607 #define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */
6608 #define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */
6609 #define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */
6610 #define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
6611 #define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */
6612 #define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */
6613 #define SQLITE_MUTEX_STATIC_APP1 8 /* For use by application */
6614 #define SQLITE_MUTEX_STATIC_APP2 9 /* For use by application */
@@ -6625,11 +6632,11 @@
6625 ** serializes access to the [database connection] given in the argument
6626 ** when the [threading mode] is Serialized.
6627 ** ^If the [threading mode] is Single-thread or Multi-thread then this
6628 ** routine returns a NULL pointer.
6629 */
6630 SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_db_mutex(sqlite3*);
6631
6632 /*
6633 ** CAPI3REF: Low-Level Control Of Database Files
6634 ** METHOD: sqlite3
6635 **
@@ -6660,11 +6667,11 @@
6660 ** an incorrect zDbName and an SQLITE_ERROR return from the underlying
6661 ** xFileControl method.
6662 **
6663 ** See also: [SQLITE_FCNTL_LOCKSTATE]
6664 */
6665 SQLITE_API int SQLITE_STDCALL sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
6666
6667 /*
6668 ** CAPI3REF: Testing Interface
6669 **
6670 ** ^The sqlite3_test_control() interface is used to read out internal
@@ -6679,11 +6686,11 @@
6679 ** The details of the operation codes, their meanings, the parameters
6680 ** they take, and what they do are all subject to change without notice.
6681 ** Unlike most of the SQLite API, this function is not guaranteed to
6682 ** operate consistently from one release to the next.
6683 */
6684 SQLITE_API int SQLITE_CDECL sqlite3_test_control(int op, ...);
6685
6686 /*
6687 ** CAPI3REF: Testing Interface Operation Codes
6688 **
6689 ** These constants are the valid operation code parameters used
@@ -6708,10 +6715,11 @@
6708 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15
6709 #define SQLITE_TESTCTRL_ISKEYWORD 16
6710 #define SQLITE_TESTCTRL_SCRATCHMALLOC 17
6711 #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
6712 #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
 
6713 #define SQLITE_TESTCTRL_NEVER_CORRUPT 20
6714 #define SQLITE_TESTCTRL_VDBE_COVERAGE 21
6715 #define SQLITE_TESTCTRL_BYTEORDER 22
6716 #define SQLITE_TESTCTRL_ISINIT 23
6717 #define SQLITE_TESTCTRL_SORTER_MMAP 24
@@ -6742,12 +6750,12 @@
6742 ** be represented by a 32-bit integer, then the values returned by
6743 ** sqlite3_status() are undefined.
6744 **
6745 ** See also: [sqlite3_db_status()]
6746 */
6747 SQLITE_API int SQLITE_STDCALL sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
6748 SQLITE_API int SQLITE_STDCALL sqlite3_status64(
6749 int op,
6750 sqlite3_int64 *pCurrent,
6751 sqlite3_int64 *pHighwater,
6752 int resetFlag
6753 );
@@ -6868,11 +6876,11 @@
6868 ** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
6869 ** non-zero [error code] on failure.
6870 **
6871 ** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
6872 */
6873 SQLITE_API int SQLITE_STDCALL sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
6874
6875 /*
6876 ** CAPI3REF: Status Parameters for database connections
6877 ** KEYWORDS: {SQLITE_DBSTATUS options}
6878 **
@@ -7011,11 +7019,11 @@
7011 ** ^If the resetFlg is true, then the counter is reset to zero after this
7012 ** interface call returns.
7013 **
7014 ** See also: [sqlite3_status()] and [sqlite3_db_status()].
7015 */
7016 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
7017
7018 /*
7019 ** CAPI3REF: Status Parameters for prepared statements
7020 ** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters}
7021 **
@@ -7480,20 +7488,20 @@
7480 ** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()
7481 ** APIs are not strictly speaking threadsafe. If they are invoked at the
7482 ** same time as another thread is invoking sqlite3_backup_step() it is
7483 ** possible that they return invalid values.
7484 */
7485 SQLITE_API sqlite3_backup *SQLITE_STDCALL sqlite3_backup_init(
7486 sqlite3 *pDest, /* Destination database handle */
7487 const char *zDestName, /* Destination database name */
7488 sqlite3 *pSource, /* Source database handle */
7489 const char *zSourceName /* Source database name */
7490 );
7491 SQLITE_API int SQLITE_STDCALL sqlite3_backup_step(sqlite3_backup *p, int nPage);
7492 SQLITE_API int SQLITE_STDCALL sqlite3_backup_finish(sqlite3_backup *p);
7493 SQLITE_API int SQLITE_STDCALL sqlite3_backup_remaining(sqlite3_backup *p);
7494 SQLITE_API int SQLITE_STDCALL sqlite3_backup_pagecount(sqlite3_backup *p);
7495
7496 /*
7497 ** CAPI3REF: Unlock Notification
7498 ** METHOD: sqlite3
7499 **
@@ -7606,11 +7614,11 @@
7606 ** by an sqlite3_step() call. ^(If there is a blocking connection, then the
7607 ** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in
7608 ** the special "DROP TABLE/INDEX" case, the extended error code is just
7609 ** SQLITE_LOCKED.)^
7610 */
7611 SQLITE_API int SQLITE_STDCALL sqlite3_unlock_notify(
7612 sqlite3 *pBlocked, /* Waiting connection */
7613 void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */
7614 void *pNotifyArg /* Argument to pass to xNotify */
7615 );
7616
@@ -7621,12 +7629,12 @@
7621 ** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications
7622 ** and extensions to compare the contents of two buffers containing UTF-8
7623 ** strings in a case-independent fashion, using the same definition of "case
7624 ** independence" that SQLite uses internally when comparing identifiers.
7625 */
7626 SQLITE_API int SQLITE_STDCALL sqlite3_stricmp(const char *, const char *);
7627 SQLITE_API int SQLITE_STDCALL sqlite3_strnicmp(const char *, const char *, int);
7628
7629 /*
7630 ** CAPI3REF: String Globbing
7631 *
7632 ** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if
@@ -7639,11 +7647,11 @@
7639 ** Note that this routine returns zero on a match and non-zero if the strings
7640 ** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
7641 **
7642 ** See also: [sqlite3_strlike()].
7643 */
7644 SQLITE_API int SQLITE_STDCALL sqlite3_strglob(const char *zGlob, const char *zStr);
7645
7646 /*
7647 ** CAPI3REF: String LIKE Matching
7648 *
7649 ** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if
@@ -7662,11 +7670,11 @@
7662 ** Note that this routine returns zero on a match and non-zero if the strings
7663 ** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
7664 **
7665 ** See also: [sqlite3_strglob()].
7666 */
7667 SQLITE_API int SQLITE_STDCALL sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc);
7668
7669 /*
7670 ** CAPI3REF: Error Logging Interface
7671 **
7672 ** ^The [sqlite3_log()] interface writes a message into the [error log]
@@ -7685,11 +7693,11 @@
7685 ** will not use dynamically allocated memory. The log message is stored in
7686 ** a fixed-length buffer on the stack. If the log message is longer than
7687 ** a few hundred characters, it will be truncated to the length of the
7688 ** buffer.
7689 */
7690 SQLITE_API void SQLITE_CDECL sqlite3_log(int iErrCode, const char *zFormat, ...);
7691
7692 /*
7693 ** CAPI3REF: Write-Ahead Log Commit Hook
7694 ** METHOD: sqlite3
7695 **
@@ -7721,11 +7729,11 @@
7721 ** previously registered write-ahead log callback. ^Note that the
7722 ** [sqlite3_wal_autocheckpoint()] interface and the
7723 ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
7724 ** overwrite any prior [sqlite3_wal_hook()] settings.
7725 */
7726 SQLITE_API void *SQLITE_STDCALL sqlite3_wal_hook(
7727 sqlite3*,
7728 int(*)(void *,sqlite3*,const char*,int),
7729 void*
7730 );
7731
@@ -7756,11 +7764,11 @@
7756 ** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
7757 ** pages. The use of this interface
7758 ** is only necessary if the default setting is found to be suboptimal
7759 ** for a particular application.
7760 */
7761 SQLITE_API int SQLITE_STDCALL sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
7762
7763 /*
7764 ** CAPI3REF: Checkpoint a database
7765 ** METHOD: sqlite3
7766 **
@@ -7778,11 +7786,11 @@
7778 ** interface was added. This interface is retained for backwards
7779 ** compatibility and as a convenience for applications that need to manually
7780 ** start a callback but which do not need the full power (and corresponding
7781 ** complication) of [sqlite3_wal_checkpoint_v2()].
7782 */
7783 SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
7784
7785 /*
7786 ** CAPI3REF: Checkpoint a database
7787 ** METHOD: sqlite3
7788 **
@@ -7872,11 +7880,11 @@
7872 ** [sqlite3_errcode()] and [sqlite3_errmsg()].
7873 **
7874 ** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
7875 ** from SQL.
7876 */
7877 SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint_v2(
7878 sqlite3 *db, /* Database handle */
7879 const char *zDb, /* Name of attached database (or NULL) */
7880 int eMode, /* SQLITE_CHECKPOINT_* value */
7881 int *pnLog, /* OUT: Size of WAL log in frames */
7882 int *pnCkpt /* OUT: Total number of frames checkpointed */
@@ -7908,11 +7916,11 @@
7908 **
7909 ** At present, there is only one option that may be configured using
7910 ** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].) Further options
7911 ** may be added in the future.
7912 */
7913 SQLITE_API int SQLITE_CDECL sqlite3_vtab_config(sqlite3*, int op, ...);
7914
7915 /*
7916 ** CAPI3REF: Virtual Table Configuration Options
7917 **
7918 ** These macros define the various options to the
@@ -7961,11 +7969,11 @@
7961 ** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],
7962 ** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode
7963 ** of the SQL statement that triggered the call to the [xUpdate] method of the
7964 ** [virtual table].
7965 */
7966 SQLITE_API int SQLITE_STDCALL sqlite3_vtab_on_conflict(sqlite3 *);
7967
7968 /*
7969 ** CAPI3REF: Conflict resolution modes
7970 ** KEYWORDS: {conflict resolution mode}
7971 **
@@ -8066,11 +8074,11 @@
8066 ** as if the loop did not exist - it returns non-zero and leave the variable
8067 ** that pOut points to unchanged.
8068 **
8069 ** See also: [sqlite3_stmt_scanstatus_reset()]
8070 */
8071 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_scanstatus(
8072 sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
8073 int idx, /* Index of loop to report on */
8074 int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
8075 void *pOut /* Result written here */
8076 );
@@ -8082,11 +8090,11 @@
8082 ** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.
8083 **
8084 ** This API is only available if the library is built with pre-processor
8085 ** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
8086 */
8087 SQLITE_API void SQLITE_STDCALL sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
8088
8089 /*
8090 ** CAPI3REF: Flush caches to disk mid-transaction
8091 **
8092 ** ^If a write-transaction is open on [database connection] D when the
@@ -8114,11 +8122,11 @@
8114 ** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK.
8115 **
8116 ** ^This function does not set the database handle error code or message
8117 ** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.
8118 */
8119 SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*);
8120
8121 /*
8122 ** CAPI3REF: The pre-update hook.
8123 **
8124 ** ^These interfaces are only available if SQLite is compiled using the
@@ -8194,11 +8202,11 @@
8194 ** triggers; or 2 for changes resulting from triggers called by top-level
8195 ** triggers; and so forth.
8196 **
8197 ** See also: [sqlite3_update_hook()]
8198 */
8199 SQLITE_API SQLITE_EXPERIMENTAL void *SQLITE_STDCALL sqlite3_preupdate_hook(
8200 sqlite3 *db,
8201 void(*xPreUpdate)(
8202 void *pCtx, /* Copy of third arg to preupdate_hook() */
8203 sqlite3 *db, /* Database handle */
8204 int op, /* SQLITE_UPDATE, DELETE or INSERT */
@@ -8207,14 +8215,14 @@
8207 sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */
8208 sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */
8209 ),
8210 void*
8211 );
8212 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);
8213 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_count(sqlite3 *);
8214 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_depth(sqlite3 *);
8215 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
8216
8217 /*
8218 ** CAPI3REF: Low-level system error code
8219 **
8220 ** ^Attempt to return the underlying operating system error code or error
@@ -8222,11 +8230,11 @@
8222 ** The return value is OS-dependent. For example, on unix systems, after
8223 ** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be
8224 ** called to get back the underlying "errno" that caused the problem, such
8225 ** as ENOSPC, EAUTH, EISDIR, and so forth.
8226 */
8227 SQLITE_API int SQLITE_STDCALL sqlite3_system_errno(sqlite3*);
8228
8229 /*
8230 ** CAPI3REF: Database Snapshot
8231 ** KEYWORDS: {snapshot}
8232 ** EXPERIMENTAL
@@ -8272,11 +8280,11 @@
8272 ** to avoid a memory leak.
8273 **
8274 ** The [sqlite3_snapshot_get()] interface is only available when the
8275 ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8276 */
8277 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_get(
8278 sqlite3 *db,
8279 const char *zSchema,
8280 sqlite3_snapshot **ppSnapshot
8281 );
8282
@@ -8310,11 +8318,11 @@
8310 ** database connection in order to make it ready to use snapshots.)
8311 **
8312 ** The [sqlite3_snapshot_open()] interface is only available when the
8313 ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8314 */
8315 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_open(
8316 sqlite3 *db,
8317 const char *zSchema,
8318 sqlite3_snapshot *pSnapshot
8319 );
8320
@@ -8327,11 +8335,11 @@
8327 ** using this routine to avoid a memory leak.
8328 **
8329 ** The [sqlite3_snapshot_free()] interface is only available when the
8330 ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8331 */
8332 SQLITE_API SQLITE_EXPERIMENTAL void SQLITE_STDCALL sqlite3_snapshot_free(sqlite3_snapshot*);
8333
8334 /*
8335 ** CAPI3REF: Compare the ages of two snapshot handles.
8336 ** EXPERIMENTAL
8337 **
@@ -8351,11 +8359,11 @@
8351 **
8352 ** Otherwise, this API returns a negative value if P1 refers to an older
8353 ** snapshot than P2, zero if the two handles refer to the same database
8354 ** snapshot, and a positive value if P1 is a newer snapshot than P2.
8355 */
8356 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_cmp(
8357 sqlite3_snapshot *p1,
8358 sqlite3_snapshot *p2
8359 );
8360
8361 /*
@@ -8409,11 +8417,11 @@
8409 ** Register a geometry callback named zGeom that can be used as part of an
8410 ** R-Tree geometry query as follows:
8411 **
8412 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
8413 */
8414 SQLITE_API int SQLITE_STDCALL sqlite3_rtree_geometry_callback(
8415 sqlite3 *db,
8416 const char *zGeom,
8417 int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),
8418 void *pContext
8419 );
@@ -8435,11 +8443,11 @@
8435 ** Register a 2nd-generation geometry callback named zScore that can be
8436 ** used as part of an R-Tree geometry query as follows:
8437 **
8438 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
8439 */
8440 SQLITE_API int SQLITE_STDCALL sqlite3_rtree_query_callback(
8441 sqlite3 *db,
8442 const char *zQueryFunc,
8443 int (*xQueryFunc)(sqlite3_rtree_query_info*),
8444 void *pContext,
8445 void (*xDestructor)(void*)
8446
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -106,11 +106,12 @@
106 ** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
107 ** be larger than the release from which it is derived. Either Y will
108 ** be held constant and Z will be incremented or else Y will be incremented
109 ** and Z will be reset to zero.
110 **
111 ** Since [version 3.6.18] ([dateof:3.6.18]),
112 ** SQLite source code has been stored in the
113 ** <a href="http://www.fossil-scm.org/">Fossil configuration management
114 ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
115 ** a string which identifies a particular check-in of SQLite
116 ** within its configuration management system. ^The SQLITE_SOURCE_ID
117 ** string contains the date and time of the check-in (UTC) and an SHA1
@@ -120,11 +121,11 @@
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122 ** [sqlite_version()] and [sqlite_source_id()].
123 */
124 #define SQLITE_VERSION "3.15.0"
125 #define SQLITE_VERSION_NUMBER 3015000
126 #define SQLITE_SOURCE_ID "2016-09-22 18:53:13 c3774c6a5fe48af91fda28e9e18c6ed9053ea992"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
131 **
@@ -153,13 +154,13 @@
154 ** [SQLITE_SOURCE_ID] C preprocessor macro.
155 **
156 ** See also: [sqlite_version()] and [sqlite_source_id()].
157 */
158 SQLITE_API SQLITE_EXTERN const char sqlite3_version[];
159 SQLITE_API const char *sqlite3_libversion(void);
160 SQLITE_API const char *sqlite3_sourceid(void);
161 SQLITE_API int sqlite3_libversion_number(void);
162
163 /*
164 ** CAPI3REF: Run-Time Library Compilation Options Diagnostics
165 **
166 ** ^The sqlite3_compileoption_used() function returns 0 or 1
@@ -180,12 +181,12 @@
181 **
182 ** See also: SQL functions [sqlite_compileoption_used()] and
183 ** [sqlite_compileoption_get()] and the [compile_options pragma].
184 */
185 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
186 SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
187 SQLITE_API const char *sqlite3_compileoption_get(int N);
188 #endif
189
190 /*
191 ** CAPI3REF: Test To See If The Library Is Threadsafe
192 **
@@ -220,11 +221,11 @@
221 ** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
222 ** is unchanged by calls to sqlite3_config().)^
223 **
224 ** See the [threading mode] documentation for additional information.
225 */
226 SQLITE_API int sqlite3_threadsafe(void);
227
228 /*
229 ** CAPI3REF: Database Connection Handle
230 ** KEYWORDS: {database connection} {database connections}
231 **
@@ -317,12 +318,12 @@
318 ** from [sqlite3_open()], [sqlite3_open16()], or
319 ** [sqlite3_open_v2()], and not previously closed.
320 ** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer
321 ** argument is a harmless no-op.
322 */
323 SQLITE_API int sqlite3_close(sqlite3*);
324 SQLITE_API int sqlite3_close_v2(sqlite3*);
325
326 /*
327 ** The type for a callback function.
328 ** This is legacy and deprecated. It is included for historical
329 ** compatibility and is not documented.
@@ -389,11 +390,11 @@
390 ** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
391 ** <li> The application must not modify the SQL statement text passed into
392 ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
393 ** </ul>
394 */
395 SQLITE_API int sqlite3_exec(
396 sqlite3*, /* An open database */
397 const char *sql, /* SQL to be evaluated */
398 int (*callback)(void*,int,char**,char**), /* Callback function */
399 void *, /* 1st argument to callback */
400 char **errmsg /* Error msg written here */
@@ -450,11 +451,12 @@
451 **
452 ** In its default configuration, SQLite API routines return one of 30 integer
453 ** [result codes]. However, experience has shown that many of
454 ** these result codes are too coarse-grained. They do not provide as
455 ** much information about problems as programmers might like. In an effort to
456 ** address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]
457 ** and later) include
458 ** support for additional result codes that provide more detailed information
459 ** about errors. These [extended result codes] are enabled or disabled
460 ** on a per database connection basis using the
461 ** [sqlite3_extended_result_codes()] API. Or, the extended code for
462 ** the most recent error can be obtained using
@@ -1388,14 +1390,14 @@
1390 ** sqlite3_os_init() and sqlite3_os_end(). An application-supplied
1391 ** implementation of sqlite3_os_init() or sqlite3_os_end()
1392 ** must return [SQLITE_OK] on success and some other [error code] upon
1393 ** failure.
1394 */
1395 SQLITE_API int sqlite3_initialize(void);
1396 SQLITE_API int sqlite3_shutdown(void);
1397 SQLITE_API int sqlite3_os_init(void);
1398 SQLITE_API int sqlite3_os_end(void);
1399
1400 /*
1401 ** CAPI3REF: Configuring The SQLite Library
1402 **
1403 ** The sqlite3_config() interface is used to make global configuration
@@ -1424,11 +1426,11 @@
1426 **
1427 ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
1428 ** ^If the option is unknown or SQLite is unable to set the option
1429 ** then this routine returns a non-zero [error code].
1430 */
1431 SQLITE_API int sqlite3_config(int, ...);
1432
1433 /*
1434 ** CAPI3REF: Configure database connections
1435 ** METHOD: sqlite3
1436 **
@@ -1443,11 +1445,11 @@
1445 ** Subsequent arguments vary depending on the configuration verb.
1446 **
1447 ** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
1448 ** the call is considered successful.
1449 */
1450 SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...);
1451
1452 /*
1453 ** CAPI3REF: Memory Allocation Routines
1454 **
1455 ** An instance of this object defines the interface between SQLite
@@ -1994,11 +1996,11 @@
1996 **
1997 ** ^The sqlite3_extended_result_codes() routine enables or disables the
1998 ** [extended result codes] feature of SQLite. ^The extended result
1999 ** codes are disabled by default for historical compatibility.
2000 */
2001 SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);
2002
2003 /*
2004 ** CAPI3REF: Last Insert Rowid
2005 ** METHOD: sqlite3
2006 **
@@ -2046,11 +2048,11 @@
2048 ** function is running and thus changes the last insert [rowid],
2049 ** then the value returned by [sqlite3_last_insert_rowid()] is
2050 ** unpredictable and might not equal either the old or the new
2051 ** last insert [rowid].
2052 */
2053 SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
2054
2055 /*
2056 ** CAPI3REF: Count The Number Of Rows Modified
2057 ** METHOD: sqlite3
2058 **
@@ -2099,11 +2101,11 @@
2101 **
2102 ** If a separate thread makes changes on the same database connection
2103 ** while [sqlite3_changes()] is running then the value returned
2104 ** is unpredictable and not meaningful.
2105 */
2106 SQLITE_API int sqlite3_changes(sqlite3*);
2107
2108 /*
2109 ** CAPI3REF: Total Number Of Rows Modified
2110 ** METHOD: sqlite3
2111 **
@@ -2123,11 +2125,11 @@
2125 **
2126 ** If a separate thread makes changes on the same database connection
2127 ** while [sqlite3_total_changes()] is running then the value
2128 ** returned is unpredictable and not meaningful.
2129 */
2130 SQLITE_API int sqlite3_total_changes(sqlite3*);
2131
2132 /*
2133 ** CAPI3REF: Interrupt A Long-Running Query
2134 ** METHOD: sqlite3
2135 **
@@ -2163,11 +2165,11 @@
2165 ** that are started after the sqlite3_interrupt() call returns.
2166 **
2167 ** If the database connection closes while [sqlite3_interrupt()]
2168 ** is running then bad things will likely happen.
2169 */
2170 SQLITE_API void sqlite3_interrupt(sqlite3*);
2171
2172 /*
2173 ** CAPI3REF: Determine If An SQL Statement Is Complete
2174 **
2175 ** These routines are useful during command-line input to determine if the
@@ -2198,12 +2200,12 @@
2200 ** UTF-8 string.
2201 **
2202 ** The input to [sqlite3_complete16()] must be a zero-terminated
2203 ** UTF-16 string in native byte order.
2204 */
2205 SQLITE_API int sqlite3_complete(const char *sql);
2206 SQLITE_API int sqlite3_complete16(const void *sql);
2207
2208 /*
2209 ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
2210 ** KEYWORDS: {busy-handler callback} {busy handler}
2211 ** METHOD: sqlite3
@@ -2260,11 +2262,11 @@
2262 ** result in undefined behavior.
2263 **
2264 ** A busy handler must not close the database connection
2265 ** or [prepared statement] that invoked the busy handler.
2266 */
2267 SQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
2268
2269 /*
2270 ** CAPI3REF: Set A Busy Timeout
2271 ** METHOD: sqlite3
2272 **
@@ -2283,11 +2285,11 @@
2285 ** was defined (using [sqlite3_busy_handler()]) prior to calling
2286 ** this routine, that other busy handler is cleared.)^
2287 **
2288 ** See also: [PRAGMA busy_timeout]
2289 */
2290 SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
2291
2292 /*
2293 ** CAPI3REF: Convenience Routines For Running Queries
2294 ** METHOD: sqlite3
2295 **
@@ -2358,19 +2360,19 @@
2360 ** interface defined here. As a consequence, errors that occur in the
2361 ** wrapper layer outside of the internal [sqlite3_exec()] call are not
2362 ** reflected in subsequent calls to [sqlite3_errcode()] or
2363 ** [sqlite3_errmsg()].
2364 */
2365 SQLITE_API int sqlite3_get_table(
2366 sqlite3 *db, /* An open database */
2367 const char *zSql, /* SQL to be evaluated */
2368 char ***pazResult, /* Results of the query */
2369 int *pnRow, /* Number of result rows written here */
2370 int *pnColumn, /* Number of result columns written here */
2371 char **pzErrmsg /* Error msg written here */
2372 );
2373 SQLITE_API void sqlite3_free_table(char **result);
2374
2375 /*
2376 ** CAPI3REF: Formatted String Printing Functions
2377 **
2378 ** These routines are work-alikes of the "printf()" family of functions
@@ -2472,14 +2474,14 @@
2474 **
2475 ** ^(The "%z" formatting option works like "%s" but with the
2476 ** addition that after the string has been read and copied into
2477 ** the result, [sqlite3_free()] is called on the input string.)^
2478 */
2479 SQLITE_API char *sqlite3_mprintf(const char*,...);
2480 SQLITE_API char *sqlite3_vmprintf(const char*, va_list);
2481 SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);
2482 SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
2483
2484 /*
2485 ** CAPI3REF: Memory Allocation Subsystem
2486 **
2487 ** The SQLite core uses these three routines for all of its own
@@ -2565,16 +2567,16 @@
2567 **
2568 ** The application must not read or write any part of
2569 ** a block of memory after it has been released using
2570 ** [sqlite3_free()] or [sqlite3_realloc()].
2571 */
2572 SQLITE_API void *sqlite3_malloc(int);
2573 SQLITE_API void *sqlite3_malloc64(sqlite3_uint64);
2574 SQLITE_API void *sqlite3_realloc(void*, int);
2575 SQLITE_API void *sqlite3_realloc64(void*, sqlite3_uint64);
2576 SQLITE_API void sqlite3_free(void*);
2577 SQLITE_API sqlite3_uint64 sqlite3_msize(void*);
2578
2579 /*
2580 ** CAPI3REF: Memory Allocator Statistics
2581 **
2582 ** SQLite provides these two interfaces for reporting on the status
@@ -2595,12 +2597,12 @@
2597 ** [sqlite3_memory_used()] if and only if the parameter to
2598 ** [sqlite3_memory_highwater()] is true. ^The value returned
2599 ** by [sqlite3_memory_highwater(1)] is the high-water mark
2600 ** prior to the reset.
2601 */
2602 SQLITE_API sqlite3_int64 sqlite3_memory_used(void);
2603 SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
2604
2605 /*
2606 ** CAPI3REF: Pseudo-Random Number Generator
2607 **
2608 ** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
@@ -2619,11 +2621,11 @@
2621 ** ^If the previous call to this routine had an N of 1 or more and a
2622 ** non-NULL P then the pseudo-randomness is generated
2623 ** internally and without recourse to the [sqlite3_vfs] xRandomness
2624 ** method.
2625 */
2626 SQLITE_API void sqlite3_randomness(int N, void *P);
2627
2628 /*
2629 ** CAPI3REF: Compile-Time Authorization Callbacks
2630 ** METHOD: sqlite3
2631 **
@@ -2702,11 +2704,11 @@
2704 ** [sqlite3_prepare()] or its variants. Authorization is not
2705 ** performed during statement evaluation in [sqlite3_step()], unless
2706 ** as stated in the previous paragraph, sqlite3_step() invokes
2707 ** sqlite3_prepare_v2() to reprepare a statement after a schema change.
2708 */
2709 SQLITE_API int sqlite3_set_authorizer(
2710 sqlite3*,
2711 int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
2712 void *pUserData
2713 );
2714
@@ -2810,13 +2812,13 @@
2812 ** digits in the time are meaningless. Future versions of SQLite
2813 ** might provide greater resolution on the profiler callback. The
2814 ** sqlite3_profile() function is considered experimental and is
2815 ** subject to change in future versions of SQLite.
2816 */
2817 SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*,
2818 void(*xTrace)(void*,const char*), void*);
2819 SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,
2820 void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
2821
2822 /*
2823 ** CAPI3REF: SQL Trace Event Codes
2824 ** KEYWORDS: SQLITE_TRACE
@@ -2901,11 +2903,11 @@
2903 **
2904 ** The sqlite3_trace_v2() interface is intended to replace the legacy
2905 ** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which
2906 ** are deprecated.
2907 */
2908 SQLITE_API int sqlite3_trace_v2(
2909 sqlite3*,
2910 unsigned uMask,
2911 int(*xCallback)(unsigned,void*,void*,void*),
2912 void *pCtx
2913 );
@@ -2940,11 +2942,11 @@
2942 ** the database connection that invoked the progress handler.
2943 ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
2944 ** database connections for the meaning of "modify" in this paragraph.
2945 **
2946 */
2947 SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
2948
2949 /*
2950 ** CAPI3REF: Opening A New Database Connection
2951 ** CONSTRUCTOR: sqlite3
2952 **
@@ -3169,19 +3171,19 @@
3171 ** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various
3172 ** features that require the use of temporary files may fail.
3173 **
3174 ** See also: [sqlite3_temp_directory]
3175 */
3176 SQLITE_API int sqlite3_open(
3177 const char *filename, /* Database filename (UTF-8) */
3178 sqlite3 **ppDb /* OUT: SQLite db handle */
3179 );
3180 SQLITE_API int sqlite3_open16(
3181 const void *filename, /* Database filename (UTF-16) */
3182 sqlite3 **ppDb /* OUT: SQLite db handle */
3183 );
3184 SQLITE_API int sqlite3_open_v2(
3185 const char *filename, /* Database filename (UTF-8) */
3186 sqlite3 **ppDb, /* OUT: SQLite db handle */
3187 int flags, /* Flags */
3188 const char *zVfs /* Name of VFS module to use */
3189 );
@@ -3223,13 +3225,13 @@
3225 ** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
3226 ** is not a database file pathname pointer that SQLite passed into the xOpen
3227 ** VFS method, then the behavior of this routine is undefined and probably
3228 ** undesirable.
3229 */
3230 SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
3231 SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
3232 SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
3233
3234
3235 /*
3236 ** CAPI3REF: Error Codes And Messages
3237 ** METHOD: sqlite3
@@ -3269,15 +3271,15 @@
3271 **
3272 ** If an interface fails with SQLITE_MISUSE, that means the interface
3273 ** was invoked incorrectly by the application. In that case, the
3274 ** error code and message may or may not be set.
3275 */
3276 SQLITE_API int sqlite3_errcode(sqlite3 *db);
3277 SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
3278 SQLITE_API const char *sqlite3_errmsg(sqlite3*);
3279 SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
3280 SQLITE_API const char *sqlite3_errstr(int);
3281
3282 /*
3283 ** CAPI3REF: Prepared Statement Object
3284 ** KEYWORDS: {prepared statement} {prepared statements}
3285 **
@@ -3341,11 +3343,11 @@
3343 ** created by an untrusted script can be contained using the
3344 ** [max_page_count] [PRAGMA].
3345 **
3346 ** New run-time limit categories may be added in future releases.
3347 */
3348 SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
3349
3350 /*
3351 ** CAPI3REF: Run-Time Limit Categories
3352 ** KEYWORDS: {limit category} {*limit categories}
3353 **
@@ -3493,32 +3495,32 @@
3495 ** or [GLOB] operator or if the parameter is compared to an indexed column
3496 ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
3497 ** </li>
3498 ** </ol>
3499 */
3500 SQLITE_API int sqlite3_prepare(
3501 sqlite3 *db, /* Database handle */
3502 const char *zSql, /* SQL statement, UTF-8 encoded */
3503 int nByte, /* Maximum length of zSql in bytes. */
3504 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3505 const char **pzTail /* OUT: Pointer to unused portion of zSql */
3506 );
3507 SQLITE_API int sqlite3_prepare_v2(
3508 sqlite3 *db, /* Database handle */
3509 const char *zSql, /* SQL statement, UTF-8 encoded */
3510 int nByte, /* Maximum length of zSql in bytes. */
3511 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3512 const char **pzTail /* OUT: Pointer to unused portion of zSql */
3513 );
3514 SQLITE_API int sqlite3_prepare16(
3515 sqlite3 *db, /* Database handle */
3516 const void *zSql, /* SQL statement, UTF-16 encoded */
3517 int nByte, /* Maximum length of zSql in bytes. */
3518 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3519 const void **pzTail /* OUT: Pointer to unused portion of zSql */
3520 );
3521 SQLITE_API int sqlite3_prepare16_v2(
3522 sqlite3 *db, /* Database handle */
3523 const void *zSql, /* SQL statement, UTF-16 encoded */
3524 int nByte, /* Maximum length of zSql in bytes. */
3525 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3526 const void **pzTail /* OUT: Pointer to unused portion of zSql */
@@ -3553,12 +3555,12 @@
3555 ** automatically freed when the prepared statement is finalized.
3556 ** ^The string returned by sqlite3_expanded_sql(P), on the other hand,
3557 ** is obtained from [sqlite3_malloc()] and must be free by the application
3558 ** by passing it to [sqlite3_free()].
3559 */
3560 SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
3561 SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt);
3562
3563 /*
3564 ** CAPI3REF: Determine If An SQL Statement Writes The Database
3565 ** METHOD: sqlite3_stmt
3566 **
@@ -3586,11 +3588,11 @@
3588 ** database. ^The [ATTACH] and [DETACH] statements also cause
3589 ** sqlite3_stmt_readonly() to return true since, while those statements
3590 ** change the configuration of a database connection, they do not make
3591 ** changes to the content of the database files on disk.
3592 */
3593 SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3594
3595 /*
3596 ** CAPI3REF: Determine If A Prepared Statement Has Been Reset
3597 ** METHOD: sqlite3_stmt
3598 **
@@ -3607,11 +3609,11 @@
3609 ** to locate all prepared statements associated with a database
3610 ** connection that are in need of being reset. This can be used,
3611 ** for example, in diagnostic routines to search for prepared
3612 ** statements that are holding a transaction open.
3613 */
3614 SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
3615
3616 /*
3617 ** CAPI3REF: Dynamically Typed Value Object
3618 ** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
3619 **
@@ -3771,24 +3773,24 @@
3773 ** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails.
3774 **
3775 ** See also: [sqlite3_bind_parameter_count()],
3776 ** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
3777 */
3778 SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
3779 SQLITE_API int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
3780 void(*)(void*));
3781 SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);
3782 SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int);
3783 SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
3784 SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);
3785 SQLITE_API int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
3786 SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
3787 SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
3788 void(*)(void*), unsigned char encoding);
3789 SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
3790 SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
3791 SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
3792
3793 /*
3794 ** CAPI3REF: Number Of SQL Parameters
3795 ** METHOD: sqlite3_stmt
3796 **
@@ -3805,11 +3807,11 @@
3807 **
3808 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
3809 ** [sqlite3_bind_parameter_name()], and
3810 ** [sqlite3_bind_parameter_index()].
3811 */
3812 SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);
3813
3814 /*
3815 ** CAPI3REF: Name Of A Host Parameter
3816 ** METHOD: sqlite3_stmt
3817 **
@@ -3833,11 +3835,11 @@
3835 **
3836 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
3837 ** [sqlite3_bind_parameter_count()], and
3838 ** [sqlite3_bind_parameter_index()].
3839 */
3840 SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
3841
3842 /*
3843 ** CAPI3REF: Index Of A Parameter With A Given Name
3844 ** METHOD: sqlite3_stmt
3845 **
@@ -3850,21 +3852,21 @@
3852 **
3853 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
3854 ** [sqlite3_bind_parameter_count()], and
3855 ** [sqlite3_bind_parameter_name()].
3856 */
3857 SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
3858
3859 /*
3860 ** CAPI3REF: Reset All Bindings On A Prepared Statement
3861 ** METHOD: sqlite3_stmt
3862 **
3863 ** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset
3864 ** the [sqlite3_bind_blob | bindings] on a [prepared statement].
3865 ** ^Use this routine to reset all host parameters to NULL.
3866 */
3867 SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);
3868
3869 /*
3870 ** CAPI3REF: Number Of Columns In A Result Set
3871 ** METHOD: sqlite3_stmt
3872 **
@@ -3872,11 +3874,11 @@
3874 ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
3875 ** statement that does not return data (for example an [UPDATE]).
3876 **
3877 ** See also: [sqlite3_data_count()]
3878 */
3879 SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
3880
3881 /*
3882 ** CAPI3REF: Column Names In A Result Set
3883 ** METHOD: sqlite3_stmt
3884 **
@@ -3901,12 +3903,12 @@
3903 ** ^The name of a result column is the value of the "AS" clause for
3904 ** that column, if there is an AS clause. If there is no AS clause
3905 ** then the name of the column is unspecified and may change from
3906 ** one release of SQLite to the next.
3907 */
3908 SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);
3909 SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
3910
3911 /*
3912 ** CAPI3REF: Source Of Data In A Query Result
3913 ** METHOD: sqlite3_stmt
3914 **
@@ -3950,16 +3952,16 @@
3952 ** If two or more threads call one or more
3953 ** [sqlite3_column_database_name | column metadata interfaces]
3954 ** for the same [prepared statement] and result column
3955 ** at the same time then the results are undefined.
3956 */
3957 SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);
3958 SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
3959 SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int);
3960 SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int);
3961 SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int);
3962 SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);
3963
3964 /*
3965 ** CAPI3REF: Declared Datatype Of A Query Result
3966 ** METHOD: sqlite3_stmt
3967 **
@@ -3987,12 +3989,12 @@
3989 ** data stored in that column is of the declared type. SQLite is
3990 ** strongly typed, but the typing is dynamic not static. ^Type
3991 ** is associated with individual values, not with the containers
3992 ** used to hold those values.
3993 */
3994 SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int);
3995 SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
3996
3997 /*
3998 ** CAPI3REF: Evaluate An SQL Statement
3999 ** METHOD: sqlite3_stmt
4000 **
@@ -4049,11 +4051,12 @@
4051 ** For all versions of SQLite up to and including 3.6.23.1, a call to
4052 ** [sqlite3_reset()] was required after sqlite3_step() returned anything
4053 ** other than [SQLITE_ROW] before any subsequent invocation of
4054 ** sqlite3_step(). Failure to reset the prepared statement using
4055 ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
4056 ** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
4057 ** sqlite3_step() began
4058 ** calling [sqlite3_reset()] automatically in this circumstance rather
4059 ** than returning [SQLITE_MISUSE]. This is not considered a compatibility
4060 ** break because any application that ever receives an SQLITE_MISUSE error
4061 ** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
4062 ** can be used to restore the legacy behavior.
@@ -4068,11 +4071,11 @@
4071 ** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
4072 ** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
4073 ** then the more specific [error codes] are returned directly
4074 ** by sqlite3_step(). The use of the "v2" interface is recommended.
4075 */
4076 SQLITE_API int sqlite3_step(sqlite3_stmt*);
4077
4078 /*
4079 ** CAPI3REF: Number of columns in a result set
4080 ** METHOD: sqlite3_stmt
4081 **
@@ -4089,11 +4092,11 @@
4092 ** where it always returns zero since each step of that multi-step
4093 ** pragma returns 0 columns of data.
4094 **
4095 ** See also: [sqlite3_column_count()]
4096 */
4097 SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
4098
4099 /*
4100 ** CAPI3REF: Fundamental Datatypes
4101 ** KEYWORDS: SQLITE_TEXT
4102 **
@@ -4279,20 +4282,20 @@
4282 ** of these routines, a default value is returned. The default value
4283 ** is either the integer 0, the floating point number 0.0, or a NULL
4284 ** pointer. Subsequent calls to [sqlite3_errcode()] will return
4285 ** [SQLITE_NOMEM].)^
4286 */
4287 SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
4288 SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
4289 SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
4290 SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
4291 SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
4292 SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
4293 SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
4294 SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
4295 SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
4296 SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
4297
4298 /*
4299 ** CAPI3REF: Destroy A Prepared Statement Object
4300 ** DESTRUCTOR: sqlite3_stmt
4301 **
@@ -4316,11 +4319,11 @@
4319 ** resource leaks. It is a grievous error for the application to try to use
4320 ** a prepared statement after it has been finalized. Any use of a prepared
4321 ** statement after it has been finalized can result in undefined and
4322 ** undesirable behavior such as segfaults and heap corruption.
4323 */
4324 SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
4325
4326 /*
4327 ** CAPI3REF: Reset A Prepared Statement Object
4328 ** METHOD: sqlite3_stmt
4329 **
@@ -4343,11 +4346,11 @@
4346 ** [sqlite3_reset(S)] returns an appropriate [error code].
4347 **
4348 ** ^The [sqlite3_reset(S)] interface does not change the values
4349 ** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
4350 */
4351 SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
4352
4353 /*
4354 ** CAPI3REF: Create Or Redefine SQL Functions
4355 ** KEYWORDS: {function creation routines}
4356 ** KEYWORDS: {application-defined SQL function}
@@ -4443,31 +4446,31 @@
4446 ** ^An application-defined function is permitted to call other
4447 ** SQLite interfaces. However, such calls must not
4448 ** close the database connection nor finalize or reset the prepared
4449 ** statement in which the function is running.
4450 */
4451 SQLITE_API int sqlite3_create_function(
4452 sqlite3 *db,
4453 const char *zFunctionName,
4454 int nArg,
4455 int eTextRep,
4456 void *pApp,
4457 void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
4458 void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4459 void (*xFinal)(sqlite3_context*)
4460 );
4461 SQLITE_API int sqlite3_create_function16(
4462 sqlite3 *db,
4463 const void *zFunctionName,
4464 int nArg,
4465 int eTextRep,
4466 void *pApp,
4467 void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
4468 void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4469 void (*xFinal)(sqlite3_context*)
4470 );
4471 SQLITE_API int sqlite3_create_function_v2(
4472 sqlite3 *db,
4473 const char *zFunctionName,
4474 int nArg,
4475 int eTextRep,
4476 void *pApp,
@@ -4509,16 +4512,16 @@
4512 ** to be supported. However, new applications should avoid
4513 ** the use of these functions. To encourage programmers to avoid
4514 ** these functions, we will not explain what they do.
4515 */
4516 #ifndef SQLITE_OMIT_DEPRECATED
4517 SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);
4518 SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);
4519 SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
4520 SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);
4521 SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
4522 SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
4523 void*,sqlite3_int64);
4524 #endif
4525
4526 /*
4527 ** CAPI3REF: Obtaining SQL Values
@@ -4564,22 +4567,22 @@
4567 ** or [sqlite3_value_text16()].
4568 **
4569 ** These routines must be called from the same thread as
4570 ** the SQL function that supplied the [sqlite3_value*] parameters.
4571 */
4572 SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
4573 SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
4574 SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
4575 SQLITE_API double sqlite3_value_double(sqlite3_value*);
4576 SQLITE_API int sqlite3_value_int(sqlite3_value*);
4577 SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
4578 SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
4579 SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
4580 SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
4581 SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
4582 SQLITE_API int sqlite3_value_type(sqlite3_value*);
4583 SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
4584
4585 /*
4586 ** CAPI3REF: Finding The Subtype Of SQL Values
4587 ** METHOD: sqlite3_value
4588 **
@@ -4591,11 +4594,11 @@
4594 **
4595 ** SQLite makes no use of subtype itself. It merely passes the subtype
4596 ** from the result of one [application-defined SQL function] into the
4597 ** input of another.
4598 */
4599 SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
4600
4601 /*
4602 ** CAPI3REF: Copy And Free SQL Values
4603 ** METHOD: sqlite3_value
4604 **
@@ -4607,12 +4610,12 @@
4610 **
4611 ** ^The sqlite3_value_free(V) interface frees an [sqlite3_value] object
4612 ** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
4613 ** then sqlite3_value_free(V) is a harmless no-op.
4614 */
4615 SQLITE_API sqlite3_value *sqlite3_value_dup(const sqlite3_value*);
4616 SQLITE_API void sqlite3_value_free(sqlite3_value*);
4617
4618 /*
4619 ** CAPI3REF: Obtain Aggregate Function Context
4620 ** METHOD: sqlite3_context
4621 **
@@ -4653,11 +4656,11 @@
4656 ** function.
4657 **
4658 ** This routine must be called from the same thread in which
4659 ** the aggregate SQL function is running.
4660 */
4661 SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
4662
4663 /*
4664 ** CAPI3REF: User Data For Functions
4665 ** METHOD: sqlite3_context
4666 **
@@ -4668,11 +4671,11 @@
4671 ** registered the application defined function.
4672 **
4673 ** This routine must be called from the same thread in which
4674 ** the application-defined function is running.
4675 */
4676 SQLITE_API void *sqlite3_user_data(sqlite3_context*);
4677
4678 /*
4679 ** CAPI3REF: Database Connection For Functions
4680 ** METHOD: sqlite3_context
4681 **
@@ -4680,11 +4683,11 @@
4683 ** the pointer to the [database connection] (the 1st parameter)
4684 ** of the [sqlite3_create_function()]
4685 ** and [sqlite3_create_function16()] routines that originally
4686 ** registered the application defined function.
4687 */
4688 SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
4689
4690 /*
4691 ** CAPI3REF: Function Auxiliary Data
4692 ** METHOD: sqlite3_context
4693 **
@@ -4734,12 +4737,12 @@
4737 ** values and [parameters] and expressions composed from the same.)^
4738 **
4739 ** These routines must be called from the same thread in which
4740 ** the SQL function is running.
4741 */
4742 SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);
4743 SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
4744
4745
4746 /*
4747 ** CAPI3REF: Constants Defining Special Destructor Behavior
4748 **
@@ -4871,31 +4874,31 @@
4874 **
4875 ** If these routines are called from within the different thread
4876 ** than the one containing the application-defined function that received
4877 ** the [sqlite3_context] pointer, the results are undefined.
4878 */
4879 SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
4880 SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,
4881 sqlite3_uint64,void(*)(void*));
4882 SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
4883 SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
4884 SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
4885 SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
4886 SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
4887 SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int);
4888 SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
4889 SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
4890 SQLITE_API void sqlite3_result_null(sqlite3_context*);
4891 SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
4892 SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
4893 void(*)(void*), unsigned char encoding);
4894 SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
4895 SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
4896 SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
4897 SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
4898 SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
4899 SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
4900
4901
4902 /*
4903 ** CAPI3REF: Setting The Subtype Of An SQL Function
4904 ** METHOD: sqlite3_context
@@ -4906,11 +4909,11 @@
4909 ** of the subtype T are preserved in current versions of SQLite;
4910 ** higher order bits are discarded.
4911 ** The number of subtype bytes preserved by SQLite might increase
4912 ** in future releases of SQLite.
4913 */
4914 SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int);
4915
4916 /*
4917 ** CAPI3REF: Define New Collating Sequences
4918 ** METHOD: sqlite3
4919 **
@@ -4988,26 +4991,26 @@
4991 ** is unfortunate but cannot be changed without breaking backwards
4992 ** compatibility.
4993 **
4994 ** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
4995 */
4996 SQLITE_API int sqlite3_create_collation(
4997 sqlite3*,
4998 const char *zName,
4999 int eTextRep,
5000 void *pArg,
5001 int(*xCompare)(void*,int,const void*,int,const void*)
5002 );
5003 SQLITE_API int sqlite3_create_collation_v2(
5004 sqlite3*,
5005 const char *zName,
5006 int eTextRep,
5007 void *pArg,
5008 int(*xCompare)(void*,int,const void*,int,const void*),
5009 void(*xDestroy)(void*)
5010 );
5011 SQLITE_API int sqlite3_create_collation16(
5012 sqlite3*,
5013 const void *zName,
5014 int eTextRep,
5015 void *pArg,
5016 int(*xCompare)(void*,int,const void*,int,const void*)
@@ -5038,16 +5041,16 @@
5041 **
5042 ** The callback function should register the desired collation using
5043 ** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
5044 ** [sqlite3_create_collation_v2()].
5045 */
5046 SQLITE_API int sqlite3_collation_needed(
5047 sqlite3*,
5048 void*,
5049 void(*)(void*,sqlite3*,int eTextRep,const char*)
5050 );
5051 SQLITE_API int sqlite3_collation_needed16(
5052 sqlite3*,
5053 void*,
5054 void(*)(void*,sqlite3*,int eTextRep,const void*)
5055 );
5056
@@ -5057,15 +5060,15 @@
5060 ** called right after sqlite3_open().
5061 **
5062 ** The code to implement this API is not available in the public release
5063 ** of SQLite.
5064 */
5065 SQLITE_API int sqlite3_key(
5066 sqlite3 *db, /* Database to be rekeyed */
5067 const void *pKey, int nKey /* The key */
5068 );
5069 SQLITE_API int sqlite3_key_v2(
5070 sqlite3 *db, /* Database to be rekeyed */
5071 const char *zDbName, /* Name of the database */
5072 const void *pKey, int nKey /* The key */
5073 );
5074
@@ -5075,35 +5078,35 @@
5078 ** database is decrypted.
5079 **
5080 ** The code to implement this API is not available in the public release
5081 ** of SQLite.
5082 */
5083 SQLITE_API int sqlite3_rekey(
5084 sqlite3 *db, /* Database to be rekeyed */
5085 const void *pKey, int nKey /* The new key */
5086 );
5087 SQLITE_API int sqlite3_rekey_v2(
5088 sqlite3 *db, /* Database to be rekeyed */
5089 const char *zDbName, /* Name of the database */
5090 const void *pKey, int nKey /* The new key */
5091 );
5092
5093 /*
5094 ** Specify the activation key for a SEE database. Unless
5095 ** activated, none of the SEE routines will work.
5096 */
5097 SQLITE_API void sqlite3_activate_see(
5098 const char *zPassPhrase /* Activation phrase */
5099 );
5100 #endif
5101
5102 #ifdef SQLITE_ENABLE_CEROD
5103 /*
5104 ** Specify the activation key for a CEROD database. Unless
5105 ** activated, none of the CEROD routines will work.
5106 */
5107 SQLITE_API void sqlite3_activate_cerod(
5108 const char *zPassPhrase /* Activation phrase */
5109 );
5110 #endif
5111
5112 /*
@@ -5121,11 +5124,11 @@
5124 ** method of the default [sqlite3_vfs] object. If the xSleep() method
5125 ** of the default VFS is not implemented correctly, or not implemented at
5126 ** all, then the behavior of sqlite3_sleep() may deviate from the description
5127 ** in the previous paragraphs.
5128 */
5129 SQLITE_API int sqlite3_sleep(int);
5130
5131 /*
5132 ** CAPI3REF: Name Of The Folder Holding Temporary Files
5133 **
5134 ** ^(If this global variable is made to point to a string which is
@@ -5240,11 +5243,11 @@
5243 **
5244 ** If another thread changes the autocommit status of the database
5245 ** connection while this routine is running, then the return value
5246 ** is undefined.
5247 */
5248 SQLITE_API int sqlite3_get_autocommit(sqlite3*);
5249
5250 /*
5251 ** CAPI3REF: Find The Database Handle Of A Prepared Statement
5252 ** METHOD: sqlite3_stmt
5253 **
@@ -5253,11 +5256,11 @@
5256 ** returned by sqlite3_db_handle is the same [database connection]
5257 ** that was the first argument
5258 ** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
5259 ** create the statement in the first place.
5260 */
5261 SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
5262
5263 /*
5264 ** CAPI3REF: Return The Filename For A Database Connection
5265 ** METHOD: sqlite3
5266 **
@@ -5270,21 +5273,21 @@
5273 ** ^The filename returned by this function is the output of the
5274 ** xFullPathname method of the [VFS]. ^In other words, the filename
5275 ** will be an absolute pathname, even if the filename used
5276 ** to open the database originally was a URI or relative pathname.
5277 */
5278 SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);
5279
5280 /*
5281 ** CAPI3REF: Determine if a database is read-only
5282 ** METHOD: sqlite3
5283 **
5284 ** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N
5285 ** of connection D is read-only, 0 if it is read/write, or -1 if N is not
5286 ** the name of a database on connection D.
5287 */
5288 SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
5289
5290 /*
5291 ** CAPI3REF: Find the next prepared statement
5292 ** METHOD: sqlite3
5293 **
@@ -5296,11 +5299,11 @@
5299 **
5300 ** The [database connection] pointer D in a call to
5301 ** [sqlite3_next_stmt(D,S)] must refer to an open database
5302 ** connection and in particular must not be a NULL pointer.
5303 */
5304 SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
5305
5306 /*
5307 ** CAPI3REF: Commit And Rollback Notification Callbacks
5308 ** METHOD: sqlite3
5309 **
@@ -5345,12 +5348,12 @@
5348 ** ^The rollback callback is not invoked if a transaction is
5349 ** automatically rolled back because the database connection is closed.
5350 **
5351 ** See also the [sqlite3_update_hook()] interface.
5352 */
5353 SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
5354 SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
5355
5356 /*
5357 ** CAPI3REF: Data Change Notification Callbacks
5358 ** METHOD: sqlite3
5359 **
@@ -5397,11 +5400,11 @@
5400 ** the first call on D.
5401 **
5402 ** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()],
5403 ** and [sqlite3_preupdate_hook()] interfaces.
5404 */
5405 SQLITE_API void *sqlite3_update_hook(
5406 sqlite3*,
5407 void(*)(void *,int ,char const *,char const *,sqlite3_int64),
5408 void*
5409 );
5410
@@ -5412,11 +5415,12 @@
5415 ** and schema data structures between [database connection | connections]
5416 ** to the same database. Sharing is enabled if the argument is true
5417 ** and disabled if the argument is false.)^
5418 **
5419 ** ^Cache sharing is enabled and disabled for an entire process.
5420 ** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]).
5421 ** In prior versions of SQLite,
5422 ** sharing was enabled or disabled for each thread separately.
5423 **
5424 ** ^(The cache sharing mode set by this interface effects all subsequent
5425 ** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
5426 ** Existing database connections continue use the sharing mode
@@ -5437,11 +5441,11 @@
5441 ** This interface is threadsafe on processors where writing a
5442 ** 32-bit integer is atomic.
5443 **
5444 ** See Also: [SQLite Shared-Cache Mode]
5445 */
5446 SQLITE_API int sqlite3_enable_shared_cache(int);
5447
5448 /*
5449 ** CAPI3REF: Attempt To Free Heap Memory
5450 **
5451 ** ^The sqlite3_release_memory() interface attempts to free N bytes
@@ -5453,11 +5457,11 @@
5457 ** ^The sqlite3_release_memory() routine is a no-op returning zero
5458 ** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT].
5459 **
5460 ** See also: [sqlite3_db_release_memory()]
5461 */
5462 SQLITE_API int sqlite3_release_memory(int);
5463
5464 /*
5465 ** CAPI3REF: Free Memory Used By A Database Connection
5466 ** METHOD: sqlite3
5467 **
@@ -5467,11 +5471,11 @@
5471 ** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is
5472 ** omitted.
5473 **
5474 ** See also: [sqlite3_release_memory()]
5475 */
5476 SQLITE_API int sqlite3_db_release_memory(sqlite3*);
5477
5478 /*
5479 ** CAPI3REF: Impose A Limit On Heap Size
5480 **
5481 ** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
@@ -5506,11 +5510,12 @@
5510 ** <li> The page cache allocates from its own memory pool supplied
5511 ** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
5512 ** from the heap.
5513 ** </ul>)^
5514 **
5515 ** Beginning with SQLite [version 3.7.3] ([dateof:3.7.3]),
5516 ** the soft heap limit is enforced
5517 ** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT]
5518 ** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT],
5519 ** the soft heap limit is enforced on every memory allocation. Without
5520 ** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced
5521 ** when memory is allocated by the page cache. Testing suggests that because
@@ -5519,11 +5524,11 @@
5524 ** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT].
5525 **
5526 ** The circumstances under which SQLite will enforce the soft heap limit may
5527 ** changes in future releases of SQLite.
5528 */
5529 SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
5530
5531 /*
5532 ** CAPI3REF: Deprecated Soft Heap Limit Interface
5533 ** DEPRECATED
5534 **
@@ -5530,11 +5535,11 @@
5535 ** This is a deprecated version of the [sqlite3_soft_heap_limit64()]
5536 ** interface. This routine is provided for historical compatibility
5537 ** only. All new applications should use the
5538 ** [sqlite3_soft_heap_limit64()] interface rather than this one.
5539 */
5540 SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
5541
5542
5543 /*
5544 ** CAPI3REF: Extract Metadata About A Column Of A Table
5545 ** METHOD: sqlite3
@@ -5600,11 +5605,11 @@
5605 **
5606 ** ^This function causes all database schemas to be read from disk and
5607 ** parsed, if that has not already been done, and returns an error if
5608 ** any errors are encountered while loading the schema.
5609 */
5610 SQLITE_API int sqlite3_table_column_metadata(
5611 sqlite3 *db, /* Connection handle */
5612 const char *zDbName, /* Database name or NULL */
5613 const char *zTableName, /* Table name */
5614 const char *zColumnName, /* Column name */
5615 char const **pzDataType, /* OUTPUT: Declared data type */
@@ -5656,11 +5661,11 @@
5661 ** disabled and prevent SQL injections from giving attackers
5662 ** access to extension loading capabilities.
5663 **
5664 ** See also the [load_extension() SQL function].
5665 */
5666 SQLITE_API int sqlite3_load_extension(
5667 sqlite3 *db, /* Load the extension into this database connection */
5668 const char *zFile, /* Name of the shared library containing extension */
5669 const char *zProc, /* Entry point. Derived from zFile if 0 */
5670 char **pzErrMsg /* Put error message here if not 0 */
5671 );
@@ -5688,11 +5693,11 @@
5693 ** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method
5694 ** rather than this interface, so the [load_extension()] SQL function
5695 ** remains disabled. This will prevent SQL injections from giving attackers
5696 ** access to extension loading capabilities.
5697 */
5698 SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
5699
5700 /*
5701 ** CAPI3REF: Automatically Load Statically Linked Extensions
5702 **
5703 ** ^This interface causes the xEntryPoint() function to be invoked for
@@ -5726,11 +5731,11 @@
5731 ** will be called more than once for each database connection that is opened.
5732 **
5733 ** See also: [sqlite3_reset_auto_extension()]
5734 ** and [sqlite3_cancel_auto_extension()]
5735 */
5736 SQLITE_API int sqlite3_auto_extension(void(*xEntryPoint)(void));
5737
5738 /*
5739 ** CAPI3REF: Cancel Automatic Extension Loading
5740 **
5741 ** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
@@ -5738,19 +5743,19 @@
5743 ** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)]
5744 ** routine returns 1 if initialization routine X was successfully
5745 ** unregistered and it returns 0 if X was not on the list of initialization
5746 ** routines.
5747 */
5748 SQLITE_API int sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
5749
5750 /*
5751 ** CAPI3REF: Reset Automatic Extension Loading
5752 **
5753 ** ^This interface disables all automatic extensions previously
5754 ** registered using [sqlite3_auto_extension()].
5755 */
5756 SQLITE_API void sqlite3_reset_auto_extension(void);
5757
5758 /*
5759 ** The interface to the virtual-table mechanism is currently considered
5760 ** to be experimental. The interface might change in incompatible ways.
5761 ** If this is a problem for you, do not use the interface at this time.
@@ -5900,17 +5905,19 @@
5905 ** before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
5906 ** set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
5907 ** the xUpdate method are automatically rolled back by SQLite.
5908 **
5909 ** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
5910 ** structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
5911 ** If a virtual table extension is
5912 ** used with an SQLite version earlier than 3.8.2, the results of attempting
5913 ** to read or write the estimatedRows field are undefined (but are likely
5914 ** to included crashing the application). The estimatedRows field should
5915 ** therefore only be used if [sqlite3_libversion_number()] returns a
5916 ** value greater than or equal to 3008002. Similarly, the idxFlags field
5917 ** was added for [version 3.9.0] ([dateof:3.9.0]).
5918 ** It may therefore only be used if
5919 ** sqlite3_libversion_number() returns a value greater than or equal to
5920 ** 3009000.
5921 */
5922 struct sqlite3_index_info {
5923 /* Inputs */
@@ -5991,17 +5998,17 @@
5998 ** be invoked if the call to sqlite3_create_module_v2() fails.
5999 ** ^The sqlite3_create_module()
6000 ** interface is equivalent to sqlite3_create_module_v2() with a NULL
6001 ** destructor.
6002 */
6003 SQLITE_API int sqlite3_create_module(
6004 sqlite3 *db, /* SQLite connection to register module with */
6005 const char *zName, /* Name of the module */
6006 const sqlite3_module *p, /* Methods for the module */
6007 void *pClientData /* Client data for xCreate/xConnect */
6008 );
6009 SQLITE_API int sqlite3_create_module_v2(
6010 sqlite3 *db, /* SQLite connection to register module with */
6011 const char *zName, /* Name of the module */
6012 const sqlite3_module *p, /* Methods for the module */
6013 void *pClientData, /* Client data for xCreate/xConnect */
6014 void(*xDestroy)(void*) /* Module destructor function */
@@ -6060,11 +6067,11 @@
6067 ** ^The [xCreate] and [xConnect] methods of a
6068 ** [virtual table module] call this interface
6069 ** to declare the format (the names and datatypes of the columns) of
6070 ** the virtual tables they implement.
6071 */
6072 SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
6073
6074 /*
6075 ** CAPI3REF: Overload A Function For A Virtual Table
6076 ** METHOD: sqlite3
6077 **
@@ -6079,11 +6086,11 @@
6086 ** of the new function always causes an exception to be thrown. So
6087 ** the new function is not good for anything by itself. Its only
6088 ** purpose is to be a placeholder function that can be overloaded
6089 ** by a [virtual table].
6090 */
6091 SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
6092
6093 /*
6094 ** The interface to the virtual-table mechanism defined above (back up
6095 ** to a comment remarkably similar to this one) is currently considered
6096 ** to be experimental. The interface might change in incompatible ways.
@@ -6178,11 +6185,11 @@
6185 ** zero-filled blob to read or write using the incremental-blob interface.
6186 **
6187 ** To avoid a resource leak, every open [BLOB handle] should eventually
6188 ** be released by a call to [sqlite3_blob_close()].
6189 */
6190 SQLITE_API int sqlite3_blob_open(
6191 sqlite3*,
6192 const char *zDb,
6193 const char *zTable,
6194 const char *zColumn,
6195 sqlite3_int64 iRow,
@@ -6211,11 +6218,11 @@
6218 ** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle
6219 ** always returns zero.
6220 **
6221 ** ^This function sets the database handle error code and message.
6222 */
6223 SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
6224
6225 /*
6226 ** CAPI3REF: Close A BLOB Handle
6227 ** DESTRUCTOR: sqlite3_blob
6228 **
@@ -6234,11 +6241,11 @@
6241 ** with a null pointer (such as would be returned by a failed call to
6242 ** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
6243 ** is passed a valid open blob handle, the values returned by the
6244 ** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
6245 */
6246 SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
6247
6248 /*
6249 ** CAPI3REF: Return The Size Of An Open BLOB
6250 ** METHOD: sqlite3_blob
6251 **
@@ -6250,11 +6257,11 @@
6257 ** This routine only works on a [BLOB handle] which has been created
6258 ** by a prior successful call to [sqlite3_blob_open()] and which has not
6259 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
6260 ** to this routine results in undefined and probably undesirable behavior.
6261 */
6262 SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);
6263
6264 /*
6265 ** CAPI3REF: Read Data From A BLOB Incrementally
6266 ** METHOD: sqlite3_blob
6267 **
@@ -6279,11 +6286,11 @@
6286 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
6287 ** to this routine results in undefined and probably undesirable behavior.
6288 **
6289 ** See also: [sqlite3_blob_write()].
6290 */
6291 SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
6292
6293 /*
6294 ** CAPI3REF: Write Data Into A BLOB Incrementally
6295 ** METHOD: sqlite3_blob
6296 **
@@ -6321,11 +6328,11 @@
6328 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
6329 ** to this routine results in undefined and probably undesirable behavior.
6330 **
6331 ** See also: [sqlite3_blob_read()].
6332 */
6333 SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
6334
6335 /*
6336 ** CAPI3REF: Virtual File System Objects
6337 **
6338 ** A virtual filesystem (VFS) is an [sqlite3_vfs] object
@@ -6352,13 +6359,13 @@
6359 **
6360 ** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.
6361 ** ^(If the default VFS is unregistered, another VFS is chosen as
6362 ** the default. The choice for the new VFS is arbitrary.)^
6363 */
6364 SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
6365 SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
6366 SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
6367
6368 /*
6369 ** CAPI3REF: Mutexes
6370 **
6371 ** The SQLite core uses these routines for thread
@@ -6470,15 +6477,15 @@
6477 ** sqlite3_mutex_leave() is a NULL pointer, then all three routines
6478 ** behave as no-ops.
6479 **
6480 ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
6481 */
6482 SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
6483 SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
6484 SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*);
6485 SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*);
6486 SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
6487
6488 /*
6489 ** CAPI3REF: Mutex Methods Object
6490 **
6491 ** An instance of this structure defines the low-level routines
@@ -6584,12 +6591,12 @@
6591 ** call to sqlite3_mutex_held() to fail, so a non-zero return is
6592 ** the appropriate thing to do. The sqlite3_mutex_notheld()
6593 ** interface should also return 1 when given a NULL pointer.
6594 */
6595 #ifndef NDEBUG
6596 SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
6597 SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
6598 #endif
6599
6600 /*
6601 ** CAPI3REF: Mutex Types
6602 **
@@ -6604,11 +6611,11 @@
6611 #define SQLITE_MUTEX_RECURSIVE 1
6612 #define SQLITE_MUTEX_STATIC_MASTER 2
6613 #define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */
6614 #define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */
6615 #define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */
6616 #define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_randomness() */
6617 #define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
6618 #define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */
6619 #define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */
6620 #define SQLITE_MUTEX_STATIC_APP1 8 /* For use by application */
6621 #define SQLITE_MUTEX_STATIC_APP2 9 /* For use by application */
@@ -6625,11 +6632,11 @@
6632 ** serializes access to the [database connection] given in the argument
6633 ** when the [threading mode] is Serialized.
6634 ** ^If the [threading mode] is Single-thread or Multi-thread then this
6635 ** routine returns a NULL pointer.
6636 */
6637 SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
6638
6639 /*
6640 ** CAPI3REF: Low-Level Control Of Database Files
6641 ** METHOD: sqlite3
6642 **
@@ -6660,11 +6667,11 @@
6667 ** an incorrect zDbName and an SQLITE_ERROR return from the underlying
6668 ** xFileControl method.
6669 **
6670 ** See also: [SQLITE_FCNTL_LOCKSTATE]
6671 */
6672 SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
6673
6674 /*
6675 ** CAPI3REF: Testing Interface
6676 **
6677 ** ^The sqlite3_test_control() interface is used to read out internal
@@ -6679,11 +6686,11 @@
6686 ** The details of the operation codes, their meanings, the parameters
6687 ** they take, and what they do are all subject to change without notice.
6688 ** Unlike most of the SQLite API, this function is not guaranteed to
6689 ** operate consistently from one release to the next.
6690 */
6691 SQLITE_API int sqlite3_test_control(int op, ...);
6692
6693 /*
6694 ** CAPI3REF: Testing Interface Operation Codes
6695 **
6696 ** These constants are the valid operation code parameters used
@@ -6708,10 +6715,11 @@
6715 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15
6716 #define SQLITE_TESTCTRL_ISKEYWORD 16
6717 #define SQLITE_TESTCTRL_SCRATCHMALLOC 17
6718 #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
6719 #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
6720 #define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
6721 #define SQLITE_TESTCTRL_NEVER_CORRUPT 20
6722 #define SQLITE_TESTCTRL_VDBE_COVERAGE 21
6723 #define SQLITE_TESTCTRL_BYTEORDER 22
6724 #define SQLITE_TESTCTRL_ISINIT 23
6725 #define SQLITE_TESTCTRL_SORTER_MMAP 24
@@ -6742,12 +6750,12 @@
6750 ** be represented by a 32-bit integer, then the values returned by
6751 ** sqlite3_status() are undefined.
6752 **
6753 ** See also: [sqlite3_db_status()]
6754 */
6755 SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
6756 SQLITE_API int sqlite3_status64(
6757 int op,
6758 sqlite3_int64 *pCurrent,
6759 sqlite3_int64 *pHighwater,
6760 int resetFlag
6761 );
@@ -6868,11 +6876,11 @@
6876 ** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
6877 ** non-zero [error code] on failure.
6878 **
6879 ** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
6880 */
6881 SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
6882
6883 /*
6884 ** CAPI3REF: Status Parameters for database connections
6885 ** KEYWORDS: {SQLITE_DBSTATUS options}
6886 **
@@ -7011,11 +7019,11 @@
7019 ** ^If the resetFlg is true, then the counter is reset to zero after this
7020 ** interface call returns.
7021 **
7022 ** See also: [sqlite3_status()] and [sqlite3_db_status()].
7023 */
7024 SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
7025
7026 /*
7027 ** CAPI3REF: Status Parameters for prepared statements
7028 ** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters}
7029 **
@@ -7480,20 +7488,20 @@
7488 ** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()
7489 ** APIs are not strictly speaking threadsafe. If they are invoked at the
7490 ** same time as another thread is invoking sqlite3_backup_step() it is
7491 ** possible that they return invalid values.
7492 */
7493 SQLITE_API sqlite3_backup *sqlite3_backup_init(
7494 sqlite3 *pDest, /* Destination database handle */
7495 const char *zDestName, /* Destination database name */
7496 sqlite3 *pSource, /* Source database handle */
7497 const char *zSourceName /* Source database name */
7498 );
7499 SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage);
7500 SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p);
7501 SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p);
7502 SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
7503
7504 /*
7505 ** CAPI3REF: Unlock Notification
7506 ** METHOD: sqlite3
7507 **
@@ -7606,11 +7614,11 @@
7614 ** by an sqlite3_step() call. ^(If there is a blocking connection, then the
7615 ** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in
7616 ** the special "DROP TABLE/INDEX" case, the extended error code is just
7617 ** SQLITE_LOCKED.)^
7618 */
7619 SQLITE_API int sqlite3_unlock_notify(
7620 sqlite3 *pBlocked, /* Waiting connection */
7621 void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */
7622 void *pNotifyArg /* Argument to pass to xNotify */
7623 );
7624
@@ -7621,12 +7629,12 @@
7629 ** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications
7630 ** and extensions to compare the contents of two buffers containing UTF-8
7631 ** strings in a case-independent fashion, using the same definition of "case
7632 ** independence" that SQLite uses internally when comparing identifiers.
7633 */
7634 SQLITE_API int sqlite3_stricmp(const char *, const char *);
7635 SQLITE_API int sqlite3_strnicmp(const char *, const char *, int);
7636
7637 /*
7638 ** CAPI3REF: String Globbing
7639 *
7640 ** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if
@@ -7639,11 +7647,11 @@
7647 ** Note that this routine returns zero on a match and non-zero if the strings
7648 ** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
7649 **
7650 ** See also: [sqlite3_strlike()].
7651 */
7652 SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr);
7653
7654 /*
7655 ** CAPI3REF: String LIKE Matching
7656 *
7657 ** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if
@@ -7662,11 +7670,11 @@
7670 ** Note that this routine returns zero on a match and non-zero if the strings
7671 ** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
7672 **
7673 ** See also: [sqlite3_strglob()].
7674 */
7675 SQLITE_API int sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc);
7676
7677 /*
7678 ** CAPI3REF: Error Logging Interface
7679 **
7680 ** ^The [sqlite3_log()] interface writes a message into the [error log]
@@ -7685,11 +7693,11 @@
7693 ** will not use dynamically allocated memory. The log message is stored in
7694 ** a fixed-length buffer on the stack. If the log message is longer than
7695 ** a few hundred characters, it will be truncated to the length of the
7696 ** buffer.
7697 */
7698 SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
7699
7700 /*
7701 ** CAPI3REF: Write-Ahead Log Commit Hook
7702 ** METHOD: sqlite3
7703 **
@@ -7721,11 +7729,11 @@
7729 ** previously registered write-ahead log callback. ^Note that the
7730 ** [sqlite3_wal_autocheckpoint()] interface and the
7731 ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
7732 ** overwrite any prior [sqlite3_wal_hook()] settings.
7733 */
7734 SQLITE_API void *sqlite3_wal_hook(
7735 sqlite3*,
7736 int(*)(void *,sqlite3*,const char*,int),
7737 void*
7738 );
7739
@@ -7756,11 +7764,11 @@
7764 ** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
7765 ** pages. The use of this interface
7766 ** is only necessary if the default setting is found to be suboptimal
7767 ** for a particular application.
7768 */
7769 SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
7770
7771 /*
7772 ** CAPI3REF: Checkpoint a database
7773 ** METHOD: sqlite3
7774 **
@@ -7778,11 +7786,11 @@
7786 ** interface was added. This interface is retained for backwards
7787 ** compatibility and as a convenience for applications that need to manually
7788 ** start a callback but which do not need the full power (and corresponding
7789 ** complication) of [sqlite3_wal_checkpoint_v2()].
7790 */
7791 SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
7792
7793 /*
7794 ** CAPI3REF: Checkpoint a database
7795 ** METHOD: sqlite3
7796 **
@@ -7872,11 +7880,11 @@
7880 ** [sqlite3_errcode()] and [sqlite3_errmsg()].
7881 **
7882 ** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
7883 ** from SQL.
7884 */
7885 SQLITE_API int sqlite3_wal_checkpoint_v2(
7886 sqlite3 *db, /* Database handle */
7887 const char *zDb, /* Name of attached database (or NULL) */
7888 int eMode, /* SQLITE_CHECKPOINT_* value */
7889 int *pnLog, /* OUT: Size of WAL log in frames */
7890 int *pnCkpt /* OUT: Total number of frames checkpointed */
@@ -7908,11 +7916,11 @@
7916 **
7917 ** At present, there is only one option that may be configured using
7918 ** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].) Further options
7919 ** may be added in the future.
7920 */
7921 SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
7922
7923 /*
7924 ** CAPI3REF: Virtual Table Configuration Options
7925 **
7926 ** These macros define the various options to the
@@ -7961,11 +7969,11 @@
7969 ** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],
7970 ** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode
7971 ** of the SQL statement that triggered the call to the [xUpdate] method of the
7972 ** [virtual table].
7973 */
7974 SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);
7975
7976 /*
7977 ** CAPI3REF: Conflict resolution modes
7978 ** KEYWORDS: {conflict resolution mode}
7979 **
@@ -8066,11 +8074,11 @@
8074 ** as if the loop did not exist - it returns non-zero and leave the variable
8075 ** that pOut points to unchanged.
8076 **
8077 ** See also: [sqlite3_stmt_scanstatus_reset()]
8078 */
8079 SQLITE_API int sqlite3_stmt_scanstatus(
8080 sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
8081 int idx, /* Index of loop to report on */
8082 int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
8083 void *pOut /* Result written here */
8084 );
@@ -8082,11 +8090,11 @@
8090 ** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.
8091 **
8092 ** This API is only available if the library is built with pre-processor
8093 ** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
8094 */
8095 SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
8096
8097 /*
8098 ** CAPI3REF: Flush caches to disk mid-transaction
8099 **
8100 ** ^If a write-transaction is open on [database connection] D when the
@@ -8114,11 +8122,11 @@
8122 ** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK.
8123 **
8124 ** ^This function does not set the database handle error code or message
8125 ** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.
8126 */
8127 SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
8128
8129 /*
8130 ** CAPI3REF: The pre-update hook.
8131 **
8132 ** ^These interfaces are only available if SQLite is compiled using the
@@ -8194,11 +8202,11 @@
8202 ** triggers; or 2 for changes resulting from triggers called by top-level
8203 ** triggers; and so forth.
8204 **
8205 ** See also: [sqlite3_update_hook()]
8206 */
8207 SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_preupdate_hook(
8208 sqlite3 *db,
8209 void(*xPreUpdate)(
8210 void *pCtx, /* Copy of third arg to preupdate_hook() */
8211 sqlite3 *db, /* Database handle */
8212 int op, /* SQLITE_UPDATE, DELETE or INSERT */
@@ -8207,14 +8215,14 @@
8215 sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */
8216 sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */
8217 ),
8218 void*
8219 );
8220 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);
8221 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_count(sqlite3 *);
8222 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_depth(sqlite3 *);
8223 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
8224
8225 /*
8226 ** CAPI3REF: Low-level system error code
8227 **
8228 ** ^Attempt to return the underlying operating system error code or error
@@ -8222,11 +8230,11 @@
8230 ** The return value is OS-dependent. For example, on unix systems, after
8231 ** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be
8232 ** called to get back the underlying "errno" that caused the problem, such
8233 ** as ENOSPC, EAUTH, EISDIR, and so forth.
8234 */
8235 SQLITE_API int sqlite3_system_errno(sqlite3*);
8236
8237 /*
8238 ** CAPI3REF: Database Snapshot
8239 ** KEYWORDS: {snapshot}
8240 ** EXPERIMENTAL
@@ -8272,11 +8280,11 @@
8280 ** to avoid a memory leak.
8281 **
8282 ** The [sqlite3_snapshot_get()] interface is only available when the
8283 ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8284 */
8285 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
8286 sqlite3 *db,
8287 const char *zSchema,
8288 sqlite3_snapshot **ppSnapshot
8289 );
8290
@@ -8310,11 +8318,11 @@
8318 ** database connection in order to make it ready to use snapshots.)
8319 **
8320 ** The [sqlite3_snapshot_open()] interface is only available when the
8321 ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8322 */
8323 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(
8324 sqlite3 *db,
8325 const char *zSchema,
8326 sqlite3_snapshot *pSnapshot
8327 );
8328
@@ -8327,11 +8335,11 @@
8335 ** using this routine to avoid a memory leak.
8336 **
8337 ** The [sqlite3_snapshot_free()] interface is only available when the
8338 ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8339 */
8340 SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);
8341
8342 /*
8343 ** CAPI3REF: Compare the ages of two snapshot handles.
8344 ** EXPERIMENTAL
8345 **
@@ -8351,11 +8359,11 @@
8359 **
8360 ** Otherwise, this API returns a negative value if P1 refers to an older
8361 ** snapshot than P2, zero if the two handles refer to the same database
8362 ** snapshot, and a positive value if P1 is a newer snapshot than P2.
8363 */
8364 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(
8365 sqlite3_snapshot *p1,
8366 sqlite3_snapshot *p2
8367 );
8368
8369 /*
@@ -8409,11 +8417,11 @@
8417 ** Register a geometry callback named zGeom that can be used as part of an
8418 ** R-Tree geometry query as follows:
8419 **
8420 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
8421 */
8422 SQLITE_API int sqlite3_rtree_geometry_callback(
8423 sqlite3 *db,
8424 const char *zGeom,
8425 int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),
8426 void *pContext
8427 );
@@ -8435,11 +8443,11 @@
8443 ** Register a 2nd-generation geometry callback named zScore that can be
8444 ** used as part of an R-Tree geometry query as follows:
8445 **
8446 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
8447 */
8448 SQLITE_API int sqlite3_rtree_query_callback(
8449 sqlite3 *db,
8450 const char *zQueryFunc,
8451 int (*xQueryFunc)(sqlite3_rtree_query_info*),
8452 void *pContext,
8453 void (*xDestructor)(void*)
8454
--- win/Makefile.PellesCGMake
+++ win/Makefile.PellesCGMake
@@ -83,11 +83,11 @@
8383
8484
# define the SQLite files, which need special flags on compile
8585
SQLITESRC=sqlite3.c
8686
ORIGSQLITESRC=$(foreach sf,$(SQLITESRC),$(SRCDIR)$(sf))
8787
SQLITEOBJ=$(foreach sf,$(SQLITESRC),$(sf:.c=.obj))
88
-SQLITEDEFINES=-DNDEBUG=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_OMIT_DEPRECATED -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_WIN32_NO_ANSI
88
+SQLITEDEFINES=-DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_WIN32_NO_ANSI
8989
9090
# define the SQLite shell files, which need special flags on compile
9191
SQLITESHELLSRC=shell.c
9292
ORIGSQLITESHELLSRC=$(foreach sf,$(SQLITESHELLSRC),$(SRCDIR)$(sf))
9393
SQLITESHELLOBJ=$(foreach sf,$(SQLITESHELLSRC),$(sf:.c=.obj))
9494
--- win/Makefile.PellesCGMake
+++ win/Makefile.PellesCGMake
@@ -83,11 +83,11 @@
83
84 # define the SQLite files, which need special flags on compile
85 SQLITESRC=sqlite3.c
86 ORIGSQLITESRC=$(foreach sf,$(SQLITESRC),$(SRCDIR)$(sf))
87 SQLITEOBJ=$(foreach sf,$(SQLITESRC),$(sf:.c=.obj))
88 SQLITEDEFINES=-DNDEBUG=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_OMIT_DEPRECATED -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_WIN32_NO_ANSI
89
90 # define the SQLite shell files, which need special flags on compile
91 SQLITESHELLSRC=shell.c
92 ORIGSQLITESHELLSRC=$(foreach sf,$(SQLITESHELLSRC),$(SRCDIR)$(sf))
93 SQLITESHELLOBJ=$(foreach sf,$(SQLITESHELLSRC),$(sf:.c=.obj))
94
--- win/Makefile.PellesCGMake
+++ win/Makefile.PellesCGMake
@@ -83,11 +83,11 @@
83
84 # define the SQLite files, which need special flags on compile
85 SQLITESRC=sqlite3.c
86 ORIGSQLITESRC=$(foreach sf,$(SQLITESRC),$(SRCDIR)$(sf))
87 SQLITEOBJ=$(foreach sf,$(SQLITESRC),$(sf:.c=.obj))
88 SQLITEDEFINES=-DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_WIN32_NO_ANSI
89
90 # define the SQLite shell files, which need special flags on compile
91 SQLITESHELLSRC=shell.c
92 ORIGSQLITESHELLSRC=$(foreach sf,$(SQLITESHELLSRC),$(SRCDIR)$(sf))
93 SQLITESHELLOBJ=$(foreach sf,$(SQLITESHELLSRC),$(sf:.c=.obj))
94
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -24,11 +24,11 @@
2424
CFLAGS = -o
2525
BCC = $(DMDIR)\bin\dmc $(CFLAGS)
2626
TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
2727
LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32
2828
29
-SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_OMIT_DEPRECATED -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5
29
+SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5
3030
3131
SHELL_OPTIONS = -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
3232
3333
SRC = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c event_.c export_.c file_.c finfo_.c foci_.c fshell_.c fusefs_.c glob_.c graph_.c gzip_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c setup_.c sha1_.c shun_.c sitemap_.c skins_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
3434
3535
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -24,11 +24,11 @@
24 CFLAGS = -o
25 BCC = $(DMDIR)\bin\dmc $(CFLAGS)
26 TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
27 LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32
28
29 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_OMIT_DEPRECATED -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5
30
31 SHELL_OPTIONS = -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
32
33 SRC = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c event_.c export_.c file_.c finfo_.c foci_.c fshell_.c fusefs_.c glob_.c graph_.c gzip_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c setup_.c sha1_.c shun_.c sitemap_.c skins_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
34
35
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -24,11 +24,11 @@
24 CFLAGS = -o
25 BCC = $(DMDIR)\bin\dmc $(CFLAGS)
26 TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
27 LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32
28
29 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5
30
31 SHELL_OPTIONS = -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
32
33 SRC = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c event_.c export_.c file_.c finfo_.c foci_.c fshell_.c fusefs_.c glob_.c graph_.c gzip_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c setup_.c sha1_.c shun_.c sitemap_.c skins_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
34
35
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -2165,17 +2165,21 @@
21652165
$(OBJDIR)/zip.h: $(OBJDIR)/headers
21662166
21672167
MINGW_OPTIONS = -D_HAVE__MINGW_H
21682168
21692169
SQLITE_OPTIONS = -DNDEBUG=1 \
2170
- -DSQLITE_OMIT_LOAD_EXTENSION=1 \
2171
- -DSQLITE_OMIT_SHARED_CACHE \
2172
- -DSQLITE_ENABLE_LOCKING_STYLE=0 \
2173
- -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 \
21742170
-DSQLITE_THREADSAFE=0 \
2175
- -DSQLITE_DEFAULT_FILE_FORMAT=4 \
2171
+ -DSQLITE_DEFAULT_MEMSTATUS=0 \
2172
+ -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \
2173
+ -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
2174
+ -DSQLITE_OMIT_DECLTYPE \
21762175
-DSQLITE_OMIT_DEPRECATED \
2176
+ -DSQLITE_OMIT_PROGRESS_CALLBACK \
2177
+ -DSQLITE_OMIT_SHARED_CACHE \
2178
+ -DSQLITE_OMIT_LOAD_EXTENSION \
2179
+ -DSQLITE_ENABLE_LOCKING_STYLE=0 \
2180
+ -DSQLITE_DEFAULT_FILE_FORMAT=4 \
21772181
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
21782182
-DSQLITE_ENABLE_FTS4 \
21792183
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
21802184
-DSQLITE_ENABLE_DBSTAT_VTAB \
21812185
-DSQLITE_ENABLE_JSON1 \
21822186
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -2165,17 +2165,21 @@
2165 $(OBJDIR)/zip.h: $(OBJDIR)/headers
2166
2167 MINGW_OPTIONS = -D_HAVE__MINGW_H
2168
2169 SQLITE_OPTIONS = -DNDEBUG=1 \
2170 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
2171 -DSQLITE_OMIT_SHARED_CACHE \
2172 -DSQLITE_ENABLE_LOCKING_STYLE=0 \
2173 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 \
2174 -DSQLITE_THREADSAFE=0 \
2175 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
 
 
 
2176 -DSQLITE_OMIT_DEPRECATED \
 
 
 
 
 
2177 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
2178 -DSQLITE_ENABLE_FTS4 \
2179 -DSQLITE_ENABLE_FTS3_PARENTHESIS \
2180 -DSQLITE_ENABLE_DBSTAT_VTAB \
2181 -DSQLITE_ENABLE_JSON1 \
2182
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -2165,17 +2165,21 @@
2165 $(OBJDIR)/zip.h: $(OBJDIR)/headers
2166
2167 MINGW_OPTIONS = -D_HAVE__MINGW_H
2168
2169 SQLITE_OPTIONS = -DNDEBUG=1 \
 
 
 
 
2170 -DSQLITE_THREADSAFE=0 \
2171 -DSQLITE_DEFAULT_MEMSTATUS=0 \
2172 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \
2173 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
2174 -DSQLITE_OMIT_DECLTYPE \
2175 -DSQLITE_OMIT_DEPRECATED \
2176 -DSQLITE_OMIT_PROGRESS_CALLBACK \
2177 -DSQLITE_OMIT_SHARED_CACHE \
2178 -DSQLITE_OMIT_LOAD_EXTENSION \
2179 -DSQLITE_ENABLE_LOCKING_STYLE=0 \
2180 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
2181 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
2182 -DSQLITE_ENABLE_FTS4 \
2183 -DSQLITE_ENABLE_FTS3_PARENTHESIS \
2184 -DSQLITE_ENABLE_DBSTAT_VTAB \
2185 -DSQLITE_ENABLE_JSON1 \
2186
+10 -6
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -98,11 +98,11 @@
9898
!ifndef USE_SEE
9999
USE_SEE = 0
100100
!endif
101101
102102
!if $(FOSSIL_ENABLE_SSL)!=0
103
-SSLDIR = $(B)\compat\openssl-1.0.2i
103
+SSLDIR = $(B)\compat\openssl-1.0.2h
104104
SSLINCDIR = $(SSLDIR)\inc32
105105
!if $(FOSSIL_DYNAMIC_BUILD)!=0
106106
SSLLIBDIR = $(SSLDIR)\out32dll
107107
!else
108108
SSLLIBDIR = $(SSLDIR)\out32
@@ -312,17 +312,21 @@
312312
TCC = $(TCC) /DUSE_SEE=1
313313
RCC = $(RCC) /DUSE_SEE=1
314314
!endif
315315
316316
SQLITE_OPTIONS = /DNDEBUG=1 \
317
- /DSQLITE_OMIT_LOAD_EXTENSION=1 \
318
- /DSQLITE_OMIT_SHARED_CACHE \
319
- /DSQLITE_ENABLE_LOCKING_STYLE=0 \
320
- /DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 \
321317
/DSQLITE_THREADSAFE=0 \
322
- /DSQLITE_DEFAULT_FILE_FORMAT=4 \
318
+ /DSQLITE_DEFAULT_MEMSTATUS=0 \
319
+ /DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \
320
+ /DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
321
+ /DSQLITE_OMIT_DECLTYPE \
323322
/DSQLITE_OMIT_DEPRECATED \
323
+ /DSQLITE_OMIT_PROGRESS_CALLBACK \
324
+ /DSQLITE_OMIT_SHARED_CACHE \
325
+ /DSQLITE_OMIT_LOAD_EXTENSION \
326
+ /DSQLITE_ENABLE_LOCKING_STYLE=0 \
327
+ /DSQLITE_DEFAULT_FILE_FORMAT=4 \
324328
/DSQLITE_ENABLE_EXPLAIN_COMMENTS \
325329
/DSQLITE_ENABLE_FTS4 \
326330
/DSQLITE_ENABLE_FTS3_PARENTHESIS \
327331
/DSQLITE_ENABLE_DBSTAT_VTAB \
328332
/DSQLITE_ENABLE_JSON1 \
329333
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -98,11 +98,11 @@
98 !ifndef USE_SEE
99 USE_SEE = 0
100 !endif
101
102 !if $(FOSSIL_ENABLE_SSL)!=0
103 SSLDIR = $(B)\compat\openssl-1.0.2i
104 SSLINCDIR = $(SSLDIR)\inc32
105 !if $(FOSSIL_DYNAMIC_BUILD)!=0
106 SSLLIBDIR = $(SSLDIR)\out32dll
107 !else
108 SSLLIBDIR = $(SSLDIR)\out32
@@ -312,17 +312,21 @@
312 TCC = $(TCC) /DUSE_SEE=1
313 RCC = $(RCC) /DUSE_SEE=1
314 !endif
315
316 SQLITE_OPTIONS = /DNDEBUG=1 \
317 /DSQLITE_OMIT_LOAD_EXTENSION=1 \
318 /DSQLITE_OMIT_SHARED_CACHE \
319 /DSQLITE_ENABLE_LOCKING_STYLE=0 \
320 /DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 \
321 /DSQLITE_THREADSAFE=0 \
322 /DSQLITE_DEFAULT_FILE_FORMAT=4 \
 
 
 
323 /DSQLITE_OMIT_DEPRECATED \
 
 
 
 
 
324 /DSQLITE_ENABLE_EXPLAIN_COMMENTS \
325 /DSQLITE_ENABLE_FTS4 \
326 /DSQLITE_ENABLE_FTS3_PARENTHESIS \
327 /DSQLITE_ENABLE_DBSTAT_VTAB \
328 /DSQLITE_ENABLE_JSON1 \
329
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -98,11 +98,11 @@
98 !ifndef USE_SEE
99 USE_SEE = 0
100 !endif
101
102 !if $(FOSSIL_ENABLE_SSL)!=0
103 SSLDIR = $(B)\compat\openssl-1.0.2h
104 SSLINCDIR = $(SSLDIR)\inc32
105 !if $(FOSSIL_DYNAMIC_BUILD)!=0
106 SSLLIBDIR = $(SSLDIR)\out32dll
107 !else
108 SSLLIBDIR = $(SSLDIR)\out32
@@ -312,17 +312,21 @@
312 TCC = $(TCC) /DUSE_SEE=1
313 RCC = $(RCC) /DUSE_SEE=1
314 !endif
315
316 SQLITE_OPTIONS = /DNDEBUG=1 \
 
 
 
 
317 /DSQLITE_THREADSAFE=0 \
318 /DSQLITE_DEFAULT_MEMSTATUS=0 \
319 /DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \
320 /DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
321 /DSQLITE_OMIT_DECLTYPE \
322 /DSQLITE_OMIT_DEPRECATED \
323 /DSQLITE_OMIT_PROGRESS_CALLBACK \
324 /DSQLITE_OMIT_SHARED_CACHE \
325 /DSQLITE_OMIT_LOAD_EXTENSION \
326 /DSQLITE_ENABLE_LOCKING_STYLE=0 \
327 /DSQLITE_DEFAULT_FILE_FORMAT=4 \
328 /DSQLITE_ENABLE_EXPLAIN_COMMENTS \
329 /DSQLITE_ENABLE_FTS4 \
330 /DSQLITE_ENABLE_FTS3_PARENTHESIS \
331 /DSQLITE_ENABLE_DBSTAT_VTAB \
332 /DSQLITE_ENABLE_JSON1 \
333

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button