Compare commits

...

46 Commits

Author SHA1 Message Date
drh 5a6f5ede81 Improvement on the previous check-in: disallow automatic indexes for any
loop that is expected to run less than twice.

FossilOrigin-Name: aab53a21894ba51d325fd8f8f4bb4163ece74391
2016-02-25 18:22:09 +00:00
drh 87eb919d05 Do not use an automatic index on an outer loop that only runs once.
FossilOrigin-Name: 5957e793414ff80ed01a7a67e70c3fd096a3f6e0
2016-02-25 18:03:38 +00:00
drh c3489bbf77 Take the LIMIT clause into account when estimating the cost of sorting.
FossilOrigin-Name: d491745cab951e0de70f1f79b7640ea8aff6e8bb
2016-02-25 16:04:59 +00:00
drh d8c22ac655 In the command-line shell: When the ".import" command is creating a new
table using column names from the first row of CSV input, make sure 
double-quotes in the name are properly escaped.

FossilOrigin-Name: 2e67a1c823c7003e7d2619c7d8b6db6ce046c527
2016-02-25 13:33:02 +00:00
dan f769cd61b2 Extend [3e9ed1ae] so that covering indexes on WITHOUT ROWID tables are also identified.
FossilOrigin-Name: e721975faa0925be4029330550ff2a9666041ff7
2016-02-24 20:16:28 +00:00
drh 6ad224e91e Change a char* to const char* in order to suppress some harmless
compiler warnings.

FossilOrigin-Name: 56f62e34ae9d5c7db07367f0007df258b2e76bd2
2016-02-24 19:57:11 +00:00
drh 87993148bd When an index complete covers a table, it can be used as a covering index
even if columns past the 63rd column are indexed and accessed.

FossilOrigin-Name: 3e9ed1aea43e8ce2eb74bb845ea2c05b5882e36e
2016-02-24 17:18:51 +00:00
dan a73086dd9e Fix a problem with handling identifiers that start with "x" if SQLITE_OMIT_BLOB_LITERAL is defined.
FossilOrigin-Name: b65217c69c59cbe9cd1494e2eb42ecf22c336399
2016-02-24 16:14:07 +00:00
drh e1dd060898 Identify indexes that complete cover their table.
FossilOrigin-Name: 71d488b599cbde817de369efac4412569a55b43d
2016-02-24 15:43:05 +00:00
drh 0e0089679f Add the SQLITE_BITMASK_TYPE compile-time option.
FossilOrigin-Name: 0064a8c77b2b048c71277d1cfd1ba3975b513b70
2016-02-23 16:28:34 +00:00
drh b052958657 Remove code not needed now that synchronous=OFF database files no longer
trigger the use of a master journal.

FossilOrigin-Name: aa9f4c622af191edbeb6a535942944f8c91f5c37
2016-02-22 23:44:42 +00:00
drh 600e888454 Avoid an unnecessary seek operation some corner-case skip-scan operations.
FossilOrigin-Name: 2a6003a937a210dfc279e393d3a0b49d1f3ac92e
2016-02-22 23:14:11 +00:00
drh 0bf2ad6a18 Clearer presentation of the logic. No functional changes.
FossilOrigin-Name: a3dcf6db76cc09bdfedb1bbeba3b359b77762cbe
2016-02-22 21:19:54 +00:00
drh a6d2f8eb1e Avoid an unnecessary seek operation on some corner-case skip-scans.
FossilOrigin-Name: 38e837e605076124b73235e1fd832838d9545cb2
2016-02-22 20:52:26 +00:00
drh b9626cfa70 Always use the sqlite3VdbeDeleteAuxdata() routine for clearing auxdata on
function parameter, rather than having a separate deleteAuxdataFromFrame()
for doing the job for trigger frames.

FossilOrigin-Name: 64386fa339adb91439da979d74062f67a6ec68fd
2016-02-22 16:04:31 +00:00
drh 8e6cf0a7c5 Avoid creating a master journal unless two or more databases in the
transaction can actually benefit from that master journal.

FossilOrigin-Name: 3ed1890612bd45bd9c72f670d2cbb0b8fbd35d92
2016-02-22 14:57:38 +00:00
drh e872d5133d Change magic numbers associated with synchronous settings to named constants.
FossilOrigin-Name: 9230ba6c01f4a550d92a0cbbf36dbe81af14fbfc
2016-02-22 13:23:16 +00:00
dan 748e5cd6f9 Add an extra test case for the change in commit [c4295725].
FossilOrigin-Name: a48ac4c347813bd2b416b1cb06c3cbf1f4b3781a
2016-02-22 09:45:27 +00:00
mistachkin d149ea3a3a Further enhancements to the MSVC batch build tool.
FossilOrigin-Name: 06f1495f4b7465e3992f524f56d97847643a9895
2016-02-19 19:46:58 +00:00
mistachkin c03c2cf8b3 Use the arguments to NMAKE consistently in the MSVC batch build tool.
FossilOrigin-Name: 480e5049486b8b047f533d78b040daa47dd6b946
2016-02-19 19:29:44 +00:00
mistachkin 56362a5ab7 Enhance clean target in the MSVC makefiles.
FossilOrigin-Name: 66a9ad4a6df513f4c35c3d337d4e2e80cd38d586
2016-02-19 19:03:04 +00:00
dan 3200132add Use a separate list of aux-data structures for each trigger program at the VDBE level. Fix for [dc9b1c91].
FossilOrigin-Name: c4295725015d394f01b8563f47236e0890f1cc0d
2016-02-19 18:54:29 +00:00
drh b719e3a747 Enhance speedtest1 to display the particular version of SQLite under test.
FossilOrigin-Name: 0cb728c15c66f1bf09cc1e0731a95ba937c6c71c
2016-02-19 16:19:23 +00:00
drh e1ee002891 Fix a couple of harmless warnings generated by clang.
FossilOrigin-Name: a1a3ff1f53145c5a9fbf29398cf4a453729e71f0
2016-02-19 15:17:53 +00:00
drh b1f4efd20b Fix a harmless uninitialized variable access.
FossilOrigin-Name: 398522e686b34e7f82a62e62d8b0a0ea924de064
2016-02-19 14:20:46 +00:00
drh 81fd3497f4 Make sure WhereClause objects are fully initialized before use when
planning OR queries.

FossilOrigin-Name: 162053021795ff40c447498a76de4d31d58aa808
2016-02-19 14:10:44 +00:00
drh 9a1e85ee2e Fix (harmless) compiler warnings in some of the TCL-based test code.
FossilOrigin-Name: 7c26d2b47025edaa289bd4a383b5c1536482ec11
2016-02-19 13:29:52 +00:00
drh 469753d949 Add an SQLITE_DISABLE_INTRINSIC #ifdef to the sqlite3Put4Byte() function.
FossilOrigin-Name: ba9c6827d0890aaed9168c221fefbdbe89f4f9d3
2016-02-19 13:20:02 +00:00
drh 51381c208e Omit the unused yyzerominor constant.
FossilOrigin-Name: 60ad68a9f569d2446d76a6453be4fa1c4ed2cd93
2016-02-19 13:19:22 +00:00
dan 92b859292d Add an "#ifndef SQLITE_AMALGAMATION" guard around a typedef in fts5_test_mi.c to avoid redefining "u32" if it is compiled as part of the amalgamation.
FossilOrigin-Name: f9c49ba1edf13cb8c48d73f1b2e3f80c46b3c030
2016-02-19 10:18:36 +00:00
mistachkin b0c99afeda Modify the MSVC batch build tool to support the MSVC autoconf Makefile.
FossilOrigin-Name: 72b10e5e7d2db436c7b03cc3735a2e9d0e53ab5d
2016-02-19 05:07:56 +00:00
mistachkin 9751730f83 Further improvements to the MSVC batch build tool.
FossilOrigin-Name: b9626b5954068ae2e7733dd14f906a1f6d7090a5
2016-02-19 00:48:23 +00:00
mistachkin b9076ba4c9 Further improvements to the MSVC batch build tool.
FossilOrigin-Name: 90dd6eb1fec22460473d670519d0e730bb37067d
2016-02-19 00:47:18 +00:00
mistachkin d8945d1707 Correct the install location for the UWP VSIX package.
FossilOrigin-Name: f74de325ffb01a1ca8ddd4f011188e38296c3402
2016-02-18 21:15:12 +00:00
mistachkin 45dc877f76 Correct the install location for the UWP VSIX package.
FossilOrigin-Name: b47d03027e973e3c8d77246a2d2100881f6a9bd2
2016-02-18 21:00:29 +00:00
drh b2bddbbc2d Avoid a potential buffer overrun if an SQL statement being parsed ends
with an illegal "!" token.  (This problem was detected by fuzzcheck
running under valgrind. The problem was introduced by check-in [9570b6b43df3].)

FossilOrigin-Name: 2a8d97e7c8976df0312e1294e8c1da8b15686654
2016-02-18 14:49:28 +00:00
drh 4c9d22819f Improved handling of the -v option on the fuzzcheck test program.
FossilOrigin-Name: c8cd7804dc905b2b20cd7c0192bcfaceaaa7e2a8
2016-02-18 14:03:15 +00:00
dan a0c2d3c155 Remove an unnecessary "include <tcl.h>" line from fts5_test_mi.c.
FossilOrigin-Name: 31d8b69e9e0747e573516570bfe2770384e99134
2016-02-18 13:32:34 +00:00
drh 5b081d8a28 Add extra API armor on the sqlite3_bind_blob() interface.
FossilOrigin-Name: 80de1ad5eb4c3839756b6467d5b8195b4abfb1f8
2016-02-18 01:29:12 +00:00
drh 7f149e5173 When VDBE opcodes fail, they cause an immediate exit from the loop, rather
than depending on the rc==SQLITE_OK test at the top of the loop.  This is
faster and smaller.

FossilOrigin-Name: 24c7151c1aabeaffcb8bb5836404e70a3ec4681b
2016-02-17 20:47:24 +00:00
drh 9467abf3dd Fix up all VDBE opcodes so that they cause an immediate exit on any kind of
error, and thereby eliminate the need to test "rc" at the top of the loop.
Resulting code is a little smaller and faster.

FossilOrigin-Name: a444633a827642bcf4d02a461e7e5f66769d39fd
2016-02-17 18:44:11 +00:00
drh b5a55ce77d Bump the version number to 3.12.0.
FossilOrigin-Name: c17d7276b8c114df5fe6e9ea14d59758443c281b
2016-02-17 15:01:18 +00:00
dan 5e29f38d2c Remove the "#ifdef SQLITE_TEST" condition from fts5_test_mi.c. Update fts5_main.c so that if SQLITE_FTS5_TEST_MI is defined when it is built the fts5_test_mi.c entry point is automatically called. This makes it easier to build versions of fts5 that include the matchinfo() demo by default.
FossilOrigin-Name: 87e6e225aea3a4d10476d16eab4a6403a4a128c9
2016-02-17 14:48:26 +00:00
dan 87d6b35541 Improve test coverage of demo code in fts5_test_mi.c.
FossilOrigin-Name: 8a78050dc0e374a0df0f29716df60250e2c4b4f7
2016-02-17 14:11:06 +00:00
drh b7997fe3a9 Enhance Lemon to generate more compact and efficient code for yy_reduce().
Update the main SQL grammar to take advantage of the new capabilities.

FossilOrigin-Name: 53fd040c98d9647ea135d43c493777bf8da4aebd
2016-02-17 13:24:12 +00:00
drh 0ccbc64fd6 Documentation typo on sqlite3_wal_hook(). No changes to code.
FossilOrigin-Name: fc2043ebaa3f106529500164936bb82f9b921b1c
2016-02-17 11:13:20 +00:00
50 changed files with 888 additions and 367 deletions
+19 -12
View File
@@ -219,27 +219,43 @@ SQLITE3H = sqlite3.h
# This is the name to use for the SQLite dynamic link library (DLL).
#
!IFNDEF SQLITE3DLL
!IF $(FOR_WIN10)!=0
SQLITE3DLL = winsqlite3.dll
!ELSE
SQLITE3DLL = sqlite3.dll
!ENDIF
!ENDIF
# This is the name to use for the SQLite import library (LIB).
#
!IFNDEF SQLITE3LIB
!IF $(FOR_WIN10)!=0
SQLITE3LIB = winsqlite3.lib
!ELSE
SQLITE3LIB = sqlite3.lib
!ENDIF
!ENDIF
# This is the name to use for the SQLite shell executable (EXE).
#
!IFNDEF SQLITE3EXE
!IF $(FOR_WIN10)!=0
SQLITE3EXE = winsqlite3shell.exe
!ELSE
SQLITE3EXE = sqlite3.exe
!ENDIF
!ENDIF
# This is the argument used to set the program database (PDB) file for the
# SQLite shell executable (EXE).
#
!IFNDEF SQLITE3EXEPDB
!IF $(FOR_WIN10)!=0
SQLITE3EXEPDB =
!ELSE
SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
!ENDIF
!ENDIF
# These are the "standard" SQLite compilation options used when compiling for
# the Windows platform.
@@ -417,15 +433,6 @@ TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS)
TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src -fp:precise
RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src $(RCOPTS) $(RCCOPTS)
# Adjust the names of the primary targets for use with Windows 10.
#
!IF $(FOR_WIN10)!=0
SQLITE3DLL = winsqlite3.dll
SQLITE3LIB = winsqlite3.lib
SQLITE3EXE = winsqlite3shell.exe
SQLITE3EXEPDB =
!ENDIF
# Check if we want to use the "stdcall" calling convention when compiling.
# This is not supported by the compilers for non-x86 platforms. It should
# also be noted here that building any target with these "stdcall" options
@@ -1386,10 +1393,10 @@ dll: $(SQLITE3DLL)
#
shell: $(SQLITE3EXE)
# <<mark>>
libsqlite3.lib: $(LIBOBJ)
$(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS)
# <<mark>>
libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib
$(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCLSTUB) $(TLIBS)
# <</mark>>
@@ -2025,7 +2032,8 @@ rbu.exe: $(TOP)\ext\rbu\rbu.c $(TOP)\ext\rbu\sqlite3rbu.c $(SQLITE3C) $(SQLITE3H
clean:
del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
del /Q $(SQLITE3EXE) $(SQLITE3DLL) 2>NUL
# <<mark>>
del /Q $(SQLITE3C) $(SQLITE3H) opcodes.c opcodes.h 2>NUL
del /Q lemon.* lempar.c parse.* 2>NUL
@@ -2044,7 +2052,6 @@ clean:
del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe 2>NUL
del /Q showjournal.exe showstat4.exe showwal.exe speedtest1.exe 2>NUL
del /Q mptester.exe wordcount.exe rbu.exe srcck1.exe 2>NUL
del /Q $(SQLITE3EXE) $(SQLITE3DLL) sqlite3.def 2>NUL
del /Q sqlite3.c sqlite3-*.c 2>NUL
del /Q sqlite3rc.h 2>NUL
del /Q shell.c sqlite3ext.h 2>NUL
+1 -1
View File
@@ -1 +1 @@
3.11.0
3.12.0
+19 -14
View File
@@ -204,27 +204,43 @@ SQLITE3H = sqlite3.h
# This is the name to use for the SQLite dynamic link library (DLL).
#
!IFNDEF SQLITE3DLL
!IF $(FOR_WIN10)!=0
SQLITE3DLL = winsqlite3.dll
!ELSE
SQLITE3DLL = sqlite3.dll
!ENDIF
!ENDIF
# This is the name to use for the SQLite import library (LIB).
#
!IFNDEF SQLITE3LIB
!IF $(FOR_WIN10)!=0
SQLITE3LIB = winsqlite3.lib
!ELSE
SQLITE3LIB = sqlite3.lib
!ENDIF
!ENDIF
# This is the name to use for the SQLite shell executable (EXE).
#
!IFNDEF SQLITE3EXE
!IF $(FOR_WIN10)!=0
SQLITE3EXE = winsqlite3shell.exe
!ELSE
SQLITE3EXE = sqlite3.exe
!ENDIF
!ENDIF
# This is the argument used to set the program database (PDB) file for the
# SQLite shell executable (EXE).
#
!IFNDEF SQLITE3EXEPDB
!IF $(FOR_WIN10)!=0
SQLITE3EXEPDB =
!ELSE
SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
!ENDIF
!ENDIF
# These are the "standard" SQLite compilation options used when compiling for
# the Windows platform.
@@ -402,15 +418,6 @@ TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS)
TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -fp:precise
RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS)
# Adjust the names of the primary targets for use with Windows 10.
#
!IF $(FOR_WIN10)!=0
SQLITE3DLL = winsqlite3.dll
SQLITE3LIB = winsqlite3.lib
SQLITE3EXE = winsqlite3shell.exe
SQLITE3EXEPDB =
!ENDIF
# Check if we want to use the "stdcall" calling convention when compiling.
# This is not supported by the compilers for non-x86 platforms. It should
# also be noted here that building any target with these "stdcall" options
@@ -863,7 +870,7 @@ SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_
# This is the default Makefile target. The objects listed here
# are what get build when you type just "make" with no arguments.
#
all: dll libsqlite3.lib shell
all: dll shell
# Dynamic link library section.
#
@@ -873,9 +880,6 @@ dll: $(SQLITE3DLL)
#
shell: $(SQLITE3EXE)
libsqlite3.lib: $(LIBOBJ)
$(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS)
$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
@@ -918,4 +922,5 @@ $(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H)
clean:
del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
del /Q $(SQLITE3EXE) $(SQLITE3DLL) 2>NUL
Vendored
+9 -9
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for sqlite 3.11.0.
# Generated by GNU Autoconf 2.69 for sqlite 3.12.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -726,8 +726,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='sqlite'
PACKAGE_TARNAME='sqlite'
PACKAGE_VERSION='3.11.0'
PACKAGE_STRING='sqlite 3.11.0'
PACKAGE_VERSION='3.12.0'
PACKAGE_STRING='sqlite 3.12.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1460,7 +1460,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures sqlite 3.11.0 to adapt to many kinds of systems.
\`configure' configures sqlite 3.12.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1525,7 +1525,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of sqlite 3.11.0:";;
short | recursive ) echo "Configuration of sqlite 3.12.0:";;
esac
cat <<\_ACEOF
@@ -1646,7 +1646,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
sqlite configure 3.11.0
sqlite configure 3.12.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2065,7 +2065,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by sqlite $as_me 3.11.0, which was
It was created by sqlite $as_me 3.12.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -12079,7 +12079,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by sqlite $as_me 3.11.0, which was
This file was extended by sqlite $as_me 3.12.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -12145,7 +12145,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
sqlite config.status 3.11.0
sqlite config.status 3.12.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
+2 -1
View File
@@ -526,7 +526,8 @@ static int fts3_test_varint_cmd(
#ifdef SQLITE_ENABLE_FTS3
char aBuf[24];
int rc;
Tcl_WideInt w, w2;
Tcl_WideInt w;
sqlite3_int64 w2;
int nByte, nByte2;
if( objc!=2 ){
+11
View File
@@ -2665,6 +2665,17 @@ static int fts5Init(sqlite3 *db){
);
}
}
/* If SQLITE_FTS5_ENABLE_TEST_MI is defined, assume that the file
** fts5_test_mi.c is compiled and linked into the executable. And call
** its entry point to enable the matchinfo() demo. */
#ifdef SQLITE_FTS5_ENABLE_TEST_MI
if( rc==SQLITE_OK ){
extern int sqlite3Fts5TestRegisterMatchinfo(sqlite3*);
rc = sqlite3Fts5TestRegisterMatchinfo(db);
}
#endif
return rc;
}
+5 -9
View File
@@ -41,16 +41,17 @@
*/
#ifdef SQLITE_TEST
#ifdef SQLITE_ENABLE_FTS5
#include "fts5.h"
#include <tcl.h>
#include <assert.h>
#include <string.h>
typedef struct Fts5MatchinfoCtx Fts5MatchinfoCtx;
#ifndef SQLITE_AMALGAMATION
typedef unsigned int u32;
#endif
struct Fts5MatchinfoCtx {
int nCol; /* Number of cols in FTS5 table */
@@ -244,11 +245,7 @@ static int fts5MatchinfoLocalCb(
iOff>=0;
pApi->xPhraseNext(pFts, &iter, &iCol, &iOff)
){
if( f=='b' ){
aOut[iPhrase * ((p->nCol+31)/32) + iCol/32] |= ((u32)1 << iCol%32);
}else{
aOut[nMul * (iCol + iPhrase * p->nCol)]++;
}
aOut[nMul * (iCol + iPhrase * p->nCol)]++;
}
}
@@ -409,7 +406,7 @@ int sqlite3Fts5TestRegisterMatchinfo(sqlite3 *db){
**
** Also check that the fts5_api object is version 2 or newer.
*/
if( pApi==0 || pApi->iVersion<1 ){
if( pApi==0 || pApi->iVersion<2 ){
return SQLITE_ERROR;
}
@@ -420,5 +417,4 @@ int sqlite3Fts5TestRegisterMatchinfo(sqlite3 *db){
}
#endif /* SQLITE_ENABLE_FTS5 */
#endif /* SQLITE_TEST */
+83
View File
@@ -0,0 +1,83 @@
# 2016 February 17
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#*************************************************************************
#
# This file is focused on OOM errors.
#
source [file join [file dirname [info script]] fts5_common.tcl]
source $testdir/malloc_common.tcl
set testprefix fts5faultB
# If SQLITE_ENABLE_FTS3 is defined, omit this file.
ifcapable !fts5 {
finish_test
return
}
proc mit {blob} {
set scan(littleEndian) i*
set scan(bigEndian) I*
binary scan $blob $scan($::tcl_platform(byteOrder)) r
return $r
}
db func mit mit
#-------------------------------------------------------------------------
# Errors while registering the matchinfo() demo function.
#
do_faultsim_test 1 -faults oom* -prep {
sqlite3 db test.db
} -body {
sqlite3_fts5_register_matchinfo db
} -test {
faultsim_test_result {0 {}} {1 SQLITE_ERROR} {1 SQLITE_NOMEM}
}
#-------------------------------------------------------------------------
# Errors while executing the matchinfo() demo function.
#
reset_db
sqlite3_fts5_register_matchinfo db
db func mit mit
do_execsql_test 2 {
CREATE VIRTUAL TABLE t1 USING fts5(a, b);
INSERT INTO t1 VALUES('x y z', '1 2 3');
INSERT INTO t1 VALUES('x', '1 2 3 4 5 6 7');
}
do_faultsim_test 2.1 -faults oom* -body {
execsql { SELECT mit(matchinfo(t1, 'a')) FROM t1('x') }
} -test {
faultsim_test_result {0 {{2 5} {2 5}}}
}
do_faultsim_test 2.2 -faults oom* -body {
execsql { SELECT mit(matchinfo(t1, 'l')) FROM t1('x') }
} -test {
faultsim_test_result {0 {{3 3} {1 7}}}
}
do_execsql_test 2.3 {
INSERT INTO t1 VALUES('a b c d e f', 'a b d e f c');
INSERT INTO t1 VALUES('l m b c a', 'n o a b c z');
}
do_faultsim_test 2.4 -faults oom* -body {
execsql { SELECT mit(matchinfo(t1, 's')) FROM t1('a b c') }
} -test {
faultsim_test_result {0 {{3 2} {2 3}}}
}
finish_test
+24
View File
@@ -467,5 +467,29 @@ do_execsql_test 12.1 {
} ;# foreach_detail_mode
#-------------------------------------------------------------------------
# Test that a bad fts5() return is detected
#
reset_db
proc xyz {} {}
db func fts5 -argcount 0 xyz
do_test 13.1 {
list [catch { sqlite3_fts5_register_matchinfo db } msg] $msg
} {1 SQLITE_ERROR}
#-------------------------------------------------------------------------
# Test that an invalid matchinfo() flag is detected
#
reset_db
sqlite3_fts5_register_matchinfo db
do_execsql_test 14.1 {
CREATE VIRTUAL TABLE x1 USING fts5(z);
INSERT INTO x1 VALUES('a b c a b c a b c');
} {}
do_catchsql_test 14.2 {
SELECT matchinfo(x1, 'd') FROM x1('a b c');
} {1 {unrecognized matchinfo flag: d}}
finish_test
+1 -1
View File
@@ -3704,7 +3704,7 @@ static int rbuVfsShmUnmap(sqlite3_file *pFile, int delFlag){
static rbu_file *rbuFindMaindb(rbu_vfs *pRbuVfs, const char *zWal){
rbu_file *pDb;
sqlite3_mutex_enter(pRbuVfs->mutex);
for(pDb=pRbuVfs->pMain; pDb && pDb->zWal!=zWal; pDb=pDb->pMainNext);
for(pDb=pRbuVfs->pMain; pDb && pDb->zWal!=zWal; pDb=pDb->pMainNext){}
sqlite3_mutex_leave(pRbuVfs->mutex);
return pDb;
}
+53 -51
View File
@@ -1,17 +1,17 @@
C More\sagressive\suse\sof\s/*A-overwrites-X*/\sin\sthe\sparser.\s\sFix\san\soff-by-one\nerror\sin\sparser\sstack\soverflow\sdetection.
D 2016-02-17T12:34:03.961
C Improvement\son\sthe\sprevious\scheck-in:\s\sdisallow\sautomatic\sindexes\sfor\sany\nloop\sthat\sis\sexpected\sto\srun\sless\sthan\stwice.
D 2016-02-25T18:22:09.962
F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 30f075dc4f27a07abb76088946b2944178d85347
F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4
F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
F VERSION 866588d1edf0ccb5b0d33896974338f97564f719
F VERSION c6b1f51809551d60ad001e6d87cf3ab2c7f54b6f
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
F autoconf/Makefile.am 29e2a6e8d0c5e32723a48b4faf6b168854dde5f4
F autoconf/Makefile.msc b865d2c72cf43cbf39913336415556af8ff2e819
F autoconf/Makefile.msc d5ab32cf30d6ba8b5ce20835b4042f6cc2a4cb39
F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7
F autoconf/README.txt 7c31da66232f7590bb987cfcd4e2381744b25d24
F autoconf/configure.ac 72a5e42beb090b32bca580285dc0ab3c4670adb8
@@ -30,7 +30,7 @@ F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63
F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977
F config.h.in 42b71ad3fe21c9e88fa59e8458ca1a6bc72eb0c0
F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55
F configure 12d96e3798e612e0ffa53a7a8c4d7fb1090df80e x
F configure 0339a635cd2943a3b56000a10a11b4b2e6ed6d1b x
F configure.ac a2224b1162f79848982d3618ac1deffcd94e88ec
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/lemon.html c30255bea0fd87a81f082d17a72c9dffbc3f6dd9
@@ -81,7 +81,7 @@ F ext/fts3/fts3_icu.c deb46f7020d87ea7a14a433fb7a7f4bef42a9652
F ext/fts3/fts3_porter.c 3565faf04b626cddf85f03825e86056a4562c009
F ext/fts3/fts3_snippet.c 68ae118b0f834ea53d2b89e4087fc0f0b8c4ee4e
F ext/fts3/fts3_term.c 88c55a6fa1a51ab494e33dced0401a6c28791fd7
F ext/fts3/fts3_test.c 8a3a78c4458b2d7c631fcf4b152a5cd656fa7038
F ext/fts3/fts3_test.c 11e36437b0f3f2266acea5b4787f615e4337a237
F ext/fts3/fts3_tokenize_vtab.c a27593ab19657166f6fa5ec073b678cc29a75860
F ext/fts3/fts3_tokenizer.c 4bd72f767f61c9ce5a7575c844e8d1ed2c3c561a
F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
@@ -105,10 +105,10 @@ F ext/fts5/fts5_config.c 35c5173cae4eb17e82164a7f5aeef56a48903079
F ext/fts5/fts5_expr.c 8e8e4635f655133eb39018072fc0f0942a2c4337
F ext/fts5/fts5_hash.c f3a7217c86eb8f272871be5f6aa1b6798960a337
F ext/fts5/fts5_index.c 78069efb54559a17c35906a741362d0b5c899bd0
F ext/fts5/fts5_main.c 0e01ead4e817483e378e7e38e6d902f50b68d29e
F ext/fts5/fts5_main.c db24ac714c6c4a1b3c24a1f8c25889f2952148c1
F ext/fts5/fts5_storage.c f8343db90d8c95a4d4b52f6676e354b4649ffd6e
F ext/fts5/fts5_tcl.c f8731e0508299bd43f1a2eff7dbeaac870768966
F ext/fts5/fts5_test_mi.c 1ec66ffdf7632077fbd773b7a6df5153272ec070
F ext/fts5/fts5_test_mi.c b8d04816428202b2898d4ca38deb1739ac0110ae
F ext/fts5/fts5_test_tok.c db08af63673c3a7d39f053b36fd6e065017706be
F ext/fts5/fts5_tokenize.c 2ce7b44183538ec46b7907726262ee43ffdd39a8
F ext/fts5/fts5_unicode2.c b450b209b157d598f7b9df9f837afb75a14c24bf
@@ -157,10 +157,11 @@ F ext/fts5/test/fts5fault7.test cb14ea3c1f42394f06f2284abc58eecee6ff8080
F ext/fts5/test/fts5fault8.test 430837fe6dd0511fd3aea52bd602ac02441bcb58
F ext/fts5/test/fts5fault9.test e10e395428a9ea0596ebe752ff7123d16ab78e08
F ext/fts5/test/fts5faultA.test fa5d59c0ff62b7125cd14eee38ded1c46e15a7ea
F ext/fts5/test/fts5faultB.test 92ae906284062bf081b6c854afa54dcb1aa9ef88
F ext/fts5/test/fts5full.test 6f6143af0c6700501d9fd597189dfab1555bb741
F ext/fts5/test/fts5hash.test 06f9309ccb4d5050a131594e9e47d0b21456837d
F ext/fts5/test/fts5integrity.test f5e4f8d284385875068ad0f3e894ce43e9de835d
F ext/fts5/test/fts5matchinfo.test 86569026d20f1ed748236587ce798de8a96615f1
F ext/fts5/test/fts5matchinfo.test f7dde99697bcb310ea8faa8eb2714d9f4dfc0e1b
F ext/fts5/test/fts5merge.test 8f3cdba2ec9c5e7e568246e81b700ad37f764367
F ext/fts5/test/fts5merge2.test c0cb66eb38a41c26cc5848fb9e50093e0f59ac93
F ext/fts5/test/fts5near.test b214cddb1c1f1bddf45c75af768f20145f7e71cc
@@ -240,7 +241,7 @@ F ext/rbu/rbufault.test cc0be8d5d392d98b0c2d6a51be377ea989250a89
F ext/rbu/rbufault2.test 9a7f19edd6ea35c4c9f807d8a3db0a03a5670c06
F ext/rbu/rbufts.test 828cd689da825f0a7b7c53ffc1f6f7fdb6fa5bda
F ext/rbu/rbusave.test 0f43b6686084f426ddd040b878426452fd2c2f48
F ext/rbu/sqlite3rbu.c bea954197524631f2691ec272e8a42df8cad01cc
F ext/rbu/sqlite3rbu.c 371e8bf06cfb3f691adac47eb15ab1073ed92dcf
F ext/rbu/sqlite3rbu.h 0bdeb3be211aaba7d85445fa36f4701a25a3dbde
F ext/rbu/test_rbu.c 4a4cdcef4ef9379fc2a21f008805c80b27bcf573
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
@@ -291,11 +292,11 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240
F src/backup.c f60f0aa55d25d853ffde53d0b0370a7bb7ee41ce
F src/bitvec.c 3ee4c8b2c94ed3a7377256e18199e6ff5cf33f63
F src/btmutex.c bc87dd3b062cc26edfe79918de2200ccb8d41e73
F src/btree.c 474ad91c1684e9053da64fa88747a1cb0c10d034
F src/btree.h 368ceeb4bd9312dc8df2ffd64b4b7dbcf4db5f8e
F src/btree.c 7bb920c473c277380fcb3e8a8ee28ce1a48e0abc
F src/btree.h a5008b9afe56e8e54ade6c436a910f112defcca9
F src/btreeInt.h c18b7d2a3494695133e4e60ee36061d37f45d9a5
F src/build.c 88f185a37d1e087818fd7077d84d65c5babefdb1
F src/callback.c 0643b8fb06c95a8977beb201b268210d4b131a22
F src/build.c 6661513c8f90a23d44ed5e5ada7ea40fac6b6b77
F src/callback.c 2e76147783386374bf01b227f752c81ec872d730
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 60e135af364d777a9ab41c97e5e89cd224da6198
F src/date.c 0b73e681c11fca867fec554750c07fe0d4e417c1
@@ -313,7 +314,7 @@ F src/insert.c 9ca97272e9f74ed0efddf3b4350ee12740cebbef
F src/journal.c fe3a3e2559ce3ce9d371afd30fbabbc074174575
F src/legacy.c 75d3023be8f0d2b99d60f905090341a03358c58e
F src/loadext.c 9e2a41adcaff16ebc1ebff1f336cbf33de55396f
F src/main.c 8d2fd210bfbf2f28becb9452641c5689760a68d4
F src/main.c d7415cd68121ef24c2e76b9e81ec96ffc90e6517
F src/malloc.c 1443d1ad95d67c21d77af7ae3f44678252f0efec
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 6919bcf12f221868ea066eec27e579fed95ce98b
@@ -335,8 +336,8 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
F src/os_unix.c 3a6f20736dfb8a0949cdd66553fdf59f6604be35
F src/os_win.c f0d7aa603eb6262143d7169a222aea07c4fca91d
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
F src/pager.c 6812f3803951774b56abded396171e1c12b0b003
F src/pager.h f3eb324a3ff2408b28bab7e81c1c55c13720f865
F src/pager.c d034c69b958c01289eb8070cbf902e1a68cd7e0b
F src/pager.h e1d38a2f14849e219df0f91f8323504d134c8a56
F src/parse.y c3ce2c4a7cbf0b699239be6b2a945c5cb51875e2
F src/pcache.c 647bb53a86b7bbcf55ad88089b3ea5a9170b90df
F src/pcache.h 4d0ccaad264d360981ec5e6a2b596d6e85242545
@@ -348,17 +349,17 @@ F src/printf.c 63e6fb12bbe702dd664dc3703776c090383a5a26
F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
F src/resolve.c b8f7174e5f8c33c44ded3a25a973d0bb89228c20
F src/rowset.c 9fe4b3ad7cc00944386bb600233d8f523de07a6e
F src/select.c 1a7e23a3bb2edb9cdc46ab0cf7c1500109cf2531
F src/shell.c 0367440658104bf2ce8d8a9a5a713a4b11c9acbe
F src/sqlite.h.in f80c6ebd85588fc514bfedf3ecb00cec269cb410
F src/select.c dbc73a63bee99bf7cfac6052477ffc21e899bb08
F src/shell.c 89b73e894e737cc2f21e4bce0feb3ea21cc61124
F src/sqlite.h.in a7caa805a345d6a14136c11ccfa6f4c1a6ef6e7b
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d
F src/sqliteInt.h 47f61c35d587d38cbcfc8ba852ff441054d697d3
F src/sqliteInt.h 5a87bccd05996f4c3facd8f831cf92a05b818b6f
F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba
F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9
F src/tclsqlite.c 13debcc6a5ca1217486f8903768c01114fbe8b58
F src/test1.c 4f1b42699068b7806af3111786f5ad760c2c1ff7
F src/test1.c 8b17b1ff53aad71e7f9318a2fda247beddeaa601
F src/test2.c 5586f43fcd9a1be0830793cf9d354082c261b25b
F src/test3.c a8887dabbbee3059af338f20d290084a63ed1b0f
F src/test4.c d168f83cc78d02e8d35567bb5630e40dcd85ac1e
@@ -370,7 +371,7 @@ F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60
F src/test_async.c 21e11293a2f72080eda70e1124e9102044531cd8
F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12
F src/test_backup.c 2e6e6a081870150f20c526a2e9d0d29cda47d803
F src/test_blob.c e5a7a81d61a780da79101aeb1e60d300af169e07
F src/test_blob.c b2551a9b5573232db5f66f292307c37067937239
F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f
F src/test_config.c 7985332c806d1cece793475c75a6abcccde9d331
F src/test_demovfs.c 0de72c2c89551629f58486fde5734b7d90758852
@@ -406,31 +407,31 @@ F src/test_windirent.c 8f5fada630348558d5745b334702f301da1ffc61
F src/test_windirent.h b12055cab6227f7be10f5c19296f67c60cc5e2a5
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
F src/tokenize.c 32aeca12f0d57a5c1c9a88d63e46ed2ee795cdb4
F src/treeview.c dc39ccf04e9331237388b9cb73289c9d87ea050b
F src/tokenize.c 3d338cdd00d916ce8a05c397001d64ed58e6fe1c
F src/treeview.c c525282442111b3f61eb176784567cd6654db5dc
F src/trigger.c e14840ee0c3e549e758ec9bf3e4146e166002280
F src/update.c a7eeeaffad59c6506f01303a071dac11de8269ca
F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c
F src/util.c 8073bbdab9cc7209f6741bd44264ede606cbadc6
F src/util.c 38c06684c922694809ccb988a13562c16890a3d5
F src/vacuum.c feb1eabb20987983d9350cad98299b21fa811f52
F src/vdbe.c ad4d5b7ad65793886b09c925fb5d1d74ac78f1a4
F src/vdbe.c 87ae3a5657fefed7875f3eb30e7ababd48013d71
F src/vdbe.h c743791f723049db94f009e3e30958952bc2d512
F src/vdbeInt.h 4b69d5451bcadd473e745af53ef1e8abfdce0a79
F src/vdbeapi.c bfc06382d5089944388a90e4f90bb1e975b3613d
F src/vdbeaux.c 3580de0325a05663195d8f8fddf48c6dd9a28522
F src/vdbeInt.h 84827a809229917fdd3cc05af719dbb61314a5a3
F src/vdbeapi.c 95b1f8e527240a18a9aea41a655b013bf07a7009
F src/vdbeaux.c 2c15cf88de4df97428318c8cfac0dea873dae451
F src/vdbeblob.c 3b570b730109e8f653d9d2081649f6e7015113db
F src/vdbemem.c be8381ed6de54eb9cb9dfa802823cdeb5166d855
F src/vdbesort.c 74c22db608649fd7ed2d19d53eefb6efb14e9ee0
F src/vdbesort.c 307460bfa4de4d1c3901fcd42089159131e34062
F src/vdbetrace.c f75c5455d8cf389ef86a8bfdfd3177e0e3692484
F src/vtab.c c27c0232bbc6bd4b50320ea0ef988334cde7d1ca
F src/vtab.c 943c23b355f0a8f859f9583e7315d64bebdb0899
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 10deb6b43887662691e5f53d10b3c171c401169b
F src/wal.h 2f7c831cf3b071fa548bf2d5cac640846a7ff19c
F src/walker.c 0f142b5bd3ed2041fc52d773880748b212e63354
F src/where.c 5b67fb8035ae4697cf721db095f800ef8dff5f56
F src/whereInt.h 78b6b4de94db84aecbdc07fe3e38f648eb391e9a
F src/wherecode.c 791a784bbf8749d560fdb0b990b607bc4f44a38d
F src/whereexpr.c de117970b29471177a6901d60ad83a194671dc03
F src/where.c b21a2b3cee42e1db4f14c8fc5124f607e0c668c0
F src/whereInt.h 93297d56edd137b7ea004490690fb6e2ce028a34
F src/wherecode.c 39c1ef4598bedf1d66249334c74efd23ddd182ac
F src/whereexpr.c fb87944b1254234e5bba671aaf6dee476241506a
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
@@ -474,7 +475,7 @@ F test/auth2.test 264c6af53cad9aba5218c68bbe18036e39007bfa
F test/auth3.test 5cfa94ed90c6617c42b7ba4b133fd79678b251c7
F test/autoinc.test c58912526998a39e11f66b533e23cfabea7f25b7
F test/autoindex1.test 14b63a9f1e405fe6d5bfc8c8d00249c2ebaf13ea
F test/autoindex2.test af7e595c6864cc6ef5fc38d5db579a3e34940cb8
F test/autoindex2.test 12ef578928102baaa0dc23ad397601a2f4ecb0df
F test/autoindex3.test a3be0d1a53a7d2edff208a5e442312957047e972
F test/autoindex4.test 49d3cd791a9baa16fb461d7ea3de80d019a819cf
F test/autoindex5.test 96f084a5e6024ea07cace5888df3223f3ea86990
@@ -563,7 +564,7 @@ F test/corruptI.test 347babbf970e7947e3f91dccf7a1bec28a1bab04
F test/corruptJ.test 9e29e7a81ee3b6ac50f77ea7a9e2f3fa03f32d91
F test/cost.test 1eedbfd868f806f3fa08ff072b04cf270dcf61c8
F test/count.test cb2e0f934c6eb33670044520748d2ecccd46259c
F test/coveridxscan.test cdb47d01acc4a634a34fd25abe85189e0d0f1e62
F test/coveridxscan.test b629e896b14df2f000a99b8d170d80589c46562c
F test/crash.test fb9dc4a02dcba30d4aa5c2c226f98b220b2b959f
F test/crash2.test 5b14d4eb58b880e231361d3b609b216acda86651
F test/crash3.test 8f5de9d32ab9ab95475a9efe7f47a940aa889418
@@ -764,7 +765,7 @@ F test/fuzz2.test 76dc35b32b6d6f965259508508abce75a6c4d7e1
F test/fuzz3.test b47377143f0c80f91ed29d722861077ff34415d5
F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b
F test/fuzz_malloc.test 328f70aaca63adf29b4c6f06505ed0cf57ca7c26
F test/fuzzcheck.c 3b1707385ee81ae124a0f35c9df6d6d20550917a
F test/fuzzcheck.c 93bb9d309888634615e21ef98d1c30d51483e942
F test/fuzzdata1.db 7ee3227bad0e7ccdeb08a9e6822916777073c664
F test/fuzzdata2.db f03a420d3b822cc82e4f894ca957618fbe9c4973
F test/fuzzdata3.db c6586d3e3cef0fbc18108f9bb649aa77bfc38aba
@@ -855,7 +856,7 @@ F test/lock6.test ad5b387a3a8096afd3c68a55b9535056431b0cf5
F test/lock7.test 49f1eaff1cdc491cc5dee3669f3c671d9f172431
F test/lock_common.tcl 7ffb45accf6ee91c736df9bafe0806a44358f035
F test/lookaside.test 90052e87282de256d613fcf8c9cbb845e4001d2f
F test/main.test 16131264ea0c2b93b95201f0c92958e85f2ba11a
F test/main.test bb75e406c9b64931f3dc7e7f04626633365bb22f
F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9
F test/malloc.test 21c213365f2cca95ab2d7dc078dc8525f96065f8
F test/malloc3.test e3b32c724b5a124b57cb0ed177f675249ad0c66a
@@ -889,7 +890,7 @@ F test/minmax.test 42fbad0e81afaa6e0de41c960329f2b2c3526efd
F test/minmax2.test b44bae787fc7b227597b01b0ca5575c7cb54d3bc
F test/minmax3.test cc1e8b010136db0d01a6f2a29ba5a9f321034354
F test/minmax4.test 936941484ebdceb8adec7c86b6cd9b6e5e897c1f
F test/misc1.test 48ebfb5b22a6a058f7b7e1df211226dd1d21409c
F test/misc1.test 6430dabfb4b4fa480633590118964201f94d3ccc
F test/misc2.test 00d7de54eda90e237fc9a38b9e5ccc769ebf6d4d
F test/misc3.test cf3dda47d5dda3e53fc5804a100d3c82be736c9d
F test/misc4.test 0d8be3466adf123a7791a66ba2bc8e8d229e87f3
@@ -931,7 +932,7 @@ F test/orderby8.test 23ef1a5d72bd3adcc2f65561c654295d1b8047bd
F test/orderby9.test 87fb9548debcc2cd141c5299002dd94672fa76a3
F test/oserror.test b32dc34f2363ef18532e3a0a7358e3e7e321974f
F test/ovfl.test 199c482696defceacee8c8e0e0ef36da62726b2f
F test/pager1.test 1acbdb14c5952a72dd43129cabdbf69aaa3ed1fa
F test/pager1.test f49df1a8b0e38b9ee3a7dd2ab4d427507b7314ce
F test/pager2.test 67b8f40ae98112bcdba1f2b2d03ea83266418c71
F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f
F test/pager4.test a122e9e6925d5b23b31e3dfef8c6a44bbf19590e
@@ -963,6 +964,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df
F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736
F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
F test/regexp2.test aa7ffcc21350007a78361b82bcf3b74d12227144
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
F test/releasetest.tcl 975449bf742b8bb9025208292208af816a1fcb58
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
@@ -1050,7 +1052,7 @@ F test/speed3.test d32043614c08c53eafdc80f33191d5bd9b920523
F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715
F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa
F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b
F test/speedtest1.c f8bf04214e7b5f745feea99f7bde68b1c4870666
F test/speedtest1.c 947421c324f5cd4cb3dcae1ec214e4be763df718
F test/spellfix.test f9c1f431e2c096c8775fec032952320c0e4700db
F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3
F test/spellfix3.test f7bf7b3482971473d32b6b00f6944c5c066cff97
@@ -1367,7 +1369,7 @@ F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac
F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5
F tool/GetTclKit.bat 629d87562e0487c386db630033931d12d62e6372
F tool/addopcodes.tcl 4ca9c3ef196f08da30add5d07ce0c9458dc8c633
F tool/build-all-msvc.bat 31866578036cd1d962628059b0760d407c3ce4d8 x
F tool/build-all-msvc.bat 55be1cf8545dabd69df2ba6b3de6868da0c26f52 x
F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367
F tool/cg_anno.tcl 692ce4b8693d59e3a3de77ca97f4139ecfa641b0 x
F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2
@@ -1379,12 +1381,12 @@ F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4
F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
F tool/lemon.c 251f5c3f21b553240cbdd42dd187a51bb2372cd3
F tool/lempar.c 5f626c741e034da827b4224d0c68eaf6d8fcc72c
F tool/lempar.c d5114c7d13aa3af1e27ff3d02e4dea6eadec7ddf
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6
F tool/mkautoconfamal.sh c78caa3214f25dc28ea157b5a82abb311f209906
F tool/mkkeywordhash.c f7f3b342211ac6a14258b9726d5b97cf4f548f22
F tool/mkmsvcmin.tcl d57e6efc9428605f5418d0b235721ddf7b5d9c0b
F tool/mkmsvcmin.tcl f9fc6f6a373084c0e0feef972485212bd0869c06
F tool/mkopcodec.tcl d1b6362bd3aa80d5520d4d6f3765badf01f6c43c
F tool/mkopcodeh.tcl 385c62d78c38b2d92146dcb5abd319dbbc33506d
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
@@ -1394,7 +1396,7 @@ F tool/mksqlite3c-noext.tcl 87240b09c20042999b41d5fabe091b7111287835
F tool/mksqlite3c.tcl b66b4170f693602cd6985aed15d9509fe2f18c84
F tool/mksqlite3h.tcl 1d41ab59bffb025121f75b76e183125ce41b3ec8
F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
F tool/mkvsix.tcl fbeb0af7cffdf64e0fba6d65e2e5120dc14595f4
F tool/mkvsix.tcl 4abcaf3267171b2faadaf9b82a0dfbaa6e98f8b7
F tool/offsets.c fe4262fdfa378e8f5499a42136d17bf3b98f6091
F tool/omittest.tcl 34d7ac01fe4fd18e3637f64abe12c40eca0f6b97
F tool/pagesig.c ff0ca355fd3c2398e933da5e22439bbff89b803b
@@ -1427,7 +1429,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh a98af506df552f3b3c0d904f94e4cdc4e1a6d598
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 5cfe9545d478a2c500083613dd20e14b2ffce645
R d924bff2a49f13e938a4912c2ba811f7
P 5957e793414ff80ed01a7a67e70c3fd096a3f6e0
R 8a8e5a80c02a4dfa694df7d4a40dc042
U drh
Z be09b78429c9c8eaf29c2a1ea6a1c05b
Z 5c10952be751c4b6279994eaa94bd734
+1 -1
View File
@@ -1 +1 @@
417e777701bbf4bd67626d4ca3bc2c5d847f6cd0
aab53a21894ba51d325fd8f8f4bb4163ece74391
-15
View File
@@ -2619,21 +2619,6 @@ int sqlite3BtreeSetPagerFlags(
}
#endif
/*
** Return TRUE if the given btree is set to safety level 1. In other
** words, return TRUE if no sync() occurs on the disk files.
*/
int sqlite3BtreeSyncDisabled(Btree *p){
BtShared *pBt = p->pBt;
int rc;
assert( sqlite3_mutex_held(p->db->mutex) );
sqlite3BtreeEnter(p);
assert( pBt && pBt->pPager );
rc = sqlite3PagerNosync(pBt->pPager);
sqlite3BtreeLeave(p);
return rc;
}
/*
** Change the default pages size and the number of reserved bytes per page.
** Or, if the page size has already been fixed, return SQLITE_READONLY
-1
View File
@@ -68,7 +68,6 @@ int sqlite3BtreeSetSpillSize(Btree*,int);
int sqlite3BtreeSetMmapLimit(Btree*,sqlite3_int64);
#endif
int sqlite3BtreeSetPagerFlags(Btree*,unsigned);
int sqlite3BtreeSyncDisabled(Btree*);
int sqlite3BtreeSetPageSize(Btree *p, int nPagesize, int nReserve, int eFix);
int sqlite3BtreeGetPageSize(Btree*);
int sqlite3BtreeMaxPageCount(Btree*,int);
+14
View File
@@ -3196,6 +3196,20 @@ Index *sqlite3CreateIndex(
sqlite3DefaultRowEst(pIndex);
if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex);
/* If this index contains every column of its table, then mark
** it as a covering index */
assert( HasRowid(pTab)
|| pTab->iPKey<0 || sqlite3ColumnOfIndex(pIndex, pTab->iPKey)>=0 );
if( pTblName!=0 && pIndex->nColumn>=pTab->nCol ){
pIndex->isCovering = 1;
for(j=0; j<pTab->nCol; j++){
if( j==pTab->iPKey ) continue;
if( sqlite3ColumnOfIndex(pIndex,j)>=0 ) continue;
pIndex->isCovering = 0;
break;
}
}
if( pTab==pParse->pNewTable ){
/* This routine has been called to create an automatic index as a
** result of a PRIMARY KEY or UNIQUE clause on a column definition, or
+2 -2
View File
@@ -405,10 +405,10 @@ FuncDef *sqlite3FindFunction(
if( createFlag && bestScore<FUNC_PERFECT_MATCH &&
(pBest = sqlite3DbMallocZero(db, sizeof(*pBest)+nName+1))!=0 ){
FuncDef *pOther;
pBest->zName = (char *)&pBest[1];
pBest->zName = (const char*)&pBest[1];
pBest->nArg = (u16)nArg;
pBest->funcFlags = enc;
memcpy(pBest->zName, zName, nName+1);
memcpy((char*)&pBest[1], zName, nName+1);
pOther = (FuncDef*)sqlite3HashInsert(&db->aFunc, pBest->zName, pBest);
if( pOther==pBest ){
sqlite3DbFree(db, pBest);
+4 -4
View File
@@ -2865,13 +2865,13 @@ static int openDatabase(
sqlite3BtreeLeave(db->aDb[0].pBt);
db->aDb[1].pSchema = sqlite3SchemaGet(db, 0);
/* The default safety_level for the main database is 'full'; for the temp
** database it is 'NONE'. This matches the pager layer defaults.
/* The default safety_level for the main database is FULL; for the temp
** database it is OFF. This matches the pager layer defaults.
*/
db->aDb[0].zName = "main";
db->aDb[0].safety_level = 3;
db->aDb[0].safety_level = PAGER_SYNCHRONOUS_FULL;
db->aDb[1].zName = "temp";
db->aDb[1].safety_level = 1;
db->aDb[1].safety_level = PAGER_SYNCHRONOUS_OFF;
db->magic = SQLITE_MAGIC_OPEN;
if( db->mallocFailed ){
-8
View File
@@ -6738,14 +6738,6 @@ const char *sqlite3PagerJournalname(Pager *pPager){
return pPager->zJournal;
}
/*
** Return true if fsync() calls are disabled for this pager. Return FALSE
** if fsync()s are executed normally.
*/
int sqlite3PagerNosync(Pager *pPager){
return pPager->noSync;
}
#ifdef SQLITE_HAS_CODEC
/*
** Set or retrieve the codec for this pager
-1
View File
@@ -191,7 +191,6 @@ sqlite3_vfs *sqlite3PagerVfs(Pager*);
sqlite3_file *sqlite3PagerFile(Pager*);
sqlite3_file *sqlite3PagerJrnlFile(Pager*);
const char *sqlite3PagerJournalname(Pager*);
int sqlite3PagerNosync(Pager*);
void *sqlite3PagerTempSpace(Pager*);
int sqlite3PagerIsMemdb(Pager*);
void sqlite3PagerCacheStat(Pager *, int, int, int *);
+21 -14
View File
@@ -105,7 +105,7 @@ Select *sqlite3SelectNew(
ExprList *pGroupBy, /* the GROUP BY clause */
Expr *pHaving, /* the HAVING clause */
ExprList *pOrderBy, /* the ORDER BY clause */
u16 selFlags, /* Flag parameters, such as SF_Distinct */
u32 selFlags, /* Flag parameters, such as SF_Distinct */
Expr *pLimit, /* LIMIT value. NULL means not used */
Expr *pOffset /* OFFSET value. NULL means no offset */
){
@@ -1845,8 +1845,9 @@ static void computeLimitRegisters(Parse *pParse, Select *p, int iBreak){
VdbeComment((v, "LIMIT counter"));
if( n==0 ){
sqlite3VdbeGoto(v, iBreak);
}else if( n>=0 && p->nSelectRow>(u64)n ){
p->nSelectRow = n;
}else if( n>=0 && p->nSelectRow>sqlite3LogEst((u64)n) ){
p->nSelectRow = sqlite3LogEst((u64)n);
p->selFlags |= SF_FixedLimit;
}
}else{
sqlite3ExprCode(pParse, p->pLimit, iLimit);
@@ -2287,12 +2288,12 @@ static int multiSelect(
testcase( rc!=SQLITE_OK );
pDelete = p->pPrior;
p->pPrior = pPrior;
p->nSelectRow += pPrior->nSelectRow;
p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);
if( pPrior->pLimit
&& sqlite3ExprIsInteger(pPrior->pLimit, &nLimit)
&& nLimit>0 && p->nSelectRow > (u64)nLimit
&& nLimit>0 && p->nSelectRow > sqlite3LogEst((u64)nLimit)
){
p->nSelectRow = nLimit;
p->nSelectRow = sqlite3LogEst((u64)nLimit);
}
if( addr ){
sqlite3VdbeJumpHere(v, addr);
@@ -2364,7 +2365,9 @@ static int multiSelect(
pDelete = p->pPrior;
p->pPrior = pPrior;
p->pOrderBy = 0;
if( p->op==TK_UNION ) p->nSelectRow += pPrior->nSelectRow;
if( p->op==TK_UNION ){
p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);
}
sqlite3ExprDelete(db, p->pLimit);
p->pLimit = pLimit;
p->pOffset = pOffset;
@@ -3001,7 +3004,7 @@ static int multiSelectOrderBy(
addrEofA_noB = sqlite3VdbeAddOp2(v, OP_Yield, regAddrB, labelEnd);
VdbeCoverage(v);
sqlite3VdbeGoto(v, addrEofA);
p->nSelectRow += pPrior->nSelectRow;
p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);
}
/* Generate a subroutine to run when the results from select B
@@ -4987,7 +4990,7 @@ int sqlite3Select(
sqlite3SelectDestInit(&dest, SRT_Coroutine, pItem->regReturn);
explainSetInteger(pItem->iSelectId, (u8)pParse->iNextSelectId);
sqlite3Select(pParse, pSub, &dest);
pItem->pTab->nRowLogEst = sqlite3LogEst(pSub->nSelectRow);
pItem->pTab->nRowLogEst = pSub->nSelectRow;
pItem->fg.viaCoroutine = 1;
pItem->regResult = dest.iSdst;
sqlite3VdbeEndCoroutine(v, pItem->regReturn);
@@ -5018,7 +5021,7 @@ int sqlite3Select(
sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor);
explainSetInteger(pItem->iSelectId, (u8)pParse->iNextSelectId);
sqlite3Select(pParse, pSub, &dest);
pItem->pTab->nRowLogEst = sqlite3LogEst(pSub->nSelectRow);
pItem->pTab->nRowLogEst = pSub->nSelectRow;
if( onceAddr ) sqlite3VdbeJumpHere(v, onceAddr);
retAddr = sqlite3VdbeAddOp1(v, OP_Return, pItem->regReturn);
VdbeComment((v, "end %s", pItem->pTab->zName));
@@ -5101,7 +5104,7 @@ int sqlite3Select(
/* Set the limiter.
*/
iEnd = sqlite3VdbeMakeLabel(v);
p->nSelectRow = LARGEST_INT64;
p->nSelectRow = 320; /* 4 billion rows */
computeLimitRegisters(pParse, p, iEnd);
if( p->iLimit==0 && sSort.addrSortIndex>=0 ){
sqlite3VdbeChangeOpcode(v, sSort.addrSortIndex, OP_SorterOpen);
@@ -5125,10 +5128,12 @@ int sqlite3Select(
if( !isAgg && pGroupBy==0 ){
/* No aggregate functions and no GROUP BY clause */
u16 wctrlFlags = (sDistinct.isTnct ? WHERE_WANT_DISTINCT : 0);
assert( WHERE_USE_LIMIT==SF_FixedLimit );
wctrlFlags |= p->selFlags & SF_FixedLimit;
/* Begin the database scan. */
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, sSort.pOrderBy,
p->pEList, wctrlFlags, 0);
p->pEList, wctrlFlags, p->nSelectRow);
if( pWInfo==0 ) goto select_end;
if( sqlite3WhereOutputRowCount(pWInfo) < p->nSelectRow ){
p->nSelectRow = sqlite3WhereOutputRowCount(pWInfo);
@@ -5188,9 +5193,11 @@ int sqlite3Select(
for(k=pGroupBy->nExpr, pItem=pGroupBy->a; k>0; k--, pItem++){
pItem->u.x.iAlias = 0;
}
if( p->nSelectRow>100 ) p->nSelectRow = 100;
assert( 66==sqlite3LogEst(100) );
if( p->nSelectRow>66 ) p->nSelectRow = 66;
}else{
p->nSelectRow = 1;
assert( 0==sqlite3LogEst(1) );
p->nSelectRow = 0;
}
/* If there is both a GROUP BY and an ORDER BY clause and they are
+1 -1
View File
@@ -3171,7 +3171,7 @@ static int do_meta_command(char *zLine, ShellState *p){
char *zCreate = sqlite3_mprintf("CREATE TABLE %s", zTable);
char cSep = '(';
while( xRead(&sCtx) ){
zCreate = sqlite3_mprintf("%z%c\n \"%s\" TEXT", zCreate, cSep, sCtx.z);
zCreate = sqlite3_mprintf("%z%c\n \"%w\" TEXT", zCreate, cSep, sCtx.z);
cSep = ',';
if( sCtx.cTerm!=sCtx.cColSep ) break;
}
+1 -1
View File
@@ -7489,7 +7489,7 @@ void sqlite3_log(int iErrCode, const char *zFormat, ...);
** previously registered write-ahead log callback. ^Note that the
** [sqlite3_wal_autocheckpoint()] interface and the
** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
** those overwrite any prior [sqlite3_wal_hook()] settings.
** overwrite any prior [sqlite3_wal_hook()] settings.
*/
void *sqlite3_wal_hook(
sqlite3*,
+28 -22
View File
@@ -1395,7 +1395,7 @@ struct FuncDef {
FuncDef *pNext; /* Next function with same name */
void (*xSFunc)(sqlite3_context*,int,sqlite3_value**); /* func or agg-step */
void (*xFinalize)(sqlite3_context*); /* Agg finalizer */
char *zName; /* SQL name of the function. */
const char *zName; /* SQL name of the function. */
union {
FuncDef *pHash; /* Next with a different name but the same hash */
FuncDestructor *pDestructor; /* Reference counted destructor function */
@@ -2338,7 +2338,11 @@ struct IdList {
** tables in a join to 32 instead of 64. But it also reduces the size
** of the library by 738 bytes on ix86.
*/
typedef u64 Bitmask;
#ifdef SQLITE_BITMASK_TYPE
typedef SQLITE_BITMASK_TYPE Bitmask;
#else
typedef u64 Bitmask;
#endif
/*
** The number of bits in a Bitmask. "BMS" means "BitMask Size".
@@ -2438,6 +2442,7 @@ struct SrcList {
#define WHERE_SORTBYGROUP 0x0800 /* Support sqlite3WhereIsSorted() */
#define WHERE_REOPEN_IDX 0x1000 /* Try to use OP_ReopenIdx */
#define WHERE_ONEPASS_MULTIROW 0x2000 /* ONEPASS is ok with multiple rows */
#define WHERE_USE_LIMIT 0x4000 /* There is a constant LIMIT clause */
/* Allowed return values from sqlite3WhereIsDistinct()
*/
@@ -2516,13 +2521,13 @@ struct NameContext {
struct Select {
ExprList *pEList; /* The fields of the result */
u8 op; /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */
u16 selFlags; /* Various SF_* values */
LogEst nSelectRow; /* Estimated number of result rows */
u32 selFlags; /* Various SF_* values */
int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */
#if SELECTTRACE_ENABLED
char zSelName[12]; /* Symbolic name of this SELECT use for debugging */
#endif
int addrOpenEphm[2]; /* OP_OpenEphem opcodes related to this select */
u64 nSelectRow; /* Estimated number of result rows */
SrcList *pSrc; /* The FROM clause */
Expr *pWhere; /* The WHERE clause */
ExprList *pGroupBy; /* The GROUP BY clause */
@@ -2539,22 +2544,23 @@ struct Select {
** Allowed values for Select.selFlags. The "SF" prefix stands for
** "Select Flag".
*/
#define SF_Distinct 0x0001 /* Output should be DISTINCT */
#define SF_All 0x0002 /* Includes the ALL keyword */
#define SF_Resolved 0x0004 /* Identifiers have been resolved */
#define SF_Aggregate 0x0008 /* Contains aggregate functions */
#define SF_UsesEphemeral 0x0010 /* Uses the OpenEphemeral opcode */
#define SF_Expanded 0x0020 /* sqlite3SelectExpand() called on this */
#define SF_HasTypeInfo 0x0040 /* FROM subqueries have Table metadata */
#define SF_Compound 0x0080 /* Part of a compound query */
#define SF_Values 0x0100 /* Synthesized from VALUES clause */
#define SF_MultiValue 0x0200 /* Single VALUES term with multiple rows */
#define SF_NestedFrom 0x0400 /* Part of a parenthesized FROM clause */
#define SF_MaybeConvert 0x0800 /* Need convertCompoundSelectToSubquery() */
#define SF_MinMaxAgg 0x1000 /* Aggregate containing min() or max() */
#define SF_Recursive 0x2000 /* The recursive part of a recursive CTE */
#define SF_Converted 0x4000 /* By convertCompoundSelectToSubquery() */
#define SF_IncludeHidden 0x8000 /* Include hidden columns in output */
#define SF_Distinct 0x00001 /* Output should be DISTINCT */
#define SF_All 0x00002 /* Includes the ALL keyword */
#define SF_Resolved 0x00004 /* Identifiers have been resolved */
#define SF_Aggregate 0x00008 /* Contains aggregate functions */
#define SF_UsesEphemeral 0x00010 /* Uses the OpenEphemeral opcode */
#define SF_Expanded 0x00020 /* sqlite3SelectExpand() called on this */
#define SF_HasTypeInfo 0x00040 /* FROM subqueries have Table metadata */
#define SF_Compound 0x00080 /* Part of a compound query */
#define SF_Values 0x00100 /* Synthesized from VALUES clause */
#define SF_MultiValue 0x00200 /* Single VALUES term with multiple rows */
#define SF_NestedFrom 0x00400 /* Part of a parenthesized FROM clause */
#define SF_MaybeConvert 0x00800 /* Need convertCompoundSelectToSubquery() */
#define SF_MinMaxAgg 0x01000 /* Aggregate containing min() or max() */
#define SF_Recursive 0x02000 /* The recursive part of a recursive CTE */
#define SF_FixedLimit 0x04000 /* nSelectRow set by a constant LIMIT */
#define SF_Converted 0x08000 /* By convertCompoundSelectToSubquery() */
#define SF_IncludeHidden 0x10000 /* Include hidden columns in output */
/*
@@ -3485,7 +3491,7 @@ Index *sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*,
void sqlite3DropIndex(Parse*, SrcList*, int);
int sqlite3Select(Parse*, Select*, SelectDest*);
Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,
Expr*,ExprList*,u16,Expr*,Expr*);
Expr*,ExprList*,u32,Expr*,Expr*);
void sqlite3SelectDelete(sqlite3*, Select*);
Table *sqlite3SrcListLookup(Parse*, SrcList*);
int sqlite3IsReadOnly(Parse*, Table*, int);
@@ -3497,7 +3503,7 @@ void sqlite3DeleteFrom(Parse*, SrcList*, Expr*);
void sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int);
WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int);
void sqlite3WhereEnd(WhereInfo*);
u64 sqlite3WhereOutputRowCount(WhereInfo*);
LogEst sqlite3WhereOutputRowCount(WhereInfo*);
int sqlite3WhereIsDistinct(WhereInfo*);
int sqlite3WhereIsOrdered(WhereInfo*);
int sqlite3WhereIsSorted(WhereInfo*);
+1 -1
View File
@@ -3154,7 +3154,7 @@ static int test_bind_zeroblob64(
){
sqlite3_stmt *pStmt;
int idx;
i64 n;
Tcl_WideInt n;
int rc;
if( objc!=4 ){
+1 -1
View File
@@ -105,7 +105,7 @@ static int test_blob_open(
const char *zDb;
const char *zTable;
const char *zColumn;
sqlite_int64 iRowid;
Tcl_WideInt iRowid;
int flags;
const char *zVarname;
int nVarname;
+3 -3
View File
@@ -285,7 +285,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
case CC_BANG: {
if( z[1]!='=' ){
*tokenType = TK_ILLEGAL;
return 2;
return 1;
}else{
*tokenType = TK_NE;
return 2;
@@ -435,8 +435,8 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
*tokenType = TK_ID;
return keywordCode((char*)z, i, tokenType);
}
#ifndef SQLITE_OMIT_BLOB_LITERAL
case CC_X: {
#ifndef SQLITE_OMIT_BLOB_LITERAL
testcase( z[0]=='x' ); testcase( z[0]=='X' );
if( z[1]=='\'' ){
*tokenType = TK_BLOB;
@@ -448,10 +448,10 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
if( z[i] ) i++;
return i;
}
#endif
/* If it is not a BLOB literal, then it must be an ID, since no
** SQL keywords start with the letter 'x'. Fall through */
}
#endif
case CC_ID: {
i = 1;
break;
+3 -2
View File
@@ -132,9 +132,10 @@ void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 moreToFollow){
sqlite3TreeViewPush(pView, 1);
}
do{
sqlite3TreeViewLine(pView, "SELECT%s%s (0x%p) selFlags=0x%x",
sqlite3TreeViewLine(pView, "SELECT%s%s (0x%p) selFlags=0x%x nSelectRow=%d",
((p->selFlags & SF_Distinct) ? " DISTINCT" : ""),
((p->selFlags & SF_Aggregate) ? " agg_flag" : ""), p, p->selFlags
((p->selFlags & SF_Aggregate) ? " agg_flag" : ""), p, p->selFlags,
(int)p->nSelectRow
);
if( cnt++ ) sqlite3TreeViewPop(pView);
if( p->pPrior ){
+4 -2
View File
@@ -1116,10 +1116,12 @@ u32 sqlite3Get4byte(const u8 *p){
void sqlite3Put4byte(unsigned char *p, u32 v){
#if SQLITE_BYTEORDER==4321
memcpy(p,&v,4);
#elif SQLITE_BYTEORDER==1234 && defined(__GNUC__) && GCC_VERSION>=4003000
#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
&& defined(__GNUC__) && GCC_VERSION>=4003000
u32 x = __builtin_bswap32(v);
memcpy(p,&x,4);
#elif SQLITE_BYTEORDER==1234 && defined(_MSC_VER) && _MSC_VER>=1300
#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
&& defined(_MSC_VER) && _MSC_VER>=1300
u32 x = _byteswap_ulong(v);
memcpy(p,&x,4);
#else
+134 -95
View File
@@ -627,7 +627,11 @@ int sqlite3VdbeExec(
}
sqlite3EndBenignMalloc();
#endif
for(pOp=&aOp[p->pc]; rc==SQLITE_OK; pOp++){
for(pOp=&aOp[p->pc]; 1; pOp++){
/* Errors are detected by individual opcodes, with an immediate
** jumps to abort_due_to_error. */
assert( rc==SQLITE_OK );
assert( pOp>=aOp && pOp<&aOp[p->nOp]);
#ifdef VDBE_PROFILE
start = sqlite3Hwtime();
@@ -774,7 +778,7 @@ check_for_interrupt:
nProgressLimit = nVmStep + db->nProgressOps - (nVmStep%db->nProgressOps);
if( db->xProgress(db->pProgressArg) ){
rc = SQLITE_INTERRUPT;
goto vdbe_error_halt;
goto abort_due_to_error;
}
}
#endif
@@ -1053,7 +1057,10 @@ case OP_String8: { /* same as TK_STRING, out2 */
#ifndef SQLITE_OMIT_UTF16
if( encoding!=SQLITE_UTF8 ){
rc = sqlite3VdbeMemSetStr(pOut, pOp->p4.z, -1, SQLITE_UTF8, SQLITE_STATIC);
if( rc==SQLITE_TOOBIG ) goto too_big;
if( rc ){
assert( rc==SQLITE_TOOBIG ); /* This is the only possible error here */
goto too_big;
}
if( SQLITE_OK!=sqlite3VdbeChangeEncoding(pOut, encoding) ) goto no_mem;
assert( pOut->szMalloc>0 && pOut->zMalloc==pOut->z );
assert( VdbeMemDynamic(pOut)==0 );
@@ -1319,7 +1326,7 @@ case OP_ResultRow: {
&& db->xProgress(db->pProgressArg)!=0
){
rc = SQLITE_INTERRUPT;
goto vdbe_error_halt;
goto abort_due_to_error;
}
#endif
@@ -1329,7 +1336,7 @@ case OP_ResultRow: {
if( SQLITE_OK!=(rc = sqlite3VdbeCheckFk(p, 0)) ){
assert( db->flags&SQLITE_CountRows );
assert( p->usesStmtJournal );
break;
goto abort_due_to_error;
}
/* If the SQLITE_CountRows flag is set in sqlite3.flags mask, then
@@ -1349,9 +1356,7 @@ case OP_ResultRow: {
*/
assert( p->iStatement==0 || db->flags&SQLITE_CountRows );
rc = sqlite3VdbeCloseStatement(p, SAVEPOINT_RELEASE);
if( NEVER(rc!=SQLITE_OK) ){
break;
}
assert( rc==SQLITE_OK );
/* Invalidate all ephemeral cursor row caches */
p->cacheCtr = (p->cacheCtr + 2)|1;
@@ -1674,7 +1679,8 @@ case OP_Function: {
sqlite3VdbeError(p, "%s", sqlite3_value_text(pCtx->pOut));
rc = pCtx->isError;
}
sqlite3VdbeDeleteAuxData(p, pCtx->iOp, pOp->p1);
sqlite3VdbeDeleteAuxData(db, &p->pAuxData, pCtx->iOp, pOp->p1);
if( rc ) goto abort_due_to_error;
}
/* Copy the result of the function into register P3 */
@@ -1858,6 +1864,7 @@ case OP_Cast: { /* in1 */
rc = ExpandBlob(pIn1);
sqlite3VdbeMemCast(pIn1, pOp->p2, encoding);
UPDATE_MAX_BLOBSIZE(pIn1);
if( rc ) goto abort_due_to_error;
break;
}
#endif /* SQLITE_OMIT_CAST */
@@ -2467,7 +2474,7 @@ case OP_Column: {
*/
if( offset > 98307 || offset > pC->payloadSize ){
rc = SQLITE_CORRUPT_BKPT;
goto op_column_error;
goto abort_due_to_error;
}
}
@@ -2492,7 +2499,7 @@ case OP_Column: {
if( pC->aRow==0 ){
memset(&sMem, 0, sizeof(sMem));
rc = sqlite3VdbeMemFromBtree(pCrsr, 0, aOffset[0], !pC->isTable, &sMem);
if( rc!=SQLITE_OK ) goto op_column_error;
if( rc!=SQLITE_OK ) goto abort_due_to_error;
zData = (u8*)sMem.z;
}else{
zData = pC->aRow;
@@ -2528,7 +2535,7 @@ case OP_Column: {
|| (offset64 > pC->payloadSize)
){
rc = SQLITE_CORRUPT_BKPT;
goto op_column_error;
goto abort_due_to_error;
}
}else{
t = 0;
@@ -2601,15 +2608,13 @@ case OP_Column: {
}else{
rc = sqlite3VdbeMemFromBtree(pCrsr, aOffset[p2], len, !pC->isTable,
pDest);
if( rc==SQLITE_OK ){
sqlite3VdbeSerialGet((const u8*)pDest->z, t, pDest);
pDest->flags &= ~MEM_Ephem;
}
if( rc!=SQLITE_OK ) goto abort_due_to_error;
sqlite3VdbeSerialGet((const u8*)pDest->z, t, pDest);
pDest->flags &= ~MEM_Ephem;
}
}
op_column_out:
op_column_error:
UPDATE_MAX_BLOBSIZE(pDest);
REGISTER_TRACE(pOp->p3, pDest);
break;
@@ -2814,6 +2819,7 @@ case OP_Count: { /* out2 */
assert( pCrsr );
nEntry = 0; /* Not needed. Only used to silence a warning. */
rc = sqlite3BtreeCount(pCrsr, &nEntry);
if( rc ) goto abort_due_to_error;
pOut = out2Prerelease(p, pOp);
pOut->u.i = nEntry;
break;
@@ -2991,6 +2997,7 @@ case OP_Savepoint: {
}
}
}
if( rc ) goto abort_due_to_error;
break;
}
@@ -3027,7 +3034,7 @@ case OP_AutoCommit: {
sqlite3VdbeError(p, "cannot commit transaction - "
"SQL statements in progress");
rc = SQLITE_BUSY;
break;
goto abort_due_to_error;
}else if( (rc = sqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){
goto vdbe_return;
}else{
@@ -3054,6 +3061,7 @@ case OP_AutoCommit: {
"cannot commit - no transaction is active"));
rc = SQLITE_ERROR;
goto abort_due_to_error;
}
break;
}
@@ -3176,6 +3184,7 @@ case OP_Transaction: {
p->expired = 1;
rc = SQLITE_SCHEMA;
}
if( rc ) goto abort_due_to_error;
break;
}
@@ -3245,6 +3254,7 @@ case OP_SetCookie: {
sqlite3ExpirePreparedStatements(db);
p->expired = 0;
}
if( rc ) goto abort_due_to_error;
break;
}
@@ -3342,7 +3352,7 @@ case OP_OpenWrite:
if( p->expired ){
rc = SQLITE_ABORT_ROLLBACK;
break;
goto abort_due_to_error;
}
nField = 0;
@@ -3376,10 +3386,7 @@ case OP_OpenWrite:
** that opcode will always set the p2 value to 2 or more or else fail.
** If there were a failure, the prepared statement would have halted
** before reaching this instruction. */
if( NEVER(p2<2) ) {
rc = SQLITE_CORRUPT_BKPT;
goto abort_due_to_error;
}
assert( p2>=2 );
}
if( pOp->p4type==P4_KEYINFO ){
pKeyInfo = pOp->p4.pKeyInfo;
@@ -3417,6 +3424,7 @@ open_cursor_set_hints:
#endif
sqlite3BtreeCursorHintFlags(pCur->uc.pCursor,
(pOp->p5 & (OPFLAG_BULKCSR|OPFLAG_SEEKEQ)));
if( rc ) goto abort_due_to_error;
break;
}
@@ -3493,6 +3501,7 @@ case OP_OpenEphemeral: {
pCx->isTable = 1;
}
}
if( rc ) goto abort_due_to_error;
pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);
break;
}
@@ -3518,6 +3527,7 @@ case OP_SorterOpen: {
assert( pCx->pKeyInfo->db==db );
assert( pCx->pKeyInfo->enc==ENC(db) );
rc = sqlite3VdbeSorterInit(db, pOp->p3, pCx);
if( rc ) goto abort_due_to_error;
break;
}
@@ -3980,7 +3990,7 @@ case OP_Found: { /* jump, in3 */
rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, pIdxKey, 0, 0, &res);
sqlite3DbFree(db, pFree);
if( rc!=SQLITE_OK ){
break;
goto abort_due_to_error;
}
pC->seekResult = res;
alreadyExists = (res==0);
@@ -4052,6 +4062,7 @@ case OP_NotExists: { /* jump, in3 */
goto jump_to_p2;
}
}
if( rc ) goto abort_due_to_error;
break;
}
@@ -4194,7 +4205,8 @@ case OP_NewRowid: { /* out2 */
0, &res))==SQLITE_OK)
&& (res==0)
&& (++cnt<100));
if( rc==SQLITE_OK && res==0 ){
if( rc ) goto abort_due_to_error;
if( res==0 ){
rc = SQLITE_FULL; /* IMP: R-38219-53002 */
goto abort_due_to_error;
}
@@ -4308,7 +4320,8 @@ case OP_InsertInt: {
pC->cacheStatus = CACHE_STALE;
/* Invoke the update-hook if required. */
if( rc==SQLITE_OK && db->xUpdateCallback && pOp->p4.z ){
if( rc ) goto abort_due_to_error;
if( db->xUpdateCallback && pOp->p4.z ){
zDb = db->aDb[pC->iDb].zName;
zTbl = pOp->p4.z;
op = ((pOp->p5 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT);
@@ -4398,7 +4411,8 @@ case OP_Delete: {
pC->cacheStatus = CACHE_STALE;
/* Invoke the update-hook if required. */
if( rc==SQLITE_OK && hasUpdateCallback ){
if( rc ) goto abort_due_to_error;
if( hasUpdateCallback ){
db->xUpdateCallback(db->pUpdateArg, SQLITE_DELETE,
db->aDb[pC->iDb].zName, pOp->p4.z, pC->movetoTarget);
assert( pC->iDb>=0 );
@@ -4447,6 +4461,7 @@ case OP_SorterCompare: {
res = 0;
rc = sqlite3VdbeSorterCompare(pC, pIn3, nKeyCol, &res);
VdbeBranchTaken(res!=0,2);
if( rc ) goto abort_due_to_error;
if( res ) goto jump_to_p2;
break;
};
@@ -4472,6 +4487,7 @@ case OP_SorterData: {
rc = sqlite3VdbeSorterRowkey(pC, pOut);
assert( rc!=SQLITE_OK || (pOut->flags & MEM_Blob) );
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
if( rc ) goto abort_due_to_error;
p->apCsr[pOp->p3]->cacheStatus = CACHE_STALE;
break;
}
@@ -4560,6 +4576,7 @@ case OP_RowData: {
}else{
rc = sqlite3BtreeData(pCrsr, 0, n, pOut->z);
}
if( rc ) goto abort_due_to_error;
pOut->enc = SQLITE_UTF8; /* In case the blob is ever cast to text */
UPDATE_MAX_BLOBSIZE(pOut);
REGISTER_TRACE(pOp->p2, pOut);
@@ -4600,6 +4617,7 @@ case OP_Rowid: { /* out2 */
assert( pModule->xRowid );
rc = pModule->xRowid(pC->uc.pVCur, &v);
sqlite3VtabImportErrmsg(p, pVtab);
if( rc ) goto abort_due_to_error;
#endif /* SQLITE_OMIT_VIRTUALTABLE */
}else{
assert( pC->eCurType==CURTYPE_BTREE );
@@ -4670,6 +4688,7 @@ case OP_Last: { /* jump */
#ifdef SQLITE_DEBUG
pC->seekOp = OP_Last;
#endif
if( rc ) goto abort_due_to_error;
if( pOp->p2>0 ){
VdbeBranchTaken(res!=0,2);
if( res ) goto jump_to_p2;
@@ -4734,6 +4753,7 @@ case OP_Rewind: { /* jump */
pC->deferredMoveto = 0;
pC->cacheStatus = CACHE_STALE;
}
if( rc ) goto abort_due_to_error;
pC->nullRow = (u8)res;
assert( pOp->p2>0 && pOp->p2<p->nOp );
VdbeBranchTaken(res!=0,2);
@@ -4846,6 +4866,7 @@ case OP_Next: /* jump */
next_tail:
pC->cacheStatus = CACHE_STALE;
VdbeBranchTaken(res==0,2);
if( rc ) goto abort_due_to_error;
if( res==0 ){
pC->nullRow = 0;
p->aCounter[pOp->p5]++;
@@ -4896,19 +4917,19 @@ case OP_IdxInsert: { /* in2 */
assert( pC->eCurType==CURTYPE_BTREE || pOp->opcode==OP_SorterInsert );
assert( pC->isTable==0 );
rc = ExpandBlob(pIn2);
if( rc==SQLITE_OK ){
if( pOp->opcode==OP_SorterInsert ){
rc = sqlite3VdbeSorterWrite(pC, pIn2);
}else{
nKey = pIn2->n;
zKey = pIn2->z;
rc = sqlite3BtreeInsert(pC->uc.pCursor, zKey, nKey, "", 0, 0, pOp->p3,
((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0)
);
assert( pC->deferredMoveto==0 );
pC->cacheStatus = CACHE_STALE;
}
if( rc ) goto abort_due_to_error;
if( pOp->opcode==OP_SorterInsert ){
rc = sqlite3VdbeSorterWrite(pC, pIn2);
}else{
nKey = pIn2->n;
zKey = pIn2->z;
rc = sqlite3BtreeInsert(pC->uc.pCursor, zKey, nKey, "", 0, 0, pOp->p3,
((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0)
);
assert( pC->deferredMoveto==0 );
pC->cacheStatus = CACHE_STALE;
}
if( rc) goto abort_due_to_error;
break;
}
@@ -4939,8 +4960,10 @@ case OP_IdxDelete: {
r.default_rc = 0;
r.aMem = &aMem[pOp->p2];
rc = sqlite3BtreeMovetoUnpacked(pCrsr, &r, 0, 0, &res);
if( rc==SQLITE_OK && res==0 ){
if( rc ) goto abort_due_to_error;
if( res==0 ){
rc = sqlite3BtreeDelete(pCrsr, BTREE_AUXDELETE);
if( rc ) goto abort_due_to_error;
}
assert( pC->deferredMoveto==0 );
pC->cacheStatus = CACHE_STALE;
@@ -5115,6 +5138,7 @@ case OP_IdxGE: { /* jump */
res++;
}
VdbeBranchTaken(res>0,2);
if( rc ) goto abort_due_to_error;
if( res>0 ) goto jump_to_p2;
break;
}
@@ -5150,6 +5174,7 @@ case OP_Destroy: { /* out2 */
if( db->nVdbeRead > db->nVDestroy+1 ){
rc = SQLITE_LOCKED;
p->errorAction = OE_Abort;
goto abort_due_to_error;
}else{
iDb = pOp->p3;
assert( DbMaskTest(p->btreeMask, iDb) );
@@ -5157,8 +5182,9 @@ case OP_Destroy: { /* out2 */
rc = sqlite3BtreeDropTable(db->aDb[iDb].pBt, pOp->p1, &iMoved);
pOut->flags = MEM_Int;
pOut->u.i = iMoved;
if( rc ) goto abort_due_to_error;
#ifndef SQLITE_OMIT_AUTOVACUUM
if( rc==SQLITE_OK && iMoved!=0 ){
if( iMoved!=0 ){
sqlite3RootPageMoved(db, iDb, iMoved, pOp->p1);
/* All OP_Destroy operations occur on the same btree */
assert( resetSchemaOnFault==0 || resetSchemaOnFault==iDb+1 );
@@ -5204,6 +5230,7 @@ case OP_Clear: {
aMem[pOp->p3].u.i += nChange;
}
}
if( rc ) goto abort_due_to_error;
break;
}
@@ -5227,6 +5254,7 @@ case OP_ResetSorter: {
assert( pC->eCurType==CURTYPE_BTREE );
assert( pC->isEphemeral );
rc = sqlite3BtreeClearTableOfCursor(pC->uc.pCursor);
if( rc ) goto abort_due_to_error;
}
break;
}
@@ -5275,6 +5303,7 @@ case OP_CreateTable: { /* out2 */
flags = BTREE_BLOBKEY;
}
rc = sqlite3BtreeCreateTable(pDb->pBt, &pgno, flags);
if( rc ) goto abort_due_to_error;
pOut->u.i = pgno;
break;
}
@@ -5327,9 +5356,12 @@ case OP_ParseSchema: {
db->init.busy = 0;
}
}
if( rc ) sqlite3ResetAllSchemasOfConnection(db);
if( rc==SQLITE_NOMEM ){
goto no_mem;
if( rc ){
sqlite3ResetAllSchemasOfConnection(db);
if( rc==SQLITE_NOMEM ){
goto no_mem;
}
goto abort_due_to_error;
}
break;
}
@@ -5344,6 +5376,7 @@ case OP_ParseSchema: {
case OP_LoadAnalysis: {
assert( pOp->p1>=0 && pOp->p1<db->nDb );
rc = sqlite3AnalysisLoad(db, pOp->p1);
if( rc ) goto abort_due_to_error;
break;
}
#endif /* !defined(SQLITE_OMIT_ANALYZE) */
@@ -5603,7 +5636,7 @@ case OP_Program: { /* jump */
if( p->nFrame>=db->aLimit[SQLITE_LIMIT_TRIGGER_DEPTH] ){
rc = SQLITE_ERROR;
sqlite3VdbeError(p, "too many levels of trigger recursion");
break;
goto abort_due_to_error;
}
/* Register pRt is used to store the memory required to save the state
@@ -5663,6 +5696,9 @@ case OP_Program: { /* jump */
pFrame->lastRowid = lastRowid;
pFrame->nChange = p->nChange;
pFrame->nDbChange = p->db->nChange;
assert( pFrame->pAuxData==0 );
pFrame->pAuxData = p->pAuxData;
p->pAuxData = 0;
p->nChange = 0;
p->pFrame = pFrame;
p->aMem = aMem = &VdbeFrameMem(pFrame)[-1];
@@ -5967,6 +6003,7 @@ case OP_AggStep: {
rc = pCtx->isError;
}
sqlite3VdbeMemRelease(&t);
if( rc ) goto abort_due_to_error;
}else{
assert( t.flags==MEM_Null );
}
@@ -5999,6 +6036,7 @@ case OP_AggFinal: {
rc = sqlite3VdbeMemFinalize(pMem, pOp->p4.pFunc);
if( rc ){
sqlite3VdbeError(p, "%s", sqlite3_value_text(pMem));
goto abort_due_to_error;
}
sqlite3VdbeChangeEncoding(pMem, encoding);
UPDATE_MAX_BLOBSIZE(pMem);
@@ -6034,7 +6072,8 @@ case OP_Checkpoint: {
|| pOp->p2==SQLITE_CHECKPOINT_TRUNCATE
);
rc = sqlite3Checkpoint(db, pOp->p1, pOp->p2, &aRes[1], &aRes[2]);
if( rc==SQLITE_BUSY ){
if( rc ){
if( rc!=SQLITE_BUSY ) goto abort_due_to_error;
rc = SQLITE_OK;
aRes[0] = 1;
}
@@ -6107,7 +6146,7 @@ case OP_JournalMode: { /* out2 */
"cannot change %s wal mode from within a transaction",
(eNew==PAGER_JOURNALMODE_WAL ? "into" : "out of")
);
break;
goto abort_due_to_error;
}else{
if( eOld==PAGER_JOURNALMODE_WAL ){
@@ -6137,9 +6176,7 @@ case OP_JournalMode: { /* out2 */
}
#endif /* ifndef SQLITE_OMIT_WAL */
if( rc ){
eNew = eOld;
}
if( rc ) eNew = eOld;
eNew = sqlite3PagerSetJournalMode(pPager, eNew);
pOut->flags = MEM_Str|MEM_Static|MEM_Term;
@@ -6147,6 +6184,7 @@ case OP_JournalMode: { /* out2 */
pOut->n = sqlite3Strlen30(pOut->z);
pOut->enc = SQLITE_UTF8;
sqlite3VdbeChangeEncoding(pOut, encoding);
if( rc ) goto abort_due_to_error;
break;
};
#endif /* SQLITE_OMIT_PRAGMA */
@@ -6161,6 +6199,7 @@ case OP_JournalMode: { /* out2 */
case OP_Vacuum: {
assert( p->readOnly==0 );
rc = sqlite3RunVacuum(&p->zErrMsg, db);
if( rc ) goto abort_due_to_error;
break;
}
#endif
@@ -6181,7 +6220,8 @@ case OP_IncrVacuum: { /* jump */
pBt = db->aDb[pOp->p1].pBt;
rc = sqlite3BtreeIncrVacuum(pBt);
VdbeBranchTaken(rc==SQLITE_DONE,2);
if( rc==SQLITE_DONE ){
if( rc ){
if( rc!=SQLITE_DONE ) goto abort_due_to_error;
rc = SQLITE_OK;
goto jump_to_p2;
}
@@ -6232,9 +6272,12 @@ case OP_TableLock: {
assert( DbMaskTest(p->btreeMask, p1) );
assert( isWriteLock==0 || isWriteLock==1 );
rc = sqlite3BtreeLockTable(db->aDb[p1].pBt, pOp->p2, isWriteLock);
if( (rc&0xFF)==SQLITE_LOCKED ){
const char *z = pOp->p4.z;
sqlite3VdbeError(p, "database table is locked: %s", z);
if( rc ){
if( (rc&0xFF)==SQLITE_LOCKED ){
const char *z = pOp->p4.z;
sqlite3VdbeError(p, "database table is locked: %s", z);
}
goto abort_due_to_error;
}
}
break;
@@ -6256,6 +6299,7 @@ case OP_VBegin: {
pVTab = pOp->p4.pVtab;
rc = sqlite3VtabBegin(db, pVTab);
if( pVTab ) sqlite3VtabImportErrmsg(p, pVTab->pVtab);
if( rc ) goto abort_due_to_error;
break;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */
@@ -6284,6 +6328,7 @@ case OP_VCreate: {
rc = sqlite3VtabCallCreate(db, pOp->p1, zTab, &p->zErrMsg);
}
sqlite3VdbeMemRelease(&sMem);
if( rc ) goto abort_due_to_error;
break;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */
@@ -6298,6 +6343,7 @@ case OP_VDestroy: {
db->nVDestroy++;
rc = sqlite3VtabCallDestroy(db, pOp->p1, pOp->p4.z);
db->nVDestroy--;
if( rc ) goto abort_due_to_error;
break;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */
@@ -6321,25 +6367,25 @@ case OP_VOpen: {
pVtab = pOp->p4.pVtab->pVtab;
if( pVtab==0 || NEVER(pVtab->pModule==0) ){
rc = SQLITE_LOCKED;
break;
goto abort_due_to_error;
}
pModule = pVtab->pModule;
rc = pModule->xOpen(pVtab, &pVCur);
sqlite3VtabImportErrmsg(p, pVtab);
if( SQLITE_OK==rc ){
/* Initialize sqlite3_vtab_cursor base class */
pVCur->pVtab = pVtab;
if( rc ) goto abort_due_to_error;
/* Initialize vdbe cursor object */
pCur = allocateCursor(p, pOp->p1, 0, -1, CURTYPE_VTAB);
if( pCur ){
pCur->uc.pVCur = pVCur;
pVtab->nRef++;
}else{
assert( db->mallocFailed );
pModule->xClose(pVCur);
goto no_mem;
}
/* Initialize sqlite3_vtab_cursor base class */
pVCur->pVtab = pVtab;
/* Initialize vdbe cursor object */
pCur = allocateCursor(p, pOp->p1, 0, -1, CURTYPE_VTAB);
if( pCur ){
pCur->uc.pVCur = pVCur;
pVtab->nRef++;
}else{
assert( db->mallocFailed );
pModule->xClose(pVCur);
goto no_mem;
}
break;
}
@@ -6401,9 +6447,8 @@ case OP_VFilter: { /* jump */
}
rc = pModule->xFilter(pVCur, iQuery, pOp->p4.z, nArg, apArg);
sqlite3VtabImportErrmsg(p, pVtab);
if( rc==SQLITE_OK ){
res = pModule->xEof(pVCur);
}
if( rc ) goto abort_due_to_error;
res = pModule->xEof(pVCur);
pCur->nullRow = 0;
VdbeBranchTaken(res!=0,2);
if( res ) goto jump_to_p2;
@@ -6452,6 +6497,7 @@ case OP_VColumn: {
if( sqlite3VdbeMemTooBig(pDest) ){
goto too_big;
}
if( rc ) goto abort_due_to_error;
break;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */
@@ -6487,9 +6533,8 @@ case OP_VNext: { /* jump */
*/
rc = pModule->xNext(pCur->uc.pVCur);
sqlite3VtabImportErrmsg(p, pVtab);
if( rc==SQLITE_OK ){
res = pModule->xEof(pCur->uc.pVCur);
}
if( rc ) goto abort_due_to_error;
res = pModule->xEof(pCur->uc.pVCur);
VdbeBranchTaken(!res,2);
if( !res ){
/* If there is data, jump to P2 */
@@ -6521,11 +6566,11 @@ case OP_VRename: {
testcase( pName->enc==SQLITE_UTF16BE );
testcase( pName->enc==SQLITE_UTF16LE );
rc = sqlite3VdbeChangeEncoding(pName, SQLITE_UTF8);
if( rc==SQLITE_OK ){
rc = pVtab->pModule->xRename(pVtab, pName->z);
sqlite3VtabImportErrmsg(p, pVtab);
p->expired = 0;
}
if( rc ) goto abort_due_to_error;
rc = pVtab->pModule->xRename(pVtab, pName->z);
sqlite3VtabImportErrmsg(p, pVtab);
p->expired = 0;
if( rc ) goto abort_due_to_error;
break;
}
#endif
@@ -6574,7 +6619,7 @@ case OP_VUpdate: {
pVtab = pOp->p4.pVtab->pVtab;
if( pVtab==0 || NEVER(pVtab->pModule==0) ){
rc = SQLITE_LOCKED;
break;
goto abort_due_to_error;
}
pModule = pVtab->pModule;
nArg = pOp->p2;
@@ -6606,6 +6651,7 @@ case OP_VUpdate: {
}else{
p->nChange++;
}
if( rc ) goto abort_due_to_error;
}
break;
}
@@ -6777,8 +6823,12 @@ default: { /* This is really OP_Noop and OP_Explain */
/* If we reach this point, it means that execution is finished with
** an error of some kind.
*/
vdbe_error_halt:
abort_due_to_error:
if( db->mallocFailed ) rc = SQLITE_NOMEM_BKPT;
assert( rc );
if( p->zErrMsg==0 && rc!=SQLITE_IOERR_NOMEM ){
sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc));
}
p->rc = rc;
testcase( sqlite3GlobalConfig.xLog!=0 );
sqlite3_log(rc, "statement aborts at %d: [%s] %s",
@@ -6809,7 +6859,7 @@ vdbe_return:
too_big:
sqlite3VdbeError(p, "string or blob too big");
rc = SQLITE_TOOBIG;
goto vdbe_error_halt;
goto abort_due_to_error;
/* Jump to here if a malloc() fails.
*/
@@ -6817,18 +6867,7 @@ no_mem:
sqlite3OomFault(db);
sqlite3VdbeError(p, "out of memory");
rc = SQLITE_NOMEM_BKPT;
goto vdbe_error_halt;
/* Jump to here for any other kind of fatal error. The "rc" variable
** should hold the error number.
*/
abort_due_to_error:
assert( p->zErrMsg==0 );
if( db->mallocFailed ) rc = SQLITE_NOMEM_BKPT;
if( rc!=SQLITE_IOERR_NOMEM ){
sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc));
}
goto vdbe_error_halt;
goto abort_due_to_error;
/* Jump to here if the sqlite3_interrupt() API sets the interrupt
** flag.
@@ -6838,5 +6877,5 @@ abort_due_to_interrupt:
rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT;
p->rc = rc;
sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc));
goto vdbe_error_halt;
goto abort_due_to_error;
}
+2 -1
View File
@@ -161,6 +161,7 @@ struct VdbeFrame {
VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */
void *token; /* Copy of SubProgram.token */
i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
AuxData *pAuxData; /* Linked list of auxdata allocations */
int nCursor; /* Number of entries in apCsr */
int pc; /* Program Counter in parent (calling) frame */
int nOp; /* Size of aOp array */
@@ -443,7 +444,7 @@ u8 sqlite3VdbeOneByteSerialTypeLen(u8);
u32 sqlite3VdbeSerialType(Mem*, int, u32*);
u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32);
u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
void sqlite3VdbeDeleteAuxData(Vdbe*, int, int);
void sqlite3VdbeDeleteAuxData(sqlite3*, AuxData**, int, int);
int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
int sqlite3VdbeIdxKeyCompare(sqlite3*,VdbeCursor*,UnpackedRecord*,int*);
+3
View File
@@ -1301,6 +1301,9 @@ int sqlite3_bind_blob(
int nData,
void (*xDel)(void*)
){
#ifdef SQLITE_ENABLE_API_ARMOR
if( nData<0 ) return SQLITE_MISUSE_BKPT;
#endif
return bindText(pStmt, i, zData, nData, xDel, 0);
}
int sqlite3_bind_blob64(
+32 -14
View File
@@ -1488,6 +1488,7 @@ void sqlite3VdbeFrameDelete(VdbeFrame *p){
sqlite3VdbeFreeCursor(p->v, apCsr[i]);
}
releaseMemArray(aMem, p->nChildMem);
sqlite3VdbeDeleteAuxData(p->v->db, &p->pAuxData, -1, 0);
sqlite3DbFree(p->v->db, p);
}
@@ -2016,6 +2017,9 @@ int sqlite3VdbeFrameRestore(VdbeFrame *pFrame){
v->db->lastRowid = pFrame->lastRowid;
v->nChange = pFrame->nChange;
v->db->nChange = pFrame->nDbChange;
sqlite3VdbeDeleteAuxData(v->db, &v->pAuxData, -1, 0);
v->pAuxData = pFrame->pAuxData;
pFrame->pAuxData = 0;
return pFrame->pc;
}
@@ -2047,7 +2051,7 @@ static void closeAllCursors(Vdbe *p){
}
/* Delete any auxdata allocations made by the VM */
if( p->pAuxData ) sqlite3VdbeDeleteAuxData(p, -1, 0);
if( p->pAuxData ) sqlite3VdbeDeleteAuxData(p->db, &p->pAuxData, -1, 0);
assert( p->pAuxData==0 );
}
@@ -2136,7 +2140,9 @@ int sqlite3VdbeSetColName(
*/
static int vdbeCommit(sqlite3 *db, Vdbe *p){
int i;
int nTrans = 0; /* Number of databases with an active write-transaction */
int nTrans = 0; /* Number of databases with an active write-transaction
** that are candidates for a two-phase commit using a
** master-journal */
int rc = SQLITE_OK;
int needXcommit = 0;
@@ -2164,10 +2170,28 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
for(i=0; rc==SQLITE_OK && i<db->nDb; i++){
Btree *pBt = db->aDb[i].pBt;
if( sqlite3BtreeIsInTrans(pBt) ){
/* Whether or not a database might need a master journal depends upon
** its journal mode (among other things). This matrix determines which
** journal modes use a master journal and which do not */
static const u8 aMJNeeded[] = {
/* DELETE */ 1,
/* PERSIST */ 1,
/* OFF */ 0,
/* TRUNCATE */ 1,
/* MEMORY */ 0,
/* WAL */ 0
};
Pager *pPager; /* Pager associated with pBt */
needXcommit = 1;
if( i!=1 ) nTrans++;
sqlite3BtreeEnter(pBt);
rc = sqlite3PagerExclusiveLock(sqlite3BtreePager(pBt));
pPager = sqlite3BtreePager(pBt);
if( db->aDb[i].safety_level!=PAGER_SYNCHRONOUS_OFF
&& aMJNeeded[sqlite3PagerGetJournalMode(pPager)]
){
assert( i!=1 );
nTrans++;
}
rc = sqlite3PagerExclusiveLock(pPager);
sqlite3BtreeLeave(pBt);
}
}
@@ -2225,7 +2249,6 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
#ifndef SQLITE_OMIT_DISKIO
else{
sqlite3_vfs *pVfs = db->pVfs;
int needSync = 0;
char *zMaster = 0; /* File-name for the master journal */
char const *zMainFile = sqlite3BtreeGetFilename(db->aDb[0].pBt);
sqlite3_file *pMaster = 0;
@@ -2285,9 +2308,6 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
continue; /* Ignore TEMP and :memory: databases */
}
assert( zFile[0]!=0 );
if( !needSync && !sqlite3BtreeSyncDisabled(pBt) ){
needSync = 1;
}
rc = sqlite3OsWrite(pMaster, zFile, sqlite3Strlen30(zFile)+1, offset);
offset += sqlite3Strlen30(zFile)+1;
if( rc!=SQLITE_OK ){
@@ -2302,8 +2322,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
/* Sync the master journal file. If the IOCAP_SEQUENTIAL device
** flag is set this is not required.
*/
if( needSync
&& 0==(sqlite3OsDeviceCharacteristics(pMaster)&SQLITE_IOCAP_SEQUENTIAL)
if( 0==(sqlite3OsDeviceCharacteristics(pMaster)&SQLITE_IOCAP_SEQUENTIAL)
&& SQLITE_OK!=(rc = sqlite3OsSync(pMaster, SQLITE_SYNC_NORMAL))
){
sqlite3OsCloseFree(pMaster);
@@ -2339,7 +2358,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
** doing this the directory is synced again before any individual
** transaction files are deleted.
*/
rc = sqlite3OsDelete(pVfs, zMaster, needSync);
rc = sqlite3OsDelete(pVfs, zMaster, 1);
sqlite3DbFree(db, zMaster);
zMaster = 0;
if( rc ){
@@ -2875,8 +2894,7 @@ int sqlite3VdbeFinalize(Vdbe *p){
** * the corresponding bit in argument mask is clear (where the first
** function parameter corresponds to bit 0 etc.).
*/
void sqlite3VdbeDeleteAuxData(Vdbe *pVdbe, int iOp, int mask){
AuxData **pp = &pVdbe->pAuxData;
void sqlite3VdbeDeleteAuxData(sqlite3 *db, AuxData **pp, int iOp, int mask){
while( *pp ){
AuxData *pAux = *pp;
if( (iOp<0)
@@ -2887,7 +2905,7 @@ void sqlite3VdbeDeleteAuxData(Vdbe *pVdbe, int iOp, int mask){
pAux->xDelete(pAux->pAux);
}
*pp = pAux->pNext;
sqlite3DbFree(pVdbe->db, pAux);
sqlite3DbFree(db, pAux);
}else{
pp= &pAux->pNext;
}
+1 -1
View File
@@ -2297,7 +2297,7 @@ static int vdbeMergeEngineLevel0(
if( pNew==0 ) rc = SQLITE_NOMEM_BKPT;
for(i=0; i<nPMA && rc==SQLITE_OK; i++){
i64 nDummy;
i64 nDummy = 0;
PmaReader *pReadr = &pNew->aReadr[i];
rc = vdbePmaReaderInit(pTask, &pTask->file, iOff, pReadr, &nDummy);
iOff = pReadr->iEof;
+2 -2
View File
@@ -1059,8 +1059,8 @@ FuncDef *sqlite3VtabOverloadFunction(
return pDef;
}
*pNew = *pDef;
pNew->zName = (char *)&pNew[1];
memcpy(pNew->zName, pDef->zName, sqlite3Strlen30(pDef->zName)+1);
pNew->zName = (const char*)&pNew[1];
memcpy((char*)&pNew[1], pDef->zName, sqlite3Strlen30(pDef->zName)+1);
pNew->xSFunc = xSFunc;
pNew->pUserData = pArg;
pNew->funcFlags |= SQLITE_FUNC_EPHEM;
+38 -12
View File
@@ -31,8 +31,8 @@ static int whereLoopResize(sqlite3*, WhereLoop*, int);
/*
** Return the estimated number of output rows from a WHERE clause
*/
u64 sqlite3WhereOutputRowCount(WhereInfo *pWInfo){
return sqlite3LogEstToInt(pWInfo->nRowOut);
LogEst sqlite3WhereOutputRowCount(WhereInfo *pWInfo){
return pWInfo->nRowOut;
}
/*
@@ -3438,6 +3438,7 @@ static const char *wherePathName(WherePath *pPath, int nLoop, WhereLoop *pLast){
** order.
*/
static LogEst whereSortingCost(
WhereInfo *pWInfo,
LogEst nRow,
int nOrderBy,
int nSorted
@@ -3458,7 +3459,15 @@ static LogEst whereSortingCost(
LogEst rScale, rSortCost;
assert( nOrderBy>0 && 66==sqlite3LogEst(100) );
rScale = sqlite3LogEst((nOrderBy-nSorted)*100/nOrderBy) - 66;
rSortCost = nRow + estLog(nRow) + rScale + 16;
rSortCost = nRow + rScale + 16;
/* Multiple by log(M) where M is the number of output rows.
** Use the LIMIT for M if it is smaller */
if( (pWInfo->wctrlFlags & WHERE_USE_LIMIT)!=0 ){
LogEst m = sqlite3LogEst(pWInfo->iLimit);
if( m<nRow ) nRow = m;
}
rSortCost += estLog(nRow);
return rSortCost;
}
@@ -3576,6 +3585,12 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
if( (pWLoop->prereq & ~pFrom->maskLoop)!=0 ) continue;
if( (pWLoop->maskSelf & pFrom->maskLoop)!=0 ) continue;
if( (pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 && pFrom->nRow<10 ){
/* Do not use an automatic index if the this loop is expected
** to run less than 2 times. */
assert( 10==sqlite3LogEst(2) );
continue;
}
/* At this point, pWLoop is a candidate to be the next loop.
** Compute its cost */
rUnsorted = sqlite3LogEstAdd(pWLoop->rSetup,pWLoop->rRun + pFrom->nRow);
@@ -3592,7 +3607,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
if( isOrdered>=0 && isOrdered<nOrderBy ){
if( aSortCost[isOrdered]==0 ){
aSortCost[isOrdered] = whereSortingCost(
nRowEst, nOrderBy, isOrdered
pWInfo, nRowEst, nOrderBy, isOrdered
);
}
rCost = sqlite3LogEstAdd(rUnsorted, aSortCost[isOrdered]);
@@ -3991,7 +4006,8 @@ WhereInfo *sqlite3WhereBegin(
ExprList *pOrderBy, /* An ORDER BY (or GROUP BY) clause, or NULL */
ExprList *pResultSet, /* Result set of the query */
u16 wctrlFlags, /* One of the WHERE_* flags defined in sqliteInt.h */
int iIdxCur /* If WHERE_ONETABLE_ONLY is set, index cursor number */
int iAuxArg /* If WHERE_ONETABLE_ONLY is set, index cursor number,
** If WHERE_USE_LIMIT, then the limit amount */
){
int nByteWInfo; /* Num. bytes allocated for WhereInfo struct */
int nTabList; /* Number of elements in pTabList */
@@ -4012,6 +4028,10 @@ WhereInfo *sqlite3WhereBegin(
&& (wctrlFlags & WHERE_OMIT_OPEN_CLOSE)==0
));
/* Only one of WHERE_ONETABLE_ONLY or WHERE_USE_LIMIT */
assert( (wctrlFlags & WHERE_ONETABLE_ONLY)==0
|| (wctrlFlags & WHERE_USE_LIMIT)==0 );
/* Variable initialization */
db = pParse->db;
memset(&sWLB, 0, sizeof(sWLB));
@@ -4065,6 +4085,7 @@ WhereInfo *sqlite3WhereBegin(
pWInfo->pResultSet = pResultSet;
pWInfo->iBreak = pWInfo->iContinue = sqlite3VdbeMakeLabel(v);
pWInfo->wctrlFlags = wctrlFlags;
pWInfo->iLimit = iAuxArg;
pWInfo->savedNQueryLoop = pParse->nQueryLoop;
assert( pWInfo->eOnePass==ONEPASS_OFF ); /* ONEPASS defaults to OFF */
pMaskSet = &pWInfo->sMaskSet;
@@ -4145,9 +4166,14 @@ WhereInfo *sqlite3WhereBegin(
}
/* Construct the WhereLoop objects */
WHERETRACE(0xffff,("*** Optimizer Start *** (wctrlFlags: 0x%x)\n",
wctrlFlags));
#if defined(WHERETRACE_ENABLED)
if( sqlite3WhereTrace & 0xffff ){
sqlite3DebugPrintf("*** Optimizer Start *** (wctrlFlags: 0x%x",wctrlFlags);
if( wctrlFlags & WHERE_USE_LIMIT ){
sqlite3DebugPrintf(", limit: %d", iAuxArg);
}
sqlite3DebugPrintf(")\n");
}
if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */
int i;
for(i=0; i<sWLB.pWC->nTerm; i++){
@@ -4330,8 +4356,8 @@ WhereInfo *sqlite3WhereBegin(
Index *pIx = pLoop->u.btree.pIndex;
int iIndexCur;
int op = OP_OpenRead;
/* iIdxCur is always set if to a positive value if ONEPASS is possible */
assert( iIdxCur!=0 || (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 );
/* iAuxArg is always set if to a positive value if ONEPASS is possible */
assert( iAuxArg!=0 || (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 );
if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIx)
&& (wctrlFlags & WHERE_ONETABLE_ONLY)!=0
){
@@ -4341,7 +4367,7 @@ WhereInfo *sqlite3WhereBegin(
op = 0;
}else if( pWInfo->eOnePass!=ONEPASS_OFF ){
Index *pJ = pTabItem->pTab->pIndex;
iIndexCur = iIdxCur;
iIndexCur = iAuxArg;
assert( wctrlFlags & WHERE_ONEPASS_DESIRED );
while( ALWAYS(pJ) && pJ!=pIx ){
iIndexCur++;
@@ -4349,8 +4375,8 @@ WhereInfo *sqlite3WhereBegin(
}
op = OP_OpenWrite;
pWInfo->aiCurOnePass[1] = iIndexCur;
}else if( iIdxCur && (wctrlFlags & WHERE_ONETABLE_ONLY)!=0 ){
iIndexCur = iIdxCur;
}else if( iAuxArg && (wctrlFlags & WHERE_ONETABLE_ONLY)!=0 ){
iIndexCur = iAuxArg;
if( wctrlFlags & WHERE_REOPEN_IDX ) op = OP_ReopenIdx;
}else{
iIndexCur = pParse->nTab++;
+1
View File
@@ -412,6 +412,7 @@ struct WhereInfo {
WhereLoop *pLoops; /* List of all WhereLoop objects */
Bitmask revMask; /* Mask of ORDER BY terms that need reversing */
LogEst nRowOut; /* Estimated number of output rows */
LogEst iLimit; /* LIMIT if wctrlFlags has WHERE_USE_LIMIT */
u16 wctrlFlags; /* Flags originally passed to sqlite3WhereBegin() */
i8 nOBSat; /* Number of ORDER BY terms satisfied by indices */
u8 sorted; /* True if really sorted (not just grouped) */
+16 -10
View File
@@ -1212,16 +1212,22 @@ Bitmask sqlite3WhereCodeOneLoopStart(
start_constraints = 1;
}
codeApplyAffinity(pParse, regBase, nConstraint - bSeekPastNull, zStartAff);
op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];
assert( op!=0 );
sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
VdbeCoverage(v);
VdbeCoverageIf(v, op==OP_Rewind); testcase( op==OP_Rewind );
VdbeCoverageIf(v, op==OP_Last); testcase( op==OP_Last );
VdbeCoverageIf(v, op==OP_SeekGT); testcase( op==OP_SeekGT );
VdbeCoverageIf(v, op==OP_SeekGE); testcase( op==OP_SeekGE );
VdbeCoverageIf(v, op==OP_SeekLE); testcase( op==OP_SeekLE );
VdbeCoverageIf(v, op==OP_SeekLT); testcase( op==OP_SeekLT );
if( pLoop->nSkip>0 && nConstraint==pLoop->nSkip ){
/* The skip-scan logic inside the call to codeAllEqualityConstraints()
** above has already left the cursor sitting on the correct row,
** so no further seeking is needed */
}else{
op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];
assert( op!=0 );
sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
VdbeCoverage(v);
VdbeCoverageIf(v, op==OP_Rewind); testcase( op==OP_Rewind );
VdbeCoverageIf(v, op==OP_Last); testcase( op==OP_Last );
VdbeCoverageIf(v, op==OP_SeekGT); testcase( op==OP_SeekGT );
VdbeCoverageIf(v, op==OP_SeekGE); testcase( op==OP_SeekGE );
VdbeCoverageIf(v, op==OP_SeekLE); testcase( op==OP_SeekLE );
VdbeCoverageIf(v, op==OP_SeekLT); testcase( op==OP_SeekLT );
}
/* Load the value for the inequality constraint at the end of the
** range (if any).
+2
View File
@@ -533,6 +533,7 @@ static void exprAnalyzeOrTerm(
if( pOrInfo==0 ) return;
pTerm->wtFlags |= TERM_ORINFO;
pOrWc = &pOrInfo->wc;
memset(pOrWc->aStatic, 0, sizeof(pOrWc->aStatic));
sqlite3WhereClauseInit(pOrWc, pWInfo);
sqlite3WhereSplit(pOrWc, pExpr, TK_OR);
sqlite3WhereExprAnalyze(pSrc, pOrWc);
@@ -559,6 +560,7 @@ static void exprAnalyzeOrTerm(
pOrTerm->wtFlags |= TERM_ANDINFO;
pOrTerm->eOperator = WO_AND;
pAndWC = &pAndInfo->wc;
memset(pAndWC->aStatic, 0, sizeof(pAndWC->aStatic));
sqlite3WhereClauseInit(pAndWC, pWC->pWInfo);
sqlite3WhereSplit(pAndWC, pOrTerm->pExpr, TK_AND);
sqlite3WhereExprAnalyze(pSrc, pAndWC);
+6 -1
View File
@@ -218,10 +218,15 @@ do_execsql_test autoindex2-120 {
AND t1.did = t2.did
AND t2.uid = t3.uid
ORDER BY t1.ptime desc LIMIT 500;
} {0 0 0 {SEARCH TABLE t1 USING INDEX t1x1 (ptime>?)} 0 1 1 {SEARCH TABLE t2 USING INDEX t2x0 (did=?)} 0 2 2 {SEARCH TABLE t3 USING INDEX t3x0 (uid=?)}}
} {~/AUTO/}
#
# ^^^--- Before being fixed, the above was using an automatic covering
# on t3 and reordering the tables so that t3 was in the outer loop and
# implementing the ORDER BY clause using a B-Tree.
#
# This test is sanitized data received from a user. The original unsanitized
# data and STAT4 data is found in the th3private test repository. See one of
# the th3private check-ins on 2016-02-25. The test is much more accurate when
# STAT4 data is used.
finish_test
+31
View File
@@ -89,5 +89,36 @@ do_test 4.3 {
db eval {SELECT b FROM t1}
} {2 4 8}
#-------------------------------------------------------------------------
# Test that indexes with large numbers of columns can be correctly
# identified as covering indexes.
reset_db
set L [list]
for {set i 1} {$i<120} {incr i} {
lappend L "c$i"
}
set cols [join $L ,]
do_execsql_test 5.1.0 "
CREATE TABLE t1(a, b, c, $cols, PRIMARY KEY(a, b, c)) WITHOUT ROWID;
CREATE INDEX i1 ON t1($cols);
CREATE TABLE t2(i INTEGER PRIMARY KEY, $cols);
CREATE INDEX i2 ON t2($cols);
"
do_eqp_test 5.1.1 {
SELECT * FROM t1 ORDER BY c1, c2;
} {
0 0 0 {SCAN TABLE t1 USING COVERING INDEX i1}
}
do_eqp_test 5.1.2 {
SELECT * FROM t2 ORDER BY c1, c2;
} {
0 0 0 {SCAN TABLE t2 USING COVERING INDEX i2}
}
finish_test
+7 -6
View File
@@ -70,6 +70,7 @@
#include <stdarg.h>
#include <ctype.h>
#include "sqlite3.h"
#include <assert.h>
#define ISSPACE(X) isspace((unsigned char)(X))
#define ISDIGIT(X) isdigit((unsigned char)(X))
@@ -621,12 +622,14 @@ static void inmemVfsRegister(void){
*/
static void runSql(sqlite3 *db, const char *zSql, unsigned runFlags){
const char *zMore;
const char *zEnd = &zSql[strlen(zSql)];
sqlite3_stmt *pStmt;
while( zSql && zSql[0] ){
zMore = 0;
pStmt = 0;
sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zMore);
assert( zMore<=zEnd );
if( zMore==zSql ) break;
if( runFlags & SQL_TRACE ){
const char *z = zSql;
@@ -784,8 +787,7 @@ static void showHelp(void){
" --export-db DIR Write databases to files(s) in DIR. Works with --dbid\n"
" --export-sql DIR Write SQL to file(s) in DIR. Also works with --sqlid\n"
" --help Show this help text\n"
" -q Reduced output\n"
" --quiet Reduced output\n"
" -q|--quiet Reduced output\n"
" --limit-mem N Limit memory used by test SQLite instance to N bytes\n"
" --limit-vdbe Panic if an sync SQL runs for more than 100,000 cycles\n"
" --load-sql ARGS... Load SQL scripts fro files into SOURCE-DB\n"
@@ -796,8 +798,7 @@ static void showHelp(void){
" --result-trace Show the results of each SQL command\n"
" --sqlid N Use only SQL where sqlid=N\n"
" --timeout N Abort if any single test case needs more than N seconds\n"
" -v Increased output\n"
" --verbose Increased output\n"
" -v|--verbose Increased output. Repeat for more output.\n"
);
}
@@ -920,8 +921,8 @@ int main(int argc, char **argv){
}else
if( strcmp(z,"verbose")==0 || strcmp(z,"v")==0 ){
quietFlag = 0;
verboseFlag = 1;
runFlags |= SQL_TRACE;
verboseFlag++;
if( verboseFlag>1 ) runFlags |= SQL_TRACE;
}else
{
fatalError("unknown option: %s", argv[i]);
+1 -1
View File
@@ -319,7 +319,7 @@ do_test main-3.1 {
sqlite3 db testdb
set v [catch {execsql {SELECT * from T1 where x!!5}} msg]
lappend v $msg
} {1 {unrecognized token: "!!"}}
} {1 {unrecognized token: "!"}}
do_test main-3.2 {
catch {db close}
foreach f [glob -nocomplain testdb/*] {forcedelete $f}
+1 -1
View File
@@ -699,7 +699,7 @@ do_catchsql_test misc1-23.3 {
#
do_test misc1-24.0 {
list [catch { sqlite3_prepare_v2 db ! -1 dummy } msg] $msg
} {1 {(1) unrecognized token: "!}}
} {1 {(1) unrecognized token: "!"}}
# The following query (provided by Kostya Serebryany) used to take 25
# minutes to prepare. This has been speeded up to about 250 milliseconds.
+74 -18
View File
@@ -529,6 +529,7 @@ set pwd [get_pwd]
testvfs tv -default 1
tv script copy_on_mj_delete
set ::mj_filename_length 0
set ::mj_delete_cnt 0
proc copy_on_mj_delete {method filename args} {
if {[string match *mj* [file tail $filename]]} {
#
@@ -542,6 +543,7 @@ proc copy_on_mj_delete {method filename args} {
set ::mj_filename_length [string length $filename]
}
faultsim_save
incr ::mj_delete_cnt
}
return SQLITE_OK
}
@@ -579,29 +581,68 @@ foreach {tn1 tcl} {
}
} {
eval $tcl
foreach {tn2 sql} {
foreach {tn2 sql usesMJ} {
o {
PRAGMA main.synchronous=OFF;
PRAGMA aux.synchronous=OFF;
PRAGMA journal_mode = DELETE;
}
} 0
o512 {
PRAGMA main.synchronous=OFF;
PRAGMA aux.synchronous=OFF;
PRAGMA main.page_size = 512;
PRAGMA aux.page_size = 512;
PRAGMA journal_mode = DELETE;
}
} 0
n {
PRAGMA main.synchronous=NORMAL;
PRAGMA aux.synchronous=NORMAL;
PRAGMA journal_mode = DELETE;
}
} 1
f {
PRAGMA main.synchronous=FULL;
PRAGMA aux.synchronous=FULL;
PRAGMA journal_mode = DELETE;
}
} 1
w1 {
PRAGMA main.synchronous=NORMAL;
PRAGMA aux.synchronous=NORMAL;
PRAGMA journal_mode = WAL;
} 0
w2 {
PRAGMA main.synchronous=NORMAL;
PRAGMA aux.synchronous=NORMAL;
PRAGMA main.journal_mode=DELETE;
PRAGMA aux.journal_mode=WAL;
} 0
o1a {
PRAGMA main.synchronous=FULL;
PRAGMA aux.synchronous=OFF;
PRAGMA journal_mode=DELETE;
} 0
o1b {
PRAGMA main.synchronous=OFF;
PRAGMA aux.synchronous=NORMAL;
PRAGMA journal_mode=DELETE;
} 0
m1 {
PRAGMA main.synchronous=NORMAL;
PRAGMA aux.synchronous=NORMAL;
PRAGMA main.journal_mode=DELETE;
PRAGMA aux.journal_mode = MEMORY;
} 0
t1 {
PRAGMA main.synchronous=NORMAL;
PRAGMA aux.synchronous=NORMAL;
PRAGMA main.journal_mode=DELETE;
PRAGMA aux.journal_mode = TRUNCATE;
} 1
p1 {
PRAGMA main.synchronous=NORMAL;
PRAGMA aux.synchronous=NORMAL;
PRAGMA main.journal_mode=DELETE;
PRAGMA aux.journal_mode = PERSIST;
} 1
} {
set tn "${tn1}.${tn2}"
@@ -613,6 +654,7 @@ foreach {tn1 tcl} {
#
tv filter xDelete
do_test pager1-4.4.$tn.1 {
set ::mj_delete_cnt 0
faultsim_delete_and_reopen $prefix
execsql "
ATTACH '${prefix}2' AS aux;
@@ -634,6 +676,13 @@ foreach {tn1 tcl} {
}
} {}
tv filter {}
# Verify that a master journal was deleted only for those cases where
# master journals really ought to be used
#
do_test pager1-4.4.$tn.1b {
set ::mj_delete_cnt
} $usesMJ
# Check that the transaction was committed successfully.
#
@@ -644,25 +693,33 @@ foreach {tn1 tcl} {
SELECT * FROM b
} {won too free double-you why zed}
# Restore the file-system and reopen the databases. Check that it now
# appears that the transaction was not committed (because the file-system
# was restored to the state where it had not been).
#
do_test pager1-4.4.$tn.4 {
faultsim_restore_and_reopen $prefix
execsql "ATTACH '${prefix}2' AS aux"
} {}
do_execsql_test pager1-4.4.$tn.5 {SELECT * FROM a} {double-you why zed}
do_execsql_test pager1-4.4.$tn.6 {SELECT * FROM b} {won too free}
if {$usesMJ} {
# Restore the file-system and reopen the databases. Check that it now
# appears that the transaction was not committed (because the file-system
# was restored to the state where it had not been).
#
do_test pager1-4.4.$tn.4 {
faultsim_restore_and_reopen $prefix
execsql "ATTACH '${prefix}2' AS aux"
} {}
do_execsql_test pager1-4.4.$tn.5 {SELECT * FROM a} {double-you why zed}
do_execsql_test pager1-4.4.$tn.6 {SELECT * FROM b} {won too free}
}
# Restore the file-system again. This time, before reopening the databases,
# delete the master-journal file from the file-system. It now appears that
# the transaction was committed (no master-journal file == no rollback).
#
do_test pager1-4.4.$tn.7 {
faultsim_restore_and_reopen $prefix
foreach f [glob ${prefix}-mj*] { forcedelete $f }
if {$::mj_delete_cnt>0} {
faultsim_restore_and_reopen $prefix
foreach f [glob ${prefix}-mj*] { forcedelete $f }
} else {
db close
sqlite3 db $prefix
}
execsql "ATTACH '${prefix}2' AS aux"
glob -nocomplain ${prefix}-mj*
} {}
do_execsql_test pager1-4.4.$tn.8 {
SELECT * FROM a
@@ -678,7 +735,6 @@ db close
tv delete
forcedelete $dirname
# Set up a VFS to make a copy of the file-system just before deleting a
# journal file to commit a transaction. The transaction modifies exactly
# two database pages (and page 1 - the change counter).
+125
View File
@@ -0,0 +1,125 @@
# 2016 February 19
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# This file implements tests for the REGEXP operator in ext/misc/regexp.c.
# It focuses on the use of the sqlite3_set_auxdata()/get_auxdata() APIs.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix regexp2
load_static_extension db regexp
#-------------------------------------------------------------------------
# Test that triggers do not become confused and use aux-data created by
# a different trigger for a different REGEXP invocation.
#
do_execsql_test 1.0 {
CREATE TABLE t1(a, b, c);
CREATE TABLE x1(x, y, z);
CREATE TABLE x2(x, y, z);
CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN
INSERT INTO x1 VALUES(
new.a REGEXP 'abc',
new.b REGEXP 'abc',
new.c REGEXP 'abc'
);
END;
CREATE TRIGGER tr2 AFTER INSERT ON t1 BEGIN
INSERT INTO x2 VALUES(
new.a REGEXP 'def',
new.b REGEXP 'def',
new.c REGEXP 'def'
);
END;
INSERT INTO t1 VALUES('abc', 'def', 'abc');
SELECT * FROM t1;
} {abc def abc}
do_execsql_test 1.1 { SELECT * FROM x1 } {1 0 1}
do_execsql_test 1.2 { SELECT * FROM x2 } {0 1 0}
#-------------------------------------------------------------------------
# Test that if an exception is thrown several triggers deep, all aux-data
# objects are cleaned up correctly.
#
proc sql_error {} {
error "SQL error!"
}
db func error sql_error
do_execsql_test 2.0 {
CREATE TABLE t2(a, b);
CREATE TABLE t3(c, d);
CREATE TABLE t4(e, f);
CREATE TRIGGER t2_tr1 AFTER UPDATE ON t2 BEGIN
UPDATE t3 SET d = new.b WHERE c = old.a;
END;
CREATE TRIGGER t3_tr1 AFTER UPDATE ON t3 BEGIN
UPDATE t4 SET f = new.d WHERE e = old.c AND new.d REGEXP 'a.*';
END;
CREATE TRIGGER t4_tr1 AFTER UPDATE ON t4 BEGIN
SELECT CASE WHEN new.f REGEXP '.*y.*' THEN error() ELSE 1 END;
END;
INSERT INTO t2 VALUES(1, 'a_x_1');
INSERT INTO t2 VALUES(2, 'a_y_1');
INSERT INTO t3 VALUES(1, 'b1');
INSERT INTO t3 VALUES(2, 'b2');
INSERT INTO t4 VALUES(1, 'b1');
INSERT INTO t4 VALUES(2, 'b2');
} {}
do_catchsql_test 2.1 {
UPDATE t2 SET a=a+1 WHERE b REGEXP 'a.*' AND b REGEXP '.*1';
} {1 {SQL error!}}
# Test that the triggers used in the test above work as expected.
#
do_execsql_test 2.2 {
UPDATE t2 SET b = 'a_abc_1';
} {}
do_execsql_test 2.3 {
SELECT * FROM t2;
SELECT * FROM t3;
SELECT * FROM t4;
} {1 a_abc_1 2 a_abc_1 1 a_abc_1 2 a_abc_1 1 a_abc_1 2 a_abc_1}
#-------------------------------------------------------------------------
# Test that trigger parameters (i.e. new.* and old.*) refs are not
# considered to be constant across separate invocations of the trigger.
#
do_execsql_test 3.0 {
CREATE TABLE t5(a);
CREATE TABLE t6(x);
CREATE TRIGGER t5tr AFTER DELETE ON t5 BEGIN
DELETE FROM t6 WHERE t6.x REGEXP old.a;
END;
INSERT INTO t5 VALUES ('^a.*'), ('^b.*'), ('^c.*');
INSERT INTO t6 VALUES ('eab'), ('abc'), ('bcd'), ('cde'), ('dea');
DELETE FROM t5;
SELECT * FROM t6;
} {eab dea}
finish_test
+3
View File
@@ -1196,6 +1196,9 @@ int main(int argc, char **argv){
int i; /* Loop counter */
int rc; /* API return code */
/* Display the version of SQLite being tested */
printf("Speedtest1 for SQLite %s %.50s\n", sqlite3_libversion(), sqlite3_sourceid());
/* Process command-line arguments */
g.zWR = "";
g.zNN = "";
+96 -23
View File
@@ -22,7 +22,7 @@ REM
REM Example:
REM
REM CD /D C:\dev\sqlite\core
REM tool\build-all-msvc.bat C:\Temp
REM CALL tool\build-all-msvc.bat C:\Temp
REM
REM In the example above, "C:\dev\sqlite\core" represents the root of the
REM source tree for SQLite and "C:\Temp" represents the final destination
@@ -54,6 +54,11 @@ REM
REM There are a few other environment variables that impact the build process
REM when set ^(to anything^), they are:
REM
REM USE_AUTOCONF_MAKEFILE
REM
REM When set, the "autoconf" Makefile for MSVC will be used instead of the main
REM Makefile for MSVC. It must exist at "%ROOT%\autoconf\Makefile.msc".
REM
REM NOCLEAN
REM
REM When set, the "clean" target will not be used during each build iteration.
@@ -69,6 +74,11 @@ REM be skipped and they will not appear in the final destination directory.
REM Setting this environment variable is never strictly needed and could cause
REM issues in some circumstances; therefore, setting it is not recommended.
REM
REM NOMEMDEBUG
REM
REM When set, disables use of MEMDEBUG when building binaries for the "Debug"
REM configuration.
REM
REM BUILD_ALL_SHELL
REM
REM When set, the command line shell will be built for each selected platform
@@ -88,17 +98,30 @@ REM on the WindowsSdkDir environment variable. It causes this batch script to
REM assume the Windows 10.0 SDK location should be used.
REM
REM NMAKE_ARGS
REM NMAKE_ARGS_DEBUG
REM NMAKE_ARGS_RETAIL
REM
REM When set, the value is expanded and passed to the NMAKE command line, after
REM its other arguments. This is used to specify additional NMAKE options, for
REM example:
REM When set, these values are expanded and passed to the NMAKE command line,
REM after its other arguments. These may be used to specify additional NMAKE
REM options, for example:
REM
REM SET NMAKE_ARGS=FOR_WINRT=1
REM SET NMAKE_ARGS_DEBUG=MEMDEBUG=1
REM SET NMAKE_ARGS_RETAIL=WIN32HEAP=1
REM
REM Using the above command before running this tool will cause the compiled
REM binaries to target the WinRT environment, which provides a subset of the
REM Win32 API.
REM
REM DLL_FILE_NAME
REM DLL_PDB_FILE_NAME
REM LIB_FILE_NAME
REM EXE_FILE_NAME
REM EXE_PDB_FILE_NAME
REM
REM When set, these values will override the associated target file name used
REM for the build.
REM
SETLOCAL
REM SET __ECHO=ECHO
@@ -204,11 +227,17 @@ REM NOTE: If the command used to invoke NMAKE is not already set, use the
REM default.
REM
IF NOT DEFINED NMAKE_CMD (
SET NMAKE_CMD=nmake -B -f Makefile.msc
IF DEFINED USE_AUTOCONF_MAKEFILE (
SET NMAKE_CMD=nmake -B -f autoconf\Makefile.msc
) ELSE (
SET NMAKE_CMD=nmake -B -f Makefile.msc
)
)
%_VECHO% NmakeCmd = '%NMAKE_CMD%'
%_VECHO% NmakeArgs = '%NMAKE_ARGS%'
%_VECHO% NmakeArgsDebug = '%NMAKE_ARGS_DEBUG%'
%_VECHO% NmakeArgsRetail = '%NMAKE_ARGS_RETAIL%'
REM
REM NOTE: Setup environment variables to translate between the MSVC platform
@@ -255,6 +284,30 @@ IF NOT DEFINED %TCLSH_FILE%_PATH (
GOTO errors
)
REM
REM NOTE: Setup the default names for the build targets we are creating. Any
REM ^(or all^) of these may end up being overridden.
REM
IF NOT DEFINED DLL_FILE_NAME (
SET DLL_FILE_NAME=sqlite3.dll
)
IF NOT DEFINED DLL_PDB_FILE_NAME (
SET DLL_PDB_FILE_NAME=sqlite3.pdb
)
IF NOT DEFINED LIB_FILE_NAME (
SET LIB_FILE_NAME=sqlite3.lib
)
IF NOT DEFINED EXE_FILE_NAME (
SET EXE_FILE_NAME=sqlite3.exe
)
IF NOT DEFINED EXE_PDB_FILE_NAME (
SET EXE_PDB_FILE_NAME=sqlite3sh.pdb
)
REM
REM NOTE: Set the TOOLPATH variable to contain all the directories where the
REM external tools were found in the search above.
@@ -434,12 +487,20 @@ FOR %%P IN (%PLATFORMS%) DO (
REM NOTE: Setting this to non-zero should enable the SQLITE_MEMDEBUG
REM define.
REM
SET MEMDEBUG=1
IF NOT DEFINED NOMEMDEBUG (
SET MEMDEBUG=1
)
) ELSE (
CALL :fn_UnsetVariable DEBUG
CALL :fn_UnsetVariable MEMDEBUG
)
REM
REM NOTE: Copy the extra NMAKE arguments for this configuration into the
REM common variable used by the actual commands.
REM
CALL :fn_CopyVariable NMAKE_ARGS_%%B NMAKE_ARGS_CFG
REM
REM NOTE: Launch a nested command shell to perform the following steps:
REM
@@ -546,7 +607,7 @@ FOR %%P IN (%PLATFORMS%) DO (
REM file, etc.
REM
IF NOT DEFINED NOCLEAN (
%__ECHO% %NMAKE_CMD% clean
CALL :fn_MakeClean %%D
IF ERRORLEVEL 1 (
ECHO Failed to clean for platform %%P.
@@ -559,7 +620,7 @@ FOR %%P IN (%PLATFORMS%) DO (
REM specifically wanting to build for each platform.
REM
%_AECHO% Cleaning final core library output files only...
%__ECHO% DEL /Q *.lo sqlite3.dll sqlite3.lib sqlite3.pdb 2%REDIRECT% NUL
%__ECHO% DEL /Q *.lo "%DLL_FILE_NAME%" "%LIB_FILE_NAME%" "%DLL_PDB_FILE_NAME%" 2%REDIRECT% NUL
)
REM
@@ -569,10 +630,10 @@ FOR %%P IN (%PLATFORMS%) DO (
REM Also, disable looking for and/or linking to the native Tcl
REM runtime library.
REM
%__ECHO% %NMAKE_CMD% sqlite3.dll XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS%
CALL :fn_MakeDll %%D
IF ERRORLEVEL 1 (
ECHO Failed to build %%B "sqlite3.dll" for platform %%P.
ECHO Failed to build %%B "%DLL_FILE_NAME%" for platform %%P.
GOTO errors
)
@@ -580,10 +641,10 @@ FOR %%P IN (%PLATFORMS%) DO (
REM NOTE: Copy the "sqlite3.dll" file to the appropriate directory for
REM the build and platform beneath the binary directory.
REM
%__ECHO% XCOPY sqlite3.dll "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
%__ECHO% XCOPY "%DLL_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
IF ERRORLEVEL 1 (
ECHO Failed to copy "sqlite3.dll" to "%BINARYDIRECTORY%\%%B\%%D\".
ECHO Failed to copy "%DLL_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\".
GOTO errors
)
@@ -591,10 +652,10 @@ FOR %%P IN (%PLATFORMS%) DO (
REM NOTE: Copy the "sqlite3.lib" file to the appropriate directory for
REM the build and platform beneath the binary directory.
REM
%__ECHO% XCOPY sqlite3.lib "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
%__ECHO% XCOPY "%LIB_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
IF ERRORLEVEL 1 (
ECHO Failed to copy "sqlite3.lib" to "%BINARYDIRECTORY%\%%B\%%D\".
ECHO Failed to copy "%LIB_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\".
GOTO errors
)
@@ -604,10 +665,10 @@ FOR %%P IN (%PLATFORMS%) DO (
REM are prevented from doing so.
REM
IF NOT DEFINED NOSYMBOLS (
%__ECHO% XCOPY sqlite3.pdb "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
%__ECHO% XCOPY "%DLL_PDB_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
IF ERRORLEVEL 1 (
ECHO Failed to copy "sqlite3.pdb" to "%BINARYDIRECTORY%\%%B\%%D\".
ECHO Failed to copy "%DLL_PDB_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\".
GOTO errors
)
)
@@ -627,7 +688,7 @@ FOR %%P IN (%PLATFORMS%) DO (
REM specifically wanting to build for each platform.
REM
%_AECHO% Cleaning final shell executable output files only...
%__ECHO% DEL /Q sqlite3.exe sqlite3sh.pdb 2%REDIRECT% NUL
%__ECHO% DEL /Q "%EXE_FILE_NAME%" "%EXE_PDB_FILE_NAME%" 2%REDIRECT% NUL
)
REM
@@ -637,10 +698,10 @@ FOR %%P IN (%PLATFORMS%) DO (
REM Also, disable looking for and/or linking to the native Tcl
REM runtime library.
REM
%__ECHO% %NMAKE_CMD% sqlite3.exe XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS%
CALL :fn_MakeExe %%D
IF ERRORLEVEL 1 (
ECHO Failed to build %%B "sqlite3.exe" for platform %%P.
ECHO Failed to build %%B "%EXE_FILE_NAME%" for platform %%P.
GOTO errors
)
@@ -648,10 +709,10 @@ FOR %%P IN (%PLATFORMS%) DO (
REM NOTE: Copy the "sqlite3.exe" file to the appropriate directory
REM for the build and platform beneath the binary directory.
REM
%__ECHO% XCOPY sqlite3.exe "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
%__ECHO% XCOPY "%EXE_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
IF ERRORLEVEL 1 (
ECHO Failed to copy "sqlite3.exe" to "%BINARYDIRECTORY%\%%B\%%D\".
ECHO Failed to copy "%EXE_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\".
GOTO errors
)
@@ -661,10 +722,10 @@ FOR %%P IN (%PLATFORMS%) DO (
REM unless we are prevented from doing so.
REM
IF NOT DEFINED NOSYMBOLS (
%__ECHO% XCOPY sqlite3sh.pdb "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
%__ECHO% XCOPY "%EXE_PDB_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
IF ERRORLEVEL 1 (
ECHO Failed to copy "sqlite3sh.pdb" to "%BINARYDIRECTORY%\%%B\%%D\".
ECHO Failed to copy "%EXE_PDB_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\".
GOTO errors
)
)
@@ -696,6 +757,18 @@ REM NOTE: If we get to this point, we have succeeded.
REM
GOTO no_errors
:fn_MakeClean
%__ECHO% %NMAKE_CMD% clean "PLATFORM=%1" XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% %NMAKE_ARGS_CFG%
GOTO :EOF
:fn_MakeDll
%__ECHO% %NMAKE_CMD% "%DLL_FILE_NAME%" "PLATFORM=%1" XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% %NMAKE_ARGS_CFG%
GOTO :EOF
:fn_MakeExe
%__ECHO% %NMAKE_CMD% "%EXE_FILE_NAME%" "PLATFORM=%1" XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% %NMAKE_ARGS_CFG%
GOTO :EOF
:fn_ShowVariable
SETLOCAL
SET __ECHO_CMD=ECHO %%%2%%
-4
View File
@@ -87,10 +87,6 @@
%%
/************* End control #defines *******************************************/
/* The yyzerominor constant is used to initialize instances of
** YYMINORTYPE objects to zero. */
static const YYMINORTYPE yyzerominor = { 0 };
/* Define the yytestcase() macro to be a no-op if is not already defined
** otherwise.
**
+1
View File
@@ -92,6 +92,7 @@ foreach i [lsort -integer [array names blocks]] {
set data [string map [list " -I\$(TOP)\\src" ""] $data]
set data [string map [list " /DEF:sqlite3.def" ""] $data]
set data [string map [list " sqlite3.def" ""] $data]
set data [string map [list " libsqlite3.lib" ""] $data]
set data [string map [list " \$(ALL_TCL_TARGETS)" ""] $data]
set data [string map [list "\$(TOP)\\src\\" "\$(TOP)\\"] $data]
+1 -1
View File
@@ -463,7 +463,7 @@ if {[string equal $packageFlavor WinRT]} then {
}
set shortName $shortNames($packageFlavor,$vsVersion)
set displayName $displayNames($packageFlavor,$vsVersion)
set targetPlatformIdentifier UWP
set targetPlatformIdentifier UAP; # NOTE: Not "UWP".
set targetPlatformVersion v0.8.0.0
set minVsVersion [getMinVsVersionXmlChunk $vsVersion]
set maxPlatformVersion \