SQLite

Changes On Branch branch-3.21
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch branch-3.21 Excluding Merge-Ins

This is equivalent to a diff from f317037b to 1a584e49

2017-10-24
19:12
Merge all enhancements and fixes from the 3.21.0 release. (check-in: 13be3a44 user: drh tags: apple-osx)
19:05
Merge all of the fixes from the 3.21.0 release. (check-in: 5ab662b4 user: drh tags: trunk)
18:55
Version 3.21.0 (Leaf check-in: 1a584e49 user: drh tags: release, branch-3.21, version-3.21.0)
17:28
Fix a problem in the incr-blob code causing a new cursor to be opened for every sqlite3_blob_reopen() call. (check-in: 41ef34a1 user: dan tags: branch-3.21)
2017-10-23
20:20
Merge trunk fixes to swarmvtabfault.test and the lsm extension into this branch. No changes to core SQLite code. (check-in: f632b870 user: dan tags: branch-3.21)
20:17
In the 'swarmvtabfault' test module, make sure to close the database handle prior to raising an error from the 'not found' callback script. (check-in: f317037b user: mistachkin tags: trunk)
17:36
Cleanup a test database file prior to using it. (check-in: e1bf5e1d user: mistachkin tags: trunk)

Changes to autoconf/Makefile.am.

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20












-
+








AM_CFLAGS = @THREADSAFE_FLAGS@ @DYNAMIC_EXTENSION_FLAGS@ @FTS5_FLAGS@ @JSON1_FLAGS@ @SESSION_FLAGS@ -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE

lib_LTLIBRARIES = libsqlite3.la
libsqlite3_la_SOURCES = sqlite3.c
libsqlite3_la_LDFLAGS = -no-undefined -version-info 8:6:8

bin_PROGRAMS = sqlite3
sqlite3_SOURCES = shell.c sqlite3.h
EXTRA_sqlite3_SOURCES = sqlite3.c
sqlite3_LDADD = @EXTRA_SHELL_OBJ@ @READLINE_LIBS@
sqlite3_DEPENDENCIES = @EXTRA_SHELL_OBJ@
sqlite3_CFLAGS = $(AM_CFLAGS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS
sqlite3_CFLAGS = $(AM_CFLAGS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_DBSTAT_VTAB

include_HEADERS = sqlite3.h sqlite3ext.h

EXTRA_DIST = sqlite3.1 tea Makefile.msc sqlite3.rc README.txt Replace.cs
pkgconfigdir = ${libdir}/pkgconfig
pkgconfig_DATA = sqlite3.pc

Changes to src/expr.c.

2674
2675
2676
2677
2678
2679
2680
2681

2682
2683
2684
2685
2686
2687
2688
2674
2675
2676
2677
2678
2679
2680

2681
2682
2683
2684
2685
2686
2687
2688







-
+







          assert( sqlite3KeyInfoIsWriteable(pKeyInfo) );
          pKeyInfo->aColl[0] = sqlite3ExprCollSeq(pParse, pExpr->pLeft);
        }

        /* Loop through each expression in <exprlist>. */
        r1 = sqlite3GetTempReg(pParse);
        r2 = sqlite3GetTempReg(pParse);
        if( isRowid ) sqlite3VdbeAddOp2(v, OP_Null, 0, r2);
        if( isRowid ) sqlite3VdbeAddOp4(v, OP_Blob, 0, r2, 0, "", P4_STATIC);
        for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){
          Expr *pE2 = pItem->pExpr;
          int iValToIns;

          /* If the expression is not constant then we will need to
          ** disable the test that was generated above that makes sure
          ** this code only executes once.  Because for a non-constant

Changes to src/pager.c.

1204
1205
1206
1207
1208
1209
1210


1211
1212
1213
1214
1215
1216
1217
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219







+
+








#if defined(SQLITE_ENABLE_ATOMIC_WRITE) \
 || defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
  int dc;                           /* Device characteristics */

  assert( isOpen(pPager->fd) );
  dc = sqlite3OsDeviceCharacteristics(pPager->fd);
#else
  UNUSED_PARAMETER(pPager);
#endif

#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
  if( dc&SQLITE_IOCAP_BATCH_ATOMIC ){
    return -1;
  }
#endif

Changes to src/test_config.c.

209
210
211
212
213
214
215






216
217
218
219
220
221
222
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228







+
+
+
+
+
+







#endif

#ifdef SQLITE_ENABLE_JSON1
  Tcl_SetVar2(interp, "sqlite_options", "json1", "1", TCL_GLOBAL_ONLY);
#else
  Tcl_SetVar2(interp, "sqlite_options", "json1", "0", TCL_GLOBAL_ONLY);
#endif

#ifdef SQLITE_HAS_CODEC
  Tcl_SetVar2(interp, "sqlite_options", "has_codec", "1", TCL_GLOBAL_ONLY);
#else
  Tcl_SetVar2(interp, "sqlite_options", "has_codec", "0", TCL_GLOBAL_ONLY);
#endif

#ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS
  Tcl_SetVar2(interp, "sqlite_options", "like_match_blobs", "0", TCL_GLOBAL_ONLY);
#else
  Tcl_SetVar2(interp, "sqlite_options", "like_match_blobs", "1", TCL_GLOBAL_ONLY);
#endif

Changes to src/vdbe.c.

4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444



4445
4446
4447
4448
4449
4450
4451
4452
4431
4432
4433
4434
4435
4436
4437







4438
4439
4440

4441
4442
4443
4444
4445
4446
4447







-
-
-
-
-
-
-
+
+
+
-







    sqlite3VdbePreUpdateHook(p, pC, SQLITE_INSERT, zDb, pTab, x.nKey, pOp->p2);
  }
  if( pOp->p5 & OPFLAG_ISNOOP ) break;
#endif

  if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
  if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = x.nKey;
  if( pData->flags & MEM_Null ){
    x.pData = 0;
    x.nData = 0;
  }else{
    assert( pData->flags & (MEM_Blob|MEM_Str) );
    x.pData = pData->z;
    x.nData = pData->n;
  assert( pData->flags & (MEM_Blob|MEM_Str) );
  x.pData = pData->z;
  x.nData = pData->n;
  }
  seekResult = ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0);
  if( pData->flags & MEM_Zero ){
    x.nZero = pData->u.nZero;
  }else{
    x.nZero = 0;
  }
  x.pKey = 0;

Changes to src/vdbeblob.c.

59
60
61
62
63
64
65
66

67
68
69
70



71
72
73
74
75
76
77
59
60
61
62
63
64
65

66
67
68


69
70
71
72
73
74
75
76
77
78







-
+


-
-
+
+
+







  /* Set the value of register r[1] in the SQL statement to integer iRow. 
  ** This is done directly as a performance optimization
  */
  v->aMem[1].flags = MEM_Int;
  v->aMem[1].u.i = iRow;

  /* If the statement has been run before (and is paused at the OP_ResultRow)
  ** then back it up to the point where it does the OP_SeekRowid.  This could
  ** then back it up to the point where it does the OP_NotExists.  This could
  ** have been down with an extra OP_Goto, but simply setting the program
  ** counter is faster. */
  if( v->pc>3 ){
    v->pc = 3;
  if( v->pc>4 ){
    v->pc = 4;
    assert( v->aOp[v->pc].opcode==OP_NotExists );
    rc = sqlite3VdbeExec(v);
  }else{
    rc = sqlite3_step(p->pStmt);
  }
  if( rc==SQLITE_ROW ){
    VdbeCursor *pC = v->apCsr[0];
    u32 type = pC->nHdrParsed>p->iCol ? pC->aType[p->iCol] : 0;

Changes to test/pragma.test.

1930
1931
1932
1933
1934
1935
1936

1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957





















1958
1959
1930
1931
1932
1933
1934
1935
1936
1937





















1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960







+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


  }
  db2 eval {
    PRAGMA foreign_key_list(t2);
  }
} {0 0 t1 y {} {NO ACTION} {NO ACTION} NONE}
db2 close

ifcapable !has_codec {
reset_db
do_execsql_test 24.0 {
  PRAGMA page_size = 1024;
  CREATE TABLE t1(a, b, c);
  CREATE INDEX i1 ON t1(b);
  INSERT INTO t1 VALUES('a', 'b', 'c');
  PRAGMA integrity_check;
} {ok}

set r [db one {SELECT rootpage FROM sqlite_master WHERE name = 't1'}]
db close
hexio_write test.db [expr $r*1024 - 16] 000000000000000701040f0f1f616263

sqlite3 db test.db
do_catchsql_test 24.1 {
  SELECT * FROM t1;
} {1 {database disk image is malformed}}
do_catchsql_test 24.2 {
  PRAGMA integrity_check;
} {0 {{database disk image is malformed}}}

  reset_db
  do_execsql_test 24.0 {
    PRAGMA page_size = 1024;
    CREATE TABLE t1(a, b, c);
    CREATE INDEX i1 ON t1(b);
    INSERT INTO t1 VALUES('a', 'b', 'c');
    PRAGMA integrity_check;
  } {ok}
  
  set r [db one {SELECT rootpage FROM sqlite_master WHERE name = 't1'}]
  db close
  hexio_write test.db [expr $r*1024 - 16] 000000000000000701040f0f1f616263
  
  sqlite3 db test.db
  do_catchsql_test 24.1 {
    SELECT * FROM t1;
  } {1 {database disk image is malformed}}
  do_catchsql_test 24.2 {
    PRAGMA integrity_check;
  } {0 {{database disk image is malformed}}}
}  
database_never_corrupt
finish_test

Changes to test/schema6.test.

14
15
16
17
18
19
20

21
22
23
24
25
26
27
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28







+







# names, white-space, and formatting of the CREATE TABLE statement should
# produce identical table content.
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl
set ::testprefix schema6
do_not_use_codec

# Command:   check_same_database_content TESTNAME SQL1 SQL2 SQL3 ...
#
# This command creates fresh databases using SQL1 and subsequent arguments
# and checks to make sure the content of all database files is byte-for-byte
# identical.  Page 1 of the database files is allowed to be different, since
# page 1 contains the sqlite_master table which is expected to vary.

Changes to test/swarmvtab.test.

11
12
13
14
15
16
17

18
19
20
21
22
23
24
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25







+







# This file implements regression tests for SQLite library.  The
# focus of this file is the "swarmvtab" extension
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix swarmvtab
do_not_use_codec

ifcapable !vtab {
  finish_test
  return
}

load_static_extension db unionvtab
239
240
241
242
243
244
245
246
240
241
242
243
244
245
246








-
} {}

do_catchsql_test 3.3.2 { SELECT * FROM xyz } {1 {fetch_db error!}}



finish_test

Changes to test/swarmvtab2.test.

11
12
13
14
15
16
17

18
19
20
21
22
23
24
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25







+







# This file implements regression tests for SQLite library.  The
# focus of this file is the "swarmvtab" extension
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix swarmvtab
do_not_use_codec

ifcapable !vtab {
  finish_test
  return
}


Changes to tool/mkautoconfamal.sh.

47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
47
48
49
50
51
52
53

54
55
56
57
58
59
60
61







-
+







rm -rf $TMPSPACE
cp -R $TOP/autoconf       $TMPSPACE
cp sqlite3.c              $TMPSPACE
cp sqlite3.h              $TMPSPACE
cp sqlite3ext.h           $TMPSPACE
cp $TOP/sqlite3.1         $TMPSPACE
cp $TOP/sqlite3.pc.in     $TMPSPACE
cp $TOP/src/shell.c       $TMPSPACE
cp shell.c                $TMPSPACE
cp $TOP/src/sqlite3.rc    $TMPSPACE
cp $TOP/tool/Replace.cs   $TMPSPACE

cat $TMPSPACE/configure.ac |
sed "s/--SQLITE-VERSION--/$VERSION/" > $TMPSPACE/tmp
mv $TMPSPACE/tmp $TMPSPACE/configure.ac

Changes to tool/warnings-clang.sh.

1
2
3
4
5
6
7


8
9
10
11
12
13
14

1
2
3
4
5


6
7
8
9
10
11
12
13

14





-
-
+
+






-
+
#/bin/sh
#
# Run this script in a directory with a working makefile to check for 
# compiler warnings in SQLite.
#
rm -f sqlite3.c
make sqlite3.c
rm -f sqlite3.c shell.c
make sqlite3.c shell.c
echo '************* FTS4 and RTREE ****************'
scan-build gcc -c -DHAVE_STDINT_H -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE \
      -DSQLITE_DEBUG -DSQLITE_ENABLE_STAT3 sqlite3.c 2>&1 | grep -v 'ANALYZE:'
echo '********** ENABLE_STAT3. THREADSAFE=0 *******'
scan-build gcc -c -I. -DSQLITE_ENABLE_STAT3 -DSQLITE_THREADSAFE=0 \
      -DSQLITE_DEBUG \
      sqlite3.c ../sqlite/src/shell.c -ldl 2>&1 | grep -v 'ANALYZE:'
      sqlite3.c shell.c -ldl 2>&1 | grep -v 'ANALYZE:'