Skip to content

Commit e62fa49

Browse files
committed
Snapshot of upstream SQLite 3.25.2
1 parent bf3fa86 commit e62fa49

32 files changed

Lines changed: 870 additions & 115 deletions

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.25.0
1+
3.25.2

autoconf/configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ AC_ARG_ENABLE(session, [AS_HELP_STRING(
172172
[--enable-session], [enable the session extension [default=no]])],
173173
[], [])
174174
if test x"$enable_session" = "xyes"; then
175-
BUILD_CFLAGS="$BUILD_CFLAGS-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK"
175+
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK"
176176
fi
177177
#-----------------------------------------------------------------------
178178

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.25.0.
3+
# Generated by GNU Autoconf 2.69 for sqlite 3.25.2.
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.25.0'
730-
PACKAGE_STRING='sqlite 3.25.0'
729+
PACKAGE_VERSION='3.25.2'
730+
PACKAGE_STRING='sqlite 3.25.2'
731731
PACKAGE_BUGREPORT=''
732732
PACKAGE_URL=''
733733

@@ -1466,7 +1466,7 @@ if test "$ac_init_help" = "long"; then
14661466
# Omit some internal or obsolete options to make the list less imposing.
14671467
# This message is too long to be a string in the A/UX 3.1 sh.
14681468
cat <<_ACEOF
1469-
\`configure' configures sqlite 3.25.0 to adapt to many kinds of systems.
1469+
\`configure' configures sqlite 3.25.2 to adapt to many kinds of systems.
14701470
14711471
Usage: $0 [OPTION]... [VAR=VALUE]...
14721472
@@ -1531,7 +1531,7 @@ fi
15311531

15321532
if test -n "$ac_init_help"; then
15331533
case $ac_init_help in
1534-
short | recursive ) echo "Configuration of sqlite 3.25.0:";;
1534+
short | recursive ) echo "Configuration of sqlite 3.25.2:";;
15351535
esac
15361536
cat <<\_ACEOF
15371537
@@ -1657,7 +1657,7 @@ fi
16571657
test -n "$ac_init_help" && exit $ac_status
16581658
if $ac_init_version; then
16591659
cat <<\_ACEOF
1660-
sqlite configure 3.25.0
1660+
sqlite configure 3.25.2
16611661
generated by GNU Autoconf 2.69
16621662
16631663
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2076,7 +2076,7 @@ cat >config.log <<_ACEOF
20762076
This file contains any messages produced by compilers while
20772077
running configure, to aid debugging if configure makes a mistake.
20782078
2079-
It was created by sqlite $as_me 3.25.0, which was
2079+
It was created by sqlite $as_me 3.25.2, which was
20802080
generated by GNU Autoconf 2.69. Invocation command line was
20812081
20822082
$ $0 $@
@@ -12232,7 +12232,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
1223212232
# report actual input values of CONFIG_FILES etc. instead of their
1223312233
# values after options handling.
1223412234
ac_log="
12235-
This file was extended by sqlite $as_me 3.25.0, which was
12235+
This file was extended by sqlite $as_me 3.25.2, which was
1223612236
generated by GNU Autoconf 2.69. Invocation command line was
1223712237
1223812238
CONFIG_FILES = $CONFIG_FILES
@@ -12298,7 +12298,7 @@ _ACEOF
1229812298
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1229912299
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1230012300
ac_cs_version="\\
12301-
sqlite config.status 3.25.0
12301+
sqlite config.status 3.25.2
1230212302
configured by $0, generated by GNU Autoconf 2.69,
1230312303
with options \\"\$ac_cs_config\\"
1230412304

ext/userauth/userauth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ int sqlite3_user_authenticate(
210210
db->auth.nAuthPW = nPW;
211211
rc = sqlite3UserAuthCheckLogin(db, "main", &authLevel);
212212
db->auth.authLevel = authLevel;
213-
sqlite3ExpirePreparedStatements(db);
213+
sqlite3ExpirePreparedStatements(db, 0);
214214
if( rc ){
215215
return rc; /* OOM error, I/O error, etc. */
216216
}

manifest

Lines changed: 36 additions & 34 deletions
Large diffs are not rendered by default.

manifest.uuid

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b63af6c3bd33152742648d5d2e8dc5d5fcbcdd27df409272b6aea00a6f761760
1+
fb90e7189ae6d62e77ba3a308ca5d683f90bbe633cf681865365b8e92792d1c7

src/alter.c

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -169,20 +169,6 @@ void sqlite3AlterRenameTable(
169169
goto exit_rename_table;
170170
}
171171

172-
/* If this is a virtual table, invoke the xRename() function if
173-
** one is defined. The xRename() callback will modify the names
174-
** of any resources used by the v-table implementation (including other
175-
** SQLite tables) that are identified by the name of the virtual table.
176-
*/
177-
#ifndef SQLITE_OMIT_VIRTUALTABLE
178-
if( pVTab ){
179-
int i = ++pParse->nMem;
180-
sqlite3VdbeLoadString(v, i, zName);
181-
sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pVTab, P4_VTAB);
182-
sqlite3MayAbort(pParse);
183-
}
184-
#endif
185-
186172
/* figure out how many UTF-8 characters are in zName */
187173
zTabName = pTab->zName;
188174
nTabName = sqlite3Utf8CharLen(zTabName, -1);
@@ -240,6 +226,20 @@ void sqlite3AlterRenameTable(
240226
, zDb, zTabName, zName, zTabName, zDb, zName);
241227
}
242228

229+
/* If this is a virtual table, invoke the xRename() function if
230+
** one is defined. The xRename() callback will modify the names
231+
** of any resources used by the v-table implementation (including other
232+
** SQLite tables) that are identified by the name of the virtual table.
233+
*/
234+
#ifndef SQLITE_OMIT_VIRTUALTABLE
235+
if( pVTab ){
236+
int i = ++pParse->nMem;
237+
sqlite3VdbeLoadString(v, i, zName);
238+
sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pVTab, P4_VTAB);
239+
sqlite3MayAbort(pParse);
240+
}
241+
#endif
242+
243243
renameReloadSchema(pParse, iDb);
244244
renameTestSchema(pParse, zDb, iDb==1);
245245

@@ -1076,7 +1076,7 @@ static int renameResolveTrigger(Parse *pParse, const char *zDb){
10761076
Table *pTarget = sqlite3LocateTable(pParse, 0, pStep->zTarget, zDb);
10771077
if( pTarget==0 ){
10781078
rc = SQLITE_ERROR;
1079-
}else{
1079+
}else if( SQLITE_OK==(rc = sqlite3ViewGetColumnNames(pParse, pTarget)) ){
10801080
SrcList sSrc;
10811081
memset(&sSrc, 0, sizeof(sSrc));
10821082
sSrc.nSrc = 1;
@@ -1422,17 +1422,20 @@ static void renameTableFunc(
14221422
rc = renameParseSql(&sParse, zDb, 1, db, zInput, bTemp);
14231423

14241424
if( rc==SQLITE_OK ){
1425+
int isLegacy = (db->flags & SQLITE_LegacyAlter);
14251426
if( sParse.pNewTable ){
14261427
Table *pTab = sParse.pNewTable;
14271428

14281429
if( pTab->pSelect ){
1429-
NameContext sNC;
1430-
memset(&sNC, 0, sizeof(sNC));
1431-
sNC.pParse = &sParse;
1432-
1433-
sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC);
1434-
if( sParse.nErr ) rc = sParse.rc;
1435-
sqlite3WalkSelect(&sWalker, pTab->pSelect);
1430+
if( isLegacy==0 ){
1431+
NameContext sNC;
1432+
memset(&sNC, 0, sizeof(sNC));
1433+
sNC.pParse = &sParse;
1434+
1435+
sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC);
1436+
if( sParse.nErr ) rc = sParse.rc;
1437+
sqlite3WalkSelect(&sWalker, pTab->pSelect);
1438+
}
14361439
}else{
14371440
/* Modify any FK definitions to point to the new table. */
14381441
#ifndef SQLITE_OMIT_FOREIGN_KEY
@@ -1451,15 +1454,19 @@ static void renameTableFunc(
14511454
** "CREATE [VIRTUAL] TABLE" bit. */
14521455
if( sqlite3_stricmp(zOld, pTab->zName)==0 ){
14531456
sCtx.pTab = pTab;
1454-
sqlite3WalkExprList(&sWalker, pTab->pCheck);
1457+
if( isLegacy==0 ){
1458+
sqlite3WalkExprList(&sWalker, pTab->pCheck);
1459+
}
14551460
renameTokenFind(&sParse, &sCtx, pTab->zName);
14561461
}
14571462
}
14581463
}
14591464

14601465
else if( sParse.pNewIndex ){
14611466
renameTokenFind(&sParse, &sCtx, sParse.pNewIndex->zName);
1462-
sqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere);
1467+
if( isLegacy==0 ){
1468+
sqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere);
1469+
}
14631470
}
14641471

14651472
#ifndef SQLITE_OMIT_TRIGGER
@@ -1472,12 +1479,14 @@ static void renameTableFunc(
14721479
renameTokenFind(&sParse, &sCtx, sParse.pNewTrigger->table);
14731480
}
14741481

1475-
rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb);
1476-
if( rc==SQLITE_OK ){
1477-
renameWalkTrigger(&sWalker, pTrigger);
1478-
for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){
1479-
if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){
1480-
renameTokenFind(&sParse, &sCtx, pStep->zTarget);
1482+
if( isLegacy==0 ){
1483+
rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb);
1484+
if( rc==SQLITE_OK ){
1485+
renameWalkTrigger(&sWalker, pTrigger);
1486+
for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){
1487+
if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){
1488+
renameTokenFind(&sParse, &sCtx, pStep->zTarget);
1489+
}
14811490
}
14821491
}
14831492
}
@@ -1535,6 +1544,7 @@ static void renameTableTest(
15351544
char const *zDb = (const char*)sqlite3_value_text(argv[0]);
15361545
char const *zInput = (const char*)sqlite3_value_text(argv[1]);
15371546
int bTemp = sqlite3_value_int(argv[4]);
1547+
int isLegacy = (db->flags & SQLITE_LegacyAlter);
15381548

15391549
#ifndef SQLITE_OMIT_AUTHORIZATION
15401550
sqlite3_xauth xAuth = db->xAuth;
@@ -1547,7 +1557,7 @@ static void renameTableTest(
15471557
Parse sParse;
15481558
rc = renameParseSql(&sParse, zDb, 1, db, zInput, bTemp);
15491559
if( rc==SQLITE_OK ){
1550-
if( sParse.pNewTable && sParse.pNewTable->pSelect ){
1560+
if( isLegacy==0 && sParse.pNewTable && sParse.pNewTable->pSelect ){
15511561
NameContext sNC;
15521562
memset(&sNC, 0, sizeof(sNC));
15531563
sNC.pParse = &sParse;
@@ -1556,7 +1566,9 @@ static void renameTableTest(
15561566
}
15571567

15581568
else if( sParse.pNewTrigger ){
1559-
rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb);
1569+
if( isLegacy==0 ){
1570+
rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb);
1571+
}
15601572
if( rc==SQLITE_OK ){
15611573
int i1 = sqlite3SchemaToIndex(db, sParse.pNewTrigger->pTabSchema);
15621574
int i2 = sqlite3FindDbName(db, zDb);

src/build.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,10 +1771,6 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
17711771
}
17721772
}
17731773

1774-
/* The remaining transformations only apply to b-tree tables, not to
1775-
** virtual tables */
1776-
if( IN_DECLARE_VTAB ) return;
1777-
17781774
/* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY
17791775
** into BTREE_BLOBKEY.
17801776
*/
@@ -2287,6 +2283,10 @@ int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
22872283
assert( pTable->pSelect );
22882284
pSel = sqlite3SelectDup(db, pTable->pSelect, 0);
22892285
if( pSel ){
2286+
#ifndef SQLITE_OMIT_ALTERTABLE
2287+
u8 eParseMode = pParse->eParseMode;
2288+
pParse->eParseMode = PARSE_MODE_NORMAL;
2289+
#endif
22902290
n = pParse->nTab;
22912291
sqlite3SrcListAssignCursors(pParse, pSel->pSrc);
22922292
pTable->nCol = -1;
@@ -2332,6 +2332,9 @@ int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
23322332
sqlite3DeleteTable(db, pSelTab);
23332333
sqlite3SelectDelete(db, pSel);
23342334
db->lookaside.bDisable--;
2335+
#ifndef SQLITE_OMIT_ALTERTABLE
2336+
pParse->eParseMode = eParseMode;
2337+
#endif
23352338
} else {
23362339
nErr++;
23372340
}

src/expr.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,17 +1265,14 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){
12651265
}
12661266

12671267
/* Fill in pNew->pLeft and pNew->pRight. */
1268+
zAlloc += dupedExprNodeSize(p, dupFlags);
12681269
if( ExprHasProperty(pNew, EP_Reduced|EP_TokenOnly) ){
1269-
zAlloc += dupedExprNodeSize(p, dupFlags);
12701270
if( !ExprHasProperty(pNew, EP_TokenOnly|EP_Leaf) ){
12711271
pNew->pLeft = p->pLeft ?
12721272
exprDup(db, p->pLeft, EXPRDUP_REDUCE, &zAlloc) : 0;
12731273
pNew->pRight = p->pRight ?
12741274
exprDup(db, p->pRight, EXPRDUP_REDUCE, &zAlloc) : 0;
12751275
}
1276-
if( pzBuffer ){
1277-
*pzBuffer = zAlloc;
1278-
}
12791276
}else{
12801277
#ifndef SQLITE_OMIT_WINDOWFUNC
12811278
if( ExprHasProperty(p, EP_Reduced|EP_TokenOnly) ){
@@ -1295,6 +1292,9 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){
12951292
pNew->pRight = sqlite3ExprDup(db, p->pRight, 0);
12961293
}
12971294
}
1295+
if( pzBuffer ){
1296+
*pzBuffer = zAlloc;
1297+
}
12981298
}
12991299
return pNew;
13001300
}
@@ -4846,18 +4846,15 @@ int sqlite3ExprImpliesExpr(Parse *pParse, Expr *pE1, Expr *pE2, int iTab){
48464846
/*
48474847
** This is the Expr node callback for sqlite3ExprImpliesNotNullRow().
48484848
** If the expression node requires that the table at pWalker->iCur
4849-
** have a non-NULL column, then set pWalker->eCode to 1 and abort.
4849+
** have one or more non-NULL column, then set pWalker->eCode to 1 and abort.
4850+
**
4851+
** This routine controls an optimization. False positives (setting
4852+
** pWalker->eCode to 1 when it should not be) are deadly, but false-negatives
4853+
** (never setting pWalker->eCode) is a harmless missed optimization.
48504854
*/
48514855
static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){
4852-
/* This routine is only called for WHERE clause expressions and so it
4853-
** cannot have any TK_AGG_COLUMN entries because those are only found
4854-
** in HAVING clauses. We can get a TK_AGG_FUNCTION in a WHERE clause,
4855-
** but that is an illegal construct and the query will be rejected at
4856-
** a later stage of processing, so the TK_AGG_FUNCTION case does not
4857-
** need to be considered here. */
4858-
assert( pExpr->op!=TK_AGG_COLUMN );
4856+
testcase( pExpr->op==TK_AGG_COLUMN );
48594857
testcase( pExpr->op==TK_AGG_FUNCTION );
4860-
48614858
if( ExprHasProperty(pExpr, EP_FromJoin) ) return WRC_Prune;
48624859
switch( pExpr->op ){
48634860
case TK_ISNOT:

src/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3021,6 +3021,7 @@ static int openDatabase(
30213021
db->nDb = 2;
30223022
db->magic = SQLITE_MAGIC_BUSY;
30233023
db->aDb = db->aDbStatic;
3024+
db->lookaside.bDisable = 1;
30243025

30253026
assert( sizeof(db->aLimit)==sizeof(aHardLimit) );
30263027
memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit));

0 commit comments

Comments
 (0)