Skip to content

Commit 686e3b8

Browse files
committed
Snapshot of upstream SQLite 3.46.1
1 parent 58e90d6 commit 686e3b8

34 files changed

Lines changed: 378 additions & 305 deletions

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.46.0
1+
3.46.1

autoconf/tea/configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dnl to configure the system for the local environment.
1919
# so that we create the export library with the dll.
2020
#-----------------------------------------------------------------------
2121

22-
AC_INIT([sqlite],[3.46.0])
22+
AC_INIT([sqlite],[3.46.1])
2323

2424
#--------------------------------------------------------------------
2525
# Call TEA_INIT as the first TEA_ macro to set up initial vars.

configure

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.69 for sqlite 3.46.0.
3+
# Generated by GNU Autoconf 2.69 for sqlite 3.46.1.
44
#
55
#
66
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -726,8 +726,8 @@ MAKEFLAGS=
726726
# Identity of this package.
727727
PACKAGE_NAME='sqlite'
728728
PACKAGE_TARNAME='sqlite'
729-
PACKAGE_VERSION='3.46.0'
730-
PACKAGE_STRING='sqlite 3.46.0'
729+
PACKAGE_VERSION='3.46.1'
730+
PACKAGE_STRING='sqlite 3.46.1'
731731
PACKAGE_BUGREPORT=''
732732
PACKAGE_URL=''
733733

@@ -1472,7 +1472,7 @@ if test "$ac_init_help" = "long"; then
14721472
# Omit some internal or obsolete options to make the list less imposing.
14731473
# This message is too long to be a string in the A/UX 3.1 sh.
14741474
cat <<_ACEOF
1475-
\`configure' configures sqlite 3.46.0 to adapt to many kinds of systems.
1475+
\`configure' configures sqlite 3.46.1 to adapt to many kinds of systems.
14761476
14771477
Usage: $0 [OPTION]... [VAR=VALUE]...
14781478
@@ -1537,7 +1537,7 @@ fi
15371537

15381538
if test -n "$ac_init_help"; then
15391539
case $ac_init_help in
1540-
short | recursive ) echo "Configuration of sqlite 3.46.0:";;
1540+
short | recursive ) echo "Configuration of sqlite 3.46.1:";;
15411541
esac
15421542
cat <<\_ACEOF
15431543
@@ -1668,7 +1668,7 @@ fi
16681668
test -n "$ac_init_help" && exit $ac_status
16691669
if $ac_init_version; then
16701670
cat <<\_ACEOF
1671-
sqlite configure 3.46.0
1671+
sqlite configure 3.46.1
16721672
generated by GNU Autoconf 2.69
16731673
16741674
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2087,7 +2087,7 @@ cat >config.log <<_ACEOF
20872087
This file contains any messages produced by compilers while
20882088
running configure, to aid debugging if configure makes a mistake.
20892089
2090-
It was created by sqlite $as_me 3.46.0, which was
2090+
It was created by sqlite $as_me 3.46.1, which was
20912091
generated by GNU Autoconf 2.69. Invocation command line was
20922092
20932093
$ $0 $@
@@ -12481,7 +12481,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
1248112481
# report actual input values of CONFIG_FILES etc. instead of their
1248212482
# values after options handling.
1248312483
ac_log="
12484-
This file was extended by sqlite $as_me 3.46.0, which was
12484+
This file was extended by sqlite $as_me 3.46.1, which was
1248512485
generated by GNU Autoconf 2.69. Invocation command line was
1248612486
1248712487
CONFIG_FILES = $CONFIG_FILES
@@ -12547,7 +12547,7 @@ _ACEOF
1254712547
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1254812548
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1254912549
ac_cs_version="\\
12550-
sqlite config.status 3.46.0
12550+
sqlite config.status 3.46.1
1255112551
configured by $0, generated by GNU Autoconf 2.69,
1255212552
with options \\"\$ac_cs_config\\"
1255312553

ext/consio/console_io.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@
5353
# define CIO_WIN_WC_XLATE 0 /* Not exposing translation routines at all */
5454
#endif
5555

56-
#if CIO_WIN_WC_XLATE
57-
/* Character used to represent a known-incomplete UTF-8 char group (�) */
58-
static WCHAR cBadGroup = 0xfffd;
59-
#endif
60-
6156
#if CIO_WIN_WC_XLATE
6257
static HANDLE handleOfFile(FILE *pf){
6358
int fileDesc = _fileno(pf);

ext/expert/expert1.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,13 @@ do_execsql_test 5.3 {
465465
t2 t2_idx_0001295b {100 20 5}
466466
}
467467

468+
do_catchsql_test 5.4 {
469+
SELECT sqlite_expert_rem(123, 123);
470+
} {1 {no such function: sqlite_expert_rem}}
471+
do_catchsql_test 5.5 {
472+
SELECT sqlite_expert_sample();
473+
} {1 {no such function: sqlite_expert_sample}}
474+
468475
if 0 {
469476
do_test expert1-6.0 {
470477
catchcmd :memory: {

ext/expert/sqlite3expert.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ static int expertFilter(
626626
pCsr->pData = 0;
627627
if( rc==SQLITE_OK ){
628628
rc = idxPrintfPrepareStmt(pExpert->db, &pCsr->pData, &pVtab->base.zErrMsg,
629-
"SELECT * FROM main.%Q WHERE sample()", pVtab->pTab->zName
629+
"SELECT * FROM main.%Q WHERE sqlite_expert_sample()", pVtab->pTab->zName
630630
);
631631
}
632632

@@ -1500,7 +1500,7 @@ struct IdxRemCtx {
15001500
};
15011501

15021502
/*
1503-
** Implementation of scalar function rem().
1503+
** Implementation of scalar function sqlite_expert_rem().
15041504
*/
15051505
static void idxRemFunc(
15061506
sqlite3_context *pCtx,
@@ -1513,7 +1513,7 @@ static void idxRemFunc(
15131513
assert( argc==2 );
15141514

15151515
iSlot = sqlite3_value_int(argv[0]);
1516-
assert( iSlot<=p->nSlot );
1516+
assert( iSlot<p->nSlot );
15171517
pSlot = &p->aSlot[iSlot];
15181518

15191519
switch( pSlot->eType ){
@@ -1624,7 +1624,8 @@ static int idxPopulateOneStat1(
16241624
const char *zName = (const char*)sqlite3_column_text(pIndexXInfo, 0);
16251625
const char *zColl = (const char*)sqlite3_column_text(pIndexXInfo, 1);
16261626
zCols = idxAppendText(&rc, zCols,
1627-
"%sx.%Q IS rem(%d, x.%Q) COLLATE %s", zComma, zName, nCol, zName, zColl
1627+
"%sx.%Q IS sqlite_expert_rem(%d, x.%Q) COLLATE %s",
1628+
zComma, zName, nCol, zName, zColl
16281629
);
16291630
zOrder = idxAppendText(&rc, zOrder, "%s%d", zComma, ++nCol);
16301631
}
@@ -1757,13 +1758,13 @@ static int idxPopulateStat1(sqlite3expert *p, char **pzErr){
17571758

17581759
if( rc==SQLITE_OK ){
17591760
sqlite3 *dbrem = (p->iSample==100 ? p->db : p->dbv);
1760-
rc = sqlite3_create_function(
1761-
dbrem, "rem", 2, SQLITE_UTF8, (void*)pCtx, idxRemFunc, 0, 0
1761+
rc = sqlite3_create_function(dbrem, "sqlite_expert_rem",
1762+
2, SQLITE_UTF8, (void*)pCtx, idxRemFunc, 0, 0
17621763
);
17631764
}
17641765
if( rc==SQLITE_OK ){
1765-
rc = sqlite3_create_function(
1766-
p->db, "sample", 0, SQLITE_UTF8, (void*)&samplectx, idxSampleFunc, 0, 0
1766+
rc = sqlite3_create_function(p->db, "sqlite_expert_sample",
1767+
0, SQLITE_UTF8, (void*)&samplectx, idxSampleFunc, 0, 0
17671768
);
17681769
}
17691770

@@ -1815,6 +1816,9 @@ static int idxPopulateStat1(sqlite3expert *p, char **pzErr){
18151816
rc = sqlite3_exec(p->dbm, "ANALYZE sqlite_schema", 0, 0, 0);
18161817
}
18171818

1819+
sqlite3_create_function(p->db, "sqlite_expert_rem", 2, SQLITE_UTF8, 0,0,0,0);
1820+
sqlite3_create_function(p->db, "sqlite_expert_sample", 0,SQLITE_UTF8,0,0,0,0);
1821+
18181822
sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp."UNIQUE_TABLE_NAME,0,0,0);
18191823
return rc;
18201824
}

ext/fts5/fts5_expr.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,11 @@ int sqlite3Fts5ExprNew(
324324
}
325325

326326
sqlite3_free(sParse.apPhrase);
327-
*pzErr = sParse.zErr;
327+
if( 0==*pzErr ){
328+
*pzErr = sParse.zErr;
329+
}else{
330+
sqlite3_free(sParse.zErr);
331+
}
328332
return sParse.rc;
329333
}
330334

@@ -2452,6 +2456,7 @@ Fts5ExprNode *sqlite3Fts5ParseImplicitAnd(
24522456
assert( pRight->eType==FTS5_STRING
24532457
|| pRight->eType==FTS5_TERM
24542458
|| pRight->eType==FTS5_EOF
2459+
|| (pRight->eType==FTS5_AND && pParse->bPhraseToAnd)
24552460
);
24562461

24572462
if( pLeft->eType==FTS5_AND ){

ext/fts5/fts5_main.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,6 +1700,7 @@ static int fts5UpdateMethod(
17001700
rc = SQLITE_ERROR;
17011701
}else{
17021702
rc = fts5SpecialDelete(pTab, apVal);
1703+
bUpdateOrDelete = 1;
17031704
}
17041705
}else{
17051706
rc = fts5SpecialInsert(pTab, z, apVal[2 + pConfig->nCol + 1]);
@@ -2874,14 +2875,16 @@ int sqlite3Fts5GetTokenizer(
28742875
if( pMod==0 ){
28752876
assert( nArg>0 );
28762877
rc = SQLITE_ERROR;
2877-
*pzErr = sqlite3_mprintf("no such tokenizer: %s", azArg[0]);
2878+
if( pzErr ) *pzErr = sqlite3_mprintf("no such tokenizer: %s", azArg[0]);
28782879
}else{
28792880
rc = pMod->x.xCreate(
28802881
pMod->pUserData, (azArg?&azArg[1]:0), (nArg?nArg-1:0), &pConfig->pTok
28812882
);
28822883
pConfig->pTokApi = &pMod->x;
28832884
if( rc!=SQLITE_OK ){
2884-
if( pzErr ) *pzErr = sqlite3_mprintf("error in tokenizer constructor");
2885+
if( pzErr && rc!=SQLITE_NOMEM ){
2886+
*pzErr = sqlite3_mprintf("error in tokenizer constructor");
2887+
}
28852888
}else{
28862889
pConfig->ePattern = sqlite3Fts5TokenizerPattern(
28872890
pMod->x.xCreate, pConfig->pTok
@@ -2975,17 +2978,23 @@ static int fts5IntegrityMethod(
29752978

29762979
assert( pzErr!=0 && *pzErr==0 );
29772980
UNUSED_PARAM(isQuick);
2981+
assert( pTab->p.pConfig->pzErrmsg==0 );
2982+
pTab->p.pConfig->pzErrmsg = pzErr;
29782983
rc = sqlite3Fts5StorageIntegrity(pTab->pStorage, 0);
2979-
if( (rc&0xff)==SQLITE_CORRUPT ){
2980-
*pzErr = sqlite3_mprintf("malformed inverted index for FTS5 table %s.%s",
2981-
zSchema, zTabname);
2982-
rc = (*pzErr) ? SQLITE_OK : SQLITE_NOMEM;
2983-
}else if( rc!=SQLITE_OK ){
2984-
*pzErr = sqlite3_mprintf("unable to validate the inverted index for"
2985-
" FTS5 table %s.%s: %s",
2986-
zSchema, zTabname, sqlite3_errstr(rc));
2984+
if( *pzErr==0 && rc!=SQLITE_OK ){
2985+
if( (rc&0xff)==SQLITE_CORRUPT ){
2986+
*pzErr = sqlite3_mprintf("malformed inverted index for FTS5 table %s.%s",
2987+
zSchema, zTabname);
2988+
rc = (*pzErr) ? SQLITE_OK : SQLITE_NOMEM;
2989+
}else{
2990+
*pzErr = sqlite3_mprintf("unable to validate the inverted index for"
2991+
" FTS5 table %s.%s: %s",
2992+
zSchema, zTabname, sqlite3_errstr(rc));
2993+
}
29872994
}
2995+
29882996
sqlite3Fts5IndexCloseReader(pTab->p.pIndex);
2997+
pTab->p.pConfig->pzErrmsg = 0;
29892998

29902999
return rc;
29913000
}

ext/fts5/fts5_tokenize.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static int fts5AsciiCreate(
7979
int i;
8080
memset(p, 0, sizeof(AsciiTokenizer));
8181
memcpy(p->aTokenChar, aAsciiTokenChar, sizeof(aAsciiTokenChar));
82-
for(i=0; rc==SQLITE_OK && i<nArg; i+=2){
82+
for(i=0; rc==SQLITE_OK && i<nArg-1; i+=2){
8383
const char *zArg = azArg[i+1];
8484
if( 0==sqlite3_stricmp(azArg[i], "tokenchars") ){
8585
fts5AsciiAddExceptions(p, zArg, 1);
@@ -90,6 +90,7 @@ static int fts5AsciiCreate(
9090
rc = SQLITE_ERROR;
9191
}
9292
}
93+
if( rc==SQLITE_OK && i<nArg ) rc = SQLITE_ERROR;
9394
if( rc!=SQLITE_OK ){
9495
fts5AsciiDelete((Fts5Tokenizer*)p);
9596
p = 0;
@@ -381,17 +382,16 @@ static int fts5UnicodeCreate(
381382
}
382383

383384
/* Search for a "categories" argument */
384-
for(i=0; rc==SQLITE_OK && i<nArg; i+=2){
385+
for(i=0; rc==SQLITE_OK && i<nArg-1; i+=2){
385386
if( 0==sqlite3_stricmp(azArg[i], "categories") ){
386387
zCat = azArg[i+1];
387388
}
388389
}
389-
390390
if( rc==SQLITE_OK ){
391391
rc = unicodeSetCategories(p, zCat);
392392
}
393393

394-
for(i=0; rc==SQLITE_OK && i<nArg; i+=2){
394+
for(i=0; rc==SQLITE_OK && i<nArg-1; i+=2){
395395
const char *zArg = azArg[i+1];
396396
if( 0==sqlite3_stricmp(azArg[i], "remove_diacritics") ){
397397
if( (zArg[0]!='0' && zArg[0]!='1' && zArg[0]!='2') || zArg[1] ){
@@ -416,6 +416,7 @@ static int fts5UnicodeCreate(
416416
rc = SQLITE_ERROR;
417417
}
418418
}
419+
if( i<nArg && rc==SQLITE_OK ) rc = SQLITE_ERROR;
419420

420421
}else{
421422
rc = SQLITE_NOMEM;
@@ -1298,7 +1299,7 @@ static int fts5TriCreate(
12981299
int i;
12991300
pNew->bFold = 1;
13001301
pNew->iFoldParam = 0;
1301-
for(i=0; rc==SQLITE_OK && i<nArg; i+=2){
1302+
for(i=0; rc==SQLITE_OK && i<nArg-1; i+=2){
13021303
const char *zArg = azArg[i+1];
13031304
if( 0==sqlite3_stricmp(azArg[i], "case_sensitive") ){
13041305
if( (zArg[0]!='0' && zArg[0]!='1') || zArg[1] ){
@@ -1316,6 +1317,7 @@ static int fts5TriCreate(
13161317
rc = SQLITE_ERROR;
13171318
}
13181319
}
1320+
if( i<nArg && rc==SQLITE_OK ) rc = SQLITE_ERROR;
13191321

13201322
if( pNew->iFoldParam!=0 && pNew->bFold==0 ){
13211323
rc = SQLITE_ERROR;

ext/fts5/test/fts5aux.test

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,4 +377,28 @@ do_catchsql_test 12.3.3 {
377377
SELECT fts5_collist(t1, 1) FROM t1('one AND two');
378378
} {0 1}
379379

380+
#-------------------------------------------------------------------------
381+
reset_db
382+
do_execsql_test 13.1 {
383+
CREATE VIRTUAL TABLE t1 USING fts5(a, tokenize=ascii);
384+
INSERT INTO t1 VALUES('a b c'), ('d e f');
385+
PRAGMA integrity_check;
386+
} {ok}
387+
388+
do_catchsql_test 13.2 {
389+
SELECT highlight(t1, 0, '[', ']') FROM t1
390+
} {0 {{a b c} {d e f}}}
391+
392+
do_execsql_test 13.3 {
393+
PRAGMA writable_schema = 1;
394+
UPDATE sqlite_schema SET sql = 'CREATE VIRTUAL TABLE t1 USING fts5(a, tokenize=blah)'
395+
WHERE name = 't1';
396+
}
397+
398+
db close
399+
sqlite3 db test.db
400+
do_catchsql_test 13.4 {
401+
SELECT highlight(t1, 0, '[', ']') FROM t1
402+
} {1 {no such tokenizer: blah}}
403+
380404
finish_test

0 commit comments

Comments
 (0)