Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c5c1507612 | |||
| 2396fce54e | |||
| 341b20fb12 | |||
| e18ec6acc2 | |||
| bce50c734b | |||
| e82126c9d0 | |||
| fb02bad04f | |||
| 5ec04f0943 | |||
| a93cd623cf | |||
| b1e8d31edf | |||
| 45a0e4eb59 | |||
| 9b88ace822 | |||
| 9e2cfad18a | |||
| 557d0383ff |
@@ -472,20 +472,24 @@ CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
|
||||
# when linking.
|
||||
#
|
||||
!IFNDEF CORE_LINK_DEP
|
||||
!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
|
||||
!IF $(DYNAMIC_SHELL)!=0
|
||||
CORE_LINK_DEP =
|
||||
!ELSE
|
||||
!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
|
||||
CORE_LINK_DEP = sqlite3.def
|
||||
!ELSE
|
||||
CORE_LINK_DEP =
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# These are additional linker options used for the core library.
|
||||
#
|
||||
!IFNDEF CORE_LINK_OPTS
|
||||
!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
|
||||
!IF $(DYNAMIC_SHELL)!=0
|
||||
CORE_LINK_OPTS =
|
||||
!ELSE
|
||||
!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
|
||||
CORE_LINK_OPTS = /DEF:sqlite3.def
|
||||
!ELSE
|
||||
CORE_LINK_OPTS =
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
@@ -1387,11 +1391,11 @@ all: dll libsqlite3.lib shell $(ALL_TCL_TARGETS)
|
||||
|
||||
# Dynamic link library section.
|
||||
#
|
||||
dll: $(SQLITE3DLL)
|
||||
dll: $(SQLITE3DLL)
|
||||
|
||||
# Shell executable.
|
||||
#
|
||||
shell: $(SQLITE3EXE)
|
||||
shell: $(SQLITE3EXE)
|
||||
|
||||
# <<mark>>
|
||||
libsqlite3.lib: $(LIBOBJ)
|
||||
@@ -1401,14 +1405,14 @@ libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib
|
||||
$(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCLSTUB) $(TLIBS)
|
||||
# <</mark>>
|
||||
|
||||
$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
|
||||
$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
|
||||
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
|
||||
|
||||
# <<mark>>
|
||||
sqlite3.def: libsqlite3.lib
|
||||
sqlite3.def: libsqlite3.lib
|
||||
echo EXPORTS > sqlite3.def
|
||||
dumpbin /all libsqlite3.lib \
|
||||
| $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3_.*)$$" \1 \
|
||||
| $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3_[^@]*)(?:@\d+)?$$" \1 \
|
||||
| sort >> sqlite3.def
|
||||
# <</mark>>
|
||||
|
||||
@@ -1784,7 +1788,7 @@ parse.c: $(TOP)\src\parse.y lemon.exe $(TOP)\tool\addopcodes.tcl
|
||||
$(SQLITE3H): $(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION
|
||||
$(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > $(SQLITE3H)
|
||||
|
||||
sqlite3ext.h: .target_source
|
||||
sqlite3ext.h: .target_source
|
||||
copy tsrc\sqlite3ext.h .
|
||||
|
||||
mkkeywordhash.exe: $(TOP)\tool\mkkeywordhash.c
|
||||
@@ -1885,9 +1889,9 @@ fts5parse.c: $(TOP)\ext\fts5\fts5parse.y lemon.exe
|
||||
del /Q fts5parse.h 2>NUL
|
||||
.\lemon.exe $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS) $(OPTS) fts5parse.y
|
||||
|
||||
fts5parse.h: fts5parse.c
|
||||
fts5parse.h: fts5parse.c
|
||||
|
||||
fts5.c: $(FTS5_SRC)
|
||||
fts5.c: $(FTS5_SRC)
|
||||
$(TCLSH_CMD) $(TOP)\ext\fts5\tool\mkfts5c.tcl
|
||||
copy $(TOP)\ext\fts5\fts5.h .
|
||||
|
||||
@@ -1928,7 +1932,7 @@ testfixture.exe: $(TESTFIXTURE_SRC) $(SQLITE3H) $(LIBRESOBJS) $(HDR)
|
||||
$(TESTFIXTURE_SRC) \
|
||||
/link $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
|
||||
|
||||
extensiontest: testfixture.exe testloadext.dll
|
||||
extensiontest: testfixture.exe testloadext.dll
|
||||
@set PATH=$(LIBTCLPATH);$(PATH)
|
||||
.\testfixture.exe $(TOP)\test\loadext.test $(TESTOPTS)
|
||||
|
||||
@@ -1971,7 +1975,7 @@ smoketest: $(TESTPROGS)
|
||||
@set PATH=$(LIBTCLPATH);$(PATH)
|
||||
.\testfixture.exe $(TOP)\test\main.test $(TESTOPTS)
|
||||
|
||||
sqlite3_analyzer.c: $(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl
|
||||
sqlite3_analyzer.c: $(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl
|
||||
echo #define TCLSH 2 > $@
|
||||
echo #define SQLITE_ENABLE_DBSTAT_VTAB 1 >> $@
|
||||
copy $@ + $(SQLITE3C) + $(TOP)\src\tclsqlite.c $@
|
||||
@@ -1987,7 +1991,7 @@ sqlite3_analyzer.exe: sqlite3_analyzer.c $(LIBRESOBJS)
|
||||
testloadext.lo: $(TOP)\src\test_loadext.c
|
||||
$(LTCOMPILE) $(NO_WARN) -c $(TOP)\src\test_loadext.c
|
||||
|
||||
testloadext.dll: testloadext.lo
|
||||
testloadext.dll: testloadext.lo
|
||||
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ testloadext.lo
|
||||
|
||||
showdb.exe: $(TOP)\tool\showdb.c $(SQLITE3C) $(SQLITE3H)
|
||||
@@ -2025,9 +2029,12 @@ speedtest1.exe: $(TOP)\test\speedtest1.c $(SQLITE3C) $(SQLITE3H)
|
||||
$(LTLINK) $(NO_WARN) -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
|
||||
$(TOP)\test\speedtest1.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
|
||||
|
||||
rbu.exe: $(TOP)\ext\rbu\rbu.c $(TOP)\ext\rbu\sqlite3rbu.c $(SQLITE3C) $(SQLITE3H)
|
||||
rbu.exe: $(TOP)\ext\rbu\rbu.c $(TOP)\ext\rbu\sqlite3rbu.c $(SQLITE3C) $(SQLITE3H)
|
||||
$(LTLINK) $(NO_WARN) -DSQLITE_ENABLE_RBU -Fe$@ \
|
||||
$(TOP)\ext\rbu\rbu.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
|
||||
|
||||
moreclean: clean
|
||||
del /Q $(SQLITE3C) $(SQLITE3H) 2>NUL
|
||||
# <</mark>>
|
||||
|
||||
clean:
|
||||
@@ -2035,7 +2042,8 @@ clean:
|
||||
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 sqlite3.c sqlite3.h 2>NUL
|
||||
del /Q opcodes.c opcodes.h 2>NUL
|
||||
del /Q lemon.* lempar.c parse.* 2>NUL
|
||||
del /Q mkkeywordhash.* keywordhash.h 2>NUL
|
||||
del /Q notasharedlib.* 2>NUL
|
||||
|
||||
@@ -457,7 +457,9 @@ CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
|
||||
# when linking.
|
||||
#
|
||||
!IFNDEF CORE_LINK_DEP
|
||||
!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
|
||||
!IF $(DYNAMIC_SHELL)!=0
|
||||
CORE_LINK_DEP =
|
||||
!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
|
||||
CORE_LINK_DEP =
|
||||
!ELSE
|
||||
CORE_LINK_DEP =
|
||||
@@ -467,7 +469,9 @@ CORE_LINK_DEP =
|
||||
# These are additional linker options used for the core library.
|
||||
#
|
||||
!IFNDEF CORE_LINK_OPTS
|
||||
!IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
|
||||
!IF $(DYNAMIC_SHELL)!=0
|
||||
CORE_LINK_OPTS =
|
||||
!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
|
||||
CORE_LINK_OPTS =
|
||||
!ELSE
|
||||
CORE_LINK_OPTS =
|
||||
@@ -874,14 +878,14 @@ all: dll shell
|
||||
|
||||
# Dynamic link library section.
|
||||
#
|
||||
dll: $(SQLITE3DLL)
|
||||
dll: $(SQLITE3DLL)
|
||||
|
||||
# Shell executable.
|
||||
#
|
||||
shell: $(SQLITE3EXE)
|
||||
shell: $(SQLITE3EXE)
|
||||
|
||||
|
||||
$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
|
||||
$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
|
||||
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for sqlite 3.12.0.
|
||||
# Generated by GNU Autoconf 2.69 for sqlite 3.11.1.
|
||||
#
|
||||
#
|
||||
# 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.12.0'
|
||||
PACKAGE_STRING='sqlite 3.12.0'
|
||||
PACKAGE_VERSION='3.11.1'
|
||||
PACKAGE_STRING='sqlite 3.11.1'
|
||||
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.12.0 to adapt to many kinds of systems.
|
||||
\`configure' configures sqlite 3.11.1 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.12.0:";;
|
||||
short | recursive ) echo "Configuration of sqlite 3.11.1:";;
|
||||
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.12.0
|
||||
sqlite configure 3.11.1
|
||||
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.12.0, which was
|
||||
It was created by sqlite $as_me 3.11.1, 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.12.0, which was
|
||||
This file was extended by sqlite $as_me 3.11.1, 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.12.0
|
||||
sqlite config.status 3.11.1
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
||||
@@ -161,9 +161,8 @@ such as ``identifier'' or ``number'' and the third argument will
|
||||
be the name of the identifier or the value of the number.</p>
|
||||
|
||||
<p>The Parse() function may have either three or four arguments,
|
||||
depending on the grammar. If the grammar specification file requests
|
||||
it (via the <a href='#extraarg'><tt>extra_argument</tt> directive</a>),
|
||||
the Parse() function will have a fourth parameter that can be
|
||||
depending on the grammar. If the grammar specification file request
|
||||
it, the Parse() function will have a fourth parameter that can be
|
||||
of any type chosen by the programmer. The parser doesn't do anything
|
||||
with this argument except to pass it through to action routines.
|
||||
This is a convenient mechanism for passing state information down
|
||||
@@ -264,12 +263,6 @@ with prior yacc and bison experience.
|
||||
But after years of experience using Lemon, I firmly
|
||||
believe that the Lemon way of doing things is better.</p>
|
||||
|
||||
<p><i>Updated as of 2016-02-16:</i>
|
||||
The text above was written in the 1990s.
|
||||
We are told that Bison has lately been enhanced to support the
|
||||
tokenizer-calls-parser paradigm used by Lemon, and to obviate the
|
||||
need for global variables.</p>
|
||||
|
||||
<h2>Input File Syntax</h2>
|
||||
|
||||
<p>The main purpose of the grammar specification file for Lemon is
|
||||
@@ -624,7 +617,6 @@ build a parser using Lemon that can be used within a long-running
|
||||
program, such as a GUI, that will not leak memory or other resources.
|
||||
To do the same using yacc or bison is much more difficult.</p>
|
||||
|
||||
<a name="extraarg"></a>
|
||||
<h4>The <tt>%extra_argument</tt> directive</h4>
|
||||
|
||||
The %extra_argument directive instructs Lemon to add a 4th parameter
|
||||
|
||||
@@ -526,8 +526,7 @@ static int fts3_test_varint_cmd(
|
||||
#ifdef SQLITE_ENABLE_FTS3
|
||||
char aBuf[24];
|
||||
int rc;
|
||||
Tcl_WideInt w;
|
||||
sqlite3_int64 w2;
|
||||
Tcl_WideInt w, w2;
|
||||
int nByte, nByte2;
|
||||
|
||||
if( objc!=2 ){
|
||||
|
||||
@@ -698,6 +698,7 @@ static Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){
|
||||
return pRet;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Release a reference to data record returned by an earlier call to
|
||||
** fts5DataRead().
|
||||
@@ -865,7 +866,7 @@ static int fts5StructureDecode(
|
||||
|
||||
for(iLvl=0; rc==SQLITE_OK && iLvl<nLevel; iLvl++){
|
||||
Fts5StructureLevel *pLvl = &pRet->aLevel[iLvl];
|
||||
int nTotal = 0;
|
||||
int nTotal;
|
||||
int iSeg;
|
||||
|
||||
if( i>=nData ){
|
||||
@@ -2154,6 +2155,10 @@ static void fts5LeafSeek(
|
||||
iPgidx = szLeaf;
|
||||
iPgidx += fts5GetVarint32(&a[iPgidx], iTermOff);
|
||||
iOff = iTermOff;
|
||||
if( iOff>n ){
|
||||
p->rc = FTS5_CORRUPT;
|
||||
return;
|
||||
}
|
||||
|
||||
while( 1 ){
|
||||
|
||||
@@ -4499,7 +4504,10 @@ int sqlite3Fts5IndexOptimize(Fts5Index *p){
|
||||
if( pLvl->aSeg ){
|
||||
int iLvl, iSeg;
|
||||
int iSegOut = 0;
|
||||
for(iLvl=0; iLvl<pStruct->nLevel; iLvl++){
|
||||
/* Iterate through all segments, from oldest to newest. Add them to
|
||||
** the new Fts5Level object so that pLvl->aSeg[0] is the oldest
|
||||
** segment in the data structure. */
|
||||
for(iLvl=pStruct->nLevel-1; iLvl>=0; iLvl--){
|
||||
for(iSeg=0; iSeg<pStruct->aLevel[iLvl].nSeg; iSeg++){
|
||||
pLvl->aSeg[iSegOut] = pStruct->aLevel[iLvl].aSeg[iSeg];
|
||||
iSegOut++;
|
||||
|
||||
@@ -245,7 +245,11 @@ static int fts5MatchinfoLocalCb(
|
||||
iOff>=0;
|
||||
pApi->xPhraseNext(pFts, &iter, &iCol, &iOff)
|
||||
){
|
||||
aOut[nMul * (iCol + iPhrase * p->nCol)]++;
|
||||
if( f=='b' ){
|
||||
aOut[iPhrase * ((p->nCol+31)/32) + iCol/32] |= ((u32)1 << iCol%32);
|
||||
}else{
|
||||
aOut[nMul * (iCol + iPhrase * p->nCol)]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,7 +410,7 @@ int sqlite3Fts5TestRegisterMatchinfo(sqlite3 *db){
|
||||
**
|
||||
** Also check that the fts5_api object is version 2 or newer.
|
||||
*/
|
||||
if( pApi==0 || pApi->iVersion<2 ){
|
||||
if( pApi==0 || pApi->iVersion<1 ){
|
||||
return SQLITE_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
);
|
||||
}
|
||||
%stack_overflow {
|
||||
UNUSED_PARAM(yypMinor); /* Silence a compiler warning */
|
||||
sqlite3Fts5ParseError(pParse, "fts5: parser stack overflow");
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,13 @@ if {![info exists testdir]} {
|
||||
source $testdir/tester.tcl
|
||||
|
||||
ifcapable !fts5 {
|
||||
finish_test
|
||||
proc return_if_no_fts5 {} {
|
||||
finish_test
|
||||
return -code return
|
||||
}
|
||||
return
|
||||
} else {
|
||||
proc return_if_no_fts5 {} {}
|
||||
}
|
||||
|
||||
catch {
|
||||
@@ -25,12 +30,6 @@ catch {
|
||||
reset_db
|
||||
}
|
||||
|
||||
# If SQLITE_ENABLE_FTS5 is not defined, skip this test.
|
||||
ifcapable !fts5 {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
proc fts5_test_poslist {cmd} {
|
||||
set res [list]
|
||||
for {set i 0} {$i < [$cmd xInstCount]} {incr i} {
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
source [file join [file dirname [info script]] fts5_common.tcl]
|
||||
set testprefix fts5bigtok
|
||||
return_if_no_fts5
|
||||
|
||||
proc rndterm {} {
|
||||
set L [list a b c d e f g h i j k l m n o p q r s t u v w x y z]
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
# 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
|
||||
|
||||
@@ -467,29 +467,5 @@ 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
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
#
|
||||
|
||||
source [file join [file dirname [info script]] fts5_common.tcl]
|
||||
set testprefix fts5merge
|
||||
set testprefix fts5merge2
|
||||
return_if_no_fts5
|
||||
|
||||
proc dump_structure {} {
|
||||
db eval {SELECT fts5_decode(id, block) AS t FROM t1_data WHERE id=10} {
|
||||
@@ -26,8 +27,6 @@ proc dump_structure {} {
|
||||
|
||||
foreach_detail_mode $testprefix {
|
||||
|
||||
if {[detail_is_none]==0} continue
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE VIRTUAL TABLE t1 USING fts5(x, detail=%DETAIL%);
|
||||
INSERT INTO t1(t1, rank) VALUES('pgsz', 32);
|
||||
|
||||
@@ -409,5 +409,23 @@ do_catchsql_test 19.2 {
|
||||
SELECT * FROM x1 WHERE x1 MATCH 'c0 AND (c1 AND (c2 AND (c3 AND (c4 AND (c5 AND (c6 AND (c7 AND (c8 AND (c9 AND (c10 AND (c11 AND (c12 AND (c13 AND (c14 AND (c15 AND (c16 AND (c17 AND (c18 AND (c19 AND (c20 AND (c21 AND (c22 AND (c23 AND (c24 AND (c25 AND (c26 AND (c27 AND (c28 AND (c29 AND (c30 AND (c31 AND (c32 AND (c33 AND (c34 AND (c35 AND (c36 AND (c37 AND (c38 AND (c39 AND (c40 AND (c41 AND (c42 AND (c43 AND (c44 AND (c45 AND (c46 AND (c47 AND (c48 AND (c49 AND (c50 AND (c51 AND (c52 AND (c53 AND (c54 AND (c55 AND (c56 AND (c57 AND (c58 AND (c59 AND (c60 AND (c61 AND (c62 AND (c63 AND (c64 AND (c65 AND (c66 AND (c67 AND (c68 AND (c69 AND (c70 AND (c71 AND (c72 AND (c73 AND (c74 AND (c75 AND (c76 AND (c77 AND (c78 AND (c79 AND (c80 AND (c81 AND (c82 AND (c83 AND (c84 AND (c85 AND (c86 AND (c87 AND (c88 AND (c89 AND (c90 AND (c91 AND (c92 AND (c93 AND (c94 AND (c95 AND (c96 AND (c97 AND (c98 AND (c99 AND (c100 AND (c101 AND (c102 AND (c103 AND (c104 AND (c105 AND (c106 AND (c107 AND (c108 AND (c109 AND (c110 AND (c111 AND (c112 AND (c113 AND (c114 AND (c115 AND (c116 AND (c117 AND (c118 AND (c119 AND (c120 AND (c121 AND (c122 AND (c123 AND (c124 AND (c125 AND (c126 AND (c127 AND (c128 AND (c129 AND (c130 AND (c131 AND (c132 AND (c133 AND (c134 AND (c135 AND (c136 AND (c137 AND (c138 AND (c139 AND (c140 AND (c141 AND (c142 AND (c143 AND (c144 AND (c145 AND (c146 AND (c147 AND (c148 AND (c149 AND (c150 AND (c151 AND (c152 AND (c153 AND (c154 AND (c155 AND (c156 AND (c157 AND (c158 AND (c159 AND (c160 AND (c161 AND (c162 AND (c163 AND (c164 AND (c165 AND (c166 AND (c167 AND (c168 AND (c169 AND (c170 AND (c171 AND (c172 AND (c173 AND (c174 AND (c175 AND (c176 AND (c177 AND (c178 AND (c179 AND (c180 AND (c181 AND (c182 AND (c183 AND (c184 AND (c185 AND (c186 AND (c187 AND (c188 AND (c189 AND (c190 AND (c191 AND (c192 AND (c193 AND (c194 AND (c195 AND (c196 AND (c197 AND (c198 AND (c199 AND c200)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
|
||||
} {1 {fts5: parser stack overflow}}
|
||||
|
||||
finish_test
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 20.0 {
|
||||
CREATE VIRTUAL TABLE x1 USING fts5(x);
|
||||
INSERT INTO x1(x1, rank) VALUES('pgsz', 32);
|
||||
INSERT INTO x1(rowid, x) VALUES(11111, 'onetwothree');
|
||||
}
|
||||
do_test 20.1 {
|
||||
for {set i 1} {$i <= 200} {incr i} {
|
||||
execsql { INSERT INTO x1(rowid, x) VALUES($i, 'one two three'); }
|
||||
}
|
||||
execsql { INSERT INTO x1(x1) VALUES('optimize'); }
|
||||
execsql { DELETE FROM x1 WHERE rowid = 4; }
|
||||
} {}
|
||||
do_execsql_test 20.2 {
|
||||
INSERT INTO x1(x1) VALUES('optimize');
|
||||
INSERT INTO x1(x1) VALUES('integrity-check');
|
||||
} {}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -1775,7 +1775,7 @@ static void scriptCodeSqlFunc(
|
||||
*/
|
||||
|
||||
/* Maximum length of a phonehash used for querying the shadow table */
|
||||
#define SPELLFIX_MX_HASH 8
|
||||
#define SPELLFIX_MX_HASH 32
|
||||
|
||||
/* Maximum number of hash strings to examine per query */
|
||||
#define SPELLFIX_MX_RUN 1
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
C Enhance\schecking\sof\sprerequisites\sin\sthe\svsixtest\stool.
|
||||
D 2016-02-25T23:22:26.535
|
||||
C Version\s3.11.1
|
||||
D 2016-03-03T16:17:53.102
|
||||
F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4
|
||||
F Makefile.msc 56ea123a975690bf9ed38b31bb89ff87b02a7c2b
|
||||
F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
|
||||
F VERSION c6b1f51809551d60ad001e6d87cf3ab2c7f54b6f
|
||||
F VERSION 1a9f17ac8a5066544976a390298fe62228c58a9e
|
||||
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 d5ab32cf30d6ba8b5ce20835b4042f6cc2a4cb39
|
||||
F autoconf/Makefile.msc 3cbf11c911fafd4d95fbe8aec059b5aa586a0157
|
||||
F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7
|
||||
F autoconf/README.txt 7c31da66232f7590bb987cfcd4e2381744b25d24
|
||||
F autoconf/configure.ac 72a5e42beb090b32bca580285dc0ab3c4670adb8
|
||||
@@ -30,10 +30,10 @@ F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63
|
||||
F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977
|
||||
F config.h.in 42b71ad3fe21c9e88fa59e8458ca1a6bc72eb0c0
|
||||
F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55
|
||||
F configure 0339a635cd2943a3b56000a10a11b4b2e6ed6d1b x
|
||||
F configure 2ea99f0951819177c002c70727b78e51818624b3 x
|
||||
F configure.ac a2224b1162f79848982d3618ac1deffcd94e88ec
|
||||
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
|
||||
F doc/lemon.html c30255bea0fd87a81f082d17a72c9dffbc3f6dd9
|
||||
F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1
|
||||
F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710
|
||||
F doc/vfs-shm.txt e101f27ea02a8387ce46a05be2b1a902a021d37a
|
||||
F ext/README.txt 913a7bd3f4837ab14d7e063304181787658b14e1
|
||||
@@ -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 11e36437b0f3f2266acea5b4787f615e4337a237
|
||||
F ext/fts3/fts3_test.c 8a3a78c4458b2d7c631fcf4b152a5cd656fa7038
|
||||
F ext/fts3/fts3_tokenize_vtab.c a27593ab19657166f6fa5ec073b678cc29a75860
|
||||
F ext/fts3/fts3_tokenizer.c 4bd72f767f61c9ce5a7575c844e8d1ed2c3c561a
|
||||
F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
|
||||
@@ -104,19 +104,19 @@ F ext/fts5/fts5_buffer.c 4c1502d4c956cd092c89ce4480867f9d8bf325cd
|
||||
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_index.c ecc70368618c6bae4bb59124abc343c02634ad0c
|
||||
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 b8d04816428202b2898d4ca38deb1739ac0110ae
|
||||
F ext/fts5/fts5_test_mi.c 6f76bfc2ec56ce258763c5ace7608636c8745956
|
||||
F ext/fts5/fts5_test_tok.c db08af63673c3a7d39f053b36fd6e065017706be
|
||||
F ext/fts5/fts5_tokenize.c 2ce7b44183538ec46b7907726262ee43ffdd39a8
|
||||
F ext/fts5/fts5_unicode2.c b450b209b157d598f7b9df9f837afb75a14c24bf
|
||||
F ext/fts5/fts5_varint.c a5aceacda04dafcbae725413d7a16818ecd65738
|
||||
F ext/fts5/fts5_vocab.c dba72ca393d71c2588548b51380387f6b44c77a8
|
||||
F ext/fts5/fts5parse.y 86fe6ba094a47e02fe8be2571539e6833d197764
|
||||
F ext/fts5/fts5parse.y 59432ea369f1aa65511bad465f55d31a22f9f223
|
||||
F ext/fts5/mkportersteps.tcl 5acf962d2e0074f701620bb5308155fa1e4a63ba
|
||||
F ext/fts5/test/fts5_common.tcl 61ff0d1a29d98a91c4553b20b3f410d858834ee9
|
||||
F ext/fts5/test/fts5_common.tcl b9b1fed811c0390511cef8b254826ea15d380f4d
|
||||
F ext/fts5/test/fts5aa.test 7e814df4a0e6c22a6fe2d84f210fdc0b5068a084
|
||||
F ext/fts5/test/fts5ab.test 30325a89453280160106be411bba3acf138e6d1b
|
||||
F ext/fts5/test/fts5ac.test 55cad4275a1f5acabfe14d8442a8046b47e49e5f
|
||||
@@ -134,7 +134,7 @@ F ext/fts5/test/fts5auto.test 401c20e89f1114d733b94809be1e6f893e16c09e
|
||||
F ext/fts5/test/fts5aux.test 8c687c948cc98e9a94be014df7d518acc1b3b74f
|
||||
F ext/fts5/test/fts5auxdata.test 141a7cbffcceb1bd2799b4b29c183ff8780d586e
|
||||
F ext/fts5/test/fts5bigpl.test 04ee0d7eebbebf17c31f5a0b5c5f9494eac3a0cb
|
||||
F ext/fts5/test/fts5bigtok.test 981b2790f6fa02773c889bd35d42c6b97f80f0f4
|
||||
F ext/fts5/test/fts5bigtok.test 017a9397b14e7598883a6328ead4a6539b42d59a
|
||||
F ext/fts5/test/fts5columnsize.test a8cfef21ffa1c264b9f670a7d94eeaccb5341c07
|
||||
F ext/fts5/test/fts5config.test 8b2bc6dcc0eb06fa2b7dd65b2ce2db09e829e873
|
||||
F ext/fts5/test/fts5conflict.test 26f4e46c4d31e16221794832a990dc4e30e18de5
|
||||
@@ -157,13 +157,12 @@ 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 f7dde99697bcb310ea8faa8eb2714d9f4dfc0e1b
|
||||
F ext/fts5/test/fts5matchinfo.test 86569026d20f1ed748236587ce798de8a96615f1
|
||||
F ext/fts5/test/fts5merge.test 8f3cdba2ec9c5e7e568246e81b700ad37f764367
|
||||
F ext/fts5/test/fts5merge2.test c0cb66eb38a41c26cc5848fb9e50093e0f59ac93
|
||||
F ext/fts5/test/fts5merge2.test a6da3c16d694235938d1939f503cfa53f0943d75
|
||||
F ext/fts5/test/fts5near.test b214cddb1c1f1bddf45c75af768f20145f7e71cc
|
||||
F ext/fts5/test/fts5onepass.test 7ed9608e258132cb8d55e7c479b08676ad68810c
|
||||
F ext/fts5/test/fts5optimize.test 42741e7c085ee0a1276140a752d4407d97c2c9f5
|
||||
@@ -177,7 +176,7 @@ F ext/fts5/test/fts5rank.test 7e9e64eac7245637f6f2033aec4b292aaf611aab
|
||||
F ext/fts5/test/fts5rebuild.test 03935f617ace91ed23a6099c7c74d905227ff29b
|
||||
F ext/fts5/test/fts5restart.test c17728fdea26e7d0f617d22ad5b4b2862b994c17
|
||||
F ext/fts5/test/fts5rowid.test 16908a99d6efc9ba21081b4f2b86b3fc699839a6
|
||||
F ext/fts5/test/fts5simple.test e6fe2fb10a2b9193648b32bbc2caecabdf8c333d
|
||||
F ext/fts5/test/fts5simple.test 09420cb1137f3a19d02dacb5b4b6831d2e683773
|
||||
F ext/fts5/test/fts5simple2.test 98377ae1ff7749a42c21fe1a139c1ed312522c46
|
||||
F ext/fts5/test/fts5simple3.test 8e71733b3d1b0e695011d02c68ebc5ca40b6124e
|
||||
F ext/fts5/test/fts5synonym.test 6475d189c2e20d60795808f83e36bf9318708d48
|
||||
@@ -214,7 +213,7 @@ F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc
|
||||
F ext/misc/rot13.c 1ac6f95f99b575907b9b09c81a349114cf9be45a
|
||||
F ext/misc/series.c b8fb7befd85b3a9b4a10e701b30b2b79ca92b6d4
|
||||
F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
|
||||
F ext/misc/spellfix.c 525190484b7a9dbc6be646c4842274fff4f27d53
|
||||
F ext/misc/spellfix.c 194b5fc3a9a63cb6c5680d8f713800012bddca7c
|
||||
F ext/misc/totype.c 4a167594e791abeed95e0a8db028822b5e8fe512
|
||||
F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95
|
||||
F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e
|
||||
@@ -241,7 +240,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 371e8bf06cfb3f691adac47eb15ab1073ed92dcf
|
||||
F ext/rbu/sqlite3rbu.c bea954197524631f2691ec272e8a42df8cad01cc
|
||||
F ext/rbu/sqlite3rbu.h 0bdeb3be211aaba7d85445fa36f4701a25a3dbde
|
||||
F ext/rbu/test_rbu.c 4a4cdcef4ef9379fc2a21f008805c80b27bcf573
|
||||
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
||||
@@ -285,43 +284,43 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
|
||||
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
|
||||
F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
|
||||
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
|
||||
F src/alter.c 7603afbd61f55e7c644b8de4a42f33e58c0b7eaa
|
||||
F src/analyze.c ab57b6763dd4c6170a20673d14882c033affd188
|
||||
F src/attach.c a3724c64de1099d85e30751213d285752aed9505
|
||||
F src/alter.c 1fbb01c26c64528088f1df8015992fefda387889
|
||||
F src/analyze.c fbf0e80d83cc893734e872f932f249a056b86e11
|
||||
F src/attach.c c16c2648a577fa3def2adfa48c28901376389bc5
|
||||
F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240
|
||||
F src/backup.c f60f0aa55d25d853ffde53d0b0370a7bb7ee41ce
|
||||
F src/bitvec.c 3ee4c8b2c94ed3a7377256e18199e6ff5cf33f63
|
||||
F src/backup.c 2869a76c03eb393ee795416e2387005553df72bc
|
||||
F src/bitvec.c 1a78d450a17c5016710eec900bedfc5729bf9bdf
|
||||
F src/btmutex.c bc87dd3b062cc26edfe79918de2200ccb8d41e73
|
||||
F src/btree.c 7bb920c473c277380fcb3e8a8ee28ce1a48e0abc
|
||||
F src/btree.h a5008b9afe56e8e54ade6c436a910f112defcca9
|
||||
F src/btree.c 4c8caaeed7878aafdb607c3d2bcbc365bb0d19a1
|
||||
F src/btree.h 368ceeb4bd9312dc8df2ffd64b4b7dbcf4db5f8e
|
||||
F src/btreeInt.h c18b7d2a3494695133e4e60ee36061d37f45d9a5
|
||||
F src/build.c 6661513c8f90a23d44ed5e5ada7ea40fac6b6b77
|
||||
F src/callback.c 2e76147783386374bf01b227f752c81ec872d730
|
||||
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
|
||||
F src/build.c 54866fbafa09d494269bdefc79995eb7207003a6
|
||||
F src/callback.c ed6c2a4a712eb7287ff64e20e3c23265dfb8a7ce
|
||||
F src/complete.c addcd8160b081131005d5bc2d34adf20c1c5c92f
|
||||
F src/ctime.c 60e135af364d777a9ab41c97e5e89cd224da6198
|
||||
F src/date.c 0b73e681c11fca867fec554750c07fe0d4e417c1
|
||||
F src/dbstat.c c845548d4346e606e2f2b7d2e714ace2b8a7dd1b
|
||||
F src/date.c ca17321bc17cca8f40e0843edea4fafff974998e
|
||||
F src/dbstat.c b2ec6793eef97aebb4d171d490a4ffdfa9f2475c
|
||||
F src/delete.c 48802aa3ee6339f576d074336d3ae1b5f40e240f
|
||||
F src/expr.c 9adb58153f6e943b703d43e9a1f67f77b5a75721
|
||||
F src/expr.c fbf0706199aea23c54efe36b6932d8307c4eb872
|
||||
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
||||
F src/fkey.c 08edad1fce30f761f14b3997e89bad58f9f7f4e0
|
||||
F src/func.c 552d300265aed09eea21f68ac742a440550c0062
|
||||
F src/global.c ded7b97efd16efda5062b65e857198e46c40e652
|
||||
F src/func.c 86e55fee35b9577e485f47d9dd5c1d34cd513288
|
||||
F src/global.c bd5a0af3f30b0c01be6db756c626cd3c33a3d260
|
||||
F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5
|
||||
F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094
|
||||
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
|
||||
F src/insert.c 9ca97272e9f74ed0efddf3b4350ee12740cebbef
|
||||
F src/journal.c fe3a3e2559ce3ce9d371afd30fbabbc074174575
|
||||
F src/legacy.c 75d3023be8f0d2b99d60f905090341a03358c58e
|
||||
F src/loadext.c 9e2a41adcaff16ebc1ebff1f336cbf33de55396f
|
||||
F src/main.c d7415cd68121ef24c2e76b9e81ec96ffc90e6517
|
||||
F src/malloc.c 1443d1ad95d67c21d77af7ae3f44678252f0efec
|
||||
F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
|
||||
F src/legacy.c b1b0880fc474abfab89e737b0ecfde0bd7a60902
|
||||
F src/loadext.c 84996d7d70a605597d79c1f1d7b2012a5fd34f2b
|
||||
F src/main.c b67a45397b93b7ba8fbd6bfcb03423d245baed05
|
||||
F src/malloc.c 337e9808b5231855fe28857950f4f60ae42c417f
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c 6919bcf12f221868ea066eec27e579fed95ce98b
|
||||
F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3
|
||||
F src/mem3.c 8768ac94694f31ffaf8b4d0ea5dc08af7010a35a
|
||||
F src/mem5.c 9bf955937b07f8c32541c8a9991f33ce3173d944
|
||||
F src/memjournal.c 349a04fb803db40532cde0993e39758f1acaecce
|
||||
F src/memjournal.c 3eb2c0b51adbd869cb6a44780323f05fa904dc85
|
||||
F src/msvc.h d9ba56c6851227ab44b3f228a35f3f5772296495
|
||||
F src/mutex.c 8e45800ee78e0cd1f1f3fe8e398853307f4a085c
|
||||
F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85
|
||||
@@ -329,37 +328,37 @@ F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4
|
||||
F src/mutex_unix.c 27bb6cc49485ee46711a6580ab7b3f1402211d23
|
||||
F src/mutex_w32.c 5e6fe1c298fb5a8a15aaed4161d5759311431c17
|
||||
F src/notify.c 9711a7575036f0d3040ba61bc6e217f13a9888e7
|
||||
F src/os.c ca9a104b677328ee037cfdf1a54a16fd1805e8c9
|
||||
F src/os.c 205fa2bad945a0dc7cad48f9f95ea3e8dc5408ff
|
||||
F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf
|
||||
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
|
||||
F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
|
||||
F src/os_unix.c 3a6f20736dfb8a0949cdd66553fdf59f6604be35
|
||||
F src/os_win.c f0d7aa603eb6262143d7169a222aea07c4fca91d
|
||||
F src/os_unix.c 821ed110197175165cf2f50b0930c7ff9a24504c
|
||||
F src/os_win.c ccf29ddded3e41e506b6bd98c1171aa0963b23f2
|
||||
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
|
||||
F src/pager.c d034c69b958c01289eb8070cbf902e1a68cd7e0b
|
||||
F src/pager.h e1d38a2f14849e219df0f91f8323504d134c8a56
|
||||
F src/parse.y c3ce2c4a7cbf0b699239be6b2a945c5cb51875e2
|
||||
F src/pcache.c 647bb53a86b7bbcf55ad88089b3ea5a9170b90df
|
||||
F src/pager.c 67cd2fbab58d0e35fed5f81432856f4f0af9fc6d
|
||||
F src/pager.h f3eb324a3ff2408b28bab7e81c1c55c13720f865
|
||||
F src/parse.y d7bff41d460f2df96fb890f36700e85cb0fc5634
|
||||
F src/pcache.c 73895411fa6b7bd6f0091212feabbe833b358d23
|
||||
F src/pcache.h 4d0ccaad264d360981ec5e6a2b596d6e85242545
|
||||
F src/pcache1.c 72f644dc9e1468c72922eff5904048427b817051
|
||||
F src/pragma.c 80ee77226d0008d9188356a6cbbe6010866e1bee
|
||||
F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c
|
||||
F src/prepare.c 22df6171aec1d86904ed2ad30c2348a5748aa04e
|
||||
F src/prepare.c c12b786713df3e8270c0f85f988c5359d8b4d87c
|
||||
F src/printf.c 63e6fb12bbe702dd664dc3703776c090383a5a26
|
||||
F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
|
||||
F src/resolve.c b8f7174e5f8c33c44ded3a25a973d0bb89228c20
|
||||
F src/resolve.c 9f7ce3a3c087afb7597b7c916c99126ff3f12f0c
|
||||
F src/rowset.c 9fe4b3ad7cc00944386bb600233d8f523de07a6e
|
||||
F src/select.c 1a7e23a3bb2edb9cdc46ab0cf7c1500109cf2531
|
||||
F src/select.c ff80004a9a6ece891a8d9327a88e7b6e2588ee6d
|
||||
F src/shell.c 0367440658104bf2ce8d8a9a5a713a4b11c9acbe
|
||||
F src/sqlite.h.in a7caa805a345d6a14136c11ccfa6f4c1a6ef6e7b
|
||||
F src/sqlite.h.in f80c6ebd85588fc514bfedf3ecb00cec269cb410
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d
|
||||
F src/sqliteInt.h 5200682fc1050f00fba07128c0facc37462c4411
|
||||
F src/sqliteInt.h 04ca5b3cdb3bcf87ba6300d5d36b51498f65f28c
|
||||
F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
|
||||
F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba
|
||||
F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9
|
||||
F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e
|
||||
F src/tclsqlite.c 13debcc6a5ca1217486f8903768c01114fbe8b58
|
||||
F src/test1.c 8b17b1ff53aad71e7f9318a2fda247beddeaa601
|
||||
F src/test1.c 4f1b42699068b7806af3111786f5ad760c2c1ff7
|
||||
F src/test2.c 5586f43fcd9a1be0830793cf9d354082c261b25b
|
||||
F src/test3.c a8887dabbbee3059af338f20d290084a63ed1b0f
|
||||
F src/test4.c d168f83cc78d02e8d35567bb5630e40dcd85ac1e
|
||||
@@ -371,12 +370,12 @@ 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 b2551a9b5573232db5f66f292307c37067937239
|
||||
F src/test_blob.c e5a7a81d61a780da79101aeb1e60d300af169e07
|
||||
F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f
|
||||
F src/test_config.c 7985332c806d1cece793475c75a6abcccde9d331
|
||||
F src/test_demovfs.c 0de72c2c89551629f58486fde5734b7d90758852
|
||||
F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
|
||||
F src/test_fs.c f10f840ca4f8c72e4837908bd8347ac4bcab074b
|
||||
F src/test_fs.c a61f54247fdb843761d709879c3bcd1989b2050c
|
||||
F src/test_func.c 37453d346cfcf118774efd5bf6187f7e6a7e3254
|
||||
F src/test_hexio.c abfdecb6fa58c354623978efceb088ca18e379cd
|
||||
F src/test_init.c 66b33120ffe9cd853b5a905ec850d51151337b32
|
||||
@@ -406,32 +405,32 @@ F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698
|
||||
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 3d338cdd00d916ce8a05c397001d64ed58e6fe1c
|
||||
F src/threads.c bbfb74450643cb5372a43ad4f6cffd7e9dfcecb0
|
||||
F src/tokenize.c 813934be70597edfbb685ae08fc4c8b549cf5a1e
|
||||
F src/treeview.c dc39ccf04e9331237388b9cb73289c9d87ea050b
|
||||
F src/trigger.c e14840ee0c3e549e758ec9bf3e4146e166002280
|
||||
F src/update.c a7eeeaffad59c6506f01303a071dac11de8269ca
|
||||
F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c
|
||||
F src/util.c 38c06684c922694809ccb988a13562c16890a3d5
|
||||
F src/vacuum.c feb1eabb20987983d9350cad98299b21fa811f52
|
||||
F src/vdbe.c 87ae3a5657fefed7875f3eb30e7ababd48013d71
|
||||
F src/utf.c 10cc2519e82e3369344d0969ad4b1a333dc86d18
|
||||
F src/util.c 49ce0a65306c1c51d61cb5bc214c71cb62452de6
|
||||
F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701
|
||||
F src/vdbe.c c193299e595a13eba247738e22fce25c49346a6c
|
||||
F src/vdbe.h c743791f723049db94f009e3e30958952bc2d512
|
||||
F src/vdbeInt.h 84827a809229917fdd3cc05af719dbb61314a5a3
|
||||
F src/vdbeapi.c 95b1f8e527240a18a9aea41a655b013bf07a7009
|
||||
F src/vdbeaux.c 2c15cf88de4df97428318c8cfac0dea873dae451
|
||||
F src/vdbeInt.h 4b69d5451bcadd473e745af53ef1e8abfdce0a79
|
||||
F src/vdbeapi.c 9324f6baee1a1b2284c6543e98f916888a81e459
|
||||
F src/vdbeaux.c deae5d3bd45da0e57c7d9e1d7436333d142dc3bb
|
||||
F src/vdbeblob.c 3b570b730109e8f653d9d2081649f6e7015113db
|
||||
F src/vdbemem.c be8381ed6de54eb9cb9dfa802823cdeb5166d855
|
||||
F src/vdbesort.c 307460bfa4de4d1c3901fcd42089159131e34062
|
||||
F src/vdbemem.c 68fcfac37dc6601d98c32cc5adee4d39f2c1b7b4
|
||||
F src/vdbesort.c ef3c6d1f1a7d44cf67bb2bee59ea3d1fe5bad174
|
||||
F src/vdbetrace.c f75c5455d8cf389ef86a8bfdfd3177e0e3692484
|
||||
F src/vtab.c 943c23b355f0a8f859f9583e7315d64bebdb0899
|
||||
F src/vtab.c bef51b4f693d82b4b0184457faa8625654534091
|
||||
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
|
||||
F src/wal.c 10deb6b43887662691e5f53d10b3c171c401169b
|
||||
F src/wal.c 1dd3f1aeed5765be62f27d7d2e44d46a68d891ab
|
||||
F src/wal.h 2f7c831cf3b071fa548bf2d5cac640846a7ff19c
|
||||
F src/walker.c 0f142b5bd3ed2041fc52d773880748b212e63354
|
||||
F src/where.c 5b67fb8035ae4697cf721db095f800ef8dff5f56
|
||||
F src/where.c 984084584c10c41e46c89ac027a5cca991bc37e6
|
||||
F src/whereInt.h 78b6b4de94db84aecbdc07fe3e38f648eb391e9a
|
||||
F src/wherecode.c 39c1ef4598bedf1d66249334c74efd23ddd182ac
|
||||
F src/whereexpr.c fb87944b1254234e5bba671aaf6dee476241506a
|
||||
F src/wherecode.c 791a784bbf8749d560fdb0b990b607bc4f44a38d
|
||||
F src/whereexpr.c de117970b29471177a6901d60ad83a194671dc03
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
|
||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||
@@ -564,7 +563,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 b629e896b14df2f000a99b8d170d80589c46562c
|
||||
F test/coveridxscan.test cdb47d01acc4a634a34fd25abe85189e0d0f1e62
|
||||
F test/crash.test fb9dc4a02dcba30d4aa5c2c226f98b220b2b959f
|
||||
F test/crash2.test 5b14d4eb58b880e231361d3b609b216acda86651
|
||||
F test/crash3.test 8f5de9d32ab9ab95475a9efe7f47a940aa889418
|
||||
@@ -765,7 +764,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 93bb9d309888634615e21ef98d1c30d51483e942
|
||||
F test/fuzzcheck.c 3309d793165ca61a9996271cb799694839348f9a
|
||||
F test/fuzzdata1.db 7ee3227bad0e7ccdeb08a9e6822916777073c664
|
||||
F test/fuzzdata2.db f03a420d3b822cc82e4f894ca957618fbe9c4973
|
||||
F test/fuzzdata3.db c6586d3e3cef0fbc18108f9bb649aa77bfc38aba
|
||||
@@ -856,7 +855,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 bb75e406c9b64931f3dc7e7f04626633365bb22f
|
||||
F test/main.test 16131264ea0c2b93b95201f0c92958e85f2ba11a
|
||||
F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9
|
||||
F test/malloc.test 21c213365f2cca95ab2d7dc078dc8525f96065f8
|
||||
F test/malloc3.test e3b32c724b5a124b57cb0ed177f675249ad0c66a
|
||||
@@ -890,7 +889,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 6430dabfb4b4fa480633590118964201f94d3ccc
|
||||
F test/misc1.test 48ebfb5b22a6a058f7b7e1df211226dd1d21409c
|
||||
F test/misc2.test 00d7de54eda90e237fc9a38b9e5ccc769ebf6d4d
|
||||
F test/misc3.test cf3dda47d5dda3e53fc5804a100d3c82be736c9d
|
||||
F test/misc4.test 0d8be3466adf123a7791a66ba2bc8e8d229e87f3
|
||||
@@ -932,7 +931,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 f49df1a8b0e38b9ee3a7dd2ab4d427507b7314ce
|
||||
F test/pager1.test 1acbdb14c5952a72dd43129cabdbf69aaa3ed1fa
|
||||
F test/pager2.test 67b8f40ae98112bcdba1f2b2d03ea83266418c71
|
||||
F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f
|
||||
F test/pager4.test a122e9e6925d5b23b31e3dfef8c6a44bbf19590e
|
||||
@@ -945,7 +944,7 @@ F test/parser1.test 222b5cbf3e2e659fec1bf7d723488c8b9c94f1d0
|
||||
F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
|
||||
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
|
||||
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
|
||||
F test/permutations.test 382a43c49f49bafe6fddffe904ea33d6bb3ff33e
|
||||
F test/permutations.test 7c9e145c9b888f719daa28a843db2c25f04f8b1d
|
||||
F test/pragma.test 507ac7ef2ea5682241ea0ef041799ca70bb5e0bf
|
||||
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
|
||||
F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c
|
||||
@@ -964,9 +963,8 @@ 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/releasetest.tcl a246ecb14ed594bf44bf77bd21df873971d779bf
|
||||
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
|
||||
F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea
|
||||
F test/rollback2.test 8435d6ff0f13f51d2a4181c232e706005fa90fc5
|
||||
@@ -1052,7 +1050,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 947421c324f5cd4cb3dcae1ec214e4be763df718
|
||||
F test/speedtest1.c f8bf04214e7b5f745feea99f7bde68b1c4870666
|
||||
F test/spellfix.test f9c1f431e2c096c8775fec032952320c0e4700db
|
||||
F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3
|
||||
F test/spellfix3.test f7bf7b3482971473d32b6b00f6944c5c066cff97
|
||||
@@ -1080,7 +1078,7 @@ F test/tclsqlite.test 7fb866443c7deceed22b63948ccd6f76b52ad054
|
||||
F test/tempdb.test 19d0f66e2e3eeffd68661a11c83ba5e6ace9128c
|
||||
F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30
|
||||
F test/temptrigger.test 8ec228b0db5d7ebc4ee9b458fc28cb9e7873f5e1
|
||||
F test/tester.tcl 750365ff97047ded5f2d6e28df82a998f7c66ae0
|
||||
F test/tester.tcl 462376b478c1429030911b4cb7c8c517ef1fbd9b
|
||||
F test/thread001.test 9f22fd3525a307ff42a326b6bc7b0465be1745a5
|
||||
F test/thread002.test e630504f8a06c00bf8bbe68528774dd96aeb2e58
|
||||
F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7
|
||||
@@ -1380,8 +1378,8 @@ F tool/fuzzershell.c 94019b185caceffc9f7c7b678a6489e42bc2aefa
|
||||
F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4
|
||||
F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5
|
||||
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
|
||||
F tool/lemon.c 251f5c3f21b553240cbdd42dd187a51bb2372cd3
|
||||
F tool/lempar.c d5114c7d13aa3af1e27ff3d02e4dea6eadec7ddf
|
||||
F tool/lemon.c 799e73e19a33b8dd7767a7fa34618ed2a9c2397d
|
||||
F tool/lempar.c 3ec1463a034b37d87d782be5f6b8b10a3b1ecbe7
|
||||
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
|
||||
F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6
|
||||
F tool/mkautoconfamal.sh c78caa3214f25dc28ea157b5a82abb311f209906
|
||||
@@ -1427,30 +1425,12 @@ F tool/varint.c 5d94cb5003db9dbbcbcc5df08d66f16071aee003
|
||||
F tool/vdbe-compress.tcl 5926c71f9c12d2ab73ef35c29376e756eb68361c
|
||||
F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh a98af506df552f3b3c0d904f94e4cdc4e1a6d598
|
||||
F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
F vsixtest/App.xaml b76d3b48860e7454775c47ea38ffea9c4abe3e85
|
||||
F vsixtest/App.xaml.cpp c465147f50871165c60ca16955219f6c5812d6d8
|
||||
F vsixtest/App.xaml.h 4a9768e2983d05600ad1e1c2f1b00a132967da9f
|
||||
F vsixtest/Assets/LockScreenLogo.scale-200.png e820c9a3deb909197081b0bf3216c06e13905f0a
|
||||
F vsixtest/Assets/SplashScreen.scale-200.png cab70988ca71bebec7bfeb3b6dbafe17b9ab0b4a
|
||||
F vsixtest/Assets/Square150x150Logo.scale-200.png e17b40817db7a239fc239d83efcc951fb824e3ff
|
||||
F vsixtest/Assets/Square44x44Logo.scale-200.png 2f166237094dea94d952d10b9eeae81806844f1c
|
||||
F vsixtest/Assets/Square44x44Logo.targetsize-24_altform-unplated.png 5f6a6d391b95a3061ccca6e6fdd6955ede63b4ed
|
||||
F vsixtest/Assets/StoreLogo.png 0828b7257db74a4ecd5eeb6b7b4971f0fdc4d9d1
|
||||
F vsixtest/Assets/Wide310x150Logo.scale-200.png 04ddefe5bc5f43ae12a7433f6f236ddab101ac42
|
||||
F vsixtest/MainPage.xaml 34f49897e3ca533a7e74506ba0759b66eebce151
|
||||
F vsixtest/MainPage.xaml.cpp 7f31fc6de751b64676c0924c97a5485d950a91d7
|
||||
F vsixtest/MainPage.xaml.h cc05cca10d50a003f6c6e4448b701cdd07f52f29
|
||||
F vsixtest/Package.appxmanifest 6b6db1eb7df3a315c5d681059754d5f0e0c47a93
|
||||
F vsixtest/pch.cpp cb823cfac36f1a39a7eb0acbd7e9a0b0de8f23af
|
||||
F vsixtest/pch.h 9cab7980f2ac4baa40807d8b5e52af32a21cf78c
|
||||
F vsixtest/vsixtest.sln 77cadbe4e96c1fe1bf51cd77de9e9b0a12ada547
|
||||
F vsixtest/vsixtest.tcl 463b7aa846f8f1bdadf2aadb1ac84c34c247437c
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 4fe7c4e90b7adbb1630b4aa15709968a1fcc7d83
|
||||
R fa3049ef82e4175b0a6df31159094b76
|
||||
U mistachkin
|
||||
Z bc452bd15f3f1d06988b3918e97baf68
|
||||
P b1258814f6100f594210775e9e3007b5b0c65025
|
||||
R da5680e10572eb2ee67e7f4f853b931e
|
||||
T +bgcolor * #d0c0ff
|
||||
T +sym-release *
|
||||
T +sym-version-3.11.1 *
|
||||
U drh
|
||||
Z ad71638129773a9e26cf148e72895b35
|
||||
|
||||
@@ -1 +1 @@
|
||||
799d5f09ed058898167e43bd9c8d1bf8c5df23ba
|
||||
f047920ce16971e573bc6ec9a48b118c9de2b3a7
|
||||
@@ -229,7 +229,7 @@ static void renameTriggerFunc(
|
||||
** Register built-in functions used to help implement ALTER TABLE
|
||||
*/
|
||||
void sqlite3AlterFunctions(void){
|
||||
static FuncDef aAlterTableFuncs[] = {
|
||||
static SQLITE_WSD FuncDef aAlterTableFuncs[] = {
|
||||
FUNCTION(sqlite_rename_table, 2, 0, 0, renameTableFunc),
|
||||
#ifndef SQLITE_OMIT_TRIGGER
|
||||
FUNCTION(sqlite_rename_trigger, 2, 0, 0, renameTriggerFunc),
|
||||
@@ -238,7 +238,13 @@ void sqlite3AlterFunctions(void){
|
||||
FUNCTION(sqlite_rename_parent, 3, 0, 0, renameParentFunc),
|
||||
#endif
|
||||
};
|
||||
sqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs));
|
||||
int i;
|
||||
FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions);
|
||||
FuncDef *aFunc = (FuncDef*)&GLOBAL(FuncDef, aAlterTableFuncs);
|
||||
|
||||
for(i=0; i<ArraySize(aAlterTableFuncs); i++){
|
||||
sqlite3FuncDefInsert(pHash, &aFunc[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -481,7 +481,8 @@ static const FuncDef statInitFuncdef = {
|
||||
statInit, /* xSFunc */
|
||||
0, /* xFinalize */
|
||||
"stat_init", /* zName */
|
||||
{0}
|
||||
0, /* pHash */
|
||||
0 /* pDestructor */
|
||||
};
|
||||
|
||||
#ifdef SQLITE_ENABLE_STAT4
|
||||
@@ -780,7 +781,8 @@ static const FuncDef statPushFuncdef = {
|
||||
statPush, /* xSFunc */
|
||||
0, /* xFinalize */
|
||||
"stat_push", /* zName */
|
||||
{0}
|
||||
0, /* pHash */
|
||||
0 /* pDestructor */
|
||||
};
|
||||
|
||||
#define STAT_GET_STAT1 0 /* "stat" column of stat1 table */
|
||||
@@ -925,7 +927,8 @@ static const FuncDef statGetFuncdef = {
|
||||
statGet, /* xSFunc */
|
||||
0, /* xFinalize */
|
||||
"stat_get", /* zName */
|
||||
{0}
|
||||
0, /* pHash */
|
||||
0 /* pDestructor */
|
||||
};
|
||||
|
||||
static void callStatGet(Vdbe *v, int regStat4, int iParam, int regOut){
|
||||
@@ -1670,7 +1673,7 @@ static int loadStatTbl(
|
||||
assert( db->lookaside.bDisable );
|
||||
zSql = sqlite3MPrintf(db, zSql1, zDb);
|
||||
if( !zSql ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);
|
||||
sqlite3DbFree(db, zSql);
|
||||
@@ -1710,7 +1713,7 @@ static int loadStatTbl(
|
||||
pIdx->aSample = sqlite3DbMallocZero(db, nByte);
|
||||
if( pIdx->aSample==0 ){
|
||||
sqlite3_finalize(pStmt);
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
pSpace = (tRowcnt*)&pIdx->aSample[nSample];
|
||||
pIdx->aAvgEq = pSpace; pSpace += nIdxCol;
|
||||
@@ -1726,7 +1729,7 @@ static int loadStatTbl(
|
||||
|
||||
zSql = sqlite3MPrintf(db, zSql2, zDb);
|
||||
if( !zSql ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);
|
||||
sqlite3DbFree(db, zSql);
|
||||
@@ -1764,7 +1767,7 @@ static int loadStatTbl(
|
||||
pSample->p = sqlite3DbMallocZero(db, pSample->n + 2);
|
||||
if( pSample->p==0 ){
|
||||
sqlite3_finalize(pStmt);
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
memcpy(pSample->p, sqlite3_column_blob(pStmt, 4), pSample->n);
|
||||
pIdx->nSample++;
|
||||
@@ -1853,7 +1856,7 @@ int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
|
||||
zSql = sqlite3MPrintf(db,
|
||||
"SELECT tbl,idx,stat FROM %Q.sqlite_stat1", sInfo.zDatabase);
|
||||
if( zSql==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
rc = sqlite3_exec(db, zSql, analysisLoader, &sInfo, 0);
|
||||
sqlite3DbFree(db, zSql);
|
||||
|
||||
@@ -144,7 +144,7 @@ static void attachFunc(
|
||||
Pager *pPager;
|
||||
aNew->pSchema = sqlite3SchemaGet(db, aNew->pBt);
|
||||
if( !aNew->pSchema ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}else if( aNew->pSchema->file_format && aNew->pSchema->enc!=ENC(db) ){
|
||||
zErrDyn = sqlite3MPrintf(db,
|
||||
"attached databases must use the same text encoding as main database");
|
||||
@@ -164,7 +164,7 @@ static void attachFunc(
|
||||
aNew->safety_level = 3;
|
||||
aNew->zName = sqlite3DbStrDup(db, zName);
|
||||
if( rc==SQLITE_OK && aNew->zName==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
|
||||
@@ -392,7 +392,8 @@ void sqlite3Detach(Parse *pParse, Expr *pDbname){
|
||||
detachFunc, /* xSFunc */
|
||||
0, /* xFinalize */
|
||||
"sqlite_detach", /* zName */
|
||||
{0}
|
||||
0, /* pHash */
|
||||
0 /* pDestructor */
|
||||
};
|
||||
codeAttach(pParse, SQLITE_DETACH, &detach_func, pDbname, 0, 0, pDbname);
|
||||
}
|
||||
@@ -411,7 +412,8 @@ void sqlite3Attach(Parse *pParse, Expr *p, Expr *pDbname, Expr *pKey){
|
||||
attachFunc, /* xSFunc */
|
||||
0, /* xFinalize */
|
||||
"sqlite_attach", /* zName */
|
||||
{0}
|
||||
0, /* pHash */
|
||||
0 /* pDestructor */
|
||||
};
|
||||
codeAttach(pParse, SQLITE_ATTACH, &attach_func, p, p, pDbname, pKey);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){
|
||||
pParse = sqlite3StackAllocZero(pErrorDb, sizeof(*pParse));
|
||||
if( pParse==0 ){
|
||||
sqlite3ErrorWithMsg(pErrorDb, SQLITE_NOMEM, "out of memory");
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
pParse->db = pDb;
|
||||
if( sqlite3OpenTempDatabase(pParse) ){
|
||||
@@ -182,7 +182,7 @@ sqlite3_backup *sqlite3_backup_init(
|
||||
** sqlite3_backup_finish(). */
|
||||
p = (sqlite3_backup *)sqlite3MallocZero(sizeof(sqlite3_backup));
|
||||
if( !p ){
|
||||
sqlite3Error(pDestDb, SQLITE_NOMEM_BKPT);
|
||||
sqlite3Error(pDestDb, SQLITE_NOMEM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,7 +581,7 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){
|
||||
}
|
||||
|
||||
if( rc==SQLITE_IOERR_NOMEM ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
p->rc = rc;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ int sqlite3BitvecSet(Bitvec *p, u32 i){
|
||||
i = i%p->iDivisor;
|
||||
if( p->u.apSub[bin]==0 ){
|
||||
p->u.apSub[bin] = sqlite3BitvecCreate( p->iDivisor );
|
||||
if( p->u.apSub[bin]==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( p->u.apSub[bin]==0 ) return SQLITE_NOMEM;
|
||||
}
|
||||
p = p->u.apSub[bin];
|
||||
}
|
||||
@@ -212,7 +212,7 @@ bitvec_set_rehash:
|
||||
int rc;
|
||||
u32 *aiValues = sqlite3StackAllocRaw(0, sizeof(p->u.aHash));
|
||||
if( aiValues==0 ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}else{
|
||||
memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash));
|
||||
memset(p->u.apSub, 0, sizeof(p->u.apSub));
|
||||
|
||||
@@ -350,7 +350,7 @@ static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
|
||||
if( !pLock ){
|
||||
pLock = (BtLock *)sqlite3MallocZero(sizeof(BtLock));
|
||||
if( !pLock ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
pLock->iTable = iTable;
|
||||
pLock->pBtree = p;
|
||||
@@ -553,7 +553,7 @@ static int btreeSetHasContent(BtShared *pBt, Pgno pgno){
|
||||
assert( pgno<=pBt->nPage );
|
||||
pBt->pHasContent = sqlite3BitvecCreate(pBt->nPage);
|
||||
if( !pBt->pHasContent ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
}
|
||||
if( rc==SQLITE_OK && pgno<=sqlite3BitvecSize(pBt->pHasContent) ){
|
||||
@@ -632,7 +632,7 @@ static int saveCursorKey(BtCursor *pCur){
|
||||
sqlite3_free(pKey);
|
||||
}
|
||||
}else{
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
}
|
||||
assert( !pCur->curIntKey || !pCur->pKey );
|
||||
@@ -764,7 +764,7 @@ static int btreeMoveto(
|
||||
pIdxKey = sqlite3VdbeAllocUnpackedRecord(
|
||||
pCur->pKeyInfo, aSpace, sizeof(aSpace), &pFree
|
||||
);
|
||||
if( pIdxKey==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( pIdxKey==0 ) return SQLITE_NOMEM;
|
||||
sqlite3VdbeRecordUnpack(pCur->pKeyInfo, (int)nKey, pKey, pIdxKey);
|
||||
if( pIdxKey->nField==0 ){
|
||||
sqlite3DbFree(pCur->pKeyInfo->db, pFree);
|
||||
@@ -2176,7 +2176,7 @@ int sqlite3BtreeOpen(
|
||||
}
|
||||
p = sqlite3MallocZero(sizeof(Btree));
|
||||
if( !p ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
p->inTrans = TRANS_NONE;
|
||||
p->db = db;
|
||||
@@ -2200,7 +2200,7 @@ int sqlite3BtreeOpen(
|
||||
p->sharable = 1;
|
||||
if( !zFullPathname ){
|
||||
sqlite3_free(p);
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
if( isMemdb ){
|
||||
memcpy(zFullPathname, zFilename, nFilename);
|
||||
@@ -2268,7 +2268,7 @@ int sqlite3BtreeOpen(
|
||||
|
||||
pBt = sqlite3MallocZero( sizeof(*pBt) );
|
||||
if( pBt==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto btree_open_out;
|
||||
}
|
||||
rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename,
|
||||
@@ -2337,7 +2337,7 @@ int sqlite3BtreeOpen(
|
||||
if( SQLITE_THREADSAFE && sqlite3GlobalConfig.bCoreMutex ){
|
||||
pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST);
|
||||
if( pBt->mutex==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto btree_open_out;
|
||||
}
|
||||
}
|
||||
@@ -2619,6 +2619,21 @@ 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
|
||||
@@ -4099,7 +4114,7 @@ static int btreeCursor(
|
||||
|
||||
if( wrFlag ){
|
||||
allocateTempSpace(pBt);
|
||||
if( pBt->pTmpSpace==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( pBt->pTmpSpace==0 ) return SQLITE_NOMEM;
|
||||
}
|
||||
if( iTable==1 && btreePagecount(pBt)==0 ){
|
||||
assert( wrFlag==0 );
|
||||
@@ -4497,7 +4512,7 @@ static int accessPayload(
|
||||
pCur->aOverflow, nOvfl*2*sizeof(Pgno)
|
||||
);
|
||||
if( aNew==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
pCur->nOvflAlloc = nOvfl*2;
|
||||
pCur->aOverflow = aNew;
|
||||
@@ -5202,7 +5217,7 @@ int sqlite3BtreeMovetoUnpacked(
|
||||
}
|
||||
pCellKey = sqlite3Malloc( nCell+18 );
|
||||
if( pCellKey==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto moveto_finish;
|
||||
}
|
||||
pCur->aiIdx[pCur->iPage] = (u16)idx;
|
||||
@@ -7021,7 +7036,7 @@ static int balance_nonroot(
|
||||
assert( pParent->nOverflow==0 || pParent->aiOvfl[0]==iParentIdx );
|
||||
|
||||
if( !aOvflSpace ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
/* Find the sibling pages to balance. Also locate the cells in pParent
|
||||
@@ -7121,7 +7136,7 @@ static int balance_nonroot(
|
||||
assert( szScratch<=6*(int)pBt->pageSize );
|
||||
b.apCell = sqlite3ScratchMalloc( szScratch );
|
||||
if( b.apCell==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto balance_cleanup;
|
||||
}
|
||||
b.szCell = (u16*)&b.apCell[nMaxCells];
|
||||
|
||||
@@ -68,6 +68,7 @@ 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);
|
||||
|
||||
@@ -710,8 +710,12 @@ int sqlite3FindDbName(sqlite3 *db, const char *zName){
|
||||
int i = -1; /* Database number */
|
||||
if( zName ){
|
||||
Db *pDb;
|
||||
int n = sqlite3Strlen30(zName);
|
||||
for(i=(db->nDb-1), pDb=&db->aDb[i]; i>=0; i--, pDb--){
|
||||
if( 0==sqlite3StrICmp(pDb->zName, zName) ) break;
|
||||
if( (!OMIT_TEMPDB || i!=1 ) && n==sqlite3Strlen30(pDb->zName) &&
|
||||
0==sqlite3StrICmp(pDb->zName, zName) ){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
@@ -923,7 +927,7 @@ void sqlite3StartTable(
|
||||
pTable = sqlite3DbMallocZero(db, sizeof(Table));
|
||||
if( pTable==0 ){
|
||||
assert( db->mallocFailed );
|
||||
pParse->rc = SQLITE_NOMEM_BKPT;
|
||||
pParse->rc = SQLITE_NOMEM;
|
||||
pParse->nErr++;
|
||||
goto begin_table_error;
|
||||
}
|
||||
@@ -1604,7 +1608,7 @@ static int resizeIndexObject(sqlite3 *db, Index *pIdx, int N){
|
||||
assert( pIdx->isResized==0 );
|
||||
nByte = (sizeof(char*) + sizeof(i16) + 1)*N;
|
||||
zExtra = sqlite3DbMallocZero(db, nByte);
|
||||
if( zExtra==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( zExtra==0 ) return SQLITE_NOMEM;
|
||||
memcpy(zExtra, pIdx->azColl, sizeof(char*)*pIdx->nColumn);
|
||||
pIdx->azColl = (const char**)zExtra;
|
||||
zExtra += sizeof(char*)*N;
|
||||
@@ -3196,20 +3200,6 @@ 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
|
||||
@@ -3247,7 +3237,7 @@ Index *sqlite3CreateIndex(
|
||||
if( pIdx->aiColumn[k]!=pIndex->aiColumn[k] ) break;
|
||||
z1 = pIdx->azColl[k];
|
||||
z2 = pIndex->azColl[k];
|
||||
if( sqlite3StrICmp(z1, z2) ) break;
|
||||
if( z1!=z2 && sqlite3StrICmp(z1, z2) ) break;
|
||||
}
|
||||
if( k==pIdx->nKeyCol ){
|
||||
if( pIdx->onError!=pIndex->onError ){
|
||||
|
||||
@@ -284,12 +284,14 @@ static int matchQuality(
|
||||
** a pointer to the matching FuncDef if found, or 0 if there is no match.
|
||||
*/
|
||||
static FuncDef *functionSearch(
|
||||
FuncDefHash *pHash, /* Hash table to search */
|
||||
int h, /* Hash of the name */
|
||||
const char *zFunc /* Name of function */
|
||||
const char *zFunc, /* Name of function */
|
||||
int nFunc /* Number of bytes in zFunc */
|
||||
){
|
||||
FuncDef *p;
|
||||
for(p=sqlite3BuiltinFunctions.a[h]; p; p=p->u.pHash){
|
||||
if( sqlite3StrICmp(p->zName, zFunc)==0 ){
|
||||
for(p=pHash->a[h]; p; p=p->pHash){
|
||||
if( sqlite3StrNICmp(p->zName, zFunc, nFunc)==0 && p->zName[nFunc]==0 ){
|
||||
return p;
|
||||
}
|
||||
}
|
||||
@@ -299,26 +301,23 @@ static FuncDef *functionSearch(
|
||||
/*
|
||||
** Insert a new FuncDef into a FuncDefHash hash table.
|
||||
*/
|
||||
void sqlite3InsertBuiltinFuncs(
|
||||
FuncDef *aDef, /* List of global functions to be inserted */
|
||||
int nDef /* Length of the apDef[] list */
|
||||
void sqlite3FuncDefInsert(
|
||||
FuncDefHash *pHash, /* The hash table into which to insert */
|
||||
FuncDef *pDef /* The function definition to insert */
|
||||
){
|
||||
int i;
|
||||
for(i=0; i<nDef; i++){
|
||||
FuncDef *pOther;
|
||||
const char *zName = aDef[i].zName;
|
||||
int nName = sqlite3Strlen30(zName);
|
||||
int h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % SQLITE_FUNC_HASH_SZ;
|
||||
pOther = functionSearch(h, zName);
|
||||
if( pOther ){
|
||||
assert( pOther!=&aDef[i] && pOther->pNext!=&aDef[i] );
|
||||
aDef[i].pNext = pOther->pNext;
|
||||
pOther->pNext = &aDef[i];
|
||||
}else{
|
||||
aDef[i].pNext = 0;
|
||||
aDef[i].u.pHash = sqlite3BuiltinFunctions.a[h];
|
||||
sqlite3BuiltinFunctions.a[h] = &aDef[i];
|
||||
}
|
||||
FuncDef *pOther;
|
||||
int nName = sqlite3Strlen30(pDef->zName);
|
||||
u8 c1 = (u8)pDef->zName[0];
|
||||
int h = (sqlite3UpperToLower[c1] + nName) % ArraySize(pHash->a);
|
||||
pOther = functionSearch(pHash, h, pDef->zName, nName);
|
||||
if( pOther ){
|
||||
assert( pOther!=pDef && pOther->pNext!=pDef );
|
||||
pDef->pNext = pOther->pNext;
|
||||
pOther->pNext = pDef;
|
||||
}else{
|
||||
pDef->pNext = 0;
|
||||
pDef->pHash = pHash->a[h];
|
||||
pHash->a[h] = pDef;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,7 +344,8 @@ void sqlite3InsertBuiltinFuncs(
|
||||
*/
|
||||
FuncDef *sqlite3FindFunction(
|
||||
sqlite3 *db, /* An open database */
|
||||
const char *zName, /* Name of the function. zero-terminated */
|
||||
const char *zName, /* Name of the function. Not null-terminated */
|
||||
int nName, /* Number of characters in the name */
|
||||
int nArg, /* Number of arguments. -1 means any number */
|
||||
u8 enc, /* Preferred text encoding */
|
||||
u8 createFlag /* Create new entry if true and does not otherwise exist */
|
||||
@@ -354,15 +354,14 @@ FuncDef *sqlite3FindFunction(
|
||||
FuncDef *pBest = 0; /* Best match found so far */
|
||||
int bestScore = 0; /* Score of best match */
|
||||
int h; /* Hash value */
|
||||
int nName; /* Length of the name */
|
||||
|
||||
assert( nArg>=(-2) );
|
||||
assert( nArg>=(-1) || createFlag==0 );
|
||||
nName = sqlite3Strlen30(zName);
|
||||
h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % ArraySize(db->aFunc.a);
|
||||
|
||||
/* First search for a match amongst the application-defined functions.
|
||||
*/
|
||||
p = (FuncDef*)sqlite3HashFind(&db->aFunc, zName);
|
||||
p = functionSearch(&db->aFunc, h, zName, nName);
|
||||
while( p ){
|
||||
int score = matchQuality(p, nArg, enc);
|
||||
if( score>bestScore ){
|
||||
@@ -385,9 +384,9 @@ FuncDef *sqlite3FindFunction(
|
||||
** So we must not search for built-ins when creating a new function.
|
||||
*/
|
||||
if( !createFlag && (pBest==0 || (db->flags & SQLITE_PreferBuiltin)!=0) ){
|
||||
FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions);
|
||||
bestScore = 0;
|
||||
h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % SQLITE_FUNC_HASH_SZ;
|
||||
p = functionSearch(h, zName);
|
||||
p = functionSearch(pHash, h, zName, nName);
|
||||
while( p ){
|
||||
int score = matchQuality(p, nArg, enc);
|
||||
if( score>bestScore ){
|
||||
@@ -404,19 +403,12 @@ FuncDef *sqlite3FindFunction(
|
||||
*/
|
||||
if( createFlag && bestScore<FUNC_PERFECT_MATCH &&
|
||||
(pBest = sqlite3DbMallocZero(db, sizeof(*pBest)+nName+1))!=0 ){
|
||||
FuncDef *pOther;
|
||||
pBest->zName = (const char*)&pBest[1];
|
||||
pBest->zName = (char *)&pBest[1];
|
||||
pBest->nArg = (u16)nArg;
|
||||
pBest->funcFlags = enc;
|
||||
memcpy((char*)&pBest[1], zName, nName+1);
|
||||
pOther = (FuncDef*)sqlite3HashInsert(&db->aFunc, pBest->zName, pBest);
|
||||
if( pOther==pBest ){
|
||||
sqlite3DbFree(db, pBest);
|
||||
sqlite3OomFault(db);
|
||||
return 0;
|
||||
}else{
|
||||
pBest->pNext = pOther;
|
||||
}
|
||||
memcpy(pBest->zName, zName, nName);
|
||||
pBest->zName[nName] = 0;
|
||||
sqlite3FuncDefInsert(&db->aFunc, pBest);
|
||||
}
|
||||
|
||||
if( pBest && (pBest->xSFunc || createFlag) ){
|
||||
|
||||
@@ -281,7 +281,7 @@ int sqlite3_complete16(const void *zSql){
|
||||
if( zSql8 ){
|
||||
rc = sqlite3_complete(zSql8);
|
||||
}else{
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
sqlite3ValueFree(pVal);
|
||||
return rc & 0xff;
|
||||
|
||||
@@ -1136,7 +1136,7 @@ static void currentTimeFunc(
|
||||
** external linkage.
|
||||
*/
|
||||
void sqlite3RegisterDateTimeFunctions(void){
|
||||
static FuncDef aDateTimeFuncs[] = {
|
||||
static SQLITE_WSD FuncDef aDateTimeFuncs[] = {
|
||||
#ifndef SQLITE_OMIT_DATETIME_FUNCS
|
||||
DFUNCTION(julianday, -1, 0, 0, juliandayFunc ),
|
||||
DFUNCTION(date, -1, 0, 0, dateFunc ),
|
||||
@@ -1152,5 +1152,11 @@ void sqlite3RegisterDateTimeFunctions(void){
|
||||
STR_FUNCTION(current_timestamp, 0, "%Y-%m-%d %H:%M:%S", 0, currentTimeFunc),
|
||||
#endif
|
||||
};
|
||||
sqlite3InsertBuiltinFuncs(aDateTimeFuncs, ArraySize(aDateTimeFuncs));
|
||||
int i;
|
||||
FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions);
|
||||
FuncDef *aFunc = (FuncDef*)&GLOBAL(FuncDef, aDateTimeFuncs);
|
||||
|
||||
for(i=0; i<ArraySize(aDateTimeFuncs); i++){
|
||||
sqlite3FuncDefInsert(pHash, &aFunc[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ static int statConnect(
|
||||
rc = sqlite3_declare_vtab(db, VTAB_SCHEMA);
|
||||
if( rc==SQLITE_OK ){
|
||||
pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable));
|
||||
if( pTab==0 ) rc = SQLITE_NOMEM_BKPT;
|
||||
if( pTab==0 ) rc = SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
assert( rc==SQLITE_OK || pTab==0 );
|
||||
@@ -243,7 +243,7 @@ static int statOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
|
||||
|
||||
pCsr = (StatCursor *)sqlite3_malloc64(sizeof(StatCursor));
|
||||
if( pCsr==0 ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}else{
|
||||
memset(pCsr, 0, sizeof(StatCursor));
|
||||
pCsr->base.pVtab = pVTab;
|
||||
@@ -349,7 +349,7 @@ static int statDecodePage(Btree *pBt, StatPage *p){
|
||||
nUsable = szPage - sqlite3BtreeGetReserveNoMutex(pBt);
|
||||
sqlite3BtreeLeave(pBt);
|
||||
p->aCell = sqlite3_malloc64((p->nCell+1) * sizeof(StatCell));
|
||||
if( p->aCell==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( p->aCell==0 ) return SQLITE_NOMEM;
|
||||
memset(p->aCell, 0, (p->nCell+1) * sizeof(StatCell));
|
||||
|
||||
for(i=0; i<p->nCell; i++){
|
||||
@@ -382,7 +382,7 @@ static int statDecodePage(Btree *pBt, StatPage *p){
|
||||
pCell->nLastOvfl = (nPayload-nLocal) - (nOvfl-1) * (nUsable-4);
|
||||
pCell->nOvfl = nOvfl;
|
||||
pCell->aOvfl = sqlite3_malloc64(sizeof(u32)*nOvfl);
|
||||
if( pCell->aOvfl==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( pCell->aOvfl==0 ) return SQLITE_NOMEM;
|
||||
pCell->aOvfl[0] = sqlite3Get4byte(&aData[iOff+nLocal]);
|
||||
for(j=1; j<nOvfl; j++){
|
||||
int rc;
|
||||
@@ -461,7 +461,7 @@ statNextRestart:
|
||||
pCsr->aPage[0].iCell = 0;
|
||||
pCsr->aPage[0].zPath = z = sqlite3_mprintf("/");
|
||||
pCsr->iPage = 0;
|
||||
if( z==0 ) rc = SQLITE_NOMEM_BKPT;
|
||||
if( z==0 ) rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
pCsr->isEof = 1;
|
||||
return sqlite3_reset(pCsr->pStmt);
|
||||
@@ -496,7 +496,7 @@ statNextRestart:
|
||||
}
|
||||
pCell->iOvfl++;
|
||||
statSizeAndOffset(pCsr);
|
||||
return z==0 ? SQLITE_NOMEM_BKPT : SQLITE_OK;
|
||||
return z==0 ? SQLITE_NOMEM : SQLITE_OK;
|
||||
}
|
||||
if( p->iRightChildPg ) break;
|
||||
p->iCell++;
|
||||
@@ -520,7 +520,7 @@ statNextRestart:
|
||||
p[1].iCell = 0;
|
||||
p[1].zPath = z = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell);
|
||||
p->iCell++;
|
||||
if( z==0 ) rc = SQLITE_NOMEM_BKPT;
|
||||
if( z==0 ) rc = SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
|
||||
@@ -554,7 +554,7 @@ statNextRestart:
|
||||
pCsr->nUnused = p->nUnused;
|
||||
pCsr->nMxPayload = p->nMxPayload;
|
||||
pCsr->zPath = z = sqlite3_mprintf("%s", p->zPath);
|
||||
if( z==0 ) rc = SQLITE_NOMEM_BKPT;
|
||||
if( z==0 ) rc = SQLITE_NOMEM;
|
||||
nPayload = 0;
|
||||
for(i=0; i<p->nCell; i++){
|
||||
nPayload += p->aCell[i].nLocal;
|
||||
@@ -588,7 +588,7 @@ static int statFilter(
|
||||
if( pCsr->iDb<0 ){
|
||||
sqlite3_free(pCursor->pVtab->zErrMsg);
|
||||
pCursor->pVtab->zErrMsg = sqlite3_mprintf("no such schema: %s", zDbase);
|
||||
return pCursor->pVtab->zErrMsg ? SQLITE_ERROR : SQLITE_NOMEM_BKPT;
|
||||
return pCursor->pVtab->zErrMsg ? SQLITE_ERROR : SQLITE_NOMEM;
|
||||
}
|
||||
}else{
|
||||
pCsr->iDb = pTab->iDb;
|
||||
@@ -604,7 +604,7 @@ static int statFilter(
|
||||
" FROM \"%w\".%s WHERE rootpage!=0"
|
||||
" ORDER BY name", pTab->db->aDb[pCsr->iDb].zName, zMaster);
|
||||
if( zSql==0 ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}else{
|
||||
rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0);
|
||||
sqlite3_free(zSql);
|
||||
|
||||
@@ -2888,6 +2888,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
|
||||
ExprList *pFarg; /* List of function arguments */
|
||||
int nFarg; /* Number of function arguments */
|
||||
FuncDef *pDef; /* The function definition object */
|
||||
int nId; /* Length of the function name in bytes */
|
||||
const char *zId; /* The function name */
|
||||
u32 constMask = 0; /* Mask of function arguments that are constant */
|
||||
int i; /* Loop counter */
|
||||
@@ -2903,9 +2904,10 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
|
||||
nFarg = pFarg ? pFarg->nExpr : 0;
|
||||
assert( !ExprHasProperty(pExpr, EP_IntValue) );
|
||||
zId = pExpr->u.zToken;
|
||||
pDef = sqlite3FindFunction(db, zId, nFarg, enc, 0);
|
||||
nId = sqlite3Strlen30(zId);
|
||||
pDef = sqlite3FindFunction(db, zId, nId, nFarg, enc, 0);
|
||||
if( pDef==0 || pDef->xFinalize!=0 ){
|
||||
sqlite3ErrorMsg(pParse, "unknown function: %s()", zId);
|
||||
sqlite3ErrorMsg(pParse, "unknown function: %.*s()", nId, zId);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4130,7 +4132,7 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
|
||||
pItem->iMem = ++pParse->nMem;
|
||||
assert( !ExprHasProperty(pExpr, EP_IntValue) );
|
||||
pItem->pFunc = sqlite3FindFunction(pParse->db,
|
||||
pExpr->u.zToken,
|
||||
pExpr->u.zToken, sqlite3Strlen30(pExpr->u.zToken),
|
||||
pExpr->x.pList ? pExpr->x.pList->nExpr : 0, enc, 0);
|
||||
if( pExpr->flags & EP_Distinct ){
|
||||
pItem->iDistinct = pParse->nTab++;
|
||||
|
||||
@@ -1611,7 +1611,7 @@ static void groupConcatFinalize(sqlite3_context *context){
|
||||
** of the built-in functions above are part of the global function set.
|
||||
** This routine only deals with those that are not global.
|
||||
*/
|
||||
void sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3 *db){
|
||||
void sqlite3RegisterBuiltinFunctions(sqlite3 *db){
|
||||
int rc = sqlite3_overload_function(db, "MATCH", 2);
|
||||
assert( rc==SQLITE_NOMEM || rc==SQLITE_OK );
|
||||
if( rc==SQLITE_NOMEM ){
|
||||
@@ -1624,7 +1624,8 @@ void sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3 *db){
|
||||
*/
|
||||
static void setLikeOptFlag(sqlite3 *db, const char *zName, u8 flagVal){
|
||||
FuncDef *pDef;
|
||||
pDef = sqlite3FindFunction(db, zName, 2, SQLITE_UTF8, 0);
|
||||
pDef = sqlite3FindFunction(db, zName, sqlite3Strlen30(zName),
|
||||
2, SQLITE_UTF8, 0);
|
||||
if( ALWAYS(pDef) ){
|
||||
pDef->funcFlags |= flagVal;
|
||||
}
|
||||
@@ -1672,7 +1673,9 @@ int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){
|
||||
return 0;
|
||||
}
|
||||
assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
|
||||
pDef = sqlite3FindFunction(db, pExpr->u.zToken, 2, SQLITE_UTF8, 0);
|
||||
pDef = sqlite3FindFunction(db, pExpr->u.zToken,
|
||||
sqlite3Strlen30(pExpr->u.zToken),
|
||||
2, SQLITE_UTF8, 0);
|
||||
if( NEVER(pDef==0) || (pDef->funcFlags & SQLITE_FUNC_LIKE)==0 ){
|
||||
return 0;
|
||||
}
|
||||
@@ -1696,7 +1699,7 @@ int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){
|
||||
**
|
||||
** After this routine runs
|
||||
*/
|
||||
void sqlite3RegisterBuiltinFunctions(void){
|
||||
void sqlite3RegisterGlobalFunctions(void){
|
||||
/*
|
||||
** The following array holds FuncDef structures for all of the functions
|
||||
** defined in this file.
|
||||
@@ -1704,27 +1707,8 @@ void sqlite3RegisterBuiltinFunctions(void){
|
||||
** The array cannot be constant since changes are made to the
|
||||
** FuncDef.pHash elements at start-time. The elements of this array
|
||||
** are read-only after initialization is complete.
|
||||
**
|
||||
** For peak efficiency, put the most frequently used function last.
|
||||
*/
|
||||
static FuncDef aBuiltinFunc[] = {
|
||||
#ifdef SQLITE_SOUNDEX
|
||||
FUNCTION(soundex, 1, 0, 0, soundexFunc ),
|
||||
#endif
|
||||
#ifndef SQLITE_OMIT_LOAD_EXTENSION
|
||||
VFUNCTION(load_extension, 1, 0, 0, loadExt ),
|
||||
VFUNCTION(load_extension, 2, 0, 0, loadExt ),
|
||||
#endif
|
||||
#if SQLITE_USER_AUTHENTICATION
|
||||
FUNCTION(sqlite_crypt, 2, 0, 0, sqlite3CryptFunc ),
|
||||
#endif
|
||||
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
|
||||
DFUNCTION(sqlite_compileoption_used,1, 0, 0, compileoptionusedFunc ),
|
||||
DFUNCTION(sqlite_compileoption_get, 1, 0, 0, compileoptiongetFunc ),
|
||||
#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
|
||||
FUNCTION2(unlikely, 1, 0, 0, noopFunc, SQLITE_FUNC_UNLIKELY),
|
||||
FUNCTION2(likelihood, 2, 0, 0, noopFunc, SQLITE_FUNC_UNLIKELY),
|
||||
FUNCTION2(likely, 1, 0, 0, noopFunc, SQLITE_FUNC_UNLIKELY),
|
||||
static SQLITE_WSD FuncDef aBuiltinFunc[] = {
|
||||
FUNCTION(ltrim, 1, 1, 0, trimFunc ),
|
||||
FUNCTION(ltrim, 2, 1, 0, trimFunc ),
|
||||
FUNCTION(rtrim, 1, 2, 0, trimFunc ),
|
||||
@@ -1742,6 +1726,8 @@ void sqlite3RegisterBuiltinFunctions(void){
|
||||
FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF),
|
||||
FUNCTION2(length, 1, 0, 0, lengthFunc, SQLITE_FUNC_LENGTH),
|
||||
FUNCTION(instr, 2, 0, 0, instrFunc ),
|
||||
FUNCTION(substr, 2, 0, 0, substrFunc ),
|
||||
FUNCTION(substr, 3, 0, 0, substrFunc ),
|
||||
FUNCTION(printf, -1, 0, 0, printfFunc ),
|
||||
FUNCTION(unicode, 1, 0, 0, unicodeFunc ),
|
||||
FUNCTION(char, -1, 0, 0, charFunc ),
|
||||
@@ -1752,22 +1738,40 @@ void sqlite3RegisterBuiltinFunctions(void){
|
||||
#endif
|
||||
FUNCTION(upper, 1, 0, 0, upperFunc ),
|
||||
FUNCTION(lower, 1, 0, 0, lowerFunc ),
|
||||
FUNCTION(coalesce, 1, 0, 0, 0 ),
|
||||
FUNCTION(coalesce, 0, 0, 0, 0 ),
|
||||
FUNCTION2(coalesce, -1, 0, 0, noopFunc, SQLITE_FUNC_COALESCE),
|
||||
FUNCTION(hex, 1, 0, 0, hexFunc ),
|
||||
FUNCTION2(ifnull, 2, 0, 0, noopFunc, SQLITE_FUNC_COALESCE),
|
||||
FUNCTION2(unlikely, 1, 0, 0, noopFunc, SQLITE_FUNC_UNLIKELY),
|
||||
FUNCTION2(likelihood, 2, 0, 0, noopFunc, SQLITE_FUNC_UNLIKELY),
|
||||
FUNCTION2(likely, 1, 0, 0, noopFunc, SQLITE_FUNC_UNLIKELY),
|
||||
VFUNCTION(random, 0, 0, 0, randomFunc ),
|
||||
VFUNCTION(randomblob, 1, 0, 0, randomBlob ),
|
||||
FUNCTION(nullif, 2, 0, 1, nullifFunc ),
|
||||
DFUNCTION(sqlite_version, 0, 0, 0, versionFunc ),
|
||||
DFUNCTION(sqlite_source_id, 0, 0, 0, sourceidFunc ),
|
||||
FUNCTION(sqlite_log, 2, 0, 0, errlogFunc ),
|
||||
#if SQLITE_USER_AUTHENTICATION
|
||||
FUNCTION(sqlite_crypt, 2, 0, 0, sqlite3CryptFunc ),
|
||||
#endif
|
||||
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
|
||||
DFUNCTION(sqlite_compileoption_used,1, 0, 0, compileoptionusedFunc ),
|
||||
DFUNCTION(sqlite_compileoption_get, 1, 0, 0, compileoptiongetFunc ),
|
||||
#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
|
||||
FUNCTION(quote, 1, 0, 0, quoteFunc ),
|
||||
VFUNCTION(last_insert_rowid, 0, 0, 0, last_insert_rowid),
|
||||
VFUNCTION(changes, 0, 0, 0, changes ),
|
||||
VFUNCTION(total_changes, 0, 0, 0, total_changes ),
|
||||
FUNCTION(replace, 3, 0, 0, replaceFunc ),
|
||||
FUNCTION(zeroblob, 1, 0, 0, zeroblobFunc ),
|
||||
FUNCTION(substr, 2, 0, 0, substrFunc ),
|
||||
FUNCTION(substr, 3, 0, 0, substrFunc ),
|
||||
#ifdef SQLITE_SOUNDEX
|
||||
FUNCTION(soundex, 1, 0, 0, soundexFunc ),
|
||||
#endif
|
||||
#ifndef SQLITE_OMIT_LOAD_EXTENSION
|
||||
VFUNCTION(load_extension, 1, 0, 0, loadExt ),
|
||||
VFUNCTION(load_extension, 2, 0, 0, loadExt ),
|
||||
#endif
|
||||
AGGREGATE(sum, 1, 0, 0, sumStep, sumFinalize ),
|
||||
AGGREGATE(total, 1, 0, 0, sumStep, totalFinalize ),
|
||||
AGGREGATE(avg, 1, 0, 0, sumStep, avgFinalize ),
|
||||
@@ -1785,32 +1789,20 @@ void sqlite3RegisterBuiltinFunctions(void){
|
||||
LIKEFUNC(like, 2, &likeInfoNorm, SQLITE_FUNC_LIKE),
|
||||
LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE),
|
||||
#endif
|
||||
FUNCTION(coalesce, 1, 0, 0, 0 ),
|
||||
FUNCTION(coalesce, 0, 0, 0, 0 ),
|
||||
FUNCTION2(coalesce, -1, 0, 0, noopFunc, SQLITE_FUNC_COALESCE),
|
||||
};
|
||||
|
||||
int i;
|
||||
FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions);
|
||||
FuncDef *aFunc = (FuncDef*)&GLOBAL(FuncDef, aBuiltinFunc);
|
||||
|
||||
for(i=0; i<ArraySize(aBuiltinFunc); i++){
|
||||
sqlite3FuncDefInsert(pHash, &aFunc[i]);
|
||||
}
|
||||
sqlite3RegisterDateTimeFunctions();
|
||||
#ifndef SQLITE_OMIT_ALTERTABLE
|
||||
sqlite3AlterFunctions();
|
||||
#endif
|
||||
#if defined(SQLITE_ENABLE_STAT3) || defined(SQLITE_ENABLE_STAT4)
|
||||
sqlite3AnalyzeFunctions();
|
||||
#endif
|
||||
sqlite3RegisterDateTimeFunctions();
|
||||
sqlite3InsertBuiltinFuncs(aBuiltinFunc, ArraySize(aBuiltinFunc));
|
||||
|
||||
#if 0 /* Enable to print out how the built-in functions are hashed */
|
||||
{
|
||||
int i;
|
||||
FuncDef *p;
|
||||
for(i=0; i<SQLITE_FUNC_HASH_SZ; i++){
|
||||
printf("FUNC-HASH %02d:", i);
|
||||
for(p=sqlite3BuiltinFunctions.a[i]; p; p=p->u.pHash){
|
||||
int n = sqlite3Strlen30(p->zName);
|
||||
int h = p->zName[0] + n;
|
||||
printf(" %s(%d)", p->zName, h);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = {
|
||||
** database connections. After initialization, this table is
|
||||
** read-only.
|
||||
*/
|
||||
FuncDefHash sqlite3BuiltinFunctions;
|
||||
SQLITE_WSD FuncDefHash sqlite3GlobalFunctions;
|
||||
|
||||
/*
|
||||
** Constant tokens for values 0 and 1.
|
||||
|
||||
@@ -212,7 +212,7 @@ int sqlite3JournalOpen(
|
||||
if( nBuf>0 ){
|
||||
p->zBuf = sqlite3MallocZero(nBuf);
|
||||
if( !p->zBuf ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
}else{
|
||||
return sqlite3OsOpen(pVfs, zName, pJfd, flags, 0);
|
||||
|
||||
@@ -131,7 +131,7 @@ exec_out:
|
||||
if( *pzErrMsg ){
|
||||
memcpy(*pzErrMsg, sqlite3_errmsg(db), nErrMsg);
|
||||
}else{
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
sqlite3Error(db, SQLITE_NOMEM);
|
||||
}
|
||||
}else if( pzErrMsg ){
|
||||
|
||||
@@ -478,7 +478,7 @@ static int sqlite3LoadExtension(
|
||||
#if SQLITE_OS_UNIX || SQLITE_OS_WIN
|
||||
for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){
|
||||
char *zAltFile = sqlite3_mprintf("%s.%s", zFile, azEndings[ii]);
|
||||
if( zAltFile==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( zAltFile==0 ) return SQLITE_NOMEM;
|
||||
handle = sqlite3OsDlOpen(pVfs, zAltFile);
|
||||
sqlite3_free(zAltFile);
|
||||
}
|
||||
@@ -514,7 +514,7 @@ static int sqlite3LoadExtension(
|
||||
zAltEntry = sqlite3_malloc64(ncFile+30);
|
||||
if( zAltEntry==0 ){
|
||||
sqlite3OsDlClose(pVfs, handle);
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
memcpy(zAltEntry, "sqlite3_", 8);
|
||||
for(iFile=ncFile-1; iFile>=0 && zFile[iFile]!='/'; iFile--){}
|
||||
@@ -557,7 +557,7 @@ static int sqlite3LoadExtension(
|
||||
/* Append the new shared library handle to the db->aExtension array. */
|
||||
aHandle = sqlite3DbMallocZero(db, sizeof(handle)*(db->nExtension+1));
|
||||
if( aHandle==0 ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
if( db->nExtension>0 ){
|
||||
memcpy(aHandle, db->aExtension, sizeof(handle)*db->nExtension);
|
||||
@@ -679,7 +679,7 @@ int sqlite3_auto_extension(void (*xInit)(void)){
|
||||
void (**aNew)(void);
|
||||
aNew = sqlite3_realloc64(wsdAutoext.aExt, nByte);
|
||||
if( aNew==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
wsdAutoext.aExt = aNew;
|
||||
wsdAutoext.aExt[wsdAutoext.nExt] = xInit;
|
||||
|
||||
@@ -187,7 +187,7 @@ int sqlite3_initialize(void){
|
||||
sqlite3GlobalConfig.pInitMutex =
|
||||
sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE);
|
||||
if( sqlite3GlobalConfig.bCoreMutex && !sqlite3GlobalConfig.pInitMutex ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -218,6 +218,7 @@ int sqlite3_initialize(void){
|
||||
*/
|
||||
sqlite3_mutex_enter(sqlite3GlobalConfig.pInitMutex);
|
||||
if( sqlite3GlobalConfig.isInit==0 && sqlite3GlobalConfig.inProgress==0 ){
|
||||
FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions);
|
||||
sqlite3GlobalConfig.inProgress = 1;
|
||||
#ifdef SQLITE_ENABLE_SQLLOG
|
||||
{
|
||||
@@ -225,8 +226,8 @@ int sqlite3_initialize(void){
|
||||
sqlite3_init_sqllog();
|
||||
}
|
||||
#endif
|
||||
memset(&sqlite3BuiltinFunctions, 0, sizeof(sqlite3BuiltinFunctions));
|
||||
sqlite3RegisterBuiltinFunctions();
|
||||
memset(pHash, 0, sizeof(sqlite3GlobalFunctions));
|
||||
sqlite3RegisterGlobalFunctions();
|
||||
if( sqlite3GlobalConfig.isPCacheInit==0 ){
|
||||
rc = sqlite3PcacheInitialize();
|
||||
}
|
||||
@@ -957,7 +958,7 @@ void sqlite3CloseSavepoints(sqlite3 *db){
|
||||
** with SQLITE_ANY as the encoding.
|
||||
*/
|
||||
static void functionDestroy(sqlite3 *db, FuncDef *p){
|
||||
FuncDestructor *pDestructor = p->u.pDestructor;
|
||||
FuncDestructor *pDestructor = p->pDestructor;
|
||||
if( pDestructor ){
|
||||
pDestructor->nRef--;
|
||||
if( pDestructor->nRef==0 ){
|
||||
@@ -1139,17 +1140,18 @@ void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){
|
||||
*/
|
||||
sqlite3ConnectionClosed(db);
|
||||
|
||||
for(i=sqliteHashFirst(&db->aFunc); i; i=sqliteHashNext(i)){
|
||||
FuncDef *pNext, *p;
|
||||
p = sqliteHashData(i);
|
||||
do{
|
||||
functionDestroy(db, p);
|
||||
pNext = p->pNext;
|
||||
sqlite3DbFree(db, p);
|
||||
p = pNext;
|
||||
}while( p );
|
||||
for(j=0; j<ArraySize(db->aFunc.a); j++){
|
||||
FuncDef *pNext, *pHash, *p;
|
||||
for(p=db->aFunc.a[j]; p; p=pHash){
|
||||
pHash = p->pHash;
|
||||
while( p ){
|
||||
functionDestroy(db, p);
|
||||
pNext = p->pNext;
|
||||
sqlite3DbFree(db, p);
|
||||
p = pNext;
|
||||
}
|
||||
}
|
||||
}
|
||||
sqlite3HashClear(&db->aFunc);
|
||||
for(i=sqliteHashFirst(&db->aCollSeq); i; i=sqliteHashNext(i)){
|
||||
CollSeq *pColl = (CollSeq *)sqliteHashData(i);
|
||||
/* Invoke any destructors registered for collation sequence user data. */
|
||||
@@ -1628,7 +1630,7 @@ int sqlite3CreateFunc(
|
||||
** is being overridden/deleted but there are no active VMs, allow the
|
||||
** operation to continue but invalidate all precompiled statements.
|
||||
*/
|
||||
p = sqlite3FindFunction(db, zFunctionName, nArg, (u8)enc, 0);
|
||||
p = sqlite3FindFunction(db, zFunctionName, nName, nArg, (u8)enc, 0);
|
||||
if( p && (p->funcFlags & SQLITE_FUNC_ENCMASK)==enc && p->nArg==nArg ){
|
||||
if( db->nVdbeActive ){
|
||||
sqlite3ErrorWithMsg(db, SQLITE_BUSY,
|
||||
@@ -1640,10 +1642,10 @@ int sqlite3CreateFunc(
|
||||
}
|
||||
}
|
||||
|
||||
p = sqlite3FindFunction(db, zFunctionName, nArg, (u8)enc, 1);
|
||||
p = sqlite3FindFunction(db, zFunctionName, nName, nArg, (u8)enc, 1);
|
||||
assert(p || db->mallocFailed);
|
||||
if( !p ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
/* If an older version of the function with a configured destructor is
|
||||
@@ -1653,7 +1655,7 @@ int sqlite3CreateFunc(
|
||||
if( pDestructor ){
|
||||
pDestructor->nRef++;
|
||||
}
|
||||
p->u.pDestructor = pDestructor;
|
||||
p->pDestructor = pDestructor;
|
||||
p->funcFlags = (p->funcFlags & SQLITE_FUNC_ENCMASK) | extraFlags;
|
||||
testcase( p->funcFlags & SQLITE_DETERMINISTIC );
|
||||
p->xSFunc = xSFunc ? xSFunc : xStep;
|
||||
@@ -1768,6 +1770,7 @@ int sqlite3_overload_function(
|
||||
const char *zName,
|
||||
int nArg
|
||||
){
|
||||
int nName = sqlite3Strlen30(zName);
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
#ifdef SQLITE_ENABLE_API_ARMOR
|
||||
@@ -1776,7 +1779,7 @@ int sqlite3_overload_function(
|
||||
}
|
||||
#endif
|
||||
sqlite3_mutex_enter(db->mutex);
|
||||
if( sqlite3FindFunction(db, zName, nArg, SQLITE_UTF8, 0)==0 ){
|
||||
if( sqlite3FindFunction(db, zName, nName, nArg, SQLITE_UTF8, 0)==0 ){
|
||||
rc = sqlite3CreateFunc(db, zName, nArg, SQLITE_UTF8,
|
||||
0, sqlite3InvalidFunction, 0, 0, 0);
|
||||
}
|
||||
@@ -2146,14 +2149,14 @@ int sqlite3TempInMemory(const sqlite3 *db){
|
||||
const char *sqlite3_errmsg(sqlite3 *db){
|
||||
const char *z;
|
||||
if( !db ){
|
||||
return sqlite3ErrStr(SQLITE_NOMEM_BKPT);
|
||||
return sqlite3ErrStr(SQLITE_NOMEM);
|
||||
}
|
||||
if( !sqlite3SafetyCheckSickOrOk(db) ){
|
||||
return sqlite3ErrStr(SQLITE_MISUSE_BKPT);
|
||||
}
|
||||
sqlite3_mutex_enter(db->mutex);
|
||||
if( db->mallocFailed ){
|
||||
z = sqlite3ErrStr(SQLITE_NOMEM_BKPT);
|
||||
z = sqlite3ErrStr(SQLITE_NOMEM);
|
||||
}else{
|
||||
testcase( db->pErr==0 );
|
||||
z = (char*)sqlite3_value_text(db->pErr);
|
||||
@@ -2221,7 +2224,7 @@ int sqlite3_errcode(sqlite3 *db){
|
||||
return SQLITE_MISUSE_BKPT;
|
||||
}
|
||||
if( !db || db->mallocFailed ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
return db->errCode & db->errMask;
|
||||
}
|
||||
@@ -2230,7 +2233,7 @@ int sqlite3_extended_errcode(sqlite3 *db){
|
||||
return SQLITE_MISUSE_BKPT;
|
||||
}
|
||||
if( !db || db->mallocFailed ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
return db->errCode;
|
||||
}
|
||||
@@ -2310,7 +2313,7 @@ static int createCollation(
|
||||
}
|
||||
|
||||
pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 1);
|
||||
if( pColl==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( pColl==0 ) return SQLITE_NOMEM;
|
||||
pColl->xCmp = xCompare;
|
||||
pColl->pUser = pCtx;
|
||||
pColl->xDel = xDel;
|
||||
@@ -2358,8 +2361,8 @@ static const int aHardLimit[] = {
|
||||
#if SQLITE_MAX_VDBE_OP<40
|
||||
# error SQLITE_MAX_VDBE_OP must be at least 40
|
||||
#endif
|
||||
#if SQLITE_MAX_FUNCTION_ARG<0 || SQLITE_MAX_FUNCTION_ARG>127
|
||||
# error SQLITE_MAX_FUNCTION_ARG must be between 0 and 127
|
||||
#if SQLITE_MAX_FUNCTION_ARG<0 || SQLITE_MAX_FUNCTION_ARG>1000
|
||||
# error SQLITE_MAX_FUNCTION_ARG must be between 0 and 1000
|
||||
#endif
|
||||
#if SQLITE_MAX_ATTACHED<0 || SQLITE_MAX_ATTACHED>125
|
||||
# error SQLITE_MAX_ATTACHED must be between 0 and 125
|
||||
@@ -2489,7 +2492,7 @@ int sqlite3ParseUri(
|
||||
|
||||
for(iIn=0; iIn<nUri; iIn++) nByte += (zUri[iIn]=='&');
|
||||
zFile = sqlite3_malloc64(nByte);
|
||||
if( !zFile ) return SQLITE_NOMEM_BKPT;
|
||||
if( !zFile ) return SQLITE_NOMEM;
|
||||
|
||||
iIn = 5;
|
||||
#ifdef SQLITE_ALLOW_URI_AUTHORITY
|
||||
@@ -2655,7 +2658,7 @@ int sqlite3ParseUri(
|
||||
|
||||
}else{
|
||||
zFile = sqlite3_malloc64(nUri+2);
|
||||
if( !zFile ) return SQLITE_NOMEM_BKPT;
|
||||
if( !zFile ) return SQLITE_NOMEM;
|
||||
memcpy(zFile, zUri, nUri);
|
||||
zFile[nUri] = '\0';
|
||||
zFile[nUri+1] = '\0';
|
||||
@@ -2854,7 +2857,7 @@ static int openDatabase(
|
||||
flags | SQLITE_OPEN_MAIN_DB);
|
||||
if( rc!=SQLITE_OK ){
|
||||
if( rc==SQLITE_IOERR_NOMEM ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
sqlite3Error(db, rc);
|
||||
goto opendb_out;
|
||||
@@ -2865,13 +2868,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 OFF. This matches the pager layer defaults.
|
||||
/* The default safety_level for the main database is 'full'; for the temp
|
||||
** database it is 'NONE'. This matches the pager layer defaults.
|
||||
*/
|
||||
db->aDb[0].zName = "main";
|
||||
db->aDb[0].safety_level = PAGER_SYNCHRONOUS_FULL;
|
||||
db->aDb[0].safety_level = 3;
|
||||
db->aDb[1].zName = "temp";
|
||||
db->aDb[1].safety_level = PAGER_SYNCHRONOUS_OFF;
|
||||
db->aDb[1].safety_level = 1;
|
||||
|
||||
db->magic = SQLITE_MAGIC_OPEN;
|
||||
if( db->mallocFailed ){
|
||||
@@ -2883,7 +2886,7 @@ static int openDatabase(
|
||||
** is accessed.
|
||||
*/
|
||||
sqlite3Error(db, SQLITE_OK);
|
||||
sqlite3RegisterPerConnectionBuiltinFunctions(db);
|
||||
sqlite3RegisterBuiltinFunctions(db);
|
||||
|
||||
/* Load automatic extensions - extensions that have been registered
|
||||
** using the sqlite3_automatic_extension() API.
|
||||
@@ -3057,7 +3060,7 @@ int sqlite3_open16(
|
||||
SCHEMA_ENC(*ppDb) = ENC(*ppDb) = SQLITE_UTF16NATIVE;
|
||||
}
|
||||
}else{
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
sqlite3ValueFree(pVal);
|
||||
|
||||
@@ -3202,7 +3205,7 @@ int sqlite3_get_autocommit(sqlite3 *db){
|
||||
|
||||
/*
|
||||
** The following routines are substitutes for constants SQLITE_CORRUPT,
|
||||
** SQLITE_MISUSE, SQLITE_CANTOPEN, SQLITE_NOMEM and possibly other error
|
||||
** SQLITE_MISUSE, SQLITE_CANTOPEN, SQLITE_IOERR and possibly other error
|
||||
** constants. They serve two purposes:
|
||||
**
|
||||
** 1. Serve as a convenient place to set a breakpoint in a debugger
|
||||
@@ -3211,33 +3214,28 @@ int sqlite3_get_autocommit(sqlite3 *db){
|
||||
** 2. Invoke sqlite3_log() to provide the source code location where
|
||||
** a low-level error is first detected.
|
||||
*/
|
||||
static int reportError(int iErr, int lineno, const char *zType){
|
||||
sqlite3_log(iErr, "%s at line %d of [%.10s]",
|
||||
zType, lineno, 20+sqlite3_sourceid());
|
||||
return iErr;
|
||||
}
|
||||
int sqlite3CorruptError(int lineno){
|
||||
testcase( sqlite3GlobalConfig.xLog!=0 );
|
||||
return reportError(SQLITE_CORRUPT, lineno, "database corruption");
|
||||
sqlite3_log(SQLITE_CORRUPT,
|
||||
"database corruption at line %d of [%.10s]",
|
||||
lineno, 20+sqlite3_sourceid());
|
||||
return SQLITE_CORRUPT;
|
||||
}
|
||||
int sqlite3MisuseError(int lineno){
|
||||
testcase( sqlite3GlobalConfig.xLog!=0 );
|
||||
return reportError(SQLITE_MISUSE, lineno, "misuse");
|
||||
sqlite3_log(SQLITE_MISUSE,
|
||||
"misuse at line %d of [%.10s]",
|
||||
lineno, 20+sqlite3_sourceid());
|
||||
return SQLITE_MISUSE;
|
||||
}
|
||||
int sqlite3CantopenError(int lineno){
|
||||
testcase( sqlite3GlobalConfig.xLog!=0 );
|
||||
return reportError(SQLITE_CANTOPEN, lineno, "cannot open file");
|
||||
sqlite3_log(SQLITE_CANTOPEN,
|
||||
"cannot open file at line %d of [%.10s]",
|
||||
lineno, 20+sqlite3_sourceid());
|
||||
return SQLITE_CANTOPEN;
|
||||
}
|
||||
#ifdef SQLITE_DEBUG
|
||||
int sqlite3NomemError(int lineno){
|
||||
testcase( sqlite3GlobalConfig.xLog!=0 );
|
||||
return reportError(SQLITE_NOMEM, lineno, "OOM");
|
||||
}
|
||||
int sqlite3IoerrnomemError(int lineno){
|
||||
testcase( sqlite3GlobalConfig.xLog!=0 );
|
||||
return reportError(SQLITE_IOERR_NOMEM, lineno, "I/O OOM error");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef SQLITE_OMIT_DEPRECATED
|
||||
/*
|
||||
|
||||
@@ -795,7 +795,7 @@ void sqlite3OomClear(sqlite3 *db){
|
||||
static SQLITE_NOINLINE int apiOomError(sqlite3 *db){
|
||||
sqlite3OomClear(db);
|
||||
sqlite3Error(db, SQLITE_NOMEM);
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -133,7 +133,7 @@ static int memjrnlWrite(
|
||||
/* New chunk is required to extend the file. */
|
||||
FileChunk *pNew = sqlite3_malloc(sizeof(FileChunk));
|
||||
if( !pNew ){
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
pNew->pNext = 0;
|
||||
if( pChunk ){
|
||||
|
||||
@@ -68,7 +68,7 @@ int sqlite3_memdebug_vfs_oom_test = 1;
|
||||
#define DO_OS_MALLOC_TEST(x) \
|
||||
if (sqlite3_memdebug_vfs_oom_test && (!x || !sqlite3IsMemJournal(x))) { \
|
||||
void *pTstAlloc = sqlite3Malloc(10); \
|
||||
if (!pTstAlloc) return SQLITE_IOERR_NOMEM_BKPT; \
|
||||
if (!pTstAlloc) return SQLITE_IOERR_NOMEM; \
|
||||
sqlite3_free(pTstAlloc); \
|
||||
}
|
||||
#else
|
||||
@@ -287,7 +287,7 @@ int sqlite3OsOpenMalloc(
|
||||
int flags,
|
||||
int *pOutFlags
|
||||
){
|
||||
int rc;
|
||||
int rc = SQLITE_NOMEM;
|
||||
sqlite3_file *pFile;
|
||||
pFile = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile);
|
||||
if( pFile ){
|
||||
@@ -297,8 +297,6 @@ int sqlite3OsOpenMalloc(
|
||||
}else{
|
||||
*ppFile = pFile;
|
||||
}
|
||||
}else{
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@@ -318,7 +316,7 @@ int sqlite3OsCloseFree(sqlite3_file *pFile){
|
||||
*/
|
||||
int sqlite3OsInit(void){
|
||||
void *p = sqlite3_malloc(10);
|
||||
if( p==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( p==0 ) return SQLITE_NOMEM;
|
||||
sqlite3_free(p);
|
||||
return sqlite3_os_init();
|
||||
}
|
||||
|
||||
@@ -1302,7 +1302,7 @@ static int findInodeInfo(
|
||||
if( pInode==0 ){
|
||||
pInode = sqlite3_malloc64( sizeof(*pInode) );
|
||||
if( pInode==0 ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
memset(pInode, 0, sizeof(*pInode));
|
||||
memcpy(&pInode->fileId, &fileId, sizeof(fileId));
|
||||
@@ -4222,7 +4222,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
|
||||
|
||||
/* Allocate space for the new unixShm object. */
|
||||
p = sqlite3_malloc64( sizeof(*p) );
|
||||
if( p==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( p==0 ) return SQLITE_NOMEM;
|
||||
memset(p, 0, sizeof(*p));
|
||||
assert( pDbFd->pShm==0 );
|
||||
|
||||
@@ -4254,7 +4254,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
|
||||
#endif
|
||||
pShmNode = sqlite3_malloc64( sizeof(*pShmNode) + nShmFilename );
|
||||
if( pShmNode==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto shm_open_err;
|
||||
}
|
||||
memset(pShmNode, 0, sizeof(*pShmNode)+nShmFilename);
|
||||
@@ -4272,7 +4272,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
|
||||
pShmNode->pInode = pDbFd->pInode;
|
||||
pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
|
||||
if( pShmNode->mutex==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto shm_open_err;
|
||||
}
|
||||
|
||||
@@ -4445,7 +4445,7 @@ static int unixShmMap(
|
||||
pShmNode->apRegion, nReqRegion*sizeof(char *)
|
||||
);
|
||||
if( !apNew ){
|
||||
rc = SQLITE_IOERR_NOMEM_BKPT;
|
||||
rc = SQLITE_IOERR_NOMEM;
|
||||
goto shmpage_out;
|
||||
}
|
||||
pShmNode->apRegion = apNew;
|
||||
@@ -4465,7 +4465,7 @@ static int unixShmMap(
|
||||
}else{
|
||||
pMem = sqlite3_malloc64(szRegion);
|
||||
if( pMem==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto shmpage_out;
|
||||
}
|
||||
memset(pMem, 0, szRegion);
|
||||
@@ -5243,7 +5243,7 @@ static int fillInUnixFile(
|
||||
pNew->pId = vxworksFindFileId(zFilename);
|
||||
if( pNew->pId==0 ){
|
||||
ctrlFlags |= UNIXFILE_NOLOCK;
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -5299,7 +5299,7 @@ static int fillInUnixFile(
|
||||
afpLockingContext *pCtx;
|
||||
pNew->lockingContext = pCtx = sqlite3_malloc64( sizeof(*pCtx) );
|
||||
if( pCtx==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
/* NB: zFilename exists and remains valid until the file is closed
|
||||
** according to requirement F11141. So we do not need to make a
|
||||
@@ -5329,7 +5329,7 @@ static int fillInUnixFile(
|
||||
nFilename = (int)strlen(zFilename) + 6;
|
||||
zLockFile = (char *)sqlite3_malloc64(nFilename);
|
||||
if( zLockFile==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
sqlite3_snprintf(nFilename, zLockFile, "%s" DOTLOCK_SUFFIX, zFilename);
|
||||
}
|
||||
@@ -5352,7 +5352,7 @@ static int fillInUnixFile(
|
||||
if( zSemName[n]=='/' ) zSemName[n] = '_';
|
||||
pNew->pInode->pSem = sem_open(zSemName, O_CREAT, 0666, 1);
|
||||
if( pNew->pInode->pSem == SEM_FAILED ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
pNew->pInode->aSemName[0] = '\0';
|
||||
}
|
||||
}
|
||||
@@ -5693,7 +5693,7 @@ static int unixOpen(
|
||||
}else{
|
||||
pUnused = sqlite3_malloc64(sizeof(*pUnused));
|
||||
if( !pUnused ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
}
|
||||
p->pUnused = pUnused;
|
||||
@@ -5779,7 +5779,7 @@ static int unixOpen(
|
||||
zPath = sqlite3_mprintf("%s", zName);
|
||||
if( zPath==0 ){
|
||||
robust_close(p, fd, __LINE__);
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
#else
|
||||
osUnlink(zName);
|
||||
@@ -6011,7 +6011,7 @@ static int unixFullPathname(
|
||||
if( bLink ){
|
||||
if( zDel==0 ){
|
||||
zDel = sqlite3_malloc(nOut);
|
||||
if( zDel==0 ) rc = SQLITE_NOMEM_BKPT;
|
||||
if( zDel==0 ) rc = SQLITE_NOMEM;
|
||||
}else if( ++nLink>SQLITE_MAX_SYMLINKS ){
|
||||
rc = SQLITE_CANTOPEN_BKPT;
|
||||
}
|
||||
@@ -6555,7 +6555,7 @@ static int proxyCreateUnixFile(
|
||||
}else{
|
||||
pUnused = sqlite3_malloc64(sizeof(*pUnused));
|
||||
if( !pUnused ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
}
|
||||
if( fd<0 ){
|
||||
@@ -6588,7 +6588,7 @@ static int proxyCreateUnixFile(
|
||||
|
||||
pNew = (unixFile *)sqlite3_malloc64(sizeof(*pNew));
|
||||
if( pNew==NULL ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto end_create_proxy;
|
||||
}
|
||||
memset(pNew, 0, sizeof(unixFile));
|
||||
@@ -7001,7 +7001,7 @@ static int proxyTakeConch(unixFile *pFile){
|
||||
if( tempLockPath ){
|
||||
pCtx->lockProxyPath = sqlite3DbStrDup(0, tempLockPath);
|
||||
if( !pCtx->lockProxyPath ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7066,7 +7066,7 @@ static int proxyCreateConchPathname(char *dbPath, char **pConchPath){
|
||||
** the name of the original database file. */
|
||||
*pConchPath = conchPath = (char *)sqlite3_malloc64(len + 8);
|
||||
if( conchPath==0 ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
memcpy(conchPath, dbPath, len+1);
|
||||
|
||||
@@ -7182,7 +7182,7 @@ static int proxyTransformUnixFile(unixFile *pFile, const char *path) {
|
||||
|
||||
pCtx = sqlite3_malloc64( sizeof(*pCtx) );
|
||||
if( pCtx==0 ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
memset(pCtx, 0, sizeof(*pCtx));
|
||||
|
||||
@@ -7218,7 +7218,7 @@ static int proxyTransformUnixFile(unixFile *pFile, const char *path) {
|
||||
if( rc==SQLITE_OK ){
|
||||
pCtx->dbPath = sqlite3DbStrDup(0, dbPath);
|
||||
if( pCtx->dbPath==NULL ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
|
||||
@@ -1222,7 +1222,7 @@ int sqlite3_win32_compact_heap(LPUINT pnLargest){
|
||||
if( lastErrno==NO_ERROR ){
|
||||
sqlite3_log(SQLITE_NOMEM, "failed to HeapCompact (no space), heap=%p",
|
||||
(void*)hHeap);
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
sqlite3_log(SQLITE_ERROR, "failed to HeapCompact (%lu), heap=%p",
|
||||
osGetLastError(), (void*)hHeap);
|
||||
@@ -1542,7 +1542,7 @@ static int winMemInit(void *pAppData){
|
||||
"failed to HeapCreate (%lu), flags=%u, initSize=%lu, maxSize=%lu",
|
||||
osGetLastError(), SQLITE_WIN32_HEAP_FLAGS, dwInitialSize,
|
||||
dwMaximumSize);
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
pWinMemData->bOwned = TRUE;
|
||||
assert( pWinMemData->bOwned );
|
||||
@@ -1552,7 +1552,7 @@ static int winMemInit(void *pAppData){
|
||||
if( !pWinMemData->hHeap ){
|
||||
sqlite3_log(SQLITE_NOMEM,
|
||||
"failed to GetProcessHeap (%lu)", osGetLastError());
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
pWinMemData->bOwned = FALSE;
|
||||
assert( !pWinMemData->bOwned );
|
||||
@@ -1789,7 +1789,7 @@ int sqlite3_win32_set_directory(DWORD type, LPCWSTR zValue){
|
||||
if( zValue && zValue[0] ){
|
||||
zValueUtf8 = winUnicodeToUtf8(zValue);
|
||||
if ( zValueUtf8==0 ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
}
|
||||
sqlite3_free(*ppDirectory);
|
||||
@@ -2066,7 +2066,7 @@ static int winceCreateLock(const char *zFilename, winFile *pFile){
|
||||
zName = winUtf8ToUnicode(zFilename);
|
||||
if( zName==0 ){
|
||||
/* out of memory */
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
|
||||
/* Initialize the local lockdata */
|
||||
@@ -3615,12 +3615,12 @@ static int winOpenSharedMemory(winFile *pDbFd){
|
||||
** allocate space for a new winShmNode and filename.
|
||||
*/
|
||||
p = sqlite3MallocZero( sizeof(*p) );
|
||||
if( p==0 ) return SQLITE_IOERR_NOMEM_BKPT;
|
||||
if( p==0 ) return SQLITE_IOERR_NOMEM;
|
||||
nName = sqlite3Strlen30(pDbFd->zPath);
|
||||
pNew = sqlite3MallocZero( sizeof(*pShmNode) + nName + 17 );
|
||||
if( pNew==0 ){
|
||||
sqlite3_free(p);
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
pNew->zFilename = (char*)&pNew[1];
|
||||
sqlite3_snprintf(nName+15, pNew->zFilename, "%s-shm", pDbFd->zPath);
|
||||
@@ -3647,7 +3647,7 @@ static int winOpenSharedMemory(winFile *pDbFd){
|
||||
|
||||
pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
|
||||
if( pShmNode->mutex==0 ){
|
||||
rc = SQLITE_IOERR_NOMEM_BKPT;
|
||||
rc = SQLITE_IOERR_NOMEM;
|
||||
goto shm_open_err;
|
||||
}
|
||||
|
||||
@@ -3952,7 +3952,7 @@ static int winShmMap(
|
||||
pShmNode->aRegion, (iRegion+1)*sizeof(apNew[0])
|
||||
);
|
||||
if( !apNew ){
|
||||
rc = SQLITE_IOERR_NOMEM_BKPT;
|
||||
rc = SQLITE_IOERR_NOMEM;
|
||||
goto shmpage_out;
|
||||
}
|
||||
pShmNode->aRegion = apNew;
|
||||
@@ -4382,7 +4382,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
|
||||
zBuf = sqlite3MallocZero( nBuf );
|
||||
if( !zBuf ){
|
||||
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
|
||||
/* Figure out the effective temporary directory. First, check if one
|
||||
@@ -4440,7 +4440,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
|
||||
if( !zConverted ){
|
||||
sqlite3_free(zBuf);
|
||||
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
if( winIsDir(zConverted) ){
|
||||
sqlite3_snprintf(nMax, zBuf, "%s", zDir);
|
||||
@@ -4453,7 +4453,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
|
||||
if( !zConverted ){
|
||||
sqlite3_free(zBuf);
|
||||
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
if( cygwin_conv_path(
|
||||
osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A, zDir,
|
||||
@@ -4474,7 +4474,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
|
||||
sqlite3_free(zConverted);
|
||||
sqlite3_free(zBuf);
|
||||
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
sqlite3_snprintf(nMax, zBuf, "%s", zUtf8);
|
||||
sqlite3_free(zUtf8);
|
||||
@@ -4492,7 +4492,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
|
||||
if( !zWidePath ){
|
||||
sqlite3_free(zBuf);
|
||||
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
if( osGetTempPathW(nMax, zWidePath)==0 ){
|
||||
sqlite3_free(zWidePath);
|
||||
@@ -4510,7 +4510,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
|
||||
sqlite3_free(zWidePath);
|
||||
sqlite3_free(zBuf);
|
||||
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
}
|
||||
#ifdef SQLITE_WIN32_HAS_ANSI
|
||||
@@ -4520,7 +4520,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
|
||||
if( !zMbcsPath ){
|
||||
sqlite3_free(zBuf);
|
||||
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
if( osGetTempPathA(nMax, zMbcsPath)==0 ){
|
||||
sqlite3_free(zBuf);
|
||||
@@ -4535,7 +4535,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
|
||||
}else{
|
||||
sqlite3_free(zBuf);
|
||||
OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
}
|
||||
#endif /* SQLITE_WIN32_HAS_ANSI */
|
||||
@@ -4727,7 +4727,7 @@ static int winOpen(
|
||||
if( zConverted==0 ){
|
||||
sqlite3_free(zTmpname);
|
||||
OSTRACE(("OPEN name=%s, rc=SQLITE_IOERR_NOMEM", zUtf8Name));
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
|
||||
if( winIsDir(zConverted) ){
|
||||
@@ -4927,7 +4927,7 @@ static int winDelete(
|
||||
zConverted = winConvertFromUtf8Filename(zFilename);
|
||||
if( zConverted==0 ){
|
||||
OSTRACE(("DELETE name=%s, rc=SQLITE_IOERR_NOMEM\n", zFilename));
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
if( osIsNT() ){
|
||||
do {
|
||||
@@ -5035,7 +5035,7 @@ static int winAccess(
|
||||
zConverted = winConvertFromUtf8Filename(zFilename);
|
||||
if( zConverted==0 ){
|
||||
OSTRACE(("ACCESS name=%s, rc=SQLITE_IOERR_NOMEM\n", zFilename));
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
if( osIsNT() ){
|
||||
int cnt = 0;
|
||||
@@ -5162,7 +5162,7 @@ static int winFullPathname(
|
||||
*/
|
||||
char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 );
|
||||
if( !zOut ){
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
if( cygwin_conv_path(
|
||||
(osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A) |
|
||||
@@ -5174,7 +5174,7 @@ static int winFullPathname(
|
||||
char *zUtf8 = winConvertToUtf8Filename(zOut);
|
||||
if( !zUtf8 ){
|
||||
sqlite3_free(zOut);
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s",
|
||||
sqlite3_data_directory, winGetDirSep(), zUtf8);
|
||||
@@ -5184,7 +5184,7 @@ static int winFullPathname(
|
||||
}else{
|
||||
char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 );
|
||||
if( !zOut ){
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
if( cygwin_conv_path(
|
||||
(osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A),
|
||||
@@ -5196,7 +5196,7 @@ static int winFullPathname(
|
||||
char *zUtf8 = winConvertToUtf8Filename(zOut);
|
||||
if( !zUtf8 ){
|
||||
sqlite3_free(zOut);
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zUtf8);
|
||||
sqlite3_free(zUtf8);
|
||||
@@ -5256,7 +5256,7 @@ static int winFullPathname(
|
||||
}
|
||||
zConverted = winConvertFromUtf8Filename(zRelative);
|
||||
if( zConverted==0 ){
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
if( osIsNT() ){
|
||||
LPWSTR zTemp;
|
||||
@@ -5270,7 +5270,7 @@ static int winFullPathname(
|
||||
zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) );
|
||||
if( zTemp==0 ){
|
||||
sqlite3_free(zConverted);
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0);
|
||||
if( nByte==0 ){
|
||||
@@ -5296,7 +5296,7 @@ static int winFullPathname(
|
||||
zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) );
|
||||
if( zTemp==0 ){
|
||||
sqlite3_free(zConverted);
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
nByte = osGetFullPathNameA((char*)zConverted, nByte, zTemp, 0);
|
||||
if( nByte==0 ){
|
||||
@@ -5315,7 +5315,7 @@ static int winFullPathname(
|
||||
sqlite3_free(zOut);
|
||||
return SQLITE_OK;
|
||||
}else{
|
||||
return SQLITE_IOERR_NOMEM_BKPT;
|
||||
return SQLITE_IOERR_NOMEM;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -5390,85 +5390,65 @@ static void winDlClose(sqlite3_vfs *pVfs, void *pHandle){
|
||||
#define winDlClose 0
|
||||
#endif
|
||||
|
||||
/* State information for the randomness gatherer. */
|
||||
typedef struct EntropyGatherer EntropyGatherer;
|
||||
struct EntropyGatherer {
|
||||
unsigned char *a; /* Gather entropy into this buffer */
|
||||
int na; /* Size of a[] in bytes */
|
||||
int i; /* XOR next input into a[i] */
|
||||
int nXor; /* Number of XOR operations done */
|
||||
};
|
||||
|
||||
#if !defined(SQLITE_TEST) && !defined(SQLITE_OMIT_RANDOMNESS)
|
||||
/* Mix sz bytes of entropy into p. */
|
||||
static void xorMemory(EntropyGatherer *p, unsigned char *x, int sz){
|
||||
int j, k;
|
||||
for(j=0, k=p->i; j<sz; j++){
|
||||
p->a[k++] ^= x[j];
|
||||
if( k>=p->na ) k = 0;
|
||||
}
|
||||
p->i = k;
|
||||
p->nXor += sz;
|
||||
}
|
||||
#endif /* !defined(SQLITE_TEST) && !defined(SQLITE_OMIT_RANDOMNESS) */
|
||||
|
||||
/*
|
||||
** Write up to nBuf bytes of randomness into zBuf.
|
||||
*/
|
||||
static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
|
||||
int n = 0;
|
||||
UNUSED_PARAMETER(pVfs);
|
||||
#if defined(SQLITE_TEST) || defined(SQLITE_OMIT_RANDOMNESS)
|
||||
UNUSED_PARAMETER(pVfs);
|
||||
n = nBuf;
|
||||
memset(zBuf, 0, nBuf);
|
||||
return nBuf;
|
||||
#else
|
||||
EntropyGatherer e;
|
||||
UNUSED_PARAMETER(pVfs);
|
||||
memset(zBuf, 0, nBuf);
|
||||
#if defined(_MSC_VER) && _MSC_VER>=1400
|
||||
rand_s((int*)zBuf); /* rand_s() is not available with MinGW */
|
||||
#endif /* defined(_MSC_VER) && _MSC_VER>=1400 */
|
||||
e.a = (unsigned char*)zBuf;
|
||||
e.na = nBuf;
|
||||
e.nXor = 0;
|
||||
e.i = 0;
|
||||
{
|
||||
if( sizeof(SYSTEMTIME)<=nBuf-n ){
|
||||
SYSTEMTIME x;
|
||||
osGetSystemTime(&x);
|
||||
xorMemory(&e, (unsigned char*)&x, sizeof(SYSTEMTIME));
|
||||
memcpy(&zBuf[n], &x, sizeof(x));
|
||||
n += sizeof(x);
|
||||
}
|
||||
{
|
||||
if( sizeof(DWORD)<=nBuf-n ){
|
||||
DWORD pid = osGetCurrentProcessId();
|
||||
xorMemory(&e, (unsigned char*)&pid, sizeof(DWORD));
|
||||
memcpy(&zBuf[n], &pid, sizeof(pid));
|
||||
n += sizeof(pid);
|
||||
}
|
||||
#if SQLITE_OS_WINRT
|
||||
{
|
||||
if( sizeof(ULONGLONG)<=nBuf-n ){
|
||||
ULONGLONG cnt = osGetTickCount64();
|
||||
xorMemory(&e, (unsigned char*)&cnt, sizeof(ULONGLONG));
|
||||
memcpy(&zBuf[n], &cnt, sizeof(cnt));
|
||||
n += sizeof(cnt);
|
||||
}
|
||||
#else
|
||||
{
|
||||
if( sizeof(DWORD)<=nBuf-n ){
|
||||
DWORD cnt = osGetTickCount();
|
||||
xorMemory(&e, (unsigned char*)&cnt, sizeof(DWORD));
|
||||
memcpy(&zBuf[n], &cnt, sizeof(cnt));
|
||||
n += sizeof(cnt);
|
||||
}
|
||||
#endif /* SQLITE_OS_WINRT */
|
||||
{
|
||||
#endif
|
||||
if( sizeof(LARGE_INTEGER)<=nBuf-n ){
|
||||
LARGE_INTEGER i;
|
||||
osQueryPerformanceCounter(&i);
|
||||
xorMemory(&e, (unsigned char*)&i, sizeof(LARGE_INTEGER));
|
||||
memcpy(&zBuf[n], &i, sizeof(i));
|
||||
n += sizeof(i);
|
||||
}
|
||||
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
|
||||
{
|
||||
if( sizeof(UUID)<=nBuf-n ){
|
||||
UUID id;
|
||||
memset(&id, 0, sizeof(UUID));
|
||||
osUuidCreate(&id);
|
||||
xorMemory(&e, (unsigned char*)&id, sizeof(UUID));
|
||||
memcpy(&zBuf[n], &id, sizeof(UUID));
|
||||
n += sizeof(UUID);
|
||||
}
|
||||
if( sizeof(UUID)<=nBuf-n ){
|
||||
UUID id;
|
||||
memset(&id, 0, sizeof(UUID));
|
||||
osUuidCreateSequential(&id);
|
||||
xorMemory(&e, (unsigned char*)&id, sizeof(UUID));
|
||||
memcpy(&zBuf[n], &id, sizeof(UUID));
|
||||
n += sizeof(UUID);
|
||||
}
|
||||
#endif /* !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID */
|
||||
return e.nXor>nBuf ? nBuf : e.nXor;
|
||||
#endif /* defined(SQLITE_TEST) || defined(SQLITE_OMIT_RANDOMNESS) */
|
||||
#endif
|
||||
#endif /* defined(SQLITE_TEST) || defined(SQLITE_ZERO_PRNG_SEED) */
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2324,9 +2324,9 @@ static int pager_playback_one_page(
|
||||
pPager->dbFileSize = pgno;
|
||||
}
|
||||
if( pPager->pBackup ){
|
||||
CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM_BKPT);
|
||||
CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM);
|
||||
sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData);
|
||||
CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM_BKPT, aData);
|
||||
CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM, aData);
|
||||
}
|
||||
}else if( !isMainJrnl && pPg==0 ){
|
||||
/* If this is a rollback of a savepoint and data was not written to
|
||||
@@ -2398,7 +2398,7 @@ static int pager_playback_one_page(
|
||||
}
|
||||
|
||||
/* Decode the page just read from disk */
|
||||
CODEC1(pPager, pData, pPg->pgno, 3, rc=SQLITE_NOMEM_BKPT);
|
||||
CODEC1(pPager, pData, pPg->pgno, 3, rc=SQLITE_NOMEM);
|
||||
sqlite3PcacheRelease(pPg);
|
||||
}
|
||||
return rc;
|
||||
@@ -2464,7 +2464,7 @@ static int pager_delmaster(Pager *pPager, const char *zMaster){
|
||||
pMaster = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile * 2);
|
||||
pJournal = (sqlite3_file *)(((u8 *)pMaster) + pVfs->szOsFile);
|
||||
if( !pMaster ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
const int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_MASTER_JOURNAL);
|
||||
rc = sqlite3OsOpen(pVfs, zMaster, pMaster, flags, 0);
|
||||
@@ -2481,7 +2481,7 @@ static int pager_delmaster(Pager *pPager, const char *zMaster){
|
||||
nMasterPtr = pVfs->mxPathname+1;
|
||||
zMasterJournal = sqlite3Malloc(nMasterJournal + nMasterPtr + 1);
|
||||
if( !zMasterJournal ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto delmaster_out;
|
||||
}
|
||||
zMasterPtr = &zMasterJournal[nMasterJournal+1];
|
||||
@@ -2951,7 +2951,7 @@ static int readDbPage(PgHdr *pPg, u32 iFrame){
|
||||
memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers));
|
||||
}
|
||||
}
|
||||
CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM_BKPT);
|
||||
CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM);
|
||||
|
||||
PAGER_INCR(sqlite3_pager_readdb_count);
|
||||
PAGER_INCR(pPager->nRead);
|
||||
@@ -3311,7 +3311,7 @@ static int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepoint){
|
||||
if( pSavepoint ){
|
||||
pDone = sqlite3BitvecCreate(pSavepoint->nOrig);
|
||||
if( !pDone ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3674,7 +3674,7 @@ int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
pNew = (char *)sqlite3PageMalloc(pageSize);
|
||||
if( !pNew ) rc = SQLITE_NOMEM_BKPT;
|
||||
if( !pNew ) rc = SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
@@ -3950,7 +3950,7 @@ static int pagerAcquireMapPage(
|
||||
*ppPage = p = (PgHdr *)sqlite3MallocZero(sizeof(PgHdr) + pPager->nExtra);
|
||||
if( p==0 ){
|
||||
sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1) * pPager->pageSize, pData);
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
p->pExtra = (void *)&p[1];
|
||||
p->flags = PGHDR_MMAP;
|
||||
@@ -4308,7 +4308,7 @@ static int pager_write_pagelist(Pager *pPager, PgHdr *pList){
|
||||
if( pList->pgno==1 ) pager_write_changecounter(pList);
|
||||
|
||||
/* Encode the database */
|
||||
CODEC2(pPager, pList->pData, pgno, 6, return SQLITE_NOMEM_BKPT, pData);
|
||||
CODEC2(pPager, pList->pData, pgno, 6, return SQLITE_NOMEM, pData);
|
||||
|
||||
/* Write out the page data. */
|
||||
rc = sqlite3OsWrite(pPager->fd, pData, pPager->pageSize, offset);
|
||||
@@ -4395,7 +4395,7 @@ static int subjournalPage(PgHdr *pPg){
|
||||
i64 offset = (i64)pPager->nSubRec*(4+pPager->pageSize);
|
||||
char *pData2;
|
||||
|
||||
CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM_BKPT, pData2);
|
||||
CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2);
|
||||
PAGERTRACE(("STMT-JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno));
|
||||
rc = write32bits(pPager->sjfd, offset, pPg->pgno);
|
||||
if( rc==SQLITE_OK ){
|
||||
@@ -4599,7 +4599,7 @@ int sqlite3PagerOpen(
|
||||
memDb = 1;
|
||||
if( zFilename && zFilename[0] ){
|
||||
zPathname = sqlite3DbStrDup(0, zFilename);
|
||||
if( zPathname==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( zPathname==0 ) return SQLITE_NOMEM;
|
||||
nPathname = sqlite3Strlen30(zPathname);
|
||||
zFilename = 0;
|
||||
}
|
||||
@@ -4615,7 +4615,7 @@ int sqlite3PagerOpen(
|
||||
nPathname = pVfs->mxPathname+1;
|
||||
zPathname = sqlite3DbMallocRaw(0, nPathname*2);
|
||||
if( zPathname==0 ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */
|
||||
rc = sqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname);
|
||||
@@ -4668,7 +4668,7 @@ int sqlite3PagerOpen(
|
||||
assert( EIGHT_BYTE_ALIGNMENT(SQLITE_INT_TO_PTR(journalFileSize)) );
|
||||
if( !pPtr ){
|
||||
sqlite3DbFree(0, zPathname);
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
pPager = (Pager*)(pPtr);
|
||||
pPager->pPCache = (PCache*)(pPtr += ROUND8(sizeof(*pPager)));
|
||||
@@ -5388,7 +5388,7 @@ int sqlite3PagerGet(
|
||||
if( rc!=SQLITE_OK ) goto pager_acquire_err;
|
||||
if( pBase==0 ){
|
||||
pPg = *ppPage = 0;
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto pager_acquire_err;
|
||||
}
|
||||
}
|
||||
@@ -5562,7 +5562,7 @@ static int pager_open_journal(Pager *pPager){
|
||||
if( !pagerUseWal(pPager) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
|
||||
pPager->pInJournal = sqlite3BitvecCreate(pPager->dbSize);
|
||||
if( pPager->pInJournal==0 ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
/* Open the journal file if it is not already open. */
|
||||
@@ -5717,7 +5717,7 @@ static SQLITE_NOINLINE int pagerAddPageToRollbackJournal(PgHdr *pPg){
|
||||
assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) );
|
||||
|
||||
assert( pPager->journalHdr<=pPager->journalOff );
|
||||
CODEC2(pPager, pPg->pData, pPg->pgno, 7, return SQLITE_NOMEM_BKPT, pData2);
|
||||
CODEC2(pPager, pPg->pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2);
|
||||
cksum = pager_cksum(pPager, (u8*)pData2);
|
||||
|
||||
/* Even if an IO or diskfull error occurs while journalling the
|
||||
@@ -6074,7 +6074,7 @@ static int pager_incr_changecounter(Pager *pPager, int isDirectMode){
|
||||
if( DIRECT_MODE ){
|
||||
const void *zBuf;
|
||||
assert( pPager->dbFileSize>0 );
|
||||
CODEC2(pPager, pPgHdr->pData, 1, 6, rc=SQLITE_NOMEM_BKPT, zBuf);
|
||||
CODEC2(pPager, pPgHdr->pData, 1, 6, rc=SQLITE_NOMEM, zBuf);
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = sqlite3OsWrite(pPager->fd, zBuf, pPager->pageSize, 0);
|
||||
pPager->aStat[PAGER_STAT_WRITE]++;
|
||||
@@ -6573,7 +6573,7 @@ static SQLITE_NOINLINE int pagerOpenSavepoint(Pager *pPager, int nSavepoint){
|
||||
pPager->aSavepoint, sizeof(PagerSavepoint)*nSavepoint
|
||||
);
|
||||
if( !aNew ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
memset(&aNew[nCurrent], 0, (nSavepoint-nCurrent) * sizeof(PagerSavepoint));
|
||||
pPager->aSavepoint = aNew;
|
||||
@@ -6589,7 +6589,7 @@ static SQLITE_NOINLINE int pagerOpenSavepoint(Pager *pPager, int nSavepoint){
|
||||
aNew[ii].iSubRec = pPager->nSubRec;
|
||||
aNew[ii].pInSavepoint = sqlite3BitvecCreate(pPager->dbSize);
|
||||
if( !aNew[ii].pInSavepoint ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
if( pagerUseWal(pPager) ){
|
||||
sqlite3WalSavepoint(pPager->pWal, aNew[ii].aWalData);
|
||||
@@ -6738,6 +6738,14 @@ 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
|
||||
|
||||
@@ -191,6 +191,7 @@ 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 *);
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
|
||||
}
|
||||
%stack_overflow {
|
||||
UNUSED_PARAMETER(yypMinor); /* Silence some compiler warnings */
|
||||
sqlite3ErrorMsg(pParse, "parser stack overflow");
|
||||
}
|
||||
|
||||
@@ -138,9 +139,9 @@ trans_opt ::= TRANSACTION.
|
||||
trans_opt ::= TRANSACTION nm.
|
||||
%type transtype {int}
|
||||
transtype(A) ::= . {A = TK_DEFERRED;}
|
||||
transtype(A) ::= DEFERRED(X). {A = @X; /*A-overwrites-X*/}
|
||||
transtype(A) ::= IMMEDIATE(X). {A = @X; /*A-overwrites-X*/}
|
||||
transtype(A) ::= EXCLUSIVE(X). {A = @X; /*A-overwrites-X*/}
|
||||
transtype(A) ::= DEFERRED(X). {A = @X;}
|
||||
transtype(A) ::= IMMEDIATE(X). {A = @X;}
|
||||
transtype(A) ::= EXCLUSIVE(X). {A = @X;}
|
||||
cmd ::= COMMIT trans_opt. {sqlite3CommitTransaction(pParse);}
|
||||
cmd ::= END trans_opt. {sqlite3CommitTransaction(pParse);}
|
||||
cmd ::= ROLLBACK trans_opt. {sqlite3RollbackTransaction(pParse);}
|
||||
@@ -163,8 +164,10 @@ cmd ::= create_table create_table_args.
|
||||
create_table ::= createkw temp(T) TABLE ifnotexists(E) nm(Y) dbnm(Z). {
|
||||
sqlite3StartTable(pParse,&Y,&Z,T,0,0,E);
|
||||
}
|
||||
createkw(A) ::= CREATE(A). {disableLookaside(pParse);}
|
||||
|
||||
createkw(A) ::= CREATE(X). {
|
||||
disableLookaside(pParse);
|
||||
A = X;
|
||||
}
|
||||
%type ifnotexists {int}
|
||||
ifnotexists(A) ::= . {A = 0;}
|
||||
ifnotexists(A) ::= IF NOT EXISTS. {A = 1;}
|
||||
@@ -198,11 +201,13 @@ columnlist ::= column.
|
||||
// datatype, and other keywords such as PRIMARY KEY, UNIQUE, REFERENCES,
|
||||
// NOT NULL and so forth.
|
||||
//
|
||||
column(A) ::= columnid(A) type carglist. {
|
||||
A.n = (int)(pParse->sLastToken.z-A.z) + pParse->sLastToken.n;
|
||||
column(A) ::= columnid(X) type carglist. {
|
||||
A.z = X.z;
|
||||
A.n = (int)(pParse->sLastToken.z-X.z) + pParse->sLastToken.n;
|
||||
}
|
||||
columnid(A) ::= nm(A). {
|
||||
sqlite3AddColumn(pParse,&A);
|
||||
columnid(A) ::= nm(X). {
|
||||
sqlite3AddColumn(pParse,&X);
|
||||
A = X;
|
||||
pParse->constraintName.n = 0;
|
||||
}
|
||||
|
||||
@@ -260,9 +265,9 @@ columnid(A) ::= nm(A). {
|
||||
// The name of a column or table can be any of the following:
|
||||
//
|
||||
%type nm {Token}
|
||||
nm(A) ::= id(A).
|
||||
nm(A) ::= STRING(A).
|
||||
nm(A) ::= JOIN_KW(A).
|
||||
nm(A) ::= id(X). {A = X;}
|
||||
nm(A) ::= STRING(X). {A = X;}
|
||||
nm(A) ::= JOIN_KW(X). {A = X;}
|
||||
|
||||
// A typetoken is really one or more tokens that form a type name such
|
||||
// as can be found after the column name in a CREATE TABLE statement.
|
||||
@@ -271,16 +276,18 @@ nm(A) ::= JOIN_KW(A).
|
||||
%type typetoken {Token}
|
||||
type ::= .
|
||||
type ::= typetoken(X). {sqlite3AddColumnType(pParse,&X);}
|
||||
typetoken(A) ::= typename(A).
|
||||
typetoken(A) ::= typename(A) LP signed RP(Y). {
|
||||
A.n = (int)(&Y.z[Y.n] - A.z);
|
||||
typetoken(A) ::= typename(X). {A = X;}
|
||||
typetoken(A) ::= typename(X) LP signed RP(Y). {
|
||||
A.z = X.z;
|
||||
A.n = (int)(&Y.z[Y.n] - X.z);
|
||||
}
|
||||
typetoken(A) ::= typename(A) LP signed COMMA signed RP(Y). {
|
||||
A.n = (int)(&Y.z[Y.n] - A.z);
|
||||
typetoken(A) ::= typename(X) LP signed COMMA signed RP(Y). {
|
||||
A.z = X.z;
|
||||
A.n = (int)(&Y.z[Y.n] - X.z);
|
||||
}
|
||||
%type typename {Token}
|
||||
typename(A) ::= ids(A).
|
||||
typename(A) ::= typename(A) ids(Y). {A.n=Y.n+(int)(Y.z-A.z);}
|
||||
typename(A) ::= ids(X). {A = X;}
|
||||
typename(A) ::= typename(X) ids(Y). {A.z=X.z; A.n=Y.n+(int)(Y.z-X.z);}
|
||||
signed ::= plus_num.
|
||||
signed ::= minus_num.
|
||||
|
||||
@@ -302,7 +309,7 @@ ccons ::= DEFAULT MINUS(A) term(X). {
|
||||
}
|
||||
ccons ::= DEFAULT id(X). {
|
||||
ExprSpan v;
|
||||
spanExpr(&v, pParse, TK_STRING, X);
|
||||
spanExpr(&v, pParse, TK_STRING, &X);
|
||||
sqlite3AddDefaultValue(pParse,&v);
|
||||
}
|
||||
|
||||
@@ -332,7 +339,7 @@ autoinc(X) ::= AUTOINCR. {X = 1;}
|
||||
//
|
||||
%type refargs {int}
|
||||
refargs(A) ::= . { A = OE_None*0x0101; /* EV: R-19803-45884 */}
|
||||
refargs(A) ::= refargs(A) refarg(Y). { A = (A & ~Y.mask) | Y.value; }
|
||||
refargs(A) ::= refargs(X) refarg(Y). { A = (X & ~Y.mask) | Y.value; }
|
||||
%type refarg {struct {int value; int mask;}}
|
||||
refarg(A) ::= MATCH nm. { A.value = 0; A.mask = 0x000000; }
|
||||
refarg(A) ::= ON INSERT refact. { A.value = 0; A.mask = 0x000000; }
|
||||
@@ -353,7 +360,7 @@ init_deferred_pred_opt(A) ::= INITIALLY DEFERRED. {A = 1;}
|
||||
init_deferred_pred_opt(A) ::= INITIALLY IMMEDIATE. {A = 0;}
|
||||
|
||||
conslist_opt(A) ::= . {A.n = 0; A.z = 0;}
|
||||
conslist_opt(A) ::= COMMA(A) conslist.
|
||||
conslist_opt(A) ::= COMMA(X) conslist. {A = X;}
|
||||
conslist ::= conslist tconscomma tcons.
|
||||
conslist ::= tcons.
|
||||
tconscomma ::= COMMA. {pParse->constraintName.n = 0;}
|
||||
@@ -372,7 +379,7 @@ tcons ::= FOREIGN KEY LP eidlist(FA) RP
|
||||
}
|
||||
%type defer_subclause_opt {int}
|
||||
defer_subclause_opt(A) ::= . {A = 0;}
|
||||
defer_subclause_opt(A) ::= defer_subclause(A).
|
||||
defer_subclause_opt(A) ::= defer_subclause(X). {A = X;}
|
||||
|
||||
// The following is a non-standard extension that allows us to declare the
|
||||
// default behavior when there is a constraint conflict.
|
||||
@@ -384,7 +391,7 @@ onconf(A) ::= . {A = OE_Default;}
|
||||
onconf(A) ::= ON CONFLICT resolvetype(X). {A = X;}
|
||||
orconf(A) ::= . {A = OE_Default;}
|
||||
orconf(A) ::= OR resolvetype(X). {A = X;}
|
||||
resolvetype(A) ::= raisetype(A).
|
||||
resolvetype(A) ::= raisetype(X). {A = X;}
|
||||
resolvetype(A) ::= IGNORE. {A = OE_Ignore;}
|
||||
resolvetype(A) ::= REPLACE. {A = OE_Replace;}
|
||||
|
||||
@@ -456,14 +463,14 @@ select(A) ::= with(W) selectnowith(X). {
|
||||
}else{
|
||||
sqlite3WithDelete(pParse->db, W);
|
||||
}
|
||||
A = p; /*A-overwrites-W*/
|
||||
A = p;
|
||||
}
|
||||
|
||||
selectnowith(A) ::= oneselect(A).
|
||||
selectnowith(A) ::= oneselect(X). {A = X;}
|
||||
%ifndef SQLITE_OMIT_COMPOUND_SELECT
|
||||
selectnowith(A) ::= selectnowith(A) multiselect_op(Y) oneselect(Z). {
|
||||
selectnowith(A) ::= selectnowith(X) multiselect_op(Y) oneselect(Z). {
|
||||
Select *pRhs = Z;
|
||||
Select *pLhs = A;
|
||||
Select *pLhs = X;
|
||||
if( pRhs && pRhs->pPrior ){
|
||||
SrcList *pFrom;
|
||||
Token x;
|
||||
@@ -484,15 +491,12 @@ selectnowith(A) ::= selectnowith(A) multiselect_op(Y) oneselect(Z). {
|
||||
A = pRhs;
|
||||
}
|
||||
%type multiselect_op {int}
|
||||
multiselect_op(A) ::= UNION(OP). {A = @OP; /*A-overwrites-OP*/}
|
||||
multiselect_op(A) ::= UNION(OP). {A = @OP;}
|
||||
multiselect_op(A) ::= UNION ALL. {A = TK_ALL;}
|
||||
multiselect_op(A) ::= EXCEPT|INTERSECT(OP). {A = @OP; /*A-overwrites-OP*/}
|
||||
multiselect_op(A) ::= EXCEPT|INTERSECT(OP). {A = @OP;}
|
||||
%endif SQLITE_OMIT_COMPOUND_SELECT
|
||||
oneselect(A) ::= SELECT(S) distinct(D) selcollist(W) from(X) where_opt(Y)
|
||||
groupby_opt(P) having_opt(Q) orderby_opt(Z) limit_opt(L). {
|
||||
#if SELECTTRACE_ENABLED
|
||||
Token s = S; /*A-overwrites-S*/
|
||||
#endif
|
||||
A = sqlite3SelectNew(pParse,W,X,Y,P,Q,Z,D,L.pLimit,L.pOffset);
|
||||
#if SELECTTRACE_ENABLED
|
||||
/* Populate the Select.zSelName[] string that is used to help with
|
||||
@@ -505,7 +509,7 @@ oneselect(A) ::= SELECT(S) distinct(D) selcollist(W) from(X) where_opt(Y)
|
||||
** is an integer that is incremented with each SELECT statement seen.
|
||||
*/
|
||||
if( A!=0 ){
|
||||
const char *z = s.z+6;
|
||||
const char *z = S.z+6;
|
||||
int i;
|
||||
sqlite3_snprintf(sizeof(A->zSelName), A->zSelName, "#%d",
|
||||
++pParse->nSelect);
|
||||
@@ -519,19 +523,20 @@ oneselect(A) ::= SELECT(S) distinct(D) selcollist(W) from(X) where_opt(Y)
|
||||
}
|
||||
#endif /* SELECTRACE_ENABLED */
|
||||
}
|
||||
oneselect(A) ::= values(A).
|
||||
oneselect(A) ::= values(X). {A = X;}
|
||||
|
||||
%type values {Select*}
|
||||
%destructor values {sqlite3SelectDelete(pParse->db, $$);}
|
||||
values(A) ::= VALUES LP nexprlist(X) RP. {
|
||||
A = sqlite3SelectNew(pParse,X,0,0,0,0,0,SF_Values,0,0);
|
||||
}
|
||||
values(A) ::= values(A) COMMA LP exprlist(Y) RP. {
|
||||
Select *pRight, *pLeft = A;
|
||||
values(A) ::= values(X) COMMA LP exprlist(Y) RP. {
|
||||
Select *pRight, *pLeft = X;
|
||||
pRight = sqlite3SelectNew(pParse,Y,0,0,0,0,0,SF_Values|SF_MultiValue,0,0);
|
||||
if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
|
||||
if( pRight ){
|
||||
pRight->op = TK_ALL;
|
||||
pLeft = X;
|
||||
pRight->pPrior = pLeft;
|
||||
A = pRight;
|
||||
}else{
|
||||
@@ -556,22 +561,22 @@ distinct(A) ::= . {A = 0;}
|
||||
%destructor selcollist {sqlite3ExprListDelete(pParse->db, $$);}
|
||||
%type sclp {ExprList*}
|
||||
%destructor sclp {sqlite3ExprListDelete(pParse->db, $$);}
|
||||
sclp(A) ::= selcollist(A) COMMA.
|
||||
sclp(A) ::= selcollist(X) COMMA. {A = X;}
|
||||
sclp(A) ::= . {A = 0;}
|
||||
selcollist(A) ::= sclp(A) expr(X) as(Y). {
|
||||
A = sqlite3ExprListAppend(pParse, A, X.pExpr);
|
||||
selcollist(A) ::= sclp(P) expr(X) as(Y). {
|
||||
A = sqlite3ExprListAppend(pParse, P, X.pExpr);
|
||||
if( Y.n>0 ) sqlite3ExprListSetName(pParse, A, &Y, 1);
|
||||
sqlite3ExprListSetSpan(pParse,A,&X);
|
||||
}
|
||||
selcollist(A) ::= sclp(A) STAR. {
|
||||
selcollist(A) ::= sclp(P) STAR. {
|
||||
Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
|
||||
A = sqlite3ExprListAppend(pParse, A, p);
|
||||
A = sqlite3ExprListAppend(pParse, P, p);
|
||||
}
|
||||
selcollist(A) ::= sclp(A) nm(X) DOT STAR(Y). {
|
||||
selcollist(A) ::= sclp(P) nm(X) DOT STAR(Y). {
|
||||
Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0, &Y);
|
||||
Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &X);
|
||||
Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);
|
||||
A = sqlite3ExprListAppend(pParse,A, pDot);
|
||||
A = sqlite3ExprListAppend(pParse,P, pDot);
|
||||
}
|
||||
|
||||
// An option "AS <id>" phrase that can follow one of the expressions that
|
||||
@@ -579,7 +584,7 @@ selcollist(A) ::= sclp(A) nm(X) DOT STAR(Y). {
|
||||
//
|
||||
%type as {Token}
|
||||
as(X) ::= AS nm(Y). {X = Y;}
|
||||
as(X) ::= ids(X).
|
||||
as(X) ::= ids(Y). {X = Y;}
|
||||
as(X) ::= . {X.n = 0;}
|
||||
|
||||
|
||||
@@ -601,31 +606,32 @@ from(A) ::= FROM seltablist(X). {
|
||||
// "seltablist" is a "Select Table List" - the content of the FROM clause
|
||||
// in a SELECT statement. "stl_prefix" is a prefix of this list.
|
||||
//
|
||||
stl_prefix(A) ::= seltablist(A) joinop(Y). {
|
||||
stl_prefix(A) ::= seltablist(X) joinop(Y). {
|
||||
A = X;
|
||||
if( ALWAYS(A && A->nSrc>0) ) A->a[A->nSrc-1].fg.jointype = (u8)Y;
|
||||
}
|
||||
stl_prefix(A) ::= . {A = 0;}
|
||||
seltablist(A) ::= stl_prefix(A) nm(Y) dbnm(D) as(Z) indexed_opt(I)
|
||||
seltablist(A) ::= stl_prefix(X) nm(Y) dbnm(D) as(Z) indexed_opt(I)
|
||||
on_opt(N) using_opt(U). {
|
||||
A = sqlite3SrcListAppendFromTerm(pParse,A,&Y,&D,&Z,0,N,U);
|
||||
A = sqlite3SrcListAppendFromTerm(pParse,X,&Y,&D,&Z,0,N,U);
|
||||
sqlite3SrcListIndexedBy(pParse, A, &I);
|
||||
}
|
||||
seltablist(A) ::= stl_prefix(A) nm(Y) dbnm(D) LP exprlist(E) RP as(Z)
|
||||
seltablist(A) ::= stl_prefix(X) nm(Y) dbnm(D) LP exprlist(E) RP as(Z)
|
||||
on_opt(N) using_opt(U). {
|
||||
A = sqlite3SrcListAppendFromTerm(pParse,A,&Y,&D,&Z,0,N,U);
|
||||
A = sqlite3SrcListAppendFromTerm(pParse,X,&Y,&D,&Z,0,N,U);
|
||||
sqlite3SrcListFuncArgs(pParse, A, E);
|
||||
}
|
||||
%ifndef SQLITE_OMIT_SUBQUERY
|
||||
seltablist(A) ::= stl_prefix(A) LP select(S) RP
|
||||
seltablist(A) ::= stl_prefix(X) LP select(S) RP
|
||||
as(Z) on_opt(N) using_opt(U). {
|
||||
A = sqlite3SrcListAppendFromTerm(pParse,A,0,0,&Z,S,N,U);
|
||||
A = sqlite3SrcListAppendFromTerm(pParse,X,0,0,&Z,S,N,U);
|
||||
}
|
||||
seltablist(A) ::= stl_prefix(A) LP seltablist(F) RP
|
||||
seltablist(A) ::= stl_prefix(X) LP seltablist(F) RP
|
||||
as(Z) on_opt(N) using_opt(U). {
|
||||
if( A==0 && Z.n==0 && N==0 && U==0 ){
|
||||
if( X==0 && Z.n==0 && N==0 && U==0 ){
|
||||
A = F;
|
||||
}else if( F->nSrc==1 ){
|
||||
A = sqlite3SrcListAppendFromTerm(pParse,A,0,0,&Z,0,N,U);
|
||||
A = sqlite3SrcListAppendFromTerm(pParse,X,0,0,&Z,0,N,U);
|
||||
if( A ){
|
||||
struct SrcList_item *pNew = &A->a[A->nSrc-1];
|
||||
struct SrcList_item *pOld = F->a;
|
||||
@@ -640,7 +646,7 @@ seltablist(A) ::= stl_prefix(A) nm(Y) dbnm(D) LP exprlist(E) RP as(Z)
|
||||
Select *pSubquery;
|
||||
sqlite3SrcListShiftJoinType(F);
|
||||
pSubquery = sqlite3SelectNew(pParse,0,F,0,0,0,0,SF_NestedFrom,0,0);
|
||||
A = sqlite3SrcListAppendFromTerm(pParse,A,0,0,&Z,pSubquery,N,U);
|
||||
A = sqlite3SrcListAppendFromTerm(pParse,X,0,0,&Z,pSubquery,N,U);
|
||||
}
|
||||
}
|
||||
%endif SQLITE_OMIT_SUBQUERY
|
||||
@@ -651,17 +657,14 @@ dbnm(A) ::= DOT nm(X). {A = X;}
|
||||
|
||||
%type fullname {SrcList*}
|
||||
%destructor fullname {sqlite3SrcListDelete(pParse->db, $$);}
|
||||
fullname(A) ::= nm(X) dbnm(Y).
|
||||
{A = sqlite3SrcListAppend(pParse->db,0,&X,&Y); /*A-overwrites-X*/}
|
||||
fullname(A) ::= nm(X) dbnm(Y). {A = sqlite3SrcListAppend(pParse->db,0,&X,&Y);}
|
||||
|
||||
%type joinop {int}
|
||||
joinop(X) ::= COMMA|JOIN. { X = JT_INNER; }
|
||||
joinop(X) ::= JOIN_KW(A) JOIN.
|
||||
{X = sqlite3JoinType(pParse,&A,0,0); /*X-overwrites-A*/}
|
||||
joinop(X) ::= JOIN_KW(A) nm(B) JOIN.
|
||||
{X = sqlite3JoinType(pParse,&A,&B,0); /*X-overwrites-A*/}
|
||||
joinop(X) ::= JOIN_KW(A) JOIN. { X = sqlite3JoinType(pParse,&A,0,0); }
|
||||
joinop(X) ::= JOIN_KW(A) nm(B) JOIN. { X = sqlite3JoinType(pParse,&A,&B,0); }
|
||||
joinop(X) ::= JOIN_KW(A) nm(B) nm(C) JOIN.
|
||||
{X = sqlite3JoinType(pParse,&A,&B,&C);/*X-overwrites-A*/}
|
||||
{ X = sqlite3JoinType(pParse,&A,&B,&C); }
|
||||
|
||||
%type on_opt {Expr*}
|
||||
%destructor on_opt {sqlite3ExprDelete(pParse->db, $$);}
|
||||
@@ -701,12 +704,12 @@ using_opt(U) ::= . {U = 0;}
|
||||
|
||||
orderby_opt(A) ::= . {A = 0;}
|
||||
orderby_opt(A) ::= ORDER BY sortlist(X). {A = X;}
|
||||
sortlist(A) ::= sortlist(A) COMMA expr(Y) sortorder(Z). {
|
||||
A = sqlite3ExprListAppend(pParse,A,Y.pExpr);
|
||||
sortlist(A) ::= sortlist(X) COMMA expr(Y) sortorder(Z). {
|
||||
A = sqlite3ExprListAppend(pParse,X,Y.pExpr);
|
||||
sqlite3ExprListSetSortOrder(A,Z);
|
||||
}
|
||||
sortlist(A) ::= expr(Y) sortorder(Z). {
|
||||
A = sqlite3ExprListAppend(pParse,0,Y.pExpr); /*A-overwrites-Y*/
|
||||
A = sqlite3ExprListAppend(pParse,0,Y.pExpr);
|
||||
sqlite3ExprListSetSortOrder(A,Z);
|
||||
}
|
||||
|
||||
@@ -796,8 +799,8 @@ cmd ::= with(C) UPDATE orconf(R) fullname(X) indexed_opt(I) SET setlist(Y)
|
||||
%type setlist {ExprList*}
|
||||
%destructor setlist {sqlite3ExprListDelete(pParse->db, $$);}
|
||||
|
||||
setlist(A) ::= setlist(A) COMMA nm(X) EQ expr(Y). {
|
||||
A = sqlite3ExprListAppend(pParse, A, Y.pExpr);
|
||||
setlist(A) ::= setlist(Z) COMMA nm(X) EQ expr(Y). {
|
||||
A = sqlite3ExprListAppend(pParse, Z, Y.pExpr);
|
||||
sqlite3ExprListSetName(pParse, A, &X, 1);
|
||||
}
|
||||
setlist(A) ::= nm(X) EQ expr(Y). {
|
||||
@@ -828,10 +831,10 @@ insert_cmd(A) ::= REPLACE. {A = OE_Replace;}
|
||||
|
||||
idlist_opt(A) ::= . {A = 0;}
|
||||
idlist_opt(A) ::= LP idlist(X) RP. {A = X;}
|
||||
idlist(A) ::= idlist(A) COMMA nm(Y).
|
||||
{A = sqlite3IdListAppend(pParse->db,A,&Y);}
|
||||
idlist(A) ::= idlist(X) COMMA nm(Y).
|
||||
{A = sqlite3IdListAppend(pParse->db,X,&Y);}
|
||||
idlist(A) ::= nm(Y).
|
||||
{A = sqlite3IdListAppend(pParse->db,0,&Y); /*A-overwrites-Y*/}
|
||||
{A = sqlite3IdListAppend(pParse->db,0,&Y);}
|
||||
|
||||
/////////////////////////// Expression Processing /////////////////////////////
|
||||
//
|
||||
@@ -855,62 +858,61 @@ idlist(A) ::= nm(Y).
|
||||
** new Expr to populate pOut. Set the span of pOut to be the identifier
|
||||
** that created the expression.
|
||||
*/
|
||||
static void spanExpr(ExprSpan *pOut, Parse *pParse, int op, Token t){
|
||||
pOut->pExpr = sqlite3PExpr(pParse, op, 0, 0, &t);
|
||||
pOut->zStart = t.z;
|
||||
pOut->zEnd = &t.z[t.n];
|
||||
static void spanExpr(ExprSpan *pOut, Parse *pParse, int op, Token *pValue){
|
||||
pOut->pExpr = sqlite3PExpr(pParse, op, 0, 0, pValue);
|
||||
pOut->zStart = pValue->z;
|
||||
pOut->zEnd = &pValue->z[pValue->n];
|
||||
}
|
||||
}
|
||||
|
||||
expr(A) ::= term(A).
|
||||
expr(A) ::= LP(B) expr(X) RP(E).
|
||||
{spanSet(&A,&B,&E); /*A-overwrites-B*/ A.pExpr = X.pExpr;}
|
||||
term(A) ::= NULL(X). {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
|
||||
expr(A) ::= id(X). {spanExpr(&A,pParse,TK_ID,X); /*A-overwrites-X*/}
|
||||
expr(A) ::= JOIN_KW(X). {spanExpr(&A,pParse,TK_ID,X); /*A-overwrites-X*/}
|
||||
expr(A) ::= term(X). {A = X;}
|
||||
expr(A) ::= LP(B) expr(X) RP(E). {A.pExpr = X.pExpr; spanSet(&A,&B,&E);}
|
||||
term(A) ::= NULL(X). {spanExpr(&A, pParse, @X, &X);}
|
||||
expr(A) ::= id(X). {spanExpr(&A, pParse, TK_ID, &X);}
|
||||
expr(A) ::= JOIN_KW(X). {spanExpr(&A, pParse, TK_ID, &X);}
|
||||
expr(A) ::= nm(X) DOT nm(Y). {
|
||||
Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &X);
|
||||
Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &Y);
|
||||
spanSet(&A,&X,&Y); /*A-overwrites-X*/
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);
|
||||
spanSet(&A,&X,&Y);
|
||||
}
|
||||
expr(A) ::= nm(X) DOT nm(Y) DOT nm(Z). {
|
||||
Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &X);
|
||||
Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &Y);
|
||||
Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &Z);
|
||||
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);
|
||||
spanSet(&A,&X,&Z); /*A-overwrites-X*/
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);
|
||||
spanSet(&A,&X,&Z);
|
||||
}
|
||||
term(A) ::= INTEGER|FLOAT|BLOB(X). {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
|
||||
term(A) ::= STRING(X). {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
|
||||
term(A) ::= INTEGER|FLOAT|BLOB(X). {spanExpr(&A, pParse, @X, &X);}
|
||||
term(A) ::= STRING(X). {spanExpr(&A, pParse, @X, &X);}
|
||||
expr(A) ::= VARIABLE(X). {
|
||||
Token t = X; /*A-overwrites-X*/
|
||||
if( t.n>=2 && t.z[0]=='#' && sqlite3Isdigit(t.z[1]) ){
|
||||
if( X.n>=2 && X.z[0]=='#' && sqlite3Isdigit(X.z[1]) ){
|
||||
/* When doing a nested parse, one can include terms in an expression
|
||||
** that look like this: #1 #2 ... These terms refer to registers
|
||||
** in the virtual machine. #N is the N-th register. */
|
||||
spanSet(&A, &t, &t);
|
||||
if( pParse->nested==0 ){
|
||||
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t);
|
||||
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &X);
|
||||
A.pExpr = 0;
|
||||
}else{
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &t);
|
||||
if( A.pExpr ) sqlite3GetInt32(&t.z[1], &A.pExpr->iTable);
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &X);
|
||||
if( A.pExpr ) sqlite3GetInt32(&X.z[1], &A.pExpr->iTable);
|
||||
}
|
||||
}else{
|
||||
spanExpr(&A, pParse, TK_VARIABLE, t);
|
||||
spanExpr(&A, pParse, TK_VARIABLE, &X);
|
||||
sqlite3ExprAssignVarNumber(pParse, A.pExpr);
|
||||
}
|
||||
spanSet(&A, &X, &X);
|
||||
}
|
||||
expr(A) ::= expr(A) COLLATE ids(C). {
|
||||
A.pExpr = sqlite3ExprAddCollateToken(pParse, A.pExpr, &C, 1);
|
||||
expr(A) ::= expr(E) COLLATE ids(C). {
|
||||
A.pExpr = sqlite3ExprAddCollateToken(pParse, E.pExpr, &C, 1);
|
||||
A.zStart = E.zStart;
|
||||
A.zEnd = &C.z[C.n];
|
||||
}
|
||||
%ifndef SQLITE_OMIT_CAST
|
||||
expr(A) ::= CAST(X) LP expr(E) AS typetoken(T) RP(Y). {
|
||||
spanSet(&A,&X,&Y); /*A-overwrites-X*/
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_CAST, E.pExpr, 0, &T);
|
||||
spanSet(&A,&X,&Y);
|
||||
}
|
||||
%endif SQLITE_OMIT_CAST
|
||||
expr(A) ::= id(X) LP distinct(D) exprlist(Y) RP(E). {
|
||||
@@ -937,56 +939,58 @@ term(A) ::= CTIME_KW(OP). {
|
||||
** objects and uses the result to populate a new ExprSpan object.
|
||||
*/
|
||||
static void spanBinaryExpr(
|
||||
ExprSpan *pOut, /* Write the result here */
|
||||
Parse *pParse, /* The parsing context. Errors accumulate here */
|
||||
int op, /* The binary operation */
|
||||
ExprSpan *pLeft, /* The left operand, and output */
|
||||
ExprSpan *pLeft, /* The left operand */
|
||||
ExprSpan *pRight /* The right operand */
|
||||
){
|
||||
pLeft->pExpr = sqlite3PExpr(pParse, op, pLeft->pExpr, pRight->pExpr, 0);
|
||||
pLeft->zEnd = pRight->zEnd;
|
||||
pOut->pExpr = sqlite3PExpr(pParse, op, pLeft->pExpr, pRight->pExpr, 0);
|
||||
pOut->zStart = pLeft->zStart;
|
||||
pOut->zEnd = pRight->zEnd;
|
||||
}
|
||||
|
||||
/* If doNot is true, then add a TK_NOT Expr-node wrapper around the
|
||||
** outside of *ppExpr.
|
||||
*/
|
||||
static void exprNot(Parse *pParse, int doNot, ExprSpan *pSpan){
|
||||
if( doNot ){
|
||||
pSpan->pExpr = sqlite3PExpr(pParse, TK_NOT, pSpan->pExpr, 0, 0);
|
||||
}
|
||||
static void exprNot(Parse *pParse, int doNot, Expr **ppExpr){
|
||||
if( doNot ) *ppExpr = sqlite3PExpr(pParse, TK_NOT, *ppExpr, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
expr(A) ::= expr(A) AND(OP) expr(Y). {spanBinaryExpr(pParse,@OP,&A,&Y);}
|
||||
expr(A) ::= expr(A) OR(OP) expr(Y). {spanBinaryExpr(pParse,@OP,&A,&Y);}
|
||||
expr(A) ::= expr(A) LT|GT|GE|LE(OP) expr(Y).
|
||||
{spanBinaryExpr(pParse,@OP,&A,&Y);}
|
||||
expr(A) ::= expr(A) EQ|NE(OP) expr(Y). {spanBinaryExpr(pParse,@OP,&A,&Y);}
|
||||
expr(A) ::= expr(A) BITAND|BITOR|LSHIFT|RSHIFT(OP) expr(Y).
|
||||
{spanBinaryExpr(pParse,@OP,&A,&Y);}
|
||||
expr(A) ::= expr(A) PLUS|MINUS(OP) expr(Y).
|
||||
{spanBinaryExpr(pParse,@OP,&A,&Y);}
|
||||
expr(A) ::= expr(A) STAR|SLASH|REM(OP) expr(Y).
|
||||
{spanBinaryExpr(pParse,@OP,&A,&Y);}
|
||||
expr(A) ::= expr(A) CONCAT(OP) expr(Y). {spanBinaryExpr(pParse,@OP,&A,&Y);}
|
||||
expr(A) ::= expr(X) AND(OP) expr(Y). {spanBinaryExpr(&A,pParse,@OP,&X,&Y);}
|
||||
expr(A) ::= expr(X) OR(OP) expr(Y). {spanBinaryExpr(&A,pParse,@OP,&X,&Y);}
|
||||
expr(A) ::= expr(X) LT|GT|GE|LE(OP) expr(Y).
|
||||
{spanBinaryExpr(&A,pParse,@OP,&X,&Y);}
|
||||
expr(A) ::= expr(X) EQ|NE(OP) expr(Y). {spanBinaryExpr(&A,pParse,@OP,&X,&Y);}
|
||||
expr(A) ::= expr(X) BITAND|BITOR|LSHIFT|RSHIFT(OP) expr(Y).
|
||||
{spanBinaryExpr(&A,pParse,@OP,&X,&Y);}
|
||||
expr(A) ::= expr(X) PLUS|MINUS(OP) expr(Y).
|
||||
{spanBinaryExpr(&A,pParse,@OP,&X,&Y);}
|
||||
expr(A) ::= expr(X) STAR|SLASH|REM(OP) expr(Y).
|
||||
{spanBinaryExpr(&A,pParse,@OP,&X,&Y);}
|
||||
expr(A) ::= expr(X) CONCAT(OP) expr(Y). {spanBinaryExpr(&A,pParse,@OP,&X,&Y);}
|
||||
%type likeop {struct LikeOp}
|
||||
likeop(A) ::= LIKE_KW|MATCH(X). {A.eOperator = X; A.bNot = 0;/*A-overwrites-X*/}
|
||||
likeop(A) ::= LIKE_KW|MATCH(X). {A.eOperator = X; A.bNot = 0;}
|
||||
likeop(A) ::= NOT LIKE_KW|MATCH(X). {A.eOperator = X; A.bNot = 1;}
|
||||
expr(A) ::= expr(A) likeop(OP) expr(Y). [LIKE_KW] {
|
||||
expr(A) ::= expr(X) likeop(OP) expr(Y). [LIKE_KW] {
|
||||
ExprList *pList;
|
||||
pList = sqlite3ExprListAppend(pParse,0, Y.pExpr);
|
||||
pList = sqlite3ExprListAppend(pParse,pList, A.pExpr);
|
||||
pList = sqlite3ExprListAppend(pParse,pList, X.pExpr);
|
||||
A.pExpr = sqlite3ExprFunction(pParse, pList, &OP.eOperator);
|
||||
exprNot(pParse, OP.bNot, &A);
|
||||
exprNot(pParse, OP.bNot, &A.pExpr);
|
||||
A.zStart = X.zStart;
|
||||
A.zEnd = Y.zEnd;
|
||||
if( A.pExpr ) A.pExpr->flags |= EP_InfixFunc;
|
||||
}
|
||||
expr(A) ::= expr(A) likeop(OP) expr(Y) ESCAPE expr(E). [LIKE_KW] {
|
||||
expr(A) ::= expr(X) likeop(OP) expr(Y) ESCAPE expr(E). [LIKE_KW] {
|
||||
ExprList *pList;
|
||||
pList = sqlite3ExprListAppend(pParse,0, Y.pExpr);
|
||||
pList = sqlite3ExprListAppend(pParse,pList, A.pExpr);
|
||||
pList = sqlite3ExprListAppend(pParse,pList, X.pExpr);
|
||||
pList = sqlite3ExprListAppend(pParse,pList, E.pExpr);
|
||||
A.pExpr = sqlite3ExprFunction(pParse, pList, &OP.eOperator);
|
||||
exprNot(pParse, OP.bNot, &A);
|
||||
exprNot(pParse, OP.bNot, &A.pExpr);
|
||||
A.zStart = X.zStart;
|
||||
A.zEnd = E.zEnd;
|
||||
if( A.pExpr ) A.pExpr->flags |= EP_InfixFunc;
|
||||
}
|
||||
@@ -995,18 +999,20 @@ expr(A) ::= expr(A) likeop(OP) expr(Y) ESCAPE expr(E). [LIKE_KW] {
|
||||
/* Construct an expression node for a unary postfix operator
|
||||
*/
|
||||
static void spanUnaryPostfix(
|
||||
ExprSpan *pOut, /* Write the new expression node here */
|
||||
Parse *pParse, /* Parsing context to record errors */
|
||||
int op, /* The operator */
|
||||
ExprSpan *pOperand, /* The operand, and output */
|
||||
ExprSpan *pOperand, /* The operand */
|
||||
Token *pPostOp /* The operand token for setting the span */
|
||||
){
|
||||
pOperand->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0, 0);
|
||||
pOperand->zEnd = &pPostOp->z[pPostOp->n];
|
||||
pOut->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0, 0);
|
||||
pOut->zStart = pOperand->zStart;
|
||||
pOut->zEnd = &pPostOp->z[pPostOp->n];
|
||||
}
|
||||
}
|
||||
|
||||
expr(A) ::= expr(A) ISNULL|NOTNULL(E). {spanUnaryPostfix(pParse,@E,&A,&E);}
|
||||
expr(A) ::= expr(A) NOT NULL(E). {spanUnaryPostfix(pParse,TK_NOTNULL,&A,&E);}
|
||||
expr(A) ::= expr(X) ISNULL|NOTNULL(E). {spanUnaryPostfix(&A,pParse,@E,&X,&E);}
|
||||
expr(A) ::= expr(X) NOT NULL(E). {spanUnaryPostfix(&A,pParse,TK_NOTNULL,&X,&E);}
|
||||
|
||||
%include {
|
||||
/* A routine to convert a binary TK_IS or TK_ISNOT expression into a
|
||||
@@ -1027,12 +1033,12 @@ expr(A) ::= expr(A) NOT NULL(E). {spanUnaryPostfix(pParse,TK_NOTNULL,&A,&E);}
|
||||
// If expr2 is NULL then code as TK_ISNULL or TK_NOTNULL. If expr2
|
||||
// is any other expression, code as TK_IS or TK_ISNOT.
|
||||
//
|
||||
expr(A) ::= expr(A) IS expr(Y). {
|
||||
spanBinaryExpr(pParse,TK_IS,&A,&Y);
|
||||
expr(A) ::= expr(X) IS expr(Y). {
|
||||
spanBinaryExpr(&A,pParse,TK_IS,&X,&Y);
|
||||
binaryToUnaryIfNull(pParse, Y.pExpr, A.pExpr, TK_ISNULL);
|
||||
}
|
||||
expr(A) ::= expr(A) IS NOT expr(Y). {
|
||||
spanBinaryExpr(pParse,TK_ISNOT,&A,&Y);
|
||||
expr(A) ::= expr(X) IS NOT expr(Y). {
|
||||
spanBinaryExpr(&A,pParse,TK_ISNOT,&X,&Y);
|
||||
binaryToUnaryIfNull(pParse, Y.pExpr, A.pExpr, TK_NOTNULL);
|
||||
}
|
||||
|
||||
@@ -1046,43 +1052,42 @@ expr(A) ::= expr(A) IS NOT expr(Y). {
|
||||
ExprSpan *pOperand, /* The operand */
|
||||
Token *pPreOp /* The operand token for setting the span */
|
||||
){
|
||||
pOut->zStart = pPreOp->z;
|
||||
pOut->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0, 0);
|
||||
pOut->zStart = pPreOp->z;
|
||||
pOut->zEnd = pOperand->zEnd;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
expr(A) ::= NOT(B) expr(X).
|
||||
{spanUnaryPrefix(&A,pParse,@B,&X,&B);/*A-overwrites-B*/}
|
||||
expr(A) ::= BITNOT(B) expr(X).
|
||||
{spanUnaryPrefix(&A,pParse,@B,&X,&B);/*A-overwrites-B*/}
|
||||
expr(A) ::= NOT(B) expr(X). {spanUnaryPrefix(&A,pParse,@B,&X,&B);}
|
||||
expr(A) ::= BITNOT(B) expr(X). {spanUnaryPrefix(&A,pParse,@B,&X,&B);}
|
||||
expr(A) ::= MINUS(B) expr(X). [BITNOT]
|
||||
{spanUnaryPrefix(&A,pParse,TK_UMINUS,&X,&B);/*A-overwrites-B*/}
|
||||
{spanUnaryPrefix(&A,pParse,TK_UMINUS,&X,&B);}
|
||||
expr(A) ::= PLUS(B) expr(X). [BITNOT]
|
||||
{spanUnaryPrefix(&A,pParse,TK_UPLUS,&X,&B);/*A-overwrites-B*/}
|
||||
{spanUnaryPrefix(&A,pParse,TK_UPLUS,&X,&B);}
|
||||
|
||||
%type between_op {int}
|
||||
between_op(A) ::= BETWEEN. {A = 0;}
|
||||
between_op(A) ::= NOT BETWEEN. {A = 1;}
|
||||
expr(A) ::= expr(A) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
|
||||
expr(A) ::= expr(W) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
|
||||
ExprList *pList = sqlite3ExprListAppend(pParse,0, X.pExpr);
|
||||
pList = sqlite3ExprListAppend(pParse,pList, Y.pExpr);
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, A.pExpr, 0, 0);
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, W.pExpr, 0, 0);
|
||||
if( A.pExpr ){
|
||||
A.pExpr->x.pList = pList;
|
||||
}else{
|
||||
sqlite3ExprListDelete(pParse->db, pList);
|
||||
}
|
||||
exprNot(pParse, N, &A);
|
||||
exprNot(pParse, N, &A.pExpr);
|
||||
A.zStart = W.zStart;
|
||||
A.zEnd = Y.zEnd;
|
||||
}
|
||||
%ifndef SQLITE_OMIT_SUBQUERY
|
||||
%type in_op {int}
|
||||
in_op(A) ::= IN. {A = 0;}
|
||||
in_op(A) ::= NOT IN. {A = 1;}
|
||||
expr(A) ::= expr(A) in_op(N) LP exprlist(Y) RP(E). [IN] {
|
||||
expr(A) ::= expr(X) in_op(N) LP exprlist(Y) RP(E). [IN] {
|
||||
if( Y==0 ){
|
||||
/* Expressions of the form
|
||||
**
|
||||
@@ -1092,8 +1097,8 @@ expr(A) ::= expr(A) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
|
||||
** simplify to constants 0 (false) and 1 (true), respectively,
|
||||
** regardless of the value of expr1.
|
||||
*/
|
||||
sqlite3ExprDelete(pParse->db, A.pExpr);
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &sqlite3IntTokens[N]);
|
||||
sqlite3ExprDelete(pParse->db, X.pExpr);
|
||||
}else if( Y->nExpr==1 ){
|
||||
/* Expressions of the form:
|
||||
**
|
||||
@@ -1120,21 +1125,21 @@ expr(A) ::= expr(A) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
|
||||
pRHS->flags &= ~EP_Collate;
|
||||
pRHS->flags |= EP_Generic;
|
||||
}
|
||||
A.pExpr = sqlite3PExpr(pParse, N ? TK_NE : TK_EQ, A.pExpr, pRHS, 0);
|
||||
A.pExpr = sqlite3PExpr(pParse, N ? TK_NE : TK_EQ, X.pExpr, pRHS, 0);
|
||||
}else{
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_IN, A.pExpr, 0, 0);
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_IN, X.pExpr, 0, 0);
|
||||
if( A.pExpr ){
|
||||
A.pExpr->x.pList = Y;
|
||||
sqlite3ExprSetHeightAndFlags(pParse, A.pExpr);
|
||||
}else{
|
||||
sqlite3ExprListDelete(pParse->db, Y);
|
||||
}
|
||||
exprNot(pParse, N, &A);
|
||||
exprNot(pParse, N, &A.pExpr);
|
||||
}
|
||||
A.zStart = X.zStart;
|
||||
A.zEnd = &E.z[E.n];
|
||||
}
|
||||
expr(A) ::= LP(B) select(X) RP(E). {
|
||||
spanSet(&A,&B,&E); /*A-overwrites-B*/
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);
|
||||
if( A.pExpr ){
|
||||
A.pExpr->x.pSelect = X;
|
||||
@@ -1143,9 +1148,11 @@ expr(A) ::= expr(A) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
|
||||
}else{
|
||||
sqlite3SelectDelete(pParse->db, X);
|
||||
}
|
||||
A.zStart = B.z;
|
||||
A.zEnd = &E.z[E.n];
|
||||
}
|
||||
expr(A) ::= expr(A) in_op(N) LP select(Y) RP(E). [IN] {
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_IN, A.pExpr, 0, 0);
|
||||
expr(A) ::= expr(X) in_op(N) LP select(Y) RP(E). [IN] {
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_IN, X.pExpr, 0, 0);
|
||||
if( A.pExpr ){
|
||||
A.pExpr->x.pSelect = Y;
|
||||
ExprSetProperty(A.pExpr, EP_xIsSelect|EP_Subquery);
|
||||
@@ -1153,12 +1160,13 @@ expr(A) ::= expr(A) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
|
||||
}else{
|
||||
sqlite3SelectDelete(pParse->db, Y);
|
||||
}
|
||||
exprNot(pParse, N, &A);
|
||||
exprNot(pParse, N, &A.pExpr);
|
||||
A.zStart = X.zStart;
|
||||
A.zEnd = &E.z[E.n];
|
||||
}
|
||||
expr(A) ::= expr(A) in_op(N) nm(Y) dbnm(Z). [IN] {
|
||||
expr(A) ::= expr(X) in_op(N) nm(Y) dbnm(Z). [IN] {
|
||||
SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&Y,&Z);
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_IN, A.pExpr, 0, 0);
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_IN, X.pExpr, 0, 0);
|
||||
if( A.pExpr ){
|
||||
A.pExpr->x.pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
|
||||
ExprSetProperty(A.pExpr, EP_xIsSelect|EP_Subquery);
|
||||
@@ -1166,13 +1174,12 @@ expr(A) ::= expr(A) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
|
||||
}else{
|
||||
sqlite3SrcListDelete(pParse->db, pSrc);
|
||||
}
|
||||
exprNot(pParse, N, &A);
|
||||
exprNot(pParse, N, &A.pExpr);
|
||||
A.zStart = X.zStart;
|
||||
A.zEnd = Z.z ? &Z.z[Z.n] : &Y.z[Y.n];
|
||||
}
|
||||
expr(A) ::= EXISTS(B) LP select(Y) RP(E). {
|
||||
Expr *p;
|
||||
spanSet(&A,&B,&E); /*A-overwrites-B*/
|
||||
p = A.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);
|
||||
Expr *p = A.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);
|
||||
if( p ){
|
||||
p->x.pSelect = Y;
|
||||
ExprSetProperty(p, EP_xIsSelect|EP_Subquery);
|
||||
@@ -1180,12 +1187,13 @@ expr(A) ::= expr(A) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
|
||||
}else{
|
||||
sqlite3SelectDelete(pParse->db, Y);
|
||||
}
|
||||
A.zStart = B.z;
|
||||
A.zEnd = &E.z[E.n];
|
||||
}
|
||||
%endif SQLITE_OMIT_SUBQUERY
|
||||
|
||||
/* CASE expressions */
|
||||
expr(A) ::= CASE(C) case_operand(X) case_exprlist(Y) case_else(Z) END(E). {
|
||||
spanSet(&A,&C,&E); /*A-overwrites-C*/
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_CASE, X, 0, 0);
|
||||
if( A.pExpr ){
|
||||
A.pExpr->x.pList = Z ? sqlite3ExprListAppend(pParse,Y,Z) : Y;
|
||||
@@ -1194,11 +1202,13 @@ expr(A) ::= CASE(C) case_operand(X) case_exprlist(Y) case_else(Z) END(E). {
|
||||
sqlite3ExprListDelete(pParse->db, Y);
|
||||
sqlite3ExprDelete(pParse->db, Z);
|
||||
}
|
||||
A.zStart = C.z;
|
||||
A.zEnd = &E.z[E.n];
|
||||
}
|
||||
%type case_exprlist {ExprList*}
|
||||
%destructor case_exprlist {sqlite3ExprListDelete(pParse->db, $$);}
|
||||
case_exprlist(A) ::= case_exprlist(A) WHEN expr(Y) THEN expr(Z). {
|
||||
A = sqlite3ExprListAppend(pParse,A, Y.pExpr);
|
||||
case_exprlist(A) ::= case_exprlist(X) WHEN expr(Y) THEN expr(Z). {
|
||||
A = sqlite3ExprListAppend(pParse,X, Y.pExpr);
|
||||
A = sqlite3ExprListAppend(pParse,A, Z.pExpr);
|
||||
}
|
||||
case_exprlist(A) ::= WHEN expr(Y) THEN expr(Z). {
|
||||
@@ -1211,7 +1221,7 @@ case_else(A) ::= ELSE expr(X). {A = X.pExpr;}
|
||||
case_else(A) ::= . {A = 0;}
|
||||
%type case_operand {Expr*}
|
||||
%destructor case_operand {sqlite3ExprDelete(pParse->db, $$);}
|
||||
case_operand(A) ::= expr(X). {A = X.pExpr; /*A-overwrites-X*/}
|
||||
case_operand(A) ::= expr(X). {A = X.pExpr;}
|
||||
case_operand(A) ::= . {A = 0;}
|
||||
|
||||
%type exprlist {ExprList*}
|
||||
@@ -1219,12 +1229,12 @@ case_operand(A) ::= . {A = 0;}
|
||||
%type nexprlist {ExprList*}
|
||||
%destructor nexprlist {sqlite3ExprListDelete(pParse->db, $$);}
|
||||
|
||||
exprlist(A) ::= nexprlist(A).
|
||||
exprlist(A) ::= nexprlist(X). {A = X;}
|
||||
exprlist(A) ::= . {A = 0;}
|
||||
nexprlist(A) ::= nexprlist(A) COMMA expr(Y).
|
||||
{A = sqlite3ExprListAppend(pParse,A,Y.pExpr);}
|
||||
nexprlist(A) ::= nexprlist(X) COMMA expr(Y).
|
||||
{A = sqlite3ExprListAppend(pParse,X,Y.pExpr);}
|
||||
nexprlist(A) ::= expr(Y).
|
||||
{A = sqlite3ExprListAppend(pParse,0,Y.pExpr); /*A-overwrites-Y*/}
|
||||
{A = sqlite3ExprListAppend(pParse,0,Y.pExpr);}
|
||||
|
||||
|
||||
///////////////////////////// The CREATE INDEX command ///////////////////////
|
||||
@@ -1288,11 +1298,11 @@ uniqueflag(A) ::= . {A = OE_None;}
|
||||
|
||||
eidlist_opt(A) ::= . {A = 0;}
|
||||
eidlist_opt(A) ::= LP eidlist(X) RP. {A = X;}
|
||||
eidlist(A) ::= eidlist(A) COMMA nm(Y) collate(C) sortorder(Z). {
|
||||
A = parserAddExprIdListTerm(pParse, A, &Y, C, Z);
|
||||
eidlist(A) ::= eidlist(X) COMMA nm(Y) collate(C) sortorder(Z). {
|
||||
A = parserAddExprIdListTerm(pParse, X, &Y, C, Z);
|
||||
}
|
||||
eidlist(A) ::= nm(Y) collate(C) sortorder(Z). {
|
||||
A = parserAddExprIdListTerm(pParse, 0, &Y, C, Z); /*A-overwrites-Y*/
|
||||
A = parserAddExprIdListTerm(pParse, 0, &Y, C, Z);
|
||||
}
|
||||
|
||||
%type collate {int}
|
||||
@@ -1324,15 +1334,15 @@ cmd ::= PRAGMA nm(X) dbnm(Z) EQ minus_num(Y).
|
||||
cmd ::= PRAGMA nm(X) dbnm(Z) LP minus_num(Y) RP.
|
||||
{sqlite3Pragma(pParse,&X,&Z,&Y,1);}
|
||||
|
||||
nmnum(A) ::= plus_num(A).
|
||||
nmnum(A) ::= nm(A).
|
||||
nmnum(A) ::= ON(A).
|
||||
nmnum(A) ::= DELETE(A).
|
||||
nmnum(A) ::= DEFAULT(A).
|
||||
nmnum(A) ::= plus_num(X). {A = X;}
|
||||
nmnum(A) ::= nm(X). {A = X;}
|
||||
nmnum(A) ::= ON(X). {A = X;}
|
||||
nmnum(A) ::= DELETE(X). {A = X;}
|
||||
nmnum(A) ::= DEFAULT(X). {A = X;}
|
||||
%endif SQLITE_OMIT_PRAGMA
|
||||
%token_class number INTEGER|FLOAT.
|
||||
plus_num(A) ::= PLUS number(X). {A = X;}
|
||||
plus_num(A) ::= number(A).
|
||||
plus_num(A) ::= number(X). {A = X;}
|
||||
minus_num(A) ::= MINUS number(X). {A = X;}
|
||||
//////////////////////////// The CREATE TRIGGER command /////////////////////
|
||||
|
||||
@@ -1349,7 +1359,7 @@ trigger_decl(A) ::= temp(T) TRIGGER ifnotexists(NOERR) nm(B) dbnm(Z)
|
||||
trigger_time(C) trigger_event(D)
|
||||
ON fullname(E) foreach_clause when_clause(G). {
|
||||
sqlite3BeginTrigger(pParse, &B, &Z, C, D.a, D.b, E, G, T, NOERR);
|
||||
A = (Z.n==0?B:Z); /*A-overwrites-T*/
|
||||
A = (Z.n==0?B:Z);
|
||||
}
|
||||
|
||||
%type trigger_time {int}
|
||||
@@ -1360,9 +1370,9 @@ trigger_time(A) ::= . { A = TK_BEFORE; }
|
||||
|
||||
%type trigger_event {struct TrigEvent}
|
||||
%destructor trigger_event {sqlite3IdListDelete(pParse->db, $$.b);}
|
||||
trigger_event(A) ::= DELETE|INSERT(X). {A.a = @X; /*A-overwrites-X*/ A.b = 0;}
|
||||
trigger_event(A) ::= UPDATE(X). {A.a = @X; /*A-overwrites-X*/ A.b = 0;}
|
||||
trigger_event(A) ::= UPDATE OF idlist(X).{A.a = TK_UPDATE; A.b = X;}
|
||||
trigger_event(A) ::= DELETE|INSERT(OP). {A.a = @OP; A.b = 0;}
|
||||
trigger_event(A) ::= UPDATE(OP). {A.a = @OP; A.b = 0;}
|
||||
trigger_event(A) ::= UPDATE OF idlist(X). {A.a = TK_UPDATE; A.b = X;}
|
||||
|
||||
foreach_clause ::= .
|
||||
foreach_clause ::= FOR EACH ROW.
|
||||
@@ -1374,14 +1384,16 @@ when_clause(A) ::= WHEN expr(X). { A = X.pExpr; }
|
||||
|
||||
%type trigger_cmd_list {TriggerStep*}
|
||||
%destructor trigger_cmd_list {sqlite3DeleteTriggerStep(pParse->db, $$);}
|
||||
trigger_cmd_list(A) ::= trigger_cmd_list(A) trigger_cmd(X) SEMI. {
|
||||
assert( A!=0 );
|
||||
A->pLast->pNext = X;
|
||||
A->pLast = X;
|
||||
trigger_cmd_list(A) ::= trigger_cmd_list(Y) trigger_cmd(X) SEMI. {
|
||||
assert( Y!=0 );
|
||||
Y->pLast->pNext = X;
|
||||
Y->pLast = X;
|
||||
A = Y;
|
||||
}
|
||||
trigger_cmd_list(A) ::= trigger_cmd(A) SEMI. {
|
||||
assert( A!=0 );
|
||||
A->pLast = A;
|
||||
trigger_cmd_list(A) ::= trigger_cmd(X) SEMI. {
|
||||
assert( X!=0 );
|
||||
X->pLast = X;
|
||||
A = X;
|
||||
}
|
||||
|
||||
// Disallow qualified table names on INSERT, UPDATE, and DELETE statements
|
||||
@@ -1389,7 +1401,7 @@ trigger_cmd_list(A) ::= trigger_cmd(A) SEMI. {
|
||||
// the same database as the table that the trigger fires on.
|
||||
//
|
||||
%type trnm {Token}
|
||||
trnm(A) ::= nm(A).
|
||||
trnm(A) ::= nm(X). {A = X;}
|
||||
trnm(A) ::= nm DOT nm(X). {
|
||||
A = X;
|
||||
sqlite3ErrorMsg(pParse,
|
||||
@@ -1420,34 +1432,35 @@ tridxby ::= NOT INDEXED. {
|
||||
// UPDATE
|
||||
trigger_cmd(A) ::=
|
||||
UPDATE orconf(R) trnm(X) tridxby SET setlist(Y) where_opt(Z).
|
||||
{A = sqlite3TriggerUpdateStep(pParse->db, &X, Y, Z, R);}
|
||||
{ A = sqlite3TriggerUpdateStep(pParse->db, &X, Y, Z, R); }
|
||||
|
||||
// INSERT
|
||||
trigger_cmd(A) ::= insert_cmd(R) INTO trnm(X) idlist_opt(F) select(S).
|
||||
{A = sqlite3TriggerInsertStep(pParse->db, &X, F, S, R);/*A-overwrites-R*/}
|
||||
{A = sqlite3TriggerInsertStep(pParse->db, &X, F, S, R);}
|
||||
|
||||
// DELETE
|
||||
trigger_cmd(A) ::= DELETE FROM trnm(X) tridxby where_opt(Y).
|
||||
{A = sqlite3TriggerDeleteStep(pParse->db, &X, Y);}
|
||||
{A = sqlite3TriggerDeleteStep(pParse->db, &X, Y);}
|
||||
|
||||
// SELECT
|
||||
trigger_cmd(A) ::= select(X).
|
||||
{A = sqlite3TriggerSelectStep(pParse->db, X); /*A-overwrites-X*/}
|
||||
trigger_cmd(A) ::= select(X). {A = sqlite3TriggerSelectStep(pParse->db, X); }
|
||||
|
||||
// The special RAISE expression that may occur in trigger programs
|
||||
expr(A) ::= RAISE(X) LP IGNORE RP(Y). {
|
||||
spanSet(&A,&X,&Y); /*A-overwrites-X*/
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0);
|
||||
if( A.pExpr ){
|
||||
A.pExpr->affinity = OE_Ignore;
|
||||
}
|
||||
A.zStart = X.z;
|
||||
A.zEnd = &Y.z[Y.n];
|
||||
}
|
||||
expr(A) ::= RAISE(X) LP raisetype(T) COMMA nm(Z) RP(Y). {
|
||||
spanSet(&A,&X,&Y); /*A-overwrites-X*/
|
||||
A.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &Z);
|
||||
if( A.pExpr ) {
|
||||
A.pExpr->affinity = (char)T;
|
||||
}
|
||||
A.zStart = X.z;
|
||||
A.zEnd = &Y.z[Y.n];
|
||||
}
|
||||
%endif !SQLITE_OMIT_TRIGGER
|
||||
|
||||
@@ -1543,9 +1556,9 @@ with(A) ::= WITH wqlist(W). { A = W; }
|
||||
with(A) ::= WITH RECURSIVE wqlist(W). { A = W; }
|
||||
|
||||
wqlist(A) ::= nm(X) eidlist_opt(Y) AS LP select(Z) RP. {
|
||||
A = sqlite3WithAdd(pParse, 0, &X, Y, Z); /*A-overwrites-X*/
|
||||
A = sqlite3WithAdd(pParse, 0, &X, Y, Z);
|
||||
}
|
||||
wqlist(A) ::= wqlist(A) COMMA nm(X) eidlist_opt(Y) AS LP select(Z) RP. {
|
||||
A = sqlite3WithAdd(pParse, A, &X, Y, Z);
|
||||
wqlist(A) ::= wqlist(W) COMMA nm(X) eidlist_opt(Y) AS LP select(Z) RP. {
|
||||
A = sqlite3WithAdd(pParse, W, &X, Y, Z);
|
||||
}
|
||||
%endif SQLITE_OMIT_CTE
|
||||
|
||||
@@ -191,7 +191,7 @@ int sqlite3PcacheSetPageSize(PCache *pCache, int szPage){
|
||||
szPage, pCache->szExtra + ROUND8(sizeof(PgHdr)),
|
||||
pCache->bPurgeable
|
||||
);
|
||||
if( pNew==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( pNew==0 ) return SQLITE_NOMEM;
|
||||
sqlite3GlobalConfig.pcache2.xCachesize(pNew, numberOfCachePages(pCache));
|
||||
if( pCache->pCache ){
|
||||
sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache);
|
||||
@@ -301,7 +301,7 @@ int sqlite3PcacheFetchStress(
|
||||
}
|
||||
}
|
||||
*ppPage = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, 2);
|
||||
return *ppPage==0 ? SQLITE_NOMEM_BKPT : SQLITE_OK;
|
||||
return *ppPage==0 ? SQLITE_NOMEM : SQLITE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -33,7 +33,7 @@ static void corruptSchema(
|
||||
sqlite3DbFree(db, *pData->pzErrMsg);
|
||||
*pData->pzErrMsg = z;
|
||||
}
|
||||
pData->rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_CORRUPT_BKPT;
|
||||
pData->rc = db->mallocFailed ? SQLITE_NOMEM : SQLITE_CORRUPT_BKPT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -307,7 +307,7 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
|
||||
#endif
|
||||
}
|
||||
if( db->mallocFailed ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
sqlite3ResetAllSchemasOfConnection(db);
|
||||
}
|
||||
if( rc==SQLITE_OK || (db->flags&SQLITE_RecoveryMode)){
|
||||
@@ -524,7 +524,7 @@ static int sqlite3Prepare(
|
||||
/* Allocate the parsing context */
|
||||
pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
|
||||
if( pParse==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto end_prepare;
|
||||
}
|
||||
pParse->pReprepare = pReprepare;
|
||||
@@ -601,7 +601,7 @@ static int sqlite3Prepare(
|
||||
schemaIsValid(pParse);
|
||||
}
|
||||
if( db->mallocFailed ){
|
||||
pParse->rc = SQLITE_NOMEM_BKPT;
|
||||
pParse->rc = SQLITE_NOMEM;
|
||||
}
|
||||
if( pzTail ){
|
||||
*pzTail = pParse->zTail;
|
||||
|
||||
@@ -656,9 +656,9 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
||||
notValid(pParse, pNC, "functions", NC_PartIdx);
|
||||
zId = pExpr->u.zToken;
|
||||
nId = sqlite3Strlen30(zId);
|
||||
pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0);
|
||||
pDef = sqlite3FindFunction(pParse->db, zId, nId, n, enc, 0);
|
||||
if( pDef==0 ){
|
||||
pDef = sqlite3FindFunction(pParse->db, zId, -2, enc, 0);
|
||||
pDef = sqlite3FindFunction(pParse->db, zId, nId, -2, enc, 0);
|
||||
if( pDef==0 ){
|
||||
no_such_func = 1;
|
||||
}else{
|
||||
|
||||
@@ -1688,7 +1688,7 @@ int sqlite3ColumnsFromExprList(
|
||||
sqlite3DbFree(db, aCol);
|
||||
*paCol = 0;
|
||||
*pnCol = 0;
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
return SQLITE_OK;
|
||||
}
|
||||
@@ -2499,7 +2499,7 @@ static int multiSelect(
|
||||
nCol = p->pEList->nExpr;
|
||||
pKeyInfo = sqlite3KeyInfoAlloc(db, nCol, 1);
|
||||
if( !pKeyInfo ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto multi_select_end;
|
||||
}
|
||||
for(i=0, apColl=pKeyInfo->aColl; i<nCol; i++, apColl++){
|
||||
@@ -2854,7 +2854,7 @@ static int multiSelectOrderBy(
|
||||
}
|
||||
if( j==nOrderBy ){
|
||||
Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);
|
||||
if( pNew==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( pNew==0 ) return SQLITE_NOMEM;
|
||||
pNew->flags |= EP_IntValue;
|
||||
pNew->u.iValue = i;
|
||||
pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew);
|
||||
@@ -4091,7 +4091,7 @@ static int withExpand(
|
||||
pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
|
||||
pTab->tabFlags |= TF_Ephemeral | TF_NoVisibleRowid;
|
||||
pFrom->pSelect = sqlite3SelectDup(db, pCte->pSelect, 0);
|
||||
if( db->mallocFailed ) return SQLITE_NOMEM_BKPT;
|
||||
if( db->mallocFailed ) return SQLITE_NOMEM;
|
||||
assert( pFrom->pSelect );
|
||||
|
||||
/* Check if this is a recursive CTE. */
|
||||
|
||||
@@ -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
|
||||
** overwrite any prior [sqlite3_wal_hook()] settings.
|
||||
** those overwrite any prior [sqlite3_wal_hook()] settings.
|
||||
*/
|
||||
void *sqlite3_wal_hook(
|
||||
sqlite3*,
|
||||
|
||||
@@ -15,14 +15,6 @@
|
||||
#ifndef _SQLITEINT_H_
|
||||
#define _SQLITEINT_H_
|
||||
|
||||
/*
|
||||
** Make sure that rand_s() is available on Windows systems with MSVC 2005
|
||||
** or higher.
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER>=1400
|
||||
# define _CRT_RAND_S
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Include the header file used to customize the compiler options for MSVC.
|
||||
** This should be done first so that it can successfully prevent spurious
|
||||
@@ -157,7 +149,7 @@
|
||||
** to the next, so we have developed the following set of #if statements
|
||||
** to generate appropriate macros for a wide range of compilers.
|
||||
**
|
||||
** The correct "ANSI" way to do this is to use the intptr_t type.
|
||||
** The correct "ANSI" way to do this is to use the intptr_t type.
|
||||
** Unfortunately, that typedef is not available on all compilers, or
|
||||
** if it is available, it requires an #include of specific headers
|
||||
** that vary from one machine to the next.
|
||||
@@ -324,7 +316,7 @@
|
||||
** is set. Thus NDEBUG becomes an opt-in rather than an opt-out
|
||||
** feature.
|
||||
*/
|
||||
#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
|
||||
#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
|
||||
# define NDEBUG 1
|
||||
#endif
|
||||
#if defined(NDEBUG) && defined(SQLITE_DEBUG)
|
||||
@@ -339,7 +331,7 @@
|
||||
#endif
|
||||
|
||||
/*
|
||||
** The testcase() macro is used to aid in coverage testing. When
|
||||
** The testcase() macro is used to aid in coverage testing. When
|
||||
** doing coverage testing, the condition inside the argument to
|
||||
** testcase() must be evaluated both true and false in order to
|
||||
** get full branch coverage. The testcase() macro is inserted
|
||||
@@ -385,7 +377,7 @@
|
||||
#endif
|
||||
|
||||
/*
|
||||
** The ALWAYS and NEVER macros surround boolean expressions which
|
||||
** The ALWAYS and NEVER macros surround boolean expressions which
|
||||
** are intended to always be true or false, respectively. Such
|
||||
** expressions could be omitted from the code completely. But they
|
||||
** are included in a few cases in order to enhance the resilience
|
||||
@@ -498,7 +490,7 @@
|
||||
|
||||
/*
|
||||
** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0
|
||||
** afterward. Having this macro allows us to cause the C compiler
|
||||
** afterward. Having this macro allows us to cause the C compiler
|
||||
** to omit code used by TEMP tables without messy #ifndef statements.
|
||||
*/
|
||||
#ifdef SQLITE_OMIT_TEMPDB
|
||||
@@ -537,7 +529,7 @@
|
||||
|
||||
/*
|
||||
** If no value has been provided for SQLITE_MAX_WORKER_THREADS, or if
|
||||
** SQLITE_TEMP_STORE is set to 3 (never use temporary files), set it
|
||||
** SQLITE_TEMP_STORE is set to 3 (never use temporary files), set it
|
||||
** to zero.
|
||||
*/
|
||||
#if SQLITE_TEMP_STORE==3 || SQLITE_THREADSAFE==0
|
||||
@@ -685,7 +677,7 @@ typedef INT8_TYPE i8; /* 1-byte signed integer */
|
||||
** 4 -> 20 1000 -> 99 1048576 -> 200
|
||||
** 10 -> 33 1024 -> 100 4294967296 -> 320
|
||||
**
|
||||
** The LogEst can be negative to indicate fractional values.
|
||||
** The LogEst can be negative to indicate fractional values.
|
||||
** Examples:
|
||||
**
|
||||
** 0.5 -> -10 0.1 -> -33 0.0625 -> -40
|
||||
@@ -751,7 +743,7 @@ typedef INT16_TYPE LogEst;
|
||||
#define LARGEST_INT64 (0xffffffff|(((i64)0x7fffffff)<<32))
|
||||
#define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64)
|
||||
|
||||
/*
|
||||
/*
|
||||
** Round up a number to the next larger multiple of 8. This is used
|
||||
** to force 8-byte alignment on 64-bit architectures.
|
||||
*/
|
||||
@@ -845,7 +837,7 @@ typedef INT16_TYPE LogEst;
|
||||
|
||||
/*
|
||||
** An instance of the following structure is used to store the busy-handler
|
||||
** callback for a given sqlite handle.
|
||||
** callback for a given sqlite handle.
|
||||
**
|
||||
** The sqlite.busyHandler member of the sqlite struct contains the busy
|
||||
** callback for the database handle. Each pager opened via the sqlite
|
||||
@@ -890,9 +882,9 @@ struct BusyHandler {
|
||||
|
||||
/*
|
||||
** The following value as a destructor means to use sqlite3DbFree().
|
||||
** The sqlite3DbFree() routine requires two parameters instead of the
|
||||
** one parameter that destructors normally want. So we have to introduce
|
||||
** this magic value that the code knows to handle differently. Any
|
||||
** The sqlite3DbFree() routine requires two parameters instead of the
|
||||
** one parameter that destructors normally want. So we have to introduce
|
||||
** this magic value that the code knows to handle differently. Any
|
||||
** pointer will work here as long as it is distinct from SQLITE_STATIC
|
||||
** and SQLITE_TRANSIENT.
|
||||
*/
|
||||
@@ -919,16 +911,16 @@ struct BusyHandler {
|
||||
int sqlite3_wsd_init(int N, int J);
|
||||
void *sqlite3_wsd_find(void *K, int L);
|
||||
#else
|
||||
#define SQLITE_WSD
|
||||
#define SQLITE_WSD
|
||||
#define GLOBAL(t,v) v
|
||||
#define sqlite3GlobalConfig sqlite3Config
|
||||
#endif
|
||||
|
||||
/*
|
||||
** The following macros are used to suppress compiler warnings and to
|
||||
** make it clear to human readers when a function parameter is deliberately
|
||||
** make it clear to human readers when a function parameter is deliberately
|
||||
** left unused within the body of a function. This usually happens when
|
||||
** a function is called via a function pointer. For example the
|
||||
** a function is called via a function pointer. For example the
|
||||
** implementation of an SQL aggregate step callback may not use the
|
||||
** parameter indicating the number of arguments passed to the aggregate,
|
||||
** if it knows that this is enforced elsewhere.
|
||||
@@ -994,7 +986,7 @@ typedef struct WhereInfo WhereInfo;
|
||||
typedef struct With With;
|
||||
|
||||
/*
|
||||
** Defer sourcing vdbe.h and btree.h until after the "u8" and
|
||||
** Defer sourcing vdbe.h and btree.h until after the "u8" and
|
||||
** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
|
||||
** pointer types (i.e. FuncDef) defined above.
|
||||
*/
|
||||
@@ -1028,7 +1020,7 @@ struct Db {
|
||||
** the Schema for the TEMP databaes (sqlite3.aDb[1]) which is free-standing.
|
||||
** In shared cache mode, a single Schema object can be shared by multiple
|
||||
** Btrees that refer to the same underlying BtShared object.
|
||||
**
|
||||
**
|
||||
** Schema objects are automatically deallocated when the last Btree that
|
||||
** references them is destroyed. The TEMP Schema is manually freed by
|
||||
** sqlite3_close().
|
||||
@@ -1053,7 +1045,7 @@ struct Schema {
|
||||
};
|
||||
|
||||
/*
|
||||
** These macros can be used to test, set, or clear bits in the
|
||||
** These macros can be used to test, set, or clear bits in the
|
||||
** Db.pSchema->flags field.
|
||||
*/
|
||||
#define DbHasProperty(D,I,P) (((D)->aDb[I].pSchema->schemaFlags&(P))==(P))
|
||||
@@ -1117,15 +1109,13 @@ struct LookasideSlot {
|
||||
};
|
||||
|
||||
/*
|
||||
** A hash table for built-in function definitions. (Application-defined
|
||||
** functions use a regular table table from hash.h.)
|
||||
** A hash table for function definitions.
|
||||
**
|
||||
** Hash each FuncDef structure into one of the FuncDefHash.a[] slots.
|
||||
** Collisions are on the FuncDef.u.pHash chain.
|
||||
** Collisions are on the FuncDef.pHash chain.
|
||||
*/
|
||||
#define SQLITE_FUNC_HASH_SZ 23
|
||||
struct FuncDefHash {
|
||||
FuncDef *a[SQLITE_FUNC_HASH_SZ]; /* Hash table for functions */
|
||||
FuncDef *a[23]; /* Hash table for functions */
|
||||
};
|
||||
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
@@ -1218,9 +1208,9 @@ struct sqlite3 {
|
||||
void *pTraceArg; /* Argument to the trace function */
|
||||
void (*xProfile)(void*,const char*,u64); /* Profiling function */
|
||||
void *pProfileArg; /* Argument to profile function */
|
||||
void *pCommitArg; /* Argument to xCommitCallback() */
|
||||
void *pCommitArg; /* Argument to xCommitCallback() */
|
||||
int (*xCommitCallback)(void*); /* Invoked at every commit. */
|
||||
void *pRollbackArg; /* Argument to xRollbackCallback() */
|
||||
void *pRollbackArg; /* Argument to xRollbackCallback() */
|
||||
void (*xRollbackCallback)(void*); /* Invoked at every commit. */
|
||||
void *pUpdateArg;
|
||||
void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64);
|
||||
@@ -1253,7 +1243,7 @@ struct sqlite3 {
|
||||
VTable **aVTrans; /* Virtual tables with open transactions */
|
||||
VTable *pDisconnect; /* Disconnect these in next sqlite3_prepare() */
|
||||
#endif
|
||||
Hash aFunc; /* Hash table of connection functions */
|
||||
FuncDefHash aFunc; /* Hash table of connection functions */
|
||||
Hash aCollSeq; /* All collating sequences */
|
||||
BusyHandler busyHandler; /* Busy callback */
|
||||
Db aDbStatic[2]; /* Static space for the 2 default backends */
|
||||
@@ -1265,8 +1255,8 @@ struct sqlite3 {
|
||||
i64 nDeferredImmCons; /* Net deferred immediate constraints */
|
||||
int *pnBytesFreed; /* If not NULL, increment this in DbFree() */
|
||||
#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
|
||||
/* The following variables are all protected by the STATIC_MASTER
|
||||
** mutex, not by sqlite3.mutex. They are used by code in notify.c.
|
||||
/* The following variables are all protected by the STATIC_MASTER
|
||||
** mutex, not by sqlite3.mutex. They are used by code in notify.c.
|
||||
**
|
||||
** When X.pUnlockConnection==Y, that means that X is waiting for Y to
|
||||
** unlock so that it can proceed.
|
||||
@@ -1380,33 +1370,27 @@ struct sqlite3 {
|
||||
|
||||
/*
|
||||
** Each SQL function is defined by an instance of the following
|
||||
** structure. For global built-in functions (ex: substr(), max(), count())
|
||||
** a pointer to this structure is held in the sqlite3BuiltinFunctions object.
|
||||
** For per-connection application-defined functions, a pointer to this
|
||||
** structure is held in the db->aHash hash table.
|
||||
**
|
||||
** The u.pHash field is used by the global built-ins. The u.pDestructor
|
||||
** field is used by per-connection app-def functions.
|
||||
** structure. A pointer to this structure is stored in the sqlite.aFunc
|
||||
** hash table. When multiple functions have the same name, the hash table
|
||||
** points to a linked list of these structures.
|
||||
*/
|
||||
struct FuncDef {
|
||||
i8 nArg; /* Number of arguments. -1 means unlimited */
|
||||
i16 nArg; /* Number of arguments. -1 means unlimited */
|
||||
u16 funcFlags; /* Some combination of SQLITE_FUNC_* */
|
||||
void *pUserData; /* User data parameter */
|
||||
FuncDef *pNext; /* Next function with same name */
|
||||
void (*xSFunc)(sqlite3_context*,int,sqlite3_value**); /* func or agg-step */
|
||||
void (*xFinalize)(sqlite3_context*); /* Agg finalizer */
|
||||
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 */
|
||||
} u;
|
||||
char *zName; /* SQL name of the function. */
|
||||
FuncDef *pHash; /* Next with a different name but the same hash */
|
||||
FuncDestructor *pDestructor; /* Reference counted destructor function */
|
||||
};
|
||||
|
||||
/*
|
||||
** This structure encapsulates a user-function destructor callback (as
|
||||
** configured using create_function_v2()) and a reference counter. When
|
||||
** create_function_v2() is called to create a function with a destructor,
|
||||
** a single object of this type is allocated. FuncDestructor.nRef is set to
|
||||
** a single object of this type is allocated. FuncDestructor.nRef is set to
|
||||
** the number of FuncDef objects created (either 1 or 3, depending on whether
|
||||
** or not the specified encoding is SQLITE_ANY). The FuncDef.pDestructor
|
||||
** member of each of the new FuncDef objects is set to point to the allocated
|
||||
@@ -1448,10 +1432,10 @@ struct FuncDestructor {
|
||||
** used to create the initializers for the FuncDef structures.
|
||||
**
|
||||
** FUNCTION(zName, nArg, iArg, bNC, xFunc)
|
||||
** Used to create a scalar function definition of a function zName
|
||||
** Used to create a scalar function definition of a function zName
|
||||
** implemented by C function xFunc that accepts nArg arguments. The
|
||||
** value passed as iArg is cast to a (void*) and made available
|
||||
** as the user-data (sqlite3_user_data()) for the function. If
|
||||
** as the user-data (sqlite3_user_data()) for the function. If
|
||||
** argument bNC is true, then the SQLITE_FUNC_NEEDCOLL flag is set.
|
||||
**
|
||||
** VFUNCTION(zName, nArg, iArg, bNC, xFunc)
|
||||
@@ -1470,8 +1454,8 @@ struct FuncDestructor {
|
||||
** FUNCTION().
|
||||
**
|
||||
** LIKEFUNC(zName, nArg, pArg, flags)
|
||||
** Used to create a scalar function definition of a function zName
|
||||
** that accepts nArg arguments and is implemented by a call to C
|
||||
** Used to create a scalar function definition of a function zName
|
||||
** that accepts nArg arguments and is implemented by a call to C
|
||||
** function likeFunc. Argument pArg is cast to a (void *) and made
|
||||
** available as the function user-data (sqlite3_user_data()). The
|
||||
** FuncDef.flags variable is set to the value passed as the flags
|
||||
@@ -1479,28 +1463,28 @@ struct FuncDestructor {
|
||||
*/
|
||||
#define FUNCTION(zName, nArg, iArg, bNC, xFunc) \
|
||||
{nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
|
||||
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0} }
|
||||
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, 0, 0}
|
||||
#define VFUNCTION(zName, nArg, iArg, bNC, xFunc) \
|
||||
{nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
|
||||
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0} }
|
||||
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, 0, 0}
|
||||
#define DFUNCTION(zName, nArg, iArg, bNC, xFunc) \
|
||||
{nArg, SQLITE_FUNC_SLOCHNG|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
|
||||
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0} }
|
||||
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, 0, 0}
|
||||
#define FUNCTION2(zName, nArg, iArg, bNC, xFunc, extraFlags) \
|
||||
{nArg,SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL)|extraFlags,\
|
||||
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0} }
|
||||
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, 0, 0}
|
||||
#define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \
|
||||
{nArg, SQLITE_FUNC_SLOCHNG|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
|
||||
pArg, 0, xFunc, 0, #zName, }
|
||||
pArg, 0, xFunc, 0, #zName, 0, 0}
|
||||
#define LIKEFUNC(zName, nArg, arg, flags) \
|
||||
{nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8|flags, \
|
||||
(void *)arg, 0, likeFunc, 0, #zName, {0} }
|
||||
(void *)arg, 0, likeFunc, 0, #zName, 0, 0}
|
||||
#define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \
|
||||
{nArg, SQLITE_UTF8|(nc*SQLITE_FUNC_NEEDCOLL), \
|
||||
SQLITE_INT_TO_PTR(arg), 0, xStep,xFinal,#zName, {0}}
|
||||
SQLITE_INT_TO_PTR(arg), 0, xStep,xFinal,#zName,0,0}
|
||||
#define AGGREGATE2(zName, nArg, arg, nc, xStep, xFinal, extraFlags) \
|
||||
{nArg, SQLITE_UTF8|(nc*SQLITE_FUNC_NEEDCOLL)|extraFlags, \
|
||||
SQLITE_INT_TO_PTR(arg), 0, xStep,xFinal,#zName, {0}}
|
||||
SQLITE_INT_TO_PTR(arg), 0, xStep,xFinal,#zName,0,0}
|
||||
|
||||
/*
|
||||
** All current savepoints are stored in a linked list starting at
|
||||
@@ -1587,7 +1571,7 @@ struct CollSeq {
|
||||
**
|
||||
** These used to have mnemonic name like 'i' for SQLITE_AFF_INTEGER and
|
||||
** 't' for SQLITE_AFF_TEXT. But we can save a little space and improve
|
||||
** the speed a little by numbering the values consecutively.
|
||||
** the speed a little by numbering the values consecutively.
|
||||
**
|
||||
** But rather than start with 0 or 1, we begin with 'A'. That way,
|
||||
** when multiple affinity types are concatenated into a string and
|
||||
@@ -1606,7 +1590,7 @@ struct CollSeq {
|
||||
|
||||
/*
|
||||
** The SQLITE_AFF_MASK values masks off the significant bits of an
|
||||
** affinity value.
|
||||
** affinity value.
|
||||
*/
|
||||
#define SQLITE_AFF_MASK 0x47
|
||||
|
||||
@@ -1626,20 +1610,20 @@ struct CollSeq {
|
||||
|
||||
/*
|
||||
** An object of this type is created for each virtual table present in
|
||||
** the database schema.
|
||||
** the database schema.
|
||||
**
|
||||
** If the database schema is shared, then there is one instance of this
|
||||
** structure for each database connection (sqlite3*) that uses the shared
|
||||
** schema. This is because each database connection requires its own unique
|
||||
** instance of the sqlite3_vtab* handle used to access the virtual table
|
||||
** implementation. sqlite3_vtab* handles can not be shared between
|
||||
** database connections, even when the rest of the in-memory database
|
||||
** instance of the sqlite3_vtab* handle used to access the virtual table
|
||||
** implementation. sqlite3_vtab* handles can not be shared between
|
||||
** database connections, even when the rest of the in-memory database
|
||||
** schema is shared, as the implementation often stores the database
|
||||
** connection handle passed to it via the xConnect() or xCreate() method
|
||||
** during initialization internally. This database connection handle may
|
||||
** then be used by the virtual table implementation to access real tables
|
||||
** within the database. So that they appear as part of the callers
|
||||
** transaction, these accesses need to be made via the same database
|
||||
** then be used by the virtual table implementation to access real tables
|
||||
** within the database. So that they appear as part of the callers
|
||||
** transaction, these accesses need to be made via the same database
|
||||
** connection as that used to execute SQL operations on the virtual table.
|
||||
**
|
||||
** All VTable objects that correspond to a single table in a shared
|
||||
@@ -1651,19 +1635,19 @@ struct CollSeq {
|
||||
** sqlite3_vtab* handle in the compiled query.
|
||||
**
|
||||
** When an in-memory Table object is deleted (for example when the
|
||||
** schema is being reloaded for some reason), the VTable objects are not
|
||||
** deleted and the sqlite3_vtab* handles are not xDisconnect()ed
|
||||
** schema is being reloaded for some reason), the VTable objects are not
|
||||
** deleted and the sqlite3_vtab* handles are not xDisconnect()ed
|
||||
** immediately. Instead, they are moved from the Table.pVTable list to
|
||||
** another linked list headed by the sqlite3.pDisconnect member of the
|
||||
** corresponding sqlite3 structure. They are then deleted/xDisconnected
|
||||
** corresponding sqlite3 structure. They are then deleted/xDisconnected
|
||||
** next time a statement is prepared using said sqlite3*. This is done
|
||||
** to avoid deadlock issues involving multiple sqlite3.mutex mutexes.
|
||||
** Refer to comments above function sqlite3VtabUnlockList() for an
|
||||
** explanation as to why it is safe to add an entry to an sqlite3.pDisconnect
|
||||
** list without holding the corresponding sqlite3.mutex mutex.
|
||||
**
|
||||
** The memory for objects of this type is always allocated by
|
||||
** sqlite3DbMalloc(), using the connection handle stored in VTable.db as
|
||||
** The memory for objects of this type is always allocated by
|
||||
** sqlite3DbMalloc(), using the connection handle stored in VTable.db as
|
||||
** the first argument.
|
||||
*/
|
||||
struct VTable {
|
||||
@@ -1831,7 +1815,7 @@ struct FKey {
|
||||
** key is set to NULL. CASCADE means that a DELETE or UPDATE of the
|
||||
** referenced table row is propagated into the row that holds the
|
||||
** foreign key.
|
||||
**
|
||||
**
|
||||
** The following symbolic values are used to record which type
|
||||
** of action to take.
|
||||
*/
|
||||
@@ -1852,7 +1836,7 @@ struct FKey {
|
||||
|
||||
/*
|
||||
** An instance of the following structure is passed as the first
|
||||
** argument to sqlite3VdbeKeyCompare and is used to control the
|
||||
** argument to sqlite3VdbeKeyCompare and is used to control the
|
||||
** comparison of the two index keys.
|
||||
**
|
||||
** Note that aSortOrder[] and aColl[] have nField+1 slots. There
|
||||
@@ -1893,7 +1877,7 @@ struct KeyInfo {
|
||||
** The key comparison functions actually return default_rc when they find
|
||||
** an equals comparison. default_rc can be -1, 0, or +1. If there are
|
||||
** multiple entries in the b-tree with the same key (when only looking
|
||||
** at the first pKeyInfo->nFields,) then default_rc can be set to -1 to
|
||||
** at the first pKeyInfo->nFields,) then default_rc can be set to -1 to
|
||||
** cause the search to find the last match, or +1 to cause the search to
|
||||
** find the first match.
|
||||
**
|
||||
@@ -1930,7 +1914,7 @@ struct UnpackedRecord {
|
||||
** In the Table structure describing Ex1, nCol==3 because there are
|
||||
** three columns in the table. In the Index structure describing
|
||||
** Ex2, nColumn==2 since 2 of the 3 columns of Ex1 are indexed.
|
||||
** The value of aiColumn is {2, 0}. aiColumn[0]==2 because the
|
||||
** The value of aiColumn is {2, 0}. aiColumn[0]==2 because the
|
||||
** first column to be indexed (c3) has an index of 2 in Ex1.aCol[].
|
||||
** The second column to be indexed (c1) has an index of 0 in
|
||||
** Ex1.aCol[], hence Ex2.aiColumn[1]==0.
|
||||
@@ -1938,7 +1922,7 @@ struct UnpackedRecord {
|
||||
** The Index.onError field determines whether or not the indexed columns
|
||||
** must be unique and what to do if they are not. When Index.onError=OE_None,
|
||||
** it means this is not a unique index. Otherwise it is a unique index
|
||||
** and the value of Index.onError indicate the which conflict resolution
|
||||
** and the value of Index.onError indicate the which conflict resolution
|
||||
** algorithm to employ whenever an attempt is made to insert a non-unique
|
||||
** element.
|
||||
**
|
||||
@@ -2003,7 +1987,7 @@ struct Index {
|
||||
#define XN_EXPR (-2) /* Indexed column is an expression */
|
||||
|
||||
/*
|
||||
** Each sample stored in the sqlite_stat3 table is represented in memory
|
||||
** Each sample stored in the sqlite_stat3 table is represented in memory
|
||||
** using a structure of this type. See documentation at the top of the
|
||||
** analyze.c source file for additional information.
|
||||
*/
|
||||
@@ -2098,9 +2082,9 @@ typedef int ynVar;
|
||||
** to represent the greater-than-or-equal-to operator in the expression
|
||||
** tree.
|
||||
**
|
||||
** If the expression is an SQL literal (TK_INTEGER, TK_FLOAT, TK_BLOB,
|
||||
** If the expression is an SQL literal (TK_INTEGER, TK_FLOAT, TK_BLOB,
|
||||
** or TK_STRING), then Expr.token contains the text of the SQL literal. If
|
||||
** the expression is a variable (TK_VARIABLE), then Expr.token contains the
|
||||
** the expression is a variable (TK_VARIABLE), then Expr.token contains the
|
||||
** variable name. Finally, if the expression is an SQL function (TK_FUNCTION),
|
||||
** then Expr.token contains the name of the function.
|
||||
**
|
||||
@@ -2111,7 +2095,7 @@ typedef int ynVar;
|
||||
** a CASE expression or an IN expression of the form "<lhs> IN (<y>, <z>...)".
|
||||
** Expr.x.pSelect is used if the expression is a sub-select or an expression of
|
||||
** the form "<lhs> IN (SELECT ...)". If the EP_xIsSelect bit is set in the
|
||||
** Expr.flags mask, then Expr.x.pSelect is valid. Otherwise, Expr.x.pList is
|
||||
** Expr.flags mask, then Expr.x.pSelect is valid. Otherwise, Expr.x.pList is
|
||||
** valid.
|
||||
**
|
||||
** An expression of the form ID or ID.ID refers to a column in a table.
|
||||
@@ -2122,8 +2106,8 @@ typedef int ynVar;
|
||||
** value is also stored in the Expr.iAgg column in the aggregate so that
|
||||
** it can be accessed after all aggregates are computed.
|
||||
**
|
||||
** If the expression is an unbound variable marker (a question mark
|
||||
** character '?' in the original SQL) then the Expr.iTable holds the index
|
||||
** If the expression is an unbound variable marker (a question mark
|
||||
** character '?' in the original SQL) then the Expr.iTable holds the index
|
||||
** number for that variable.
|
||||
**
|
||||
** If the expression is a subquery then Expr.iColumn holds an integer
|
||||
@@ -2162,7 +2146,7 @@ struct Expr {
|
||||
|
||||
/* If the EP_TokenOnly flag is set in the Expr.flags mask, then no
|
||||
** space is allocated for the fields below this point. An attempt to
|
||||
** access them will result in a segfault or malfunction.
|
||||
** access them will result in a segfault or malfunction.
|
||||
*********************************************************************/
|
||||
|
||||
Expr *pLeft; /* Left subnode */
|
||||
@@ -2228,7 +2212,7 @@ struct Expr {
|
||||
#define EP_Propagate (EP_Collate|EP_Subquery) /* Propagate these bits up tree */
|
||||
|
||||
/*
|
||||
** These macros can be used to test, set, or clear bits in the
|
||||
** These macros can be used to test, set, or clear bits in the
|
||||
** Expr.flags field.
|
||||
*/
|
||||
#define ExprHasProperty(E,P) (((E)->flags&(P))!=0)
|
||||
@@ -2247,8 +2231,8 @@ struct Expr {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Macros to determine the number of bytes required by a normal Expr
|
||||
** struct, an Expr struct with the EP_Reduced flag set in Expr.flags
|
||||
** Macros to determine the number of bytes required by a normal Expr
|
||||
** struct, an Expr struct with the EP_Reduced flag set in Expr.flags
|
||||
** and an Expr struct with the EP_TokenOnly flag set.
|
||||
*/
|
||||
#define EXPR_FULLSIZE sizeof(Expr) /* Full size */
|
||||
@@ -2256,7 +2240,7 @@ struct Expr {
|
||||
#define EXPR_TOKENONLYSIZE offsetof(Expr,pLeft) /* Fewer features */
|
||||
|
||||
/*
|
||||
** Flags passed to the sqlite3ExprDup() function. See the header comment
|
||||
** Flags passed to the sqlite3ExprDup() function. See the header comment
|
||||
** above sqlite3ExprDup() for details.
|
||||
*/
|
||||
#define EXPRDUP_REDUCE 0x0001 /* Used reduced-size Expr nodes */
|
||||
@@ -2338,11 +2322,7 @@ 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.
|
||||
*/
|
||||
#ifdef SQLITE_BITMASK_TYPE
|
||||
typedef SQLITE_BITMASK_TYPE Bitmask;
|
||||
#else
|
||||
typedef u64 Bitmask;
|
||||
#endif
|
||||
typedef u64 Bitmask;
|
||||
|
||||
/*
|
||||
** The number of bits in a Bitmask. "BMS" means "BitMask Size".
|
||||
@@ -2459,12 +2439,12 @@ struct SrcList {
|
||||
** pEList corresponds to the result set of a SELECT and is NULL for
|
||||
** other statements.
|
||||
**
|
||||
** NameContexts can be nested. When resolving names, the inner-most
|
||||
** NameContexts can be nested. When resolving names, the inner-most
|
||||
** context is searched first. If no match is found, the next outer
|
||||
** context is checked. If there is still no match, the next context
|
||||
** is checked. This process continues until either a match is found
|
||||
** or all contexts are check. When a match is found, the nRef member of
|
||||
** the context containing the match is incremented.
|
||||
** the context containing the match is incremented.
|
||||
**
|
||||
** Each subquery gets a new NameContext. The pNext field points to the
|
||||
** NameContext in the parent query. Thus the process of scanning the
|
||||
@@ -2487,7 +2467,7 @@ struct NameContext {
|
||||
**
|
||||
** Note: NC_MinMaxAgg must have the same value as SF_MinMaxAgg and
|
||||
** SQLITE_FUNC_MINMAX.
|
||||
**
|
||||
**
|
||||
*/
|
||||
#define NC_AllowAgg 0x0001 /* Aggregate functions are allowed here */
|
||||
#define NC_HasAgg 0x0002 /* One or more aggregate functions seen */
|
||||
@@ -2566,7 +2546,7 @@ struct Select {
|
||||
** by one of the following macros. The "SRT" prefix means "SELECT Result
|
||||
** Type".
|
||||
**
|
||||
** SRT_Union Store results as a key in a temporary index
|
||||
** SRT_Union Store results as a key in a temporary index
|
||||
** identified by pDest->iSDParm.
|
||||
**
|
||||
** SRT_Except Remove results from the temporary index pDest->iSDParm.
|
||||
@@ -2590,7 +2570,7 @@ struct Select {
|
||||
** of the query. This destination implies "LIMIT 1".
|
||||
**
|
||||
** SRT_Set The result must be a single column. Store each
|
||||
** row of result as the key in table pDest->iSDParm.
|
||||
** row of result as the key in table pDest->iSDParm.
|
||||
** Apply the affinity pDest->affSdst before storing
|
||||
** results. Used to implement "IN (SELECT ...)".
|
||||
**
|
||||
@@ -2658,7 +2638,7 @@ struct SelectDest {
|
||||
};
|
||||
|
||||
/*
|
||||
** During code generation of statements that do inserts into AUTOINCREMENT
|
||||
** During code generation of statements that do inserts into AUTOINCREMENT
|
||||
** tables, the following information is attached to the Table.u.autoInc.p
|
||||
** pointer of each autoincrement table to record some side information that
|
||||
** the code generator needs. We have to keep per-table autoincrement
|
||||
@@ -2681,7 +2661,7 @@ struct AutoincInfo {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** At least one instance of the following structure is created for each
|
||||
** At least one instance of the following structure is created for each
|
||||
** trigger that may be fired while parsing an INSERT, UPDATE or DELETE
|
||||
** statement. All such objects are stored in the linked list headed at
|
||||
** Parse.pTriggerPrg and deleted once statement compilation has been
|
||||
@@ -2694,7 +2674,7 @@ struct AutoincInfo {
|
||||
** values for both pTrigger and orconf.
|
||||
**
|
||||
** The TriggerPrg.aColmask[0] variable is set to a mask of old.* columns
|
||||
** accessed (or set to 0 for triggers fired as a result of INSERT
|
||||
** accessed (or set to 0 for triggers fired as a result of INSERT
|
||||
** statements). Similarly, the TriggerPrg.aColmask[1] variable is set to
|
||||
** a mask of new.* columns used by the program.
|
||||
*/
|
||||
@@ -2735,7 +2715,7 @@ struct TriggerPrg {
|
||||
** is constant but the second part is reset at the beginning and end of
|
||||
** each recursion.
|
||||
**
|
||||
** The nTableLock and aTableLock variables are only used if the shared-cache
|
||||
** The nTableLock and aTableLock variables are only used if the shared-cache
|
||||
** feature is enabled (if sqlite3Tsd()->useSharedData is true). They are
|
||||
** used to store the set of table-locks required by the statement being
|
||||
** compiled. Function sqlite3TableLock() is used to add entries to the
|
||||
@@ -2888,10 +2868,10 @@ struct AuthContext {
|
||||
|
||||
/*
|
||||
* Each trigger present in the database schema is stored as an instance of
|
||||
* struct Trigger.
|
||||
* struct Trigger.
|
||||
*
|
||||
* Pointers to instances of struct Trigger are stored in two ways.
|
||||
* 1. In the "trigHash" hash table (part of the sqlite3* that represents the
|
||||
* 1. In the "trigHash" hash table (part of the sqlite3* that represents the
|
||||
* database). This allows Trigger structures to be retrieved by name.
|
||||
* 2. All triggers associated with a single table form a linked list, using the
|
||||
* pNext member of struct Trigger. A pointer to the first element of the
|
||||
@@ -2917,7 +2897,7 @@ struct Trigger {
|
||||
|
||||
/*
|
||||
** A trigger is either a BEFORE or an AFTER trigger. The following constants
|
||||
** determine which.
|
||||
** determine which.
|
||||
**
|
||||
** If there are multiple triggers, you might of some BEFORE and some AFTER.
|
||||
** In that cases, the constants below can be ORed together.
|
||||
@@ -2927,15 +2907,15 @@ struct Trigger {
|
||||
|
||||
/*
|
||||
* An instance of struct TriggerStep is used to store a single SQL statement
|
||||
* that is a part of a trigger-program.
|
||||
* that is a part of a trigger-program.
|
||||
*
|
||||
* Instances of struct TriggerStep are stored in a singly linked list (linked
|
||||
* using the "pNext" member) referenced by the "step_list" member of the
|
||||
* using the "pNext" member) referenced by the "step_list" member of the
|
||||
* associated struct Trigger instance. The first element of the linked list is
|
||||
* the first step of the trigger-program.
|
||||
*
|
||||
*
|
||||
* The "op" member indicates whether this is a "DELETE", "INSERT", "UPDATE" or
|
||||
* "SELECT" statement. The meanings of the other members is determined by the
|
||||
* "SELECT" statement. The meanings of the other members is determined by the
|
||||
* value of "op" as follows:
|
||||
*
|
||||
* (op == TK_INSERT)
|
||||
@@ -2945,7 +2925,7 @@ struct Trigger {
|
||||
* zTarget -> Dequoted name of the table to insert into.
|
||||
* pExprList -> If this is an INSERT INTO ... VALUES ... statement, then
|
||||
* this stores values to be inserted. Otherwise NULL.
|
||||
* pIdList -> If this is an INSERT INTO ... (<column-names>) VALUES ...
|
||||
* pIdList -> If this is an INSERT INTO ... (<column-names>) VALUES ...
|
||||
* statement, then this stores the column-names to be
|
||||
* inserted into.
|
||||
*
|
||||
@@ -2953,7 +2933,7 @@ struct Trigger {
|
||||
* zTarget -> Dequoted name of the table to delete from.
|
||||
* pWhere -> The WHERE clause of the DELETE statement if one is specified.
|
||||
* Otherwise NULL.
|
||||
*
|
||||
*
|
||||
* (op == TK_UPDATE)
|
||||
* zTarget -> Dequoted name of the table to update.
|
||||
* pWhere -> The WHERE clause of the UPDATE statement if one is specified.
|
||||
@@ -2961,7 +2941,7 @@ struct Trigger {
|
||||
* pExprList -> A list of the columns to update and the expressions to update
|
||||
* them to. See sqlite3Update() documentation of "pChanges"
|
||||
* argument.
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct TriggerStep {
|
||||
u8 op; /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT */
|
||||
@@ -2979,7 +2959,7 @@ struct TriggerStep {
|
||||
/*
|
||||
** The following structure contains information used by the sqliteFix...
|
||||
** routines as they walk the parse tree to make database references
|
||||
** explicit.
|
||||
** explicit.
|
||||
*/
|
||||
typedef struct DbFixer DbFixer;
|
||||
struct DbFixer {
|
||||
@@ -3189,15 +3169,6 @@ int sqlite3CantopenError(int);
|
||||
#define SQLITE_CORRUPT_BKPT sqlite3CorruptError(__LINE__)
|
||||
#define SQLITE_MISUSE_BKPT sqlite3MisuseError(__LINE__)
|
||||
#define SQLITE_CANTOPEN_BKPT sqlite3CantopenError(__LINE__)
|
||||
#ifdef SQLITE_DEBUG
|
||||
int sqlite3NomemError(int);
|
||||
int sqlite3IoerrnomemError(int);
|
||||
# define SQLITE_NOMEM_BKPT sqlite3NomemError(__LINE__)
|
||||
# define SQLITE_IOERR_NOMEM_BKPT sqlite3IoerrnomemError(__LINE__)
|
||||
#else
|
||||
# define SQLITE_NOMEM_BKPT SQLITE_NOMEM
|
||||
# define SQLITE_IOERR_NOMEM_BKPT SQLITE_IOERR_NOMEM
|
||||
#endif
|
||||
|
||||
/*
|
||||
** FTS3 and FTS4 both require virtual table support
|
||||
@@ -3254,7 +3225,7 @@ int sqlite3IsIdChar(u8);
|
||||
/*
|
||||
** Internal function prototypes
|
||||
*/
|
||||
int sqlite3StrICmp(const char*,const char*);
|
||||
#define sqlite3StrICmp sqlite3_stricmp
|
||||
int sqlite3Strlen30(const char*);
|
||||
#define sqlite3StrNICmp sqlite3_strnicmp
|
||||
|
||||
@@ -3294,7 +3265,7 @@ int sqlite3HeapNearlyFull(void);
|
||||
#ifdef SQLITE_USE_ALLOCA
|
||||
# define sqlite3StackAllocRaw(D,N) alloca(N)
|
||||
# define sqlite3StackAllocZero(D,N) memset(alloca(N), 0, N)
|
||||
# define sqlite3StackFree(D,P)
|
||||
# define sqlite3StackFree(D,P)
|
||||
#else
|
||||
# define sqlite3StackAllocRaw(D,N) sqlite3DbMallocRaw(D,N)
|
||||
# define sqlite3StackAllocZero(D,N) sqlite3DbMallocZero(D,N)
|
||||
@@ -3601,11 +3572,11 @@ void sqlite3SelectSetName(Select*,const char*);
|
||||
#else
|
||||
# define sqlite3SelectSetName(A,B)
|
||||
#endif
|
||||
void sqlite3InsertBuiltinFuncs(FuncDef*,int);
|
||||
FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,u8,u8);
|
||||
void sqlite3RegisterBuiltinFunctions(void);
|
||||
void sqlite3FuncDefInsert(FuncDefHash*, FuncDef*);
|
||||
FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,int,u8,u8);
|
||||
void sqlite3RegisterBuiltinFunctions(sqlite3*);
|
||||
void sqlite3RegisterDateTimeFunctions(void);
|
||||
void sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3*);
|
||||
void sqlite3RegisterGlobalFunctions(void);
|
||||
int sqlite3SafetyCheckOk(sqlite3*);
|
||||
int sqlite3SafetyCheckSickOrOk(sqlite3*);
|
||||
void sqlite3ChangeCookie(Parse*, int);
|
||||
@@ -3751,7 +3722,7 @@ u8 sqlite3GetBoolean(const char *z,u8);
|
||||
|
||||
const void *sqlite3ValueText(sqlite3_value*, u8);
|
||||
int sqlite3ValueBytes(sqlite3_value*, u8);
|
||||
void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
|
||||
void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
|
||||
void(*)(void*));
|
||||
void sqlite3ValueSetNull(sqlite3_value*);
|
||||
void sqlite3ValueFree(sqlite3_value*);
|
||||
@@ -3766,7 +3737,7 @@ extern const unsigned char sqlite3UpperToLower[];
|
||||
extern const unsigned char sqlite3CtypeMap[];
|
||||
extern const Token sqlite3IntTokens[];
|
||||
extern SQLITE_WSD struct Sqlite3Config sqlite3Config;
|
||||
extern FuncDefHash sqlite3BuiltinFunctions;
|
||||
extern SQLITE_WSD FuncDefHash sqlite3GlobalFunctions;
|
||||
#ifndef SQLITE_OMIT_WSD
|
||||
extern int sqlite3PendingByte;
|
||||
#endif
|
||||
@@ -3811,7 +3782,7 @@ KeyInfo *sqlite3KeyInfoOfIndex(Parse*, Index*);
|
||||
#ifdef SQLITE_DEBUG
|
||||
int sqlite3KeyInfoIsWriteable(KeyInfo*);
|
||||
#endif
|
||||
int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *,
|
||||
int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *,
|
||||
void (*)(sqlite3_context*,int,sqlite3_value **),
|
||||
void (*)(sqlite3_context*,int,sqlite3_value **), void (*)(sqlite3_context*),
|
||||
FuncDestructor *pDestructor
|
||||
@@ -3874,7 +3845,7 @@ void sqlite3AutoLoadExtensions(sqlite3*);
|
||||
# define sqlite3VtabRollback(X)
|
||||
# define sqlite3VtabCommit(X)
|
||||
# define sqlite3VtabInSync(db) 0
|
||||
# define sqlite3VtabLock(X)
|
||||
# define sqlite3VtabLock(X)
|
||||
# define sqlite3VtabUnlock(X)
|
||||
# define sqlite3VtabUnlockList(X)
|
||||
# define sqlite3VtabSavepoint(X, Y, Z) SQLITE_OK
|
||||
@@ -3932,7 +3903,7 @@ const char *sqlite3JournalModename(int);
|
||||
** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign
|
||||
** key functionality is available. If OMIT_TRIGGER is defined but
|
||||
** OMIT_FOREIGN_KEY is not, only some of the functions are no-oped. In
|
||||
** this case foreign keys are parsed, but no other functionality is
|
||||
** this case foreign keys are parsed, but no other functionality is
|
||||
** provided (enforcement of FK constraints requires the triggers sub-system).
|
||||
*/
|
||||
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
|
||||
@@ -4036,7 +4007,7 @@ void sqlite3Put4byte(u8*, u32);
|
||||
/*
|
||||
** If the SQLITE_ENABLE IOTRACE exists then the global variable
|
||||
** sqlite3IoTrace is a pointer to a printf-like routine used to
|
||||
** print I/O tracing messages.
|
||||
** print I/O tracing messages.
|
||||
*/
|
||||
#ifdef SQLITE_ENABLE_IOTRACE
|
||||
# define IOTRACE(A) if( sqlite3IoTrace ){ sqlite3IoTrace A; }
|
||||
@@ -4070,7 +4041,7 @@ SQLITE_API SQLITE_EXTERN void (SQLITE_CDECL *sqlite3IoTrace)(const char*,...);
|
||||
** that allocations that might have been satisfied by lookaside are not
|
||||
** passed back to non-lookaside free() routines. Asserts such as the
|
||||
** example above are placed on the non-lookaside free() routines to verify
|
||||
** this constraint.
|
||||
** this constraint.
|
||||
**
|
||||
** All of this is no-op for a production build. It only comes into
|
||||
** play when the SQLITE_MEMDEBUG compile-time option is used.
|
||||
|
||||
@@ -101,7 +101,7 @@ static int sqlite3_get_table_cb(void *pArg, int nCol, char **argv, char **colv){
|
||||
return 0;
|
||||
|
||||
malloc_failed:
|
||||
p->rc = SQLITE_NOMEM_BKPT;
|
||||
p->rc = SQLITE_NOMEM;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ int sqlite3_get_table(
|
||||
res.azResult = sqlite3_malloc64(sizeof(char*)*res.nAlloc );
|
||||
if( res.azResult==0 ){
|
||||
db->errCode = SQLITE_NOMEM;
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
res.azResult[0] = 0;
|
||||
rc = sqlite3_exec(db, zSql, sqlite3_get_table_cb, &res, pzErrMsg);
|
||||
@@ -171,7 +171,7 @@ int sqlite3_get_table(
|
||||
if( azNew==0 ){
|
||||
sqlite3_free_table(&res.azResult[1]);
|
||||
db->errCode = SQLITE_NOMEM;
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
res.azResult = azNew;
|
||||
}
|
||||
|
||||
@@ -3154,7 +3154,7 @@ static int test_bind_zeroblob64(
|
||||
){
|
||||
sqlite3_stmt *pStmt;
|
||||
int idx;
|
||||
Tcl_WideInt n;
|
||||
i64 n;
|
||||
int rc;
|
||||
|
||||
if( objc!=4 ){
|
||||
|
||||
@@ -105,7 +105,7 @@ static int test_blob_open(
|
||||
const char *zDb;
|
||||
const char *zTable;
|
||||
const char *zColumn;
|
||||
Tcl_WideInt iRowid;
|
||||
sqlite_int64 iRowid;
|
||||
int flags;
|
||||
const char *zVarname;
|
||||
int nVarname;
|
||||
|
||||
@@ -496,9 +496,9 @@ static int fstreeFilter(
|
||||
|
||||
#if SQLITE_OS_WIN
|
||||
zRoot = sqlite3_mprintf("%s%c", getenv("SystemDrive"), '/');
|
||||
nRoot = sqlite3Strlen30(zRoot);
|
||||
nRoot = strlen(zRoot);
|
||||
zPrefix = sqlite3_mprintf("%s", getenv("SystemDrive"));
|
||||
nPrefix = sqlite3Strlen30(zPrefix);
|
||||
nPrefix = strlen(zPrefix);
|
||||
#else
|
||||
zRoot = "/";
|
||||
nRoot = 1;
|
||||
|
||||
@@ -63,7 +63,7 @@ int sqlite3ThreadCreate(
|
||||
|
||||
*ppThread = 0;
|
||||
p = sqlite3Malloc(sizeof(*p));
|
||||
if( p==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( p==0 ) return SQLITE_NOMEM;
|
||||
memset(p, 0, sizeof(*p));
|
||||
p->xTask = xTask;
|
||||
p->pIn = pIn;
|
||||
@@ -89,7 +89,7 @@ int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
|
||||
int rc;
|
||||
|
||||
assert( ppOut!=0 );
|
||||
if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT;
|
||||
if( NEVER(p==0) ) return SQLITE_NOMEM;
|
||||
if( p->done ){
|
||||
*ppOut = p->pOut;
|
||||
rc = SQLITE_OK;
|
||||
@@ -154,7 +154,7 @@ int sqlite3ThreadCreate(
|
||||
assert( xTask!=0 );
|
||||
*ppThread = 0;
|
||||
p = sqlite3Malloc(sizeof(*p));
|
||||
if( p==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( p==0 ) return SQLITE_NOMEM;
|
||||
/* If the SQLITE_TESTCTRL_FAULT_INSTALL callback is registered to a
|
||||
** function that returns SQLITE_ERROR when passed the argument 200, that
|
||||
** forces worker threads to run sequentially and deterministically
|
||||
@@ -186,7 +186,7 @@ int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
|
||||
BOOL bRc;
|
||||
|
||||
assert( ppOut!=0 );
|
||||
if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT;
|
||||
if( NEVER(p==0) ) return SQLITE_NOMEM;
|
||||
if( p->xTask==0 ){
|
||||
/* assert( p->id==GetCurrentThreadId() ); */
|
||||
rc = WAIT_OBJECT_0;
|
||||
@@ -234,7 +234,7 @@ int sqlite3ThreadCreate(
|
||||
assert( xTask!=0 );
|
||||
*ppThread = 0;
|
||||
p = sqlite3Malloc(sizeof(*p));
|
||||
if( p==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( p==0 ) return SQLITE_NOMEM;
|
||||
if( (SQLITE_PTR_TO_INT(p)/17)&1 ){
|
||||
p->xTask = xTask;
|
||||
p->pIn = pIn;
|
||||
@@ -250,7 +250,7 @@ int sqlite3ThreadCreate(
|
||||
int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
|
||||
|
||||
assert( ppOut!=0 );
|
||||
if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT;
|
||||
if( NEVER(p==0) ) return SQLITE_NOMEM;
|
||||
if( p->xTask ){
|
||||
*ppOut = p->xTask(p->pIn);
|
||||
}else{
|
||||
@@ -261,7 +261,7 @@ int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
|
||||
#if defined(SQLITE_TEST)
|
||||
{
|
||||
void *pTstAlloc = sqlite3Malloc(10);
|
||||
if (!pTstAlloc) return SQLITE_NOMEM_BKPT;
|
||||
if (!pTstAlloc) return SQLITE_NOMEM;
|
||||
sqlite3_free(pTstAlloc);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -285,7 +285,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
|
||||
case CC_BANG: {
|
||||
if( z[1]!='=' ){
|
||||
*tokenType = TK_ILLEGAL;
|
||||
return 1;
|
||||
return 2;
|
||||
}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);
|
||||
}
|
||||
case CC_X: {
|
||||
#ifndef SQLITE_OMIT_BLOB_LITERAL
|
||||
case CC_X: {
|
||||
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;
|
||||
@@ -495,7 +495,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
|
||||
pEngine = sqlite3ParserAlloc(sqlite3Malloc);
|
||||
if( pEngine==0 ){
|
||||
sqlite3OomFault(db);
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
assert( pParse->pNewTable==0 );
|
||||
assert( pParse->pNewTrigger==0 );
|
||||
@@ -523,17 +523,18 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
if( tokenType==TK_SEMI ) pParse->zTail = &zSql[i];
|
||||
sqlite3Parser(pEngine, tokenType, pParse->sLastToken, pParse);
|
||||
lastTokenParsed = tokenType;
|
||||
if( pParse->rc!=SQLITE_OK || db->mallocFailed ) break;
|
||||
}
|
||||
}
|
||||
assert( nErr==0 );
|
||||
pParse->zTail = &zSql[i];
|
||||
if( pParse->rc==SQLITE_OK && db->mallocFailed==0 ){
|
||||
assert( zSql[i]==0 );
|
||||
if( lastTokenParsed!=TK_SEMI ){
|
||||
sqlite3Parser(pEngine, TK_SEMI, pParse->sLastToken, pParse);
|
||||
pParse->zTail = &zSql[i];
|
||||
}
|
||||
if( pParse->rc==SQLITE_OK && db->mallocFailed==0 ){
|
||||
sqlite3Parser(pEngine, 0, pParse->sLastToken, pParse);
|
||||
@@ -548,7 +549,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
|
||||
#endif /* YYDEBUG */
|
||||
sqlite3ParserFree(pEngine, sqlite3_free);
|
||||
if( db->mallocFailed ){
|
||||
pParse->rc = SQLITE_NOMEM_BKPT;
|
||||
pParse->rc = SQLITE_NOMEM;
|
||||
}
|
||||
if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){
|
||||
pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc));
|
||||
|
||||
@@ -231,7 +231,7 @@ SQLITE_NOINLINE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){
|
||||
rc = sqlite3VdbeMemMakeWriteable(pMem);
|
||||
if( rc!=SQLITE_OK ){
|
||||
assert( rc==SQLITE_NOMEM );
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
zIn = (u8*)pMem->z;
|
||||
zTerm = &zIn[pMem->n&~1];
|
||||
@@ -273,7 +273,7 @@ SQLITE_NOINLINE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){
|
||||
zTerm = &zIn[pMem->n];
|
||||
zOut = sqlite3DbMallocRaw(pMem->db, len);
|
||||
if( !zOut ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
z = zOut;
|
||||
|
||||
|
||||
@@ -256,25 +256,16 @@ void sqlite3TokenInit(Token *p, char *z){
|
||||
** independence" that SQLite uses internally when comparing identifiers.
|
||||
*/
|
||||
int sqlite3_stricmp(const char *zLeft, const char *zRight){
|
||||
register unsigned char *a, *b;
|
||||
if( zLeft==0 ){
|
||||
return zRight ? -1 : 0;
|
||||
}else if( zRight==0 ){
|
||||
return 1;
|
||||
}
|
||||
return sqlite3StrICmp(zLeft, zRight);
|
||||
}
|
||||
int sqlite3StrICmp(const char *zLeft, const char *zRight){
|
||||
unsigned char *a, *b;
|
||||
int c;
|
||||
a = (unsigned char *)zLeft;
|
||||
b = (unsigned char *)zRight;
|
||||
for(;;){
|
||||
c = (int)UpperToLower[*a] - (int)UpperToLower[*b];
|
||||
if( c || *a==0 ) break;
|
||||
a++;
|
||||
b++;
|
||||
}
|
||||
return c;
|
||||
while( *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
|
||||
return UpperToLower[*a] - UpperToLower[*b];
|
||||
}
|
||||
int sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){
|
||||
register unsigned char *a, *b;
|
||||
@@ -1116,12 +1107,10 @@ 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(SQLITE_DISABLE_INTRINSIC) \
|
||||
&& defined(__GNUC__) && GCC_VERSION>=4003000
|
||||
#elif SQLITE_BYTEORDER==1234 && defined(__GNUC__) && GCC_VERSION>=4003000
|
||||
u32 x = __builtin_bswap32(v);
|
||||
memcpy(p,&x,4);
|
||||
#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \
|
||||
&& defined(_MSC_VER) && _MSC_VER>=1300
|
||||
#elif SQLITE_BYTEORDER==1234 && defined(_MSC_VER) && _MSC_VER>=1300
|
||||
u32 x = _byteswap_ulong(v);
|
||||
memcpy(p,&x,4);
|
||||
#else
|
||||
|
||||
@@ -38,7 +38,7 @@ static int execSql(sqlite3 *db, char **pzErrMsg, const char *zSql){
|
||||
sqlite3_stmt *pStmt;
|
||||
VVA_ONLY( int rc; )
|
||||
if( !zSql ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
if( SQLITE_OK!=sqlite3_prepare(db, zSql, -1, &pStmt, 0) ){
|
||||
sqlite3SetString(pzErrMsg, db, sqlite3_errmsg(db));
|
||||
@@ -219,7 +219,7 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){
|
||||
|| (!isMemDb && sqlite3BtreeSetPageSize(pTemp, db->nextPagesize, nRes, 0))
|
||||
|| NEVER(db->mallocFailed)
|
||||
){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto end_of_vacuum;
|
||||
}
|
||||
|
||||
|
||||
@@ -627,11 +627,7 @@ int sqlite3VdbeExec(
|
||||
}
|
||||
sqlite3EndBenignMalloc();
|
||||
#endif
|
||||
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 );
|
||||
|
||||
for(pOp=&aOp[p->pc]; rc==SQLITE_OK; pOp++){
|
||||
assert( pOp>=aOp && pOp<&aOp[p->nOp]);
|
||||
#ifdef VDBE_PROFILE
|
||||
start = sqlite3Hwtime();
|
||||
@@ -778,7 +774,7 @@ check_for_interrupt:
|
||||
nProgressLimit = nVmStep + db->nProgressOps - (nVmStep%db->nProgressOps);
|
||||
if( db->xProgress(db->pProgressArg) ){
|
||||
rc = SQLITE_INTERRUPT;
|
||||
goto abort_due_to_error;
|
||||
goto vdbe_error_halt;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1057,10 +1053,7 @@ 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 ){
|
||||
assert( rc==SQLITE_TOOBIG ); /* This is the only possible error here */
|
||||
goto too_big;
|
||||
}
|
||||
if( rc==SQLITE_TOOBIG ) goto too_big;
|
||||
if( SQLITE_OK!=sqlite3VdbeChangeEncoding(pOut, encoding) ) goto no_mem;
|
||||
assert( pOut->szMalloc>0 && pOut->zMalloc==pOut->z );
|
||||
assert( VdbeMemDynamic(pOut)==0 );
|
||||
@@ -1326,7 +1319,7 @@ case OP_ResultRow: {
|
||||
&& db->xProgress(db->pProgressArg)!=0
|
||||
){
|
||||
rc = SQLITE_INTERRUPT;
|
||||
goto abort_due_to_error;
|
||||
goto vdbe_error_halt;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1336,7 +1329,7 @@ case OP_ResultRow: {
|
||||
if( SQLITE_OK!=(rc = sqlite3VdbeCheckFk(p, 0)) ){
|
||||
assert( db->flags&SQLITE_CountRows );
|
||||
assert( p->usesStmtJournal );
|
||||
goto abort_due_to_error;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If the SQLITE_CountRows flag is set in sqlite3.flags mask, then
|
||||
@@ -1356,7 +1349,9 @@ case OP_ResultRow: {
|
||||
*/
|
||||
assert( p->iStatement==0 || db->flags&SQLITE_CountRows );
|
||||
rc = sqlite3VdbeCloseStatement(p, SAVEPOINT_RELEASE);
|
||||
assert( rc==SQLITE_OK );
|
||||
if( NEVER(rc!=SQLITE_OK) ){
|
||||
break;
|
||||
}
|
||||
|
||||
/* Invalidate all ephemeral cursor row caches */
|
||||
p->cacheCtr = (p->cacheCtr + 2)|1;
|
||||
@@ -1679,8 +1674,7 @@ case OP_Function: {
|
||||
sqlite3VdbeError(p, "%s", sqlite3_value_text(pCtx->pOut));
|
||||
rc = pCtx->isError;
|
||||
}
|
||||
sqlite3VdbeDeleteAuxData(db, &p->pAuxData, pCtx->iOp, pOp->p1);
|
||||
if( rc ) goto abort_due_to_error;
|
||||
sqlite3VdbeDeleteAuxData(p, pCtx->iOp, pOp->p1);
|
||||
}
|
||||
|
||||
/* Copy the result of the function into register P3 */
|
||||
@@ -1864,7 +1858,6 @@ 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 */
|
||||
@@ -2474,7 +2467,7 @@ case OP_Column: {
|
||||
*/
|
||||
if( offset > 98307 || offset > pC->payloadSize ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto abort_due_to_error;
|
||||
goto op_column_error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2499,7 +2492,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 abort_due_to_error;
|
||||
if( rc!=SQLITE_OK ) goto op_column_error;
|
||||
zData = (u8*)sMem.z;
|
||||
}else{
|
||||
zData = pC->aRow;
|
||||
@@ -2535,7 +2528,7 @@ case OP_Column: {
|
||||
|| (offset64 > pC->payloadSize)
|
||||
){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto abort_due_to_error;
|
||||
goto op_column_error;
|
||||
}
|
||||
}else{
|
||||
t = 0;
|
||||
@@ -2608,13 +2601,15 @@ case OP_Column: {
|
||||
}else{
|
||||
rc = sqlite3VdbeMemFromBtree(pCrsr, aOffset[p2], len, !pC->isTable,
|
||||
pDest);
|
||||
if( rc!=SQLITE_OK ) goto abort_due_to_error;
|
||||
sqlite3VdbeSerialGet((const u8*)pDest->z, t, pDest);
|
||||
pDest->flags &= ~MEM_Ephem;
|
||||
if( rc==SQLITE_OK ){
|
||||
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;
|
||||
@@ -2819,7 +2814,6 @@ 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;
|
||||
@@ -2997,7 +2991,6 @@ case OP_Savepoint: {
|
||||
}
|
||||
}
|
||||
}
|
||||
if( rc ) goto abort_due_to_error;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -3034,7 +3027,7 @@ case OP_AutoCommit: {
|
||||
sqlite3VdbeError(p, "cannot commit transaction - "
|
||||
"SQL statements in progress");
|
||||
rc = SQLITE_BUSY;
|
||||
goto abort_due_to_error;
|
||||
break;
|
||||
}else if( (rc = sqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){
|
||||
goto vdbe_return;
|
||||
}else{
|
||||
@@ -3061,7 +3054,6 @@ case OP_AutoCommit: {
|
||||
"cannot commit - no transaction is active"));
|
||||
|
||||
rc = SQLITE_ERROR;
|
||||
goto abort_due_to_error;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -3184,7 +3176,6 @@ case OP_Transaction: {
|
||||
p->expired = 1;
|
||||
rc = SQLITE_SCHEMA;
|
||||
}
|
||||
if( rc ) goto abort_due_to_error;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3254,7 +3245,6 @@ case OP_SetCookie: {
|
||||
sqlite3ExpirePreparedStatements(db);
|
||||
p->expired = 0;
|
||||
}
|
||||
if( rc ) goto abort_due_to_error;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3352,7 +3342,7 @@ case OP_OpenWrite:
|
||||
|
||||
if( p->expired ){
|
||||
rc = SQLITE_ABORT_ROLLBACK;
|
||||
goto abort_due_to_error;
|
||||
break;
|
||||
}
|
||||
|
||||
nField = 0;
|
||||
@@ -3386,7 +3376,10 @@ 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. */
|
||||
assert( p2>=2 );
|
||||
if( NEVER(p2<2) ) {
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto abort_due_to_error;
|
||||
}
|
||||
}
|
||||
if( pOp->p4type==P4_KEYINFO ){
|
||||
pKeyInfo = pOp->p4.pKeyInfo;
|
||||
@@ -3424,7 +3417,6 @@ open_cursor_set_hints:
|
||||
#endif
|
||||
sqlite3BtreeCursorHintFlags(pCur->uc.pCursor,
|
||||
(pOp->p5 & (OPFLAG_BULKCSR|OPFLAG_SEEKEQ)));
|
||||
if( rc ) goto abort_due_to_error;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3501,7 +3493,6 @@ case OP_OpenEphemeral: {
|
||||
pCx->isTable = 1;
|
||||
}
|
||||
}
|
||||
if( rc ) goto abort_due_to_error;
|
||||
pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);
|
||||
break;
|
||||
}
|
||||
@@ -3527,7 +3518,6 @@ 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;
|
||||
}
|
||||
|
||||
@@ -3990,7 +3980,7 @@ case OP_Found: { /* jump, in3 */
|
||||
rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, pIdxKey, 0, 0, &res);
|
||||
sqlite3DbFree(db, pFree);
|
||||
if( rc!=SQLITE_OK ){
|
||||
goto abort_due_to_error;
|
||||
break;
|
||||
}
|
||||
pC->seekResult = res;
|
||||
alreadyExists = (res==0);
|
||||
@@ -4062,7 +4052,6 @@ case OP_NotExists: { /* jump, in3 */
|
||||
goto jump_to_p2;
|
||||
}
|
||||
}
|
||||
if( rc ) goto abort_due_to_error;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4205,8 +4194,7 @@ case OP_NewRowid: { /* out2 */
|
||||
0, &res))==SQLITE_OK)
|
||||
&& (res==0)
|
||||
&& (++cnt<100));
|
||||
if( rc ) goto abort_due_to_error;
|
||||
if( res==0 ){
|
||||
if( rc==SQLITE_OK && res==0 ){
|
||||
rc = SQLITE_FULL; /* IMP: R-38219-53002 */
|
||||
goto abort_due_to_error;
|
||||
}
|
||||
@@ -4320,8 +4308,7 @@ case OP_InsertInt: {
|
||||
pC->cacheStatus = CACHE_STALE;
|
||||
|
||||
/* Invoke the update-hook if required. */
|
||||
if( rc ) goto abort_due_to_error;
|
||||
if( db->xUpdateCallback && pOp->p4.z ){
|
||||
if( rc==SQLITE_OK && db->xUpdateCallback && pOp->p4.z ){
|
||||
zDb = db->aDb[pC->iDb].zName;
|
||||
zTbl = pOp->p4.z;
|
||||
op = ((pOp->p5 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT);
|
||||
@@ -4411,8 +4398,7 @@ case OP_Delete: {
|
||||
pC->cacheStatus = CACHE_STALE;
|
||||
|
||||
/* Invoke the update-hook if required. */
|
||||
if( rc ) goto abort_due_to_error;
|
||||
if( hasUpdateCallback ){
|
||||
if( rc==SQLITE_OK && hasUpdateCallback ){
|
||||
db->xUpdateCallback(db->pUpdateArg, SQLITE_DELETE,
|
||||
db->aDb[pC->iDb].zName, pOp->p4.z, pC->movetoTarget);
|
||||
assert( pC->iDb>=0 );
|
||||
@@ -4461,7 +4447,6 @@ 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;
|
||||
};
|
||||
@@ -4487,7 +4472,6 @@ 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;
|
||||
}
|
||||
@@ -4576,7 +4560,6 @@ 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);
|
||||
@@ -4617,7 +4600,6 @@ 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 );
|
||||
@@ -4688,7 +4670,6 @@ 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;
|
||||
@@ -4753,7 +4734,6 @@ 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);
|
||||
@@ -4866,7 +4846,6 @@ 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]++;
|
||||
@@ -4917,19 +4896,19 @@ case OP_IdxInsert: { /* in2 */
|
||||
assert( pC->eCurType==CURTYPE_BTREE || pOp->opcode==OP_SorterInsert );
|
||||
assert( pC->isTable==0 );
|
||||
rc = ExpandBlob(pIn2);
|
||||
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==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;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4960,10 +4939,8 @@ case OP_IdxDelete: {
|
||||
r.default_rc = 0;
|
||||
r.aMem = &aMem[pOp->p2];
|
||||
rc = sqlite3BtreeMovetoUnpacked(pCrsr, &r, 0, 0, &res);
|
||||
if( rc ) goto abort_due_to_error;
|
||||
if( res==0 ){
|
||||
if( rc==SQLITE_OK && res==0 ){
|
||||
rc = sqlite3BtreeDelete(pCrsr, BTREE_AUXDELETE);
|
||||
if( rc ) goto abort_due_to_error;
|
||||
}
|
||||
assert( pC->deferredMoveto==0 );
|
||||
pC->cacheStatus = CACHE_STALE;
|
||||
@@ -5138,7 +5115,6 @@ case OP_IdxGE: { /* jump */
|
||||
res++;
|
||||
}
|
||||
VdbeBranchTaken(res>0,2);
|
||||
if( rc ) goto abort_due_to_error;
|
||||
if( res>0 ) goto jump_to_p2;
|
||||
break;
|
||||
}
|
||||
@@ -5174,7 +5150,6 @@ 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) );
|
||||
@@ -5182,9 +5157,8 @@ 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( iMoved!=0 ){
|
||||
if( rc==SQLITE_OK && iMoved!=0 ){
|
||||
sqlite3RootPageMoved(db, iDb, iMoved, pOp->p1);
|
||||
/* All OP_Destroy operations occur on the same btree */
|
||||
assert( resetSchemaOnFault==0 || resetSchemaOnFault==iDb+1 );
|
||||
@@ -5230,7 +5204,6 @@ case OP_Clear: {
|
||||
aMem[pOp->p3].u.i += nChange;
|
||||
}
|
||||
}
|
||||
if( rc ) goto abort_due_to_error;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -5254,7 +5227,6 @@ case OP_ResetSorter: {
|
||||
assert( pC->eCurType==CURTYPE_BTREE );
|
||||
assert( pC->isEphemeral );
|
||||
rc = sqlite3BtreeClearTableOfCursor(pC->uc.pCursor);
|
||||
if( rc ) goto abort_due_to_error;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -5303,7 +5275,6 @@ 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;
|
||||
}
|
||||
@@ -5344,7 +5315,7 @@ case OP_ParseSchema: {
|
||||
"SELECT name, rootpage, sql FROM '%q'.%s WHERE %s ORDER BY rowid",
|
||||
db->aDb[iDb].zName, zMaster, pOp->p4.z);
|
||||
if( zSql==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
assert( db->init.busy==0 );
|
||||
db->init.busy = 1;
|
||||
@@ -5356,12 +5327,9 @@ case OP_ParseSchema: {
|
||||
db->init.busy = 0;
|
||||
}
|
||||
}
|
||||
if( rc ){
|
||||
sqlite3ResetAllSchemasOfConnection(db);
|
||||
if( rc==SQLITE_NOMEM ){
|
||||
goto no_mem;
|
||||
}
|
||||
goto abort_due_to_error;
|
||||
if( rc ) sqlite3ResetAllSchemasOfConnection(db);
|
||||
if( rc==SQLITE_NOMEM ){
|
||||
goto no_mem;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -5376,7 +5344,6 @@ 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) */
|
||||
@@ -5636,7 +5603,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");
|
||||
goto abort_due_to_error;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Register pRt is used to store the memory required to save the state
|
||||
@@ -5696,9 +5663,6 @@ 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];
|
||||
@@ -6003,7 +5967,6 @@ case OP_AggStep: {
|
||||
rc = pCtx->isError;
|
||||
}
|
||||
sqlite3VdbeMemRelease(&t);
|
||||
if( rc ) goto abort_due_to_error;
|
||||
}else{
|
||||
assert( t.flags==MEM_Null );
|
||||
}
|
||||
@@ -6036,7 +5999,6 @@ 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);
|
||||
@@ -6072,8 +6034,7 @@ case OP_Checkpoint: {
|
||||
|| pOp->p2==SQLITE_CHECKPOINT_TRUNCATE
|
||||
);
|
||||
rc = sqlite3Checkpoint(db, pOp->p1, pOp->p2, &aRes[1], &aRes[2]);
|
||||
if( rc ){
|
||||
if( rc!=SQLITE_BUSY ) goto abort_due_to_error;
|
||||
if( rc==SQLITE_BUSY ){
|
||||
rc = SQLITE_OK;
|
||||
aRes[0] = 1;
|
||||
}
|
||||
@@ -6146,7 +6107,7 @@ case OP_JournalMode: { /* out2 */
|
||||
"cannot change %s wal mode from within a transaction",
|
||||
(eNew==PAGER_JOURNALMODE_WAL ? "into" : "out of")
|
||||
);
|
||||
goto abort_due_to_error;
|
||||
break;
|
||||
}else{
|
||||
|
||||
if( eOld==PAGER_JOURNALMODE_WAL ){
|
||||
@@ -6176,7 +6137,9 @@ 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;
|
||||
@@ -6184,7 +6147,6 @@ 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 */
|
||||
@@ -6199,7 +6161,6 @@ 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
|
||||
@@ -6220,8 +6181,7 @@ case OP_IncrVacuum: { /* jump */
|
||||
pBt = db->aDb[pOp->p1].pBt;
|
||||
rc = sqlite3BtreeIncrVacuum(pBt);
|
||||
VdbeBranchTaken(rc==SQLITE_DONE,2);
|
||||
if( rc ){
|
||||
if( rc!=SQLITE_DONE ) goto abort_due_to_error;
|
||||
if( rc==SQLITE_DONE ){
|
||||
rc = SQLITE_OK;
|
||||
goto jump_to_p2;
|
||||
}
|
||||
@@ -6272,12 +6232,9 @@ case OP_TableLock: {
|
||||
assert( DbMaskTest(p->btreeMask, p1) );
|
||||
assert( isWriteLock==0 || isWriteLock==1 );
|
||||
rc = sqlite3BtreeLockTable(db->aDb[p1].pBt, pOp->p2, isWriteLock);
|
||||
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;
|
||||
if( (rc&0xFF)==SQLITE_LOCKED ){
|
||||
const char *z = pOp->p4.z;
|
||||
sqlite3VdbeError(p, "database table is locked: %s", z);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -6299,7 +6256,6 @@ 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 */
|
||||
@@ -6328,7 +6284,6 @@ 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 */
|
||||
@@ -6343,7 +6298,6 @@ 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 */
|
||||
@@ -6367,25 +6321,25 @@ case OP_VOpen: {
|
||||
pVtab = pOp->p4.pVtab->pVtab;
|
||||
if( pVtab==0 || NEVER(pVtab->pModule==0) ){
|
||||
rc = SQLITE_LOCKED;
|
||||
goto abort_due_to_error;
|
||||
break;
|
||||
}
|
||||
pModule = pVtab->pModule;
|
||||
rc = pModule->xOpen(pVtab, &pVCur);
|
||||
sqlite3VtabImportErrmsg(p, pVtab);
|
||||
if( rc ) goto abort_due_to_error;
|
||||
if( SQLITE_OK==rc ){
|
||||
/* Initialize sqlite3_vtab_cursor base class */
|
||||
pVCur->pVtab = pVtab;
|
||||
|
||||
/* 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;
|
||||
/* 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;
|
||||
}
|
||||
@@ -6447,8 +6401,9 @@ case OP_VFilter: { /* jump */
|
||||
}
|
||||
rc = pModule->xFilter(pVCur, iQuery, pOp->p4.z, nArg, apArg);
|
||||
sqlite3VtabImportErrmsg(p, pVtab);
|
||||
if( rc ) goto abort_due_to_error;
|
||||
res = pModule->xEof(pVCur);
|
||||
if( rc==SQLITE_OK ){
|
||||
res = pModule->xEof(pVCur);
|
||||
}
|
||||
pCur->nullRow = 0;
|
||||
VdbeBranchTaken(res!=0,2);
|
||||
if( res ) goto jump_to_p2;
|
||||
@@ -6497,7 +6452,6 @@ case OP_VColumn: {
|
||||
if( sqlite3VdbeMemTooBig(pDest) ){
|
||||
goto too_big;
|
||||
}
|
||||
if( rc ) goto abort_due_to_error;
|
||||
break;
|
||||
}
|
||||
#endif /* SQLITE_OMIT_VIRTUALTABLE */
|
||||
@@ -6533,8 +6487,9 @@ case OP_VNext: { /* jump */
|
||||
*/
|
||||
rc = pModule->xNext(pCur->uc.pVCur);
|
||||
sqlite3VtabImportErrmsg(p, pVtab);
|
||||
if( rc ) goto abort_due_to_error;
|
||||
res = pModule->xEof(pCur->uc.pVCur);
|
||||
if( rc==SQLITE_OK ){
|
||||
res = pModule->xEof(pCur->uc.pVCur);
|
||||
}
|
||||
VdbeBranchTaken(!res,2);
|
||||
if( !res ){
|
||||
/* If there is data, jump to P2 */
|
||||
@@ -6566,11 +6521,11 @@ case OP_VRename: {
|
||||
testcase( pName->enc==SQLITE_UTF16BE );
|
||||
testcase( pName->enc==SQLITE_UTF16LE );
|
||||
rc = sqlite3VdbeChangeEncoding(pName, SQLITE_UTF8);
|
||||
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;
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = pVtab->pModule->xRename(pVtab, pName->z);
|
||||
sqlite3VtabImportErrmsg(p, pVtab);
|
||||
p->expired = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -6619,7 +6574,7 @@ case OP_VUpdate: {
|
||||
pVtab = pOp->p4.pVtab->pVtab;
|
||||
if( pVtab==0 || NEVER(pVtab->pModule==0) ){
|
||||
rc = SQLITE_LOCKED;
|
||||
goto abort_due_to_error;
|
||||
break;
|
||||
}
|
||||
pModule = pVtab->pModule;
|
||||
nArg = pOp->p2;
|
||||
@@ -6651,7 +6606,6 @@ case OP_VUpdate: {
|
||||
}else{
|
||||
p->nChange++;
|
||||
}
|
||||
if( rc ) goto abort_due_to_error;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -6823,12 +6777,8 @@ 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.
|
||||
*/
|
||||
abort_due_to_error:
|
||||
if( db->mallocFailed ) rc = SQLITE_NOMEM_BKPT;
|
||||
vdbe_error_halt:
|
||||
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",
|
||||
@@ -6859,23 +6809,34 @@ vdbe_return:
|
||||
too_big:
|
||||
sqlite3VdbeError(p, "string or blob too big");
|
||||
rc = SQLITE_TOOBIG;
|
||||
goto abort_due_to_error;
|
||||
goto vdbe_error_halt;
|
||||
|
||||
/* Jump to here if a malloc() fails.
|
||||
*/
|
||||
no_mem:
|
||||
sqlite3OomFault(db);
|
||||
sqlite3VdbeError(p, "out of memory");
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
goto abort_due_to_error;
|
||||
rc = SQLITE_NOMEM;
|
||||
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;
|
||||
if( rc!=SQLITE_IOERR_NOMEM ){
|
||||
sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc));
|
||||
}
|
||||
goto vdbe_error_halt;
|
||||
|
||||
/* Jump to here if the sqlite3_interrupt() API sets the interrupt
|
||||
** flag.
|
||||
*/
|
||||
abort_due_to_interrupt:
|
||||
assert( db->u1.isInterrupted );
|
||||
rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT;
|
||||
rc = db->mallocFailed ? SQLITE_NOMEM : SQLITE_INTERRUPT;
|
||||
p->rc = rc;
|
||||
sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc));
|
||||
goto abort_due_to_error;
|
||||
goto vdbe_error_halt;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,6 @@ 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 */
|
||||
@@ -444,7 +443,7 @@ u8 sqlite3VdbeOneByteSerialTypeLen(u8);
|
||||
u32 sqlite3VdbeSerialType(Mem*, int, u32*);
|
||||
u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32);
|
||||
u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
|
||||
void sqlite3VdbeDeleteAuxData(sqlite3*, AuxData**, int, int);
|
||||
void sqlite3VdbeDeleteAuxData(Vdbe*, int, int);
|
||||
|
||||
int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
|
||||
int sqlite3VdbeIdxKeyCompare(sqlite3*,VdbeCursor*,UnpackedRecord*,int*);
|
||||
|
||||
@@ -471,7 +471,7 @@ void sqlite3_result_error_toobig(sqlite3_context *pCtx){
|
||||
void sqlite3_result_error_nomem(sqlite3_context *pCtx){
|
||||
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
|
||||
sqlite3VdbeMemSetNull(pCtx->pOut);
|
||||
pCtx->isError = SQLITE_NOMEM_BKPT;
|
||||
pCtx->isError = SQLITE_NOMEM;
|
||||
pCtx->fErrorOrAux = 1;
|
||||
sqlite3OomFault(pCtx->pOut->db);
|
||||
}
|
||||
@@ -547,7 +547,7 @@ static int sqlite3Step(Vdbe *p){
|
||||
db = p->db;
|
||||
if( db->mallocFailed ){
|
||||
p->rc = SQLITE_NOMEM;
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
if( p->pc<=0 && p->expired ){
|
||||
@@ -610,7 +610,7 @@ static int sqlite3Step(Vdbe *p){
|
||||
|
||||
db->errCode = rc;
|
||||
if( SQLITE_NOMEM==sqlite3ApiExit(p->db, p->rc) ){
|
||||
p->rc = SQLITE_NOMEM_BKPT;
|
||||
p->rc = SQLITE_NOMEM;
|
||||
}
|
||||
end_of_step:
|
||||
/* At this point local variable rc holds the value that should be
|
||||
@@ -677,7 +677,7 @@ int sqlite3_step(sqlite3_stmt *pStmt){
|
||||
v->rc = rc2;
|
||||
} else {
|
||||
v->zErrMsg = 0;
|
||||
v->rc = rc = SQLITE_NOMEM_BKPT;
|
||||
v->rc = rc = SQLITE_NOMEM;
|
||||
}
|
||||
}
|
||||
rc = sqlite3ApiExit(db, rc);
|
||||
@@ -1301,9 +1301,6 @@ 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(
|
||||
|
||||
@@ -129,7 +129,7 @@ static int growOpArray(Vdbe *v, int nOp){
|
||||
p->nOpAlloc = p->szOpAlloc/sizeof(Op);
|
||||
v->aOp = pNew;
|
||||
}
|
||||
return (pNew ? SQLITE_OK : SQLITE_NOMEM_BKPT);
|
||||
return (pNew ? SQLITE_OK : SQLITE_NOMEM);
|
||||
}
|
||||
|
||||
#ifdef SQLITE_DEBUG
|
||||
@@ -1488,7 +1488,6 @@ 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);
|
||||
}
|
||||
|
||||
@@ -1531,7 +1530,7 @@ int sqlite3VdbeList(
|
||||
releaseMemArray(pMem, 8);
|
||||
p->pResultSet = 0;
|
||||
|
||||
if( p->rc==SQLITE_NOMEM_BKPT ){
|
||||
if( p->rc==SQLITE_NOMEM ){
|
||||
/* This happens if a malloc() inside a call to sqlite3_column_text() or
|
||||
** sqlite3_column_text16() failed. */
|
||||
sqlite3OomFault(db);
|
||||
@@ -2017,9 +2016,6 @@ 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;
|
||||
}
|
||||
|
||||
@@ -2051,7 +2047,7 @@ static void closeAllCursors(Vdbe *p){
|
||||
}
|
||||
|
||||
/* Delete any auxdata allocations made by the VM */
|
||||
if( p->pAuxData ) sqlite3VdbeDeleteAuxData(p->db, &p->pAuxData, -1, 0);
|
||||
if( p->pAuxData ) sqlite3VdbeDeleteAuxData(p, -1, 0);
|
||||
assert( p->pAuxData==0 );
|
||||
}
|
||||
|
||||
@@ -2123,7 +2119,7 @@ int sqlite3VdbeSetColName(
|
||||
assert( var<COLNAME_N );
|
||||
if( p->db->mallocFailed ){
|
||||
assert( !zName || xDel!=SQLITE_DYNAMIC );
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
assert( p->aColName!=0 );
|
||||
pColName = &(p->aColName[idx+var*p->nResColumn]);
|
||||
@@ -2140,9 +2136,7 @@ int sqlite3VdbeSetColName(
|
||||
*/
|
||||
static int vdbeCommit(sqlite3 *db, Vdbe *p){
|
||||
int i;
|
||||
int nTrans = 0; /* Number of databases with an active write-transaction
|
||||
** that are candidates for a two-phase commit using a
|
||||
** master-journal */
|
||||
int nTrans = 0; /* Number of databases with an active write-transaction */
|
||||
int rc = SQLITE_OK;
|
||||
int needXcommit = 0;
|
||||
|
||||
@@ -2170,28 +2164,10 @@ 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);
|
||||
pPager = sqlite3BtreePager(pBt);
|
||||
if( db->aDb[i].safety_level!=PAGER_SYNCHRONOUS_OFF
|
||||
&& aMJNeeded[sqlite3PagerGetJournalMode(pPager)]
|
||||
){
|
||||
assert( i!=1 );
|
||||
nTrans++;
|
||||
}
|
||||
rc = sqlite3PagerExclusiveLock(pPager);
|
||||
rc = sqlite3PagerExclusiveLock(sqlite3BtreePager(pBt));
|
||||
sqlite3BtreeLeave(pBt);
|
||||
}
|
||||
}
|
||||
@@ -2249,6 +2225,7 @@ 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;
|
||||
@@ -2260,7 +2237,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
|
||||
/* Select a master journal file name */
|
||||
nMainFile = sqlite3Strlen30(zMainFile);
|
||||
zMaster = sqlite3MPrintf(db, "%s-mjXXXXXX9XXz", zMainFile);
|
||||
if( zMaster==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( zMaster==0 ) return SQLITE_NOMEM;
|
||||
do {
|
||||
u32 iRandom;
|
||||
if( retryCount ){
|
||||
@@ -2308,6 +2285,9 @@ 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 ){
|
||||
@@ -2322,7 +2302,8 @@ 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( 0==(sqlite3OsDeviceCharacteristics(pMaster)&SQLITE_IOCAP_SEQUENTIAL)
|
||||
if( needSync
|
||||
&& 0==(sqlite3OsDeviceCharacteristics(pMaster)&SQLITE_IOCAP_SEQUENTIAL)
|
||||
&& SQLITE_OK!=(rc = sqlite3OsSync(pMaster, SQLITE_SYNC_NORMAL))
|
||||
){
|
||||
sqlite3OsCloseFree(pMaster);
|
||||
@@ -2358,7 +2339,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, 1);
|
||||
rc = sqlite3OsDelete(pVfs, zMaster, needSync);
|
||||
sqlite3DbFree(db, zMaster);
|
||||
zMaster = 0;
|
||||
if( rc ){
|
||||
@@ -2546,7 +2527,7 @@ int sqlite3VdbeHalt(Vdbe *p){
|
||||
*/
|
||||
|
||||
if( db->mallocFailed ){
|
||||
p->rc = SQLITE_NOMEM_BKPT;
|
||||
p->rc = SQLITE_NOMEM;
|
||||
}
|
||||
if( p->aOnceFlag ) memset(p->aOnceFlag, 0, p->nOnceFlag);
|
||||
closeAllCursors(p);
|
||||
@@ -2707,7 +2688,7 @@ int sqlite3VdbeHalt(Vdbe *p){
|
||||
p->magic = VDBE_MAGIC_HALT;
|
||||
checkActiveVdbeCnt(db);
|
||||
if( db->mallocFailed ){
|
||||
p->rc = SQLITE_NOMEM_BKPT;
|
||||
p->rc = SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
/* If the auto-commit flag is set to true, then any locks that were held
|
||||
@@ -2894,7 +2875,8 @@ int sqlite3VdbeFinalize(Vdbe *p){
|
||||
** * the corresponding bit in argument mask is clear (where the first
|
||||
** function parameter corresponds to bit 0 etc.).
|
||||
*/
|
||||
void sqlite3VdbeDeleteAuxData(sqlite3 *db, AuxData **pp, int iOp, int mask){
|
||||
void sqlite3VdbeDeleteAuxData(Vdbe *pVdbe, int iOp, int mask){
|
||||
AuxData **pp = &pVdbe->pAuxData;
|
||||
while( *pp ){
|
||||
AuxData *pAux = *pp;
|
||||
if( (iOp<0)
|
||||
@@ -2905,7 +2887,7 @@ void sqlite3VdbeDeleteAuxData(sqlite3 *db, AuxData **pp, int iOp, int mask){
|
||||
pAux->xDelete(pAux->pAux);
|
||||
}
|
||||
*pp = pAux->pNext;
|
||||
sqlite3DbFree(db, pAux);
|
||||
sqlite3DbFree(pVdbe->db, pAux);
|
||||
}else{
|
||||
pp= &pAux->pNext;
|
||||
}
|
||||
@@ -3684,7 +3666,7 @@ static int vdbeCompareMemString(
|
||||
v2 = sqlite3ValueText((sqlite3_value*)&c2, pColl->enc);
|
||||
n2 = v2==0 ? 0 : c2.n;
|
||||
rc = pColl->xCmp(pColl->pUser, n1, v1, n2, v2);
|
||||
if( (v1==0 || v2==0) && prcErr ) *prcErr = SQLITE_NOMEM_BKPT;
|
||||
if( (v1==0 || v2==0) && prcErr ) *prcErr = SQLITE_NOMEM;
|
||||
sqlite3VdbeMemRelease(&c1);
|
||||
sqlite3VdbeMemRelease(&c2);
|
||||
return rc;
|
||||
|
||||
@@ -138,7 +138,7 @@ SQLITE_NOINLINE int sqlite3VdbeMemGrow(Mem *pMem, int n, int bPreserve){
|
||||
sqlite3VdbeMemSetNull(pMem);
|
||||
pMem->z = 0;
|
||||
pMem->szMalloc = 0;
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}else{
|
||||
pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc);
|
||||
}
|
||||
@@ -196,7 +196,7 @@ int sqlite3VdbeMemMakeWriteable(Mem *pMem){
|
||||
f = pMem->flags;
|
||||
if( (f&(MEM_Str|MEM_Blob)) && (pMem->szMalloc==0 || pMem->z!=pMem->zMalloc) ){
|
||||
if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
pMem->z[pMem->n] = 0;
|
||||
pMem->z[pMem->n+1] = 0;
|
||||
@@ -228,7 +228,7 @@ int sqlite3VdbeMemExpandBlob(Mem *pMem){
|
||||
nByte = 1;
|
||||
}
|
||||
if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
memset(&pMem->z[pMem->n], 0, pMem->u.nZero);
|
||||
@@ -245,7 +245,7 @@ int sqlite3VdbeMemExpandBlob(Mem *pMem){
|
||||
*/
|
||||
static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){
|
||||
if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
pMem->z[pMem->n] = 0;
|
||||
pMem->z[pMem->n+1] = 0;
|
||||
@@ -294,7 +294,7 @@ int sqlite3VdbeMemStringify(Mem *pMem, u8 enc, u8 bForce){
|
||||
|
||||
|
||||
if( sqlite3VdbeMemClearAndResize(pMem, nByte) ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
/* For a Real or Integer, use sqlite3_snprintf() to produce the UTF-8
|
||||
@@ -905,7 +905,7 @@ int sqlite3VdbeMemSetStr(
|
||||
testcase( nAlloc==31 );
|
||||
testcase( nAlloc==32 );
|
||||
if( sqlite3VdbeMemClearAndResize(pMem, MAX(nAlloc,32)) ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
memcpy(pMem->z, z, nAlloc);
|
||||
}else if( xDel==SQLITE_DYNAMIC ){
|
||||
@@ -925,7 +925,7 @@ int sqlite3VdbeMemSetStr(
|
||||
|
||||
#ifndef SQLITE_OMIT_UTF16
|
||||
if( pMem->enc!=SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1186,6 +1186,7 @@ static int valueFromFunction(
|
||||
FuncDef *pFunc = 0; /* Function definition */
|
||||
sqlite3_value *pVal = 0; /* New value */
|
||||
int rc = SQLITE_OK; /* Return code */
|
||||
int nName; /* Size of function name in bytes */
|
||||
ExprList *pList = 0; /* Function arguments */
|
||||
int i; /* Iterator variable */
|
||||
|
||||
@@ -1193,7 +1194,8 @@ static int valueFromFunction(
|
||||
assert( (p->flags & EP_TokenOnly)==0 );
|
||||
pList = p->x.pList;
|
||||
if( pList ) nVal = pList->nExpr;
|
||||
pFunc = sqlite3FindFunction(db, p->u.zToken, nVal, enc, 0);
|
||||
nName = sqlite3Strlen30(p->u.zToken);
|
||||
pFunc = sqlite3FindFunction(db, p->u.zToken, nName, nVal, enc, 0);
|
||||
assert( pFunc );
|
||||
if( (pFunc->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0
|
||||
|| (pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL)
|
||||
@@ -1204,7 +1206,7 @@ static int valueFromFunction(
|
||||
if( pList ){
|
||||
apVal = (sqlite3_value**)sqlite3DbMallocZero(db, sizeof(apVal[0]) * nVal);
|
||||
if( apVal==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto value_from_function_out;
|
||||
}
|
||||
for(i=0; i<nVal; i++){
|
||||
@@ -1215,7 +1217,7 @@ static int valueFromFunction(
|
||||
|
||||
pVal = valueNew(db, pCtx);
|
||||
if( pVal==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto value_from_function_out;
|
||||
}
|
||||
|
||||
@@ -1388,7 +1390,7 @@ no_mem:
|
||||
#else
|
||||
assert( pCtx==0 ); sqlite3ValueFree(pVal);
|
||||
#endif
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1455,10 +1457,15 @@ static void recordFunc(
|
||||
** Register built-in functions used to help read ANALYZE data.
|
||||
*/
|
||||
void sqlite3AnalyzeFunctions(void){
|
||||
static FuncDef aAnalyzeTableFuncs[] = {
|
||||
static SQLITE_WSD FuncDef aAnalyzeTableFuncs[] = {
|
||||
FUNCTION(sqlite_record, 1, 0, 0, recordFunc),
|
||||
};
|
||||
sqlite3InsertBuiltinFuncs(aAnalyzeTableFuncs, ArraySize(aAnalyzeTableFuncs));
|
||||
int i;
|
||||
FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions);
|
||||
FuncDef *aFunc = (FuncDef*)&GLOBAL(FuncDef, aAnalyzeTableFuncs);
|
||||
for(i=0; i<ArraySize(aAnalyzeTableFuncs); i++){
|
||||
sqlite3FuncDefInsert(pHash, &aFunc[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1637,7 +1644,7 @@ int sqlite3Stat4Column(
|
||||
if( iField>nRec ) return SQLITE_CORRUPT_BKPT;
|
||||
if( pMem==0 ){
|
||||
pMem = *ppVal = sqlite3ValueNew(db);
|
||||
if( pMem==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( pMem==0 ) return SQLITE_NOMEM;
|
||||
}
|
||||
sqlite3VdbeSerialGet(&a[iField-szField], t, pMem);
|
||||
pMem->enc = ENC(db);
|
||||
|
||||
@@ -540,7 +540,7 @@ static int vdbePmaReadBlob(
|
||||
int nNew = MAX(128, p->nAlloc*2);
|
||||
while( nByte>nNew ) nNew = nNew*2;
|
||||
aNew = sqlite3Realloc(p->aAlloc, nNew);
|
||||
if( !aNew ) return SQLITE_NOMEM_BKPT;
|
||||
if( !aNew ) return SQLITE_NOMEM;
|
||||
p->nAlloc = nNew;
|
||||
p->aAlloc = aNew;
|
||||
}
|
||||
@@ -652,7 +652,7 @@ static int vdbePmaReaderSeek(
|
||||
int iBuf = pReadr->iReadOff % pgsz;
|
||||
if( pReadr->aBuffer==0 ){
|
||||
pReadr->aBuffer = (u8*)sqlite3Malloc(pgsz);
|
||||
if( pReadr->aBuffer==0 ) rc = SQLITE_NOMEM_BKPT;
|
||||
if( pReadr->aBuffer==0 ) rc = SQLITE_NOMEM;
|
||||
pReadr->nBuffer = pgsz;
|
||||
}
|
||||
if( rc==SQLITE_OK && iBuf ){
|
||||
@@ -968,7 +968,7 @@ int sqlite3VdbeSorterInit(
|
||||
pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo);
|
||||
pCsr->uc.pSorter = pSorter;
|
||||
if( pSorter==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
pSorter->pKeyInfo = pKeyInfo = (KeyInfo*)((u8*)pSorter + sz);
|
||||
memcpy(pKeyInfo, pCsr->pKeyInfo, szKeyInfo);
|
||||
@@ -1002,7 +1002,7 @@ int sqlite3VdbeSorterInit(
|
||||
assert( pSorter->iMemory==0 );
|
||||
pSorter->nMemory = pgsz;
|
||||
pSorter->list.aMemory = (u8*)sqlite3Malloc(pgsz);
|
||||
if( !pSorter->list.aMemory ) rc = SQLITE_NOMEM_BKPT;
|
||||
if( !pSorter->list.aMemory ) rc = SQLITE_NOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1324,7 +1324,7 @@ static int vdbeSortAllocUnpacked(SortSubtask *pTask){
|
||||
pTask->pSorter->pKeyInfo, 0, 0, &pFree
|
||||
);
|
||||
assert( pTask->pUnpacked==(UnpackedRecord*)pFree );
|
||||
if( pFree==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( pFree==0 ) return SQLITE_NOMEM;
|
||||
pTask->pUnpacked->nField = pTask->pSorter->pKeyInfo->nField;
|
||||
pTask->pUnpacked->errCode = 0;
|
||||
}
|
||||
@@ -1399,7 +1399,7 @@ static int vdbeSorterSort(SortSubtask *pTask, SorterList *pList){
|
||||
|
||||
aSlot = (SorterRecord **)sqlite3MallocZero(64 * sizeof(SorterRecord *));
|
||||
if( !aSlot ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
while( p ){
|
||||
@@ -1449,7 +1449,7 @@ static void vdbePmaWriterInit(
|
||||
memset(p, 0, sizeof(PmaWriter));
|
||||
p->aBuffer = (u8*)sqlite3Malloc(nBuf);
|
||||
if( !p->aBuffer ){
|
||||
p->eFWErr = SQLITE_NOMEM_BKPT;
|
||||
p->eFWErr = SQLITE_NOMEM;
|
||||
}else{
|
||||
p->iBufEnd = p->iBufStart = (iStart % nBuf);
|
||||
p->iWriteOff = iStart - p->iBufStart;
|
||||
@@ -1737,7 +1737,7 @@ static int vdbeSorterFlushPMA(VdbeSorter *pSorter){
|
||||
pSorter->nMemory = sqlite3MallocSize(aMem);
|
||||
}else if( pSorter->list.aMemory ){
|
||||
pSorter->list.aMemory = sqlite3Malloc(pSorter->nMemory);
|
||||
if( !pSorter->list.aMemory ) return SQLITE_NOMEM_BKPT;
|
||||
if( !pSorter->list.aMemory ) return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
rc = vdbeSorterCreateThread(pTask, vdbeSorterFlushThread, pCtx);
|
||||
@@ -1828,7 +1828,7 @@ int sqlite3VdbeSorterWrite(
|
||||
if( nNew < nMin ) nNew = nMin;
|
||||
|
||||
aNew = sqlite3Realloc(pSorter->list.aMemory, nNew);
|
||||
if( !aNew ) return SQLITE_NOMEM_BKPT;
|
||||
if( !aNew ) return SQLITE_NOMEM;
|
||||
pSorter->list.pList = (SorterRecord*)&aNew[iListOff];
|
||||
pSorter->list.aMemory = aNew;
|
||||
pSorter->nMemory = nNew;
|
||||
@@ -1842,7 +1842,7 @@ int sqlite3VdbeSorterWrite(
|
||||
}else{
|
||||
pNew = (SorterRecord *)sqlite3Malloc(nReq);
|
||||
if( pNew==0 ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
pNew->u.pNext = pSorter->list.pList;
|
||||
}
|
||||
@@ -1989,7 +1989,7 @@ static int vdbeIncrMergerNew(
|
||||
pTask->file2.iEof += pIncr->mxSz;
|
||||
}else{
|
||||
vdbeMergeEngineFree(pMerger);
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@@ -2294,10 +2294,10 @@ static int vdbeMergeEngineLevel0(
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
*ppOut = pNew = vdbeMergeEngineNew(nPMA);
|
||||
if( pNew==0 ) rc = SQLITE_NOMEM_BKPT;
|
||||
if( pNew==0 ) rc = SQLITE_NOMEM;
|
||||
|
||||
for(i=0; i<nPMA && rc==SQLITE_OK; i++){
|
||||
i64 nDummy = 0;
|
||||
i64 nDummy;
|
||||
PmaReader *pReadr = &pNew->aReadr[i];
|
||||
rc = vdbePmaReaderInit(pTask, &pTask->file, iOff, pReadr, &nDummy);
|
||||
iOff = pReadr->iEof;
|
||||
@@ -2365,7 +2365,7 @@ static int vdbeSorterAddToTree(
|
||||
if( pReadr->pIncr==0 ){
|
||||
MergeEngine *pNew = vdbeMergeEngineNew(SORTER_MAX_MERGE_COUNT);
|
||||
if( pNew==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
rc = vdbeIncrMergerNew(pTask, pNew, &pReadr->pIncr);
|
||||
}
|
||||
@@ -2410,7 +2410,7 @@ static int vdbeSorterMergeTreeBuild(
|
||||
assert( pSorter->bUseThreads || pSorter->nTask==1 );
|
||||
if( pSorter->nTask>1 ){
|
||||
pMain = vdbeMergeEngineNew(pSorter->nTask);
|
||||
if( pMain==0 ) rc = SQLITE_NOMEM_BKPT;
|
||||
if( pMain==0 ) rc = SQLITE_NOMEM;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2428,7 +2428,7 @@ static int vdbeSorterMergeTreeBuild(
|
||||
int i;
|
||||
int iSeq = 0;
|
||||
pRoot = vdbeMergeEngineNew(SORTER_MAX_MERGE_COUNT);
|
||||
if( pRoot==0 ) rc = SQLITE_NOMEM_BKPT;
|
||||
if( pRoot==0 ) rc = SQLITE_NOMEM;
|
||||
for(i=0; i<pTask->nPMA && rc==SQLITE_OK; i += SORTER_MAX_MERGE_COUNT){
|
||||
MergeEngine *pMerger = 0; /* New level-0 PMA merger */
|
||||
int nReader; /* Number of level-0 PMAs to merge */
|
||||
@@ -2499,7 +2499,7 @@ static int vdbeSorterSetupMerge(VdbeSorter *pSorter){
|
||||
if( rc==SQLITE_OK ){
|
||||
pReadr = (PmaReader*)sqlite3DbMallocZero(db, sizeof(PmaReader));
|
||||
pSorter->pReader = pReadr;
|
||||
if( pReadr==0 ) rc = SQLITE_NOMEM_BKPT;
|
||||
if( pReadr==0 ) rc = SQLITE_NOMEM;
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = vdbeIncrMergerNew(pLast, pMain, &pReadr->pIncr);
|
||||
@@ -2676,7 +2676,7 @@ int sqlite3VdbeSorterRowkey(const VdbeCursor *pCsr, Mem *pOut){
|
||||
pSorter = pCsr->uc.pSorter;
|
||||
pKey = vdbeSorterRowkey(pSorter, &nKey);
|
||||
if( sqlite3VdbeMemClearAndResize(pOut, nKey) ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
pOut->n = nKey;
|
||||
MemSetTypeFlag(pOut, MEM_Blob);
|
||||
@@ -2721,7 +2721,7 @@ int sqlite3VdbeSorterCompare(
|
||||
char *p;
|
||||
r2 = pSorter->pUnpacked = sqlite3VdbeAllocUnpackedRecord(pKeyInfo,0,0,&p);
|
||||
assert( pSorter->pUnpacked==(UnpackedRecord*)p );
|
||||
if( r2==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( r2==0 ) return SQLITE_NOMEM;
|
||||
r2->nField = nKeyCol;
|
||||
}
|
||||
assert( r2->nField==nKeyCol );
|
||||
|
||||
@@ -506,13 +506,13 @@ static int vtabCallConstructor(
|
||||
|
||||
zModuleName = sqlite3MPrintf(db, "%s", pTab->zName);
|
||||
if( !zModuleName ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
pVTable = sqlite3DbMallocZero(db, sizeof(VTable));
|
||||
if( !pVTable ){
|
||||
sqlite3DbFree(db, zModuleName);
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
pVTable->db = db;
|
||||
pVTable->pMod = pMod;
|
||||
@@ -655,7 +655,7 @@ static int growVTrans(sqlite3 *db){
|
||||
int nBytes = sizeof(sqlite3_vtab *) * (db->nVTrans + ARRAY_INCR);
|
||||
aVTrans = sqlite3DbRealloc(db, (void *)db->aVTrans, nBytes);
|
||||
if( !aVTrans ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
memset(&aVTrans[db->nVTrans], 0, sizeof(sqlite3_vtab *)*ARRAY_INCR);
|
||||
db->aVTrans = aVTrans;
|
||||
@@ -747,7 +747,7 @@ int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
|
||||
|
||||
pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
|
||||
if( pParse==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
pParse->declareVtab = 1;
|
||||
pParse->db = db;
|
||||
@@ -1059,8 +1059,8 @@ FuncDef *sqlite3VtabOverloadFunction(
|
||||
return pDef;
|
||||
}
|
||||
*pNew = *pDef;
|
||||
pNew->zName = (const char*)&pNew[1];
|
||||
memcpy((char*)&pNew[1], pDef->zName, sqlite3Strlen30(pDef->zName)+1);
|
||||
pNew->zName = (char *)&pNew[1];
|
||||
memcpy(pNew->zName, pDef->zName, sqlite3Strlen30(pDef->zName)+1);
|
||||
pNew->xSFunc = xSFunc;
|
||||
pNew->pUserData = pArg;
|
||||
pNew->funcFlags |= SQLITE_FUNC_EPHEM;
|
||||
|
||||
@@ -546,7 +546,7 @@ static int walIndexPage(Wal *pWal, int iPage, volatile u32 **ppPage){
|
||||
apNew = (volatile u32 **)sqlite3_realloc64((void *)pWal->apWiData, nByte);
|
||||
if( !apNew ){
|
||||
*ppPage = 0;
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
memset((void*)&apNew[pWal->nWiData], 0,
|
||||
sizeof(u32*)*(iPage+1-pWal->nWiData));
|
||||
@@ -558,7 +558,7 @@ static int walIndexPage(Wal *pWal, int iPage, volatile u32 **ppPage){
|
||||
if( pWal->apWiData[iPage]==0 ){
|
||||
if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ){
|
||||
pWal->apWiData[iPage] = (u32 volatile *)sqlite3MallocZero(WALINDEX_PGSZ);
|
||||
if( !pWal->apWiData[iPage] ) rc = SQLITE_NOMEM_BKPT;
|
||||
if( !pWal->apWiData[iPage] ) rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
rc = sqlite3OsShmMap(pWal->pDbFd, iPage, WALINDEX_PGSZ,
|
||||
pWal->writeLock, (void volatile **)&pWal->apWiData[iPage]
|
||||
@@ -1173,7 +1173,7 @@ static int walIndexRecover(Wal *pWal){
|
||||
szFrame = szPage + WAL_FRAME_HDRSIZE;
|
||||
aFrame = (u8 *)sqlite3_malloc64(szFrame);
|
||||
if( !aFrame ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
goto recovery_error;
|
||||
}
|
||||
aData = &aFrame[WAL_FRAME_HDRSIZE];
|
||||
@@ -1311,7 +1311,7 @@ int sqlite3WalOpen(
|
||||
*ppWal = 0;
|
||||
pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile);
|
||||
if( !pRet ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
pRet->pVfs = pVfs;
|
||||
@@ -1575,7 +1575,7 @@ static int walIteratorInit(Wal *pWal, WalIterator **pp){
|
||||
+ iLast*sizeof(ht_slot);
|
||||
p = (WalIterator *)sqlite3_malloc64(nByte);
|
||||
if( !p ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
memset(p, 0, nByte);
|
||||
p->nSegment = nSegment;
|
||||
@@ -1587,7 +1587,7 @@ static int walIteratorInit(Wal *pWal, WalIterator **pp){
|
||||
sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast)
|
||||
);
|
||||
if( !aTmp ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
for(i=0; rc==SQLITE_OK && i<nSegment; i++){
|
||||
@@ -2880,7 +2880,7 @@ static int walWriteOneFrame(
|
||||
void *pData; /* Data actually written */
|
||||
u8 aFrame[WAL_FRAME_HDRSIZE]; /* Buffer to assemble frame-header in */
|
||||
#if defined(SQLITE_HAS_CODEC)
|
||||
if( (pData = sqlite3PagerCodec(pPage))==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( (pData = sqlite3PagerCodec(pPage))==0 ) return SQLITE_NOMEM;
|
||||
#else
|
||||
pData = pPage->pData;
|
||||
#endif
|
||||
@@ -2909,7 +2909,7 @@ static int walRewriteChecksums(Wal *pWal, u32 iLast){
|
||||
i64 iCksumOff;
|
||||
|
||||
aBuf = sqlite3_malloc(szPage + WAL_FRAME_HDRSIZE);
|
||||
if( aBuf==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( aBuf==0 ) return SQLITE_NOMEM;
|
||||
|
||||
/* Find the checksum values to use as input for the recalculating the
|
||||
** first checksum. If the first frame is frame 1 (implying that the current
|
||||
@@ -3385,7 +3385,7 @@ int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot){
|
||||
|
||||
pRet = (WalIndexHdr*)sqlite3_malloc(sizeof(WalIndexHdr));
|
||||
if( pRet==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
memcpy(pRet, &pWal->hdr, sizeof(WalIndexHdr));
|
||||
*ppSnapshot = (sqlite3_snapshot*)pRet;
|
||||
|
||||
@@ -1736,7 +1736,7 @@ static int whereLoopResize(sqlite3 *db, WhereLoop *p, int n){
|
||||
if( p->nLSlot>=n ) return SQLITE_OK;
|
||||
n = (n+7)&~7;
|
||||
paNew = sqlite3DbMallocRawNN(db, sizeof(p->aLTerm[0])*n);
|
||||
if( paNew==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( paNew==0 ) return SQLITE_NOMEM;
|
||||
memcpy(paNew, p->aLTerm, sizeof(p->aLTerm[0])*p->nLSlot);
|
||||
if( p->aLTerm!=p->aLTermSpace ) sqlite3DbFree(db, p->aLTerm);
|
||||
p->aLTerm = paNew;
|
||||
@@ -1751,7 +1751,7 @@ static int whereLoopXfer(sqlite3 *db, WhereLoop *pTo, WhereLoop *pFrom){
|
||||
whereLoopClearUnion(db, pTo);
|
||||
if( whereLoopResize(db, pTo, pFrom->nLTerm) ){
|
||||
memset(&pTo->u, 0, sizeof(pTo->u));
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
memcpy(pTo, pFrom, WHERE_LOOP_XFER_SZ);
|
||||
memcpy(pTo->aLTerm, pFrom->aLTerm, pTo->nLTerm*sizeof(pTo->aLTerm[0]));
|
||||
@@ -2033,7 +2033,7 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){
|
||||
if( p==0 ){
|
||||
/* Allocate a new WhereLoop to add to the end of the list */
|
||||
*ppPrev = p = sqlite3DbMallocRawNN(db, sizeof(WhereLoop));
|
||||
if( p==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( p==0 ) return SQLITE_NOMEM;
|
||||
whereLoopInit(p);
|
||||
p->pNextLoop = 0;
|
||||
}else{
|
||||
@@ -2189,7 +2189,7 @@ static int whereLoopAddBtreeIndex(
|
||||
WhereTerm *pTop = 0, *pBtm = 0; /* Top and bottom range constraints */
|
||||
|
||||
pNew = pBuilder->pNew;
|
||||
if( db->mallocFailed ) return SQLITE_NOMEM_BKPT;
|
||||
if( db->mallocFailed ) return SQLITE_NOMEM;
|
||||
|
||||
assert( (pNew->wsFlags & WHERE_VIRTUALTABLE)==0 );
|
||||
assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 );
|
||||
@@ -2806,7 +2806,7 @@ static int whereLoopAddVirtual(
|
||||
pTab = pSrc->pTab;
|
||||
assert( IsVirtual(pTab) );
|
||||
pIdxInfo = allocateIndexInfo(pParse, pWC, mUnusable, pSrc,pBuilder->pOrderBy);
|
||||
if( pIdxInfo==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( pIdxInfo==0 ) return SQLITE_NOMEM;
|
||||
pNew->prereq = 0;
|
||||
pNew->rSetup = 0;
|
||||
pNew->wsFlags = WHERE_VIRTUALTABLE;
|
||||
@@ -2816,7 +2816,7 @@ static int whereLoopAddVirtual(
|
||||
nConstraint = pIdxInfo->nConstraint;
|
||||
if( whereLoopResize(db, pNew, nConstraint) ){
|
||||
sqlite3DbFree(db, pIdxInfo);
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
for(iPhase=0; iPhase<=3; iPhase++){
|
||||
@@ -3521,7 +3521,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
|
||||
nSpace = (sizeof(WherePath)+sizeof(WhereLoop*)*nLoop)*mxChoice*2;
|
||||
nSpace += sizeof(LogEst) * nOrderBy;
|
||||
pSpace = sqlite3DbMallocRawNN(db, nSpace);
|
||||
if( pSpace==0 ) return SQLITE_NOMEM_BKPT;
|
||||
if( pSpace==0 ) return SQLITE_NOMEM;
|
||||
aTo = (WherePath*)pSpace;
|
||||
aFrom = aTo+mxChoice;
|
||||
memset(aFrom, 0, sizeof(aFrom[0]));
|
||||
|
||||
@@ -1212,22 +1212,16 @@ Bitmask sqlite3WhereCodeOneLoopStart(
|
||||
start_constraints = 1;
|
||||
}
|
||||
codeApplyAffinity(pParse, regBase, nConstraint - bSeekPastNull, zStartAff);
|
||||
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 );
|
||||
}
|
||||
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).
|
||||
|
||||
@@ -533,7 +533,6 @@ 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);
|
||||
@@ -560,7 +559,6 @@ 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);
|
||||
|
||||
@@ -89,36 +89,5 @@ 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
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
#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))
|
||||
|
||||
@@ -256,9 +255,8 @@ static VFile *createVFile(const char *zName, int sz, unsigned char *pData){
|
||||
if( i>=MX_FILE ) return 0;
|
||||
pNew = &g.aFile[i];
|
||||
if( zName ){
|
||||
int nName = (int)strlen(zName)+1;
|
||||
pNew->zFilename = safe_realloc(0, nName);
|
||||
memcpy(pNew->zFilename, zName, nName);
|
||||
pNew->zFilename = safe_realloc(0, strlen(zName)+1);
|
||||
memcpy(pNew->zFilename, zName, strlen(zName)+1);
|
||||
}else{
|
||||
pNew->zFilename = 0;
|
||||
}
|
||||
@@ -622,14 +620,12 @@ 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;
|
||||
@@ -787,7 +783,8 @@ 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|--quiet Reduced output\n"
|
||||
" -q Reduced output\n"
|
||||
" --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"
|
||||
@@ -798,7 +795,8 @@ 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|--verbose Increased output. Repeat for more output.\n"
|
||||
" -v Increased output\n"
|
||||
" --verbose Increased output\n"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -921,8 +919,8 @@ int main(int argc, char **argv){
|
||||
}else
|
||||
if( strcmp(z,"verbose")==0 || strcmp(z,"v")==0 ){
|
||||
quietFlag = 0;
|
||||
verboseFlag++;
|
||||
if( verboseFlag>1 ) runFlags |= SQL_TRACE;
|
||||
verboseFlag = 1;
|
||||
runFlags |= SQL_TRACE;
|
||||
}else
|
||||
{
|
||||
fatalError("unknown option: %s", argv[i]);
|
||||
@@ -1057,7 +1055,7 @@ int main(int argc, char **argv){
|
||||
/* Print the description, if there is one */
|
||||
if( !quietFlag ){
|
||||
zDbName = azSrcDb[iSrcDb];
|
||||
i = (int)strlen(zDbName) - 1;
|
||||
i = strlen(zDbName) - 1;
|
||||
while( i>0 && zDbName[i-1]!='/' && zDbName[i-1]!='\\' ){ i--; }
|
||||
zDbName += i;
|
||||
sqlite3_prepare_v2(db, "SELECT msg FROM readme", -1, &pStmt, 0);
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -529,7 +529,6 @@ 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]]} {
|
||||
#
|
||||
@@ -543,7 +542,6 @@ proc copy_on_mj_delete {method filename args} {
|
||||
set ::mj_filename_length [string length $filename]
|
||||
}
|
||||
faultsim_save
|
||||
incr ::mj_delete_cnt
|
||||
}
|
||||
return SQLITE_OK
|
||||
}
|
||||
@@ -581,68 +579,29 @@ foreach {tn1 tcl} {
|
||||
}
|
||||
} {
|
||||
eval $tcl
|
||||
foreach {tn2 sql usesMJ} {
|
||||
foreach {tn2 sql} {
|
||||
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}"
|
||||
@@ -654,7 +613,6 @@ 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;
|
||||
@@ -676,13 +634,6 @@ 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.
|
||||
#
|
||||
@@ -693,33 +644,25 @@ foreach {tn1 tcl} {
|
||||
SELECT * FROM b
|
||||
} {won too free double-you why zed}
|
||||
|
||||
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 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 {
|
||||
if {$::mj_delete_cnt>0} {
|
||||
faultsim_restore_and_reopen $prefix
|
||||
foreach f [glob ${prefix}-mj*] { forcedelete $f }
|
||||
} else {
|
||||
db close
|
||||
sqlite3 db $prefix
|
||||
}
|
||||
faultsim_restore_and_reopen $prefix
|
||||
foreach f [glob ${prefix}-mj*] { forcedelete $f }
|
||||
execsql "ATTACH '${prefix}2' AS aux"
|
||||
glob -nocomplain ${prefix}-mj*
|
||||
} {}
|
||||
do_execsql_test pager1-4.4.$tn.8 {
|
||||
SELECT * FROM a
|
||||
@@ -735,6 +678,7 @@ 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).
|
||||
|
||||
@@ -86,7 +86,10 @@ proc test_set {args} {
|
||||
#
|
||||
set alltests [list]
|
||||
foreach f [glob $testdir/*.test] { lappend alltests [file tail $f] }
|
||||
foreach f [glob -nocomplain $testdir/../ext/rtree/*.test] {
|
||||
foreach f [glob -nocomplain \
|
||||
$testdir/../ext/rtree/*.test \
|
||||
$testdir/../ext/fts5/test/*.test \
|
||||
] {
|
||||
lappend alltests $f
|
||||
}
|
||||
|
||||
@@ -157,7 +160,8 @@ test_suite "veryquick" -prefix "" -description {
|
||||
This test suite is the same as the "quick" tests, except that some files
|
||||
that test malloc and IO errors are omitted.
|
||||
} -files [
|
||||
test_set $allquicktests -exclude *malloc* *ioerr* *fault* *bigfile* *_err*
|
||||
test_set $allquicktests -exclude *malloc* *ioerr* *fault* *bigfile* *_err* \
|
||||
*fts5corrupt* *fts5big* *fts5aj*
|
||||
]
|
||||
|
||||
test_suite "extraquick" -prefix "" -description {
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
# 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
|
||||
|
||||
@@ -203,6 +203,7 @@ array set ::Configs [strip_comments {
|
||||
-DSQLITE_MAX_ATTACHED=30
|
||||
-DSQLITE_ENABLE_COLUMN_METADATA
|
||||
-DSQLITE_ENABLE_FTS4
|
||||
-DSQLITE_ENABLE_FTS5
|
||||
-DSQLITE_ENABLE_FTS4_PARENTHESIS
|
||||
-DSQLITE_DISABLE_FTS4_DEFERRED
|
||||
-DSQLITE_ENABLE_RTREE
|
||||
|
||||
@@ -1196,9 +1196,6 @@ 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 = "";
|
||||
|
||||
@@ -374,21 +374,6 @@ proc do_not_use_codec {} {
|
||||
reset_db
|
||||
}
|
||||
|
||||
# Print a HELP message and exit
|
||||
#
|
||||
proc print_help_and_quit {} {
|
||||
puts {Options:
|
||||
--pause Wait for user input before continuing
|
||||
--soft-heap-limit=N Set the soft-heap-limit to N
|
||||
--maxerror=N Quit after N errors
|
||||
--verbose=(0|1) Control the amount of output. Default '1'
|
||||
--output=FILE set --verbose=2 and output to FILE. Implies -q
|
||||
-q Shorthand for --verbose=0
|
||||
--help This message
|
||||
}
|
||||
exit 1
|
||||
}
|
||||
|
||||
# The following block only runs the first time this file is sourced. It
|
||||
# does not run in slave interpreters (since the ::cmdlinearg array is
|
||||
# populated before the test script is run in slave interpreters).
|
||||
@@ -498,13 +483,6 @@ if {[info exists cmdlinearg]==0} {
|
||||
error "option --verbose= must be set to a boolean or to \"file\""
|
||||
}
|
||||
}
|
||||
{.*help.*} {
|
||||
print_help_and_quit
|
||||
}
|
||||
{^-q$} {
|
||||
set cmdlinearg(output) test-out.txt
|
||||
set cmdlinearg(verbose) 2
|
||||
}
|
||||
|
||||
default {
|
||||
lappend leftover $a
|
||||
|
||||
@@ -286,8 +286,6 @@ struct rule {
|
||||
const char **rhsalias; /* An alias for each RHS symbol (NULL if none) */
|
||||
int line; /* Line number at which code begins */
|
||||
const char *code; /* The code executed when this rule is reduced */
|
||||
const char *codePrefix; /* Setup code before code[] above */
|
||||
const char *codeSuffix; /* Breakdown code after code[] above */
|
||||
struct symbol *precsym; /* Precedence symbol for this rule */
|
||||
int index; /* An index number for this rule */
|
||||
Boolean canReduce; /* True if this rule is ever reduced */
|
||||
@@ -3432,7 +3430,6 @@ PRIVATE char *append_str(const char *zText, int n, int p1, int p2){
|
||||
int c;
|
||||
char zInt[40];
|
||||
if( zText==0 ){
|
||||
if( used==0 && z!=0 ) z[0] = 0;
|
||||
used = 0;
|
||||
return z;
|
||||
}
|
||||
@@ -3469,21 +3466,12 @@ PRIVATE char *append_str(const char *zText, int n, int p1, int p2){
|
||||
** zCode is a string that is the action associated with a rule. Expand
|
||||
** the symbols in this string so that the refer to elements of the parser
|
||||
** stack.
|
||||
**
|
||||
** Return 1 if the expanded code requires that "yylhsminor" local variable
|
||||
** to be defined.
|
||||
*/
|
||||
PRIVATE int translate_code(struct lemon *lemp, struct rule *rp){
|
||||
PRIVATE void translate_code(struct lemon *lemp, struct rule *rp){
|
||||
char *cp, *xp;
|
||||
int i;
|
||||
int rc = 0; /* True if yylhsminor is used */
|
||||
int dontUseRhs0 = 0; /* If true, use of left-most RHS label is illegal */
|
||||
const char *zSkip = 0; /* The zOvwrt comment within rp->code, or NULL */
|
||||
char lhsused = 0; /* True if the LHS element has been used */
|
||||
char lhsdirect; /* True if LHS writes directly into stack */
|
||||
char used[MAXRHS]; /* True for each RHS element which is used */
|
||||
char zLhs[50]; /* Convert the LHS symbol into this string */
|
||||
char zOvwrt[900]; /* Comment that to allow LHS to overwrite RHS */
|
||||
char lhsused = 0; /* True if the LHS element has been used */
|
||||
char used[MAXRHS]; /* True for each RHS element which is used */
|
||||
|
||||
for(i=0; i<rp->nrhs; i++) used[i] = 0;
|
||||
lhsused = 0;
|
||||
@@ -3494,83 +3482,23 @@ PRIVATE int translate_code(struct lemon *lemp, struct rule *rp){
|
||||
rp->line = rp->ruleline;
|
||||
}
|
||||
|
||||
|
||||
if( rp->lhsalias==0 ){
|
||||
/* There is no LHS value symbol. */
|
||||
lhsdirect = 1;
|
||||
}else if( rp->nrhs==0 ){
|
||||
/* If there are no RHS symbols, then writing directly to the LHS is ok */
|
||||
lhsdirect = 1;
|
||||
}else if( rp->rhsalias[0]==0 ){
|
||||
/* The left-most RHS symbol has not value. LHS direct is ok. But
|
||||
** we have to call the distructor on the RHS symbol first. */
|
||||
lhsdirect = 1;
|
||||
if( has_destructor(rp->rhs[0],lemp) ){
|
||||
append_str(0,0,0,0);
|
||||
append_str(" yy_destructor(yypParser,%d,&yymsp[%d].minor);\n", 0,
|
||||
rp->rhs[0]->index,1-rp->nrhs);
|
||||
rp->codePrefix = Strsafe(append_str(0,0,0,0));
|
||||
}
|
||||
}else if( strcmp(rp->lhsalias,rp->rhsalias[0])==0 ){
|
||||
/* The LHS symbol and the left-most RHS symbol are the same, so
|
||||
** direct writing is allowed */
|
||||
lhsdirect = 1;
|
||||
lhsused = 1;
|
||||
used[0] = 1;
|
||||
if( rp->lhs->dtnum!=rp->rhs[0]->dtnum ){
|
||||
ErrorMsg(lemp->filename,rp->ruleline,
|
||||
"%s(%s) and %s(%s) share the same label but have "
|
||||
"different datatypes.",
|
||||
rp->lhs->name, rp->lhsalias, rp->rhs[0]->name, rp->rhsalias[0]);
|
||||
lemp->errorcnt++;
|
||||
}
|
||||
}else{
|
||||
lemon_sprintf(zOvwrt, "/*%s-overwrites-%s*/",
|
||||
rp->lhsalias, rp->rhsalias[0]);
|
||||
zSkip = strstr(rp->code, zOvwrt);
|
||||
if( zSkip!=0 ){
|
||||
/* The code contains a special comment that indicates that it is safe
|
||||
** for the LHS label to overwrite left-most RHS label. */
|
||||
lhsdirect = 1;
|
||||
}else{
|
||||
lhsdirect = 0;
|
||||
}
|
||||
}
|
||||
if( lhsdirect ){
|
||||
sprintf(zLhs, "yymsp[%d].minor.yy%d",1-rp->nrhs,rp->lhs->dtnum);
|
||||
}else{
|
||||
rc = 1;
|
||||
sprintf(zLhs, "yylhsminor.yy%d",rp->lhs->dtnum);
|
||||
}
|
||||
|
||||
append_str(0,0,0,0);
|
||||
|
||||
/* This const cast is wrong but harmless, if we're careful. */
|
||||
for(cp=(char *)rp->code; *cp; cp++){
|
||||
if( cp==zSkip ){
|
||||
append_str(zOvwrt,0,0,0);
|
||||
cp += lemonStrlen(zOvwrt)-1;
|
||||
dontUseRhs0 = 1;
|
||||
continue;
|
||||
}
|
||||
if( ISALPHA(*cp) && (cp==rp->code || (!ISALNUM(cp[-1]) && cp[-1]!='_')) ){
|
||||
char saved;
|
||||
for(xp= &cp[1]; ISALNUM(*xp) || *xp=='_'; xp++);
|
||||
saved = *xp;
|
||||
*xp = 0;
|
||||
if( rp->lhsalias && strcmp(cp,rp->lhsalias)==0 ){
|
||||
append_str(zLhs,0,0,0);
|
||||
append_str("yygotominor.yy%d",0,rp->lhs->dtnum,0);
|
||||
cp = xp;
|
||||
lhsused = 1;
|
||||
}else{
|
||||
for(i=0; i<rp->nrhs; i++){
|
||||
if( rp->rhsalias[i] && strcmp(cp,rp->rhsalias[i])==0 ){
|
||||
if( i==0 && dontUseRhs0 ){
|
||||
ErrorMsg(lemp->filename,rp->ruleline,
|
||||
"Label %s used after '%s'.",
|
||||
rp->rhsalias[0], zOvwrt);
|
||||
lemp->errorcnt++;
|
||||
}else if( cp!=rp->code && cp[-1]=='@' ){
|
||||
if( cp!=rp->code && cp[-1]=='@' ){
|
||||
/* If the argument is of the form @X then substituted
|
||||
** the token number of X, not the value of X */
|
||||
append_str("yymsp[%d].major",-1,i-rp->nrhs+1,0);
|
||||
@@ -3595,11 +3523,6 @@ PRIVATE int translate_code(struct lemon *lemp, struct rule *rp){
|
||||
append_str(cp, 1, 0, 0);
|
||||
} /* End loop */
|
||||
|
||||
/* Main code generation completed */
|
||||
cp = append_str(0,0,0,0);
|
||||
if( cp && cp[0] ) rp->code = Strsafe(cp);
|
||||
append_str(0,0,0,0);
|
||||
|
||||
/* Check to make sure the LHS has been used */
|
||||
if( rp->lhsalias && !lhsused ){
|
||||
ErrorMsg(lemp->filename,rp->ruleline,
|
||||
@@ -3608,55 +3531,27 @@ PRIVATE int translate_code(struct lemon *lemp, struct rule *rp){
|
||||
lemp->errorcnt++;
|
||||
}
|
||||
|
||||
/* Generate destructor code for RHS minor values which are not referenced.
|
||||
** Generate error messages for unused labels and duplicate labels.
|
||||
*/
|
||||
/* Generate destructor code for RHS symbols which are not used in the
|
||||
** reduce code */
|
||||
for(i=0; i<rp->nrhs; i++){
|
||||
if( rp->rhsalias[i] ){
|
||||
if( i>0 ){
|
||||
int j;
|
||||
if( rp->lhsalias && strcmp(rp->lhsalias,rp->rhsalias[i])==0 ){
|
||||
ErrorMsg(lemp->filename,rp->ruleline,
|
||||
"%s(%s) has the same label as the LHS but is not the left-most "
|
||||
"symbol on the RHS.",
|
||||
rp->rhs[i]->name, rp->rhsalias);
|
||||
lemp->errorcnt++;
|
||||
}
|
||||
for(j=0; j<i; j++){
|
||||
if( rp->rhsalias[j] && strcmp(rp->rhsalias[j],rp->rhsalias[i])==0 ){
|
||||
ErrorMsg(lemp->filename,rp->ruleline,
|
||||
"Label %s used for multiple symbols on the RHS of a rule.",
|
||||
rp->rhsalias[i]);
|
||||
lemp->errorcnt++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( rp->rhsalias[i] && !used[i] ){
|
||||
ErrorMsg(lemp->filename,rp->ruleline,
|
||||
"Label %s for \"%s(%s)\" is never used.",
|
||||
rp->rhsalias[i],rp->rhs[i]->name,rp->rhsalias[i]);
|
||||
lemp->errorcnt++;
|
||||
}else if( rp->rhsalias[i]==0 ){
|
||||
if( has_destructor(rp->rhs[i],lemp) ){
|
||||
append_str(" yy_destructor(yypParser,%d,&yymsp[%d].minor);\n", 0,
|
||||
rp->rhs[i]->index,i-rp->nrhs+1);
|
||||
}else{
|
||||
/* No destructor defined for this term */
|
||||
}
|
||||
if( !used[i] ){
|
||||
ErrorMsg(lemp->filename,rp->ruleline,
|
||||
"Label %s for \"%s(%s)\" is never used.",
|
||||
rp->rhsalias[i],rp->rhs[i]->name,rp->rhsalias[i]);
|
||||
lemp->errorcnt++;
|
||||
}
|
||||
}else if( i>0 && has_destructor(rp->rhs[i],lemp) ){
|
||||
append_str(" yy_destructor(yypParser,%d,&yymsp[%d].minor);\n", 0,
|
||||
rp->rhs[i]->index,i-rp->nrhs+1);
|
||||
}
|
||||
}
|
||||
|
||||
/* If unable to write LHS values directly into the stack, write the
|
||||
** saved LHS value now. */
|
||||
if( lhsdirect==0 ){
|
||||
append_str(" yymsp[%d].minor.yy%d = ", 0, 1-rp->nrhs, rp->lhs->dtnum);
|
||||
append_str(zLhs, 0, 0, 0);
|
||||
append_str(";\n", 0, 0, 0);
|
||||
if( rp->code ){
|
||||
cp = append_str(0,0,0,0);
|
||||
rp->code = Strsafe(cp?cp:"");
|
||||
}
|
||||
|
||||
/* Suffix code generation complete */
|
||||
cp = append_str(0,0,0,0);
|
||||
if( cp ) rp->codeSuffix = Strsafe(cp);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3671,12 +3566,6 @@ PRIVATE void emit_code(
|
||||
){
|
||||
const char *cp;
|
||||
|
||||
/* Setup code prior to the #line directive */
|
||||
if( rp->codePrefix && rp->codePrefix[0] ){
|
||||
fprintf(out, "{%s", rp->codePrefix);
|
||||
for(cp=rp->codePrefix; *cp; cp++){ if( *cp=='\n' ) (*lineno)++; }
|
||||
}
|
||||
|
||||
/* Generate code to do the reduce action */
|
||||
if( rp->code ){
|
||||
if( !lemp->nolinenosflag ){
|
||||
@@ -3684,23 +3573,15 @@ PRIVATE void emit_code(
|
||||
tplt_linedir(out,rp->line,lemp->filename);
|
||||
}
|
||||
fprintf(out,"{%s",rp->code);
|
||||
for(cp=rp->code; *cp; cp++){ if( *cp=='\n' ) (*lineno)++; }
|
||||
for(cp=rp->code; *cp; cp++){
|
||||
if( *cp=='\n' ) (*lineno)++;
|
||||
} /* End loop */
|
||||
fprintf(out,"}\n"); (*lineno)++;
|
||||
if( !lemp->nolinenosflag ){
|
||||
(*lineno)++;
|
||||
tplt_linedir(out,*lineno,lemp->outname);
|
||||
}
|
||||
}
|
||||
|
||||
/* Generate breakdown code that occurs after the #line directive */
|
||||
if( rp->codeSuffix && rp->codeSuffix[0] ){
|
||||
fprintf(out, "%s", rp->codeSuffix);
|
||||
for(cp=rp->codeSuffix; *cp; cp++){ if( *cp=='\n' ) (*lineno)++; }
|
||||
}
|
||||
|
||||
if( rp->codePrefix ){
|
||||
fprintf(out, "}\n"); (*lineno)++;
|
||||
}
|
||||
} /* End if( rp->code ) */
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -4325,12 +4206,8 @@ void ReportTable(
|
||||
tplt_xfer(lemp->name,in,out,&lineno);
|
||||
|
||||
/* Generate code which execution during each REDUCE action */
|
||||
i = 0;
|
||||
for(rp=lemp->rule; rp; rp=rp->next){
|
||||
i += translate_code(lemp, rp);
|
||||
}
|
||||
if( i ){
|
||||
fprintf(out," YYMINORTYPE yylhsminor;\n"); lineno++;
|
||||
translate_code(lemp, rp);
|
||||
}
|
||||
/* First output rules other than the default: rule */
|
||||
for(rp=lemp->rule; rp; rp=rp->next){
|
||||
|
||||
@@ -87,6 +87,10 @@
|
||||
%%
|
||||
/************* 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.
|
||||
**
|
||||
@@ -207,9 +211,7 @@ struct yyParser {
|
||||
#ifdef YYTRACKMAXSTACKDEPTH
|
||||
int yyidxMax; /* Maximum value of yyidx */
|
||||
#endif
|
||||
#ifndef YYNOERRORRECOVERY
|
||||
int yyerrcnt; /* Shifts left before out of the error */
|
||||
#endif
|
||||
ParseARG_SDECL /* A place to hold %extra_argument */
|
||||
#if YYSTACKDEPTH<=0
|
||||
int yystksz; /* Current side of the stack */
|
||||
@@ -514,7 +516,7 @@ static int yy_find_reduce_action(
|
||||
/*
|
||||
** The following routine is called if the stack overflows.
|
||||
*/
|
||||
static void yyStackOverflow(yyParser *yypParser){
|
||||
static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
|
||||
ParseARG_FETCH;
|
||||
yypParser->yyidx--;
|
||||
#ifndef NDEBUG
|
||||
@@ -558,7 +560,7 @@ static void yy_shift(
|
||||
yyParser *yypParser, /* The parser to be shifted */
|
||||
int yyNewState, /* The new state to shift in */
|
||||
int yyMajor, /* The major token to shift in */
|
||||
ParseTOKENTYPE yyMinor /* The minor token to shift in */
|
||||
YYMINORTYPE *yypMinor /* Pointer to the minor token to shift in */
|
||||
){
|
||||
yyStackEntry *yytos;
|
||||
yypParser->yyidx++;
|
||||
@@ -569,14 +571,14 @@ static void yy_shift(
|
||||
#endif
|
||||
#if YYSTACKDEPTH>0
|
||||
if( yypParser->yyidx>=YYSTACKDEPTH ){
|
||||
yyStackOverflow(yypParser);
|
||||
yyStackOverflow(yypParser, yypMinor);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if( yypParser->yyidx>=yypParser->yystksz ){
|
||||
yyGrowStack(yypParser);
|
||||
if( yypParser->yyidx>=yypParser->yystksz ){
|
||||
yyStackOverflow(yypParser);
|
||||
yyStackOverflow(yypParser, yypMinor);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -584,7 +586,7 @@ static void yy_shift(
|
||||
yytos = &yypParser->yystack[yypParser->yyidx];
|
||||
yytos->stateno = (YYACTIONTYPE)yyNewState;
|
||||
yytos->major = (YYCODETYPE)yyMajor;
|
||||
yytos->minor.yy0 = yyMinor;
|
||||
yytos->minor = *yypMinor;
|
||||
yyTraceShift(yypParser, yyNewState);
|
||||
}
|
||||
|
||||
@@ -610,6 +612,7 @@ static void yy_reduce(
|
||||
){
|
||||
int yygoto; /* The next state */
|
||||
int yyact; /* The next action */
|
||||
YYMINORTYPE yygotominor; /* The LHS of the rule reduced */
|
||||
yyStackEntry *yymsp; /* The top of the parser's stack */
|
||||
int yysize; /* Amount to pop the stack */
|
||||
ParseARG_FETCH;
|
||||
@@ -622,31 +625,7 @@ static void yy_reduce(
|
||||
yyRuleName[yyruleno], yymsp[-yysize].stateno);
|
||||
}
|
||||
#endif /* NDEBUG */
|
||||
|
||||
/* Check that the stack is large enough to grow by a single entry
|
||||
** if the RHS of the rule is empty. This ensures that there is room
|
||||
** enough on the stack to push the LHS value */
|
||||
if( yyRuleInfo[yyruleno].nrhs==0 ){
|
||||
#ifdef YYTRACKMAXSTACKDEPTH
|
||||
if( yypParser->yyidx>yypParser->yyidxMax ){
|
||||
yypParser->yyidxMax = yypParser->yyidx;
|
||||
}
|
||||
#endif
|
||||
#if YYSTACKDEPTH>0
|
||||
if( yypParser->yyidx>=YYSTACKDEPTH-1 ){
|
||||
yyStackOverflow(yypParser);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if( yypParser->yyidx>=yypParser->yystksz-1 ){
|
||||
yyGrowStack(yypParser);
|
||||
if( yypParser->yyidx>=yypParser->yystksz-1 ){
|
||||
yyStackOverflow(yypParser);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
yygotominor = yyzerominor;
|
||||
|
||||
switch( yyruleno ){
|
||||
/* Beginning here are the reduction cases. A typical example
|
||||
@@ -664,17 +643,26 @@ static void yy_reduce(
|
||||
assert( yyruleno>=0 && yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
|
||||
yygoto = yyRuleInfo[yyruleno].lhs;
|
||||
yysize = yyRuleInfo[yyruleno].nrhs;
|
||||
yypParser->yyidx -= yysize;
|
||||
yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
|
||||
if( yyact <= YY_MAX_SHIFTREDUCE ){
|
||||
if( yyact>YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
|
||||
yypParser->yyidx -= yysize - 1;
|
||||
yymsp -= yysize-1;
|
||||
yymsp->stateno = (YYACTIONTYPE)yyact;
|
||||
yymsp->major = (YYCODETYPE)yygoto;
|
||||
yyTraceShift(yypParser, yyact);
|
||||
/* If the reduce action popped at least
|
||||
** one element off the stack, then we can push the new element back
|
||||
** onto the stack here, and skip the stack overflow test in yy_shift().
|
||||
** That gives a significant speed improvement. */
|
||||
if( yysize ){
|
||||
yypParser->yyidx++;
|
||||
yymsp -= yysize-1;
|
||||
yymsp->stateno = (YYACTIONTYPE)yyact;
|
||||
yymsp->major = (YYCODETYPE)yygoto;
|
||||
yymsp->minor = yygotominor;
|
||||
yyTraceShift(yypParser, yyact);
|
||||
}else{
|
||||
yy_shift(yypParser,yyact,yygoto,&yygotominor);
|
||||
}
|
||||
}else{
|
||||
assert( yyact == YY_ACCEPT_ACTION );
|
||||
yypParser->yyidx -= yysize;
|
||||
yy_accept(yypParser);
|
||||
}
|
||||
}
|
||||
@@ -708,10 +696,10 @@ static void yy_parse_failed(
|
||||
static void yy_syntax_error(
|
||||
yyParser *yypParser, /* The parser */
|
||||
int yymajor, /* The major type of the error token */
|
||||
ParseTOKENTYPE yyminor /* The minor type of the error token */
|
||||
YYMINORTYPE yyminor /* The minor type of the error token */
|
||||
){
|
||||
ParseARG_FETCH;
|
||||
#define TOKEN yyminor
|
||||
#define TOKEN (yyminor.yy0)
|
||||
/************ Begin %syntax_error code ****************************************/
|
||||
%%
|
||||
/************ End %syntax_error code ******************************************/
|
||||
@@ -779,14 +767,14 @@ void Parse(
|
||||
if( yypParser->yyidx<0 ){
|
||||
#if YYSTACKDEPTH<=0
|
||||
if( yypParser->yystksz <=0 ){
|
||||
yyStackOverflow(yypParser);
|
||||
/*memset(&yyminorunion, 0, sizeof(yyminorunion));*/
|
||||
yyminorunion = yyzerominor;
|
||||
yyStackOverflow(yypParser, &yyminorunion);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
yypParser->yyidx = 0;
|
||||
#ifndef YYNOERRORRECOVERY
|
||||
yypParser->yyerrcnt = -1;
|
||||
#endif
|
||||
yypParser->yystack[0].stateno = 0;
|
||||
yypParser->yystack[0].major = 0;
|
||||
#ifndef NDEBUG
|
||||
@@ -796,6 +784,7 @@ void Parse(
|
||||
}
|
||||
#endif
|
||||
}
|
||||
yyminorunion.yy0 = yyminor;
|
||||
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
|
||||
yyendofinput = (yymajor==0);
|
||||
#endif
|
||||
@@ -811,16 +800,13 @@ void Parse(
|
||||
yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
|
||||
if( yyact <= YY_MAX_SHIFTREDUCE ){
|
||||
if( yyact > YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
|
||||
yy_shift(yypParser,yyact,yymajor,yyminor);
|
||||
#ifndef YYNOERRORRECOVERY
|
||||
yy_shift(yypParser,yyact,yymajor,&yyminorunion);
|
||||
yypParser->yyerrcnt--;
|
||||
#endif
|
||||
yymajor = YYNOCODE;
|
||||
}else if( yyact <= YY_MAX_REDUCE ){
|
||||
yy_reduce(yypParser,yyact-YY_MIN_REDUCE);
|
||||
}else{
|
||||
assert( yyact == YY_ERROR_ACTION );
|
||||
yyminorunion.yy0 = yyminor;
|
||||
#ifdef YYERRORSYMBOL
|
||||
int yymx;
|
||||
#endif
|
||||
@@ -850,7 +836,7 @@ void Parse(
|
||||
**
|
||||
*/
|
||||
if( yypParser->yyerrcnt<0 ){
|
||||
yy_syntax_error(yypParser,yymajor,yyminor);
|
||||
yy_syntax_error(yypParser,yymajor,yyminorunion);
|
||||
}
|
||||
yymx = yypParser->yystack[yypParser->yyidx].major;
|
||||
if( yymx==YYERRORSYMBOL || yyerrorhit ){
|
||||
@@ -860,10 +846,10 @@ void Parse(
|
||||
yyTracePrompt,yyTokenName[yymajor]);
|
||||
}
|
||||
#endif
|
||||
yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
|
||||
yy_destructor(yypParser, (YYCODETYPE)yymajor,&yyminorunion);
|
||||
yymajor = YYNOCODE;
|
||||
}else{
|
||||
while(
|
||||
while(
|
||||
yypParser->yyidx >= 0 &&
|
||||
yymx != YYERRORSYMBOL &&
|
||||
(yyact = yy_find_reduce_action(
|
||||
@@ -877,7 +863,9 @@ void Parse(
|
||||
yy_parse_failed(yypParser);
|
||||
yymajor = YYNOCODE;
|
||||
}else if( yymx!=YYERRORSYMBOL ){
|
||||
yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);
|
||||
YYMINORTYPE u2;
|
||||
u2.YYERRSYMDT = 0;
|
||||
yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
|
||||
}
|
||||
}
|
||||
yypParser->yyerrcnt = 3;
|
||||
@@ -890,7 +878,7 @@ void Parse(
|
||||
** Applications can set this macro (for example inside %include) if
|
||||
** they intend to abandon the parse upon the first syntax error seen.
|
||||
*/
|
||||
yy_syntax_error(yypParser,yymajor, yyminor);
|
||||
yy_syntax_error(yypParser,yymajor,yyminorunion);
|
||||
yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
|
||||
yymajor = YYNOCODE;
|
||||
|
||||
@@ -905,7 +893,7 @@ void Parse(
|
||||
** three input tokens have been successfully shifted.
|
||||
*/
|
||||
if( yypParser->yyerrcnt<=0 ){
|
||||
yy_syntax_error(yypParser,yymajor, yyminor);
|
||||
yy_syntax_error(yypParser,yymajor,yyminorunion);
|
||||
}
|
||||
yypParser->yyerrcnt = 3;
|
||||
yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
|
||||
|
||||
@@ -10,7 +10,6 @@ gcc -c -Wshadow -Wall -Wextra -pedantic-errors -Wno-long-long -std=c89 \
|
||||
-ansi -DHAVE_STDINT_H -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE \
|
||||
-DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 \
|
||||
sqlite3.c
|
||||
if test x`uname` = 'xLinux'; then
|
||||
echo '********** Android configuration ******************************'
|
||||
gcc -c \
|
||||
-DHAVE_USLEEP=1 \
|
||||
@@ -33,7 +32,6 @@ gcc -c \
|
||||
-DUSE_PREAD64 \
|
||||
-Wshadow -Wall -Wextra \
|
||||
-Os sqlite3.c shell.c
|
||||
fi
|
||||
echo '********** No optimizations. ENABLE_STAT4. THREADSAFE=0 *******'
|
||||
gcc -c -Wshadow -Wall -Wextra -pedantic-errors -Wno-long-long -std=c89 \
|
||||
-ansi -DSQLITE_ENABLE_STAT4 -DSQLITE_THREADSAFE=0 \
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<Application
|
||||
x:Class="vsixtest.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:vsixtest"
|
||||
RequestedTheme="Light">
|
||||
|
||||
</Application>
|
||||
@@ -1,120 +0,0 @@
|
||||
//
|
||||
// App.xaml.cpp
|
||||
// Implementation of the App class.
|
||||
//
|
||||
|
||||
#include "pch.h"
|
||||
#include "MainPage.xaml.h"
|
||||
|
||||
using namespace vsixtest;
|
||||
|
||||
using namespace Platform;
|
||||
using namespace Windows::ApplicationModel;
|
||||
using namespace Windows::ApplicationModel::Activation;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::UI::Xaml::Controls::Primitives;
|
||||
using namespace Windows::UI::Xaml::Data;
|
||||
using namespace Windows::UI::Xaml::Input;
|
||||
using namespace Windows::UI::Xaml::Interop;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::UI::Xaml::Navigation;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the singleton application object. This is the first line of authored code
|
||||
/// executed, and as such is the logical equivalent of main() or WinMain().
|
||||
/// </summary>
|
||||
App::App()
|
||||
{
|
||||
InitializeComponent();
|
||||
Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when the application is launched normally by the end user. Other entry points
|
||||
/// will be used such as when the application is launched to open a specific file.
|
||||
/// </summary>
|
||||
/// <param name="e">Details about the launch request and process.</param>
|
||||
void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e)
|
||||
{
|
||||
|
||||
#if _DEBUG
|
||||
// Show graphics profiling information while debugging.
|
||||
if (IsDebuggerPresent())
|
||||
{
|
||||
// Display the current frame rate counters
|
||||
DebugSettings->EnableFrameRateCounter = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
auto rootFrame = dynamic_cast<Frame^>(Window::Current->Content);
|
||||
|
||||
// Do not repeat app initialization when the Window already has content,
|
||||
// just ensure that the window is active
|
||||
if (rootFrame == nullptr)
|
||||
{
|
||||
// Create a Frame to act as the navigation context and associate it with
|
||||
// a SuspensionManager key
|
||||
rootFrame = ref new Frame();
|
||||
|
||||
rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed);
|
||||
|
||||
if (e->PreviousExecutionState == ApplicationExecutionState::Terminated)
|
||||
{
|
||||
// TODO: Restore the saved session state only when appropriate, scheduling the
|
||||
// final launch steps after the restore is complete
|
||||
|
||||
}
|
||||
|
||||
if (rootFrame->Content == nullptr)
|
||||
{
|
||||
// When the navigation stack isn't restored navigate to the first page,
|
||||
// configuring the new page by passing required information as a navigation
|
||||
// parameter
|
||||
rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
|
||||
}
|
||||
// Place the frame in the current Window
|
||||
Window::Current->Content = rootFrame;
|
||||
// Ensure the current window is active
|
||||
Window::Current->Activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rootFrame->Content == nullptr)
|
||||
{
|
||||
// When the navigation stack isn't restored navigate to the first page,
|
||||
// configuring the new page by passing required information as a navigation
|
||||
// parameter
|
||||
rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
|
||||
}
|
||||
// Ensure the current window is active
|
||||
Window::Current->Activate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when application execution is being suspended. Application state is saved
|
||||
/// without knowing whether the application will be terminated or resumed with the contents
|
||||
/// of memory still intact.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the suspend request.</param>
|
||||
/// <param name="e">Details about the suspend request.</param>
|
||||
void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
|
||||
{
|
||||
(void) sender; // Unused parameter
|
||||
(void) e; // Unused parameter
|
||||
|
||||
//TODO: Save application state and stop any background activity
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when Navigation to a certain page fails
|
||||
/// </summary>
|
||||
/// <param name="sender">The Frame which failed navigation</param>
|
||||
/// <param name="e">Details about the navigation failure</param>
|
||||
void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e)
|
||||
{
|
||||
throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
//
|
||||
// App.xaml.h
|
||||
// Declaration of the App class.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "App.g.h"
|
||||
|
||||
namespace vsixtest
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
||||
/// </summary>
|
||||
ref class App sealed
|
||||
{
|
||||
protected:
|
||||
virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override;
|
||||
|
||||
internal:
|
||||
App();
|
||||
|
||||
private:
|
||||
void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
|
||||
void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e);
|
||||
};
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
@@ -1,13 +0,0 @@
|
||||
<Page
|
||||
x:Class="vsixtest.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:vsixtest"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -1,53 +0,0 @@
|
||||
//
|
||||
// MainPage.xaml.cpp
|
||||
// Implementation of the MainPage class.
|
||||
//
|
||||
|
||||
#include "pch.h"
|
||||
#include "MainPage.xaml.h"
|
||||
#include "sqlite3.h"
|
||||
|
||||
using namespace vsixtest;
|
||||
|
||||
using namespace Platform;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::UI::Xaml::Controls::Primitives;
|
||||
using namespace Windows::UI::Xaml::Data;
|
||||
using namespace Windows::UI::Xaml::Input;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::UI::Xaml::Navigation;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
||||
|
||||
MainPage::MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
UseSQLite();
|
||||
}
|
||||
|
||||
void MainPage::UseSQLite(void)
|
||||
{
|
||||
int rc = SQLITE_OK;
|
||||
sqlite3 *pDb = nullptr;
|
||||
|
||||
rc = sqlite3_open_v2("test.db", &pDb,
|
||||
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr);
|
||||
|
||||
if (rc != SQLITE_OK)
|
||||
throw ref new FailureException("Failed to open database.");
|
||||
|
||||
rc = sqlite3_exec(pDb, "VACUUM;", nullptr, nullptr, nullptr);
|
||||
|
||||
if (rc != SQLITE_OK)
|
||||
throw ref new FailureException("Failed to vacuum database.");
|
||||
|
||||
rc = sqlite3_close(pDb);
|
||||
|
||||
if (rc != SQLITE_OK)
|
||||
throw ref new FailureException("Failed to close database.");
|
||||
|
||||
pDb = nullptr;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
//
|
||||
// MainPage.xaml.h
|
||||
// Declaration of the MainPage class.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MainPage.g.h"
|
||||
|
||||
namespace vsixtest
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public ref class MainPage sealed
|
||||
{
|
||||
public:
|
||||
MainPage();
|
||||
void UseSQLite(void);
|
||||
|
||||
};
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
IgnorableNamespaces="uap mp">
|
||||
|
||||
<Identity
|
||||
Name="bb52b3e1-5c8a-4516-a5ff-8b9f9baadef7"
|
||||
Publisher="CN=mistachkin"
|
||||
Version="1.0.0.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="bb52b3e1-5c8a-4516-a5ff-8b9f9baadef7" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<DisplayName>vsixtest</DisplayName>
|
||||
<PublisherDisplayName>mistachkin</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate"/>
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App"
|
||||
Executable="$targetnametoken$.exe"
|
||||
EntryPoint="vsixtest.App">
|
||||
<uap:VisualElements
|
||||
DisplayName="vsixtest"
|
||||
Square150x150Logo="Assets\Square150x150Logo.png"
|
||||
Square44x44Logo="Assets\Square44x44Logo.png"
|
||||
Description="vsixtest"
|
||||
BackgroundColor="transparent">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
</Capabilities>
|
||||
</Package>
|
||||
@@ -1,6 +0,0 @@
|
||||
//
|
||||
// pch.cpp
|
||||
// Include the standard header and generate the precompiled header.
|
||||
//
|
||||
|
||||
#include "pch.h"
|
||||