diff --git a/Makefile.in b/Makefile.in index e1c3ea1999..899354b398 100644 --- a/Makefile.in +++ b/Makefile.in @@ -612,7 +612,7 @@ TESTOPTS = --verbose=file --output=test-out.txt # Extra compiler options for various shell tools # -SHELL_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4 +SHELL_OPT = -DSQLITE_ENABLE_FTS4 #SHELL_OPT += -DSQLITE_ENABLE_FTS5 SHELL_OPT += -DSQLITE_ENABLE_RTREE SHELL_OPT += -DSQLITE_ENABLE_EXPLAIN_COMMENTS @@ -622,8 +622,8 @@ SHELL_OPT += -DSQLITE_ENABLE_DBPAGE_VTAB SHELL_OPT += -DSQLITE_ENABLE_DBSTAT_VTAB SHELL_OPT += -DSQLITE_ENABLE_BYTECODE_VTAB SHELL_OPT += -DSQLITE_ENABLE_OFFSET_SQL_FUNC -FUZZERSHELL_OPT = -DSQLITE_ENABLE_JSON1 -FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ +FUZZERSHELL_OPT = +FUZZCHECK_OPT = -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ FUZZCHECK_OPT += -DSQLITE_MAX_MEMORY=50000000 FUZZCHECK_OPT += -DSQLITE_PRINTF_PRECISION_LIMIT=1000 FUZZCHECK_OPT += -DSQLITE_ENABLE_FTS4 diff --git a/Makefile.msc b/Makefile.msc index 3b14a53626..e69257d41e 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -363,7 +363,6 @@ SQLITE_TCL_DEP = OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_GEOPOLY=1 -OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_JSON1=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1 @@ -1697,9 +1696,9 @@ SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1 # <> # Extra compiler options for various test tools. # -MPTESTER_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -FUZZERSHELL_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1 -FUZZCHECK_OPTS = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ -DSQLITE_MAX_MEMORY=50000000 -DSQLITE_PRINTF_PRECISION_LIMIT=1000 +MPTESTER_COMPILE_OPTS = -DSQLITE_ENABLE_FTS5 +FUZZERSHELL_COMPILE_OPTS = +FUZZCHECK_OPTS = -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ -DSQLITE_MAX_MEMORY=50000000 -DSQLITE_PRINTF_PRECISION_LIMIT=1000 FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_FTS4 FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_FTS5 FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_RTREE @@ -2394,7 +2393,6 @@ TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_DEFAULT_PAGE_SIZE=1024 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1 -TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_JSON1=1 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CKSUMVFS_STATIC=1 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) $(TEST_CCONV_OPTS) diff --git a/autoconf/Makefile.msc b/autoconf/Makefile.msc index 524aeb6f41..e36eb21ea0 100644 --- a/autoconf/Makefile.msc +++ b/autoconf/Makefile.msc @@ -285,7 +285,6 @@ SQLITE3EXEPDB = /pdb:sqlite3sh.pdb OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_GEOPOLY=1 -OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_JSON1=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1 diff --git a/autoconf/README.txt b/autoconf/README.txt index 6e62a4e138..ccf5e235ac 100644 --- a/autoconf/README.txt +++ b/autoconf/README.txt @@ -105,7 +105,7 @@ may be specified in this manner as some require the amalgamation to be built with them enabled (see http://www.sqlite.org/compile.html). For example, the following will work: - "OPTS=-DSQLITE_ENABLE_STAT4=1 -DSQLITE_ENABLE_JSON1=1" + "OPTS=-DSQLITE_ENABLE_STAT4=1 -DSQLITE_OMIT_JSON=1" However, the following will not compile unless the amalgamation was built with it enabled: diff --git a/autoconf/configure.ac b/autoconf/configure.ac index e050786bd7..0c7a32db1f 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -173,21 +173,6 @@ else fi #----------------------------------------------------------------------- -#----------------------------------------------------------------------- -# --enable-json1 -# -AC_ARG_ENABLE(json1, [AS_HELP_STRING( - [--enable-json1], [include json1 support [default=yes]])], - [],[enable_json1=yes]) -AC_MSG_CHECKING([JSON functions]) -if test x"$enable_json1" = "xyes"; then - BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_JSON1" - AC_MSG_RESULT([enabled]) -else - AC_MSG_RESULT([disabled]) -fi -#----------------------------------------------------------------------- - #----------------------------------------------------------------------- # --enable-rtree # diff --git a/ext/lsm1/lsm_vtab.c b/ext/lsm1/lsm_vtab.c index f96a6bbd71..bb1460297d 100644 --- a/ext/lsm1/lsm_vtab.c +++ b/ext/lsm1/lsm_vtab.c @@ -26,7 +26,7 @@ ** ** The virtual table contains read-only hidden columns: ** -** lsm1_key A BLOB which is the raw LSM key. If the "keytype" +** lsm1_key A BLOB which is the raw LSM key. If the "keytype" ** is BLOB or TEXT then this column is exactly the ** same as the key. For the UINT keytype, this column ** will be a variable-length integer encoding of the key. diff --git a/ext/misc/csv.c b/ext/misc/csv.c index d08ddd6b3a..b51fbad30e 100644 --- a/ext/misc/csv.c +++ b/ext/misc/csv.c @@ -941,7 +941,7 @@ int sqlite3_csv_init( char **pzErrMsg, const sqlite3_api_routines *pApi ){ -#ifndef SQLITE_OMIT_VIRTUALTABLE +#ifndef SQLITE_OMIT_VIRTUALTABLE int rc; SQLITE_EXTENSION_INIT2(pApi); rc = sqlite3_create_module(db, "csv", &CsvModule, 0); diff --git a/ext/misc/ieee754.c b/ext/misc/ieee754.c index 66d946f3d5..ff5d2d333c 100644 --- a/ext/misc/ieee754.c +++ b/ext/misc/ieee754.c @@ -284,7 +284,7 @@ int sqlite3_ieee_init( SQLITE_EXTENSION_INIT2(pApi); (void)pzErrMsg; /* Unused parameter */ for(i=0; imDbFlags |= DBFLAG_PreferBuiltin; sqlite3RunParser(pParse, zSql); + sqlite3DbFree(db, pParse->zErrMsg); + pParse->zErrMsg = 0; db->mDbFlags = savedDbFlags; sqlite3DbFree(db, zSql); memcpy(PARSE_TAIL(pParse), saveBuf, PARSE_TAIL_SZ); diff --git a/src/date.c b/src/date.c index a510d62750..b96ebc05d2 100644 --- a/src/date.c +++ b/src/date.c @@ -574,8 +574,8 @@ static int toLocaltime( memset(&sLocal, 0, sizeof(sLocal)); computeJD(p); - if( p->iJD<21086676000*(i64)10000 /* 1970-01-01 */ - || p->iJD>21301414560*(i64)10000 /* 2038-01-18 */ + if( p->iJD<2108667600*(i64)100000 /* 1970-01-01 */ + || p->iJD>2130141456*(i64)100000 /* 2038-01-18 */ ){ /* EVIDENCE-OF: R-55269-29598 The localtime_r() C function normally only ** works for years between 1970 and 2037. For dates outside this range, @@ -681,7 +681,9 @@ static int parseModifier( if( !p->rawS || p->validJD ){ rc = 0; p->rawS = 0; - }else if( p->s>=-210866760000 && p->s<=253402300799 ){ + }else if( p->s>=-21086676*(i64)10000 /* -4713-11-24 12:00:00 */ + && p->s<=(25340230*(i64)10000)+799 /* 9999-12-31 23:59:59 */ + ){ r = p->s*1000.0 + 210866760000000.0; clearYMD_HMS_TZ(p); p->iJD = (sqlite3_int64)(r + 0.5); diff --git a/src/shell.c.in b/src/shell.c.in index c9ae8d2c89..bc107e9255 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -4246,6 +4246,7 @@ static const char *(azHelp[]) = { ".auth ON|OFF Show authorizer callbacks", #endif ".backup ?DB? FILE Backup DB (default \"main\") to FILE", + " Options:", " --append Use the appendvfs", " --async Write to FILE without journal and fsync()", ".bail on|off Stop after hitting an error. Default OFF", @@ -4393,7 +4394,7 @@ static const char *(azHelp[]) = { " that are not also INTEGER PRIMARY KEYs", #endif ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE", - ".save FILE Write in-memory database into FILE", + ".save ?OPTIONS? FILE Write database to FILE (an alias for .backup ...)", ".scanstats on|off Turn sqlite3_stmt_scanstatus() metrics on or off", ".schema ?PATTERN? Show the CREATE statements matching PATTERN", " Options:", diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 5164cf329c..42e4bf2f61 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -4285,6 +4285,10 @@ const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt); ** be false. ^Similarly, a CREATE TABLE IF NOT EXISTS statement is a ** read-only no-op if the table already exists, but ** sqlite3_stmt_readonly() still returns false for such a statement. +** +** ^If prepared statement X is an [EXPLAIN] or [EXPLAIN QUERY PLAN] +** statement, then sqlite3_stmt_readonly(X) returns the same value as +** if the EXPLAIN or EXPLAIN QUERY PLAN prefix were omitted. */ int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); diff --git a/src/tclsqlite.c b/src/tclsqlite.c index efd0cb3a87..b0b6b4371e 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -1943,15 +1943,16 @@ static int SQLITE_TCLAPI DbObjCmd( "close", "collate", "collation_needed", "commit_hook", "complete", "config", "copy", "deserialize", "enable_load_extension", - "errorcode", "eval", "exists", - "function", "incrblob", "interrupt", - "last_insert_rowid", "nullvalue", "onecolumn", - "preupdate", "profile", "progress", - "rekey", "restore", "rollback_hook", - "serialize", "status", "timeout", - "total_changes", "trace", "trace_v2", - "transaction", "unlock_notify", "update_hook", - "version", "wal_hook", 0 + "errorcode", "erroroffset", "eval", + "exists", "function", "incrblob", + "interrupt", "last_insert_rowid", "nullvalue", + "onecolumn", "preupdate", "profile", + "progress", "rekey", "restore", + "rollback_hook", "serialize", "status", + "timeout", "total_changes", "trace", + "trace_v2", "transaction", "unlock_notify", + "update_hook", "version", "wal_hook", + 0 }; enum DB_enum { DB_AUTHORIZER, DB_BACKUP, DB_BIND_FALLBACK, @@ -1959,15 +1960,15 @@ static int SQLITE_TCLAPI DbObjCmd( DB_CLOSE, DB_COLLATE, DB_COLLATION_NEEDED, DB_COMMIT_HOOK, DB_COMPLETE, DB_CONFIG, DB_COPY, DB_DESERIALIZE, DB_ENABLE_LOAD_EXTENSION, - DB_ERRORCODE, DB_EVAL, DB_EXISTS, - DB_FUNCTION, DB_INCRBLOB, DB_INTERRUPT, - DB_LAST_INSERT_ROWID, DB_NULLVALUE, DB_ONECOLUMN, - DB_PREUPDATE, DB_PROFILE, DB_PROGRESS, - DB_REKEY, DB_RESTORE, DB_ROLLBACK_HOOK, - DB_SERIALIZE, DB_STATUS, DB_TIMEOUT, - DB_TOTAL_CHANGES, DB_TRACE, DB_TRACE_V2, - DB_TRANSACTION, DB_UNLOCK_NOTIFY, DB_UPDATE_HOOK, - DB_VERSION, DB_WAL_HOOK + DB_ERRORCODE, DB_ERROROFFSET, DB_EVAL, + DB_EXISTS, DB_FUNCTION, DB_INCRBLOB, + DB_INTERRUPT, DB_LAST_INSERT_ROWID, DB_NULLVALUE, + DB_ONECOLUMN, DB_PREUPDATE, DB_PROFILE, + DB_PROGRESS, DB_REKEY, DB_RESTORE, + DB_ROLLBACK_HOOK, DB_SERIALIZE, DB_STATUS, + DB_TIMEOUT, DB_TOTAL_CHANGES, DB_TRACE, + DB_TRACE_V2, DB_TRANSACTION, DB_UNLOCK_NOTIFY, + DB_UPDATE_HOOK, DB_VERSION, DB_WAL_HOOK, }; /* don't leave trailing commas on DB_enum, it confuses the AIX xlc compiler */ @@ -2730,6 +2731,17 @@ deserialize_error: break; } + /* + ** $db erroroffset + ** + ** Return the numeric error code that was returned by the most recent + ** call to sqlite3_exec(). + */ + case DB_ERROROFFSET: { + Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_error_offset(pDb->db))); + break; + } + /* ** $db exists $sql ** $db onecolumn $sql diff --git a/src/test_config.c b/src/test_config.c index e2919eac69..1288fcac91 100644 --- a/src/test_config.c +++ b/src/test_config.c @@ -239,7 +239,7 @@ static void set_options(Tcl_Interp *interp){ Tcl_SetVar2(interp, "sqlite_options", "geopoly", "0", TCL_GLOBAL_ONLY); #endif -#ifdef SQLITE_ENABLE_JSON1 +#ifndef SQLITE_OMIT_JSON Tcl_SetVar2(interp, "sqlite_options", "json1", "1", TCL_GLOBAL_ONLY); #else Tcl_SetVar2(interp, "sqlite_options", "json1", "0", TCL_GLOBAL_ONLY); diff --git a/src/vdbe.c b/src/vdbe.c index cef65c9744..a45c849dca 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -3243,7 +3243,7 @@ case OP_MakeRecord: { testcase( uu==127 ); testcase( uu==128 ); testcase( uu==32767 ); testcase( uu==32768 ); testcase( uu==8388607 ); testcase( uu==8388608 ); - testcase( uu==2147483647 ); testcase( uu==2147483648 ); + testcase( uu==2147483647 ); testcase( uu==2147483648LL ); testcase( uu==140737488355327LL ); testcase( uu==140737488355328LL ); if( uu<=127 ){ if( (i&1)==i && file_format>=4 ){ diff --git a/src/vdbemem.c b/src/vdbemem.c index 5d2d69268e..e840f6586c 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -1645,7 +1645,7 @@ static int valueFromExpr( no_mem: #ifdef SQLITE_ENABLE_STAT4 - if( pCtx==0 || pCtx->pParse->nErr==0 ) + if( pCtx==0 || NEVER(pCtx->pParse->nErr==0) ) #endif sqlite3OomFault(db); sqlite3DbFree(db, zVal); diff --git a/test/capi3d.test b/test/capi3d.test index b56d7929b0..7cad2870cd 100644 --- a/test/capi3d.test +++ b/test/capi3d.test @@ -100,8 +100,32 @@ proc test_is_readonly {testname sql truth} { sqlite3_finalize $STMT set rc } $sql] $truth + + # EVIDENCE-OF: R-61212-30018 If prepared statement X is an EXPLAIN or + # EXPLAIN QUERY PLAN statement, then sqlite3_stmt_readonly(X) returns + # the same value as if the EXPLAIN or EXPLAIN QUERY PLAN prefix were + # omitted. + # + do_test $testname.explain [format { + set DB [sqlite3_connection_pointer db] + set STMT [sqlite3_prepare $DB {EXPLAIN %s} -1 TAIL] + set rc [sqlite3_stmt_readonly $STMT] + sqlite3_finalize $STMT + set rc + } $sql] $truth + do_test $testname.eqp [format { + set DB [sqlite3_connection_pointer db] + set STMT [sqlite3_prepare $DB {EXPLAIN QUERY PLAN %s} -1 TAIL] + set rc [sqlite3_stmt_readonly $STMT] + sqlite3_finalize $STMT + set rc + } $sql] $truth } +# EVIDENCE-OF: R-23332-64992 The sqlite3_stmt_readonly(X) interface +# returns true (non-zero) if and only if the prepared statement X makes +# no direct changes to the content of the database file. +# test_is_readonly capi3d-2.1 {SELECT * FROM sqlite_master} 1 test_is_readonly capi3d-2.2 {CREATE TABLE t1(x)} 0 db eval {CREATE TABLE t1(x)} @@ -120,6 +144,68 @@ do_test capi3-2.49 { } 1 +# EVIDENCE-OF: R-04929-09147 This routine returns false if there is any +# possibility that the statement might change the database file. +# +# EVIDENCE-OF: R-13288-53765 A false return does not guarantee that the +# statement will change the database file. +# +# EVIDENCE-OF: R-22182-18548 For example, an UPDATE statement might have +# a WHERE clause that makes it a no-op, but the sqlite3_stmt_readonly() +# result would still be false. +# +# EVIDENCE-OF: R-50998-48593 Similarly, a CREATE TABLE IF NOT EXISTS +# statement is a read-only no-op if the table already exists, but +# sqlite3_stmt_readonly() still returns false for such a statement. +# +db eval { + CREATE TABLE t2(a,b,c); + INSERT INTO t2 VALUES(1,2,3); +} +test_is_readonly capi3d-2.11 {UPDATE t2 SET a=a+1 WHERE false} 0 +test_is_readonly capi3d-2.12 {CREATE TABLE IF NOT EXISTS t2(x,y)} 0 + + +# EVIDENCE-OF: R-37014-01401 The ATTACH and DETACH statements also cause +# sqlite3_stmt_readonly() to return true since, while those statements +# change the configuration of a database connection, they do not make +# changes to the content of the database files on disk. +# +test_is_readonly capi3d-2.13 {ATTACH ':memory:' AS mem1} 1 +db eval {ATTACH ':memory:' AS mem1} +test_is_readonly capi3d-2.14 {DETACH mem1} 1 +db eval {DETACH mem1} + +# EVIDENCE-OF: R-07474-04783 Transaction control statements such as +# BEGIN, COMMIT, ROLLBACK, SAVEPOINT, and RELEASE cause +# sqlite3_stmt_readonly() to return true, since the statements +# themselves do not actually modify the database but rather they control +# the timing of when other statements modify the database. +# +test_is_readonly capi3d-2.15 {BEGIN} 1 +test_is_readonly capi3d-2.16 {COMMIT} 1 +test_is_readonly capi3d-2.17 {SAVEPOINT one} 1 +test_is_readonly capi3d-2.18 {RELEASE one} 1 + +# EVIDENCE-OF: R-36961-63052 The sqlite3_stmt_readonly() interface +# returns true for BEGIN since BEGIN merely sets internal flags, but the +# BEGIN IMMEDIATE and BEGIN EXCLUSIVE commands do touch the database and +# so sqlite3_stmt_readonly() returns false for those commands. +# +test_is_readonly capi3d-2.19 {BEGIN IMMEDIATE} 0 +test_is_readonly capi3d-2.20 {BEGIN EXCLUSIVE} 0 + +# EVIDENCE-OF: R-21769-42523 For example, if an application defines a +# function "eval()" that calls sqlite3_exec(), then the following SQL +# statement would change the database file through side-effects: SELECT +# eval('DELETE FROM t1') FROM t2; But because the SELECT statement does +# not change the database file directly, sqlite3_stmt_readonly() would +# still return true. +# +proc evalsql {sql} {db eval $sql} +db func eval evalsql +test_is_readonly capi3d-2.21 {SELECT eval('DELETE FROM t1') FROM t2} 1 + # Tests for the is-explain interface. # proc test_is_explain {testname sql truth} { diff --git a/test/releasetest_data.tcl b/test/releasetest_data.tcl index 45966fd233..314331aeef 100644 --- a/test/releasetest_data.tcl +++ b/test/releasetest_data.tcl @@ -99,7 +99,6 @@ array set ::Configs [strip_comments { -DSQLITE_ENABLE_STMT_SCANSTATUS -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_ENABLE_CURSOR_HINTS - --enable-json1 } "Check-Symbols" { -DSQLITE_MEMDEBUG=1 @@ -117,7 +116,7 @@ array set ::Configs [strip_comments { -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1 -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_STMT_SCANSTATUS - --enable-json1 --enable-fts5 --enable-session + --enable-fts5 --enable-session } "Debug-One" { --disable-shared @@ -134,7 +133,7 @@ array set ::Configs [strip_comments { -DSQLITE_ENABLE_HIDDEN_COLUMNS -DSQLITE_MAX_ATTACHED=125 -DSQLITE_MUTATION_TEST - --enable-fts5 --enable-json1 + --enable-fts5 } "Debug-Two" { -DSQLITE_DEFAULT_MEMSTATUS=0 @@ -170,7 +169,6 @@ array set ::Configs [strip_comments { -DSQLITE_OMIT_VIRTUALTABLE=1 -DSQLITE_ENABLE_HIDDEN_COLUMNS -DSQLITE_TEMP_STORE=3 - --enable-json1 } "Device-Two" { -DSQLITE_4_BYTE_ALIGNED_MALLOC=1 @@ -188,7 +186,7 @@ array set ::Configs [strip_comments { -DSQLITE_OMIT_TRACE=1 -DSQLITE_TEMP_STORE=3 -DSQLITE_THREADSAFE=2 - --enable-json1 --enable-fts5 --enable-session + --enable-fts5 --enable-session } "Locking-Style" { -O2 @@ -232,7 +230,7 @@ array set ::Configs [strip_comments { -DSQLITE_WRITE_WALFRAME_PREBUFFERED=1 -DUSE_GUARDED_FD=1 -DUSE_PREAD=1 - --enable-json1 --enable-fts5 + --enable-fts5 } "Extra-Robustness" { -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1 @@ -247,7 +245,7 @@ array set ::Configs [strip_comments { -DSQLITE_ENABLE_FTS4_PARENTHESIS -DSQLITE_DISABLE_FTS4_DEFERRED -DSQLITE_ENABLE_RTREE - --enable-json1 --enable-fts5 + --enable-fts5 } "No-lookaside" { -DSQLITE_TEST_REALLOC_STRESS=1 @@ -259,7 +257,6 @@ array set ::Configs [strip_comments { -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_HIDDEN_COLUMNS -DCONFIG_SLOWDOWN_FACTOR=8.0 - --enable-json1 } "Windows-Memdebug" { @@ -503,9 +500,6 @@ proc main_script {args} { --enable-fts5 { lappend opts -DSQLITE_ENABLE_FTS5 } - --enable-json1 { - lappend opts -DSQLITE_ENABLE_JSON1 - } --enable-shared { lappend makeOpts USE_CRT_DLL=1 DYNAMIC_SHELL=1 } diff --git a/test/shell5.test b/test/shell5.test index 7599edbbe2..2237e685d5 100644 --- a/test/shell5.test +++ b/test/shell5.test @@ -479,6 +479,7 @@ CREATE TABLE t8(a, b, c); #---------------------------------------------------------------------------- # Tests for the shell automatic column rename. # +db close # Import columns containing duplicates do_test shell5-5.1 { diff --git a/test/tclsqlite.test b/test/tclsqlite.test index e99f8c4788..546931a6f3 100644 --- a/test/tclsqlite.test +++ b/test/tclsqlite.test @@ -45,7 +45,7 @@ do_test tcl-1.1.1 { do_test tcl-1.2 { set v [catch {db bogus} msg] lappend v $msg -} {1 {bad option "bogus": must be authorizer, backup, bind_fallback, busy, cache, changes, close, collate, collation_needed, commit_hook, complete, config, copy, deserialize, enable_load_extension, errorcode, eval, exists, function, incrblob, interrupt, last_insert_rowid, nullvalue, onecolumn, preupdate, profile, progress, rekey, restore, rollback_hook, serialize, status, timeout, total_changes, trace, trace_v2, transaction, unlock_notify, update_hook, version, or wal_hook}} +} {1 {bad option "bogus": must be authorizer, backup, bind_fallback, busy, cache, changes, close, collate, collation_needed, commit_hook, complete, config, copy, deserialize, enable_load_extension, errorcode, erroroffset, eval, exists, function, incrblob, interrupt, last_insert_rowid, nullvalue, onecolumn, preupdate, profile, progress, rekey, restore, rollback_hook, serialize, status, timeout, total_changes, trace, trace_v2, transaction, unlock_notify, update_hook, version, or wal_hook}} do_test tcl-1.2.1 { set v [catch {db cache bogus} msg] lappend v $msg @@ -886,5 +886,10 @@ do_test 20.2 { list $rc $msg } {0 {10 1 20 30 30 40}} -finish_test +sqlite3 db :memory: +do_test 21.1 { + catch {db eval {SELECT 1 2 3;}} msg + db erroroffset +} {9} +finish_test diff --git a/tool/omittest.tcl b/tool/omittest.tcl index 9f24d6d3d3..b54f2984d4 100644 --- a/tool/omittest.tcl +++ b/tool/omittest.tcl @@ -218,6 +218,7 @@ proc main {argv} { SQLITE_OMIT_INCRBLOB \ SQLITE_OMIT_INTEGRITY_CHECK \ SQLITE_OMIT_INTROSPECTION_PRAGMAS \ + SQLITE_OMIT_JSON \ SQLITE_OMIT_LIKE_OPTIMIZATION \ SQLITE_OMIT_LOAD_EXTENSION \ SQLITE_OMIT_LOCALTIME \ diff --git a/tool/sqldiff.c b/tool/sqldiff.c index da444bf9af..0a017037cf 100644 --- a/tool/sqldiff.c +++ b/tool/sqldiff.c @@ -407,31 +407,31 @@ static void printQuoted(FILE *out, sqlite3_value *X){ if( zArg==0 ){ fprintf(out, "NULL"); }else{ - int inctl = 0; - int i, j; + int inctl = 0; + int i, j; fprintf(out, "'"); - for(i=j=0; zArg[i]; i++){ - char c = zArg[i]; - int ctl = iscntrl(c); - if( ctl>inctl ){ - inctl = ctl; - fprintf(out, "%.*s'||X'%02x", i-j, &zArg[j], c); - j = i+1; - }else if( ctl ){ - fprintf(out, "%02x", c); - j = i+1; - }else{ - if( inctl ){ - inctl = 0; - fprintf(out, "'\n||'"); - } - if( c=='\'' ){ - fprintf(out, "%.*s'", i-j+1, &zArg[j]); - j = i+1; - } - } - } - fprintf(out, "%s'", &zArg[j]); + for(i=j=0; zArg[i]; i++){ + char c = zArg[i]; + int ctl = iscntrl(c); + if( ctl>inctl ){ + inctl = ctl; + fprintf(out, "%.*s'||X'%02x", i-j, &zArg[j], c); + j = i+1; + }else if( ctl ){ + fprintf(out, "%02x", c); + j = i+1; + }else{ + if( inctl ){ + inctl = 0; + fprintf(out, "'\n||'"); + } + if( c=='\'' ){ + fprintf(out, "%.*s'", i-j+1, &zArg[j]); + j = i+1; + } + } + } + fprintf(out, "%s'", &zArg[j]); } break; } diff --git a/tool/warnings.sh b/tool/warnings.sh index 0754a0f3f6..a839d235b6 100644 --- a/tool/warnings.sh +++ b/tool/warnings.sh @@ -20,7 +20,7 @@ echo '********** No optimizations. Includes FTS4/5, GEOPOLY, JSON1 ***' echo '********** ' Options: $WARNING_OPTS gcc -c $WARNING_OPTS -std=c89 \ -ansi -DHAVE_STDINT_H -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_GEOPOLY \ - -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 \ + -DSQLITE_ENABLE_FTS5 \ sqlite3.c if test x`uname` = 'xLinux'; then echo '********** Android configuration ******************************' @@ -56,5 +56,5 @@ echo '********** Optimized -O3. Includes FTS4/5, GEOPOLY, JSON1 ******' echo '********** ' Options: $WARNING_OPTS gcc -O3 -c $WARNING_OPTS -std=c89 \ -ansi -DHAVE_STDINT_H -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_GEOPOLY \ - -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 \ + -DSQLITE_ENABLE_FTS5 \ sqlite3.c