Skip to content

Commit a23eddc

Browse files
committed
Snapshot of upstream SQLite 3.45.1
1 parent a4df8d6 commit a23eddc

File tree

21 files changed

+360
-127
lines changed

21 files changed

+360
-127
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.45.0
1+
3.45.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.45.0])
22+
AC_INIT([sqlite],[3.45.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.45.0.
3+
# Generated by GNU Autoconf 2.69 for sqlite 3.45.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.45.0'
730-
PACKAGE_STRING='sqlite 3.45.0'
729+
PACKAGE_VERSION='3.45.1'
730+
PACKAGE_STRING='sqlite 3.45.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.45.0 to adapt to many kinds of systems.
1475+
\`configure' configures sqlite 3.45.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.45.0:";;
1540+
short | recursive ) echo "Configuration of sqlite 3.45.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.45.0
1671+
sqlite configure 3.45.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.45.0, which was
2090+
It was created by sqlite $as_me 3.45.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.45.0, which was
12484+
This file was extended by sqlite $as_me 3.45.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.45.0
12550+
sqlite config.status 3.45.1
1255112551
configured by $0, generated by GNU Autoconf 2.69,
1255212552
with options \\"\$ac_cs_config\\"
1255312553

ext/fts3/fts3.c

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4006,38 +4006,29 @@ static int fts3ShadowName(const char *zName){
40064006
** Implementation of the xIntegrity() method on the FTS3/FTS4 virtual
40074007
** table.
40084008
*/
4009-
static int fts3Integrity(
4009+
static int fts3IntegrityMethod(
40104010
sqlite3_vtab *pVtab, /* The virtual table to be checked */
40114011
const char *zSchema, /* Name of schema in which pVtab lives */
40124012
const char *zTabname, /* Name of the pVTab table */
40134013
int isQuick, /* True if this is a quick_check */
40144014
char **pzErr /* Write error message here */
40154015
){
40164016
Fts3Table *p = (Fts3Table*)pVtab;
4017-
char *zSql;
40184017
int rc;
4019-
char *zErr = 0;
4018+
int bOk = 0;
40204019

4021-
assert( pzErr!=0 );
4022-
assert( *pzErr==0 );
40234020
UNUSED_PARAMETER(isQuick);
4024-
zSql = sqlite3_mprintf(
4025-
"INSERT INTO \"%w\".\"%w\"(\"%w\") VALUES('integrity-check');",
4026-
zSchema, zTabname, zTabname);
4027-
if( zSql==0 ){
4028-
return SQLITE_NOMEM;
4029-
}
4030-
rc = sqlite3_exec(p->db, zSql, 0, 0, &zErr);
4031-
sqlite3_free(zSql);
4032-
if( (rc&0xff)==SQLITE_CORRUPT ){
4033-
*pzErr = sqlite3_mprintf("malformed inverted index for FTS%d table %s.%s",
4034-
p->bFts4 ? 4 : 3, zSchema, zTabname);
4035-
}else if( rc!=SQLITE_OK ){
4021+
rc = sqlite3Fts3IntegrityCheck(p, &bOk);
4022+
assert( rc!=SQLITE_CORRUPT_VTAB || bOk==0 );
4023+
if( rc!=SQLITE_OK && rc!=SQLITE_CORRUPT_VTAB ){
40364024
*pzErr = sqlite3_mprintf("unable to validate the inverted index for"
40374025
" FTS%d table %s.%s: %s",
4038-
p->bFts4 ? 4 : 3, zSchema, zTabname, zErr);
4026+
p->bFts4 ? 4 : 3, zSchema, zTabname, sqlite3_errstr(rc));
4027+
}else if( bOk==0 ){
4028+
*pzErr = sqlite3_mprintf("malformed inverted index for FTS%d table %s.%s",
4029+
p->bFts4 ? 4 : 3, zSchema, zTabname);
40394030
}
4040-
sqlite3_free(zErr);
4031+
sqlite3Fts3SegmentsClose(p);
40414032
return SQLITE_OK;
40424033
}
40434034

@@ -4068,7 +4059,7 @@ static const sqlite3_module fts3Module = {
40684059
/* xRelease */ fts3ReleaseMethod,
40694060
/* xRollbackTo */ fts3RollbackToMethod,
40704061
/* xShadowName */ fts3ShadowName,
4071-
/* xIntegrity */ fts3Integrity,
4062+
/* xIntegrity */ fts3IntegrityMethod,
40724063
};
40734064

40744065
/*

ext/fts3/fts3Int.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,5 +653,7 @@ int sqlite3FtsUnicodeIsdiacritic(int);
653653

654654
int sqlite3Fts3ExprIterate(Fts3Expr*, int (*x)(Fts3Expr*,int,void*), void*);
655655

656+
int sqlite3Fts3IntegrityCheck(Fts3Table *p, int *pbOk);
657+
656658
#endif /* !SQLITE_CORE || SQLITE_ENABLE_FTS3 */
657659
#endif /* _FTSINT_H */

ext/fts3/fts3_write.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5294,7 +5294,7 @@ static u64 fts3ChecksumIndex(
52945294
** If an error occurs (e.g. an OOM or IO error), return an SQLite error
52955295
** code. The final value of *pbOk is undefined in this case.
52965296
*/
5297-
static int fts3IntegrityCheck(Fts3Table *p, int *pbOk){
5297+
int sqlite3Fts3IntegrityCheck(Fts3Table *p, int *pbOk){
52985298
int rc = SQLITE_OK; /* Return code */
52995299
u64 cksum1 = 0; /* Checksum based on FTS index contents */
53005300
u64 cksum2 = 0; /* Checksum based on %_content contents */
@@ -5372,7 +5372,7 @@ static int fts3IntegrityCheck(Fts3Table *p, int *pbOk){
53725372
sqlite3_finalize(pStmt);
53735373
}
53745374

5375-
*pbOk = (cksum1==cksum2);
5375+
*pbOk = (rc==SQLITE_OK && cksum1==cksum2);
53765376
return rc;
53775377
}
53785378

@@ -5412,7 +5412,7 @@ static int fts3DoIntegrityCheck(
54125412
){
54135413
int rc;
54145414
int bOk = 0;
5415-
rc = fts3IntegrityCheck(p, &bOk);
5415+
rc = sqlite3Fts3IntegrityCheck(p, &bOk);
54165416
if( rc==SQLITE_OK && bOk==0 ) rc = FTS_CORRUPT_VTAB;
54175417
return rc;
54185418
}

ext/fts5/fts5_main.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,27 +2971,21 @@ static int fts5IntegrityMethod(
29712971
char **pzErr /* Write error message here */
29722972
){
29732973
Fts5FullTable *pTab = (Fts5FullTable*)pVtab;
2974-
Fts5Config *pConfig = pTab->p.pConfig;
2975-
char *zSql;
2976-
char *zErr = 0;
29772974
int rc;
2975+
29782976
assert( pzErr!=0 && *pzErr==0 );
29792977
UNUSED_PARAM(isQuick);
2980-
zSql = sqlite3_mprintf(
2981-
"INSERT INTO \"%w\".\"%w\"(\"%w\") VALUES('integrity-check');",
2982-
zSchema, zTabname, pConfig->zName);
2983-
if( zSql==0 ) return SQLITE_NOMEM;
2984-
rc = sqlite3_exec(pConfig->db, zSql, 0, 0, &zErr);
2985-
sqlite3_free(zSql);
2978+
rc = sqlite3Fts5StorageIntegrity(pTab->pStorage, 0);
29862979
if( (rc&0xff)==SQLITE_CORRUPT ){
29872980
*pzErr = sqlite3_mprintf("malformed inverted index for FTS5 table %s.%s",
29882981
zSchema, zTabname);
29892982
}else if( rc!=SQLITE_OK ){
29902983
*pzErr = sqlite3_mprintf("unable to validate the inverted index for"
29912984
" FTS5 table %s.%s: %s",
2992-
zSchema, zTabname, zErr);
2985+
zSchema, zTabname, sqlite3_errstr(rc));
29932986
}
2994-
sqlite3_free(zErr);
2987+
sqlite3Fts5IndexCloseReader(pTab->p.pIndex);
2988+
29952989
return SQLITE_OK;
29962990
}
29972991

ext/fts5/test/fts5integrity.test

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,4 +355,30 @@ do_execsql_test 11.4 {
355355
PRAGMA integrity_check(t2);
356356
} {ok}
357357

358+
#-------------------------------------------------------------------
359+
reset_db
360+
361+
do_execsql_test 12.1 {
362+
CREATE VIRTUAL TABLE x1 USING fts5(a, b);
363+
INSERT INTO x1 VALUES('one', 'two');
364+
INSERT INTO x1 VALUES('three', 'four');
365+
INSERT INTO x1 VALUES('five', 'six');
366+
}
367+
368+
do_execsql_test 12.2 {
369+
PRAGMA integrity_check
370+
} {ok}
371+
372+
db close
373+
sqlite3 db test.db -readonly 1
374+
375+
explain_i {
376+
PRAGMA integrity_check
377+
}
378+
do_execsql_test 12.3 {
379+
PRAGMA integrity_check
380+
} {ok}
381+
382+
383+
358384
finish_test

ext/wasm/GNUmakefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,15 +652,18 @@ $(sqlite3-api-build-version.js): $(bin.version-info) $(MAKEFILE)
652652
########################################################################
653653
# $(sqlite3-license-version.js) contains the license header and
654654
# in-comment build version info.
655+
#
656+
# Maintenance reminder: there are awk binaries out there which do not
657+
# support -e SCRIPT.
655658
$(sqlite3-license-version.js): $(sqlite3.h) $(sqlite3-license-version-header.js) \
656659
$(MAKEFILE)
657660
@echo "Making $@..."; { \
658661
cat $(sqlite3-license-version-header.js); \
659662
echo '/*'; \
660663
echo '** This code was built from sqlite3 version...'; \
661664
echo "**"; \
662-
awk -e '/define SQLITE_VERSION/{$$1=""; print "**" $$0}' \
663-
-e '/define SQLITE_SOURCE_ID/{$$1=""; print "**" $$0}' $(sqlite3.h); \
665+
awk '/define SQLITE_VERSION/{$$1=""; print "**" $$0}' $(sqlite3.h); \
666+
awk '/define SQLITE_SOURCE_ID/{$$1=""; print "**" $$0}' $(sqlite3.h); \
664667
echo "**"; \
665668
echo "** Using the Emscripten SDK version $(emcc.version)."; \
666669
echo '*/'; \

0 commit comments

Comments
 (0)