System.Data.SQLite

Check-in [1868813f4f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge all changes from SQLite core library pre-release branch.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1868813f4fa71434f9b885921f40d3feba271ae5
User & Date: mistachkin 2020-01-26 22:06:02.682
References
2020-04-03
18:10
Partial cherrypick of [1868813f4]. check-in: a5ac78ea8e user: mistachkin tags: branch-1.0.112
Context
2020-04-03
18:10
Partial cherrypick of [1868813f4]. check-in: a5ac78ea8e user: mistachkin tags: branch-1.0.112
2020-02-02
04:18
Add an overload of the static Execute method to the SQLiteCommand class that accepts an open connection. check-in: 344a8bd45f user: mistachkin tags: trunk
2020-01-26
22:06
Merge all changes from SQLite core library pre-release branch. check-in: 1868813f4f user: mistachkin tags: trunk
22:04
Update SQLite core library to the latest trunk code. Leaf check-in: 1be3d892d0 user: mistachkin tags: corePreRelease
2019-12-17
12:58
Attempt to make sure all garbage is collected before proceeding with the next test after running the test for ticket [ae5267b863]. check-in: 119a958bb2 user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Doc/Extra/Core/images/syntax/column-constraint.gif.

cannot compute difference between binary files

Changes to Doc/Extra/Core/lang.html.
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124

<p>The following syntax documentation topics are available:</p>

<table width="100%" cellpadding="5" border="0">
<tr><td valign="top"><ul>

<style>
#listtab31 tr td {vertical-align:top;}
</style>
<table id='listtab31' width='100%'></table>
<script>
var listitems31 = [{"u":"lang_aggfunc.html","x":"aggregate functions","s":0},
{"u":"lang_altertable.html","x":"ALTER TABLE","s":0},
{"u":"lang_analyze.html","x":"ANALYZE","s":0},
{"u":"lang_attach.html","x":"ATTACH DATABASE","s":0},
{"u":"lang_transaction.html","x":"BEGIN TRANSACTION","s":0},
{"u":"lang_comment.html","x":"comment","s":0},
{"u":"lang_transaction.html","x":"COMMIT TRANSACTION","s":0},
{"u":"lang_corefunc.html","x":"core functions","s":0},







|

|

|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124

<p>The following syntax documentation topics are available:</p>

<table width="100%" cellpadding="5" border="0">
<tr><td valign="top"><ul>

<style>
#listtab33 tr td {vertical-align:top;}
</style>
<table id='listtab33' width='100%'></table>
<script>
var listitems33 = [{"u":"lang_aggfunc.html","x":"aggregate functions","s":0},
{"u":"lang_altertable.html","x":"ALTER TABLE","s":0},
{"u":"lang_analyze.html","x":"ANALYZE","s":0},
{"u":"lang_attach.html","x":"ATTACH DATABASE","s":0},
{"u":"lang_transaction.html","x":"BEGIN TRANSACTION","s":0},
{"u":"lang_comment.html","x":"comment","s":0},
{"u":"lang_transaction.html","x":"COMMIT TRANSACTION","s":0},
{"u":"lang_corefunc.html","x":"core functions","s":0},
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
{"u":"lang_UPSERT.html","x":"UPSERT","s":0},
{"u":"lang_vacuum.html","x":"VACUUM","s":0},
{"u":"lang_with.html","x":"WITH clause","s":0}];
var j = 0;
var w = Math.max(document.documentElement.clientWidth,  window.innerWidth || 0);
var nCol = Math.floor(w/340);
if(nCol<=0) nCol=1;
var nRow = Math.ceil((listitems31.length+1)/nCol);
var h="<tr><td><ul class='multicol_list'>"
var ea
for(var i=0; i<listitems31.length; i++){
  if( (++j)>nRow ){
    h += "</ul></td>\n<td><ul class='multicol_list'>\n";
    j = 1;
  }
  if(listitems31[i].u=="" || listitems31[i].s==2){
    h += "<li>"
    ea = ""
  }else{
    h += "<li><a href='";
    h += listitems31[i].u;
    h += "'>";
    ea = "</a>"
  }
  if(listitems31[i].s==2 || listitems31[i].s==3) h += "<s>"
  h += listitems31[i].x;
  if(listitems31[i].s==2 || listitems31[i].s==3) h += "</s>"
  h += ea
  if(listitems31[i].s==1) h += "<small><i>(exp)</i></small>\n";
  if(listitems31[i].s==3) h += "&sup1\n";
  if(listitems31[i].s==4) h += "&sup2\n";
  if(listitems31[i].s==5) h += "&sup3\n";
}
document.getElementById("listtab31").innerHTML = h;
</script>

</ul></td></tr></table>

<p>The routines <a href="c3ref/prepare.html">sqlite3_prepare_v2()</a>, <a href="c3ref/prepare.html">sqlite3_prepare()</a>,
<a href="c3ref/prepare.html">sqlite3_prepare16()</a>, <a href="c3ref/prepare.html">sqlite3_prepare16_v2()</a>, 
<a href="c3ref/exec.html">sqlite3_exec()</a>, and <a href="c3ref/free_table.html">sqlite3_get_table()</a> accept







|


|




|




|



|
|
|

|
|
|
|

|







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
{"u":"lang_UPSERT.html","x":"UPSERT","s":0},
{"u":"lang_vacuum.html","x":"VACUUM","s":0},
{"u":"lang_with.html","x":"WITH clause","s":0}];
var j = 0;
var w = Math.max(document.documentElement.clientWidth,  window.innerWidth || 0);
var nCol = Math.floor(w/340);
if(nCol<=0) nCol=1;
var nRow = Math.ceil((listitems33.length+1)/nCol);
var h="<tr><td><ul class='multicol_list'>"
var ea
for(var i=0; i<listitems33.length; i++){
  if( (++j)>nRow ){
    h += "</ul></td>\n<td><ul class='multicol_list'>\n";
    j = 1;
  }
  if(listitems33[i].u=="" || listitems33[i].s==2){
    h += "<li>"
    ea = ""
  }else{
    h += "<li><a href='";
    h += listitems33[i].u;
    h += "'>";
    ea = "</a>"
  }
  if(listitems33[i].s==2 || listitems33[i].s==3) h += "<s>"
  h += listitems33[i].x;
  if(listitems33[i].s==2 || listitems33[i].s==3) h += "</s>"
  h += ea
  if(listitems33[i].s==1) h += "<small><i>(exp)</i></small>\n";
  if(listitems33[i].s==3) h += "&sup1\n";
  if(listitems33[i].s==4) h += "&sup2\n";
  if(listitems33[i].s==5) h += "&sup3\n";
}
document.getElementById("listtab33").innerHTML = h;
</script>

</ul></td></tr></table>

<p>The routines <a href="c3ref/prepare.html">sqlite3_prepare_v2()</a>, <a href="c3ref/prepare.html">sqlite3_prepare()</a>,
<a href="c3ref/prepare.html">sqlite3_prepare16()</a>, <a href="c3ref/prepare.html">sqlite3_prepare16_v2()</a>, 
<a href="c3ref/exec.html">sqlite3_exec()</a>, and <a href="c3ref/free_table.html">sqlite3_get_table()</a> accept
Changes to Doc/Extra/Core/lang_aggfunc.html.
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277

<p>
If a FILTER clause is provided, then only rows for which the <i>expr</i> is
true are included in the aggregate.
</p>

<style>
#listtab33 tr td {vertical-align:top;}
</style>
<table id='listtab33' width='100%'></table>
<script>
var listitems33 = [{"u":"lang_aggfunc.html#avg","x":"avg(X)","s":0},
{"u":"lang_aggfunc.html#count","x":"count(*)","s":0},
{"u":"lang_aggfunc.html#count","x":"count(X)","s":0},
{"u":"lang_aggfunc.html#groupconcat","x":"group_concat(X)","s":0},
{"u":"lang_aggfunc.html#groupconcat","x":"group_concat(X,Y)","s":0},
{"u":"lang_corefunc.html#maxoreunc","x":"max(X)","s":0},
{"u":"lang_corefunc.html#minoreunc","x":"min(X)","s":0},
{"u":"lang_aggfunc.html#sumunc","x":"sum(X)","s":0},
{"u":"lang_aggfunc.html#sumunc","x":"total(X)","s":0}];
var j = 0;
var w = Math.max(document.documentElement.clientWidth,  window.innerWidth || 0);
var nCol = Math.floor(w/225);
if(nCol<=0) nCol=1;
var nRow = Math.ceil((listitems33.length+1)/nCol);
var h="<tr><td><ul class='multicol_list'>"
var ea
for(var i=0; i<listitems33.length; i++){
  if( (++j)>nRow ){
    h += "</ul></td>\n<td><ul class='multicol_list'>\n";
    j = 1;
  }
  if(listitems33[i].u=="" || listitems33[i].s==2){
    h += "<li>"
    ea = ""
  }else{
    h += "<li><a href='";
    h += listitems33[i].u;
    h += "'>";
    ea = "</a>"
  }
  if(listitems33[i].s==2 || listitems33[i].s==3) h += "<s>"
  h += listitems33[i].x;
  if(listitems33[i].s==2 || listitems33[i].s==3) h += "</s>"
  h += ea
  if(listitems33[i].s==1) h += "<small><i>(exp)</i></small>\n";
  if(listitems33[i].s==3) h += "&sup1\n";
  if(listitems33[i].s==4) h += "&sup2\n";
  if(listitems33[i].s==5) h += "&sup3\n";
}
document.getElementById("listtab33").innerHTML = h;
</script>
<hr class='xhr'>
<dl>
<a name="avg"></a>
<dt><p><b>avg(<i>X</i>)</b></dt><dd><p>
  The avg() function
  returns the average value of all non-NULL <i>X</i> within a







|

|

|












|


|




|




|



|
|
|

|
|
|
|

|







220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277

<p>
If a FILTER clause is provided, then only rows for which the <i>expr</i> is
true are included in the aggregate.
</p>

<style>
#listtab35 tr td {vertical-align:top;}
</style>
<table id='listtab35' width='100%'></table>
<script>
var listitems35 = [{"u":"lang_aggfunc.html#avg","x":"avg(X)","s":0},
{"u":"lang_aggfunc.html#count","x":"count(*)","s":0},
{"u":"lang_aggfunc.html#count","x":"count(X)","s":0},
{"u":"lang_aggfunc.html#groupconcat","x":"group_concat(X)","s":0},
{"u":"lang_aggfunc.html#groupconcat","x":"group_concat(X,Y)","s":0},
{"u":"lang_corefunc.html#maxoreunc","x":"max(X)","s":0},
{"u":"lang_corefunc.html#minoreunc","x":"min(X)","s":0},
{"u":"lang_aggfunc.html#sumunc","x":"sum(X)","s":0},
{"u":"lang_aggfunc.html#sumunc","x":"total(X)","s":0}];
var j = 0;
var w = Math.max(document.documentElement.clientWidth,  window.innerWidth || 0);
var nCol = Math.floor(w/225);
if(nCol<=0) nCol=1;
var nRow = Math.ceil((listitems35.length+1)/nCol);
var h="<tr><td><ul class='multicol_list'>"
var ea
for(var i=0; i<listitems35.length; i++){
  if( (++j)>nRow ){
    h += "</ul></td>\n<td><ul class='multicol_list'>\n";
    j = 1;
  }
  if(listitems35[i].u=="" || listitems35[i].s==2){
    h += "<li>"
    ea = ""
  }else{
    h += "<li><a href='";
    h += listitems35[i].u;
    h += "'>";
    ea = "</a>"
  }
  if(listitems35[i].s==2 || listitems35[i].s==3) h += "<s>"
  h += listitems35[i].x;
  if(listitems35[i].s==2 || listitems35[i].s==3) h += "</s>"
  h += ea
  if(listitems35[i].s==1) h += "<small><i>(exp)</i></small>\n";
  if(listitems35[i].s==3) h += "&sup1\n";
  if(listitems35[i].s==4) h += "&sup2\n";
  if(listitems35[i].s==5) h += "&sup3\n";
}
document.getElementById("listtab35").innerHTML = h;
</script>
<hr class='xhr'>
<dl>
<a name="avg"></a>
<dt><p><b>avg(<i>X</i>)</b></dt><dd><p>
  The avg() function
  returns the average value of all non-NULL <i>X</i> within a
Changes to Doc/Extra/Core/lang_altertable.html.
312
313
314
315
316
317
318


319
320
321
322
323
324
325
<li>The column may not have a default value of CURRENT_TIME, CURRENT_DATE, 
    CURRENT_TIMESTAMP, or an expression in parentheses.</li>
<li>If a NOT NULL constraint is specified, then the column must have a
    default value other than NULL.
<li>If <a href="foreignkeys.html">foreign key constraints</a> are <a href="pragma.html#pragma_foreign_keys">enabled</a> and
    a column with a <a href="syntax/foreign-key-clause.html">REFERENCES clause</a>
    is added, the column must have a default value of NULL.


</ul>

<p>Note also that when adding a <a href="lang_createtable.html#ckconst">CHECK constraint</a>, the CHECK constraint
is not tested against preexisting rows of the table.
This can result in a table that contains data that
is in violation of the CHECK constraint.  Future versions of SQLite might
change to validate CHECK constraints as they are added.</p>







>
>







312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<li>The column may not have a default value of CURRENT_TIME, CURRENT_DATE, 
    CURRENT_TIMESTAMP, or an expression in parentheses.</li>
<li>If a NOT NULL constraint is specified, then the column must have a
    default value other than NULL.
<li>If <a href="foreignkeys.html">foreign key constraints</a> are <a href="pragma.html#pragma_foreign_keys">enabled</a> and
    a column with a <a href="syntax/foreign-key-clause.html">REFERENCES clause</a>
    is added, the column must have a default value of NULL.
<li>The column may not be <a href="gencol.html">GENERATED ALWAYS ... STORED</a>,
though VIRTUAL columns are allowed.
</ul>

<p>Note also that when adding a <a href="lang_createtable.html#ckconst">CHECK constraint</a>, the CHECK constraint
is not tested against preexisting rows of the table.
This can result in a table that contains data that
is in violation of the CHECK constraint.  Future versions of SQLite might
change to validate CHECK constraints as they are added.</p>
Changes to Doc/Extra/Core/lang_corefunc.html.
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<a href="windowfunctions.html#biwinfunc">window functions</a>, and
<a href="json1.html">JSON functions</a> are documented separately.  An
application may define additional
functions written in C and added to the database engine using
the <a href="c3ref/create_function.html">sqlite3_create_function()</a> API.</p>

<style>
#listtab32 tr td {vertical-align:top;}
</style>
<table id='listtab32' width='100%'></table>
<script>
var listitems32 = [{"u":"lang_corefunc.html#abs","x":"abs(X)","s":0},
{"u":"lang_corefunc.html#changes","x":"changes()","s":0},
{"u":"lang_corefunc.html#char","x":"char(X1,X2,...,XN)","s":0},
{"u":"lang_corefunc.html#coalesce","x":"coalesce(X,Y,...)","s":0},
{"u":"lang_corefunc.html#glob","x":"glob(X,Y)","s":0},
{"u":"lang_corefunc.html#hex","x":"hex(X)","s":0},
{"u":"lang_corefunc.html#ifnull","x":"ifnull(X,Y)","s":0},
{"u":"lang_corefunc.html#instr","x":"instr(X,Y)","s":0},







|

|

|







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<a href="windowfunctions.html#biwinfunc">window functions</a>, and
<a href="json1.html">JSON functions</a> are documented separately.  An
application may define additional
functions written in C and added to the database engine using
the <a href="c3ref/create_function.html">sqlite3_create_function()</a> API.</p>

<style>
#listtab34 tr td {vertical-align:top;}
</style>
<table id='listtab34' width='100%'></table>
<script>
var listitems34 = [{"u":"lang_corefunc.html#abs","x":"abs(X)","s":0},
{"u":"lang_corefunc.html#changes","x":"changes()","s":0},
{"u":"lang_corefunc.html#char","x":"char(X1,X2,...,XN)","s":0},
{"u":"lang_corefunc.html#coalesce","x":"coalesce(X,Y,...)","s":0},
{"u":"lang_corefunc.html#glob","x":"glob(X,Y)","s":0},
{"u":"lang_corefunc.html#hex","x":"hex(X)","s":0},
{"u":"lang_corefunc.html#ifnull","x":"ifnull(X,Y)","s":0},
{"u":"lang_corefunc.html#instr","x":"instr(X,Y)","s":0},
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
{"u":"lang_corefunc.html#unlikely","x":"unlikely(X)","s":0},
{"u":"lang_corefunc.html#upper","x":"upper(X)","s":0},
{"u":"lang_corefunc.html#zeroblob","x":"zeroblob(N)","s":0}];
var j = 0;
var w = Math.max(document.documentElement.clientWidth,  window.innerWidth || 0);
var nCol = Math.floor(w/225);
if(nCol<=0) nCol=1;
var nRow = Math.ceil((listitems32.length+1)/nCol);
var h="<tr><td><ul class='multicol_list'>"
var ea
for(var i=0; i<listitems32.length; i++){
  if( (++j)>nRow ){
    h += "</ul></td>\n<td><ul class='multicol_list'>\n";
    j = 1;
  }
  if(listitems32[i].u=="" || listitems32[i].s==2){
    h += "<li>"
    ea = ""
  }else{
    h += "<li><a href='";
    h += listitems32[i].u;
    h += "'>";
    ea = "</a>"
  }
  if(listitems32[i].s==2 || listitems32[i].s==3) h += "<s>"
  h += listitems32[i].x;
  if(listitems32[i].s==2 || listitems32[i].s==3) h += "</s>"
  h += ea
  if(listitems32[i].s==1) h += "<small><i>(exp)</i></small>\n";
  if(listitems32[i].s==3) h += "&sup1\n";
  if(listitems32[i].s==4) h += "&sup2\n";
  if(listitems32[i].s==5) h += "&sup3\n";
}
document.getElementById("listtab32").innerHTML = h;
</script>
<hr class='xhr'>
<dl>
<a name="abs"></a>
<dt><p><b>abs(<i>X</i>)</b></dt><dd><p>
  The abs(X) function returns the absolute value of the numeric
  argument X.  Abs(X) returns NULL if X is NULL. 







|


|




|




|



|
|
|

|
|
|
|

|







154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
{"u":"lang_corefunc.html#unlikely","x":"unlikely(X)","s":0},
{"u":"lang_corefunc.html#upper","x":"upper(X)","s":0},
{"u":"lang_corefunc.html#zeroblob","x":"zeroblob(N)","s":0}];
var j = 0;
var w = Math.max(document.documentElement.clientWidth,  window.innerWidth || 0);
var nCol = Math.floor(w/225);
if(nCol<=0) nCol=1;
var nRow = Math.ceil((listitems34.length+1)/nCol);
var h="<tr><td><ul class='multicol_list'>"
var ea
for(var i=0; i<listitems34.length; i++){
  if( (++j)>nRow ){
    h += "</ul></td>\n<td><ul class='multicol_list'>\n";
    j = 1;
  }
  if(listitems34[i].u=="" || listitems34[i].s==2){
    h += "<li>"
    ea = ""
  }else{
    h += "<li><a href='";
    h += listitems34[i].u;
    h += "'>";
    ea = "</a>"
  }
  if(listitems34[i].s==2 || listitems34[i].s==3) h += "<s>"
  h += listitems34[i].x;
  if(listitems34[i].s==2 || listitems34[i].s==3) h += "</s>"
  h += ea
  if(listitems34[i].s==1) h += "<small><i>(exp)</i></small>\n";
  if(listitems34[i].s==3) h += "&sup1\n";
  if(listitems34[i].s==4) h += "&sup2\n";
  if(listitems34[i].s==5) h += "&sup3\n";
}
document.getElementById("listtab34").innerHTML = h;
</script>
<hr class='xhr'>
<dl>
<a name="abs"></a>
<dt><p><b>abs(<i>X</i>)</b></dt><dd><p>
  The abs(X) function returns the absolute value of the numeric
  argument X.  Abs(X) returns NULL if X is NULL. 
Changes to Doc/Extra/Core/lang_createindex.html.
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
and 3.7.9 use the legacy schema format by default.  The newer schema format is
used by default in version 3.7.10 (2012-01-16) and later.
The <a href="pragma.html#pragma_legacy_file_format">legacy_file_format pragma</a> can be used to change set the specific
behavior for any version of SQLite.</p>

<p>The NULLS FIRST and NULLS LAST predicates are not supported
for indexes.  For <a href="datatype3.html#sortorder">sorting purposes</a>, SQLite considers NULL values 
to be smaller than all other values.  Hences NULL values always appear at
the beginning of an ASC index and at the end of a DESC index.</p>

<a name="collidx"></a>

<p>The COLLATE clause optionally following each column name
or expression defines a
collating sequence used for text entries in that column.







|







224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
and 3.7.9 use the legacy schema format by default.  The newer schema format is
used by default in version 3.7.10 (2012-01-16) and later.
The <a href="pragma.html#pragma_legacy_file_format">legacy_file_format pragma</a> can be used to change set the specific
behavior for any version of SQLite.</p>

<p>The NULLS FIRST and NULLS LAST predicates are not supported
for indexes.  For <a href="datatype3.html#sortorder">sorting purposes</a>, SQLite considers NULL values 
to be smaller than all other values.  Hence NULL values always appear at
the beginning of an ASC index and at the end of a DESC index.</p>

<a name="collidx"></a>

<p>The COLLATE clause optionally following each column name
or expression defines a
collating sequence used for text entries in that column.
Changes to Doc/Extra/Core/lang_createtable.html.
348
349
350
351
352
353
354


355
356
357
358
359
360
361
  <li><p> A default collation sequence to use with each column.

  <li><p> Optionally, a PRIMARY KEY for the table. Both single column and
       composite (multiple column) primary keys are supported.

  <li><p> A set of SQL constraints for each table. SQLite supports UNIQUE, NOT
       NULL, CHECK and FOREIGN KEY constraints.



  <li><p> Whether the table is a <a href="withoutrowid.html">WITHOUT ROWID</a> table.
</ul>

<p>Every CREATE TABLE statement must specify a name for the new table.
  Table names that begin with "sqlite_" are reserved for internal use. It
  is an error to attempt to create a table with a name that starts with







>
>







348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
  <li><p> A default collation sequence to use with each column.

  <li><p> Optionally, a PRIMARY KEY for the table. Both single column and
       composite (multiple column) primary keys are supported.

  <li><p> A set of SQL constraints for each table. SQLite supports UNIQUE, NOT
       NULL, CHECK and FOREIGN KEY constraints.

  <li><p> Optionally, a <a href="gencol.html">generated column</a> constraint.

  <li><p> Whether the table is a <a href="withoutrowid.html">WITHOUT ROWID</a> table.
</ul>

<p>Every CREATE TABLE statement must specify a name for the new table.
  Table names that begin with "sqlite_" are reserved for internal use. It
  is an error to attempt to create a table with a name that starts with
427
428
429
430
431
432
433
434

435
436
437
438
439
440
441
name of the column, optionally followed by the declared type of the column,
then one or more optional <a href="syntax/column-constraint.html">column constraints</a>. Included in
the definition of "column constraints" for the purposes of the previous
statement are the COLLATE and DEFAULT clauses, even though these are not really
constraints in the sense that they do not restrict the data that the table may
contain. The other constraints - NOT NULL, CHECK, UNIQUE, PRIMARY KEY and
FOREIGN KEY constraints - impose restrictions on the tables data, and are are
described under <a href="lang_createtable.html#constraints">SQL Data Constraints</a> below.


<p>Unlike most SQL databases, SQLite does not restrict the type of data that
may be inserted into a column based on the columns declared type. Instead,
SQLite uses <a href="datatype3.html">dynamic typing</a>. The declared type of a column is used to
determine the <a href="datatype3.html#affinity">affinity</a> of the column only.

<a name="dfltval"></a>







|
>







429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
name of the column, optionally followed by the declared type of the column,
then one or more optional <a href="syntax/column-constraint.html">column constraints</a>. Included in
the definition of "column constraints" for the purposes of the previous
statement are the COLLATE and DEFAULT clauses, even though these are not really
constraints in the sense that they do not restrict the data that the table may
contain. The other constraints - NOT NULL, CHECK, UNIQUE, PRIMARY KEY and
FOREIGN KEY constraints - impose restrictions on the tables data, and are are
described under <a href="lang_createtable.html#constraints">SQL Data Constraints</a> below. The
<a href="gencol.html">generated column</a> syntax is supported since SQLite 3.31.0 (2020-01-22).

<p>Unlike most SQL databases, SQLite does not restrict the type of data that
may be inserted into a column based on the columns declared type. Instead,
SQLite uses <a href="datatype3.html">dynamic typing</a>. The declared type of a column is used to
determine the <a href="datatype3.html#affinity">affinity</a> of the column only.

<a name="dfltval"></a>
Changes to Doc/Extra/Core/lang_expr.html.
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
that function.</p>

<a name="regexp"></a>

<p>The REGEXP operator is a special syntax for the regexp()
user function.  No regexp() user function is defined by default
and so use of the REGEXP operator will normally result in an
error message.  If an <a href="c3ref/create_function.html">application-defined SQL function</a> named "regexp"
is added at run-time, then the "<i>X</i> REGEXP <i>Y</i>" operator will
be implemented as a call to "regexp(<i>Y</i>,<i>X</i>)".</p>

<a name="match"></a>

<p>The MATCH operator is a special syntax for the match()
application-defined function.  The default match() function implementation







|







451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
that function.</p>

<a name="regexp"></a>

<p>The REGEXP operator is a special syntax for the regexp()
user function.  No regexp() user function is defined by default
and so use of the REGEXP operator will normally result in an
error message.  If an <a href="appfunc.html">application-defined SQL function</a> named "regexp"
is added at run-time, then the "<i>X</i> REGEXP <i>Y</i>" operator will
be implemented as a call to "regexp(<i>Y</i>,<i>X</i>)".</p>

<a name="match"></a>

<p>The MATCH operator is a special syntax for the match()
application-defined function.  The default match() function implementation
Changes to Doc/Extra/Core/lang_keywords.html.
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181

182
183
184
185
186
187
188
but some keywords may be omitted when SQL language features are
disabled.
Applications can use the
<a href="c3ref/keyword_check.html">sqlite3_keyword_count()</a>, <a href="c3ref/keyword_check.html">sqlite3_keyword_name()</a>, and
<a href="c3ref/keyword_check.html">sqlite3_keyword_check()</a> interfaces to determine the keywords
recognized by SQLite at run-time.
Regardless of the compile-time configuration, any identifier that is not on
the following 143 element
list is not a keyword to the SQL parser in SQLite:
</p>

<ol>
<li>ABORT</li>
<li>ACTION</li>
<li>ADD</li>
<li>AFTER</li>
<li>ALL</li>
<li>ALTER</li>

<li>ANALYZE</li>
<li>AND</li>
<li>AS</li>
<li>ASC</li>
<li>ATTACH</li>
<li>AUTOINCREMENT</li>
<li>BEFORE</li>







|










>







164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
but some keywords may be omitted when SQL language features are
disabled.
Applications can use the
<a href="c3ref/keyword_check.html">sqlite3_keyword_count()</a>, <a href="c3ref/keyword_check.html">sqlite3_keyword_name()</a>, and
<a href="c3ref/keyword_check.html">sqlite3_keyword_check()</a> interfaces to determine the keywords
recognized by SQLite at run-time.
Regardless of the compile-time configuration, any identifier that is not on
the following 145 element
list is not a keyword to the SQL parser in SQLite:
</p>

<ol>
<li>ABORT</li>
<li>ACTION</li>
<li>ADD</li>
<li>AFTER</li>
<li>ALL</li>
<li>ALTER</li>
<li>ALWAYS</li>
<li>ANALYZE</li>
<li>AND</li>
<li>AS</li>
<li>ASC</li>
<li>ATTACH</li>
<li>AUTOINCREMENT</li>
<li>BEFORE</li>
227
228
229
230
231
232
233

234
235
236
237
238
239
240
<li>FILTER</li>
<li>FIRST</li>
<li>FOLLOWING</li>
<li>FOR</li>
<li>FOREIGN</li>
<li>FROM</li>
<li>FULL</li>

<li>GLOB</li>
<li>GROUP</li>
<li>GROUPS</li>
<li>HAVING</li>
<li>IF</li>
<li>IGNORE</li>
<li>IMMEDIATE</li>







>







228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<li>FILTER</li>
<li>FIRST</li>
<li>FOLLOWING</li>
<li>FOR</li>
<li>FOREIGN</li>
<li>FROM</li>
<li>FULL</li>
<li>GENERATED</li>
<li>GLOB</li>
<li>GROUP</li>
<li>GROUPS</li>
<li>HAVING</li>
<li>IF</li>
<li>IGNORE</li>
<li>IMMEDIATE</li>
Changes to Doc/Extra/Core/pragma.html.
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
cannot use this feature.
</ul>


<hr /><a name="toc"></a>
<h2>List Of PRAGMAs</h2>
<style>
#listtab34 tr td {vertical-align:top;}
</style>
<table id='listtab34' width='100%'></table>
<script>
var listitems34 = [{"u":"pragma.html#pragma_application_id","x":"application_id","s":0},
{"u":"pragma.html#pragma_auto_vacuum","x":"auto_vacuum","s":0},
{"u":"pragma.html#pragma_automatic_index","x":"automatic_index","s":0},
{"u":"pragma.html#pragma_busy_timeout","x":"busy_timeout","s":0},
{"u":"pragma.html#pragma_cache_size","x":"cache_size","s":0},
{"u":"pragma.html#pragma_cache_spill","x":"cache_spill","s":0},
{"u":"pragma.html#pragma_case_sensitive_like","x":"case_sensitive_like","s":0},
{"u":"pragma.html#pragma_cell_size_check","x":"cell_size_check","s":0},







|

|

|







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
cannot use this feature.
</ul>


<hr /><a name="toc"></a>
<h2>List Of PRAGMAs</h2>
<style>
#listtab36 tr td {vertical-align:top;}
</style>
<table id='listtab36' width='100%'></table>
<script>
var listitems36 = [{"u":"pragma.html#pragma_application_id","x":"application_id","s":0},
{"u":"pragma.html#pragma_auto_vacuum","x":"auto_vacuum","s":0},
{"u":"pragma.html#pragma_automatic_index","x":"automatic_index","s":0},
{"u":"pragma.html#pragma_busy_timeout","x":"busy_timeout","s":0},
{"u":"pragma.html#pragma_cache_size","x":"cache_size","s":0},
{"u":"pragma.html#pragma_cache_spill","x":"cache_spill","s":0},
{"u":"pragma.html#pragma_case_sensitive_like","x":"case_sensitive_like","s":0},
{"u":"pragma.html#pragma_cell_size_check","x":"cell_size_check","s":0},
280
281
282
283
284
285
286

287
288
289
290
291
292
293
{"u":"pragma.html#pragma_foreign_key_check","x":"foreign_key_check","s":0},
{"u":"pragma.html#pragma_foreign_key_list","x":"foreign_key_list","s":0},
{"u":"pragma.html#pragma_foreign_keys","x":"foreign_keys","s":0},
{"u":"pragma.html#pragma_freelist_count","x":"freelist_count","s":0},
{"u":"pragma.html#pragma_full_column_names","x":"full_column_names","s":3},
{"u":"pragma.html#pragma_fullfsync","x":"fullfsync","s":0},
{"u":"pragma.html#pragma_function_list","x":"function_list","s":0},

{"u":"pragma.html#pragma_ignore_check_constraints","x":"ignore_check_constraints","s":0},
{"u":"pragma.html#pragma_incremental_vacuum","x":"incremental_vacuum","s":0},
{"u":"pragma.html#pragma_index_info","x":"index_info","s":0},
{"u":"pragma.html#pragma_index_list","x":"index_list","s":0},
{"u":"pragma.html#pragma_index_xinfo","x":"index_xinfo","s":0},
{"u":"pragma.html#pragma_integrity_check","x":"integrity_check","s":0},
{"u":"pragma.html#pragma_journal_mode","x":"journal_mode","s":0},







>







280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
{"u":"pragma.html#pragma_foreign_key_check","x":"foreign_key_check","s":0},
{"u":"pragma.html#pragma_foreign_key_list","x":"foreign_key_list","s":0},
{"u":"pragma.html#pragma_foreign_keys","x":"foreign_keys","s":0},
{"u":"pragma.html#pragma_freelist_count","x":"freelist_count","s":0},
{"u":"pragma.html#pragma_full_column_names","x":"full_column_names","s":3},
{"u":"pragma.html#pragma_fullfsync","x":"fullfsync","s":0},
{"u":"pragma.html#pragma_function_list","x":"function_list","s":0},
{"u":"pragma.html#pragma_hard_heap_limit","x":"hard_heap_limit","s":0},
{"u":"pragma.html#pragma_ignore_check_constraints","x":"ignore_check_constraints","s":0},
{"u":"pragma.html#pragma_incremental_vacuum","x":"incremental_vacuum","s":0},
{"u":"pragma.html#pragma_index_info","x":"index_info","s":0},
{"u":"pragma.html#pragma_index_list","x":"index_list","s":0},
{"u":"pragma.html#pragma_index_xinfo","x":"index_xinfo","s":0},
{"u":"pragma.html#pragma_integrity_check","x":"integrity_check","s":0},
{"u":"pragma.html#pragma_journal_mode","x":"journal_mode","s":0},
316
317
318
319
320
321
322

323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
{"u":"pragma.html#pragma_stats","x":"stats","s":5},
{"u":"pragma.html#pragma_synchronous","x":"synchronous","s":0},
{"u":"pragma.html#pragma_table_info","x":"table_info","s":0},
{"u":"pragma.html#pragma_table_xinfo","x":"table_xinfo","s":0},
{"u":"pragma.html#pragma_temp_store","x":"temp_store","s":0},
{"u":"pragma.html#pragma_temp_store_directory","x":"temp_store_directory","s":3},
{"u":"pragma.html#pragma_threads","x":"threads","s":0},

{"u":"pragma.html#pragma_user_version","x":"user_version","s":0},
{"u":"pragma.html#pragma_vdbe_addoptrace","x":"vdbe_addoptrace","s":4},
{"u":"pragma.html#pragma_vdbe_debug","x":"vdbe_debug","s":4},
{"u":"pragma.html#pragma_vdbe_listing","x":"vdbe_listing","s":4},
{"u":"pragma.html#pragma_vdbe_trace","x":"vdbe_trace","s":4},
{"u":"pragma.html#pragma_wal_autocheckpoint","x":"wal_autocheckpoint","s":0},
{"u":"pragma.html#pragma_wal_checkpoint","x":"wal_checkpoint","s":0},
{"u":"pragma.html#pragma_writable_schema","x":"writable_schema","s":5}];
var j = 0;
var w = Math.max(document.documentElement.clientWidth,  window.innerWidth || 0);
var nCol = Math.floor(w/250);
if(nCol<=0) nCol=1;
var nRow = Math.ceil((listitems34.length+1)/nCol);
var h="<tr><td><ul class='multicol_list'>"
var ea
for(var i=0; i<listitems34.length; i++){
  if( (++j)>nRow ){
    h += "</ul></td>\n<td><ul class='multicol_list'>\n";
    j = 1;
  }
  if(listitems34[i].u=="" || listitems34[i].s==2){
    h += "<li>"
    ea = ""
  }else{
    h += "<li><a href='";
    h += listitems34[i].u;
    h += "'>";
    ea = "</a>"
  }
  if(listitems34[i].s==2 || listitems34[i].s==3) h += "<s>"
  h += listitems34[i].x;
  if(listitems34[i].s==2 || listitems34[i].s==3) h += "</s>"
  h += ea
  if(listitems34[i].s==1) h += "<small><i>(exp)</i></small>\n";
  if(listitems34[i].s==3) h += "&sup1\n";
  if(listitems34[i].s==4) h += "&sup2\n";
  if(listitems34[i].s==5) h += "&sup3\n";
}
document.getElementById("listtab34").innerHTML = h;
</script>

<p>Notes:
<ol>
<li>Pragmas whose names are <s>struck through</s>
are deprecated. Do not use them. They exist
for historical compatibility.







>












|


|




|




|



|
|
|

|
|
|
|

|







317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
{"u":"pragma.html#pragma_stats","x":"stats","s":5},
{"u":"pragma.html#pragma_synchronous","x":"synchronous","s":0},
{"u":"pragma.html#pragma_table_info","x":"table_info","s":0},
{"u":"pragma.html#pragma_table_xinfo","x":"table_xinfo","s":0},
{"u":"pragma.html#pragma_temp_store","x":"temp_store","s":0},
{"u":"pragma.html#pragma_temp_store_directory","x":"temp_store_directory","s":3},
{"u":"pragma.html#pragma_threads","x":"threads","s":0},
{"u":"pragma.html#pragma_trusted_schema","x":"trusted_schema","s":0},
{"u":"pragma.html#pragma_user_version","x":"user_version","s":0},
{"u":"pragma.html#pragma_vdbe_addoptrace","x":"vdbe_addoptrace","s":4},
{"u":"pragma.html#pragma_vdbe_debug","x":"vdbe_debug","s":4},
{"u":"pragma.html#pragma_vdbe_listing","x":"vdbe_listing","s":4},
{"u":"pragma.html#pragma_vdbe_trace","x":"vdbe_trace","s":4},
{"u":"pragma.html#pragma_wal_autocheckpoint","x":"wal_autocheckpoint","s":0},
{"u":"pragma.html#pragma_wal_checkpoint","x":"wal_checkpoint","s":0},
{"u":"pragma.html#pragma_writable_schema","x":"writable_schema","s":5}];
var j = 0;
var w = Math.max(document.documentElement.clientWidth,  window.innerWidth || 0);
var nCol = Math.floor(w/250);
if(nCol<=0) nCol=1;
var nRow = Math.ceil((listitems36.length+1)/nCol);
var h="<tr><td><ul class='multicol_list'>"
var ea
for(var i=0; i<listitems36.length; i++){
  if( (++j)>nRow ){
    h += "</ul></td>\n<td><ul class='multicol_list'>\n";
    j = 1;
  }
  if(listitems36[i].u=="" || listitems36[i].s==2){
    h += "<li>"
    ea = ""
  }else{
    h += "<li><a href='";
    h += listitems36[i].u;
    h += "'>";
    ea = "</a>"
  }
  if(listitems36[i].s==2 || listitems36[i].s==3) h += "<s>"
  h += listitems36[i].x;
  if(listitems36[i].s==2 || listitems36[i].s==3) h += "</s>"
  h += ea
  if(listitems36[i].s==1) h += "<small><i>(exp)</i></small>\n";
  if(listitems36[i].s==3) h += "&sup1\n";
  if(listitems36[i].s==4) h += "&sup2\n";
  if(listitems36[i].s==5) h += "&sup3\n";
}
document.getElementById("listtab36").innerHTML = h;
</script>

<p>Notes:
<ol>
<li>Pragmas whose names are <s>struck through</s>
are deprecated. Do not use them. They exist
for historical compatibility.
881
882
883
884
885
886
887
888























889
890
891
892
893
894
895
    is off.  Only Mac OS X supports F_FULLFSYNC.</p>

    <p>See also <a href="pragma.html#pragma_checkpoint_fullfsync">checkpoint_fullfsync</a>.</p>
<a name="pragma_function_list"></a>
<h _id=pragma_function_list style="display:none"> PRAGMA function_list</h><hr>
    <p><b>PRAGMA function_list;</b>
    <p>This pragma returns a list of SQL functions
    known to the database connection.























<a name="pragma_ignore_check_constraints"></a>
<h _id=pragma_ignore_check_constraints style="display:none"> PRAGMA ignore_check_constraints</h><hr>
    <p><b>PRAGMA ignore_check_constraints  = </b><i>boolean</i><b>;</b></p>

    <p>This pragma enables or disables the enforcement of CHECK constraints.
    The default setting is off, meaning that CHECK constraints are
    enforced by default.</p>







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
    is off.  Only Mac OS X supports F_FULLFSYNC.</p>

    <p>See also <a href="pragma.html#pragma_checkpoint_fullfsync">checkpoint_fullfsync</a>.</p>
<a name="pragma_function_list"></a>
<h _id=pragma_function_list style="display:none"> PRAGMA function_list</h><hr>
    <p><b>PRAGMA function_list;</b>
    <p>This pragma returns a list of SQL functions
    known to the database connection.  Each row of the result
    describes a single calling signature for a single SQL function.
    Some SQL functions will have multiple rows in the result set
    if they can (for example) be invoked with a varying number of
    arguments or can accept text in various encodings.
<a name="pragma_hard_heap_limit"></a>
<h _id=pragma_hard_heap_limit style="display:none"> PRAGMA hard_heap_limit</h><hr>
    <p><b>PRAGMA hard_heap_limit<br>
          PRAGMA hard_heap_limit=</b><i>N</i></p>

    <p>This pragma invokes the <a href="c3ref/hard_heap_limit64.html">sqlite3_hard_heap_limit64()</a> interface with
    the argument N, if N is specified and N is a positive integer that
    is less than the current hard heap limit.
    The hard_heap_limit pragma always returns the same integer
    that would be returned by the <a href="c3ref/hard_heap_limit64.html">sqlite3_hard_heap_limit64</a>(-1) C-language
    function.  That is to say, it always returns the value of the hard
    heap limit that is set after any changes imposed by this PRAGMA.
    </p>

    <p>This pragma can only lower the heap limit, never raise it.
    The C-language interface <a href="c3ref/hard_heap_limit64.html">sqlite3_hard_heap_limit64()</a> must be used
    to raise the heap limit.</p>

    <p>See also the <a href="pragma.html#pragma_soft_heap_limit">soft_heap_limit pragma</a>.
<a name="pragma_ignore_check_constraints"></a>
<h _id=pragma_ignore_check_constraints style="display:none"> PRAGMA ignore_check_constraints</h><hr>
    <p><b>PRAGMA ignore_check_constraints  = </b><i>boolean</i><b>;</b></p>

    <p>This pragma enables or disables the enforcement of CHECK constraints.
    The default setting is off, meaning that CHECK constraints are
    enforced by default.</p>
1160
1161
1162
1163
1164
1165
1166
1167

1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
    method is being run.  The value of this flag is restore after the 
    <a href="vtab.html#xrename">sqlite3_module.xRename</a> method finishes.
    <p>The legacy alter table behavior can also be toggled on and off
    using the <a href="c3ref/c_dbconfig_defensive.html#sqlitedbconfiglegacyaltertable">SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</a> option to the
    <a href="c3ref/db_config.html">sqlite3_db_config()</a> interface.
<a name="pragma_legacy_file_format"></a>
<h _id=pragma_legacy_file_format style="display:none"> PRAGMA legacy_file_format</h><hr>
   <p><b>PRAGMA legacy_file_format;

       <br>PRAGMA legacy_file_format = <i>boolean</i></b></p>
    <p>This pragma sets or queries the value of the legacy_file_format
    flag.  When this flag is on, new SQLite databases are created in
    a file format that is readable and writable by all versions of
    SQLite going back to 3.0.0.  When the flag is off, new databases
    are created using the latest file format which might not be
    readable or writable by versions of SQLite prior to 3.3.0.</p>

    <p>When the legacy_file_format pragma is issued with no argument,
    it returns the setting of the flag.  This pragma does <u>not</u> tell
    which file format the current database is using; it tells what format
    will be used by any newly created databases.</p>

    <p>The legacy_file_format pragma is initialized to OFF when an existing
    database in the newer file format is first opened.</p>

    <p>The default file format is set by the
    <a href="compile.html#default_file_format">SQLITE_DEFAULT_FILE_FORMAT</a> compile-time option.</p>
<a name="pragma_locking_mode"></a>
<h _id=pragma_locking_mode style="display:none"> PRAGMA locking_mode</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>locking_mode;
    <br>PRAGMA </b><i>schema.</i><b>locking_mode
                = <i>NORMAL | EXCLUSIVE</i></b></p>
    <p>This pragma sets or queries the database connection locking-mode. 
    The locking-mode is either NORMAL or EXCLUSIVE.







|
>
|
<
<
<
<
<
<
|
<
<
<
<
|
<
<
|
<
<







1185
1186
1187
1188
1189
1190
1191
1192
1193
1194






1195




1196


1197


1198
1199
1200
1201
1202
1203
1204
    method is being run.  The value of this flag is restore after the 
    <a href="vtab.html#xrename">sqlite3_module.xRename</a> method finishes.
    <p>The legacy alter table behavior can also be toggled on and off
    using the <a href="c3ref/c_dbconfig_defensive.html#sqlitedbconfiglegacyaltertable">SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</a> option to the
    <a href="c3ref/db_config.html">sqlite3_db_config()</a> interface.
<a name="pragma_legacy_file_format"></a>
<h _id=pragma_legacy_file_format style="display:none"> PRAGMA legacy_file_format</h><hr>
   <p><b>PRAGMA legacy_file_format;</b>
    <p>This pragma no longer functions.  It has become a no-op.
    The capabilities formerly provided by PRAGMA legacy_file_format






    are now available using the <a href="c3ref/c_dbconfig_defensive.html#sqlitedbconfiglegacyfileformat">SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</a>




    option to the <a href="c3ref/db_config.html">sqlite3_db_config()</a> C-language interface.


    <p>


<a name="pragma_locking_mode"></a>
<h _id=pragma_locking_mode style="display:none"> PRAGMA locking_mode</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>locking_mode;
    <br>PRAGMA </b><i>schema.</i><b>locking_mode
                = <i>NORMAL | EXCLUSIVE</i></b></p>
    <p>This pragma sets or queries the database connection locking-mode. 
    The locking-mode is either NORMAL or EXCLUSIVE.
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
    that might be caused by linking against a different version of SQLite.
    </p>
<a name="pragma_schema_version"></a>
<h _id=pragma_schema_version style="display:none"> PRAGMA schema_version</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>schema_version; 
      <br>PRAGMA </b><i>schema.</i><b>schema_version = </b><i>integer </i>;

<p>   The schema_version pragma will to get or set
       the value of the schema-version integer at offset 40 in the
       <a href="fileformat2.html#database_header">database header</a>. 

<p>    SQLite automatically increments the schema-version whenever the
       schema changes. As each SQL statement runs, the schema version is
       checked to ensure that the schema has not changed since the SQL
       statement was <a href="c3ref/prepare.html">prepared</a>.







|







1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
    that might be caused by linking against a different version of SQLite.
    </p>
<a name="pragma_schema_version"></a>
<h _id=pragma_schema_version style="display:none"> PRAGMA schema_version</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>schema_version; 
      <br>PRAGMA </b><i>schema.</i><b>schema_version = </b><i>integer </i>;

<p>   The schema_version pragma will get or set
       the value of the schema-version integer at offset 40 in the
       <a href="fileformat2.html#database_header">database header</a>. 

<p>    SQLite automatically increments the schema-version whenever the
       schema changes. As each SQL statement runs, the schema version is
       checked to ensure that the schema has not changed since the SQL
       statement was <a href="c3ref/prepare.html">prepared</a>.
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601

1602
1603
1604
1605
1606
1607
1608
    <a href="c3ref/db_release_memory.html">sqlite3_db_release_memory()</a>.
    </p>
<a name="pragma_soft_heap_limit"></a>
<h _id=pragma_soft_heap_limit style="display:none"> PRAGMA soft_heap_limit</h><hr>
    <p><b>PRAGMA soft_heap_limit<br>
          PRAGMA soft_heap_limit=</b><i>N</i></p>

    <p>This pragma invokes the <a href="c3ref/soft_heap_limit64.html">sqlite3_soft_heap_limit64()</a> interface with
    the argument N, if N is specified and is a non-negative integer.
    The soft_heap_limit pragma always returns the same integer
    that would be returned by the <a href="c3ref/soft_heap_limit64.html">sqlite3_soft_heap_limit64</a>(-1) C-language
    function.
    </p>

<a name="pragma_stats"></a>
<h _id=pragma_stats style="display:none"> PRAGMA stats</h><hr>
    <p><b>PRAGMA stats;</b> </p>
    <p>This pragma returns auxiliary information about tables and
    indices.  The returned information is used during testing to help
    verify that the query planner is operating correctly.  The format
    and meaning of this pragma will likely change from one release







|


|


>







1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
    <a href="c3ref/db_release_memory.html">sqlite3_db_release_memory()</a>.
    </p>
<a name="pragma_soft_heap_limit"></a>
<h _id=pragma_soft_heap_limit style="display:none"> PRAGMA soft_heap_limit</h><hr>
    <p><b>PRAGMA soft_heap_limit<br>
          PRAGMA soft_heap_limit=</b><i>N</i></p>

    <p>This pragma invokes the <a href="c3ref/hard_heap_limit64.html">sqlite3_soft_heap_limit64()</a> interface with
    the argument N, if N is specified and is a non-negative integer.
    The soft_heap_limit pragma always returns the same integer
    that would be returned by the <a href="c3ref/hard_heap_limit64.html">sqlite3_soft_heap_limit64</a>(-1) C-language
    function.
    </p>
    <p>See also the <a href="pragma.html#pragma_hard_heap_limit">hard_heap_limit pragma</a>.
<a name="pragma_stats"></a>
<h _id=pragma_stats style="display:none"> PRAGMA stats</h><hr>
    <p><b>PRAGMA stats;</b> </p>
    <p>This pragma returns auxiliary information about tables and
    indices.  The returned information is used during testing to help
    verify that the query planner is operating correctly.  The format
    and meaning of this pragma will likely change from one release
1819
1820
1821
1822
1823
1824
1825



















1826
1827
1828
1829
1830
1831
1832
    unless it is changed using the <a href="compile.html#default_worker_threads">SQLITE_DEFAULT_WORKER_THREADS</a>
    compile-time option.  When the limit is zero, that means no
    auxiliary threads will be launched.</p>

    <p>This pragma is a thin wrapper around the
    <a href="c3ref/limit.html">sqlite3_limit</a>(db,<a href="c3ref/c_limit_attached.html#sqlitelimitworkerthreads">SQLITE_LIMIT_WORKER_THREADS</a>,...) interface.
    </p>



















<a name="pragma_user_version"></a>
<h _id=pragma_user_version style="display:none"> PRAGMA user_version</h><hr>
      <p><b>PRAGMA </b><i>schema.</i><b>user_version;
      <br>PRAGMA </b><i>schema.</i><b>user_version = </b><i>integer </i><b>;</b>

  
<p>    The user_version pragma will to get or set







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
    unless it is changed using the <a href="compile.html#default_worker_threads">SQLITE_DEFAULT_WORKER_THREADS</a>
    compile-time option.  When the limit is zero, that means no
    auxiliary threads will be launched.</p>

    <p>This pragma is a thin wrapper around the
    <a href="c3ref/limit.html">sqlite3_limit</a>(db,<a href="c3ref/c_limit_attached.html#sqlitelimitworkerthreads">SQLITE_LIMIT_WORKER_THREADS</a>,...) interface.
    </p>
<a name="pragma_trusted_schema"></a>
<h _id=pragma_trusted_schema style="display:none"> PRAGMA trusted_schema</h><hr>
    <p><b>PRAGMA trusted_schema;
      <br>PRAGMA trusted_schema = </b><i>boolean</i><b>;</b></p>
    <p>The trusted_schema setting is a per-connection boolean that
    determines whether or not SQL functions and virtual tables that
    have not been security audited are allowed to be run by views,
    triggers, or in expressions of the schema such as <a href="lang_createtable.html#ckconst">CHECK constraints</a>,
    <a href="lang_createtable.html#dfltval">DEFAULT clauses</a>, <a href="gencol.html">generated columns</a>, <a href="expridx.html">expression indexes</a>, and/or
    <a href="partialindex.html">partial indexes</a>.  This setting can also be controlled using
    the <a href="c3ref/db_config.html">sqlite3_db_config</a>(db,<a href="c3ref/c_dbconfig_defensive.html#sqlitedbconfigtrustedschema">SQLITE_DBCONFIG_TRUSTED_SCHEMA</a>,...)
    C-language interface.
    <p>In order to maintain backwards compatibility, this setting is
    ON by default.  There are advantages to turning it off, and most
    applications will be unaffected if it is turned off.  For that reason,
    all applications are encouraged to switch this setting off on every
    database connection as soon as that connection is opened.
    <p>The <a href="compile.html#trusted_schema">-DSQLITE_TRUSTED_SCHEMA=0</a> compile-time option will cause
    this setting to default to OFF.
<a name="pragma_user_version"></a>
<h _id=pragma_user_version style="display:none"> PRAGMA user_version</h><hr>
      <p><b>PRAGMA </b><i>schema.</i><b>user_version;
      <br>PRAGMA </b><i>schema.</i><b>user_version = </b><i>integer </i><b>;</b>

  
<p>    The user_version pragma will to get or set
Changes to Doc/Extra/Core/syntax.html.
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
</script>
</div>


<h1 align="center">List of SQLite Syntax Diagrams</h1>

<style>
#listtab42 tr td {vertical-align:top;}
</style>
<table id='listtab42' width='100%'></table>
<script>
var listitems42 = [{"u":"syntax/aggregate-function-invocation.html","x":"aggregate-function-invocation","s":0},
{"u":"syntax/alter-table-stmt.html","x":"alter-table-stmt","s":0},
{"u":"syntax/analyze-stmt.html","x":"analyze-stmt","s":0},
{"u":"syntax/attach-stmt.html","x":"attach-stmt","s":0},
{"u":"syntax/begin-stmt.html","x":"begin-stmt","s":0},
{"u":"syntax/column-constraint.html","x":"column-constraint","s":0},
{"u":"syntax/column-def.html","x":"column-def","s":0},
{"u":"syntax/column-name-list.html","x":"column-name-list","s":0},







|

|

|







92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
</script>
</div>


<h1 align="center">List of SQLite Syntax Diagrams</h1>

<style>
#listtab44 tr td {vertical-align:top;}
</style>
<table id='listtab44' width='100%'></table>
<script>
var listitems44 = [{"u":"syntax/aggregate-function-invocation.html","x":"aggregate-function-invocation","s":0},
{"u":"syntax/alter-table-stmt.html","x":"alter-table-stmt","s":0},
{"u":"syntax/analyze-stmt.html","x":"analyze-stmt","s":0},
{"u":"syntax/attach-stmt.html","x":"attach-stmt","s":0},
{"u":"syntax/begin-stmt.html","x":"begin-stmt","s":0},
{"u":"syntax/column-constraint.html","x":"column-constraint","s":0},
{"u":"syntax/column-def.html","x":"column-def","s":0},
{"u":"syntax/column-name-list.html","x":"column-name-list","s":0},
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
{"u":"syntax/window-defn.html","x":"window-defn","s":0},
{"u":"syntax/window-function-invocation.html","x":"window-function-invocation","s":0},
{"u":"syntax/with-clause.html","x":"with-clause","s":0}];
var j = 0;
var w = Math.max(document.documentElement.clientWidth,  window.innerWidth || 0);
var nCol = Math.floor(w/300);
if(nCol<=0) nCol=1;
var nRow = Math.ceil((listitems42.length+1)/nCol);
var h="<tr><td><ul class='multicol_list'>"
var ea
for(var i=0; i<listitems42.length; i++){
  if( (++j)>nRow ){
    h += "</ul></td>\n<td><ul class='multicol_list'>\n";
    j = 1;
  }
  if(listitems42[i].u=="" || listitems42[i].s==2){
    h += "<li>"
    ea = ""
  }else{
    h += "<li><a href='";
    h += listitems42[i].u;
    h += "'>";
    ea = "</a>"
  }
  if(listitems42[i].s==2 || listitems42[i].s==3) h += "<s>"
  h += listitems42[i].x;
  if(listitems42[i].s==2 || listitems42[i].s==3) h += "</s>"
  h += ea
  if(listitems42[i].s==1) h += "<small><i>(exp)</i></small>\n";
  if(listitems42[i].s==3) h += "&sup1\n";
  if(listitems42[i].s==4) h += "&sup2\n";
  if(listitems42[i].s==5) h += "&sup3\n";
}
document.getElementById("listtab42").innerHTML = h;
</script>









|


|




|




|



|
|
|

|
|
|
|

|



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
{"u":"syntax/window-defn.html","x":"window-defn","s":0},
{"u":"syntax/window-function-invocation.html","x":"window-function-invocation","s":0},
{"u":"syntax/with-clause.html","x":"with-clause","s":0}];
var j = 0;
var w = Math.max(document.documentElement.clientWidth,  window.innerWidth || 0);
var nCol = Math.floor(w/300);
if(nCol<=0) nCol=1;
var nRow = Math.ceil((listitems44.length+1)/nCol);
var h="<tr><td><ul class='multicol_list'>"
var ea
for(var i=0; i<listitems44.length; i++){
  if( (++j)>nRow ){
    h += "</ul></td>\n<td><ul class='multicol_list'>\n";
    j = 1;
  }
  if(listitems44[i].u=="" || listitems44[i].s==2){
    h += "<li>"
    ea = ""
  }else{
    h += "<li><a href='";
    h += listitems44[i].u;
    h += "'>";
    ea = "</a>"
  }
  if(listitems44[i].s==2 || listitems44[i].s==3) h += "<s>"
  h += listitems44[i].x;
  if(listitems44[i].s==2 || listitems44[i].s==3) h += "</s>"
  h += ea
  if(listitems44[i].s==1) h += "<small><i>(exp)</i></small>\n";
  if(listitems44[i].s==3) h += "&sup1\n";
  if(listitems44[i].s==4) h += "&sup2\n";
  if(listitems44[i].s==5) h += "&sup3\n";
}
document.getElementById("listtab44").innerHTML = h;
</script>


Changes to Doc/Extra/Core/syntax/column-constraint.html.
93
94
95
96
97
98
99
100
101
102
103
</div>
<h1 align='center'>column-constraint</h1>
<div class='imgcontainer'>
<img alt="syntax diagram column-constraint" src="../images/syntax/column-constraint.gif"></img><br>

Used by:&nbsp;&nbsp; <a href='./column-def.html'>column-def</a><br></br>
References:&nbsp;&nbsp; <a href='./conflict-clause.html'>conflict-clause</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./foreign-key-clause.html'>foreign-key-clause</a>&nbsp;&nbsp; <a href='./literal-value.html'>literal-value</a>&nbsp;&nbsp; <a href='./signed-number.html'>signed-number</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>
</div>









|



93
94
95
96
97
98
99
100
101
102
103
</div>
<h1 align='center'>column-constraint</h1>
<div class='imgcontainer'>
<img alt="syntax diagram column-constraint" src="../images/syntax/column-constraint.gif"></img><br>

Used by:&nbsp;&nbsp; <a href='./column-def.html'>column-def</a><br></br>
References:&nbsp;&nbsp; <a href='./conflict-clause.html'>conflict-clause</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./foreign-key-clause.html'>foreign-key-clause</a>&nbsp;&nbsp; <a href='./literal-value.html'>literal-value</a>&nbsp;&nbsp; <a href='./signed-number.html'>signed-number</a><br></br>
See also:&nbsp;&nbsp; <a href='../gencol.html'>gencol.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>
</div>


Changes to Doc/Extra/Core/syntaxdiagrams.html.
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
See also:&nbsp;&nbsp; <a href="lang_UPSERT.html">lang_UPSERT.html</a>&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="column-constraint"></a><h4>column-constraint:</h4><div class='imgcontainer'>
<img src="images/syntax/column-constraint.gif"></img><br></br>
Used by:&nbsp;&nbsp; <a href="#column-def">column-def</a><br></br>
References:&nbsp;&nbsp; <a href="#conflict-clause">conflict-clause</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#foreign-key-clause">foreign-key-clause</a>&nbsp;&nbsp; <a href="#literal-value">literal-value</a>&nbsp;&nbsp; <a href="#signed-number">signed-number</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtable.html#tablecoldef">lang_createtable.html#tablecoldef</a>
</div>

<a name="signed-number"></a><h4>signed-number:</h4><div class='imgcontainer'>
<img src="images/syntax/signed-number.gif"></img><br></br>
Used by:&nbsp;&nbsp; <a href="#column-constraint">column-constraint</a>&nbsp;&nbsp; <a href="#pragma-value">pragma-value</a>&nbsp;&nbsp; <a href="#type-name">type-name</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_UPSERT.html">lang_UPSERT.html</a>&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>&nbsp;&nbsp; <a href="pragma.html#syntax">pragma.html#syntax</a>
</div>







|







194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
See also:&nbsp;&nbsp; <a href="lang_UPSERT.html">lang_UPSERT.html</a>&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="column-constraint"></a><h4>column-constraint:</h4><div class='imgcontainer'>
<img src="images/syntax/column-constraint.gif"></img><br></br>
Used by:&nbsp;&nbsp; <a href="#column-def">column-def</a><br></br>
References:&nbsp;&nbsp; <a href="#conflict-clause">conflict-clause</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#foreign-key-clause">foreign-key-clause</a>&nbsp;&nbsp; <a href="#literal-value">literal-value</a>&nbsp;&nbsp; <a href="#signed-number">signed-number</a><br></br>
See also:&nbsp;&nbsp; <a href="gencol.html">gencol.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtable.html#tablecoldef">lang_createtable.html#tablecoldef</a>
</div>

<a name="signed-number"></a><h4>signed-number:</h4><div class='imgcontainer'>
<img src="images/syntax/signed-number.gif"></img><br></br>
Used by:&nbsp;&nbsp; <a href="#column-constraint">column-constraint</a>&nbsp;&nbsp; <a href="#pragma-value">pragma-value</a>&nbsp;&nbsp; <a href="#type-name">type-name</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_UPSERT.html">lang_UPSERT.html</a>&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>&nbsp;&nbsp; <a href="pragma.html#syntax">pragma.html#syntax</a>
</div>
Changes to Doc/Extra/Provider/version.html.
39
40
41
42
43
44
45
46
47

48
49
50
51
52
53
54
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.113.0 - January XX, 2020 <font color="red">(release scheduled)</font></b></p>
    <ul>

      <li>Include the &quot;LINQ&quot; partial classes in the primary managed assembly for .NET Standard 2.1. Fix for <a href="https://system.data.sqlite.org/index.html/info/ad28d8e026">[ad28d8e026]</a>.</li>
      <li>Add SQLite_ForceLogLifecycle environment variable to force logging of calls into key members pertaining to the lifecycle of connections and their associated classes (e.g. LINQ, EF6, etc).</li>
    </ul>
    <p><b>1.0.112.0 - October 28, 2019</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_30_1.html">SQLite 3.30.1</a>.</li>
      <li>Add preliminary support for .NET Core 3.0 and the .NET Standard 2.1. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/ce75d320d0">[ce75d320d0]</a>.</li>







|

>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.113.0 - February XX, 2020 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_31_0.html">SQLite 3.31.0</a>.</li>
      <li>Include the &quot;LINQ&quot; partial classes in the primary managed assembly for .NET Standard 2.1. Fix for <a href="https://system.data.sqlite.org/index.html/info/ad28d8e026">[ad28d8e026]</a>.</li>
      <li>Add SQLite_ForceLogLifecycle environment variable to force logging of calls into key members pertaining to the lifecycle of connections and their associated classes (e.g. LINQ, EF6, etc).</li>
    </ul>
    <p><b>1.0.112.0 - October 28, 2019</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_30_1.html">SQLite 3.30.1</a>.</li>
      <li>Add preliminary support for .NET Core 3.0 and the .NET Standard 2.1. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/ce75d320d0">[ce75d320d0]</a>.</li>
Changes to Doc/Special/Core/vtab.html.
471
472
473
474
475
476
477


478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495

496

497

















498
499
500
501
502
503
504
505
506
507
508
509
the virtual table mechanism assumes 
that each <a href="c3ref/sqlite3.html">database connection</a> kept
its own copy of the database schema. Hence, the virtual table mechanism
could not be used in a database that has <a href="sharedcache.html">shared cache mode</a> enabled. 
The <a href="c3ref/create_module.html">sqlite3_create_module()</a> interface would return an error if 
<a href="sharedcache.html">shared cache mode</a> is enabled.  That restriction was relaxed
beginning with SQLite <a href="releaselog/3_6_17.html">version 3.6.17</a>.



</p><h2 id="creating_new_virtual_table_implementations"><span>1.4. </span>Creating New Virtual Table Implementations</h2>

<p>Follow these steps to create your own virtual table:

</p><p>
</p><ol>
<li> Write all necessary methods.
</li><li> Create an instance of the <a href="c3ref/module.html">sqlite3_module</a> structure containing pointers
     to all the methods from step 1.
</li><li> Register your <a href="c3ref/module.html">sqlite3_module</a> structure using one of the
     <a href="c3ref/create_module.html">sqlite3_create_module()</a> or <a href="c3ref/create_module.html">sqlite3_create_module_v2()</a> interfaces.
</li><li> Run a <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> command that specifies the new module in 
     the USING clause. 
</li></ol>

<p>The only really hard part is step 1. You might want to start with an 
existing virtual table implementation and modify it to suit your needs.

There are several virtual table implementations in the SQLite source tree 

(for testing purposes). You might use one of those as a guide. Locate 

















these test virtual table implementations by searching 
for "sqlite3_create_module".

</p><p>You might also want to implement your new virtual table as a 
<a href="c3ref/load_extension.html">loadable extension</a>.

</p><h1 id="virtual_table_methods"><span>2. </span>Virtual Table Methods</h1>

<a name="xcreate"></a>

<h2 id="the_xcreate_method"><span>2.1. </span>The xCreate Method</h2>








>
>


















>
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|



|







471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
the virtual table mechanism assumes 
that each <a href="c3ref/sqlite3.html">database connection</a> kept
its own copy of the database schema. Hence, the virtual table mechanism
could not be used in a database that has <a href="sharedcache.html">shared cache mode</a> enabled. 
The <a href="c3ref/create_module.html">sqlite3_create_module()</a> interface would return an error if 
<a href="sharedcache.html">shared cache mode</a> is enabled.  That restriction was relaxed
beginning with SQLite <a href="releaselog/3_6_17.html">version 3.6.17</a>.

<a name="customvtab"></a>

</p><h2 id="creating_new_virtual_table_implementations"><span>1.4. </span>Creating New Virtual Table Implementations</h2>

<p>Follow these steps to create your own virtual table:

</p><p>
</p><ol>
<li> Write all necessary methods.
</li><li> Create an instance of the <a href="c3ref/module.html">sqlite3_module</a> structure containing pointers
     to all the methods from step 1.
</li><li> Register your <a href="c3ref/module.html">sqlite3_module</a> structure using one of the
     <a href="c3ref/create_module.html">sqlite3_create_module()</a> or <a href="c3ref/create_module.html">sqlite3_create_module_v2()</a> interfaces.
</li><li> Run a <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> command that specifies the new module in 
     the USING clause. 
</li></ol>

<p>The only really hard part is step 1. You might want to start with an 
existing virtual table implementation and modify it to suit your needs.
The <a href="https://sqlite.org/src/dir?ci=trunk&type=tree">SQLite source tree</a>
contains many virtual table implementations that are suitable for copying,
including:

</p><p>
</p><ul>
<li> <b><a href="https://sqlite.org/src/file/ext/misc/templatevtab.c">templatevtab.c</a></b>
&rarr; A virtual table created specifically to serve as a template for
other custom virtual tables.
</li><li> <b><a href="https://sqlite.org/src/file/ext/misc/series.c">series.c</a></b>
&rarr; Implementation of the generate_series() table-valued function.
</li><li> <b><a href="https://sqlite.org/src/file/ext/misc/json1.c">json1.c</a></b> &rarr;
Contains the sources for the <a href="json1.html#jeach">json_each()</a> and <a href="json1.html#jtree">json_tree()</a> table-valued
functions.
</li><li> <b><a href="https://sqlite.org/src/file/ext/misc/csv.c">csv.c</a></b> &rarr;
A virtual table that reads CSV files.
</li></ul>


<p>There are <a href="vtablist.html">many other virtual table implementations</a>
in the SQLite source tree that can be used as examples.  Locate 
these other virtual table implementations by searching 
for "sqlite3_create_module".

</p><p>You might also want to implement your new virtual table as a 
<a href="loadext.html">loadable extension</a>.

</p><h1 id="virtual_table_methods"><span>2. </span>Virtual Table Methods</h1>

<a name="xcreate"></a>

<h2 id="the_xcreate_method"><span>2.1. </span>The xCreate Method</h2>

Changes to Doc/sync.eagle.
174
175
176
177
178
179
180




181


182
183
184
185
186
187
188

set specialFileNames [list \
    [file join vtab.html]]

###############################################################################

set path [file dirname [info script]]




set rootUri https://www.sqlite.org


set rootDirectory [file join $path]

if {[info exists argv] && \
    [lsearch -exact -- $argv --verbose] != -1} then {
  set verbose true
} else {
  set verbose false







>
>
>
>
|
>
>







174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194

set specialFileNames [list \
    [file join vtab.html]]

###############################################################################

set path [file dirname [info script]]

if {[info exists draft] && $draft} then {
  set rootUri https://www.sqlite.org/draft
} else {
  set rootUri https://www.sqlite.org
}

set rootDirectory [file join $path]

if {[info exists argv] && \
    [lsearch -exact -- $argv --verbose] != -1} then {
  set verbose true
} else {
  set verbose false
Changes to NuGet/shared/Core/build/System.Data.SQLite.Core.targets.
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
  -->

  <ItemGroup Condition="'$(ContentSQLiteInteropFiles)' != '' And
                        '$(ContentSQLiteInteropFiles)' != 'false' And
                        '@(SQLiteInteropFiles)' != ''">
    <Content Include="@(SQLiteInteropFiles)">
      <Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

  <!--
  ******************************************************************************
  **                   SQLite Interop Library Build Targets                   **
  ******************************************************************************







|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
  -->

  <ItemGroup Condition="'$(ContentSQLiteInteropFiles)' != '' And
                        '$(ContentSQLiteInteropFiles)' != 'false' And
                        '@(SQLiteInteropFiles)' != ''">
    <Content Include="@(SQLiteInteropFiles)">
      <Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

  <!--
  ******************************************************************************
  **                   SQLite Interop Library Build Targets                   **
  ******************************************************************************
Changes to SQLite.Interop/props/sqlite3.props.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * sqlite3.props -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup Label="UserMacros">
    <SQLITE_MANIFEST_VERSION>3.30.1.0</SQLITE_MANIFEST_VERSION>
    <SQLITE_RC_VERSION>3,30,1,0</SQLITE_RC_VERSION>
    <SQLITE_COMMON_DEFINES>_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;SQLITE_THREADSAFE=1;SQLITE_USE_URI=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT4=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1;SQLITE_ENABLE_MEMORY_MANAGEMENT=1;SQLITE_ENABLE_API_ARMOR=1;SQLITE_ENABLE_DBSTAT_VTAB=1;SQLITE_ENABLE_STMTVTAB=1</SQLITE_COMMON_DEFINES>
    <SQLITE_EXTRA_DEFINES>SQLITE_PLACEHOLDER=1;SQLITE_HAS_CODEC=1</SQLITE_EXTRA_DEFINES>
    <SQLITE_WINCE_200X_DEFINES>SQLITE_OMIT_WAL=1</SQLITE_WINCE_200X_DEFINES>
    <SQLITE_WINCE_2013_DEFINES>HAVE_ERRNO_H=1;SQLITE_MSVC_LOCALTIME_API=1</SQLITE_WINCE_2013_DEFINES>
    <SQLITE_DEBUG_DEFINES>SQLITE_DEBUG=1;SQLITE_MEMDEBUG=1;SQLITE_ENABLE_EXPENSIVE_ASSERT=1</SQLITE_DEBUG_DEFINES>
    <SQLITE_RELEASE_DEFINES>SQLITE_WIN32_MALLOC=1</SQLITE_RELEASE_DEFINES>
    <SQLITE_DISABLE_WARNINGS>4055;4100;4127;4146;4210;4232;4244;4245;4267;4306;4389;4701;4703;4706</SQLITE_DISABLE_WARNINGS>











|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * sqlite3.props -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup Label="UserMacros">
    <SQLITE_MANIFEST_VERSION>3.31.0.0</SQLITE_MANIFEST_VERSION>
    <SQLITE_RC_VERSION>3,31,0,0</SQLITE_RC_VERSION>
    <SQLITE_COMMON_DEFINES>_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;SQLITE_THREADSAFE=1;SQLITE_USE_URI=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT4=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1;SQLITE_ENABLE_MEMORY_MANAGEMENT=1;SQLITE_ENABLE_API_ARMOR=1;SQLITE_ENABLE_DBSTAT_VTAB=1;SQLITE_ENABLE_STMTVTAB=1</SQLITE_COMMON_DEFINES>
    <SQLITE_EXTRA_DEFINES>SQLITE_PLACEHOLDER=1;SQLITE_HAS_CODEC=1</SQLITE_EXTRA_DEFINES>
    <SQLITE_WINCE_200X_DEFINES>SQLITE_OMIT_WAL=1</SQLITE_WINCE_200X_DEFINES>
    <SQLITE_WINCE_2013_DEFINES>HAVE_ERRNO_H=1;SQLITE_MSVC_LOCALTIME_API=1</SQLITE_WINCE_2013_DEFINES>
    <SQLITE_DEBUG_DEFINES>SQLITE_DEBUG=1;SQLITE_MEMDEBUG=1;SQLITE_ENABLE_EXPENSIVE_ASSERT=1</SQLITE_DEBUG_DEFINES>
    <SQLITE_RELEASE_DEFINES>SQLITE_WIN32_MALLOC=1</SQLITE_RELEASE_DEFINES>
    <SQLITE_DISABLE_WARNINGS>4055;4100;4127;4146;4210;4232;4244;4245;4267;4306;4389;4701;4703;4706</SQLITE_DISABLE_WARNINGS>
Changes to SQLite.Interop/props/sqlite3.vsprops.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<VisualStudioPropertySheet
	ProjectType="Visual C++"
	Version="8.00"
	Name="sqlite3"
	>
	<UserMacro
		Name="SQLITE_MANIFEST_VERSION"
		Value="3.30.1.0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_RC_VERSION"
		Value="3,30,1,0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_COMMON_DEFINES"
		Value="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;SQLITE_THREADSAFE=1;SQLITE_USE_URI=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT4=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1;SQLITE_ENABLE_MEMORY_MANAGEMENT=1;SQLITE_ENABLE_API_ARMOR=1;SQLITE_ENABLE_DBSTAT_VTAB=1;SQLITE_ENABLE_STMTVTAB=1"
		PerformEnvironmentSet="true"
	/>







|




|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<VisualStudioPropertySheet
	ProjectType="Visual C++"
	Version="8.00"
	Name="sqlite3"
	>
	<UserMacro
		Name="SQLITE_MANIFEST_VERSION"
		Value="3.31.0.0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_RC_VERSION"
		Value="3,31,0,0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_COMMON_DEFINES"
		Value="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;SQLITE_THREADSAFE=1;SQLITE_USE_URI=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT4=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1;SQLITE_ENABLE_MEMORY_MANAGEMENT=1;SQLITE_ENABLE_API_ARMOR=1;SQLITE_ENABLE_DBSTAT_VTAB=1;SQLITE_ENABLE_STMTVTAB=1"
		PerformEnvironmentSet="true"
	/>
Changes to SQLite.Interop/src/core/sqlite3.c.

more than 10,000 changes

Changes to SQLite.Interop/src/core/sqlite3.h.
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
** been edited in any way since it was last checked in, then the last
** four hexadecimal digits of the hash may be modified.
**
** See also: [sqlite3_libversion()],
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION        "3.30.1"
#define SQLITE_VERSION_NUMBER 3030001
#define SQLITE_SOURCE_ID      "2019-10-10 20:19:45 18db032d058f1436ce3dea84081f4ee5a0f2259ad97301d43c426bc7f3df1b0b"

/*
** CAPI3REF: Run-Time Library Version Numbers
** KEYWORDS: sqlite3_version sqlite3_sourceid
**
** These interfaces provide the same information as the [SQLITE_VERSION],
** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros







|
|
|







119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
** been edited in any way since it was last checked in, then the last
** four hexadecimal digits of the hash may be modified.
**
** See also: [sqlite3_libversion()],
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION        "3.31.0"
#define SQLITE_VERSION_NUMBER 3031000
#define SQLITE_SOURCE_ID      "2020-01-23 15:00:18 14331989fcaf6591336290ed1548e9c90f0f153e27f456f4c30c966f9c23aa6e"

/*
** CAPI3REF: Run-Time Library Version Numbers
** KEYWORDS: sqlite3_version sqlite3_sourceid
**
** These interfaces provide the same information as the [SQLITE_VERSION],
** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
512
513
514
515
516
517
518

519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537

538
539
540
541
542

543
544
545
546
547
548
549
#define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))
#define SQLITE_BUSY_SNAPSHOT           (SQLITE_BUSY   |  (2<<8))
#define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))
#define SQLITE_CANTOPEN_ISDIR          (SQLITE_CANTOPEN | (2<<8))
#define SQLITE_CANTOPEN_FULLPATH       (SQLITE_CANTOPEN | (3<<8))
#define SQLITE_CANTOPEN_CONVPATH       (SQLITE_CANTOPEN | (4<<8))
#define SQLITE_CANTOPEN_DIRTYWAL       (SQLITE_CANTOPEN | (5<<8)) /* Not Used */

#define SQLITE_CORRUPT_VTAB            (SQLITE_CORRUPT | (1<<8))
#define SQLITE_CORRUPT_SEQUENCE        (SQLITE_CORRUPT | (2<<8))
#define SQLITE_READONLY_RECOVERY       (SQLITE_READONLY | (1<<8))
#define SQLITE_READONLY_CANTLOCK       (SQLITE_READONLY | (2<<8))
#define SQLITE_READONLY_ROLLBACK       (SQLITE_READONLY | (3<<8))
#define SQLITE_READONLY_DBMOVED        (SQLITE_READONLY | (4<<8))
#define SQLITE_READONLY_CANTINIT       (SQLITE_READONLY | (5<<8))
#define SQLITE_READONLY_DIRECTORY      (SQLITE_READONLY | (6<<8))
#define SQLITE_ABORT_ROLLBACK          (SQLITE_ABORT | (2<<8))
#define SQLITE_CONSTRAINT_CHECK        (SQLITE_CONSTRAINT | (1<<8))
#define SQLITE_CONSTRAINT_COMMITHOOK   (SQLITE_CONSTRAINT | (2<<8))
#define SQLITE_CONSTRAINT_FOREIGNKEY   (SQLITE_CONSTRAINT | (3<<8))
#define SQLITE_CONSTRAINT_FUNCTION     (SQLITE_CONSTRAINT | (4<<8))
#define SQLITE_CONSTRAINT_NOTNULL      (SQLITE_CONSTRAINT | (5<<8))
#define SQLITE_CONSTRAINT_PRIMARYKEY   (SQLITE_CONSTRAINT | (6<<8))
#define SQLITE_CONSTRAINT_TRIGGER      (SQLITE_CONSTRAINT | (7<<8))
#define SQLITE_CONSTRAINT_UNIQUE       (SQLITE_CONSTRAINT | (8<<8))
#define SQLITE_CONSTRAINT_VTAB         (SQLITE_CONSTRAINT | (9<<8))
#define SQLITE_CONSTRAINT_ROWID        (SQLITE_CONSTRAINT |(10<<8))

#define SQLITE_NOTICE_RECOVER_WAL      (SQLITE_NOTICE | (1<<8))
#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
#define SQLITE_WARNING_AUTOINDEX       (SQLITE_WARNING | (1<<8))
#define SQLITE_AUTH_USER               (SQLITE_AUTH | (1<<8))
#define SQLITE_OK_LOAD_PERMANENTLY     (SQLITE_OK | (1<<8))


/*
** CAPI3REF: Flags For File Open Operations
**
** These bit values are intended for use in the
** 3rd parameter to the [sqlite3_open_v2()] interface and
** in the 4th parameter to the [sqlite3_vfs.xOpen] method.







>



















>





>







512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
#define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))
#define SQLITE_BUSY_SNAPSHOT           (SQLITE_BUSY   |  (2<<8))
#define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))
#define SQLITE_CANTOPEN_ISDIR          (SQLITE_CANTOPEN | (2<<8))
#define SQLITE_CANTOPEN_FULLPATH       (SQLITE_CANTOPEN | (3<<8))
#define SQLITE_CANTOPEN_CONVPATH       (SQLITE_CANTOPEN | (4<<8))
#define SQLITE_CANTOPEN_DIRTYWAL       (SQLITE_CANTOPEN | (5<<8)) /* Not Used */
#define SQLITE_CANTOPEN_SYMLINK        (SQLITE_CANTOPEN | (6<<8))
#define SQLITE_CORRUPT_VTAB            (SQLITE_CORRUPT | (1<<8))
#define SQLITE_CORRUPT_SEQUENCE        (SQLITE_CORRUPT | (2<<8))
#define SQLITE_READONLY_RECOVERY       (SQLITE_READONLY | (1<<8))
#define SQLITE_READONLY_CANTLOCK       (SQLITE_READONLY | (2<<8))
#define SQLITE_READONLY_ROLLBACK       (SQLITE_READONLY | (3<<8))
#define SQLITE_READONLY_DBMOVED        (SQLITE_READONLY | (4<<8))
#define SQLITE_READONLY_CANTINIT       (SQLITE_READONLY | (5<<8))
#define SQLITE_READONLY_DIRECTORY      (SQLITE_READONLY | (6<<8))
#define SQLITE_ABORT_ROLLBACK          (SQLITE_ABORT | (2<<8))
#define SQLITE_CONSTRAINT_CHECK        (SQLITE_CONSTRAINT | (1<<8))
#define SQLITE_CONSTRAINT_COMMITHOOK   (SQLITE_CONSTRAINT | (2<<8))
#define SQLITE_CONSTRAINT_FOREIGNKEY   (SQLITE_CONSTRAINT | (3<<8))
#define SQLITE_CONSTRAINT_FUNCTION     (SQLITE_CONSTRAINT | (4<<8))
#define SQLITE_CONSTRAINT_NOTNULL      (SQLITE_CONSTRAINT | (5<<8))
#define SQLITE_CONSTRAINT_PRIMARYKEY   (SQLITE_CONSTRAINT | (6<<8))
#define SQLITE_CONSTRAINT_TRIGGER      (SQLITE_CONSTRAINT | (7<<8))
#define SQLITE_CONSTRAINT_UNIQUE       (SQLITE_CONSTRAINT | (8<<8))
#define SQLITE_CONSTRAINT_VTAB         (SQLITE_CONSTRAINT | (9<<8))
#define SQLITE_CONSTRAINT_ROWID        (SQLITE_CONSTRAINT |(10<<8))
#define SQLITE_CONSTRAINT_PINNED       (SQLITE_CONSTRAINT |(11<<8))
#define SQLITE_NOTICE_RECOVER_WAL      (SQLITE_NOTICE | (1<<8))
#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
#define SQLITE_WARNING_AUTOINDEX       (SQLITE_WARNING | (1<<8))
#define SQLITE_AUTH_USER               (SQLITE_AUTH | (1<<8))
#define SQLITE_OK_LOAD_PERMANENTLY     (SQLITE_OK | (1<<8))
#define SQLITE_OK_SYMLINK              (SQLITE_OK | (2<<8))

/*
** CAPI3REF: Flags For File Open Operations
**
** These bit values are intended for use in the
** 3rd parameter to the [sqlite3_open_v2()] interface and
** in the 4th parameter to the [sqlite3_vfs.xOpen] method.
564
565
566
567
568
569
570

571
572
573
574
575
576
577
#define SQLITE_OPEN_SUBJOURNAL       0x00002000  /* VFS only */
#define SQLITE_OPEN_MASTER_JOURNAL   0x00004000  /* VFS only */
#define SQLITE_OPEN_NOMUTEX          0x00008000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_FULLMUTEX        0x00010000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_SHAREDCACHE      0x00020000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_PRIVATECACHE     0x00040000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_WAL              0x00080000  /* VFS only */


/* Reserved:                         0x00F00000 */

/*
** CAPI3REF: Device Characteristics
**
** The xDeviceCharacteristics method of the [sqlite3_io_methods]







>







567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
#define SQLITE_OPEN_SUBJOURNAL       0x00002000  /* VFS only */
#define SQLITE_OPEN_MASTER_JOURNAL   0x00004000  /* VFS only */
#define SQLITE_OPEN_NOMUTEX          0x00008000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_FULLMUTEX        0x00010000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_SHAREDCACHE      0x00020000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_PRIVATECACHE     0x00040000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_WAL              0x00080000  /* VFS only */
#define SQLITE_OPEN_NOFOLLOW         0x01000000  /* Ok for sqlite3_open_v2() */

/* Reserved:                         0x00F00000 */

/*
** CAPI3REF: Device Characteristics
**
** The xDeviceCharacteristics method of the [sqlite3_io_methods]
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
** file control occurs at the beginning of pragma statement analysis and so
** it is able to override built-in [PRAGMA] statements.
**
** <li>[[SQLITE_FCNTL_BUSYHANDLER]]
** ^The [SQLITE_FCNTL_BUSYHANDLER]
** file-control may be invoked by SQLite on the database file handle
** shortly after it is opened in order to provide a custom VFS with access
** to the connections busy-handler callback. The argument is of type (void **)
** - an array of two (void *) values. The first (void *) actually points
** to a function of type (int (*)(void *)). In order to invoke the connections
** busy-handler, this function should be invoked with the second (void *) in
** the array as the only argument. If it returns non-zero, then the operation
** should be retried. If it returns zero, the custom VFS should abandon the
** current operation.
**
** <li>[[SQLITE_FCNTL_TEMPFILENAME]]
** ^Application can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control
** to have SQLite generate a
** temporary filename using the same algorithm that is followed to generate
** temporary filenames for TEMP tables and other internal uses.  The
** argument should be a char** which will be filled with the filename
** written into memory obtained from [sqlite3_malloc()].  The caller should
** invoke [sqlite3_free()] on the result to avoid a memory leak.
**







|

|






|







979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
** file control occurs at the beginning of pragma statement analysis and so
** it is able to override built-in [PRAGMA] statements.
**
** <li>[[SQLITE_FCNTL_BUSYHANDLER]]
** ^The [SQLITE_FCNTL_BUSYHANDLER]
** file-control may be invoked by SQLite on the database file handle
** shortly after it is opened in order to provide a custom VFS with access
** to the connection's busy-handler callback. The argument is of type (void**)
** - an array of two (void *) values. The first (void *) actually points
** to a function of type (int (*)(void *)). In order to invoke the connection's
** busy-handler, this function should be invoked with the second (void *) in
** the array as the only argument. If it returns non-zero, then the operation
** should be retried. If it returns zero, the custom VFS should abandon the
** current operation.
**
** <li>[[SQLITE_FCNTL_TEMPFILENAME]]
** ^Applications can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control
** to have SQLite generate a
** temporary filename using the same algorithm that is followed to generate
** temporary filenames for TEMP tables and other internal uses.  The
** argument should be a char** which will be filled with the filename
** written into memory obtained from [sqlite3_malloc()].  The caller should
** invoke [sqlite3_free()] on the result to avoid a memory leak.
**
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109






1110
1111
1112
1113
1114
1115
1116
** connection or through transactions committed by separate database
** connections possibly in other processes. The [sqlite3_total_changes()]
** interface can be used to find if any database on the connection has changed,
** but that interface responds to changes on TEMP as well as MAIN and does
** not provide a mechanism to detect changes to MAIN only.  Also, the
** [sqlite3_total_changes()] interface responds to internal changes only and
** omits changes made by other database connections.  The
** [PRAGMA data_version] command provide a mechanism to detect changes to
** a single attached database that occur due to other database connections,
** but omits changes implemented by the database connection on which it is
** called.  This file control is the only mechanism to detect changes that
** happen either internally or externally and that are associated with
** a particular attached database.






** </ul>
*/
#define SQLITE_FCNTL_LOCKSTATE               1
#define SQLITE_FCNTL_GET_LOCKPROXYFILE       2
#define SQLITE_FCNTL_SET_LOCKPROXYFILE       3
#define SQLITE_FCNTL_LAST_ERRNO              4
#define SQLITE_FCNTL_SIZE_HINT               5







|





>
>
>
>
>
>







1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
** connection or through transactions committed by separate database
** connections possibly in other processes. The [sqlite3_total_changes()]
** interface can be used to find if any database on the connection has changed,
** but that interface responds to changes on TEMP as well as MAIN and does
** not provide a mechanism to detect changes to MAIN only.  Also, the
** [sqlite3_total_changes()] interface responds to internal changes only and
** omits changes made by other database connections.  The
** [PRAGMA data_version] command provides a mechanism to detect changes to
** a single attached database that occur due to other database connections,
** but omits changes implemented by the database connection on which it is
** called.  This file control is the only mechanism to detect changes that
** happen either internally or externally and that are associated with
** a particular attached database.
**
** <li>[[SQLITE_FCNTL_CKPT_DONE]]
** The [SQLITE_FCNTL_CKPT_DONE] opcode is invoked from within a checkpoint
** in wal mode after the client has finished copying pages from the wal
** file to the database file, but before the *-shm file is updated to
** record the fact that the pages have been checkpointed.
** </ul>
*/
#define SQLITE_FCNTL_LOCKSTATE               1
#define SQLITE_FCNTL_GET_LOCKPROXYFILE       2
#define SQLITE_FCNTL_SET_LOCKPROXYFILE       3
#define SQLITE_FCNTL_LAST_ERRNO              4
#define SQLITE_FCNTL_SIZE_HINT               5
1140
1141
1142
1143
1144
1145
1146

1147
1148
1149
1150
1151
1152
1153
#define SQLITE_FCNTL_PDB                    30
#define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE     31
#define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE    32
#define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE  33
#define SQLITE_FCNTL_LOCK_TIMEOUT           34
#define SQLITE_FCNTL_DATA_VERSION           35
#define SQLITE_FCNTL_SIZE_LIMIT             36


/* deprecated names */
#define SQLITE_GET_LOCKPROXYFILE      SQLITE_FCNTL_GET_LOCKPROXYFILE
#define SQLITE_SET_LOCKPROXYFILE      SQLITE_FCNTL_SET_LOCKPROXYFILE
#define SQLITE_LAST_ERRNO             SQLITE_FCNTL_LAST_ERRNO









>







1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
#define SQLITE_FCNTL_PDB                    30
#define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE     31
#define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE    32
#define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE  33
#define SQLITE_FCNTL_LOCK_TIMEOUT           34
#define SQLITE_FCNTL_DATA_VERSION           35
#define SQLITE_FCNTL_SIZE_LIMIT             36
#define SQLITE_FCNTL_CKPT_DONE              37

/* deprecated names */
#define SQLITE_GET_LOCKPROXYFILE      SQLITE_FCNTL_GET_LOCKPROXYFILE
#define SQLITE_SET_LOCKPROXYFILE      SQLITE_FCNTL_SET_LOCKPROXYFILE
#define SQLITE_LAST_ERRNO             SQLITE_FCNTL_LAST_ERRNO


1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
** the end.  Each time such an extension occurs, the iVersion field
** is incremented.  The iVersion value started out as 1 in
** SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2
** with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased
** to 3 with SQLite [version 3.7.6] on [dateof:3.7.6].  Additional fields
** may be appended to the sqlite3_vfs object and the iVersion value
** may increase again in future versions of SQLite.
** Note that the structure
** of the sqlite3_vfs object changes in the transition from
** SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0]
** and yet the iVersion field was not modified.
**
** The szOsFile field is the size of the subclassed [sqlite3_file]
** structure used by this VFS.  mxPathname is the maximum length of
** a pathname in this VFS.
**
** Registered sqlite3_vfs objects are kept on a linked list formed by
** the pNext pointer.  The [sqlite3_vfs_register()]







|
|

|







1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
** the end.  Each time such an extension occurs, the iVersion field
** is incremented.  The iVersion value started out as 1 in
** SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2
** with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased
** to 3 with SQLite [version 3.7.6] on [dateof:3.7.6].  Additional fields
** may be appended to the sqlite3_vfs object and the iVersion value
** may increase again in future versions of SQLite.
** Note that due to an oversight, the structure
** of the sqlite3_vfs object changed in the transition from
** SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0]
** and yet the iVersion field was not increased.
**
** The szOsFile field is the size of the subclassed [sqlite3_file]
** structure used by this VFS.  mxPathname is the maximum length of
** a pathname in this VFS.
**
** Registered sqlite3_vfs objects are kept on a linked list formed by
** the pNext pointer.  The [sqlite3_vfs_register()]
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
** API.  The SQLITE_OPEN_EXCLUSIVE flag, when paired with the 
** SQLITE_OPEN_CREATE, is used to indicate that file should always
** be created, and that it is an error if it already exists.
** It is <i>not</i> used to indicate the file should be opened 
** for exclusive access.
**
** ^At least szOsFile bytes of memory are allocated by SQLite
** to hold the  [sqlite3_file] structure passed as the third
** argument to xOpen.  The xOpen method does not have to
** allocate the structure; it should just fill it in.  Note that
** the xOpen method must set the sqlite3_file.pMethods to either
** a valid [sqlite3_io_methods] object or to NULL.  xOpen must do
** this even if the open fails.  SQLite expects that the sqlite3_file.pMethods
** element will be valid after xOpen returns regardless of the success
** or failure of the xOpen call.







|







1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
** API.  The SQLITE_OPEN_EXCLUSIVE flag, when paired with the 
** SQLITE_OPEN_CREATE, is used to indicate that file should always
** be created, and that it is an error if it already exists.
** It is <i>not</i> used to indicate the file should be opened 
** for exclusive access.
**
** ^At least szOsFile bytes of memory are allocated by SQLite
** to hold the [sqlite3_file] structure passed as the third
** argument to xOpen.  The xOpen method does not have to
** allocate the structure; it should just fill it in.  Note that
** the xOpen method must set the sqlite3_file.pMethods to either
** a valid [sqlite3_io_methods] object or to NULL.  xOpen must do
** this even if the open fails.  SQLite expects that the sqlite3_file.pMethods
** element will be valid after xOpen returns regardless of the success
** or failure of the xOpen call.
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
** allocators round up memory allocations at least to the next multiple
** of 8.  Some allocators round up to a larger multiple or to a power of 2.
** Every memory allocation request coming in through [sqlite3_malloc()]
** or [sqlite3_realloc()] first calls xRoundup.  If xRoundup returns 0, 
** that causes the corresponding memory allocation to fail.
**
** The xInit method initializes the memory allocator.  For example,
** it might allocate any require mutexes or initialize internal data
** structures.  The xShutdown method is invoked (indirectly) by
** [sqlite3_shutdown()] and should deallocate any resources acquired
** by xInit.  The pAppData pointer is used as the only parameter to
** xInit and xShutdown.
**
** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes
** the xInit method, so the xInit method need not be threadsafe.  The







|







1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
** allocators round up memory allocations at least to the next multiple
** of 8.  Some allocators round up to a larger multiple or to a power of 2.
** Every memory allocation request coming in through [sqlite3_malloc()]
** or [sqlite3_realloc()] first calls xRoundup.  If xRoundup returns 0, 
** that causes the corresponding memory allocation to fail.
**
** The xInit method initializes the memory allocator.  For example,
** it might allocate any required mutexes or initialize internal data
** structures.  The xShutdown method is invoked (indirectly) by
** [sqlite3_shutdown()] and should deallocate any resources acquired
** by xInit.  The pAppData pointer is used as the only parameter to
** xInit and xShutdown.
**
** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes
** the xInit method, so the xInit method need not be threadsafe.  The
1738
1739
1740
1741
1742
1743
1744

1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
**
** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
** interpreted as a boolean, which enables or disables the collection of
** memory allocation statistics. ^(When memory allocation statistics are
** disabled, the following SQLite interfaces become non-operational:
**   <ul>

**   <li> [sqlite3_memory_used()]
**   <li> [sqlite3_memory_highwater()]
**   <li> [sqlite3_soft_heap_limit64()]
**   <li> [sqlite3_status64()]
**   </ul>)^
** ^Memory allocation statistics are enabled by default unless SQLite is
** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
** allocation statistics are disabled by default.
** </dd>
**
** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
** <dd> The SQLITE_CONFIG_SCRATCH option is no longer used.
** </dd>
**
** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a memory pool
** that SQLite can use for the database page cache with the default page
** cache implementation.  
** This configuration option is a no-op if an application-define page
** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2].
** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to
** 8-byte aligned memory (pMem), the size of each page cache line (sz),
** and the number of cache lines (N).
** The sz argument should be the size of the largest database page
** (a power of two between 512 and 65536) plus some extra bytes for each
** page header.  ^The number of extra bytes needed by the page header







>


















|







1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
**
** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
** interpreted as a boolean, which enables or disables the collection of
** memory allocation statistics. ^(When memory allocation statistics are
** disabled, the following SQLite interfaces become non-operational:
**   <ul>
**   <li> [sqlite3_hard_heap_limit64()]
**   <li> [sqlite3_memory_used()]
**   <li> [sqlite3_memory_highwater()]
**   <li> [sqlite3_soft_heap_limit64()]
**   <li> [sqlite3_status64()]
**   </ul>)^
** ^Memory allocation statistics are enabled by default unless SQLite is
** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
** allocation statistics are disabled by default.
** </dd>
**
** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
** <dd> The SQLITE_CONFIG_SCRATCH option is no longer used.
** </dd>
**
** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a memory pool
** that SQLite can use for the database page cache with the default page
** cache implementation.  
** This configuration option is a no-op if an application-defined page
** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2].
** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to
** 8-byte aligned memory (pMem), the size of each page cache line (sz),
** and the number of cache lines (N).
** The sz argument should be the size of the largest database page
** (a power of two between 512 and 65536) plus some extra bytes for each
** page header.  ^The number of extra bytes needed by the page header
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261











































2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279


2280
2281
2282
2283
2284
2285
2286
2287
** additional information. This feature can also be turned on and off
** using the [PRAGMA legacy_alter_table] statement.
** </dd>
**
** [[SQLITE_DBCONFIG_DQS_DML]]
** <dt>SQLITE_DBCONFIG_DQS_DML</td>
** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates
** the legacy [double-quoted string literal] misfeature for DML statement
** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The
** default value of this setting is determined by the [-DSQLITE_DQS]
** compile-time option.
** </dd>
**
** [[SQLITE_DBCONFIG_DQS_DDL]]
** <dt>SQLITE_DBCONFIG_DQS_DDL</td>
** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates
** the legacy [double-quoted string literal] misfeature for DDL statements,
** such as CREATE TABLE and CREATE INDEX. The
** default value of this setting is determined by the [-DSQLITE_DQS]
** compile-time option.
** </dd>











































** </dl>
*/
#define SQLITE_DBCONFIG_MAINDBNAME            1000 /* const char* */
#define SQLITE_DBCONFIG_LOOKASIDE             1001 /* void* int int */
#define SQLITE_DBCONFIG_ENABLE_FKEY           1002 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_TRIGGER        1003 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE      1006 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_QPSG           1007 /* int int* */
#define SQLITE_DBCONFIG_TRIGGER_EQP           1008 /* int int* */
#define SQLITE_DBCONFIG_RESET_DATABASE        1009 /* int int* */
#define SQLITE_DBCONFIG_DEFENSIVE             1010 /* int int* */
#define SQLITE_DBCONFIG_WRITABLE_SCHEMA       1011 /* int int* */
#define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE    1012 /* int int* */
#define SQLITE_DBCONFIG_DQS_DML               1013 /* int int* */
#define SQLITE_DBCONFIG_DQS_DDL               1014 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_VIEW           1015 /* int int* */


#define SQLITE_DBCONFIG_MAX                   1015 /* Largest DBCONFIG */

/*
** CAPI3REF: Enable Or Disable Extended Result Codes
** METHOD: sqlite3
**
** ^The sqlite3_extended_result_codes() routine enables or disables the
** [extended result codes] feature of SQLite. ^The extended result







|













>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


















>
>
|







2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
** additional information. This feature can also be turned on and off
** using the [PRAGMA legacy_alter_table] statement.
** </dd>
**
** [[SQLITE_DBCONFIG_DQS_DML]]
** <dt>SQLITE_DBCONFIG_DQS_DML</td>
** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates
** the legacy [double-quoted string literal] misfeature for DML statements
** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The
** default value of this setting is determined by the [-DSQLITE_DQS]
** compile-time option.
** </dd>
**
** [[SQLITE_DBCONFIG_DQS_DDL]]
** <dt>SQLITE_DBCONFIG_DQS_DDL</td>
** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates
** the legacy [double-quoted string literal] misfeature for DDL statements,
** such as CREATE TABLE and CREATE INDEX. The
** default value of this setting is determined by the [-DSQLITE_DQS]
** compile-time option.
** </dd>
**
** [[SQLITE_DBCONFIG_TRUSTED_SCHEMA]]
** <dt>SQLITE_DBCONFIG_TRUSTED_SCHEMA</td>
** <dd>The SQLITE_DBCONFIG_TRUSTED_SCHEMA option tells SQLite to
** assume that database schemas (the contents of the [sqlite_master] tables)
** are untainted by malicious content.
** When the SQLITE_DBCONFIG_TRUSTED_SCHEMA option is disabled, SQLite
** takes additional defensive steps to protect the application from harm
** including:
** <ul>
** <li> Prohibit the use of SQL functions inside triggers, views,
** CHECK constraints, DEFAULT clauses, expression indexes, 
** partial indexes, or generated columns
** unless those functions are tagged with [SQLITE_INNOCUOUS].
** <li> Prohibit the use of virtual tables inside of triggers or views
** unless those virtual tables are tagged with [SQLITE_VTAB_INNOCUOUS].
** </ul>
** This setting defaults to "on" for legacy compatibility, however
** all applications are advised to turn it off if possible. This setting
** can also be controlled using the [PRAGMA trusted_schema] statement.
** </dd>
**
** [[SQLITE_DBCONFIG_LEGACY_FILE_FORMAT]]
** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</td>
** <dd>The SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option activates or deactivates
** the legacy file format flag.  When activated, this flag causes all newly
** created database file to have a schema format version number (the 4-byte
** integer found at offset 44 into the database header) of 1.  This in turn
** means that the resulting database file will be readable and writable by
** any SQLite version back to 3.0.0 ([dateof:3.0.0]).  Without this setting,
** newly created databases are generally not understandable by SQLite versions
** prior to 3.3.0 ([dateof:3.3.0]).  As these words are written, there
** is now scarcely any need to generated database files that are compatible 
** all the way back to version 3.0.0, and so this setting is of little
** practical use, but is provided so that SQLite can continue to claim the
** ability to generate new database files that are compatible with  version
** 3.0.0.
** <p>Note that when the SQLITE_DBCONFIG_LEGACY_FILE_FORMAT setting is on,
** the [VACUUM] command will fail with an obscure error when attempting to
** process a table with generated columns and a descending index.  This is
** not considered a bug since SQLite versions 3.3.0 and earlier do not support
** either generated columns or decending indexes.
** </dd>
** </dl>
*/
#define SQLITE_DBCONFIG_MAINDBNAME            1000 /* const char* */
#define SQLITE_DBCONFIG_LOOKASIDE             1001 /* void* int int */
#define SQLITE_DBCONFIG_ENABLE_FKEY           1002 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_TRIGGER        1003 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE      1006 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_QPSG           1007 /* int int* */
#define SQLITE_DBCONFIG_TRIGGER_EQP           1008 /* int int* */
#define SQLITE_DBCONFIG_RESET_DATABASE        1009 /* int int* */
#define SQLITE_DBCONFIG_DEFENSIVE             1010 /* int int* */
#define SQLITE_DBCONFIG_WRITABLE_SCHEMA       1011 /* int int* */
#define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE    1012 /* int int* */
#define SQLITE_DBCONFIG_DQS_DML               1013 /* int int* */
#define SQLITE_DBCONFIG_DQS_DDL               1014 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_VIEW           1015 /* int int* */
#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT    1016 /* int int* */
#define SQLITE_DBCONFIG_TRUSTED_SCHEMA        1017 /* int int* */
#define SQLITE_DBCONFIG_MAX                   1017 /* Largest DBCONFIG */

/*
** CAPI3REF: Enable Or Disable Extended Result Codes
** METHOD: sqlite3
**
** ^The sqlite3_extended_result_codes() routine enables or disables the
** [extended result codes] feature of SQLite. ^The extended result
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE
** that is inside an explicit transaction, then the entire transaction
** will be rolled back automatically.
**
** ^The sqlite3_interrupt(D) call is in effect until all currently running
** SQL statements on [database connection] D complete.  ^Any new SQL statements
** that are started after the sqlite3_interrupt() call and before the 
** running statements reaches zero are interrupted as if they had been
** running prior to the sqlite3_interrupt() call.  ^New SQL statements
** that are started after the running statement count reaches zero are
** not effected by the sqlite3_interrupt().
** ^A call to sqlite3_interrupt(D) that occurs when there are no running
** SQL statements is a no-op and has no effect on SQL statements
** that are started after the sqlite3_interrupt() call returns.
*/







|







2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE
** that is inside an explicit transaction, then the entire transaction
** will be rolled back automatically.
**
** ^The sqlite3_interrupt(D) call is in effect until all currently running
** SQL statements on [database connection] D complete.  ^Any new SQL statements
** that are started after the sqlite3_interrupt() call and before the 
** running statement count reaches zero are interrupted as if they had been
** running prior to the sqlite3_interrupt() call.  ^New SQL statements
** that are started after the running statement count reaches zero are
** not effected by the sqlite3_interrupt().
** ^A call to sqlite3_interrupt(D) that occurs when there are no running
** SQL statements is a no-op and has no effect on SQL statements
** that are started after the sqlite3_interrupt() call returns.
*/
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
**        Name        | Age
**        -----------------------
**        Alice       | 43
**        Bob         | 28
**        Cindy       | 21
** </pre></blockquote>
**
** There are two column (M==2) and three rows (N==3).  Thus the
** result table has 8 entries.  Suppose the result table is stored
** in an array names azResult.  Then azResult holds this content:
**
** <blockquote><pre>
**        azResult&#91;0] = "Name";
**        azResult&#91;1] = "Age";
**        azResult&#91;2] = "Alice";
**        azResult&#91;3] = "43";
**        azResult&#91;4] = "Bob";







|

|







2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
**        Name        | Age
**        -----------------------
**        Alice       | 43
**        Bob         | 28
**        Cindy       | 21
** </pre></blockquote>
**
** There are two columns (M==2) and three rows (N==3).  Thus the
** result table has 8 entries.  Suppose the result table is stored
** in an array named azResult.  Then azResult holds this content:
**
** <blockquote><pre>
**        azResult&#91;0] = "Name";
**        azResult&#91;1] = "Age";
**        azResult&#91;2] = "Alice";
**        azResult&#91;3] = "43";
**        azResult&#91;4] = "Bob";
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);

/*
** CAPI3REF: Memory Allocation Subsystem
**
** The SQLite core uses these three routines for all of its own
** internal memory allocation needs. "Core" in the previous sentence
** does not include operating-system specific VFS implementation.  The
** Windows VFS uses native malloc() and free() for some operations.
**
** ^The sqlite3_malloc() routine returns a pointer to a block
** of memory at least N bytes in length, where N is the parameter.
** ^If sqlite3_malloc() is unable to obtain sufficient free
** memory, it returns a NULL pointer.  ^If the parameter N to
** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns







|







2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);

/*
** CAPI3REF: Memory Allocation Subsystem
**
** The SQLite core uses these three routines for all of its own
** internal memory allocation needs. "Core" in the previous sentence
** does not include operating-system specific [VFS] implementation.  The
** Windows VFS uses native malloc() and free() for some operations.
**
** ^The sqlite3_malloc() routine returns a pointer to a block
** of memory at least N bytes in length, where N is the parameter.
** ^If sqlite3_malloc() is unable to obtain sufficient free
** memory, it returns a NULL pointer.  ^If the parameter N to
** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
**
** ^The memory returned by sqlite3_malloc(), sqlite3_realloc(),
** sqlite3_malloc64(), and sqlite3_realloc64()
** is always aligned to at least an 8 byte boundary, or to a
** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time
** option is used.
**
** In SQLite version 3.5.0 and 3.5.1, it was possible to define
** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in
** implementation of these routines to be omitted.  That capability
** is no longer provided.  Only built-in memory allocators can be used.
**
** Prior to SQLite version 3.7.10, the Windows OS interface layer called
** the system malloc() and free() directly when converting
** filenames between the UTF-8 encoding used by SQLite
** and whatever filename encoding is used by the particular Windows
** installation.  Memory allocation errors were detected, but
** they were reported back as [SQLITE_CANTOPEN] or
** [SQLITE_IOERR] rather than [SQLITE_NOMEM].
**
** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()]
** must be either NULL or else pointers obtained from a prior
** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have
** not yet been released.
**
** The application must not read or write any part of
** a block of memory after it has been released using







<
<
<
<
<
<
<
<
<
<
<
<
<







2860
2861
2862
2863
2864
2865
2866













2867
2868
2869
2870
2871
2872
2873
**
** ^The memory returned by sqlite3_malloc(), sqlite3_realloc(),
** sqlite3_malloc64(), and sqlite3_realloc64()
** is always aligned to at least an 8 byte boundary, or to a
** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time
** option is used.
**













** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()]
** must be either NULL or else pointers obtained from a prior
** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have
** not yet been released.
**
** The application must not read or write any part of
** a block of memory after it has been released using
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878

/*
** CAPI3REF: Pseudo-Random Number Generator
**
** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
** select random [ROWID | ROWIDs] when inserting new records into a table that
** already uses the largest possible [ROWID].  The PRNG is also used for
** the build-in random() and randomblob() SQL functions.  This interface allows
** applications to access the same PRNG for other purposes.
**
** ^A call to this routine stores N bytes of randomness into buffer P.
** ^The P parameter can be a NULL pointer.
**
** ^If this routine has not been previously called or if the previous
** call had N less than one or a NULL pointer for P, then the PRNG is







|







2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922

/*
** CAPI3REF: Pseudo-Random Number Generator
**
** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
** select random [ROWID | ROWIDs] when inserting new records into a table that
** already uses the largest possible [ROWID].  The PRNG is also used for
** the built-in random() and randomblob() SQL functions.  This interface allows
** applications to access the same PRNG for other purposes.
**
** ^A call to this routine stores N bytes of randomness into buffer P.
** ^The P parameter can be a NULL pointer.
**
** ^If this routine has not been previously called or if the previous
** call had N less than one or a NULL pointer for P, then the PRNG is
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265








































3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
** Whether or not an error occurs when it is opened, resources
** associated with the [database connection] handle should be released by
** passing it to [sqlite3_close()] when it is no longer required.
**
** The sqlite3_open_v2() interface works like sqlite3_open()
** except that it accepts two additional parameters for additional control
** over the new database connection.  ^(The flags parameter to
** sqlite3_open_v2() can take one of
** the following three values, optionally combined with the 
** [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], [SQLITE_OPEN_SHAREDCACHE],
** [SQLITE_OPEN_PRIVATECACHE], and/or [SQLITE_OPEN_URI] flags:)^
**
** <dl>
** ^(<dt>[SQLITE_OPEN_READONLY]</dt>
** <dd>The database is opened in read-only mode.  If the database does not
** already exist, an error is returned.</dd>)^
**
** ^(<dt>[SQLITE_OPEN_READWRITE]</dt>
** <dd>The database is opened for reading and writing if possible, or reading
** only if the file is write protected by the operating system.  In either
** case the database must already exist, otherwise an error is returned.</dd>)^
**
** ^(<dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt>
** <dd>The database is opened for reading and writing, and is created if
** it does not already exist. This is the behavior that is always used for
** sqlite3_open() and sqlite3_open16().</dd>)^
** </dl>
**








































** If the 3rd parameter to sqlite3_open_v2() is not one of the
** combinations shown above optionally combined with other
** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits]
** then the behavior is undefined.
**
** ^If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection
** opens in the multi-thread [threading mode] as long as the single-thread
** mode has not been set at compile-time or start-time.  ^If the
** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens
** in the serialized [threading mode] unless single-thread was
** previously selected at compile-time or start-time.
** ^The [SQLITE_OPEN_SHAREDCACHE] flag causes the database connection to be
** eligible to use [shared cache mode], regardless of whether or not shared
** cache is enabled using [sqlite3_enable_shared_cache()].  ^The
** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not
** participate in [shared cache mode] even if it is enabled.
**
** ^The fourth parameter to sqlite3_open_v2() is the name of the
** [sqlite3_vfs] object that defines the operating system interface that
** the new database connection should use.  ^If the fourth parameter is
** a NULL pointer then the default [sqlite3_vfs] object is used.
**
** ^If the filename is ":memory:", then a private, temporary in-memory database
** is created for the connection.  ^This in-memory database will vanish when







|
|
<
<

















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|



<
<
<
<
<
<
<
<
<
<
<
<







3282
3283
3284
3285
3286
3287
3288
3289
3290


3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352












3353
3354
3355
3356
3357
3358
3359
** Whether or not an error occurs when it is opened, resources
** associated with the [database connection] handle should be released by
** passing it to [sqlite3_close()] when it is no longer required.
**
** The sqlite3_open_v2() interface works like sqlite3_open()
** except that it accepts two additional parameters for additional control
** over the new database connection.  ^(The flags parameter to
** sqlite3_open_v2() must include, at a minimum, one of the following
** three flag combinations:)^


**
** <dl>
** ^(<dt>[SQLITE_OPEN_READONLY]</dt>
** <dd>The database is opened in read-only mode.  If the database does not
** already exist, an error is returned.</dd>)^
**
** ^(<dt>[SQLITE_OPEN_READWRITE]</dt>
** <dd>The database is opened for reading and writing if possible, or reading
** only if the file is write protected by the operating system.  In either
** case the database must already exist, otherwise an error is returned.</dd>)^
**
** ^(<dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt>
** <dd>The database is opened for reading and writing, and is created if
** it does not already exist. This is the behavior that is always used for
** sqlite3_open() and sqlite3_open16().</dd>)^
** </dl>
**
** In addition to the required flags, the following optional flags are
** also supported:
**
** <dl>
** ^(<dt>[SQLITE_OPEN_URI]</dt>
** <dd>The filename can be interpreted as a URI if this flag is set.</dd>)^
**
** ^(<dt>[SQLITE_OPEN_MEMORY]</dt>
** <dd>The database will be opened as an in-memory database.  The database
** is named by the "filename" argument for the purposes of cache-sharing,
** if shared cache mode is enabled, but the "filename" is otherwise ignored.
** </dd>)^
**
** ^(<dt>[SQLITE_OPEN_NOMUTEX]</dt>
** <dd>The new database connection will use the "multi-thread"
** [threading mode].)^  This means that separate threads are allowed
** to use SQLite at the same time, as long as each thread is using
** a different [database connection].
**
** ^(<dt>[SQLITE_OPEN_FULLMUTEX]</dt>
** <dd>The new database connection will use the "serialized"
** [threading mode].)^  This means the multiple threads can safely
** attempt to use the same database connection at the same time.
** (Mutexes will block any actual concurrency, but in this mode
** there is no harm in trying.)
**
** ^(<dt>[SQLITE_OPEN_SHAREDCACHE]</dt>
** <dd>The database is opened [shared cache] enabled, overriding
** the default shared cache setting provided by
** [sqlite3_enable_shared_cache()].)^
**
** ^(<dt>[SQLITE_OPEN_PRIVATECACHE]</dt>
** <dd>The database is opened [shared cache] disabled, overriding
** the default shared cache setting provided by
** [sqlite3_enable_shared_cache()].)^
**
** [[OPEN_NOFOLLOW]] ^(<dt>[SQLITE_OPEN_NOFOLLOW]</dt>
** <dd>The database filename is not allowed to be a symbolic link</dd>
** </dl>)^
**
** If the 3rd parameter to sqlite3_open_v2() is not one of the
** required combinations shown above optionally combined with other
** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits]
** then the behavior is undefined.
**












** ^The fourth parameter to sqlite3_open_v2() is the name of the
** [sqlite3_vfs] object that defines the operating system interface that
** the new database connection should use.  ^If the fourth parameter is
** a NULL pointer then the default [sqlite3_vfs] object is used.
**
** ^If the filename is ":memory:", then a private, temporary in-memory database
** is created for the connection.  ^This in-memory database will vanish when
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490







3491
3492
3493
3494
3495
3496








3497
3498
3499
3500
3501
3502
































3503
3504
3505
3506
3507
3508
3509
  int flags,              /* Flags */
  const char *zVfs        /* Name of VFS module to use */
);

/*
** CAPI3REF: Obtain Values For URI Parameters
**
** These are utility routines, useful to VFS implementations, that check
** to see if a database file was a URI that contained a specific query 
** parameter, and if so obtains the value of that query parameter.
**
** If F is the database filename pointer passed into the xOpen() method of 
** a VFS implementation when the flags parameter to xOpen() has one or 
** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and
** P is the name of the query parameter, then
** sqlite3_uri_parameter(F,P) returns the value of the P
** parameter if it exists or a NULL pointer if P does not appear as a 
** query parameter on F.  If P is a query parameter of F
** has no explicit value, then sqlite3_uri_parameter(F,P) returns
** a pointer to an empty string.
**
** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean
** parameter and returns true (1) or false (0) according to the value
** of P.  The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the
** value of query parameter P is one of "yes", "true", or "on" in any
** case or if the value begins with a non-zero number.  The 
** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of
** query parameter P is one of "no", "false", or "off" in any case or
** if the value begins with a numeric zero.  If P is not a query
** parameter on F or if the value of P is does not match any of the
** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0).
**
** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a
** 64-bit signed integer and returns that integer, or D if P does not
** exist.  If the value of P is something other than an integer, then
** zero is returned.







** 
** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and
** sqlite3_uri_boolean(F,P,B) returns B.  If F is not a NULL pointer and
** is not a database file pathname pointer that SQLite passed into the xOpen
** VFS method, then the behavior of this routine is undefined and probably
** undesirable.








**
** See the [URI filename] documentation for additional information.
*/
SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);


































/*
** CAPI3REF: Error Codes And Messages
** METHOD: sqlite3
**
** ^If the most recent sqlite3_* API call associated with 







|
|



|
<
|


|











|






>
>
>
>
>
>
>



|
|
|
>
>
>
>
>
>
>
>






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537

3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
  int flags,              /* Flags */
  const char *zVfs        /* Name of VFS module to use */
);

/*
** CAPI3REF: Obtain Values For URI Parameters
**
** These are utility routines, useful to [VFS|custom VFS implementations],
** that check if a database file was a URI that contained a specific query 
** parameter, and if so obtains the value of that query parameter.
**
** If F is the database filename pointer passed into the xOpen() method of 
** a VFS implementation or it is the return value of [sqlite3_db_filename()]

** and if P is the name of the query parameter, then
** sqlite3_uri_parameter(F,P) returns the value of the P
** parameter if it exists or a NULL pointer if P does not appear as a 
** query parameter on F.  If P is a query parameter of F and it
** has no explicit value, then sqlite3_uri_parameter(F,P) returns
** a pointer to an empty string.
**
** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean
** parameter and returns true (1) or false (0) according to the value
** of P.  The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the
** value of query parameter P is one of "yes", "true", or "on" in any
** case or if the value begins with a non-zero number.  The 
** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of
** query parameter P is one of "no", "false", or "off" in any case or
** if the value begins with a numeric zero.  If P is not a query
** parameter on F or if the value of P does not match any of the
** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0).
**
** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a
** 64-bit signed integer and returns that integer, or D if P does not
** exist.  If the value of P is something other than an integer, then
** zero is returned.
**
** The sqlite3_uri_key(F,N) returns a pointer to the name (not
** the value) of the N-th query parameter for filename F, or a NULL
** pointer if N is less than zero or greater than the number of query
** parameters minus 1.  The N value is zero-based so N should be 0 to obtain
** the name of the first query parameter, 1 for the second parameter, and
** so forth.
** 
** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and
** sqlite3_uri_boolean(F,P,B) returns B.  If F is not a NULL pointer and
** is not a database file pathname pointer that the SQLite core passed
** into the xOpen VFS method, then the behavior of this routine is undefined
** and probably undesirable.
**
** Beginning with SQLite [version 3.31.0] ([dateof:3.31.0]) the input F
** parameter can also be the name of a rollback journal file or WAL file
** in addition to the main database file.  Prior to version 3.31.0, these
** routines would only work if F was the name of the main database file.
** When the F parameter is the name of the rollback journal or WAL file,
** it has access to all the same query parameters as were found on the
** main database file.
**
** See the [URI filename] documentation for additional information.
*/
SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
SQLITE_API const char *sqlite3_uri_key(const char *zFilename, int N);

/*
** CAPI3REF:  Translate filenames
**
** These routines are available to [VFS|custom VFS implementations] for
** translating filenames between the main database file, the journal file,
** and the WAL file.
**
** If F is the name of an sqlite database file, journal file, or WAL file
** passed by the SQLite core into the VFS, then sqlite3_filename_database(F)
** returns the name of the corresponding database file.
**
** If F is the name of an sqlite database file, journal file, or WAL file
** passed by the SQLite core into the VFS, or if F is a database filename
** obtained from [sqlite3_db_filename()], then sqlite3_filename_journal(F)
** returns the name of the corresponding rollback journal file.
**
** If F is the name of an sqlite database file, journal file, or WAL file
** that was passed by the SQLite core into the VFS, or if F is a database
** filename obtained from [sqlite3_db_filename()], then
** sqlite3_filename_wal(F) returns the name of the corresponding
** WAL file.
**
** In all of the above, if F is not the name of a database, journal or WAL
** filename passed into the VFS from the SQLite core and F is not the
** return value from [sqlite3_db_filename()], then the result is
** undefined and is likely a memory access violation.
*/
SQLITE_API const char *sqlite3_filename_database(const char*);
SQLITE_API const char *sqlite3_filename_journal(const char*);
SQLITE_API const char *sqlite3_filename_wal(const char*);


/*
** CAPI3REF: Error Codes And Messages
** METHOD: sqlite3
**
** ^If the most recent sqlite3_* API call associated with 
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code
** and the application would have to make a second call to [sqlite3_reset()]
** in order to find the underlying cause of the problem. With the "v2" prepare
** interfaces, the underlying reason for the error is returned immediately.
** </li>
**
** <li>
** ^If the specific value bound to [parameter | host parameter] in the 
** WHERE clause might influence the choice of query plan for a statement,
** then the statement will be automatically recompiled, as if there had been 
** a schema change, on the first  [sqlite3_step()] call following any change
** to the [sqlite3_bind_text | bindings] of that [parameter]. 
** ^The specific value of WHERE-clause [parameter] might influence the 
** choice of query plan if the parameter is the left-hand side of a [LIKE]
** or [GLOB] operator or if the parameter is compared to an indexed column
** and the [SQLITE_ENABLE_STAT4] compile-time option is enabled.
** </li>
** </ol>
**
** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having







|


|

|







3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code
** and the application would have to make a second call to [sqlite3_reset()]
** in order to find the underlying cause of the problem. With the "v2" prepare
** interfaces, the underlying reason for the error is returned immediately.
** </li>
**
** <li>
** ^If the specific value bound to a [parameter | host parameter] in the 
** WHERE clause might influence the choice of query plan for a statement,
** then the statement will be automatically recompiled, as if there had been 
** a schema change, on the first [sqlite3_step()] call following any change
** to the [sqlite3_bind_text | bindings] of that [parameter]. 
** ^The specific value of a WHERE-clause [parameter] might influence the 
** choice of query plan if the parameter is the left-hand side of a [LIKE]
** or [GLOB] operator or if the parameter is compared to an indexed column
** and the [SQLITE_ENABLE_STAT4] compile-time option is enabled.
** </li>
** </ol>
**
** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
** ^The first argument to these interfaces is a [prepared statement].
** ^These functions return information about the Nth result column returned by
** the statement, where N is the second function argument.
** ^The left-most column is column 0 for these routines.
**
** ^If the Nth column returned by the statement is an expression or
** subquery and is not a column value, then all of these functions return
** NULL.  ^These routine might also return NULL if a memory allocation error
** occurs.  ^Otherwise, they return the name of the attached database, table,
** or column that query result column was extracted from.
**
** ^As with all other SQLite APIs, those whose names end with "16" return
** UTF-16 encoded strings and the other functions return UTF-8.
**
** ^These APIs are only available if the library was compiled with the
** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol.
**
** If two or more threads call one or more of these routines against the same
** prepared statement and column at the same time then the results are
** undefined.
**
** If two or more threads call one or more
** [sqlite3_column_database_name | column metadata interfaces]
** for the same [prepared statement] and result column
** at the same time then the results are undefined.
*/
SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);
SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);







|









<
<
<
<







4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460




4461
4462
4463
4464
4465
4466
4467
** ^The first argument to these interfaces is a [prepared statement].
** ^These functions return information about the Nth result column returned by
** the statement, where N is the second function argument.
** ^The left-most column is column 0 for these routines.
**
** ^If the Nth column returned by the statement is an expression or
** subquery and is not a column value, then all of these functions return
** NULL.  ^These routines might also return NULL if a memory allocation error
** occurs.  ^Otherwise, they return the name of the attached database, table,
** or column that query result column was extracted from.
**
** ^As with all other SQLite APIs, those whose names end with "16" return
** UTF-16 encoded strings and the other functions return UTF-8.
**
** ^These APIs are only available if the library was compiled with the
** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol.
**




** If two or more threads call one or more
** [sqlite3_column_database_name | column metadata interfaces]
** for the same [prepared statement] and result column
** at the same time then the results are undefined.
*/
SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);
SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
/*
** CAPI3REF: Number of columns in a result set
** METHOD: sqlite3_stmt
**
** ^The sqlite3_data_count(P) interface returns the number of columns in the
** current row of the result set of [prepared statement] P.
** ^If prepared statement P does not have results ready to return
** (via calls to the [sqlite3_column_int | sqlite3_column_*()] of
** interfaces) then sqlite3_data_count(P) returns 0.
** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer.
** ^The sqlite3_data_count(P) routine returns 0 if the previous call to
** [sqlite3_step](P) returned [SQLITE_DONE].  ^The sqlite3_data_count(P)
** will return non-zero if previous call to [sqlite3_step](P) returned
** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum]
** where it always returns zero since each step of that multi-step







|







4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
/*
** CAPI3REF: Number of columns in a result set
** METHOD: sqlite3_stmt
**
** ^The sqlite3_data_count(P) interface returns the number of columns in the
** current row of the result set of [prepared statement] P.
** ^If prepared statement P does not have results ready to return
** (via calls to the [sqlite3_column_int | sqlite3_column()] family of
** interfaces) then sqlite3_data_count(P) returns 0.
** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer.
** ^The sqlite3_data_count(P) routine returns 0 if the previous call to
** [sqlite3_step](P) returned [SQLITE_DONE].  ^The sqlite3_data_count(P)
** will return non-zero if previous call to [sqlite3_step](P) returned
** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum]
** where it always returns zero since each step of that multi-step
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
*/
SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);

/*
** CAPI3REF: Create Or Redefine SQL Functions
** KEYWORDS: {function creation routines}
** KEYWORDS: {application-defined SQL function}
** KEYWORDS: {application-defined SQL functions}
** METHOD: sqlite3
**
** ^These functions (collectively known as "function creation routines")
** are used to add SQL functions or aggregates or to redefine the behavior
** of existing SQL functions or aggregates. The only differences between
** the three "sqlite3_create_function*" routines are the text encoding 
** expected for the second parameter (the name of the function being 







<
<







4914
4915
4916
4917
4918
4919
4920


4921
4922
4923
4924
4925
4926
4927
** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
*/
SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);

/*
** CAPI3REF: Create Or Redefine SQL Functions
** KEYWORDS: {function creation routines}


** METHOD: sqlite3
**
** ^These functions (collectively known as "function creation routines")
** are used to add SQL functions or aggregates or to redefine the behavior
** of existing SQL functions or aggregates. The only differences between
** the three "sqlite3_create_function*" routines are the text encoding 
** expected for the second parameter (the name of the function being 
4859
4860
4861
4862
4863
4864
4865




4866
4867







4868
4869
4870
4871
4872
4873
4874
4875
** deterministic.  The built-in [random()] SQL function is an example of a
** function that is not deterministic.  The SQLite query planner is able to
** perform additional optimizations on deterministic functions, so use
** of the [SQLITE_DETERMINISTIC] flag is recommended where possible.
**
** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY]
** flag, which if present prevents the function from being invoked from




** within VIEWs or TRIGGERs.  For security reasons, the [SQLITE_DIRECTONLY]
** flag is recommended for any application-defined SQL function that has







** side-effects.
**
** ^(The fifth parameter is an arbitrary pointer.  The implementation of the
** function can gain access to this pointer using [sqlite3_user_data()].)^
**
** ^The sixth, seventh and eighth parameters passed to the three
** "sqlite3_create_function*" functions, xFunc, xStep and xFinal, are
** pointers to C-language functions that implement the SQL function or







>
>
>
>
|
|
>
>
>
>
>
>
>
|







4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
** deterministic.  The built-in [random()] SQL function is an example of a
** function that is not deterministic.  The SQLite query planner is able to
** perform additional optimizations on deterministic functions, so use
** of the [SQLITE_DETERMINISTIC] flag is recommended where possible.
**
** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY]
** flag, which if present prevents the function from being invoked from
** within VIEWs, TRIGGERs, CHECK constraints, generated column expressions,
** index expressions, or the WHERE clause of partial indexes.
**
** <span style="background-color:#ffff90;">
** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
** all application-defined SQL functions that do not need to be
** used inside of triggers, view, CHECK constraints, or other elements of
** the database schema.  This flags is especially recommended for SQL 
** functions that have side effects or reveal internal application state.
** Without this flag, an attacker might be able to modify the schema of
** a database file to include invocations of the function with parameters
** chosen by the attacker, which the application will then execute when
** the database file is opened and read.
** </span>
**
** ^(The fifth parameter is an arbitrary pointer.  The implementation of the
** function can gain access to this pointer using [sqlite3_user_data()].)^
**
** ^The sixth, seventh and eighth parameters passed to the three
** "sqlite3_create_function*" functions, xFunc, xStep and xFinal, are
** pointers to C-language functions that implement the SQL function or
4980
4981
4982
4983
4984
4985
4986


4987
4988
4989






4990

4991
4992


4993
4994

















4995




4996


4997
4998

4999
5000
5001
5002
5003
5004
5005


5006
5007
5008
5009

5010
5011
5012
5013
5014
5015
5016
** CAPI3REF: Function Flags
**
** These constants may be ORed together with the 
** [SQLITE_UTF8 | preferred text encoding] as the fourth argument
** to [sqlite3_create_function()], [sqlite3_create_function16()], or
** [sqlite3_create_function_v2()].
**


** The SQLITE_DETERMINISTIC flag means that the new function will always
** maps the same inputs into the same output.  The abs() function is
** deterministic, for example, but randomblob() is not.






**

** The SQLITE_DIRECTONLY flag means that the function may only be invoked
** from top-level SQL, and cannot be used in VIEWs or TRIGGERs.  This is


** a security feature which is recommended for all 
** [application-defined SQL functions] that have side-effects.  This flag 

















** prevents an attacker from adding triggers and views to a schema then 




** tricking a high-privilege application into causing unintended side-effects


** while performing ordinary queries.
**

** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call
** [sqlite3_value_subtype()] to inspect the sub-types of its arguments.
** Specifying this flag makes no difference for scalar or aggregate user
** functions. However, if it is not specified for a user-defined window
** function, then any sub-types belonging to arguments passed to the window
** function may be discarded before the window function is called (i.e.
** sqlite3_value_subtype() will always return 0).


*/
#define SQLITE_DETERMINISTIC    0x000000800
#define SQLITE_DIRECTONLY       0x000080000
#define SQLITE_SUBTYPE          0x000100000


/*
** CAPI3REF: Deprecated Functions
** DEPRECATED
**
** These functions are [deprecated].  In order to maintain
** backwards compatibility with older code, these functions continue 







>
>
|
|
|
>
>
>
>
>
>
|
>

|
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
|
>
>
|

>







>
>




>







5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
** CAPI3REF: Function Flags
**
** These constants may be ORed together with the 
** [SQLITE_UTF8 | preferred text encoding] as the fourth argument
** to [sqlite3_create_function()], [sqlite3_create_function16()], or
** [sqlite3_create_function_v2()].
**
** <dl>
** [[SQLITE_DETERMINISTIC]] <dt>SQLITE_DETERMINISTIC</dt><dd>
** The SQLITE_DETERMINISTIC flag means that the new function always gives
** the same output when the input parameters are the same.
** The [abs|abs() function] is deterministic, for example, but
** [randomblob|randomblob()] is not.  Functions must
** be deterministic in order to be used in certain contexts such as
** with the WHERE clause of [partial indexes] or in [generated columns].
** SQLite might also optimize deterministic functions by factoring them
** out of inner loops.
** </dd>
** 
** [[SQLITE_DIRECTONLY]] <dt>SQLITE_DIRECTONLY</dt><dd>
** The SQLITE_DIRECTONLY flag means that the function may only be invoked
** from top-level SQL, and cannot be used in VIEWs or TRIGGERs nor in 
** schema structures such as [CHECK constraints], [DEFAULT clauses],
** [expression indexes], [partial indexes], or [generated columns].
** The SQLITE_DIRECTONLY flags is a security feature which is recommended
** for all [application-defined SQL functions], and especially for functions
** that have side-effects or that could potentially leak sensitive
** information.
** </dd>
**
** [[SQLITE_INNOCUOUS]] <dt>SQLITE_INNOCUOUS</dt><dd>
** The SQLITE_INNOCUOUS flag means that the function is unlikely
** to cause problems even if misused.  An innocuous function should have
** no side effects and should not depend on any values other than its
** input parameters. The [abs|abs() function] is an example of an
** innocuous function.
** The [load_extension() SQL function] is not innocuous because of its
** side effects.
** <p> SQLITE_INNOCUOUS is similar to SQLITE_DETERMINISTIC, but is not
** exactly the same.  The [random|random() function] is an example of a
** function that is innocuous but not deterministic.
** <p>Some heightened security settings
** ([SQLITE_DBCONFIG_TRUSTED_SCHEMA] and [PRAGMA trusted_schema=OFF])
** disable the use of SQL functions inside views and triggers and in
** schema structures such as [CHECK constraints], [DEFAULT clauses],
** [expression indexes], [partial indexes], and [generated columns] unless
** the function is tagged with SQLITE_INNOCUOUS.  Most built-in functions
** are innocuous.  Developers are advised to avoid using the
** SQLITE_INNOCUOUS flag for application-defined functions unless the
** function has been carefully audited and found to be free of potentially
** security-adverse side-effects and information-leaks.
** </dd>
**
** [[SQLITE_SUBTYPE]] <dt>SQLITE_SUBTYPE</dt><dd>
** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call
** [sqlite3_value_subtype()] to inspect the sub-types of its arguments.
** Specifying this flag makes no difference for scalar or aggregate user
** functions. However, if it is not specified for a user-defined window
** function, then any sub-types belonging to arguments passed to the window
** function may be discarded before the window function is called (i.e.
** sqlite3_value_subtype() will always return 0).
** </dd>
** </dl>
*/
#define SQLITE_DETERMINISTIC    0x000000800
#define SQLITE_DIRECTONLY       0x000080000
#define SQLITE_SUBTYPE          0x000100000
#define SQLITE_INNOCUOUS        0x000200000

/*
** CAPI3REF: Deprecated Functions
** DEPRECATED
**
** These functions are [deprecated].  In order to maintain
** backwards compatibility with older code, these functions continue 
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
** <td>&rarr;&nbsp;&nbsp;<td>True if value originated from a [bound parameter]
** </table></blockquote>
**
** <b>Details:</b>
**
** These routines extract type, size, and content information from
** [protected sqlite3_value] objects.  Protected sqlite3_value objects
** are used to pass parameter information into implementation of
** [application-defined SQL functions] and [virtual tables].
**
** These routines work only with [protected sqlite3_value] objects.
** Any attempt to use these routines on an [unprotected sqlite3_value]
** is not threadsafe.
**
** ^These routines work just like the corresponding [column access functions]
** except that these routines take a single [protected sqlite3_value] object







|
|







5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
** <td>&rarr;&nbsp;&nbsp;<td>True if value originated from a [bound parameter]
** </table></blockquote>
**
** <b>Details:</b>
**
** These routines extract type, size, and content information from
** [protected sqlite3_value] objects.  Protected sqlite3_value objects
** are used to pass parameter information into the functions that
** implement [application-defined SQL functions] and [virtual tables].
**
** These routines work only with [protected sqlite3_value] objects.
** Any attempt to use these routines on an [unprotected sqlite3_value]
** is not threadsafe.
**
** ^These routines work just like the corresponding [column access functions]
** except that these routines take a single [protected sqlite3_value] object
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
** to be a NULL value.  If sqlite3_value_nochange(X) is invoked anywhere other
** than within an [xUpdate] method call for an UPDATE statement, then
** the return value is arbitrary and meaningless.
**
** ^The sqlite3_value_frombind(X) interface returns non-zero if the
** value X originated from one of the [sqlite3_bind_int|sqlite3_bind()]
** interfaces.  ^If X comes from an SQL literal value, or a table column,
** and expression, then sqlite3_value_frombind(X) returns zero.
**
** Please pay particular attention to the fact that the pointer returned
** from [sqlite3_value_blob()], [sqlite3_value_text()], or
** [sqlite3_value_text16()] can be invalidated by a subsequent call to
** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()],
** or [sqlite3_value_text16()].
**







|







5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
** to be a NULL value.  If sqlite3_value_nochange(X) is invoked anywhere other
** than within an [xUpdate] method call for an UPDATE statement, then
** the return value is arbitrary and meaningless.
**
** ^The sqlite3_value_frombind(X) interface returns non-zero if the
** value X originated from one of the [sqlite3_bind_int|sqlite3_bind()]
** interfaces.  ^If X comes from an SQL literal value, or a table column,
** or an expression, then sqlite3_value_frombind(X) returns zero.
**
** Please pay particular attention to the fact that the pointer returned
** from [sqlite3_value_blob()], [sqlite3_value_text()], or
** [sqlite3_value_text16()] can be invalidated by a subsequent call to
** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()],
** or [sqlite3_value_text16()].
**
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
** CAPI3REF: Obtain Aggregate Function Context
** METHOD: sqlite3_context
**
** Implementations of aggregate SQL functions use this
** routine to allocate memory for storing their state.
**
** ^The first time the sqlite3_aggregate_context(C,N) routine is called 
** for a particular aggregate function, SQLite
** allocates N of memory, zeroes out that memory, and returns a pointer
** to the new memory. ^On second and subsequent calls to
** sqlite3_aggregate_context() for the same aggregate function instance,
** the same buffer is returned.  Sqlite3_aggregate_context() is normally
** called once for each invocation of the xStep callback and then one
** last time when the xFinal callback is invoked.  ^(When no rows match
** an aggregate query, the xStep() callback of the aggregate function
** implementation is never called and xFinal() is called exactly once.
** In those cases, sqlite3_aggregate_context() might be called for the
** first time from within xFinal().)^
**
** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer 
** when first called if N is less than or equal to zero or if a memory
** allocate error occurs.
**
** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
** determined by the N parameter on first successful call.  Changing the
** value of N in subsequent call to sqlite3_aggregate_context() within
** the same aggregate function instance will not resize the memory
** allocation.)^  Within the xFinal callback, it is customary to set
** N=0 in calls to sqlite3_aggregate_context(C,N) so that no 
** pointless memory allocations occur.
**
** ^SQLite automatically frees the memory allocated by 
** sqlite3_aggregate_context() when the aggregate query concludes.







|
|
















|







5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
** CAPI3REF: Obtain Aggregate Function Context
** METHOD: sqlite3_context
**
** Implementations of aggregate SQL functions use this
** routine to allocate memory for storing their state.
**
** ^The first time the sqlite3_aggregate_context(C,N) routine is called 
** for a particular aggregate function, SQLite allocates
** N bytes of memory, zeroes out that memory, and returns a pointer
** to the new memory. ^On second and subsequent calls to
** sqlite3_aggregate_context() for the same aggregate function instance,
** the same buffer is returned.  Sqlite3_aggregate_context() is normally
** called once for each invocation of the xStep callback and then one
** last time when the xFinal callback is invoked.  ^(When no rows match
** an aggregate query, the xStep() callback of the aggregate function
** implementation is never called and xFinal() is called exactly once.
** In those cases, sqlite3_aggregate_context() might be called for the
** first time from within xFinal().)^
**
** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer 
** when first called if N is less than or equal to zero or if a memory
** allocate error occurs.
**
** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
** determined by the N parameter on first successful call.  Changing the
** value of N in any subsequents call to sqlite3_aggregate_context() within
** the same aggregate function instance will not resize the memory
** allocation.)^  Within the xFinal callback, it is customary to set
** N=0 in calls to sqlite3_aggregate_context(C,N) so that no 
** pointless memory allocations occur.
**
** ^SQLite automatically frees the memory allocated by 
** sqlite3_aggregate_context() when the aggregate query concludes.
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560

5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
** <li> [SQLITE_UTF8],
** <li> [SQLITE_UTF16LE],
** <li> [SQLITE_UTF16BE],
** <li> [SQLITE_UTF16], or
** <li> [SQLITE_UTF16_ALIGNED].
** </ul>)^
** ^The eTextRep argument determines the encoding of strings passed
** to the collating function callback, xCallback.
** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep
** force strings to be UTF16 with native byte order.
** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin
** on an even byte address.
**
** ^The fourth argument, pArg, is an application data pointer that is passed
** through as the first argument to the collating function callback.
**
** ^The fifth argument, xCallback, is a pointer to the collating function.
** ^Multiple collating functions can be registered using the same name but
** with different eTextRep parameters and SQLite will use whichever
** function requires the least amount of data transformation.
** ^If the xCallback argument is NULL then the collating function is
** deleted.  ^When all collating functions having the same name are deleted,
** that collation is no longer usable.
**
** ^The collating function callback is invoked with a copy of the pArg 
** application data pointer and with two strings in the encoding specified
** by the eTextRep argument.  The collating function must return an

** integer that is negative, zero, or positive
** if the first string is less than, equal to, or greater than the second,
** respectively.  A collating function must always return the same answer
** given the same inputs.  If two or more collating functions are registered
** to the same collation name (using different eTextRep values) then all
** must give an equivalent answer when invoked with equivalent strings.
** The collating function must obey the following properties for all
** strings A, B, and C:
**
** <ol>
** <li> If A==B then B==A.
** <li> If A==B and B==C then A==C.
** <li> If A&lt;B THEN B&gt;A.
** <li> If A&lt;B and B&lt;C then A&lt;C.
** </ol>
**
** If a collating function fails any of the above constraints and that
** collating function is  registered and used, then the behavior of SQLite
** is undefined.
**
** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation()
** with the addition that the xDestroy callback is invoked on pArg when
** the collating function is deleted.
** ^Collating functions are deleted when they are overridden by later
** calls to the collation creation functions or when the







|








|



|





|
>
|
















|







5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
** <li> [SQLITE_UTF8],
** <li> [SQLITE_UTF16LE],
** <li> [SQLITE_UTF16BE],
** <li> [SQLITE_UTF16], or
** <li> [SQLITE_UTF16_ALIGNED].
** </ul>)^
** ^The eTextRep argument determines the encoding of strings passed
** to the collating function callback, xCompare.
** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep
** force strings to be UTF16 with native byte order.
** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin
** on an even byte address.
**
** ^The fourth argument, pArg, is an application data pointer that is passed
** through as the first argument to the collating function callback.
**
** ^The fifth argument, xCompare, is a pointer to the collating function.
** ^Multiple collating functions can be registered using the same name but
** with different eTextRep parameters and SQLite will use whichever
** function requires the least amount of data transformation.
** ^If the xCompare argument is NULL then the collating function is
** deleted.  ^When all collating functions having the same name are deleted,
** that collation is no longer usable.
**
** ^The collating function callback is invoked with a copy of the pArg 
** application data pointer and with two strings in the encoding specified
** by the eTextRep argument.  The two integer parameters to the collating
** function callback are the length of the two strings, in bytes. The collating
** function must return an integer that is negative, zero, or positive
** if the first string is less than, equal to, or greater than the second,
** respectively.  A collating function must always return the same answer
** given the same inputs.  If two or more collating functions are registered
** to the same collation name (using different eTextRep values) then all
** must give an equivalent answer when invoked with equivalent strings.
** The collating function must obey the following properties for all
** strings A, B, and C:
**
** <ol>
** <li> If A==B then B==A.
** <li> If A==B and B==C then A==C.
** <li> If A&lt;B THEN B&gt;A.
** <li> If A&lt;B and B&lt;C then A&lt;C.
** </ol>
**
** If a collating function fails any of the above constraints and that
** collating function is registered and used, then the behavior of SQLite
** is undefined.
**
** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation()
** with the addition that the xDestroy callback is invoked on pArg when
** the collating function is deleted.
** ^Collating functions are deleted when they are overridden by later
** calls to the collation creation functions or when the
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909




5910
5911
5912
5913
5914











5915
5916
5917
5918
5919
5920
5921
*/
SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);

/*
** CAPI3REF: Return The Filename For A Database Connection
** METHOD: sqlite3
**
** ^The sqlite3_db_filename(D,N) interface returns a pointer to a filename
** associated with database N of connection D.  ^The main database file
** has the name "main".  If there is no attached database N on the database
** connection D, or if database N is a temporary or in-memory database, then
** this function will return either a NULL pointer or an empty string.




**
** ^The filename returned by this function is the output of the
** xFullPathname method of the [VFS].  ^In other words, the filename
** will be an absolute pathname, even if the filename used
** to open the database originally was a URI or relative pathname.











*/
SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);

/*
** CAPI3REF: Determine if a database is read-only
** METHOD: sqlite3
**







|
|
|


>
>
>
>





>
>
>
>
>
>
>
>
>
>
>







6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
*/
SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);

/*
** CAPI3REF: Return The Filename For A Database Connection
** METHOD: sqlite3
**
** ^The sqlite3_db_filename(D,N) interface returns a pointer to the filename
** associated with database N of connection D.
** ^If there is no attached database N on the database
** connection D, or if database N is a temporary or in-memory database, then
** this function will return either a NULL pointer or an empty string.
**
** ^The string value returned by this routine is owned and managed by
** the database connection.  ^The value will be valid until the database N
** is [DETACH]-ed or until the database connection closes.
**
** ^The filename returned by this function is the output of the
** xFullPathname method of the [VFS].  ^In other words, the filename
** will be an absolute pathname, even if the filename used
** to open the database originally was a URI or relative pathname.
**
** If the filename pointer returned by this routine is not NULL, then it
** can be used as the filename input parameter to these routines:
** <ul>
** <li> [sqlite3_uri_parameter()]
** <li> [sqlite3_uri_boolean()]
** <li> [sqlite3_uri_int64()]
** <li> [sqlite3_filename_database()]
** <li> [sqlite3_filename_journal()]
** <li> [sqlite3_filename_wal()]
** </ul>
*/
SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);

/*
** CAPI3REF: Determine if a database is read-only
** METHOD: sqlite3
**
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072




6073
6074
6075
6076
6077
6078
6079
** ^Cache sharing is enabled and disabled for an entire process.
** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]). 
** In prior versions of SQLite,
** sharing was enabled or disabled for each thread separately.
**
** ^(The cache sharing mode set by this interface effects all subsequent
** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
** Existing database connections continue use the sharing mode
** that was in effect at the time they were opened.)^
**
** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled
** successfully.  An [error code] is returned otherwise.)^
**
** ^Shared cache is disabled by default. But this might change in
** future releases of SQLite.  Applications that care about shared
** cache setting should set it explicitly.




**
** Note: This method is disabled on MacOS X 10.7 and iOS version 5.0
** and will always return SQLITE_MISUSE. On those systems, 
** shared cache mode should be enabled per-database connection via 
** [sqlite3_open_v2()] with [SQLITE_OPEN_SHAREDCACHE].
**
** This interface is threadsafe on processors where writing a







|





|
|
|
>
>
>
>







6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
** ^Cache sharing is enabled and disabled for an entire process.
** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]). 
** In prior versions of SQLite,
** sharing was enabled or disabled for each thread separately.
**
** ^(The cache sharing mode set by this interface effects all subsequent
** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
** Existing database connections continue to use the sharing mode
** that was in effect at the time they were opened.)^
**
** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled
** successfully.  An [error code] is returned otherwise.)^
**
** ^Shared cache is disabled by default. It is recommended that it stay
** that way.  In other words, do not use this routine.  This interface
** continues to be provided for historical compatibility, but its use is
** discouraged.  Any use of shared cache is discouraged.  If shared cache
** must be used, it is recommended that shared cache only be enabled for
** individual database connections using the [sqlite3_open_v2()] interface
** with the [SQLITE_OPEN_SHAREDCACHE] flag.
**
** Note: This method is disabled on MacOS X 10.7 and iOS version 5.0
** and will always return SQLITE_MISUSE. On those systems, 
** shared cache mode should be enabled per-database connection via 
** [sqlite3_open_v2()] with [SQLITE_OPEN_SHAREDCACHE].
**
** This interface is threadsafe on processors where writing a
6111
6112
6113
6114
6115
6116
6117



6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128







6129
6130
6131
6132
6133
6134
6135





6136






6137



6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167

6168
6169
6170
6171
6172
6173
6174
**
** See also: [sqlite3_release_memory()]
*/
SQLITE_API int sqlite3_db_release_memory(sqlite3*);

/*
** CAPI3REF: Impose A Limit On Heap Size



**
** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
** soft limit on the amount of heap memory that may be allocated by SQLite.
** ^SQLite strives to keep heap memory utilization below the soft heap
** limit by reducing the number of pages held in the page cache
** as heap memory usages approaches the limit.
** ^The soft heap limit is "soft" because even though SQLite strives to stay
** below the limit, it will exceed the limit rather than generate
** an [SQLITE_NOMEM] error.  In other words, the soft heap limit 
** is advisory only.
**







** ^The return value from sqlite3_soft_heap_limit64() is the size of
** the soft heap limit prior to the call, or negative in the case of an
** error.  ^If the argument N is negative
** then no change is made to the soft heap limit.  Hence, the current
** size of the soft heap limit can be determined by invoking
** sqlite3_soft_heap_limit64() with a negative argument.
**





** ^If the argument N is zero then the soft heap limit is disabled.






**



** ^(The soft heap limit is not enforced in the current implementation
** if one or more of following conditions are true:
**
** <ul>
** <li> The soft heap limit is set to zero.
** <li> Memory accounting is disabled using a combination of the
**      [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and
**      the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.
** <li> An alternative page cache implementation is specified using
**      [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...).
** <li> The page cache allocates from its own memory pool supplied
**      by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
**      from the heap.
** </ul>)^
**
** Beginning with SQLite [version 3.7.3] ([dateof:3.7.3]), 
** the soft heap limit is enforced
** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT]
** compile-time option is invoked.  With [SQLITE_ENABLE_MEMORY_MANAGEMENT],
** the soft heap limit is enforced on every memory allocation.  Without
** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced
** when memory is allocated by the page cache.  Testing suggests that because
** the page cache is the predominate memory user in SQLite, most
** applications will achieve adequate soft heap limit enforcement without
** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT].
**
** The circumstances under which SQLite will enforce the soft heap limit may
** changes in future releases of SQLite.
*/
SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);


/*
** CAPI3REF: Deprecated Soft Heap Limit Interface
** DEPRECATED
**
** This is a deprecated version of the [sqlite3_soft_heap_limit64()]
** interface.  This routine is provided for historical compatibility







>
>
>











>
>
>
>
>
>
>
|
|

|
|
|

>
>
>
>
>
|
>
>
>
>
>
>

>
>
>
|



|










<
<
<
<
<
<
<
<
<
<
<
|



>







6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355











6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
**
** See also: [sqlite3_release_memory()]
*/
SQLITE_API int sqlite3_db_release_memory(sqlite3*);

/*
** CAPI3REF: Impose A Limit On Heap Size
**
** These interfaces impose limits on the amount of heap memory that will be
** by all database connections within a single process.
**
** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
** soft limit on the amount of heap memory that may be allocated by SQLite.
** ^SQLite strives to keep heap memory utilization below the soft heap
** limit by reducing the number of pages held in the page cache
** as heap memory usages approaches the limit.
** ^The soft heap limit is "soft" because even though SQLite strives to stay
** below the limit, it will exceed the limit rather than generate
** an [SQLITE_NOMEM] error.  In other words, the soft heap limit 
** is advisory only.
**
** ^The sqlite3_hard_heap_limit64(N) interface sets a hard upper bound of
** N bytes on the amount of memory that will be allocated.  ^The
** sqlite3_hard_heap_limit64(N) interface is similar to
** sqlite3_soft_heap_limit64(N) except that memory allocations will fail
** when the hard heap limit is reached.
**
** ^The return value from both sqlite3_soft_heap_limit64() and
** sqlite3_hard_heap_limit64() is the size of
** the heap limit prior to the call, or negative in the case of an
** error.  ^If the argument N is negative
** then no change is made to the heap limit.  Hence, the current
** size of heap limits can be determined by invoking
** sqlite3_soft_heap_limit64(-1) or sqlite3_hard_heap_limit(-1).
**
** ^Setting the heap limits to zero disables the heap limiter mechanism.
**
** ^The soft heap limit may not be greater than the hard heap limit.
** ^If the hard heap limit is enabled and if sqlite3_soft_heap_limit(N)
** is invoked with a value of N that is greater than the hard heap limit,
** the the soft heap limit is set to the value of the hard heap limit.
** ^The soft heap limit is automatically enabled whenever the hard heap
** limit is enabled. ^When sqlite3_hard_heap_limit64(N) is invoked and
** the soft heap limit is outside the range of 1..N, then the soft heap
** limit is set to N.  ^Invoking sqlite3_soft_heap_limit64(0) when the
** hard heap limit is enabled makes the soft heap limit equal to the
** hard heap limit.
**
** The memory allocation limits can also be adjusted using
** [PRAGMA soft_heap_limit] and [PRAGMA hard_heap_limit].
**
** ^(The heap limits are not enforced in the current implementation
** if one or more of following conditions are true:
**
** <ul>
** <li> The limit value is set to zero.
** <li> Memory accounting is disabled using a combination of the
**      [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and
**      the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.
** <li> An alternative page cache implementation is specified using
**      [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...).
** <li> The page cache allocates from its own memory pool supplied
**      by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
**      from the heap.
** </ul>)^
**











** The circumstances under which SQLite will enforce the heap limits may
** changes in future releases of SQLite.
*/
SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 N);

/*
** CAPI3REF: Deprecated Soft Heap Limit Interface
** DEPRECATED
**
** This is a deprecated version of the [sqlite3_soft_heap_limit64()]
** interface.  This routine is provided for historical compatibility
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
**
** ^(The sqlite3_table_column_metadata(X,D,T,C,....) routine returns
** information about column C of table T in database D
** on [database connection] X.)^  ^The sqlite3_table_column_metadata()
** interface returns SQLITE_OK and fills in the non-NULL pointers in
** the final five arguments with appropriate values if the specified
** column exists.  ^The sqlite3_table_column_metadata() interface returns
** SQLITE_ERROR and if the specified column does not exist.
** ^If the column-name parameter to sqlite3_table_column_metadata() is a
** NULL pointer, then this routine simply checks for the existence of the
** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it
** does not.  If the table name parameter T in a call to
** sqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is
** undefined behavior.
**







|







6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
**
** ^(The sqlite3_table_column_metadata(X,D,T,C,....) routine returns
** information about column C of table T in database D
** on [database connection] X.)^  ^The sqlite3_table_column_metadata()
** interface returns SQLITE_OK and fills in the non-NULL pointers in
** the final five arguments with appropriate values if the specified
** column exists.  ^The sqlite3_table_column_metadata() interface returns
** SQLITE_ERROR if the specified column does not exist.
** ^If the column-name parameter to sqlite3_table_column_metadata() is a
** NULL pointer, then this routine simply checks for the existence of the
** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it
** does not.  If the table name parameter T in a call to
** sqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is
** undefined behavior.
**
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
**
** ^This interface enables or disables both the C-API
** [sqlite3_load_extension()] and the SQL function [load_extension()].
** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..)
** to enable or disable only the C-API.)^
**
** <b>Security warning:</b> It is recommended that extension loading
** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method
** rather than this interface, so the [load_extension()] SQL function
** remains disabled. This will prevent SQL injections from giving attackers
** access to extension loading capabilities.
*/
SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);

/*







|







6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
**
** ^This interface enables or disables both the C-API
** [sqlite3_load_extension()] and the SQL function [load_extension()].
** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..)
** to enable or disable only the C-API.)^
**
** <b>Security warning:</b> It is recommended that extension loading
** be enabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method
** rather than this interface, so the [load_extension()] SQL function
** remains disabled. This will prevent SQL injections from giving attackers
** access to extension loading capabilities.
*/
SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);

/*
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
typedef struct sqlite3_module sqlite3_module;

/*
** CAPI3REF: Virtual Table Object
** KEYWORDS: sqlite3_module {virtual table module}
**
** This structure, sometimes called a "virtual table module", 
** defines the implementation of a [virtual tables].  
** This structure consists mostly of methods for the module.
**
** ^A virtual table module is created by filling in a persistent
** instance of this structure and passing a pointer to that instance
** to [sqlite3_create_module()] or [sqlite3_create_module_v2()].
** ^The registration remains valid until it is replaced by a different
** module or until the [database connection] closes.  The content







|







6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
typedef struct sqlite3_module sqlite3_module;

/*
** CAPI3REF: Virtual Table Object
** KEYWORDS: sqlite3_module {virtual table module}
**
** This structure, sometimes called a "virtual table module", 
** defines the implementation of a [virtual table].  
** This structure consists mostly of methods for the module.
**
** ^A virtual table module is created by filling in a persistent
** instance of this structure and passing a pointer to that instance
** to [sqlite3_create_module()] or [sqlite3_create_module_v2()].
** ^The registration remains valid until it is replaced by a different
** module or until the [database connection] closes.  The content
6510
6511
6512
6513
6514
6515
6516
6517






6518
6519
6520
6521
6522
6523
6524
** non-zero.
**
** The [xBestIndex] method must fill aConstraintUsage[] with information
** about what parameters to pass to xFilter.  ^If argvIndex>0 then
** the right-hand side of the corresponding aConstraint[] is evaluated
** and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit
** is true, then the constraint is assumed to be fully handled by the
** virtual table and is not checked again by SQLite.)^






**
** ^The idxNum and idxPtr values are recorded and passed into the
** [xFilter] method.
** ^[sqlite3_free()] is used to free idxPtr if and only if
** needToFreeIdxPtr is true.
**
** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in







|
>
>
>
>
>
>







6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
** non-zero.
**
** The [xBestIndex] method must fill aConstraintUsage[] with information
** about what parameters to pass to xFilter.  ^If argvIndex>0 then
** the right-hand side of the corresponding aConstraint[] is evaluated
** and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit
** is true, then the constraint is assumed to be fully handled by the
** virtual table and might not be checked again by the byte code.)^ ^(The
** aConstraintUsage[].omit flag is an optimization hint. When the omit flag
** is left in its default setting of false, the constraint will always be
** checked separately in byte code.  If the omit flag is change to true, then
** the constraint may or may not be checked in byte code.  In other words,
** when the omit flag is true there is no guarantee that the constraint will
** not be checked again using byte code.)^
**
** ^The idxNum and idxPtr values are recorded and passed into the
** [xFilter] method.
** ^[sqlite3_free()] is used to free idxPtr if and only if
** needToFreeIdxPtr is true.
**
** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
** the xUpdate method are automatically rolled back by SQLite.
**
** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
** structure for SQLite [version 3.8.2] ([dateof:3.8.2]). 
** If a virtual table extension is
** used with an SQLite version earlier than 3.8.2, the results of attempting 
** to read or write the estimatedRows field are undefined (but are likely 
** to included crashing the application). The estimatedRows field should
** therefore only be used if [sqlite3_libversion_number()] returns a
** value greater than or equal to 3008002. Similarly, the idxFlags field
** was added for [version 3.9.0] ([dateof:3.9.0]). 
** It may therefore only be used if
** sqlite3_libversion_number() returns a value greater than or equal to
** 3009000.
*/







|







6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
** the xUpdate method are automatically rolled back by SQLite.
**
** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
** structure for SQLite [version 3.8.2] ([dateof:3.8.2]). 
** If a virtual table extension is
** used with an SQLite version earlier than 3.8.2, the results of attempting 
** to read or write the estimatedRows field are undefined (but are likely 
** to include crashing the application). The estimatedRows field should
** therefore only be used if [sqlite3_libversion_number()] returns a
** value greater than or equal to 3008002. Similarly, the idxFlags field
** was added for [version 3.9.0] ([dateof:3.9.0]). 
** It may therefore only be used if
** sqlite3_libversion_number() returns a value greater than or equal to
** 3009000.
*/
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
** these bits.
*/
#define SQLITE_INDEX_SCAN_UNIQUE      1     /* Scan visits at most 1 row */

/*
** CAPI3REF: Virtual Table Constraint Operator Codes
**
** These macros defined the allowed values for the
** [sqlite3_index_info].aConstraint[].op field.  Each value represents
** an operator that is part of a constraint term in the wHERE clause of
** a query that uses a [virtual table].
*/
#define SQLITE_INDEX_CONSTRAINT_EQ         2
#define SQLITE_INDEX_CONSTRAINT_GT         4
#define SQLITE_INDEX_CONSTRAINT_LE         8







|







6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
** these bits.
*/
#define SQLITE_INDEX_SCAN_UNIQUE      1     /* Scan visits at most 1 row */

/*
** CAPI3REF: Virtual Table Constraint Operator Codes
**
** These macros define the allowed values for the
** [sqlite3_index_info].aConstraint[].op field.  Each value represents
** an operator that is part of a constraint term in the wHERE clause of
** a query that uses a [virtual table].
*/
#define SQLITE_INDEX_CONSTRAINT_EQ         2
#define SQLITE_INDEX_CONSTRAINT_GT         4
#define SQLITE_INDEX_CONSTRAINT_LE         8
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
**   <li>  [sqlite3_mutex_held()] </li>
**   <li>  [sqlite3_mutex_notheld()] </li>
** </ul>)^
**
** The only difference is that the public sqlite3_XXX functions enumerated
** above silently ignore any invocations that pass a NULL pointer instead
** of a valid mutex handle. The implementations of the methods defined
** by this structure are not required to handle this case, the results
** of passing a NULL pointer instead of a valid mutex handle are undefined
** (i.e. it is acceptable to provide an implementation that segfaults if
** it is passed a NULL pointer).
**
** The xMutexInit() method must be threadsafe.  It must be harmless to
** invoke xMutexInit() multiple times within the same process and without
** intervening calls to xMutexEnd().  Second and subsequent calls to







|







7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
**   <li>  [sqlite3_mutex_held()] </li>
**   <li>  [sqlite3_mutex_notheld()] </li>
** </ul>)^
**
** The only difference is that the public sqlite3_XXX functions enumerated
** above silently ignore any invocations that pass a NULL pointer instead
** of a valid mutex handle. The implementations of the methods defined
** by this structure are not required to handle this case. The results
** of passing a NULL pointer instead of a valid mutex handle are undefined
** (i.e. it is acceptable to provide an implementation that segfaults if
** it is passed a NULL pointer).
**
** The xMutexInit() method must be threadsafe.  It must be harmless to
** invoke xMutexInit() multiple times within the same process and without
** intervening calls to xMutexEnd().  Second and subsequent calls to
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
** returned value includes allocations that overflowed because they
** where too large (they were larger than the "sz" parameter to
** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
** no space was left in the page cache.</dd>)^
**
** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(<dt>SQLITE_STATUS_PAGECACHE_SIZE</dt>
** <dd>This parameter records the largest memory allocation request
** handed to [pagecache memory allocator].  Only the value returned in the
** *pHighwater parameter to [sqlite3_status()] is of interest.  
** The value written into the *pCurrent parameter is undefined.</dd>)^
**
** [[SQLITE_STATUS_SCRATCH_USED]] <dt>SQLITE_STATUS_SCRATCH_USED</dt>
** <dd>No longer used.</dd>
**
** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>







|







7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
** returned value includes allocations that overflowed because they
** where too large (they were larger than the "sz" parameter to
** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
** no space was left in the page cache.</dd>)^
**
** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(<dt>SQLITE_STATUS_PAGECACHE_SIZE</dt>
** <dd>This parameter records the largest memory allocation request
** handed to the [pagecache memory allocator].  Only the value returned in the
** *pHighwater parameter to [sqlite3_status()] is of interest.  
** The value written into the *pCurrent parameter is undefined.</dd>)^
**
** [[SQLITE_STATUS_SCRATCH_USED]] <dt>SQLITE_STATUS_SCRATCH_USED</dt>
** <dd>No longer used.</dd>
**
** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
**
** <dl>
** [[SQLITE_DBSTATUS_LOOKASIDE_USED]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_USED</dt>
** <dd>This parameter returns the number of lookaside memory slots currently
** checked out.</dd>)^
**
** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>
** <dd>This parameter returns the number malloc attempts that were 
** satisfied using lookaside memory. Only the high-water value is meaningful;
** the current value is always zero.)^
**
** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]
** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>
** <dd>This parameter returns the number malloc attempts that might have
** been satisfied using lookaside memory but failed due to the amount of







|







7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
**
** <dl>
** [[SQLITE_DBSTATUS_LOOKASIDE_USED]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_USED</dt>
** <dd>This parameter returns the number of lookaside memory slots currently
** checked out.</dd>)^
**
** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>
** <dd>This parameter returns the number of malloc attempts that were 
** satisfied using lookaside memory. Only the high-water value is meaningful;
** the current value is always zero.)^
**
** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]
** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>
** <dd>This parameter returns the number malloc attempts that might have
** been satisfied using lookaside memory but failed due to the amount of
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
**
** [[SQLITE_DBSTATUS_CACHE_SPILL]] ^(<dt>SQLITE_DBSTATUS_CACHE_SPILL</dt>
** <dd>This parameter returns the number of dirty cache entries that have
** been written to disk in the middle of a transaction due to the page
** cache overflowing. Transactions are more efficient if they are written
** to disk all at once. When pages spill mid-transaction, that introduces
** additional overhead. This parameter can be used help identify
** inefficiencies that can be resolve by increasing the cache size.
** </dd>
**
** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(<dt>SQLITE_DBSTATUS_DEFERRED_FKS</dt>
** <dd>This parameter returns zero for the current value if and only if
** all foreign key constraints (deferred or immediate) have been
** resolved.)^  ^The highwater mark is always 0.
** </dd>







|







8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
**
** [[SQLITE_DBSTATUS_CACHE_SPILL]] ^(<dt>SQLITE_DBSTATUS_CACHE_SPILL</dt>
** <dd>This parameter returns the number of dirty cache entries that have
** been written to disk in the middle of a transaction due to the page
** cache overflowing. Transactions are more efficient if they are written
** to disk all at once. When pages spill mid-transaction, that introduces
** additional overhead. This parameter can be used help identify
** inefficiencies that can be resolved by increasing the cache size.
** </dd>
**
** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(<dt>SQLITE_DBSTATUS_DEFERRED_FKS</dt>
** <dd>This parameter returns zero for the current value if and only if
** all foreign key constraints (deferred or immediate) have been
** resolved.)^  ^The highwater mark is always 0.
** </dd>
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
** to 2147483647.  The number of virtual machine operations can be 
** used as a proxy for the total work done by the prepared statement.
** If the number of virtual machine operations exceeds 2147483647
** then the value returned by this statement status code is undefined.
**
** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
** <dd>^This is the number of times that the prepare statement has been
** automatically regenerated due to schema changes or change to 
** [bound parameters] that might affect the query plan.
**
** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
** <dd>^This is the number of times that the prepared statement has
** been run.  A single "run" for the purposes of this counter is one
** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
** The counter is incremented on the first [sqlite3_step()] call of each







|







8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
** to 2147483647.  The number of virtual machine operations can be 
** used as a proxy for the total work done by the prepared statement.
** If the number of virtual machine operations exceeds 2147483647
** then the value returned by this statement status code is undefined.
**
** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
** <dd>^This is the number of times that the prepare statement has been
** automatically regenerated due to schema changes or changes to 
** [bound parameters] that might affect the query plan.
**
** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
** <dd>^This is the number of times that the prepared statement has
** been run.  A single "run" for the purposes of this counter is one
** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
** The counter is incremented on the first [sqlite3_step()] call of each
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
**                 Otherwise return NULL.
** <tr><td> 2 <td> Make every effort to allocate a new page.  Only return
**                 NULL if allocating a new page is effectively impossible.
** </table>
**
** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1.  SQLite
** will only use a createFlag of 2 after a prior call with a createFlag of 1
** failed.)^  In between the to xFetch() calls, SQLite may
** attempt to unpin one or more cache pages by spilling the content of
** pinned pages to disk and synching the operating system disk cache.
**
** [[the xUnpin() page cache method]]
** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
** as its second argument.  If the third parameter, discard, is non-zero,
** then the page must be evicted from the cache.







|







8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
**                 Otherwise return NULL.
** <tr><td> 2 <td> Make every effort to allocate a new page.  Only return
**                 NULL if allocating a new page is effectively impossible.
** </table>
**
** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1.  SQLite
** will only use a createFlag of 2 after a prior call with a createFlag of 1
** failed.)^  In between the xFetch() calls, SQLite may
** attempt to unpin one or more cache pages by spilling the content of
** pinned pages to disk and synching the operating system disk cache.
**
** [[the xUnpin() page cache method]]
** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
** as its second argument.  If the third parameter, discard, is non-zero,
** then the page must be evicted from the cache.
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
** identity of the database connection (the blocking connection) that
** has locked the required resource is stored internally. ^After an 
** application receives an SQLITE_LOCKED error, it may call the
** sqlite3_unlock_notify() method with the blocked connection handle as 
** the first argument to register for a callback that will be invoked
** when the blocking connections current transaction is concluded. ^The
** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
** call that concludes the blocking connections transaction.
**
** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,
** there is a chance that the blocking connection will have already
** concluded its transaction by the time sqlite3_unlock_notify() is invoked.
** If this happens, then the specified callback is invoked immediately,
** from within the call to sqlite3_unlock_notify().)^
**







|







8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
** identity of the database connection (the blocking connection) that
** has locked the required resource is stored internally. ^After an 
** application receives an SQLITE_LOCKED error, it may call the
** sqlite3_unlock_notify() method with the blocked connection handle as 
** the first argument to register for a callback that will be invoked
** when the blocking connections current transaction is concluded. ^The
** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
** call that concludes the blocking connection's transaction.
**
** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,
** there is a chance that the blocking connection will have already
** concluded its transaction by the time sqlite3_unlock_notify() is invoked.
** If this happens, then the specified callback is invoked immediately,
** from within the call to sqlite3_unlock_notify().)^
**
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
** When an unlock-notify callback is registered, the application provides a 
** single void* pointer that is passed to the callback when it is invoked.
** However, the signature of the callback function allows SQLite to pass
** it an array of void* context pointers. The first argument passed to
** an unlock-notify callback is a pointer to an array of void* pointers,
** and the second is the number of entries in the array.
**
** When a blocking connections transaction is concluded, there may be
** more than one blocked connection that has registered for an unlock-notify
** callback. ^If two or more such blocked connections have specified the
** same callback function, then instead of invoking the callback function
** multiple times, it is invoked once with the set of void* context pointers
** specified by the blocked connections bundled together into an array.
** This gives the application an opportunity to prioritize any actions 
** related to the set of unblocked database connections.







|







8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
** When an unlock-notify callback is registered, the application provides a 
** single void* pointer that is passed to the callback when it is invoked.
** However, the signature of the callback function allows SQLite to pass
** it an array of void* context pointers. The first argument passed to
** an unlock-notify callback is a pointer to an array of void* pointers,
** and the second is the number of entries in the array.
**
** When a blocking connection's transaction is concluded, there may be
** more than one blocked connection that has registered for an unlock-notify
** callback. ^If two or more such blocked connections have specified the
** same callback function, then instead of invoking the callback function
** multiple times, it is invoked once with the set of void* context pointers
** specified by the blocked connections bundled together into an array.
** This gives the application an opportunity to prioritize any actions 
** related to the set of unblocked database connections.
8807
8808
8809
8810
8811
8812
8813
8814
8815




8816
8817
8818
8819
8820
8821


8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
** This function may be called by either the [xConnect] or [xCreate] method
** of a [virtual table] implementation to configure
** various facets of the virtual table interface.
**
** If this interface is invoked outside the context of an xConnect or
** xCreate virtual table method then the behavior is undefined.
**
** At present, there is only one option that may be configured using
** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].)  Further options




** may be added in the future.
*/
SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);

/*
** CAPI3REF: Virtual Table Configuration Options


**
** These macros define the various options to the
** [sqlite3_vtab_config()] interface that [virtual table] implementations
** can use to customize and optimize their behavior.
**
** <dl>
** [[SQLITE_VTAB_CONSTRAINT_SUPPORT]]
** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT
** <dd>Calls of the form
** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported,
** where X is an integer.  If X is zero, then the [virtual table] whose
** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not
** support constraints.  In this configuration (which is the default) if
** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
** statement is rolled back as if [ON CONFLICT | OR ABORT] had been







|
|
>
>
>
>
|





>
>







|







9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
** This function may be called by either the [xConnect] or [xCreate] method
** of a [virtual table] implementation to configure
** various facets of the virtual table interface.
**
** If this interface is invoked outside the context of an xConnect or
** xCreate virtual table method then the behavior is undefined.
**
** In the call sqlite3_vtab_config(D,C,...) the D parameter is the
** [database connection] in which the virtual table is being created and
** which is passed in as the first argument to the [xConnect] or [xCreate]
** method that is invoking sqlite3_vtab_config().  The C parameter is one
** of the [virtual table configuration options].  The presence and meaning
** of parameters after C depend on which [virtual table configuration option]
** is used.
*/
SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);

/*
** CAPI3REF: Virtual Table Configuration Options
** KEYWORDS: {virtual table configuration options} 
** KEYWORDS: {virtual table configuration option}
**
** These macros define the various options to the
** [sqlite3_vtab_config()] interface that [virtual table] implementations
** can use to customize and optimize their behavior.
**
** <dl>
** [[SQLITE_VTAB_CONSTRAINT_SUPPORT]]
** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT</dt>
** <dd>Calls of the form
** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported,
** where X is an integer.  If X is zero, then the [virtual table] whose
** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not
** support constraints.  In this configuration (which is the default) if
** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
8851
8852
8853
8854
8855
8856
8857




















8858
8859
8860


8861
8862
8863
8864
8865
8866
8867
** must do so within the [xUpdate] method. If a call to the 
** [sqlite3_vtab_on_conflict()] function indicates that the current ON 
** CONFLICT policy is REPLACE, the virtual table implementation should 
** silently replace the appropriate rows within the xUpdate callback and
** return SQLITE_OK. Or, if this is not possible, it may return
** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT 
** constraint handling.




















** </dl>
*/
#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1



/*
** CAPI3REF: Determine The Virtual Table Conflict Policy
**
** This function may only be called from within a call to the [xUpdate] method
** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The
** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



>
>







9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
** must do so within the [xUpdate] method. If a call to the 
** [sqlite3_vtab_on_conflict()] function indicates that the current ON 
** CONFLICT policy is REPLACE, the virtual table implementation should 
** silently replace the appropriate rows within the xUpdate callback and
** return SQLITE_OK. Or, if this is not possible, it may return
** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT 
** constraint handling.
** </dd>
**
** [[SQLITE_VTAB_DIRECTONLY]]<dt>SQLITE_VTAB_DIRECTONLY</dt>
** <dd>Calls of the form
** [sqlite3_vtab_config](db,SQLITE_VTAB_DIRECTONLY) from within the
** the [xConnect] or [xCreate] methods of a [virtual table] implmentation
** prohibits that virtual table from being used from within triggers and
** views.
** </dd>
**
** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
** <dd>Calls of the form
** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
** the [xConnect] or [xCreate] methods of a [virtual table] implmentation
** identify that virtual table as being safe to use from within triggers
** and views.  Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
** virtual table can do no serious harm even if it is controlled by a
** malicious hacker.  Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
** flag unless absolutely necessary.
** </dd>
** </dl>
*/
#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
#define SQLITE_VTAB_INNOCUOUS          2
#define SQLITE_VTAB_DIRECTONLY         3

/*
** CAPI3REF: Determine The Virtual Table Conflict Policy
**
** This function may only be called from within a call to the [xUpdate] method
** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The
** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
**
** When the value returned to V is a string, space to hold that string is
** managed by the prepared statement S and will be automatically freed when
** S is finalized.
**
** <dl>
** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt>
** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be
** set to the total number of times that the X-th loop has run.</dd>
**
** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be set
** to the total number of rows examined by all iterations of the X-th loop.</dd>
**
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
** <dd>^The "double" variable pointed to by the T parameter will be set to the
** query planner's estimate for the average number of rows output from each
** iteration of the X-th loop.  If the query planner's estimates was accurate,
** then this value will approximate the quotient NVISIT/NLOOP and the
** product of this value for all prior loops with the same SELECTID will
** be the NLOOP value for the current loop.
**
** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
** <dd>^The "const char *" variable pointed to by the T parameter will be set
** to a zero-terminated UTF-8 string containing the name of the index or table
** used for the X-th loop.
**
** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
** <dd>^The "const char *" variable pointed to by the T parameter will be set
** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
** description for the X-th loop.
**
** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECT</dt>
** <dd>^The "int" variable pointed to by the T parameter will be set to the
** "select-id" for the X-th loop.  The select-id identifies which query or
** subquery the loop is part of.  The main query has a select-id of zero.
** The select-id is the same value as is output in the first column
** of an [EXPLAIN QUERY PLAN] query.
** </dl>
*/
#define SQLITE_SCANSTAT_NLOOP    0







|



|



|







|




|




|







9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
**
** When the value returned to V is a string, space to hold that string is
** managed by the prepared statement S and will be automatically freed when
** S is finalized.
**
** <dl>
** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt>
** <dd>^The [sqlite3_int64] variable pointed to by the V parameter will be
** set to the total number of times that the X-th loop has run.</dd>
**
** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
** <dd>^The [sqlite3_int64] variable pointed to by the V parameter will be set
** to the total number of rows examined by all iterations of the X-th loop.</dd>
**
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
** <dd>^The "double" variable pointed to by the V parameter will be set to the
** query planner's estimate for the average number of rows output from each
** iteration of the X-th loop.  If the query planner's estimates was accurate,
** then this value will approximate the quotient NVISIT/NLOOP and the
** product of this value for all prior loops with the same SELECTID will
** be the NLOOP value for the current loop.
**
** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
** <dd>^The "const char *" variable pointed to by the V parameter will be set
** to a zero-terminated UTF-8 string containing the name of the index or table
** used for the X-th loop.
**
** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
** <dd>^The "const char *" variable pointed to by the V parameter will be set
** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
** description for the X-th loop.
**
** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECT</dt>
** <dd>^The "int" variable pointed to by the V parameter will be set to the
** "select-id" for the X-th loop.  The select-id identifies which query or
** subquery the loop is part of.  The main query has a select-id of zero.
** The select-id is the same value as is output in the first column
** of an [EXPLAIN QUERY PLAN] query.
** </dl>
*/
#define SQLITE_SCANSTAT_NLOOP    0
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
/*
** CAPI3REF: Set a table filter on a Session Object.
** METHOD: sqlite3_session
**
** The second argument (xFilter) is the "filter callback". For changes to rows 
** in tables that are not attached to the Session object, the filter is called
** to determine whether changes to the table's rows should be tracked or not. 
** If xFilter returns 0, changes is not tracked. Note that once a table is 
** attached, xFilter will not be called again.
*/
SQLITE_API void sqlite3session_table_filter(
  sqlite3_session *pSession,      /* Session object */
  int(*xFilter)(
    void *pCtx,                   /* Copy of third arg to _filter_table() */
    const char *zTab              /* Table name */







|







10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
/*
** CAPI3REF: Set a table filter on a Session Object.
** METHOD: sqlite3_session
**
** The second argument (xFilter) is the "filter callback". For changes to rows 
** in tables that are not attached to the Session object, the filter is called
** to determine whether changes to the table's rows should be tracked or not. 
** If xFilter returns 0, changes are not tracked. Note that once a table is 
** attached, xFilter will not be called again.
*/
SQLITE_API void sqlite3session_table_filter(
  sqlite3_session *pSession,      /* Session object */
  int(*xFilter)(
    void *pCtx,                   /* Copy of third arg to _filter_table() */
    const char *zTab              /* Table name */
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
** using [sqlite3session_changeset()], then after applying that changeset to 
** database zFrom the contents of the two compatible tables would be 
** identical.
**
** It an error if database zFrom does not exist or does not contain the
** required compatible table.
**
** If the operation successful, SQLITE_OK is returned. Otherwise, an SQLite
** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
** may be set to point to a buffer containing an English language error 
** message. It is the responsibility of the caller to free this buffer using
** sqlite3_free().
*/
SQLITE_API int sqlite3session_diff(
  sqlite3_session *pSession,







|







10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
** using [sqlite3session_changeset()], then after applying that changeset to 
** database zFrom the contents of the two compatible tables would be 
** identical.
**
** It an error if database zFrom does not exist or does not contain the
** required compatible table.
**
** If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite
** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
** may be set to point to a buffer containing an English language error 
** message. It is the responsibility of the caller to free this buffer using
** sqlite3_free().
*/
SQLITE_API int sqlite3session_diff(
  sqlite3_session *pSession,
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
#define SQLITE_CHANGESETSTART_INVERT        0x0002


/*
** CAPI3REF: Advance A Changeset Iterator
** METHOD: sqlite3_changeset_iter
**
** This function may only be used with iterators created by function
** [sqlite3changeset_start()]. If it is called on an iterator passed to
** a conflict-handler callback by [sqlite3changeset_apply()], SQLITE_MISUSE
** is returned and the call has no effect.
**
** Immediately after an iterator is created by sqlite3changeset_start(), it
** does not point to any change in the changeset. Assuming the changeset
** is not empty, the first call to this function advances the iterator to







|







10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
#define SQLITE_CHANGESETSTART_INVERT        0x0002


/*
** CAPI3REF: Advance A Changeset Iterator
** METHOD: sqlite3_changeset_iter
**
** This function may only be used with iterators created by the function
** [sqlite3changeset_start()]. If it is called on an iterator passed to
** a conflict-handler callback by [sqlite3changeset_apply()], SQLITE_MISUSE
** is returned and the call has no effect.
**
** Immediately after an iterator is created by sqlite3changeset_start(), it
** does not point to any change in the changeset. Assuming the changeset
** is not empty, the first call to this function advances the iterator to
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
**
** If the new changeset contains changes to a table that is already present
** in the changegroup, then the number of columns and the position of the
** primary key columns for the table must be consistent. If this is not the
** case, this function fails with SQLITE_SCHEMA. If the input changeset
** appears to be corrupt and the corruption is detected, SQLITE_CORRUPT is
** returned. Or, if an out-of-memory condition occurs during processing, this
** function returns SQLITE_NOMEM. In all cases, if an error occurs the
** final contents of the changegroup is undefined.
**
** If no error occurs, SQLITE_OK is returned.
*/
SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);

/*
** CAPI3REF: Obtain A Composite Changeset From A Changegroup







|
|







10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
**
** If the new changeset contains changes to a table that is already present
** in the changegroup, then the number of columns and the position of the
** primary key columns for the table must be consistent. If this is not the
** case, this function fails with SQLITE_SCHEMA. If the input changeset
** appears to be corrupt and the corruption is detected, SQLITE_CORRUPT is
** returned. Or, if an out-of-memory condition occurs during processing, this
** function returns SQLITE_NOMEM. In all cases, if an error occurs the state
** of the final contents of the changegroup is undefined.
**
** If no error occurs, SQLITE_OK is returned.
*/
SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);

/*
** CAPI3REF: Obtain A Composite Changeset From A Changegroup
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
**   This includes the case where the UPDATE operation is attempted after 
**   an earlier call to the conflict handler function returned
**   [SQLITE_CHANGESET_REPLACE].  
** </dl>
**
** It is safe to execute SQL statements, including those that write to the
** table that the callback related to, from within the xConflict callback.
** This can be used to further customize the applications conflict
** resolution strategy.
**
** All changes made by these functions are enclosed in a savepoint transaction.
** If any other error (aside from a constraint failure when attempting to
** write to the target database) occurs, then the savepoint transaction is
** rolled back, restoring the target database to its original state, and an 
** SQLite error code returned.







|







10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
**   This includes the case where the UPDATE operation is attempted after 
**   an earlier call to the conflict handler function returned
**   [SQLITE_CHANGESET_REPLACE].  
** </dl>
**
** It is safe to execute SQL statements, including those that write to the
** table that the callback related to, from within the xConflict callback.
** This can be used to further customize the application's conflict
** resolution strategy.
**
** All changes made by these functions are enclosed in a savepoint transaction.
** If any other error (aside from a constraint failure when attempting to
** write to the target database) occurs, then the savepoint transaction is
** rolled back, restoring the target database to its original state, and an 
** SQLite error code returned.
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041

/*
** CAPI3REF: Rebase a changeset
** EXPERIMENTAL
**
** Argument pIn must point to a buffer containing a changeset nIn bytes
** in size. This function allocates and populates a buffer with a copy
** of the changeset rebased rebased according to the configuration of the
** rebaser object passed as the first argument. If successful, (*ppOut)
** is set to point to the new buffer containing the rebased changeset and 
** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the
** responsibility of the caller to eventually free the new buffer using
** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut)
** are set to zero and an SQLite error code returned.
*/







|







11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268

/*
** CAPI3REF: Rebase a changeset
** EXPERIMENTAL
**
** Argument pIn must point to a buffer containing a changeset nIn bytes
** in size. This function allocates and populates a buffer with a copy
** of the changeset rebased according to the configuration of the
** rebaser object passed as the first argument. If successful, (*ppOut)
** is set to point to the new buffer containing the rebased changeset and 
** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the
** responsibility of the caller to eventually free the new buffer using
** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut)
** are set to zero and an SQLite error code returned.
*/
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
**   If the query runs to completion without incident, SQLITE_OK is returned.
**   Or, if some error occurs before the query completes or is aborted by
**   the callback, an SQLite error code is returned.
**
**
** xSetAuxdata(pFts5, pAux, xDelete)
**
**   Save the pointer passed as the second argument as the extension functions 
**   "auxiliary data". The pointer may then be retrieved by the current or any
**   future invocation of the same fts5 extension function made as part of
**   the same MATCH query using the xGetAuxdata() API.
**
**   Each extension function is allocated a single auxiliary data slot for
**   each FTS query (MATCH expression). If the extension function is invoked 
**   more than once for a single FTS query, then all invocations share a 







|







11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
**   If the query runs to completion without incident, SQLITE_OK is returned.
**   Or, if some error occurs before the query completes or is aborted by
**   the callback, an SQLite error code is returned.
**
**
** xSetAuxdata(pFts5, pAux, xDelete)
**
**   Save the pointer passed as the second argument as the extension function's 
**   "auxiliary data". The pointer may then be retrieved by the current or any
**   future invocation of the same fts5 extension function made as part of
**   the same MATCH query using the xGetAuxdata() API.
**
**   Each extension function is allocated a single auxiliary data slot for
**   each FTS query (MATCH expression). If the extension function is invoked 
**   more than once for a single FTS query, then all invocations share a 
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
**   of "first place" within the document set, but not alternative forms
**   such as "1st place". In some applications, it would be better to match
**   all instances of "first place" or "1st place" regardless of which form
**   the user specified in the MATCH query text.
**
**   There are several ways to approach this in FTS5:
**
**   <ol><li> By mapping all synonyms to a single token. In this case, the 
**            In the above example, this means that the tokenizer returns the
**            same token for inputs "first" and "1st". Say that token is in
**            fact "first", so that when the user inserts the document "I won
**            1st place" entries are added to the index for tokens "i", "won",
**            "first" and "place". If the user then queries for '1st + place',
**            the tokenizer substitutes "first" for "1st" and the query works
**            as expected.
**







|
|







11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
**   of "first place" within the document set, but not alternative forms
**   such as "1st place". In some applications, it would be better to match
**   all instances of "first place" or "1st place" regardless of which form
**   the user specified in the MATCH query text.
**
**   There are several ways to approach this in FTS5:
**
**   <ol><li> By mapping all synonyms to a single token. In this case, using
**            the above example, this means that the tokenizer returns the
**            same token for inputs "first" and "1st". Say that token is in
**            fact "first", so that when the user inserts the document "I won
**            1st place" entries are added to the index for tokens "i", "won",
**            "first" and "place". If the user then queries for '1st + place',
**            the tokenizer substitutes "first" for "1st" and the query works
**            as expected.
**
Changes to SQLite.Interop/src/core/sqlite3ext.h.
320
321
322
323
324
325
326






327
328
329
330
331
332
333
  /* Version 3.26.0 and later */
  const char *(*normalized_sql)(sqlite3_stmt*);
  /* Version 3.28.0 and later */
  int (*stmt_isexplain)(sqlite3_stmt*);
  int (*value_frombind)(sqlite3_value*);
  /* Version 3.30.0 and later */
  int (*drop_modules)(sqlite3*,const char**);






};

/*
** This is the function signature used for all extension entry points.  It
** is also defined in the file "loadext.c".
*/
typedef int (*sqlite3_loadext_entry)(







>
>
>
>
>
>







320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
  /* Version 3.26.0 and later */
  const char *(*normalized_sql)(sqlite3_stmt*);
  /* Version 3.28.0 and later */
  int (*stmt_isexplain)(sqlite3_stmt*);
  int (*value_frombind)(sqlite3_value*);
  /* Version 3.30.0 and later */
  int (*drop_modules)(sqlite3*,const char**);
  /* Version 3.31.0 and later */
  sqlite3_int64 (*hard_heap_limit64)(sqlite3_int64);
  const char *(*uri_key)(const char*,int);
  const char *(*filename_database)(const char*);
  const char *(*filename_journal)(const char*);
  const char *(*filename_wal)(const char*);
};

/*
** This is the function signature used for all extension entry points.  It
** is also defined in the file "loadext.c".
*/
typedef int (*sqlite3_loadext_entry)(
610
611
612
613
614
615
616
617
618
619
620






621
622
623
624
625
626
627
#define sqlite3_str_length             sqlite3_api->str_length
#define sqlite3_str_value              sqlite3_api->str_value
/* Version 3.25.0 and later */
#define sqlite3_create_window_function sqlite3_api->create_window_function
/* Version 3.26.0 and later */
#define sqlite3_normalized_sql         sqlite3_api->normalized_sql
/* Version 3.28.0 and later */
#define sqlite3_stmt_isexplain         sqlite3_api->isexplain
#define sqlite3_value_frombind         sqlite3_api->frombind
/* Version 3.30.0 and later */
#define sqlite3_drop_modules           sqlite3_api->drop_modules






#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */

#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
  /* This case when the file really is being compiled as a loadable 
  ** extension */
# define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api=0;
# define SQLITE_EXTENSION_INIT2(v)  sqlite3_api=v;







|
|


>
>
>
>
>
>







616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
#define sqlite3_str_length             sqlite3_api->str_length
#define sqlite3_str_value              sqlite3_api->str_value
/* Version 3.25.0 and later */
#define sqlite3_create_window_function sqlite3_api->create_window_function
/* Version 3.26.0 and later */
#define sqlite3_normalized_sql         sqlite3_api->normalized_sql
/* Version 3.28.0 and later */
#define sqlite3_stmt_isexplain         sqlite3_api->stmt_isexplain
#define sqlite3_value_frombind         sqlite3_api->value_frombind
/* Version 3.30.0 and later */
#define sqlite3_drop_modules           sqlite3_api->drop_modules
/* Version 3.31.0 and later */
#define sqlite3_hard_heap_limit64      sqlite3_api->hard_heap_limit64
#define sqlite3_uri_key                sqlite3_api->uri_key
#define sqlite3_filename_database      sqlite3_api->filename_database
#define sqlite3_filename_journal       sqlite3_api->filename_journal
#define sqlite3_filename_wal           sqlite3_api->filename_wal
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */

#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
  /* This case when the file really is being compiled as a loadable 
  ** extension */
# define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api=0;
# define SQLITE_EXTENSION_INIT2(v)  sqlite3_api=v;
Changes to SQLite.Interop/src/ext/fts5.c.
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
**   If the query runs to completion without incident, SQLITE_OK is returned.
**   Or, if some error occurs before the query completes or is aborted by
**   the callback, an SQLite error code is returned.
**
**
** xSetAuxdata(pFts5, pAux, xDelete)
**
**   Save the pointer passed as the second argument as the extension functions 
**   "auxiliary data". The pointer may then be retrieved by the current or any
**   future invocation of the same fts5 extension function made as part of
**   the same MATCH query using the xGetAuxdata() API.
**
**   Each extension function is allocated a single auxiliary data slot for
**   each FTS query (MATCH expression). If the extension function is invoked 
**   more than once for a single FTS query, then all invocations share a 







|







167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
**   If the query runs to completion without incident, SQLITE_OK is returned.
**   Or, if some error occurs before the query completes or is aborted by
**   the callback, an SQLite error code is returned.
**
**
** xSetAuxdata(pFts5, pAux, xDelete)
**
**   Save the pointer passed as the second argument as the extension function's 
**   "auxiliary data". The pointer may then be retrieved by the current or any
**   future invocation of the same fts5 extension function made as part of
**   the same MATCH query using the xGetAuxdata() API.
**
**   Each extension function is allocated a single auxiliary data slot for
**   each FTS query (MATCH expression). If the extension function is invoked 
**   more than once for a single FTS query, then all invocations share a 
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
**   of "first place" within the document set, but not alternative forms
**   such as "1st place". In some applications, it would be better to match
**   all instances of "first place" or "1st place" regardless of which form
**   the user specified in the MATCH query text.
**
**   There are several ways to approach this in FTS5:
**
**   <ol><li> By mapping all synonyms to a single token. In this case, the 
**            In the above example, this means that the tokenizer returns the
**            same token for inputs "first" and "1st". Say that token is in
**            fact "first", so that when the user inserts the document "I won
**            1st place" entries are added to the index for tokens "i", "won",
**            "first" and "place". If the user then queries for '1st + place',
**            the tokenizer substitutes "first" for "1st" and the query works
**            as expected.
**







|
|







409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
**   of "first place" within the document set, but not alternative forms
**   such as "1st place". In some applications, it would be better to match
**   all instances of "first place" or "1st place" regardless of which form
**   the user specified in the MATCH query text.
**
**   There are several ways to approach this in FTS5:
**
**   <ol><li> By mapping all synonyms to a single token. In this case, using
**            the above example, this means that the tokenizer returns the
**            same token for inputs "first" and "1st". Say that token is in
**            fact "first", so that when the user inserts the document "I won
**            1st place" entries are added to the index for tokens "i", "won",
**            "first" and "place". If the user then queries for '1st + place',
**            the tokenizer substitutes "first" for "1st" and the query works
**            as expected.
**
646
647
648
649
650
651
652





653
654
655
656
657
658
659
/*
** Maximum number of prefix indexes on single FTS5 table. This must be
** less than 32. If it is set to anything large than that, an #error
** directive in fts5_index.c will cause the build to fail.
*/
#define FTS5_MAX_PREFIX_INDEXES 31






#define FTS5_DEFAULT_NEARDIST 10
#define FTS5_DEFAULT_RANK     "bm25"

/* Name of rank and rowid columns */
#define FTS5_RANK_NAME "rank"
#define FTS5_ROWID_NAME "rowid"








>
>
>
>
>







646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
/*
** Maximum number of prefix indexes on single FTS5 table. This must be
** less than 32. If it is set to anything large than that, an #error
** directive in fts5_index.c will cause the build to fail.
*/
#define FTS5_MAX_PREFIX_INDEXES 31

/*
** Maximum segments permitted in a single index 
*/
#define FTS5_MAX_SEGMENT 2000

#define FTS5_DEFAULT_NEARDIST 10
#define FTS5_DEFAULT_RANK     "bm25"

/* Name of rank and rowid columns */
#define FTS5_RANK_NAME "rank"
#define FTS5_ROWID_NAME "rowid"

1002
1003
1004
1005
1006
1007
1008





1009
1010
1011
1012
1013
1014
1015
static int sqlite3Fts5IterNextFrom(Fts5IndexIter*, i64 iMatch);

/*
** Close an iterator opened by sqlite3Fts5IndexQuery().
*/
static void sqlite3Fts5IterClose(Fts5IndexIter*);






/*
** This interface is used by the fts5vocab module.
*/
static const char *sqlite3Fts5IterTerm(Fts5IndexIter*, int*);
static int sqlite3Fts5IterNextScan(Fts5IndexIter*);









>
>
>
>
>







1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
static int sqlite3Fts5IterNextFrom(Fts5IndexIter*, i64 iMatch);

/*
** Close an iterator opened by sqlite3Fts5IndexQuery().
*/
static void sqlite3Fts5IterClose(Fts5IndexIter*);

/*
** Close the reader blob handle, if it is open.
*/
static void sqlite3Fts5IndexCloseReader(Fts5Index*);

/*
** This interface is used by the fts5vocab module.
*/
static const char *sqlite3Fts5IterTerm(Fts5IndexIter*, int*);
static int sqlite3Fts5IterNextScan(Fts5IndexIter*);


1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489

/*
** Alternative datatype for the argument to the malloc() routine passed
** into sqlite3ParserAlloc().  The default is size_t.
*/
#define fts5YYMALLOCARGTYPE  u64

#line 57 "fts5parse.c"
/**************** End of %include directives **********************************/
/* These constants specify the various numeric values for terminal symbols
** in a format understandable to "makeheaders".  This section is blank unless
** "lemon" is run with the "-m" command-line option.
***************** Begin makeheaders token definitions *************************/
/**************** End makeheaders token definitions ***************************/








|







1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499

/*
** Alternative datatype for the argument to the malloc() routine passed
** into sqlite3ParserAlloc().  The default is size_t.
*/
#define fts5YYMALLOCARGTYPE  u64

#line 57 "fts5parse.sql"
/**************** End of %include directives **********************************/
/* These constants specify the various numeric values for terminal symbols
** in a format understandable to "makeheaders".  This section is blank unless
** "lemon" is run with the "-m" command-line option.
***************** Begin makeheaders token definitions *************************/
/**************** End makeheaders token definitions ***************************/

1566
1567
1568
1569
1570
1571
1572

1573
1574
1575
1576
1577
1578
1579
#define sqlite3Fts5ParserCTX_SDECL
#define sqlite3Fts5ParserCTX_PDECL
#define sqlite3Fts5ParserCTX_PARAM
#define sqlite3Fts5ParserCTX_FETCH
#define sqlite3Fts5ParserCTX_STORE
#define fts5YYNSTATE             35
#define fts5YYNRULE              28

#define fts5YYNFTS5TOKEN             16
#define fts5YY_MAX_SHIFT         34
#define fts5YY_MIN_SHIFTREDUCE   52
#define fts5YY_MAX_SHIFTREDUCE   79
#define fts5YY_ERROR_ACTION      80
#define fts5YY_ACCEPT_ACTION     81
#define fts5YY_NO_ACTION         82







>







1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
#define sqlite3Fts5ParserCTX_SDECL
#define sqlite3Fts5ParserCTX_PDECL
#define sqlite3Fts5ParserCTX_PARAM
#define sqlite3Fts5ParserCTX_FETCH
#define sqlite3Fts5ParserCTX_STORE
#define fts5YYNSTATE             35
#define fts5YYNRULE              28
#define fts5YYNRULE_WITH_ACTION  28
#define fts5YYNFTS5TOKEN             16
#define fts5YY_MAX_SHIFT         34
#define fts5YY_MIN_SHIFTREDUCE   52
#define fts5YY_MAX_SHIFTREDUCE   79
#define fts5YY_ERROR_ACTION      80
#define fts5YY_ACCEPT_ACTION     81
#define fts5YY_NO_ACTION         82
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
    ** inside the C code.
    */
/********* Begin destructor definitions ***************************************/
    case 16: /* input */
{
#line 83 "fts5parse.y"
 (void)pParse; 
#line 570 "fts5parse.c"
}
      break;
    case 17: /* expr */
    case 18: /* cnearset */
    case 19: /* exprlist */
{
#line 89 "fts5parse.y"
 sqlite3Fts5ParseNodeFree((fts5yypminor->fts5yy24)); 
#line 579 "fts5parse.c"
}
      break;
    case 20: /* colset */
    case 21: /* colsetlist */
{
#line 93 "fts5parse.y"
 sqlite3_free((fts5yypminor->fts5yy11)); 
#line 587 "fts5parse.c"
}
      break;
    case 22: /* nearset */
    case 23: /* nearphrases */
{
#line 148 "fts5parse.y"
 sqlite3Fts5ParseNearsetFree((fts5yypminor->fts5yy46)); 
#line 595 "fts5parse.c"
}
      break;
    case 24: /* phrase */
{
#line 183 "fts5parse.y"
 sqlite3Fts5ParsePhraseFree((fts5yypminor->fts5yy53)); 
#line 602 "fts5parse.c"
}
      break;
/********* End destructor definitions *****************************************/
    default:  break;   /* If no destructor action specified: do nothing */
  }
}








|








|







|







|






|







1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
    ** inside the C code.
    */
/********* Begin destructor definitions ***************************************/
    case 16: /* input */
{
#line 83 "fts5parse.y"
 (void)pParse; 
#line 571 "fts5parse.sql"
}
      break;
    case 17: /* expr */
    case 18: /* cnearset */
    case 19: /* exprlist */
{
#line 89 "fts5parse.y"
 sqlite3Fts5ParseNodeFree((fts5yypminor->fts5yy24)); 
#line 580 "fts5parse.sql"
}
      break;
    case 20: /* colset */
    case 21: /* colsetlist */
{
#line 93 "fts5parse.y"
 sqlite3_free((fts5yypminor->fts5yy11)); 
#line 588 "fts5parse.sql"
}
      break;
    case 22: /* nearset */
    case 23: /* nearphrases */
{
#line 148 "fts5parse.y"
 sqlite3Fts5ParseNearsetFree((fts5yypminor->fts5yy46)); 
#line 596 "fts5parse.sql"
}
      break;
    case 24: /* phrase */
{
#line 183 "fts5parse.y"
 sqlite3Fts5ParsePhraseFree((fts5yypminor->fts5yy53)); 
#line 603 "fts5parse.sql"
}
      break;
/********* End destructor definitions *****************************************/
    default:  break;   /* If no destructor action specified: do nothing */
  }
}

2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
   while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser);
   /* Here code is inserted which will execute if the parser
   ** stack every overflows */
/******** Begin %stack_overflow code ******************************************/
#line 36 "fts5parse.y"

  sqlite3Fts5ParseError(pParse, "fts5: parser stack overflow");
#line 823 "fts5parse.c"
/******** End %stack_overflow code ********************************************/
   sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument var */
   sqlite3Fts5ParserCTX_STORE
}

/*
** Print tracing information for a SHIFT action







|







2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
   while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser);
   /* Here code is inserted which will execute if the parser
   ** stack every overflows */
/******** Begin %stack_overflow code ******************************************/
#line 36 "fts5parse.y"

  sqlite3Fts5ParseError(pParse, "fts5: parser stack overflow");
#line 824 "fts5parse.sql"
/******** End %stack_overflow code ********************************************/
   sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument var */
   sqlite3Fts5ParserCTX_STORE
}

/*
** Print tracing information for a SHIFT action
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416


2417
2418
2419

2420
2421
2422
2423
2424
2425
2426
  (void)fts5yyLookahead;
  (void)fts5yyLookaheadToken;
  fts5yymsp = fts5yypParser->fts5yytos;
#ifndef NDEBUG
  if( fts5yyTraceFILE && fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ){
    fts5yysize = fts5yyRuleInfoNRhs[fts5yyruleno];
    if( fts5yysize ){
      fprintf(fts5yyTraceFILE, "%sReduce %d [%s], go to state %d.\n",
        fts5yyTracePrompt,
        fts5yyruleno, fts5yyRuleName[fts5yyruleno], fts5yymsp[fts5yysize].stateno);


    }else{
      fprintf(fts5yyTraceFILE, "%sReduce %d [%s].\n",
        fts5yyTracePrompt, fts5yyruleno, fts5yyRuleName[fts5yyruleno]);

    }
  }
#endif /* NDEBUG */

  /* Check that the stack is large enough to grow by a single entry
  ** if the RHS of the rule is empty.  This ensures that there is room
  ** enough on the stack to push the LHS value */







|

|
>
>

|
|
>







2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
  (void)fts5yyLookahead;
  (void)fts5yyLookaheadToken;
  fts5yymsp = fts5yypParser->fts5yytos;
#ifndef NDEBUG
  if( fts5yyTraceFILE && fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ){
    fts5yysize = fts5yyRuleInfoNRhs[fts5yyruleno];
    if( fts5yysize ){
      fprintf(fts5yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
        fts5yyTracePrompt,
        fts5yyruleno, fts5yyRuleName[fts5yyruleno],
        fts5yyruleno<fts5YYNRULE_WITH_ACTION ? "" : " without external action",
        fts5yymsp[fts5yysize].stateno);
    }else{
      fprintf(fts5yyTraceFILE, "%sReduce %d [%s]%s.\n",
        fts5yyTracePrompt, fts5yyruleno, fts5yyRuleName[fts5yyruleno],
        fts5yyruleno<fts5YYNRULE_WITH_ACTION ? "" : " without external action");
    }
  }
#endif /* NDEBUG */

  /* Check that the stack is large enough to grow by a single entry
  ** if the RHS of the rule is empty.  This ensures that there is room
  ** enough on the stack to push the LHS value */
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
  **     break;
  */
/********** Begin reduce actions **********************************************/
        fts5YYMINORTYPE fts5yylhsminor;
      case 0: /* input ::= expr */
#line 82 "fts5parse.y"
{ sqlite3Fts5ParseFinished(pParse, fts5yymsp[0].minor.fts5yy24); }
#line 1045 "fts5parse.c"
        break;
      case 1: /* colset ::= MINUS LCP colsetlist RCP */
#line 97 "fts5parse.y"
{ 
    fts5yymsp[-3].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);
}
#line 1052 "fts5parse.c"
        break;
      case 2: /* colset ::= LCP colsetlist RCP */
#line 100 "fts5parse.y"
{ fts5yymsp[-2].minor.fts5yy11 = fts5yymsp[-1].minor.fts5yy11; }
#line 1057 "fts5parse.c"
        break;
      case 3: /* colset ::= STRING */
#line 101 "fts5parse.y"
{
  fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
}
#line 1064 "fts5parse.c"
  fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
        break;
      case 4: /* colset ::= MINUS STRING */
#line 104 "fts5parse.y"
{
  fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
  fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);
}
#line 1073 "fts5parse.c"
        break;
      case 5: /* colsetlist ::= colsetlist STRING */
#line 109 "fts5parse.y"
{ 
  fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, fts5yymsp[-1].minor.fts5yy11, &fts5yymsp[0].minor.fts5yy0); }
#line 1079 "fts5parse.c"
  fts5yymsp[-1].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
        break;
      case 6: /* colsetlist ::= STRING */
#line 111 "fts5parse.y"
{ 
  fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0); 
}
#line 1087 "fts5parse.c"
  fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
        break;
      case 7: /* expr ::= expr AND expr */
#line 115 "fts5parse.y"
{
  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_AND, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
}
#line 1095 "fts5parse.c"
  fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 8: /* expr ::= expr OR expr */
#line 118 "fts5parse.y"
{
  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_OR, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
}
#line 1103 "fts5parse.c"
  fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 9: /* expr ::= expr NOT expr */
#line 121 "fts5parse.y"
{
  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_NOT, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
}
#line 1111 "fts5parse.c"
  fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 10: /* expr ::= colset COLON LP expr RP */
#line 125 "fts5parse.y"
{
  sqlite3Fts5ParseSetColset(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[-4].minor.fts5yy11);
  fts5yylhsminor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;
}
#line 1120 "fts5parse.c"
  fts5yymsp[-4].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 11: /* expr ::= LP expr RP */
#line 129 "fts5parse.y"
{fts5yymsp[-2].minor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;}
#line 1126 "fts5parse.c"
        break;
      case 12: /* expr ::= exprlist */
      case 13: /* exprlist ::= cnearset */ fts5yytestcase(fts5yyruleno==13);
#line 130 "fts5parse.y"
{fts5yylhsminor.fts5yy24 = fts5yymsp[0].minor.fts5yy24;}
#line 1132 "fts5parse.c"
  fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 14: /* exprlist ::= exprlist cnearset */
#line 133 "fts5parse.y"
{
  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseImplicitAnd(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24);
}
#line 1140 "fts5parse.c"
  fts5yymsp[-1].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 15: /* cnearset ::= nearset */
#line 137 "fts5parse.y"
{ 
  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46); 
}
#line 1148 "fts5parse.c"
  fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 16: /* cnearset ::= colset COLON nearset */
#line 140 "fts5parse.y"
{ 
  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46); 
  sqlite3Fts5ParseSetColset(pParse, fts5yylhsminor.fts5yy24, fts5yymsp[-2].minor.fts5yy11);
}
#line 1157 "fts5parse.c"
  fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 17: /* nearset ::= phrase */
#line 151 "fts5parse.y"
{ fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); }
#line 1163 "fts5parse.c"
  fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
        break;
      case 18: /* nearset ::= CARET phrase */
#line 152 "fts5parse.y"
{ 
  sqlite3Fts5ParseSetCaret(fts5yymsp[0].minor.fts5yy53);
  fts5yymsp[-1].minor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); 
}
#line 1172 "fts5parse.c"
        break;
      case 19: /* nearset ::= STRING LP nearphrases neardist_opt RP */
#line 156 "fts5parse.y"
{
  sqlite3Fts5ParseNear(pParse, &fts5yymsp[-4].minor.fts5yy0);
  sqlite3Fts5ParseSetDistance(pParse, fts5yymsp[-2].minor.fts5yy46, &fts5yymsp[-1].minor.fts5yy0);
  fts5yylhsminor.fts5yy46 = fts5yymsp[-2].minor.fts5yy46;
}
#line 1181 "fts5parse.c"
  fts5yymsp[-4].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
        break;
      case 20: /* nearphrases ::= phrase */
#line 162 "fts5parse.y"
{ 
  fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); 
}
#line 1189 "fts5parse.c"
  fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
        break;
      case 21: /* nearphrases ::= nearphrases phrase */
#line 165 "fts5parse.y"
{
  fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, fts5yymsp[-1].minor.fts5yy46, fts5yymsp[0].minor.fts5yy53);
}
#line 1197 "fts5parse.c"
  fts5yymsp[-1].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
        break;
      case 22: /* neardist_opt ::= */
#line 172 "fts5parse.y"
{ fts5yymsp[1].minor.fts5yy0.p = 0; fts5yymsp[1].minor.fts5yy0.n = 0; }
#line 1203 "fts5parse.c"
        break;
      case 23: /* neardist_opt ::= COMMA STRING */
#line 173 "fts5parse.y"
{ fts5yymsp[-1].minor.fts5yy0 = fts5yymsp[0].minor.fts5yy0; }
#line 1208 "fts5parse.c"
        break;
      case 24: /* phrase ::= phrase PLUS STRING star_opt */
#line 185 "fts5parse.y"
{ 
  fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, fts5yymsp[-3].minor.fts5yy53, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
}
#line 1215 "fts5parse.c"
  fts5yymsp[-3].minor.fts5yy53 = fts5yylhsminor.fts5yy53;
        break;
      case 25: /* phrase ::= STRING star_opt */
#line 188 "fts5parse.y"
{ 
  fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, 0, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
}
#line 1223 "fts5parse.c"
  fts5yymsp[-1].minor.fts5yy53 = fts5yylhsminor.fts5yy53;
        break;
      case 26: /* star_opt ::= STAR */
#line 196 "fts5parse.y"
{ fts5yymsp[0].minor.fts5yy4 = 1; }
#line 1229 "fts5parse.c"
        break;
      case 27: /* star_opt ::= */
#line 197 "fts5parse.y"
{ fts5yymsp[1].minor.fts5yy4 = 0; }
#line 1234 "fts5parse.c"
        break;
      default:
        break;
/********** End reduce actions ************************************************/
  };
  assert( fts5yyruleno<sizeof(fts5yyRuleInfoLhs)/sizeof(fts5yyRuleInfoLhs[0]) );
  fts5yygoto = fts5yyRuleInfoLhs[fts5yyruleno];







|






|




|






|








|





|







|







|







|







|








|





|





|







|







|








|





|








|








|







|







|





|




|






|







|





|




|







2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
  **     break;
  */
/********** Begin reduce actions **********************************************/
        fts5YYMINORTYPE fts5yylhsminor;
      case 0: /* input ::= expr */
#line 82 "fts5parse.y"
{ sqlite3Fts5ParseFinished(pParse, fts5yymsp[0].minor.fts5yy24); }
#line 1049 "fts5parse.sql"
        break;
      case 1: /* colset ::= MINUS LCP colsetlist RCP */
#line 97 "fts5parse.y"
{ 
    fts5yymsp[-3].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);
}
#line 1056 "fts5parse.sql"
        break;
      case 2: /* colset ::= LCP colsetlist RCP */
#line 100 "fts5parse.y"
{ fts5yymsp[-2].minor.fts5yy11 = fts5yymsp[-1].minor.fts5yy11; }
#line 1061 "fts5parse.sql"
        break;
      case 3: /* colset ::= STRING */
#line 101 "fts5parse.y"
{
  fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
}
#line 1068 "fts5parse.sql"
  fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
        break;
      case 4: /* colset ::= MINUS STRING */
#line 104 "fts5parse.y"
{
  fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
  fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);
}
#line 1077 "fts5parse.sql"
        break;
      case 5: /* colsetlist ::= colsetlist STRING */
#line 109 "fts5parse.y"
{ 
  fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, fts5yymsp[-1].minor.fts5yy11, &fts5yymsp[0].minor.fts5yy0); }
#line 1083 "fts5parse.sql"
  fts5yymsp[-1].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
        break;
      case 6: /* colsetlist ::= STRING */
#line 111 "fts5parse.y"
{ 
  fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0); 
}
#line 1091 "fts5parse.sql"
  fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
        break;
      case 7: /* expr ::= expr AND expr */
#line 115 "fts5parse.y"
{
  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_AND, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
}
#line 1099 "fts5parse.sql"
  fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 8: /* expr ::= expr OR expr */
#line 118 "fts5parse.y"
{
  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_OR, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
}
#line 1107 "fts5parse.sql"
  fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 9: /* expr ::= expr NOT expr */
#line 121 "fts5parse.y"
{
  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_NOT, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
}
#line 1115 "fts5parse.sql"
  fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 10: /* expr ::= colset COLON LP expr RP */
#line 125 "fts5parse.y"
{
  sqlite3Fts5ParseSetColset(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[-4].minor.fts5yy11);
  fts5yylhsminor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;
}
#line 1124 "fts5parse.sql"
  fts5yymsp[-4].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 11: /* expr ::= LP expr RP */
#line 129 "fts5parse.y"
{fts5yymsp[-2].minor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;}
#line 1130 "fts5parse.sql"
        break;
      case 12: /* expr ::= exprlist */
      case 13: /* exprlist ::= cnearset */ fts5yytestcase(fts5yyruleno==13);
#line 130 "fts5parse.y"
{fts5yylhsminor.fts5yy24 = fts5yymsp[0].minor.fts5yy24;}
#line 1136 "fts5parse.sql"
  fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 14: /* exprlist ::= exprlist cnearset */
#line 133 "fts5parse.y"
{
  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseImplicitAnd(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24);
}
#line 1144 "fts5parse.sql"
  fts5yymsp[-1].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 15: /* cnearset ::= nearset */
#line 137 "fts5parse.y"
{ 
  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46); 
}
#line 1152 "fts5parse.sql"
  fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 16: /* cnearset ::= colset COLON nearset */
#line 140 "fts5parse.y"
{ 
  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46); 
  sqlite3Fts5ParseSetColset(pParse, fts5yylhsminor.fts5yy24, fts5yymsp[-2].minor.fts5yy11);
}
#line 1161 "fts5parse.sql"
  fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
        break;
      case 17: /* nearset ::= phrase */
#line 151 "fts5parse.y"
{ fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); }
#line 1167 "fts5parse.sql"
  fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
        break;
      case 18: /* nearset ::= CARET phrase */
#line 152 "fts5parse.y"
{ 
  sqlite3Fts5ParseSetCaret(fts5yymsp[0].minor.fts5yy53);
  fts5yymsp[-1].minor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); 
}
#line 1176 "fts5parse.sql"
        break;
      case 19: /* nearset ::= STRING LP nearphrases neardist_opt RP */
#line 156 "fts5parse.y"
{
  sqlite3Fts5ParseNear(pParse, &fts5yymsp[-4].minor.fts5yy0);
  sqlite3Fts5ParseSetDistance(pParse, fts5yymsp[-2].minor.fts5yy46, &fts5yymsp[-1].minor.fts5yy0);
  fts5yylhsminor.fts5yy46 = fts5yymsp[-2].minor.fts5yy46;
}
#line 1185 "fts5parse.sql"
  fts5yymsp[-4].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
        break;
      case 20: /* nearphrases ::= phrase */
#line 162 "fts5parse.y"
{ 
  fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); 
}
#line 1193 "fts5parse.sql"
  fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
        break;
      case 21: /* nearphrases ::= nearphrases phrase */
#line 165 "fts5parse.y"
{
  fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, fts5yymsp[-1].minor.fts5yy46, fts5yymsp[0].minor.fts5yy53);
}
#line 1201 "fts5parse.sql"
  fts5yymsp[-1].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
        break;
      case 22: /* neardist_opt ::= */
#line 172 "fts5parse.y"
{ fts5yymsp[1].minor.fts5yy0.p = 0; fts5yymsp[1].minor.fts5yy0.n = 0; }
#line 1207 "fts5parse.sql"
        break;
      case 23: /* neardist_opt ::= COMMA STRING */
#line 173 "fts5parse.y"
{ fts5yymsp[-1].minor.fts5yy0 = fts5yymsp[0].minor.fts5yy0; }
#line 1212 "fts5parse.sql"
        break;
      case 24: /* phrase ::= phrase PLUS STRING star_opt */
#line 185 "fts5parse.y"
{ 
  fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, fts5yymsp[-3].minor.fts5yy53, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
}
#line 1219 "fts5parse.sql"
  fts5yymsp[-3].minor.fts5yy53 = fts5yylhsminor.fts5yy53;
        break;
      case 25: /* phrase ::= STRING star_opt */
#line 188 "fts5parse.y"
{ 
  fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, 0, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
}
#line 1227 "fts5parse.sql"
  fts5yymsp[-1].minor.fts5yy53 = fts5yylhsminor.fts5yy53;
        break;
      case 26: /* star_opt ::= STAR */
#line 196 "fts5parse.y"
{ fts5yymsp[0].minor.fts5yy4 = 1; }
#line 1233 "fts5parse.sql"
        break;
      case 27: /* star_opt ::= */
#line 197 "fts5parse.y"
{ fts5yymsp[1].minor.fts5yy4 = 0; }
#line 1238 "fts5parse.sql"
        break;
      default:
        break;
/********** End reduce actions ************************************************/
  };
  assert( fts5yyruleno<sizeof(fts5yyRuleInfoLhs)/sizeof(fts5yyRuleInfoLhs[0]) );
  fts5yygoto = fts5yyRuleInfoLhs[fts5yyruleno];
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
/************ Begin %syntax_error code ****************************************/
#line 30 "fts5parse.y"

  UNUSED_PARAM(fts5yymajor); /* Silence a compiler warning */
  sqlite3Fts5ParseError(
    pParse, "fts5: syntax error near \"%.*s\"",FTS5TOKEN.n,FTS5TOKEN.p
  );
#line 1302 "fts5parse.c"
/************ End %syntax_error code ******************************************/
  sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
  sqlite3Fts5ParserCTX_STORE
}

/*
** The following is executed when the parser accepts







|







2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
/************ Begin %syntax_error code ****************************************/
#line 30 "fts5parse.y"

  UNUSED_PARAM(fts5yymajor); /* Silence a compiler warning */
  sqlite3Fts5ParseError(
    pParse, "fts5: syntax error near \"%.*s\"",FTS5TOKEN.n,FTS5TOKEN.p
  );
#line 1306 "fts5parse.sql"
/************ End %syntax_error code ******************************************/
  sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
  sqlite3Fts5ParserCTX_STORE
}

/*
** The following is executed when the parser accepts
2950
2951
2952
2953
2954
2955
2956
2957
2958

2959
2960
2961
2962
2963
2964
2965
*/
static int sqlite3Fts5ParserFallback(int iToken){
#ifdef fts5YYFALLBACK
  assert( iToken<(int)(sizeof(fts5yyFallback)/sizeof(fts5yyFallback[0])) );
  return fts5yyFallback[iToken];
#else
  (void)iToken;
#endif
  return 0;

}

#line 1 "fts5_aux.c"
/*
** 2014 May 31
**
** The author disclaims copyright to this source code.  In place of







<

>







2964
2965
2966
2967
2968
2969
2970

2971
2972
2973
2974
2975
2976
2977
2978
2979
*/
static int sqlite3Fts5ParserFallback(int iToken){
#ifdef fts5YYFALLBACK
  assert( iToken<(int)(sizeof(fts5yyFallback)/sizeof(fts5yyFallback[0])) );
  return fts5yyFallback[iToken];
#else
  (void)iToken;

  return 0;
#endif
}

#line 1 "fts5_aux.c"
/*
** 2014 May 31
**
** The author disclaims copyright to this source code.  In place of
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
#define FTS5_DEFAULT_PAGE_SIZE   4050
#define FTS5_DEFAULT_AUTOMERGE      4
#define FTS5_DEFAULT_USERMERGE      4
#define FTS5_DEFAULT_CRISISMERGE   16
#define FTS5_DEFAULT_HASHSIZE    (1024*1024)

/* Maximum allowed page size */
#define FTS5_MAX_PAGE_SIZE (128*1024)

static int fts5_iswhitespace(char x){
  return (x==' ');
}

static int fts5_isopenquote(char x){
  return (x=='"' || x=='\'' || x=='[' || x=='`');







|







4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
#define FTS5_DEFAULT_PAGE_SIZE   4050
#define FTS5_DEFAULT_AUTOMERGE      4
#define FTS5_DEFAULT_USERMERGE      4
#define FTS5_DEFAULT_CRISISMERGE   16
#define FTS5_DEFAULT_HASHSIZE    (1024*1024)

/* Maximum allowed page size */
#define FTS5_MAX_PAGE_SIZE (64*1024)

static int fts5_iswhitespace(char x){
  return (x==' ');
}

static int fts5_isopenquote(char x){
  return (x=='"' || x=='\'' || x=='[' || x=='`');
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
  int iOut = 0;
  q = z[0];

  /* Set stack variable q to the close-quote character */
  assert( q=='[' || q=='\'' || q=='"' || q=='`' );
  if( q=='[' ) q = ']';  

  while( ALWAYS(z[iIn]) ){
    if( z[iIn]==q ){
      if( z[iIn+1]!=q ){
        /* Character iIn was the close quote. */
        iIn++;
        break;
      }else{
        /* Character iIn and iIn+1 form an escaped quote character. Skip







|







4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
  int iOut = 0;
  q = z[0];

  /* Set stack variable q to the close-quote character */
  assert( q=='[' || q=='\'' || q=='"' || q=='`' );
  if( q=='[' ) q = ']';  

  while( z[iIn] ){
    if( z[iIn]==q ){
      if( z[iIn+1]!=q ){
        /* Character iIn was the close quote. */
        iIn++;
        break;
      }else{
        /* Character iIn and iIn+1 form an escaped quote character. Skip
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
  int rc = SQLITE_OK;

  if( 0==sqlite3_stricmp(zKey, "pgsz") ){
    int pgsz = 0;
    if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){
      pgsz = sqlite3_value_int(pVal);
    }
    if( pgsz<=0 || pgsz>FTS5_MAX_PAGE_SIZE ){
      *pbBadkey = 1;
    }else{
      pConfig->pgsz = pgsz;
    }
  }

  else if( 0==sqlite3_stricmp(zKey, "hashsize") ){







|







4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
  int rc = SQLITE_OK;

  if( 0==sqlite3_stricmp(zKey, "pgsz") ){
    int pgsz = 0;
    if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){
      pgsz = sqlite3_value_int(pVal);
    }
    if( pgsz<32 || pgsz>FTS5_MAX_PAGE_SIZE ){
      *pbBadkey = 1;
    }else{
      pConfig->pgsz = pgsz;
    }
  }

  else if( 0==sqlite3_stricmp(zKey, "hashsize") ){
4961
4962
4963
4964
4965
4966
4967

4968
4969
4970
4971
4972
4973
4974
    if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){
      nCrisisMerge = sqlite3_value_int(pVal);
    }
    if( nCrisisMerge<0 ){
      *pbBadkey = 1;
    }else{
      if( nCrisisMerge<=1 ) nCrisisMerge = FTS5_DEFAULT_CRISISMERGE;

      pConfig->nCrisisMerge = nCrisisMerge;
    }
  }

  else if( 0==sqlite3_stricmp(zKey, "rank") ){
    const char *zIn = (const char*)sqlite3_value_text(pVal);
    char *zRank;







>







4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
    if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){
      nCrisisMerge = sqlite3_value_int(pVal);
    }
    if( nCrisisMerge<0 ){
      *pbBadkey = 1;
    }else{
      if( nCrisisMerge<=1 ) nCrisisMerge = FTS5_DEFAULT_CRISISMERGE;
      if( nCrisisMerge>=FTS5_MAX_SEGMENT ) nCrisisMerge = FTS5_MAX_SEGMENT-1;
      pConfig->nCrisisMerge = nCrisisMerge;
    }
  }

  else if( 0==sqlite3_stricmp(zKey, "rank") ){
    const char *zIn = (const char*)sqlite3_value_text(pVal);
    char *zRank;
7559
7560
7561
7562
7563
7564
7565
7566

7567
7568
7569

7570
7571
7572
7573
7574
7575
7576
    sqlite3_result_error_nomem(pCtx);
    return;
  }
  azConfig[0] = 0;
  azConfig[1] = "main";
  azConfig[2] = "tbl";
  for(i=3; iArg<nArg; iArg++){
    azConfig[i++] = (const char*)sqlite3_value_text(apVal[iArg]);

  }

  zExpr = (const char*)sqlite3_value_text(apVal[0]);


  rc = sqlite3Fts5ConfigParse(pGlobal, db, nConfig, azConfig, &pConfig, &zErr);
  if( rc==SQLITE_OK ){
    rc = sqlite3Fts5ExprNew(pConfig, pConfig->nCol, zExpr, &pExpr, &zErr);
  }
  if( rc==SQLITE_OK ){
    char *zText;







|
>



>







7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
    sqlite3_result_error_nomem(pCtx);
    return;
  }
  azConfig[0] = 0;
  azConfig[1] = "main";
  azConfig[2] = "tbl";
  for(i=3; iArg<nArg; iArg++){
    const char *z = (const char*)sqlite3_value_text(apVal[iArg]);
    azConfig[i++] = (z ? z : "");
  }

  zExpr = (const char*)sqlite3_value_text(apVal[0]);
  if( zExpr==0 ) zExpr = "";

  rc = sqlite3Fts5ConfigParse(pGlobal, db, nConfig, azConfig, &pConfig, &zErr);
  if( rc==SQLITE_OK ){
    rc = sqlite3Fts5ExprNew(pConfig, pConfig->nCol, zExpr, &pExpr, &zErr);
  }
  if( rc==SQLITE_OK ){
    char *zText;
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
 ((i64)(height) << (FTS5_DATA_PAGE_B)) +                                       \
 ((i64)(pgno))                                                                 \
)

#define FTS5_SEGMENT_ROWID(segid, pgno)       fts5_dri(segid, 0, 0, pgno)
#define FTS5_DLIDX_ROWID(segid, height, pgno) fts5_dri(segid, 1, height, pgno)

/*
** Maximum segments permitted in a single index 
*/
#define FTS5_MAX_SEGMENT 2000

#ifdef SQLITE_DEBUG
static int sqlite3Fts5Corrupt() { return SQLITE_CORRUPT_VTAB; }
#endif


/*
** Each time a blob is read from the %_data table, it is padded with this







<
<
<
<
<







8752
8753
8754
8755
8756
8757
8758





8759
8760
8761
8762
8763
8764
8765
 ((i64)(height) << (FTS5_DATA_PAGE_B)) +                                       \
 ((i64)(pgno))                                                                 \
)

#define FTS5_SEGMENT_ROWID(segid, pgno)       fts5_dri(segid, 0, 0, pgno)
#define FTS5_DLIDX_ROWID(segid, height, pgno) fts5_dri(segid, 1, height, pgno)






#ifdef SQLITE_DEBUG
static int sqlite3Fts5Corrupt() { return SQLITE_CORRUPT_VTAB; }
#endif


/*
** Each time a blob is read from the %_data table, it is padded with this
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
  fts5GetVarint32(&pLeaf->p[pLeaf->szLeaf], ret);
  return ret;
}

/*
** Close the read-only blob handle, if it is open.
*/
static void fts5CloseReader(Fts5Index *p){
  if( p->pReader ){
    sqlite3_blob *pReader = p->pReader;
    p->pReader = 0;
    sqlite3_blob_close(pReader);
  }
}








|







9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
  fts5GetVarint32(&pLeaf->p[pLeaf->szLeaf], ret);
  return ret;
}

/*
** Close the read-only blob handle, if it is open.
*/
static void sqlite3Fts5IndexCloseReader(Fts5Index *p){
  if( p->pReader ){
    sqlite3_blob *pReader = p->pReader;
    p->pReader = 0;
    sqlite3_blob_close(pReader);
  }
}

9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
      ** is required.  */
      sqlite3_blob *pBlob = p->pReader;
      p->pReader = 0;
      rc = sqlite3_blob_reopen(pBlob, iRowid);
      assert( p->pReader==0 );
      p->pReader = pBlob;
      if( rc!=SQLITE_OK ){
        fts5CloseReader(p);
      }
      if( rc==SQLITE_ABORT ) rc = SQLITE_OK;
    }

    /* If the blob handle is not open at this point, open it and seek 
    ** to the requested entry.  */
    if( p->pReader==0 && rc==SQLITE_OK ){







|







9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
      ** is required.  */
      sqlite3_blob *pBlob = p->pReader;
      p->pReader = 0;
      rc = sqlite3_blob_reopen(pBlob, iRowid);
      assert( p->pReader==0 );
      p->pReader = pBlob;
      if( rc!=SQLITE_OK ){
        sqlite3Fts5IndexCloseReader(p);
      }
      if( rc==SQLITE_ABORT ) rc = SQLITE_OK;
    }

    /* If the blob handle is not open at this point, open it and seek 
    ** to the requested entry.  */
    if( p->pReader==0 && rc==SQLITE_OK ){
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737

13738
13739
13740
13741
13742
13743
13744

/*
** Commit data to disk.
*/
static int sqlite3Fts5IndexSync(Fts5Index *p){
  assert( p->rc==SQLITE_OK );
  fts5IndexFlush(p);
  fts5CloseReader(p);
  return fts5IndexReturn(p);
}

/*
** Discard any data stored in the in-memory hash tables. Do not write it
** to the database. Additionally, assume that the contents of the %_data
** table may have changed on disk. So any in-memory caches of %_data 
** records must be invalidated.
*/
static int sqlite3Fts5IndexRollback(Fts5Index *p){
  fts5CloseReader(p);
  fts5IndexDiscardData(p);
  fts5StructureInvalidate(p);
  /* assert( p->rc==SQLITE_OK ); */
  return SQLITE_OK;
}

/*
** The %_data table is completely empty when this function is called. This
** function populates it with the initial structure objects for each index,
** and the initial version of the "averages" record (a zero-byte blob).
*/
static int sqlite3Fts5IndexReinit(Fts5Index *p){
  Fts5Structure s;
  fts5StructureInvalidate(p);

  memset(&s, 0, sizeof(Fts5Structure));
  fts5DataWrite(p, FTS5_AVERAGES_ROWID, (const u8*)"", 0);
  fts5StructureWrite(p, &s);
  return fts5IndexReturn(p);
}

/*







|










|














>







13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757

/*
** Commit data to disk.
*/
static int sqlite3Fts5IndexSync(Fts5Index *p){
  assert( p->rc==SQLITE_OK );
  fts5IndexFlush(p);
  sqlite3Fts5IndexCloseReader(p);
  return fts5IndexReturn(p);
}

/*
** Discard any data stored in the in-memory hash tables. Do not write it
** to the database. Additionally, assume that the contents of the %_data
** table may have changed on disk. So any in-memory caches of %_data 
** records must be invalidated.
*/
static int sqlite3Fts5IndexRollback(Fts5Index *p){
  sqlite3Fts5IndexCloseReader(p);
  fts5IndexDiscardData(p);
  fts5StructureInvalidate(p);
  /* assert( p->rc==SQLITE_OK ); */
  return SQLITE_OK;
}

/*
** The %_data table is completely empty when this function is called. This
** function populates it with the initial structure objects for each index,
** and the initial version of the "averages" record (a zero-byte blob).
*/
static int sqlite3Fts5IndexReinit(Fts5Index *p){
  Fts5Structure s;
  fts5StructureInvalidate(p);
  fts5IndexDiscardData(p);
  memset(&s, 0, sizeof(Fts5Structure));
  fts5DataWrite(p, FTS5_AVERAGES_ROWID, (const u8*)"", 0);
  fts5StructureWrite(p, &s);
  return fts5IndexReturn(p);
}

/*
13818
13819
13820
13821
13822
13823
13824

13825
13826
13827



13828
13829
13830
13831
13832
13833
13834
  int nChar
){
  int n = 0;
  int i;
  for(i=0; i<nChar; i++){
    if( n>=nByte ) return 0;      /* Input contains fewer than nChar chars */
    if( (unsigned char)p[n++]>=0xc0 ){

      while( (p[n] & 0xc0)==0x80 ){
        n++;
        if( n>=nByte ) break;



      }
    }
  }
  return n;
}

/*







>


|
>
>
>







13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
  int nChar
){
  int n = 0;
  int i;
  for(i=0; i<nChar; i++){
    if( n>=nByte ) return 0;      /* Input contains fewer than nChar chars */
    if( (unsigned char)p[n++]>=0xc0 ){
      if( n>=nByte ) return 0;
      while( (p[n] & 0xc0)==0x80 ){
        n++;
        if( n>=nByte ){
          if( i+1==nChar ) break;
          return 0;
        }
      }
    }
  }
  return n;
}

/*
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
        if( pSeg->pLeaf ) pRet->xSetOutputs(pRet, pSeg);
      }
    }

    if( p->rc ){
      sqlite3Fts5IterClose((Fts5IndexIter*)pRet);
      pRet = 0;
      fts5CloseReader(p);
    }

    *ppIter = (Fts5IndexIter*)pRet;
    sqlite3Fts5BufferFree(&buf);
  }
  return fts5IndexReturn(p);
}







|







13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
        if( pSeg->pLeaf ) pRet->xSetOutputs(pRet, pSeg);
      }
    }

    if( p->rc ){
      sqlite3Fts5IterClose((Fts5IndexIter*)pRet);
      pRet = 0;
      sqlite3Fts5IndexCloseReader(p);
    }

    *ppIter = (Fts5IndexIter*)pRet;
    sqlite3Fts5BufferFree(&buf);
  }
  return fts5IndexReturn(p);
}
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
** Close an iterator opened by an earlier call to sqlite3Fts5IndexQuery().
*/
static void sqlite3Fts5IterClose(Fts5IndexIter *pIndexIter){
  if( pIndexIter ){
    Fts5Iter *pIter = (Fts5Iter*)pIndexIter;
    Fts5Index *pIndex = pIter->pIndex;
    fts5MultiIterFree(pIter);
    fts5CloseReader(pIndex);
  }
}

/*
** Read and decode the "averages" record from the database. 
**
** Parameter anSize must point to an array of size nCol, where nCol is







|







14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
** Close an iterator opened by an earlier call to sqlite3Fts5IndexQuery().
*/
static void sqlite3Fts5IterClose(Fts5IndexIter *pIndexIter){
  if( pIndexIter ){
    Fts5Iter *pIter = (Fts5Iter*)pIndexIter;
    Fts5Index *pIndex = pIter->pIndex;
    fts5MultiIterFree(pIter);
    sqlite3Fts5IndexCloseReader(pIndex);
  }
}

/*
** Read and decode the "averages" record from the database. 
**
** Parameter anSize must point to an array of size nCol, where nCol is
14222
14223
14224
14225
14226
14227
14228































14229
14230
14231
14232
14233
14234
14235
  }
  sqlite3Fts5IterClose(pIter);

  *pCksum = cksum;
  return rc;
}

































/*
** This function is also purely an internal test. It does not contribute to 
** FTS functionality, or even the integrity-check, in any way.
*/
static void fts5TestTerm(
  Fts5Index *p, 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
  }
  sqlite3Fts5IterClose(pIter);

  *pCksum = cksum;
  return rc;
}

/*
** Check if buffer z[], size n bytes, contains as series of valid utf-8
** encoded codepoints. If so, return 0. Otherwise, if the buffer does not
** contain valid utf-8, return non-zero.
*/
static int fts5TestUtf8(const char *z, int n){
  int i = 0;
  assert_nc( n>0 );
  while( i<n ){
    if( (z[i] & 0x80)==0x00 ){
      i++;
    }else
    if( (z[i] & 0xE0)==0xC0 ){
      if( i+1>=n || (z[i+1] & 0xC0)!=0x80 ) return 1;
      i += 2;
    }else
    if( (z[i] & 0xF0)==0xE0 ){
      if( i+2>=n || (z[i+1] & 0xC0)!=0x80 || (z[i+2] & 0xC0)!=0x80 ) return 1;
      i += 3;
    }else
    if( (z[i] & 0xF8)==0xF0 ){
      if( i+3>=n || (z[i+1] & 0xC0)!=0x80 || (z[i+2] & 0xC0)!=0x80 ) return 1;
      if( (z[i+2] & 0xC0)!=0x80 ) return 1;
      i += 3;
    }else{
      return 1;
    }
  }

  return 0;
}

/*
** This function is also purely an internal test. It does not contribute to 
** FTS functionality, or even the integrity-check, in any way.
*/
static void fts5TestTerm(
  Fts5Index *p, 
14262
14263
14264
14265
14266
14267
14268
14269






14270
14271
14272
14273
14274
14275
14276
14277

    /* If this is a prefix query, check that the results returned if the
    ** the index is disabled are the same. In both ASC and DESC order. 
    **
    ** This check may only be performed if the hash table is empty. This
    ** is because the hash table only supports a single scan query at
    ** a time, and the multi-iter loop from which this function is called
    ** is already performing such a scan. */






    if( p->nPendingData==0 ){
      if( iIdx>0 && rc==SQLITE_OK ){
        int f = flags|FTS5INDEX_QUERY_TEST_NOIDX;
        ck2 = 0;
        rc = fts5QueryCksum(p, iIdx, zTerm, nTerm, f, &ck2);
        if( rc==SQLITE_OK && ck1!=ck2 ) rc = FTS5_CORRUPT;
      }
      if( iIdx>0 && rc==SQLITE_OK ){







|
>
>
>
>
>
>
|







14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331

    /* If this is a prefix query, check that the results returned if the
    ** the index is disabled are the same. In both ASC and DESC order. 
    **
    ** This check may only be performed if the hash table is empty. This
    ** is because the hash table only supports a single scan query at
    ** a time, and the multi-iter loop from which this function is called
    ** is already performing such a scan. 
    **
    ** Also only do this if buffer zTerm contains nTerm bytes of valid
    ** utf-8. Otherwise, the last part of the buffer contents might contain
    ** a non-utf-8 sequence that happens to be a prefix of a valid utf-8
    ** character stored in the main fts index, which will cause the
    ** test to fail.  */
    if( p->nPendingData==0 && 0==fts5TestUtf8(zTerm, nTerm) ){
      if( iIdx>0 && rc==SQLITE_OK ){
        int f = flags|FTS5INDEX_QUERY_TEST_NOIDX;
        ck2 = 0;
        rc = fts5QueryCksum(p, iIdx, zTerm, nTerm, f, &ck2);
        if( rc==SQLITE_OK && ck1!=ck2 ) rc = FTS5_CORRUPT;
      }
      if( iIdx>0 && rc==SQLITE_OK ){
14386
14387
14388
14389
14390
14391
14392
14393

14394
14395
14396
14397
14398
14399
14400
14401

14402
14403
14404
14405
14406
14407
14408
14409
14410
  int rc2;
  int iIdxPrevLeaf = pSeg->pgnoFirst-1;
  int iDlidxPrevLeaf = pSeg->pgnoLast;

  if( pSeg->pgnoFirst==0 ) return;

  fts5IndexPrepareStmt(p, &pStmt, sqlite3_mprintf(
      "SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d",

      pConfig->zDb, pConfig->zName, pSeg->iSegid
  ));

  /* Iterate through the b-tree hierarchy.  */
  while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
    i64 iRow;                     /* Rowid for this leaf */
    Fts5Data *pLeaf;              /* Data for this leaf */


    int nIdxTerm = sqlite3_column_bytes(pStmt, 1);
    const char *zIdxTerm = (const char*)sqlite3_column_text(pStmt, 1);
    int iIdxLeaf = sqlite3_column_int(pStmt, 2);
    int bIdxDlidx = sqlite3_column_int(pStmt, 3);

    /* If the leaf in question has already been trimmed from the segment, 
    ** ignore this b-tree entry. Otherwise, load it into memory. */
    if( iIdxLeaf<pSeg->pgnoFirst ) continue;
    iRow = FTS5_SEGMENT_ROWID(pSeg->iSegid, iIdxLeaf);







|
>








>

<







14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458

14459
14460
14461
14462
14463
14464
14465
  int rc2;
  int iIdxPrevLeaf = pSeg->pgnoFirst-1;
  int iDlidxPrevLeaf = pSeg->pgnoLast;

  if( pSeg->pgnoFirst==0 ) return;

  fts5IndexPrepareStmt(p, &pStmt, sqlite3_mprintf(
      "SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d "
      "ORDER BY 1, 2",
      pConfig->zDb, pConfig->zName, pSeg->iSegid
  ));

  /* Iterate through the b-tree hierarchy.  */
  while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
    i64 iRow;                     /* Rowid for this leaf */
    Fts5Data *pLeaf;              /* Data for this leaf */

    const char *zIdxTerm = (const char*)sqlite3_column_blob(pStmt, 1);
    int nIdxTerm = sqlite3_column_bytes(pStmt, 1);

    int iIdxLeaf = sqlite3_column_int(pStmt, 2);
    int bIdxDlidx = sqlite3_column_int(pStmt, 3);

    /* If the leaf in question has already been trimmed from the segment, 
    ** ignore this b-tree entry. Otherwise, load it into memory. */
    if( iIdxLeaf<pSeg->pgnoFirst ) continue;
    iRow = FTS5_SEGMENT_ROWID(pSeg->iSegid, iIdxLeaf);
15378
15379
15380
15381
15382
15383
15384



15385
15386
15387
15388
15389
15390
15391
15392
      assert( iSavepoint<=p->ts.iSavepoint );
      p->ts.iSavepoint = iSavepoint-1;
      break;

    case FTS5_ROLLBACKTO:
      assert( p->ts.eState==1 );
      assert( iSavepoint>=-1 );



      assert( iSavepoint<=p->ts.iSavepoint );
      p->ts.iSavepoint = iSavepoint;
      break;
  }
}
#else
# define fts5CheckTransactionState(x,y,z)
#endif







>
>
>
|







15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
      assert( iSavepoint<=p->ts.iSavepoint );
      p->ts.iSavepoint = iSavepoint-1;
      break;

    case FTS5_ROLLBACKTO:
      assert( p->ts.eState==1 );
      assert( iSavepoint>=-1 );
      /* The following assert() can fail if another vtab strikes an error
      ** within an xSavepoint() call then SQLite calls xRollbackTo() - without
      ** having called xSavepoint() on this vtab.  */
      /* assert( iSavepoint<=p->ts.iSavepoint ); */
      p->ts.iSavepoint = iSavepoint;
      break;
  }
}
#else
# define fts5CheckTransactionState(x,y,z)
#endif
15833
15834
15835
15836
15837
15838
15839

15840
15841
15842
15843
15844
15845
15846
  sqlite3_free(pCsr->apRankArg);

  if( CsrFlagTest(pCsr, FTS5CSR_FREE_ZRANK) ){
    sqlite3_free(pCsr->zRank);
    sqlite3_free(pCsr->zRankArgs);
  }


  memset(&pCsr->ePlan, 0, sizeof(Fts5Cursor) - ((u8*)&pCsr->ePlan - (u8*)pCsr));
}


/*
** Close the cursor.  For additional information see the documentation
** on the xClose method of the virtual table interface.







>







15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
  sqlite3_free(pCsr->apRankArg);

  if( CsrFlagTest(pCsr, FTS5CSR_FREE_ZRANK) ){
    sqlite3_free(pCsr->zRank);
    sqlite3_free(pCsr->zRankArgs);
  }

  sqlite3Fts5IndexCloseReader(pTab->p.pIndex);
  memset(&pCsr->ePlan, 0, sizeof(Fts5Cursor) - ((u8*)&pCsr->ePlan - (u8*)pCsr));
}


/*
** Close the cursor.  For additional information see the documentation
** on the xClose method of the virtual table interface.
15983
15984
15985
15986
15987
15988
15989
15990


15991

15992
15993
15994





15995
15996
15997
15998

15999
16000
16001
16002
16003
16004
16005
      }
  
      case FTS5_PLAN_SORTED_MATCH: {
        rc = fts5SorterNext(pCsr);
        break;
      }
  
      default:


        rc = sqlite3_step(pCsr->pStmt);

        if( rc!=SQLITE_ROW ){
          CsrFlagSet(pCsr, FTS5CSR_EOF);
          rc = sqlite3_reset(pCsr->pStmt);





        }else{
          rc = SQLITE_OK;
        }
        break;

    }
  }
  
  return rc;
}









|
>
>

>



>
>
>
>
>




>







16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
      }
  
      case FTS5_PLAN_SORTED_MATCH: {
        rc = fts5SorterNext(pCsr);
        break;
      }
  
      default: {
        Fts5Config *pConfig = ((Fts5Table*)pCursor->pVtab)->pConfig;
        pConfig->bLock++;
        rc = sqlite3_step(pCsr->pStmt);
        pConfig->bLock--;
        if( rc!=SQLITE_ROW ){
          CsrFlagSet(pCsr, FTS5CSR_EOF);
          rc = sqlite3_reset(pCsr->pStmt);
          if( rc!=SQLITE_OK ){
            pCursor->pVtab->zErrMsg = sqlite3_mprintf(
                "%s", sqlite3_errmsg(pConfig->db)
            );
          }
        }else{
          rc = SQLITE_OK;
        }
        break;
      }
    }
  }
  
  return rc;
}


16275
16276
16277
16278
16279
16280
16281







16282
16283
16284
16285
16286
16287
16288
  sqlite3_value *pRowidLe = 0;    /* rowid <= ? expression (or NULL) */
  sqlite3_value *pRowidGe = 0;    /* rowid >= ? expression (or NULL) */
  int iCol;                       /* Column on LHS of MATCH operator */
  char **pzErrmsg = pConfig->pzErrmsg;
  int i;
  int iIdxStr = 0;
  Fts5Expr *pExpr = 0;








  if( pCsr->ePlan ){
    fts5FreeCursorComponents(pCsr);
    memset(&pCsr->ePlan, 0, sizeof(Fts5Cursor) - ((u8*)&pCsr->ePlan-(u8*)pCsr));
  }

  assert( pCsr->pStmt==0 );







>
>
>
>
>
>
>







16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
  sqlite3_value *pRowidLe = 0;    /* rowid <= ? expression (or NULL) */
  sqlite3_value *pRowidGe = 0;    /* rowid >= ? expression (or NULL) */
  int iCol;                       /* Column on LHS of MATCH operator */
  char **pzErrmsg = pConfig->pzErrmsg;
  int i;
  int iIdxStr = 0;
  Fts5Expr *pExpr = 0;

  if( pConfig->bLock ){
    pTab->p.base.zErrMsg = sqlite3_mprintf(
        "recursively defined fts5 content table"
    );
    return SQLITE_ERROR;
  }

  if( pCsr->ePlan ){
    fts5FreeCursorComponents(pCsr);
    memset(&pCsr->ePlan, 0, sizeof(Fts5Cursor) - ((u8*)&pCsr->ePlan-(u8*)pCsr));
  }

  assert( pCsr->pStmt==0 );
16496
16497
16498
16499
16500
16501
16502

16503
16504
16505

16506

16507
16508
16509
16510
16511
16512
16513




16514
16515
16516
16517
16518
16519
16520
        pTab->pStorage, eStmt, &pCsr->pStmt, (bErrormsg?&pTab->p.base.zErrMsg:0)
    );
    assert( rc!=SQLITE_OK || pTab->p.base.zErrMsg==0 );
    assert( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_CONTENT) );
  }

  if( rc==SQLITE_OK && CsrFlagTest(pCsr, FTS5CSR_REQUIRE_CONTENT) ){

    assert( pCsr->pExpr );
    sqlite3_reset(pCsr->pStmt);
    sqlite3_bind_int64(pCsr->pStmt, 1, fts5CursorRowid(pCsr));

    rc = sqlite3_step(pCsr->pStmt);

    if( rc==SQLITE_ROW ){
      rc = SQLITE_OK;
      CsrFlagClear(pCsr, FTS5CSR_REQUIRE_CONTENT);
    }else{
      rc = sqlite3_reset(pCsr->pStmt);
      if( rc==SQLITE_OK ){
        rc = FTS5_CORRUPT;




      }
    }
  }
  return rc;
}

static void fts5SetVtabError(Fts5FullTable *p, const char *zFormat, ...){







>



>

>







>
>
>
>







16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591
16592
16593
16594
16595
16596
16597
16598
16599
16600
16601
16602
        pTab->pStorage, eStmt, &pCsr->pStmt, (bErrormsg?&pTab->p.base.zErrMsg:0)
    );
    assert( rc!=SQLITE_OK || pTab->p.base.zErrMsg==0 );
    assert( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_CONTENT) );
  }

  if( rc==SQLITE_OK && CsrFlagTest(pCsr, FTS5CSR_REQUIRE_CONTENT) ){
    Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
    assert( pCsr->pExpr );
    sqlite3_reset(pCsr->pStmt);
    sqlite3_bind_int64(pCsr->pStmt, 1, fts5CursorRowid(pCsr));
    pTab->pConfig->bLock++;
    rc = sqlite3_step(pCsr->pStmt);
    pTab->pConfig->bLock--;
    if( rc==SQLITE_ROW ){
      rc = SQLITE_OK;
      CsrFlagClear(pCsr, FTS5CSR_REQUIRE_CONTENT);
    }else{
      rc = sqlite3_reset(pCsr->pStmt);
      if( rc==SQLITE_OK ){
        rc = FTS5_CORRUPT;
      }else if( pTab->pConfig->pzErrmsg ){
        *pTab->pConfig->pzErrmsg = sqlite3_mprintf(
            "%s", sqlite3_errmsg(pTab->pConfig->db)
        );
      }
    }
  }
  return rc;
}

static void fts5SetVtabError(Fts5FullTable *p, const char *zFormat, ...){
17522
17523
17524
17525
17526
17527
17528

17529
17530
17531
17532

17533
17534
17535
17536
17537
17538
17539
     || pCsr->ePlan==FTS5_PLAN_SORTED_MATCH
    ){
      if( pCsr->pRank || SQLITE_OK==(rc = fts5FindRankFunction(pCsr)) ){
        fts5ApiInvoke(pCsr->pRank, pCsr, pCtx, pCsr->nRankArg, pCsr->apRankArg);
      }
    }
  }else if( !fts5IsContentless(pTab) ){

    rc = fts5SeekCursor(pCsr, 1);
    if( rc==SQLITE_OK ){
      sqlite3_result_value(pCtx, sqlite3_column_value(pCsr->pStmt, iCol+1));
    }

  }
  return rc;
}


/*
** This routine implements the xFindFunction method for the FTS3







>




>







17604
17605
17606
17607
17608
17609
17610
17611
17612
17613
17614
17615
17616
17617
17618
17619
17620
17621
17622
17623
     || pCsr->ePlan==FTS5_PLAN_SORTED_MATCH
    ){
      if( pCsr->pRank || SQLITE_OK==(rc = fts5FindRankFunction(pCsr)) ){
        fts5ApiInvoke(pCsr->pRank, pCsr, pCtx, pCsr->nRankArg, pCsr->apRankArg);
      }
    }
  }else if( !fts5IsContentless(pTab) ){
    pConfig->pzErrmsg = &pTab->p.base.zErrMsg;
    rc = fts5SeekCursor(pCsr, 1);
    if( rc==SQLITE_OK ){
      sqlite3_result_value(pCtx, sqlite3_column_value(pCsr->pStmt, iCol+1));
    }
    pConfig->pzErrmsg = 0;
  }
  return rc;
}


/*
** This routine implements the xFindFunction method for the FTS3
17802
17803
17804
17805
17806
17807
17808
17809
17810
17811
17812
17813
17814
17815
17816
static void fts5SourceIdFunc(
  sqlite3_context *pCtx,          /* Function call context */
  int nArg,                       /* Number of args */
  sqlite3_value **apUnused        /* Function arguments */
){
  assert( nArg==0 );
  UNUSED_PARAM2(nArg, apUnused);
  sqlite3_result_text(pCtx, "fts5: 2019-10-10 20:19:45 18db032d058f1436ce3dea84081f4ee5a0f2259ad97301d43c426bc7f3df1b0b", -1, SQLITE_TRANSIENT);
}

/*
** Return true if zName is the extension on one of the shadow tables used
** by this module.
*/
static int fts5ShadowName(const char *zName){







|







17886
17887
17888
17889
17890
17891
17892
17893
17894
17895
17896
17897
17898
17899
17900
static void fts5SourceIdFunc(
  sqlite3_context *pCtx,          /* Function call context */
  int nArg,                       /* Number of args */
  sqlite3_value **apUnused        /* Function arguments */
){
  assert( nArg==0 );
  UNUSED_PARAM2(nArg, apUnused);
  sqlite3_result_text(pCtx, "fts5: 2020-01-23 15:00:18 14331989fcaf6591336290ed1548e9c90f0f153e27f456f4c30c966f9c23aa6e", -1, SQLITE_TRANSIENT);
}

/*
** Return true if zName is the extension on one of the shadow tables used
** by this module.
*/
static int fts5ShadowName(const char *zName){
18496
18497
18498
18499
18500
18501
18502


18503
18504
18505
18506
18507
18508
18509

/*
** Delete all entries in the FTS5 index.
*/
static int sqlite3Fts5StorageDeleteAll(Fts5Storage *p){
  Fts5Config *pConfig = p->pConfig;
  int rc;



  /* Delete the contents of the %_data and %_docsize tables. */
  rc = fts5ExecPrintf(pConfig->db, 0,
      "DELETE FROM %Q.'%q_data';" 
      "DELETE FROM %Q.'%q_idx';",
      pConfig->zDb, pConfig->zName,
      pConfig->zDb, pConfig->zName







>
>







18580
18581
18582
18583
18584
18585
18586
18587
18588
18589
18590
18591
18592
18593
18594
18595

/*
** Delete all entries in the FTS5 index.
*/
static int sqlite3Fts5StorageDeleteAll(Fts5Storage *p){
  Fts5Config *pConfig = p->pConfig;
  int rc;

  p->bTotalsValid = 0;

  /* Delete the contents of the %_data and %_docsize tables. */
  rc = fts5ExecPrintf(pConfig->db, 0,
      "DELETE FROM %Q.'%q_data';" 
      "DELETE FROM %Q.'%q_idx';",
      pConfig->zDb, pConfig->zName,
      pConfig->zDb, pConfig->zName
18548
18549
18550
18551
18552
18553
18554


18555
18556
18557
18558

18559
18560
18561
18562
18563
18564
18565
    i64 iRowid = sqlite3_column_int64(pScan, 0);

    sqlite3Fts5BufferZero(&buf);
    rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid);
    for(ctx.iCol=0; rc==SQLITE_OK && ctx.iCol<pConfig->nCol; ctx.iCol++){
      ctx.szCol = 0;
      if( pConfig->abUnindexed[ctx.iCol]==0 ){


        rc = sqlite3Fts5Tokenize(pConfig, 
            FTS5_TOKENIZE_DOCUMENT,
            (const char*)sqlite3_column_text(pScan, ctx.iCol+1),
            sqlite3_column_bytes(pScan, ctx.iCol+1),

            (void*)&ctx,
            fts5StorageInsertCallback
        );
      }
      sqlite3Fts5BufferAppendVarint(&rc, &buf, ctx.szCol);
      p->aTotalSize[ctx.iCol] += (i64)ctx.szCol;
    }







>
>


<
<
>







18634
18635
18636
18637
18638
18639
18640
18641
18642
18643
18644


18645
18646
18647
18648
18649
18650
18651
18652
    i64 iRowid = sqlite3_column_int64(pScan, 0);

    sqlite3Fts5BufferZero(&buf);
    rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid);
    for(ctx.iCol=0; rc==SQLITE_OK && ctx.iCol<pConfig->nCol; ctx.iCol++){
      ctx.szCol = 0;
      if( pConfig->abUnindexed[ctx.iCol]==0 ){
        const char *zText = (const char*)sqlite3_column_text(pScan, ctx.iCol+1);
        int nText = sqlite3_column_bytes(pScan, ctx.iCol+1);
        rc = sqlite3Fts5Tokenize(pConfig, 
            FTS5_TOKENIZE_DOCUMENT,


            zText, nText,
            (void*)&ctx,
            fts5StorageInsertCallback
        );
      }
      sqlite3Fts5BufferAppendVarint(&rc, &buf, ctx.szCol);
      p->aTotalSize[ctx.iCol] += (i64)ctx.szCol;
    }
18673
18674
18675
18676
18677
18678
18679


18680
18681
18682
18683

18684
18685
18686
18687
18688
18689
18690

  if( rc==SQLITE_OK ){
    rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid);
  }
  for(ctx.iCol=0; rc==SQLITE_OK && ctx.iCol<pConfig->nCol; ctx.iCol++){
    ctx.szCol = 0;
    if( pConfig->abUnindexed[ctx.iCol]==0 ){


      rc = sqlite3Fts5Tokenize(pConfig, 
          FTS5_TOKENIZE_DOCUMENT,
          (const char*)sqlite3_value_text(apVal[ctx.iCol+2]),
          sqlite3_value_bytes(apVal[ctx.iCol+2]),

          (void*)&ctx,
          fts5StorageInsertCallback
      );
    }
    sqlite3Fts5BufferAppendVarint(&rc, &buf, ctx.szCol);
    p->aTotalSize[ctx.iCol] += (i64)ctx.szCol;
  }







>
>


<
<
>







18760
18761
18762
18763
18764
18765
18766
18767
18768
18769
18770


18771
18772
18773
18774
18775
18776
18777
18778

  if( rc==SQLITE_OK ){
    rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid);
  }
  for(ctx.iCol=0; rc==SQLITE_OK && ctx.iCol<pConfig->nCol; ctx.iCol++){
    ctx.szCol = 0;
    if( pConfig->abUnindexed[ctx.iCol]==0 ){
      const char *zText = (const char*)sqlite3_value_text(apVal[ctx.iCol+2]);
      int nText = sqlite3_value_bytes(apVal[ctx.iCol+2]);
      rc = sqlite3Fts5Tokenize(pConfig, 
          FTS5_TOKENIZE_DOCUMENT,


          zText, nText,
          (void*)&ctx,
          fts5StorageInsertCallback
      );
    }
    sqlite3Fts5BufferAppendVarint(&rc, &buf, ctx.szCol);
    p->aTotalSize[ctx.iCol] += (i64)ctx.szCol;
  }
18845
18846
18847
18848
18849
18850
18851


18852
18853
18854
18855
18856
18857
18858
18859
18860
18861
18862
        if( pConfig->abUnindexed[i] ) continue;
        ctx.iCol = i;
        ctx.szCol = 0;
        if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){
          rc = sqlite3Fts5TermsetNew(&ctx.pTermset);
        }
        if( rc==SQLITE_OK ){


          rc = sqlite3Fts5Tokenize(pConfig, 
              FTS5_TOKENIZE_DOCUMENT,
              (const char*)sqlite3_column_text(pScan, i+1),
              sqlite3_column_bytes(pScan, i+1),
              (void*)&ctx,
              fts5StorageIntegrityCallback
          );
        }
        if( rc==SQLITE_OK && pConfig->bColumnsize && ctx.szCol!=aColSize[i] ){
          rc = FTS5_CORRUPT;
        }







>
>


|
<







18933
18934
18935
18936
18937
18938
18939
18940
18941
18942
18943
18944

18945
18946
18947
18948
18949
18950
18951
        if( pConfig->abUnindexed[i] ) continue;
        ctx.iCol = i;
        ctx.szCol = 0;
        if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){
          rc = sqlite3Fts5TermsetNew(&ctx.pTermset);
        }
        if( rc==SQLITE_OK ){
          const char *zText = (const char*)sqlite3_column_text(pScan, i+1);
          int nText = sqlite3_column_bytes(pScan, i+1);
          rc = sqlite3Fts5Tokenize(pConfig, 
              FTS5_TOKENIZE_DOCUMENT,
              zText, nText,

              (void*)&ctx,
              fts5StorageIntegrityCallback
          );
        }
        if( rc==SQLITE_OK && pConfig->bColumnsize && ctx.szCol!=aColSize[i] ){
          rc = FTS5_CORRUPT;
        }
Changes to SQLite.Interop/src/ext/json1.c.
517
518
519
520
521
522
523































524
525
526
527
528
529
530
){
  JsonString s;
  jsonInit(&s, pCtx);
  jsonRenderNode(pNode, &s, aReplace);
  jsonResult(&s);
  sqlite3_result_subtype(pCtx, JSON_SUBTYPE);
}
































/*
** Make the JsonNode the return value of the function.
*/
static void jsonReturn(
  JsonNode *pNode,            /* Node to return */
  sqlite3_context *pCtx,      /* Return value for this function */







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
){
  JsonString s;
  jsonInit(&s, pCtx);
  jsonRenderNode(pNode, &s, aReplace);
  jsonResult(&s);
  sqlite3_result_subtype(pCtx, JSON_SUBTYPE);
}

/*
** Translate a single byte of Hex into an integer.
** This routine only works if h really is a valid hexadecimal
** character:  0..9a..fA..F
*/
static u8 jsonHexToInt(int h){
  assert( (h>='0' && h<='9') ||  (h>='a' && h<='f') ||  (h>='A' && h<='F') );
#ifdef SQLITE_EBCDIC
  h += 9*(1&~(h>>4));
#else
  h += 9*(1&(h>>6));
#endif
  return (u8)(h & 0xf);
}

/*
** Convert a 4-byte hex string into an integer
*/
static u32 jsonHexToInt4(const char *z){
  u32 v;
  assert( safe_isxdigit(z[0]) );
  assert( safe_isxdigit(z[1]) );
  assert( safe_isxdigit(z[2]) );
  assert( safe_isxdigit(z[3]) );
  v = (jsonHexToInt(z[0])<<12)
    + (jsonHexToInt(z[1])<<8)
    + (jsonHexToInt(z[2])<<4)
    + jsonHexToInt(z[3]);
  return v;
}

/*
** Make the JsonNode the return value of the function.
*/
static void jsonReturn(
  JsonNode *pNode,            /* Node to return */
  sqlite3_context *pCtx,      /* Return value for this function */
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633















634
635
636

637
638
639
640
641
642
643
        for(i=1, j=0; i<n-1; i++){
          char c = z[i];
          if( c!='\\' ){
            zOut[j++] = c;
          }else{
            c = z[++i];
            if( c=='u' ){
              u32 v = 0, k;
              for(k=0; k<4; i++, k++){
                assert( i<n-2 );
                c = z[i+1];
                assert( safe_isxdigit(c) );
                if( c<='9' ) v = v*16 + c - '0';
                else if( c<='F' ) v = v*16 + c - 'A' + 10;
                else v = v*16 + c - 'a' + 10;
              }
              if( v==0 ) break;
              if( v<=0x7f ){
                zOut[j++] = (char)v;
              }else if( v<=0x7ff ){
                zOut[j++] = (char)(0xc0 | (v>>6));
                zOut[j++] = 0x80 | (v&0x3f);
              }else{















                zOut[j++] = (char)(0xe0 | (v>>12));
                zOut[j++] = 0x80 | ((v>>6)&0x3f);
                zOut[j++] = 0x80 | (v&0x3f);

              }
            }else{
              if( c=='b' ){
                c = '\b';
              }else if( c=='f' ){
                c = '\f';
              }else if( c=='n' ){







|
<
<
|
<
<
<
<
<







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
>







642
643
644
645
646
647
648
649


650





651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
        for(i=1, j=0; i<n-1; i++){
          char c = z[i];
          if( c!='\\' ){
            zOut[j++] = c;
          }else{
            c = z[++i];
            if( c=='u' ){
              u32 v = jsonHexToInt4(z+i+1);


              i += 4;





              if( v==0 ) break;
              if( v<=0x7f ){
                zOut[j++] = (char)v;
              }else if( v<=0x7ff ){
                zOut[j++] = (char)(0xc0 | (v>>6));
                zOut[j++] = 0x80 | (v&0x3f);
              }else{
                u32 vlo;
                if( (v&0xfc00)==0xd800
                  && i<n-6
                  && z[i+1]=='\\'
                  && z[i+2]=='u'
                  && ((vlo = jsonHexToInt4(z+i+3))&0xfc00)==0xdc00
                ){
                  /* We have a surrogate pair */
                  v = ((v&0x3ff)<<10) + (vlo&0x3ff) + 0x10000;
                  i += 6;
                  zOut[j++] = 0xf0 | (v>>18);
                  zOut[j++] = 0x80 | ((v>>12)&0x3f);
                  zOut[j++] = 0x80 | ((v>>6)&0x3f);
                  zOut[j++] = 0x80 | (v&0x3f);
                }else{
                  zOut[j++] = 0xe0 | (v>>12);
                  zOut[j++] = 0x80 | ((v>>6)&0x3f);
                  zOut[j++] = 0x80 | (v&0x3f);
                }
              }
            }else{
              if( c=='b' ){
                c = '\b';
              }else if( c=='f' ){
                c = '\f';
              }else if( c=='n' ){
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146


























1147
1148
1149
1150






1151
1152
1153
1154
1155
1156
1157
        pRoot = &pParse->aNode[iRoot];
        pRoot->u.iAppend = iStart - iRoot;
        pRoot->jnFlags |= JNODE_APPEND;
        pParse->aNode[iLabel].jnFlags |= JNODE_RAW;
      }
      return pNode;
    }
  }else if( zPath[0]=='[' && safe_isdigit(zPath[1]) ){
    if( pRoot->eType!=JSON_ARRAY ) return 0;
    i = 0;
    j = 1;
    while( safe_isdigit(zPath[j]) ){
      i = i*10 + zPath[j] - '0';
      j++;
    }


























    if( zPath[j]!=']' ){
      *pzErr = zPath;
      return 0;
    }






    zPath += j + 1;
    j = 1;
    for(;;){
      while( j<=pRoot->n && (i>0 || (pRoot[j].jnFlags & JNODE_REMOVE)!=0) ){
        if( (pRoot[j].jnFlags & JNODE_REMOVE)==0 ) i--;
        j += jsonNodeSize(&pRoot[j]);
      }







|
<






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
>
>
>
>
>
>







1172
1173
1174
1175
1176
1177
1178
1179

1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
        pRoot = &pParse->aNode[iRoot];
        pRoot->u.iAppend = iStart - iRoot;
        pRoot->jnFlags |= JNODE_APPEND;
        pParse->aNode[iLabel].jnFlags |= JNODE_RAW;
      }
      return pNode;
    }
  }else if( zPath[0]=='[' ){

    i = 0;
    j = 1;
    while( safe_isdigit(zPath[j]) ){
      i = i*10 + zPath[j] - '0';
      j++;
    }
    if( j<2 || zPath[j]!=']' ){
      if( zPath[1]=='#' ){
        JsonNode *pBase = pRoot;
        int iBase = iRoot;
        if( pRoot->eType!=JSON_ARRAY ) return 0;
        for(;;){
          while( j<=pBase->n ){
            if( (pBase[j].jnFlags & JNODE_REMOVE)==0 ) i++;
            j += jsonNodeSize(&pBase[j]);
          }
          if( (pBase->jnFlags & JNODE_APPEND)==0 ) break;
          iBase += pBase->u.iAppend;
          pBase = &pParse->aNode[iBase];
          j = 1;
        }
        j = 2;
        if( zPath[2]=='-' && safe_isdigit(zPath[3]) ){
          unsigned int x = 0;
          j = 3;
          do{
            x = x*10 + zPath[j] - '0';
            j++;
          }while( safe_isdigit(zPath[j]) );
          if( x>i ) return 0;
          i -= x;
        }
        if( zPath[j]!=']' ){
          *pzErr = zPath;
          return 0;
        }
      }else{
        *pzErr = zPath;
        return 0;
      }
    }
    if( pRoot->eType!=JSON_ARRAY ) return 0;
    zPath += j + 1;
    j = 1;
    for(;;){
      while( j<=pRoot->n && (i>0 || (pRoot[j].jnFlags & JNODE_REMOVE)!=0) ){
        if( (pRoot[j].jnFlags & JNODE_REMOVE)==0 ) i--;
        j += jsonNodeSize(&pRoot[j]);
      }
2016
2017
2018
2019
2020
2021
2022

2023
2024
2025
2026
2027
2028
2029
  rc = sqlite3_declare_vtab(db, 
     "CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,"
                    "json HIDDEN,root HIDDEN)");
  if( rc==SQLITE_OK ){
    pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) );
    if( pNew==0 ) return SQLITE_NOMEM;
    memset(pNew, 0, sizeof(*pNew));

  }
  return rc;
}

/* destructor for json_each virtual table */
static int jsonEachDisconnect(sqlite3_vtab *pVtab){
  sqlite3_free(pVtab);







>







2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
  rc = sqlite3_declare_vtab(db, 
     "CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,"
                    "json HIDDEN,root HIDDEN)");
  if( rc==SQLITE_OK ){
    pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) );
    if( pNew==0 ) return SQLITE_NOMEM;
    memset(pNew, 0, sizeof(*pNew));
    sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
  }
  return rc;
}

/* destructor for json_each virtual table */
static int jsonEachDisconnect(sqlite3_vtab *pVtab){
  sqlite3_free(pVtab);
2506
2507
2508
2509
2510
2511
2512




2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
     const char *zName;
     sqlite3_module *pModule;
  } aMod[] = {
    { "json_each",            &jsonEachModule               },
    { "json_tree",            &jsonTreeModule               },
  };
#endif




  for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){
    rc = sqlite3_create_function(db, aFunc[i].zName, aFunc[i].nArg,
                                 SQLITE_UTF8 | SQLITE_DETERMINISTIC,
                                 (void*)&aFunc[i].flag,
                                 aFunc[i].xFunc, 0, 0);
  }
#ifndef SQLITE_OMIT_WINDOWFUNC
  for(i=0; i<sizeof(aAgg)/sizeof(aAgg[0]) && rc==SQLITE_OK; i++){
    rc = sqlite3_create_window_function(db, aAgg[i].zName, aAgg[i].nArg,
                SQLITE_SUBTYPE | SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0,
                                 aAgg[i].xStep, aAgg[i].xFinal,
                                 aAgg[i].xValue, jsonGroupInverse, 0);
  }
#endif
#ifndef SQLITE_OMIT_VIRTUALTABLE
  for(i=0; i<sizeof(aMod)/sizeof(aMod[0]) && rc==SQLITE_OK; i++){
    rc = sqlite3_create_module(db, aMod[i].zName, aMod[i].pModule, 0);







>
>
>
>

|
<






|







2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590

2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
     const char *zName;
     sqlite3_module *pModule;
  } aMod[] = {
    { "json_each",            &jsonEachModule               },
    { "json_tree",            &jsonTreeModule               },
  };
#endif
  static const int enc = 
       SQLITE_UTF8 |
       SQLITE_DETERMINISTIC |
       SQLITE_INNOCUOUS;
  for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){
    rc = sqlite3_create_function(db, aFunc[i].zName, aFunc[i].nArg, enc,

                                 (void*)&aFunc[i].flag,
                                 aFunc[i].xFunc, 0, 0);
  }
#ifndef SQLITE_OMIT_WINDOWFUNC
  for(i=0; i<sizeof(aAgg)/sizeof(aAgg[0]) && rc==SQLITE_OK; i++){
    rc = sqlite3_create_window_function(db, aAgg[i].zName, aAgg[i].nArg,
                                 SQLITE_SUBTYPE | enc, 0,
                                 aAgg[i].xStep, aAgg[i].xFinal,
                                 aAgg[i].xValue, jsonGroupInverse, 0);
  }
#endif
#ifndef SQLITE_OMIT_VIRTUALTABLE
  for(i=0; i<sizeof(aMod)/sizeof(aMod[0]) && rc==SQLITE_OK; i++){
    rc = sqlite3_create_module(db, aMod[i].zName, aMod[i].pModule, 0);
Changes to SQLite.Interop/src/ext/percentile.c.
209
210
211
212
213
214
215
216

217
218
219
  sqlite3 *db, 
  char **pzErrMsg, 
  const sqlite3_api_routines *pApi
){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  (void)pzErrMsg;  /* Unused parameter */
  rc = sqlite3_create_function(db, "percentile", 2, SQLITE_UTF8, 0,

                               0, percentStep, percentFinal);
  return rc;
}







|
>



209
210
211
212
213
214
215
216
217
218
219
220
  sqlite3 *db, 
  char **pzErrMsg, 
  const sqlite3_api_routines *pApi
){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  (void)pzErrMsg;  /* Unused parameter */
  rc = sqlite3_create_function(db, "percentile", 2, 
                               SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
                               0, percentStep, percentFinal);
  return rc;
}
Changes to SQLite.Interop/src/ext/regexp.c.
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
    if( (c&0xe0)==0xc0 && p->i<p->mx && (p->z[p->i]&0xc0)==0x80 ){
      c = (c&0x1f)<<6 | (p->z[p->i++]&0x3f);
      if( c<0x80 ) c = 0xfffd;
    }else if( (c&0xf0)==0xe0 && p->i+1<p->mx && (p->z[p->i]&0xc0)==0x80
           && (p->z[p->i+1]&0xc0)==0x80 ){
      c = (c&0x0f)<<12 | ((p->z[p->i]&0x3f)<<6) | (p->z[p->i+1]&0x3f);
      p->i += 2;
      if( c<=0x3ff || (c>=0xd800 && c<=0xdfff) ) c = 0xfffd;
    }else if( (c&0xf8)==0xf0 && p->i+3<p->mx && (p->z[p->i]&0xc0)==0x80
           && (p->z[p->i+1]&0xc0)==0x80 && (p->z[p->i+2]&0xc0)==0x80 ){
      c = (c&0x07)<<18 | ((p->z[p->i]&0x3f)<<12) | ((p->z[p->i+1]&0x3f)<<6)
                       | (p->z[p->i+2]&0x3f);
      p->i += 3;
      if( c<=0xffff || c>0x10ffff ) c = 0xfffd;
    }else{







|







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
    if( (c&0xe0)==0xc0 && p->i<p->mx && (p->z[p->i]&0xc0)==0x80 ){
      c = (c&0x1f)<<6 | (p->z[p->i++]&0x3f);
      if( c<0x80 ) c = 0xfffd;
    }else if( (c&0xf0)==0xe0 && p->i+1<p->mx && (p->z[p->i]&0xc0)==0x80
           && (p->z[p->i+1]&0xc0)==0x80 ){
      c = (c&0x0f)<<12 | ((p->z[p->i]&0x3f)<<6) | (p->z[p->i+1]&0x3f);
      p->i += 2;
      if( c<=0x7ff || (c>=0xd800 && c<=0xdfff) ) c = 0xfffd;
    }else if( (c&0xf8)==0xf0 && p->i+3<p->mx && (p->z[p->i]&0xc0)==0x80
           && (p->z[p->i+1]&0xc0)==0x80 && (p->z[p->i+2]&0xc0)==0x80 ){
      c = (c&0x07)<<18 | ((p->z[p->i]&0x3f)<<12) | ((p->z[p->i+1]&0x3f)<<6)
                       | (p->z[p->i+2]&0x3f);
      p->i += 3;
      if( c<=0xffff || c>0x10ffff ) c = 0xfffd;
    }else{
750
751
752
753
754
755
756
757
758
759
760
int sqlite3_regexp_init(
  sqlite3 *db, 
  char **pzErrMsg, 
  const sqlite3_api_routines *pApi
){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8, 0,
                                 re_sql_func, 0, 0);
  return rc;
}







|
|


750
751
752
753
754
755
756
757
758
759
760
int sqlite3_regexp_init(
  sqlite3 *db, 
  char **pzErrMsg, 
  const sqlite3_api_routines *pApi
){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8|SQLITE_INNOCUOUS,
                               0, re_sql_func, 0, 0);
  return rc;
}
Changes to SQLite.Interop/src/ext/sha1.c.
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
typedef struct SHA1Context SHA1Context;
struct SHA1Context {
  unsigned int state[5];
  unsigned int count[2];
  unsigned char buffer[64];
};


#if __GNUC__ && (defined(__i386__) || defined(__x86_64__))
/*
 * GCC by itself only generates left rotates.  Use right rotates if
 * possible to be kinder to dinky implementations with iterative rotate
 * instructions.
 */
#define SHA_ROT(op, x, k) \
        ({ unsigned int y; asm(op " %1,%0" : "=r" (y) : "I" (k), "0" (x)); y; })
#define rol(x,k) SHA_ROT("roll", x, k)
#define ror(x,k) SHA_ROT("rorl", x, k)

#else
/* Generic C equivalent */
#define SHA_ROT(x,l,r) ((x) << (l) | (x) >> (r))
#define rol(x,k) SHA_ROT(x,k,32-(k))
#define ror(x,k) SHA_ROT(x,32-(k),k)
#endif


#define blk0le(i) (block[i] = (ror(block[i],8)&0xFF00FF00) \
    |(rol(block[i],8)&0x00FF00FF))
#define blk0be(i) block[i]
#define blk(i) (block[i&15] = rol(block[(i+13)&15]^block[(i+8)&15] \
    ^block[(i+2)&15]^block[i&15],1))








<
<
<
<
<
<
<
<
<
<
<
<
<
<



<
<







35
36
37
38
39
40
41














42
43
44


45
46
47
48
49
50
51
typedef struct SHA1Context SHA1Context;
struct SHA1Context {
  unsigned int state[5];
  unsigned int count[2];
  unsigned char buffer[64];
};















#define SHA_ROT(x,l,r) ((x) << (l) | (x) >> (r))
#define rol(x,k) SHA_ROT(x,k,32-(k))
#define ror(x,k) SHA_ROT(x,32-(k),k)



#define blk0le(i) (block[i] = (ror(block[i],8)&0xFF00FF00) \
    |(rol(block[i],8)&0x00FF00FF))
#define blk0be(i) block[i]
#define blk(i) (block[i&15] = rol(block[(i+13)&15]^block[(i+8)&15] \
    ^block[(i+2)&15]^block[i&15],1))

393
394
395
396
397
398
399
400
401
402
403

404
405
406
407
  sqlite3 *db,
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  (void)pzErrMsg;  /* Unused parameter */
  rc = sqlite3_create_function(db, "sha1", 1, SQLITE_UTF8, 0,
                               sha1Func, 0, 0);
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_function(db, "sha1_query", 1, SQLITE_UTF8, 0,

                                 sha1QueryFunc, 0, 0);
  }
  return rc;
}







|


|
>




377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
  sqlite3 *db,
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  (void)pzErrMsg;  /* Unused parameter */
  rc = sqlite3_create_function(db, "sha1", 1, SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
                               sha1Func, 0, 0);
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_function(db, "sha1_query", 1, 
                                 SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
                                 sha1QueryFunc, 0, 0);
  }
  return rc;
}
Changes to SQLite.Interop/src/ext/totype.c.
498
499
500
501
502
503
504
505

506
507
508

509
510
511
512
  sqlite3 *db,
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  (void)pzErrMsg;  /* Unused parameter */
  rc = sqlite3_create_function(db, "tointeger", 1, SQLITE_UTF8, 0,

                               tointegerFunc, 0, 0);
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_function(db, "toreal", 1, SQLITE_UTF8, 0,

                                 torealFunc, 0, 0);
  }
  return rc;
}







|
>
|

|
>
|



498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
  sqlite3 *db,
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  (void)pzErrMsg;  /* Unused parameter */
  rc = sqlite3_create_function(db, "tointeger", 1,
        SQLITE_UTF8 | SQLITE_DETERMINISTIC | SQLITE_INNOCUOUS, 0,
        tointegerFunc, 0, 0);
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_function(db, "toreal", 1,
        SQLITE_UTF8 | SQLITE_DETERMINISTIC | SQLITE_INNOCUOUS, 0,
        torealFunc, 0, 0);
  }
  return rc;
}
Changes to SQLite.Interop/src/generic/interop.c.
15
16
17
18
19
20
21




22
23
24
25
26
27
28
#ifndef SQLITE_ENABLE_SESSION
#define SQLITE_ENABLE_SESSION (1)
#endif
#ifndef SQLITE_ENABLE_PREUPDATE_HOOK
#define SQLITE_ENABLE_PREUPDATE_HOOK (1)
#endif
#endif





#if defined(INTEROP_INCLUDE_SEE)
#include "../ext/see-prefix.txt"
#endif

#include "../core/sqlite3.c"








>
>
>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef SQLITE_ENABLE_SESSION
#define SQLITE_ENABLE_SESSION (1)
#endif
#ifndef SQLITE_ENABLE_PREUPDATE_HOOK
#define SQLITE_ENABLE_PREUPDATE_HOOK (1)
#endif
#endif

#ifndef SQLITE_MAX_ATTACHED
#define SQLITE_MAX_ATTACHED 30
#endif

#if defined(INTEROP_INCLUDE_SEE)
#include "../ext/see-prefix.txt"
#endif

#include "../core/sqlite3.c"

Changes to System.Data.SQLite/SQLite3.cs.
2879
2880
2881
2882
2883
2884
2885
2886

2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898

2899
2900
2901
2902
2903
2904
2905
        }
#else
        //
        // TODO: Update this list if the available values in the
        //       "SQLiteConfigDbOpsEnum" enumeration change.
        //
        builder.AppendFormat(CultureInfo.InvariantCulture,
            "{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}",

            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_LOOKASIDE_USED,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_USED,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_SCHEMA_USED,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_STMT_USED,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_LOOKASIDE_HIT,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_HIT,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_MISS,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_WRITE,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_DEFERRED_FKS,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_USED_SHARED);

#endif

        return builder.ToString();
    }

    /// <summary>
    /// Builds an error message string fragment containing the







|
>











|
>







2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
        }
#else
        //
        // TODO: Update this list if the available values in the
        //       "SQLiteConfigDbOpsEnum" enumeration change.
        //
        builder.AppendFormat(CultureInfo.InvariantCulture,
            "{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, " +
            "{10}, {11}, {12}",
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_LOOKASIDE_USED,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_USED,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_SCHEMA_USED,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_STMT_USED,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_LOOKASIDE_HIT,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_HIT,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_MISS,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_WRITE,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_DEFERRED_FKS,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_USED_SHARED,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_SPILL);
#endif

        return builder.ToString();
    }

    /// <summary>
    /// Builds an error message string fragment containing the
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000


3001
3002
3003
3004
3005
3006
3007
        }
#else
        //
        // TODO: Update this list if the available values in the
        //       "SQLiteConfigDbOpsEnum" enumeration change.
        //
        builder.AppendFormat(CultureInfo.InvariantCulture,
            "{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, " +
            "{9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}",
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_NONE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_MAINDBNAME,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_LOOKASIDE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_FKEY,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_TRIGGER,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_QPSG,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_TRIGGER_EQP,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_RESET_DATABASE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DEFENSIVE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_WRITABLE_SCHEMA,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DQS_DML,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DQS_DDL,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_VIEW);


#endif

        return builder.ToString();
    }

    /// <summary>
    /// Returns the current and/or highwater values for the specified







|
|
















|
>
>







2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
        }
#else
        //
        // TODO: Update this list if the available values in the
        //       "SQLiteConfigDbOpsEnum" enumeration change.
        //
        builder.AppendFormat(CultureInfo.InvariantCulture,
            "{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, " +
            "{10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}",
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_NONE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_MAINDBNAME,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_LOOKASIDE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_FKEY,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_TRIGGER,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_QPSG,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_TRIGGER_EQP,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_RESET_DATABASE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DEFENSIVE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_WRITABLE_SCHEMA,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DQS_DML,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DQS_DDL,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_VIEW,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_LEGACY_FILE_FORMAT,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_TRUSTED_SCHEMA);
#endif

        return builder.ToString();
    }

    /// <summary>
    /// Returns the current and/or highwater values for the specified
3204
3205
3206
3207
3208
3209
3210


3211
3212
3213
3214
3215
3216
3217
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_RESET_DATABASE: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DEFENSIVE: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_WRITABLE_SCHEMA: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DQS_DML: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DQS_DDL: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_VIEW: // int int*


                {
                    if (!(value is bool))
                    {
                        throw new SQLiteException(HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            "configuration value type mismatch, must be of type {0}",
                            typeof(bool)));







>
>







3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_RESET_DATABASE: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DEFENSIVE: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_WRITABLE_SCHEMA: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DQS_DML: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DQS_DDL: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_VIEW: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_LEGACY_FILE_FORMAT: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_TRUSTED_SCHEMA: // int int*
                {
                    if (!(value is bool))
                    {
                        throw new SQLiteException(HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            "configuration value type mismatch, must be of type {0}",
                            typeof(bool)));
Changes to System.Data.SQLite/SQLiteBase.cs.
1536
1537
1538
1539
1540
1541
1542
1543











1544
1545
1546
1547
1548
1549
1550
      /// the pager caches associated with the database connection are
      /// shared, this request returns the same value as DBSTATUS_CACHE_USED.
      /// Or, if one or more or the pager caches are shared, the value
      /// returned by this call will be smaller than that returned by
      /// DBSTATUS_CACHE_USED. The highwater mark associated with
      /// SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.
      /// </summary>
      SQLITE_DBSTATUS_CACHE_USED_SHARED = 11











  }

  /// <summary>
  /// These are the supported configuration verbs for use with the native
  /// SQLite library.  They are used with the
  /// <see cref="SQLiteConnection.SetConfigurationOption" /> method.
  /// </summary>







|
>
>
>
>
>
>
>
>
>
>
>







1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
      /// the pager caches associated with the database connection are
      /// shared, this request returns the same value as DBSTATUS_CACHE_USED.
      /// Or, if one or more or the pager caches are shared, the value
      /// returned by this call will be smaller than that returned by
      /// DBSTATUS_CACHE_USED. The highwater mark associated with
      /// SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.
      /// </summary>
      SQLITE_DBSTATUS_CACHE_USED_SHARED = 11,

      /// <summary>
      /// This parameter returns the number of dirty cache entries that have
      /// been written to disk in the middle of a transaction due to the page
      /// cache overflowing. Transactions are more efficient if they are
      /// written to disk all at once. When pages spill mid-transaction, that
      /// introduces additional overhead. This parameter can be used help
      /// identify inefficiencies that can be resolved by increasing the cache
      /// size.
      /// </summary>
      SQLITE_DBSTATUS_CACHE_SPILL = 12
  }

  /// <summary>
  /// These are the supported configuration verbs for use with the native
  /// SQLite library.  They are used with the
  /// <see cref="SQLiteConnection.SetConfigurationOption" /> method.
  /// </summary>
1670
1671
1672
1673
1674
1675
1676
1677





























1678
1679
1680
1681
1682
1683
1684
      /// INDEX.
      /// </summary>
      SQLITE_DBCONFIG_DQS_DDL = 1014, // int int*

      /// <summary>
      /// This option is used to enable or disable CREATE VIEW.
      /// </summary>
      SQLITE_DBCONFIG_ENABLE_VIEW = 1015 // int int*





























  }

  // These are the options to the internal sqlite3_config call.
  internal enum SQLiteConfigOpsEnum
  {
    SQLITE_CONFIG_NONE = 0, // nil
    SQLITE_CONFIG_SINGLETHREAD = 1, // nil







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
      /// INDEX.
      /// </summary>
      SQLITE_DBCONFIG_DQS_DDL = 1014, // int int*

      /// <summary>
      /// This option is used to enable or disable CREATE VIEW.
      /// </summary>
      SQLITE_DBCONFIG_ENABLE_VIEW = 1015, // int int*

      /// <summary>
      /// This option activates or deactivates the legacy file format flag.
      /// </summary>
      SQLITE_DBCONFIG_LEGACY_FILE_FORMAT = 1016, // int int*

      /// <summary>
      /// This option tells SQLite to assume that database schemas (i.e. the
      /// contents of the sqlite_master tables) are untainted by malicious
      /// content.  When the trusted schema option is disabled, SQLite takes
      /// additional defensive steps to protect the application from harm
      /// including:
      /// <![CDATA[<ul>]]>
      /// <![CDATA[<li>]]>
      /// Prohibit the use of SQL functions inside triggers, views, CHECK
      /// constraints, DEFAULT clauses, expression indexes, partial indexes,
      /// or generated columns unless those functions are tagged with
      /// SQLITE_INNOCUOUS.
      /// <![CDATA[</li>]]>
      /// <![CDATA[<li>]]>
      /// Prohibit the use of virtual tables inside of triggers or views
      /// unless those virtual tables are tagged with SQLITE_VTAB_INNOCUOUS.
      /// <![CDATA[</ul>]]>
      /// This setting defaults to "on" for legacy compatibility, however
      /// all applications are advised to turn it off if possible.  This
      /// setting can also be controlled using the PRAGMA trusted_schema
      /// statement.
      /// </summary>
      SQLITE_DBCONFIG_TRUSTED_SCHEMA = 1017 // int int*
  }

  // These are the options to the internal sqlite3_config call.
  internal enum SQLiteConfigOpsEnum
  {
    SQLITE_CONFIG_NONE = 0, // nil
    SQLITE_CONFIG_SINGLETHREAD = 1, // nil
1701
1702
1703
1704
1705
1706
1707
1708




1709
1710
1711
1712
1713
1714
1715
    SQLITE_CONFIG_PCACHE2 = 18, // sqlite3_pcache_methods2*
    SQLITE_CONFIG_GETPCACHE2 = 19, // sqlite3_pcache_methods2*
    SQLITE_CONFIG_COVERING_INDEX_SCAN = 20, // int
    SQLITE_CONFIG_SQLLOG = 21, // xSqllog, void*
    SQLITE_CONFIG_MMAP_SIZE = 22, // sqlite3_int64, sqlite3_int64
    SQLITE_CONFIG_WIN32_HEAPSIZE = 23, // int nByte
    SQLITE_CONFIG_PCACHE_HDRSZ = 24, // int *psz
    SQLITE_CONFIG_PMASZ = 25 // unsigned int szPma




  }

  /// <summary>
  /// These constants are used with the sqlite3_trace_v2() API and the
  /// callbacks registered by it.
  /// </summary>
  [Flags()]







|
>
>
>
>







1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
    SQLITE_CONFIG_PCACHE2 = 18, // sqlite3_pcache_methods2*
    SQLITE_CONFIG_GETPCACHE2 = 19, // sqlite3_pcache_methods2*
    SQLITE_CONFIG_COVERING_INDEX_SCAN = 20, // int
    SQLITE_CONFIG_SQLLOG = 21, // xSqllog, void*
    SQLITE_CONFIG_MMAP_SIZE = 22, // sqlite3_int64, sqlite3_int64
    SQLITE_CONFIG_WIN32_HEAPSIZE = 23, // int nByte
    SQLITE_CONFIG_PCACHE_HDRSZ = 24, // int *psz
    SQLITE_CONFIG_PMASZ = 25, // unsigned int szPma
    SQLITE_CONFIG_STMTJRNL_SPILL = 26, // int nByte
    SQLITE_CONFIG_SMALL_MALLOC = 27, // boolean
    SQLITE_CONFIG_SORTERREF_SIZE = 28, // int nByte
    SQLITE_CONFIG_MEMDB_MAXSIZE = 29  // sqlite3_int64
  }

  /// <summary>
  /// These constants are used with the sqlite3_trace_v2() API and the
  /// callbacks registered by it.
  /// </summary>
  [Flags()]
Changes to System.Data.SQLite/UnsafeNativeMethods.cs.
1405
1406
1407
1408
1409
1410
1411


1412
1413
1414
1415
1416
1417
1418
          SHx = 4,
          ARM = 5,
          IA64 = 6,
          Alpha64 = 7,
          MSIL = 8,
          AMD64 = 9,
          IA32_on_Win64 = 10,


          Unknown = 0xFFFF
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This structure contains information about the current computer. This
      /// includes the processor type, page size, memory addresses, etc.







>
>







1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
          SHx = 4,
          ARM = 5,
          IA64 = 6,
          Alpha64 = 7,
          MSIL = 8,
          AMD64 = 9,
          IA32_on_Win64 = 10,
          Neutral = 11,
          ARM64 = 12,
          Unknown = 0xFFFF
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This structure contains information about the current computer. This
      /// includes the processor type, page size, memory addresses, etc.
Changes to Targets/SQLite.NET.targets.
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
  -->

  <Target Name="CleanConfigurations"
          Condition="'$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')">
    <CreateItem Include="$(OutputPath)*.config">
      <Output ItemName="ConfigurationFiles" TaskParameter="Include" />
    </CreateItem>

    <Delete Condition="'@(ConfigurationFiles)' != ''"
            Files="@(ConfigurationFiles)" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CopyConfigurations"
          Condition="'$(CopyConfigurations)' != 'false' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyConfigurations.done">
    <CreateItem Include="Configurations\*.config" Exclude="Configurations\no_*">
      <Output ItemName="ConfigurationFiles" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(ConfigurationFiles)"
          DestinationFolder="$(OutputPath)" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyConfigurations.done" />
  </Target>

  <!--







|


|
|














|


|







171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
  -->

  <Target Name="CleanConfigurations"
          Condition="'$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')">
    <CreateItem Include="$(OutputPath)*.config">
      <Output ItemName="CleanConfigurationsItem" TaskParameter="Include" />
    </CreateItem>

    <Delete Condition="'@(CleanConfigurationsItem)' != ''"
            Files="@(CleanConfigurationsItem)" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CopyConfigurations"
          Condition="'$(CopyConfigurations)' != 'false' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyConfigurations.done">
    <CreateItem Include="Configurations\*.config" Exclude="Configurations\no_*">
      <Output ItemName="CopyConfigurationsItem" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(CopyConfigurationsItem)"
          DestinationFolder="$(OutputPath)" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyConfigurations.done" />
  </Target>

  <!--
Changes to Tests/basic.eagle.
1698
1699
1700
1701
1702
1703
1704
1705

1706
1707
1708
1709
1710
1711
1712
1713

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \

[list [getDbDefaultPageSize] 1073741823 0 2 [getDbDefaultCacheSize] delete 0]}

###############################################################################

runTest {test data-1.34 {SQLiteConnection.Open with SetDefaults=True} -setup {
  setupDb [set fileName data-1.34.db] "" "" "" "" SetDefaults=True
} -body {
  set result [list]







|
>
|







1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result [appendArgs ^ [getDbDefaultPageSize] " 1073741823 " \
{(?:\{\}|0)} " 2 " [getDbDefaultCacheSize] " delete 0\$"]}

###############################################################################

runTest {test data-1.34 {SQLiteConnection.Open with SetDefaults=True} -setup {
  setupDb [set fileName data-1.34.db] "" "" "" "" SetDefaults=True
} -body {
  set result [list]
1722
1723
1724
1725
1726
1727
1728
1729

1730
1731
1732
1733
1734
1735
1736
1737

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \

[list [getDbDefaultPageSize] 1073741823 0 2 [getDbDefaultCacheSize] delete 0]}

###############################################################################

runTest {test data-1.35 {SQLiteConnection.Open without SetDefaults} -setup {
  setupDb [set fileName data-1.35.db]
} -body {
  set result [list]







|
>
|







1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result [appendArgs ^ [getDbDefaultPageSize] " 1073741823 " \
{(?:\{\}|1)} " 2 " [getDbDefaultCacheSize] " delete 0\$"]}

###############################################################################

runTest {test data-1.35 {SQLiteConnection.Open without SetDefaults} -setup {
  setupDb [set fileName data-1.35.db]
} -body {
  set result [list]
1746
1747
1748
1749
1750
1751
1752
1753

1754
1755
1756
1757
1758
1759
1760
1761

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \

[list [getDbDefaultPageSize] 1073741823 0 2 [getDbDefaultCacheSize] delete 0]}

###############################################################################

runTest {test data-1.36 {SQLiteConnection.Open with PRAGMA overrides} -setup {
  #
  # NOTE: Attempt to open a connection with all available PRAGMA settings
  #       set to non-default values in the connection string.







|
>
|







1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result [appendArgs ^ [getDbDefaultPageSize] " 1073741823 " \
{(?:\{\}|0)} " 2 " [getDbDefaultCacheSize] " delete 0\$"]}

###############################################################################

runTest {test data-1.36 {SQLiteConnection.Open with PRAGMA overrides} -setup {
  #
  # NOTE: Attempt to open a connection with all available PRAGMA settings
  #       set to non-default values in the connection string.
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{4096 2048 1 1 4096 wal 1}}

###############################################################################

runTest {test data-1.37 {sqlite3_win32_set_directory function} -setup {
  set directory(base) [getDatabaseDirectory]

  if {[string length $directory(base)] == 0 || \







|
|







1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^4096 2048 (?:\{\}|1) 1 4096 wal 1$}}

###############################################################################

runTest {test data-1.37 {sqlite3_win32_set_directory function} -setup {
  set directory(base) [getDatabaseDirectory]

  if {[string length $directory(base)] == 0 || \
4975
4976
4977
4978
4979
4980
4981


4982
4983
4984
4985
4986
4987
4988
  lappend dbConfigs SQLITE_DBCONFIG_RESET_DATABASE; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_DEFENSIVE; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_WRITABLE_SCHEMA; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_LEGACY_ALTER_TABLE; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_DQS_DML; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_DQS_DDL; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_ENABLE_VIEW; # int int*



  set connection [getDbConnection]

  foreach dbConfig $dbConfigs {
    switch -exact -- $dbConfig {
      SQLITE_DBCONFIG_NONE {
        set value null







>
>







4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
  lappend dbConfigs SQLITE_DBCONFIG_RESET_DATABASE; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_DEFENSIVE; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_WRITABLE_SCHEMA; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_LEGACY_ALTER_TABLE; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_DQS_DML; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_DQS_DDL; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_ENABLE_VIEW; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_LEGACY_FILE_FORMAT; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_TRUSTED_SCHEMA; # int int*

  set connection [getDbConnection]

  foreach dbConfig $dbConfigs {
    switch -exact -- $dbConfig {
      SQLITE_DBCONFIG_NONE {
        set value null
5049
5050
5051
5052
5053
5054
5055
5056

5057
5058
5059
5060
5061
5062
5063
  }

  unset -nocomplain current highwater ints count size ptr value
  unset -nocomplain result dbConfig dbConfigs
  unset -nocomplain connection db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -match regexp -result {^\{\} \{\} \{\} \{\} \{\} \{\} \{\}\
\{\} \{\} \{\} \{\} \{\} \{\} \{\} \{\} \{\} \{\} Ok 0 0 Ok \d+ \d+ True True$}}


###############################################################################

runTest {test data-1.96 {connection pool interaction with read-only} -setup {
  catch {
    object invoke -flags +NonPublic \
        System.Data.SQLite.SQLiteConnectionPool _poolOpened 0







|
>







5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
  }

  unset -nocomplain current highwater ints count size ptr value
  unset -nocomplain result dbConfig dbConfigs
  unset -nocomplain connection db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -match regexp -result {^\{\} \{\} \{\} \{\} \{\} \{\} \{\}\
\{\} \{\} \{\} \{\} \{\} \{\} \{\} \{\} \{\} \{\} \{\} \{\} Ok 0 0 Ok \d+ \d+\
True True$}}

###############################################################################

runTest {test data-1.96 {connection pool interaction with read-only} -setup {
  catch {
    object invoke -flags +NonPublic \
        System.Data.SQLite.SQLiteConnectionPool _poolOpened 0
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569

  freeDbConnection

  unset -nocomplain value result limit limits
  unset -nocomplain connection db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {-1 -1 1000000000 1 1000000000 1 2000 1 1000 1 500\
1 250000000 1 127 1 10 1 50000 1 999 1 1000 1 0 1}}

###############################################################################

reportSQLiteResources $test_channel

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue







|










5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575

  freeDbConnection

  unset -nocomplain value result limit limits
  unset -nocomplain connection db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {-1 -1 1000000000 1 1000000000 1 2000 1 1000 1 500\
1 250000000 1 127 1 30 1 50000 1 999 1 1000 1 0 1}}

###############################################################################

reportSQLiteResources $test_channel

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue
Changes to Tests/version.eagle.
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
###############################################################################

#
# NOTE: What is the full version of the included SQLite core library?  This
#       must be kept synchronized with the version numbers for the associated
#       source code and property files.
#
set version(core,full) 3.30.1.0
set version(core,short) 3.30.1

###############################################################################

#
# NOTE: What is the full version of the EntityFramework NuGet package (which
#       is not [necessarily] the same version as the assembly itself) in use
#       by the System.Data.SQLite NuGet packages?







|
|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
###############################################################################

#
# NOTE: What is the full version of the included SQLite core library?  This
#       must be kept synchronized with the version numbers for the associated
#       source code and property files.
#
set version(core,full) 3.31.0.0
set version(core,short) 3.31.0

###############################################################################

#
# NOTE: What is the full version of the EntityFramework NuGet package (which
#       is not [necessarily] the same version as the assembly itself) in use
#       by the System.Data.SQLite NuGet packages?
247
248
249
250
251
252
253

254
255
256

257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275

276
277
278
279
280
281
282
283
unset -nocomplain patterns

###############################################################################
# readme.htm
###############################################################################

lappend patterns \

    [appendArgs "Using <a href=\"https://www\\.sqlite\\.org/releaselog/" \
        [string map [list . _] $version(core,short)] "\\.html\">SQLite " \
        [string map [list . \\.] $version(core,short)] </a>] \

    [appendArgs " to <a href=\"https://www\\.sqlite\\.org/releaselog/" \
        [string map [list . _] $version(core,short)] "\\.html\">SQLite " \
        [string map [list . \\.] $version(core,short)] </a>] \
    [appendArgs Version " " [string map [list . \\.] $version(full)] " "] \
    [appendArgs <b> [string map [list . \\.] $version(full)] " - "] \
    [appendArgs Version= [string map [list . \\.] $version(full)] ,]

###############################################################################
# dbfactorysupport.html
###############################################################################

lappend patterns \
    [appendArgs Version= [string map [list . \\.] $version(full)] ,]

###############################################################################
# version.html
###############################################################################

lappend patterns \

    [appendArgs " to <a href=\"https://www\\.sqlite\\.org/releaselog/" \
        [string map [list . _] $version(core,short)] "\\.html\">SQLite " \
        [string map [list . \\.] $version(core,short)] </a>] \
    [appendArgs <b> [string map [list . \\.] $version(full)] " - "]

###############################################################################
# welcome.html
###############################################################################







>
|


>
|


















>
|







247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
unset -nocomplain patterns

###############################################################################
# readme.htm
###############################################################################

lappend patterns \
    [appendArgs \
        "Using <a href=\"https://www\\.sqlite\\.org/(?:draft/)?releaselog/" \
        [string map [list . _] $version(core,short)] "\\.html\">SQLite " \
        [string map [list . \\.] $version(core,short)] </a>] \
    [appendArgs \
        " to <a href=\"https://www\\.sqlite\\.org/(?:draft/)?releaselog/" \
        [string map [list . _] $version(core,short)] "\\.html\">SQLite " \
        [string map [list . \\.] $version(core,short)] </a>] \
    [appendArgs Version " " [string map [list . \\.] $version(full)] " "] \
    [appendArgs <b> [string map [list . \\.] $version(full)] " - "] \
    [appendArgs Version= [string map [list . \\.] $version(full)] ,]

###############################################################################
# dbfactorysupport.html
###############################################################################

lappend patterns \
    [appendArgs Version= [string map [list . \\.] $version(full)] ,]

###############################################################################
# version.html
###############################################################################

lappend patterns \
    [appendArgs \
        " to <a href=\"https://www\\.sqlite\\.org/(?:draft/)?releaselog/" \
        [string map [list . _] $version(core,short)] "\\.html\">SQLite " \
        [string map [list . \\.] $version(core,short)] </a>] \
    [appendArgs <b> [string map [list . \\.] $version(full)] " - "]

###############################################################################
# welcome.html
###############################################################################
Changes to readme.htm.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
ADO.NET SQLite Data Provider<br />
Version 1.0.113.0 - January XX, 2020 <font color="red">(release scheduled)</font><br />
Using <a href="https://www.sqlite.org/releaselog/3_30_1.html">SQLite 3.30.1</a><br />Originally written by Robert Simpson<br />
Released to the public domain, use at your own risk!<br />
Official provider website:&nbsp;<a href="https://system.data.sqlite.org/">https://system.data.sqlite.org/</a><br />
Legacy versions:&nbsp;<a href="https://sourceforge.net/projects/sqlite-dotnet2/">https://sourceforge.net/projects/sqlite-dotnet2/</a><br />
<br />
The current development version can be downloaded from <a href="https://system.data.sqlite.org/index.html/timeline?y=ci">
https://system.data.sqlite.org/index.html/timeline?y=ci</a>
<br />







|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
ADO.NET SQLite Data Provider<br />
Version 1.0.113.0 - February XX, 2020 <font color="red">(release scheduled)</font><br />
Using <a href="https://www.sqlite.org/releaselog/3_31_0.html">SQLite 3.31.0</a><br />Originally written by Robert Simpson<br />
Released to the public domain, use at your own risk!<br />
Official provider website:&nbsp;<a href="https://system.data.sqlite.org/">https://system.data.sqlite.org/</a><br />
Legacy versions:&nbsp;<a href="https://sourceforge.net/projects/sqlite-dotnet2/">https://sourceforge.net/projects/sqlite-dotnet2/</a><br />
<br />
The current development version can be downloaded from <a href="https://system.data.sqlite.org/index.html/timeline?y=ci">
https://system.data.sqlite.org/index.html/timeline?y=ci</a>
<br />
204
205
206
207
208
209
210
211
212
213

214
215
216
217
218
219
220
designed for robustness and maximum backward compatibility with previously
released versions of System.Data.SQLite.
</p>

<h2><b>Version History</b></h2>

<p>
    <b>1.0.113.0 - January XX, 2020 <font color="red">(release scheduled)</font></b>
</p>
<ul>

    <li>Include the &quot;LINQ&quot; partial classes in the primary managed assembly for .NET Standard 2.1. Fix for [ad28d8e026].</li>
    <li>Add SQLite_ForceLogLifecycle environment variable to force logging of calls into key members pertaining to the lifecycle of connections and their associated classes (e.g. LINQ, EF6, etc).</li>
</ul>
<p>
    <b>1.0.112.0 - October 28, 2019</b>
</p>
<ul>







|


>







204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
designed for robustness and maximum backward compatibility with previously
released versions of System.Data.SQLite.
</p>

<h2><b>Version History</b></h2>

<p>
    <b>1.0.113.0 - February XX, 2020 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_31_0.html">SQLite 3.31.0</a>.</li>
    <li>Include the &quot;LINQ&quot; partial classes in the primary managed assembly for .NET Standard 2.1. Fix for [ad28d8e026].</li>
    <li>Add SQLite_ForceLogLifecycle environment variable to force logging of calls into key members pertaining to the lifecycle of connections and their associated classes (e.g. LINQ, EF6, etc).</li>
</ul>
<p>
    <b>1.0.112.0 - October 28, 2019</b>
</p>
<ul>
Changes to testce/testce.2005.csproj.
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Content Include="test.cfg">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="test.sql">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2005.csproj">
      <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.Compact.2005</Name>
    </ProjectReference>







|


|







91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Content Include="test.cfg">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="test.sql">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2005.csproj">
      <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.Compact.2005</Name>
    </ProjectReference>
Changes to testce/testce.2008.csproj.
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Content Include="test.cfg">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="test.sql">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2008.csproj">
      <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.Compact.2008</Name>
    </ProjectReference>







|


|







92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Content Include="test.cfg">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="test.sql">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2008.csproj">
      <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.Compact.2008</Name>
    </ProjectReference>
Changes to testce/testce.2012.csproj.
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Content Include="test.cfg">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="test.sql">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2012.csproj">
      <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.Compact.2012</Name>
    </ProjectReference>







|


|







76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Content Include="test.cfg">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="test.sql">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2012.csproj">
      <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.Compact.2012</Name>
    </ProjectReference>
Changes to testlinq/test.2010.csproj.
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
    <None Condition="'$(UseEntityFramework6)' == 'false' And
                     '$(TargetFrameworkVersion)' == 'v4.0'"
          Include="2010\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' != 'false' And
                     '$(TargetFrameworkVersion)' == 'v4.0'"
          Include="2010\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <EntityDeploy Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                  Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' == 'false' And







|







91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
    <None Condition="'$(UseEntityFramework6)' == 'false' And
                     '$(TargetFrameworkVersion)' == 'v4.0'"
          Include="2010\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' != 'false' And
                     '$(TargetFrameworkVersion)' == 'v4.0'"
          Include="2010\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <EntityDeploy Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                  Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' == 'false' And
Changes to testlinq/test.2012.csproj.
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
                      '$(TargetFrameworkVersion)' == 'v4.5')"
          Include="2012\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' != 'false' And
                     ('$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5')"
          Include="2012\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <EntityDeploy Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                  Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' == 'false' And







|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
                      '$(TargetFrameworkVersion)' == 'v4.5')"
          Include="2012\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' != 'false' And
                     ('$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5')"
          Include="2012\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <EntityDeploy Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                  Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' == 'false' And
Changes to testlinq/test.2013.csproj.
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
          Include="2013\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' != 'false' And
                     ('$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.1')"
          Include="2013\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <EntityDeploy Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                  Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' == 'false' And







|







110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
          Include="2013\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' != 'false' And
                     ('$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.1')"
          Include="2013\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <EntityDeploy Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                  Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' == 'false' And
Changes to testlinq/test.2015.csproj.
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
                      '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.6' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.2')"
          Include="2015\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <EntityDeploy Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                  Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' == 'false' And







|







126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
                      '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.6' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.2')"
          Include="2015\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <EntityDeploy Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                  Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' == 'false' And
Changes to testlinq/test.2017.csproj.
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
                      '$(TargetFrameworkVersion)' == 'v4.6' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.7' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.1')"
          Include="2017\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <EntityDeploy Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                  Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' == 'false' And







|







134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
                      '$(TargetFrameworkVersion)' == 'v4.6' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.7' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.1')"
          Include="2017\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <EntityDeploy Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                  Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' == 'false' And
Changes to testlinq/testef6.NetStandard21.csproj.
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
          Condition="'$(CopyToNetStandard21)' != 'false' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyToNetStandard21.done">
    <CreateItem Include="$(OutputPath)**">
      <Output ItemName="OutputPathFiles" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(OutputPathFiles)"
          DestinationFiles="@(OutputPathFiles -> '$(OutputPath)..\netstandard2.1\%(RecursiveDir)%(Filename)%(Extension)')" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyToNetStandard21.done" />
  </Target>

  <!--
  ******************************************************************************







|


|
|







71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
          Condition="'$(CopyToNetStandard21)' != 'false' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyToNetStandard21.done">
    <CreateItem Include="$(OutputPath)**">
      <Output ItemName="CopyToNetStandard21Item" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(CopyToNetStandard21Item)"
          DestinationFiles="@(CopyToNetStandard21Item -> '$(OutputPath)..\netstandard2.1\%(RecursiveDir)%(Filename)%(Extension)')" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyToNetStandard21.done" />
  </Target>

  <!--
  ******************************************************************************
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
  **                     Project Miscellaneous Data Files                     **
  ******************************************************************************
  -->

  <ItemGroup>
    <None Include="NetStandard21\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>

  <!--
  ******************************************************************************
  **                          Entity Framework Files                          **
  ******************************************************************************







|







181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
  **                     Project Miscellaneous Data Files                     **
  ******************************************************************************
  -->

  <ItemGroup>
    <None Include="NetStandard21\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>

  <!--
  ******************************************************************************
  **                          Entity Framework Files                          **
  ******************************************************************************
Changes to testlinq/testlinq.2008.csproj.
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="2008\LINQ\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <EntityDeploy Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
  </ItemGroup>
  <ItemGroup>







|







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="2008\LINQ\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <EntityDeploy Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
  </ItemGroup>
  <ItemGroup>
Changes to www/news.wiki.
41
42
43
44
45
46
47
48
49
50

51
52
53
54
55
56
57
    Access to archived release packages will be granted on a case-by-case basis.
  </li>
</ul>

<div align="center"><h2><b>Version History</b></h2></div>

<p>
    <b>1.0.113.0 - January XX, 2020 <font color="red">(release scheduled)</font></b>
</p>
<ul>

    <li>Include the &quot;LINQ&quot; partial classes in the primary managed assembly for .NET Standard 2.1. Fix for [ad28d8e026].</li>
    <li>Add SQLite_ForceLogLifecycle environment variable to force logging of calls into key members pertaining to the lifecycle of connections and their associated classes (e.g. LINQ, EF6, etc).</li>
</ul>
<p>
    <b>1.0.112.0 - October 28, 2019</b>
</p>
<ul>







|


>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
    Access to archived release packages will be granted on a case-by-case basis.
  </li>
</ul>

<div align="center"><h2><b>Version History</b></h2></div>

<p>
    <b>1.0.113.0 - February XX, 2020 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_31_0.html|SQLite 3.31.0].</li>
    <li>Include the &quot;LINQ&quot; partial classes in the primary managed assembly for .NET Standard 2.1. Fix for [ad28d8e026].</li>
    <li>Add SQLite_ForceLogLifecycle environment variable to force logging of calls into key members pertaining to the lifecycle of connections and their associated classes (e.g. LINQ, EF6, etc).</li>
</ul>
<p>
    <b>1.0.112.0 - October 28, 2019</b>
</p>
<ul>