Commit 8a87f7e5 authored by Victor Costan's avatar Victor Costan Committed by Commit Bot

sqlite: Upgrade from 3.20.1 to 3.21.0.

Release notes for the new version:
https://sqlite.org/releaselog/3_21_0.html

Patch 0003 (Modify default VFS to support WebDatabase) was updated to
reflect conflicts introduced by the following commits:
* https://www.sqlite.org/src/info/3075cfa07489eaf1
* https://www.sqlite.org/src/info/1a7e0b61c8a6bdd3

The patch was updated to reflect the rename of pUnused to
pPreallocatedUnused and an extra assert added. Both changes were in
src/os_unix.c.

Patch 0004 (Virtual table supporting recovery of corrupted databases)
was updated to reflect the addition of new compile-time flags to
main.mk.

Patch 0005 (Custom shell.c helpers to load Chromium's ICU data) was
updated to reflect conflicts introduced by
https://www.sqlite.org/src/info/36acc0a97fdcc6f5 which replaced
src/shell.c with src/shell.c.in, which is used to generate src/shell.c
via Tcl. The change in the build process also introduced conflicts in
main.mk.

Patch 0009 (Fix _CRT_RAND_S conflict in sqliteInt.h) was removed
completely. It is no longer necessary, because
https://www.sqlite.org/src/info/3a2793aa65727cbb removed the use of
_CRT_RAND_S in src/sqliteInt.h.

Patches 0012 and 0013 were removed, because they were backports for
upstream changes that fixed clusterfuzz issues. Upgrading removed the
need for backports altogether.

The new SQLite release allows ATTACH and DETACH to be used inside
transactions, so sql/connection_unittest.cc was updated to reflect the
new behavior. The test for attaching databases was broken into two
tests, covering the behavior with and without a transaction. The former
test (covering the behavior with a transaction) has separate
implementations for iOS, where we use the system SQLite, which might be
old, and every other platform, where we ship our own SQLite version.

Bug: 780626, 701522
Change-Id: I7a8378cb317966388ebe9903d9e61162d3b3d3c9
Reviewed-on: https://chromium-review.googlesource.com/754522Reviewed-by: 's avatarChris Mumford <cmumford@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515403}
parent 85d947a4
......@@ -391,8 +391,14 @@ class SQL_EXPORT Connection {
// handle under |attachment_point|. |attachment_point| should only
// contain characters from [a-zA-Z0-9_].
//
// Note that calling attach or detach with an open transaction is an
// error.
// Attaching a database while a transaction is open will have
// platform-dependent results, as explained below.
//
// On the SQLite version shipped with Chrome (3.21+, Oct 2017), databases can
// be attached while a transaction is opened. However, these databases cannot
// be detached until the transaction is committed or aborted. On iOS, the
// built-in SQLite might not be older than 3.21. In that case, attaching a
// database while a transaction is open results in a error.
bool AttachDatabase(const base::FilePath& other_db_path,
const char* attachment_point);
bool DetachDatabase(const char* attachment_point);
......
......@@ -28,7 +28,7 @@
#if defined(OS_IOS) && defined(USE_SYSTEM_SQLITE)
#include "base/ios/ios_util.h"
#endif
#endif // defined(OS_IOS) && defined(USE_SYSTEM_SQLITE)
namespace sql {
namespace test {
......@@ -229,7 +229,7 @@ class ScopedUmaskSetter {
mode_t old_umask_;
DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedUmaskSetter);
};
#endif
#endif // defined(OS_POSIX)
// SQLite function to adjust mock time by |argv[0]| milliseconds.
void sqlite_adjust_millis(sql::test::ScopedMockTimeSource* time_mock,
......@@ -845,7 +845,7 @@ TEST_F(SQLConnectionTest, RazeAndCloseDiagnostics) {
db().IsSQLValid(kSimpleSql);
}, "Illegal use of connection without a db");
}
#endif
#endif // !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_FUCHSIA)
}
// TODO(shess): Spin up a background thread to hold other_db, to more
......@@ -899,7 +899,7 @@ TEST_F(SQLConnectionTest, SetTempDirForSQL) {
// database file'.
ASSERT_TRUE(meta_table.Init(&db(), 4, 4));
}
#endif
#endif // defined(OS_ANDROID)
TEST_F(SQLConnectionTest, Delete) {
EXPECT_TRUE(db().Execute("CREATE TABLE x (x)"));
......@@ -1032,8 +1032,7 @@ TEST_F(SQLConnectionTest, Poison) {
EXPECT_FALSE(db().CommitTransaction());
}
// Test attaching and detaching databases from the connection.
TEST_F(SQLConnectionTest, Attach) {
TEST_F(SQLConnectionTest, AttachDatabase) {
EXPECT_TRUE(db().Execute("CREATE TABLE foo (a, b)"));
// Create a database to attach to.
......@@ -1050,21 +1049,69 @@ TEST_F(SQLConnectionTest, Attach) {
// Cannot see the attached database, yet.
EXPECT_FALSE(db().IsSQLValid("SELECT count(*) from other.bar"));
EXPECT_TRUE(db().AttachDatabase(attach_path, kAttachmentPoint));
EXPECT_TRUE(db().IsSQLValid("SELECT count(*) from other.bar"));
// Queries can touch both databases after the ATTACH.
EXPECT_TRUE(db().Execute("INSERT INTO foo SELECT a, b FROM other.bar"));
{
sql::Statement s(db().GetUniqueStatement("SELECT COUNT(*) FROM foo"));
ASSERT_TRUE(s.Step());
EXPECT_EQ(1, s.ColumnInt(0));
}
EXPECT_TRUE(db().DetachDatabase(kAttachmentPoint));
EXPECT_FALSE(db().IsSQLValid("SELECT count(*) from other.bar"));
}
TEST_F(SQLConnectionTest, AttachDatabaseWithOpenTransaction) {
EXPECT_TRUE(db().Execute("CREATE TABLE foo (a, b)"));
// Create a database to attach to.
base::FilePath attach_path =
db_path().DirName().AppendASCII("SQLConnectionAttach.db");
const char kAttachmentPoint[] = "other";
{
sql::Connection other_db;
ASSERT_TRUE(other_db.Open(attach_path));
EXPECT_TRUE(other_db.Execute("CREATE TABLE bar (a, b)"));
EXPECT_TRUE(other_db.Execute("INSERT INTO bar VALUES ('hello', 'world')"));
}
// Cannot see the attached database, yet.
EXPECT_FALSE(db().IsSQLValid("SELECT count(*) from other.bar"));
#if defined(OS_IOS) && defined(USE_SYSTEM_SQLITE)
// SQLite before 3.21 does not support ATTACH and DETACH in transactions.
// Attach fails in a transaction.
EXPECT_TRUE(db().BeginTransaction());
{
sql::test::ScopedErrorExpecter expecter;
expecter.ExpectError(SQLITE_ERROR);
EXPECT_FALSE(db().AttachDatabase(attach_path, kAttachmentPoint));
EXPECT_FALSE(db().IsSQLValid("SELECT count(*) from other.bar"));
ASSERT_TRUE(expecter.SawExpectedErrors());
}
// Detach also fails in a transaction.
{
sql::test::ScopedErrorExpecter expecter;
expecter.ExpectError(SQLITE_ERROR);
EXPECT_FALSE(db().DetachDatabase(kAttachmentPoint));
ASSERT_TRUE(expecter.SawExpectedErrors());
}
// Attach succeeds when the transaction is closed.
db().RollbackTransaction();
#else // defined(OS_IOS) && defined(USE_SYSTEM_SQLITE)
// Chrome's SQLite (3.21+) supports ATTACH and DETACH in transactions.
// Attach succeeds in a transaction.
EXPECT_TRUE(db().BeginTransaction());
EXPECT_TRUE(db().AttachDatabase(attach_path, kAttachmentPoint));
EXPECT_TRUE(db().IsSQLValid("SELECT count(*) from other.bar"));
// Queries can touch both databases.
// Queries can touch both databases after the ATTACH.
EXPECT_TRUE(db().Execute("INSERT INTO foo SELECT a, b FROM other.bar"));
{
sql::Statement s(db().GetUniqueStatement("SELECT COUNT(*) FROM foo"));
......@@ -1072,8 +1119,7 @@ TEST_F(SQLConnectionTest, Attach) {
EXPECT_EQ(1, s.ColumnInt(0));
}
// Detach also fails in a transaction.
EXPECT_TRUE(db().BeginTransaction());
// Detaching the same database fails, database is locked in the transaction.
{
sql::test::ScopedErrorExpecter expecter;
expecter.ExpectError(SQLITE_ERROR);
......@@ -1082,11 +1128,11 @@ TEST_F(SQLConnectionTest, Attach) {
ASSERT_TRUE(expecter.SawExpectedErrors());
}
// Detach succeeds outside of a transaction.
// Detach succeeds when the transaction is closed.
db().RollbackTransaction();
EXPECT_TRUE(db().DetachDatabase(kAttachmentPoint));
EXPECT_FALSE(db().IsSQLValid("SELECT count(*) from other.bar"));
#endif // defined(OS_IOS) && defined(USE_SYSTEM_SQLITE)
}
TEST_F(SQLConnectionTest, Basic_QuickIntegrityCheck) {
......@@ -1555,7 +1601,7 @@ TEST_F(SQLConnectionTest, GetAppropriateMmapSize) {
ASSERT_EQ(0UL, db().GetAppropriateMmapSize());
return;
}
#endif
#endif // defined(OS_IOS) && defined(USE_SYSTEM_SQLITE)
const size_t kMmapAlot = 25 * 1024 * 1024;
int64_t mmap_status = MetaTable::kMmapFailure;
......@@ -1607,7 +1653,7 @@ TEST_F(SQLConnectionTest, GetAppropriateMmapSizeAltStatus) {
ASSERT_EQ(0UL, db().GetAppropriateMmapSize());
return;
}
#endif
#endif // defined(OS_IOS) && defined(USE_SYSTEM_SQLITE)
const size_t kMmapAlot = 25 * 1024 * 1024;
......@@ -1656,7 +1702,7 @@ TEST_F(SQLConnectionTest, CompileError) {
db().GetUniqueStatement("SELECT x");
}, "SQL compile error no such column: x");
}
#endif
#endif // !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_FUCHSIA)
}
} // namespace sql
......@@ -204,7 +204,7 @@ if (!use_system_sqlite) {
include_dirs = [ "amalgamation" ]
sources = [
"src/src/shell.c",
"amalgamation/shell.c",
"src/src/shell_icu_linux.c",
# Include a dummy c++ file to force linking of libstdc++.
......
Name: sqlite
URL: https://sqlite.org/
Version: 3.20.1
Version: 3.21.0
Included In Release: Yes
Security Critical: Yes
License: Public domain
......
......@@ -1499,7 +1499,7 @@ static void sha3QueryFunc(
#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_shathree_init(
sqlite3 *db,
......@@ -1611,7 +1611,7 @@ static void writefileFunc(
#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_fileio_init(
sqlite3 *db,
......@@ -2139,7 +2139,7 @@ int sqlite3CompletionVtabInit(sqlite3 *db){
}
#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_completion_init(
sqlite3 *db,
......@@ -2231,14 +2231,13 @@ struct ShellState {
/*
** These are the allowed shellFlgs values
*/
#define SHFLG_Scratch 0x00000001 /* The --scratch option is used */
#define SHFLG_Pagecache 0x00000002 /* The --pagecache option is used */
#define SHFLG_Lookaside 0x00000004 /* Lookaside memory is used */
#define SHFLG_Backslash 0x00000008 /* The --backslash option is used */
#define SHFLG_PreserveRowid 0x00000010 /* .dump preserves rowid values */
#define SHFLG_Newlines 0x00000020 /* .dump --newline flag */
#define SHFLG_CountChanges 0x00000040 /* .changes setting */
#define SHFLG_Echo 0x00000080 /* .echo or --echo setting */
#define SHFLG_Pagecache 0x00000001 /* The --pagecache option is used */
#define SHFLG_Lookaside 0x00000002 /* Lookaside memory is used */
#define SHFLG_Backslash 0x00000004 /* The --backslash option is used */
#define SHFLG_PreserveRowid 0x00000008 /* .dump preserves rowid values */
#define SHFLG_Newlines 0x00000010 /* .dump --newline flag */
#define SHFLG_CountChanges 0x00000020 /* .changes setting */
#define SHFLG_Echo 0x00000040 /* .echo or --echo setting */
/*
** Macros for testing and setting shellFlgs
......@@ -2659,6 +2658,7 @@ static int shell_callback(
int i;
ShellState *p = (ShellState*)pArg;
if( azArg==0 ) return 0;
switch( p->cMode ){
case MODE_Line: {
int w = 5;
......@@ -2773,6 +2773,7 @@ static int shell_callback(
for(i=0; IsSpace(z[i]); i++){}
for(; (c = z[i])!=0; i++){
if( IsSpace(c) ){
if( z[j-1]=='\r' ) z[j-1] = '\n';
if( IsSpace(z[j-1]) || z[j-1]=='(' ) continue;
}else if( (c=='(' || c==')') && j>0 && IsSpace(z[j-1]) ){
j--;
......@@ -3009,6 +3010,7 @@ static int captureOutputCallback(void *pArg, int nArg, char **azArg, char **az){
ShellText *p = (ShellText*)pArg;
int i;
UNUSED_PARAMETER(az);
if( azArg==0 ) return 0;
if( p->n ) appendText(p, "|", 0);
for(i=0; i<nArg; i++){
if( i ) appendText(p, ",", 0);
......@@ -3073,7 +3075,7 @@ static void createSelftestTable(ShellState *p){
*/
static void set_table_name(ShellState *p, const char *zName){
int i, n;
int cQuote;
char cQuote;
char *z;
if( p->zDestTable ){
......@@ -3255,18 +3257,10 @@ static int display_stats(
}
displayStatLine(pArg, "Number of Pcache Overflow Bytes:",
"%lld (max %lld) bytes", SQLITE_STATUS_PAGECACHE_OVERFLOW, bReset);
if( pArg->shellFlgs & SHFLG_Scratch ){
displayStatLine(pArg, "Number of Scratch Allocations Used:",
"%lld (max %lld)", SQLITE_STATUS_SCRATCH_USED, bReset);
}
displayStatLine(pArg, "Number of Scratch Overflow Bytes:",
"%lld (max %lld) bytes", SQLITE_STATUS_SCRATCH_OVERFLOW, bReset);
displayStatLine(pArg, "Largest Allocation:",
"%lld bytes", SQLITE_STATUS_MALLOC_SIZE, bReset);
displayStatLine(pArg, "Largest Pcache Allocation:",
"%lld bytes", SQLITE_STATUS_PAGECACHE_SIZE, bReset);
displayStatLine(pArg, "Largest Scratch Allocation:",
"%lld bytes", SQLITE_STATUS_SCRATCH_SIZE, bReset);
#ifdef YYTRACKMAXSTACKDEPTH
displayStatLine(pArg, "Deepest Parser Stack:",
"%lld (max %lld)", SQLITE_STATUS_PARSER_STACK, bReset);
......@@ -3807,6 +3801,7 @@ static char **tableColumnList(ShellState *p, const char *zTab){
}
}
sqlite3_finalize(pStmt);
if( azCol==0 ) return 0;
azCol[0] = 0;
azCol[nCol+1] = 0;
......@@ -3890,7 +3885,7 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azNotUsed){
ShellState *p = (ShellState *)pArg;
UNUSED_PARAMETER(azNotUsed);
if( nArg!=3 ) return 1;
if( nArg!=3 || azArg==0 ) return 0;
zTable = azArg[0];
zType = azArg[1];
zSql = azArg[2];
......@@ -4976,20 +4971,24 @@ static int shell_dbinfo_command(ShellState *p, int nArg, char **azArg){
{ "schema size:",
"SELECT total(length(sql)) FROM %s" },
};
sqlite3_file *pFile = 0;
int i;
char *zSchemaTab;
char *zDb = nArg>=2 ? azArg[1] : "main";
sqlite3_stmt *pStmt = 0;
unsigned char aHdr[100];
open_db(p, 0);
if( p->db==0 ) return 1;
sqlite3_file_control(p->db, zDb, SQLITE_FCNTL_FILE_POINTER, &pFile);
if( pFile==0 || pFile->pMethods==0 || pFile->pMethods->xRead==0 ){
return 1;
}
i = pFile->pMethods->xRead(pFile, aHdr, 100, 0);
if( i!=SQLITE_OK ){
sqlite3_prepare_v2(p->db,"SELECT data FROM sqlite_dbpage(?1) WHERE pgno=1",
-1, &pStmt, 0);
sqlite3_bind_text(pStmt, 1, zDb, -1, SQLITE_STATIC);
if( sqlite3_step(pStmt)==SQLITE_ROW
&& sqlite3_column_bytes(pStmt,0)>100
){
memcpy(aHdr, sqlite3_column_blob(pStmt,0), 100);
sqlite3_finalize(pStmt);
}else{
raw_printf(stderr, "unable to read database header\n");
sqlite3_finalize(pStmt);
return 1;
}
i = get2byteInt(aHdr+16);
......@@ -5609,7 +5608,7 @@ static int do_meta_command(char *zLine, ShellState *p){
utf8_printf(stderr,
"testcase-%s FAILED\n Expected: [%s]\n Got: [%s]\n",
p->zTestcase, azArg[1], zRes);
rc = 2;
rc = 1;
}else{
utf8_printf(stdout, "testcase-%s ok\n", p->zTestcase);
p->nCheck++;
......@@ -7287,7 +7286,6 @@ static int do_meta_command(char *zLine, ShellState *p){
{ "reserve", SQLITE_TESTCTRL_RESERVE },
{ "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS },
{ "iskeyword", SQLITE_TESTCTRL_ISKEYWORD },
{ "scratchmalloc", SQLITE_TESTCTRL_SCRATCHMALLOC },
{ "byteorder", SQLITE_TESTCTRL_BYTEORDER },
{ "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT },
{ "imposter", SQLITE_TESTCTRL_IMPOSTER },
......@@ -7400,7 +7398,6 @@ static int do_meta_command(char *zLine, ShellState *p){
case SQLITE_TESTCTRL_BITVEC_TEST:
case SQLITE_TESTCTRL_FAULT_INSTALL:
case SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS:
case SQLITE_TESTCTRL_SCRATCHMALLOC:
default:
utf8_printf(stderr,
"Error: CLI support for testctrl %s not implemented\n",
......@@ -7920,7 +7917,6 @@ static const char zOptions[] =
" -nullvalue TEXT set text string for NULL values. Default ''\n"
" -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n"
" -quote set output mode to 'quote'\n"
" -scratch SIZE N use N slots of SZ bytes each for scratch memory\n"
" -separator SEP set output column separator. Default: '|'\n"
" -stats print memory stats before each finalize\n"
" -version show SQLite version\n"
......@@ -8023,7 +8019,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
stdout_is_console = isatty(1);
#if USE_SYSTEM_SQLITE+0!=1
if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
if( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,60)!=0 ){
utf8_printf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
sqlite3_sourceid(), SQLITE_SOURCE_ID);
exit(1);
......@@ -8128,16 +8124,6 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
#else
(void)cmdline_option_value(argc, argv, ++i);
#endif
}else if( strcmp(z,"-scratch")==0 ){
int n, sz;
sz = (int)integerValue(cmdline_option_value(argc,argv,++i));
if( sz>400000 ) sz = 400000;
if( sz<2500 ) sz = 2500;
n = (int)integerValue(cmdline_option_value(argc,argv,++i));
if( n>10 ) n = 10;
if( n<1 ) n = 1;
sqlite3_config(SQLITE_CONFIG_SCRATCH, malloc(n*sz+1), sz, n);
data.shellFlgs |= SHFLG_Scratch;
}else if( strcmp(z,"-pagecache")==0 ){
int n, sz;
sz = (int)integerValue(cmdline_option_value(argc,argv,++i));
......@@ -8281,8 +8267,6 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
stdin_is_interactive = 0;
}else if( strcmp(z,"-heap")==0 ){
i++;
}else if( strcmp(z,"-scratch")==0 ){
i+=2;
}else if( strcmp(z,"-pagecache")==0 ){
i+=2;
}else if( strcmp(z,"-lookaside")==0 ){
......
This diff is collapsed.
This diff is collapsed.
......@@ -9,7 +9,7 @@ cd src
mkdir bld
cd bld
../configure
FILES="sqlite3.h sqlite3.c"
FILES="shell.c sqlite3.h sqlite3.c"
OPTS=""
make "OPTS=$OPTS" $FILES
cp -f $FILES ../../amalgamation
......
From 7a3deabc19ed4ab0da08fc70b856304df70e0771 Mon Sep 17 00:00:00 2001
From e6a52a13daabf722ed5bee436af214babae113c1 Mon Sep 17 00:00:00 2001
From: Scott Hess <shess@chromium.org>
Date: Fri, 16 Jan 2015 10:24:30 -0800
Subject: [PATCH 01/11] [test] SQLite tests compiling on Linux.
Subject: [PATCH 01/10] [test] SQLite tests compiling on Linux.
---
third_party/sqlite/src/Makefile.linux-gcc | 41 ++++++++++++++++++++++---------
......@@ -18,7 +18,7 @@ index b838b844a312..62d029430803 100644
#
-TOP = ../sqlite
+TOP = ..
#### C Compiler and options for use in building executables that
# will run on the platform that is doing the build.
@@ -32,19 +32,19 @@ USLEEP = -DHAVE_USLEEP=1
......@@ -29,7 +29,7 @@ index b838b844a312..62d029430803 100644
-THREADSAFE = -DTHREADSAFE=0
+THREADSAFE = -DTHREADSAFE=1
+#THREADSAFE = -DTHREADSAFE=0
#### Specify any extra linker options needed to make the library
# thread safe
#
......@@ -37,13 +37,13 @@ index b838b844a312..62d029430803 100644
-THREADLIB =
+THREADLIB = -lpthread
+#THREADLIB =
#### Specify any extra libraries needed to access required functions.
#
#TLIBS = -lrt # fdatasync on Solaris 8
-TLIBS =
+TLIBS = -ldl
#### Leave SQLITE_DEBUG undefined for maximum speed. Use SQLITE_DEBUG=1
# to check for memory leaks. Use SQLITE_DEBUG=2 to print a log of all
@@ -58,7 +58,24 @@ TLIBS =
......@@ -69,7 +69,7 @@ index b838b844a312..62d029430803 100644
+
+# TODO(shess) I can't see why I need this setting.
+OPTS += -DOS_UNIX=1
#### The suffix to add to executable files. ".exe" for windows.
# Nothing for unix.
@@ -70,7 +87,7 @@ EXE =
......@@ -82,7 +82,7 @@ index b838b844a312..62d029430803 100644
#TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage
#TCC = /opt/mingw/bin/i386-mingw32-gcc -O6
@@ -91,16 +108,16 @@ SHPREFIX = lib
#### Extra compiler options needed for programs that use the TCL library.
#
-#TCL_FLAGS =
......@@ -92,7 +92,7 @@ index b838b844a312..62d029430803 100644
+#TCL_FLAGS = -I/home/drh/tcltk/8.5linux
#TCL_FLAGS = -I/home/drh/tcltk/8.5win -DSTATIC_BUILD=1
#TCL_FLAGS = -I/home/drh/tcltk/8.3hpux
#### Linker options needed to link against the TCL library.
#
-#LIBTCL = -ltcl -lm -ldl
......@@ -101,20 +101,19 @@ index b838b844a312..62d029430803 100644
+#LIBTCL = /home/drh/tcltk/8.5linux/libtcl8.5g.a -lm -ldl
#LIBTCL = /home/drh/tcltk/8.5win/libtcl85s.a -lmsvcrt
#LIBTCL = /home/drh/tcltk/8.3hpux/libtcl8.3.a -ldld -lm -lc
diff --git a/third_party/sqlite/src/main.mk b/third_party/sqlite/src/main.mk
index 62ba293d5b9d..32c394e7812d 100644
index d45f8b8a4daf..be694f0d5586 100644
--- a/third_party/sqlite/src/main.mk
+++ b/third_party/sqlite/src/main.mk
@@ -766,7 +766,7 @@ sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl
echo "; return zMainloop; }" >> $@
@@ -784,7 +784,7 @@ sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $
tclsh $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in >sqlite3_analyzer.c
sqlite3_analyzer$(EXE): sqlite3_analyzer.c
- $(TCCX) $(TCL_FLAGS) sqlite3_analyzer.c -o $@ $(LIBTCL) $(THREADLIB)
+ $(TCCX) $(TCL_FLAGS) sqlite3_analyzer.c -o $@ $(LIBTCL) $(TLIBS) $(THREADLIB)
dbdump$(EXE): $(TOP)/ext/misc/dbdump.c sqlite3.o
$(TCCX) -DDBDUMP_STANDALONE -o dbdump$(EXE) \
--
2.13.5
--
2.14.0
From 1a80653fbe21926055ef45396a547d3a3a0902db Mon Sep 17 00:00:00 2001
From a5bfa4afd458372a73efed9b191a02c7b7c000c5 Mon Sep 17 00:00:00 2001
From: rmcilroy <rmcilroy@chromium.org>
Date: Thu, 20 Jun 2013 22:50:12 +0000
Subject: [PATCH 02/11] Use seperate page-cache pools for each sqlite
Subject: [PATCH 02/10] Use seperate page-cache pools for each sqlite
connection.
Due to multiple different subsystems using sqlite, the shared global page
......@@ -16,7 +16,7 @@ Original review URL: https://chromiumcodereview.appspot.com/17413004
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/third_party/sqlite/src/src/pcache1.c b/third_party/sqlite/src/src/pcache1.c
index 885b8b11fcf7..4b09e9805e82 100644
index 2692bd6ac9d3..c93294a9df71 100644
--- a/third_party/sqlite/src/src/pcache1.c
+++ b/third_party/sqlite/src/src/pcache1.c
@@ -689,6 +689,8 @@ static int pcache1Init(void *NotUsed){
......@@ -39,6 +39,5 @@ index 885b8b11fcf7..4b09e9805e82 100644
pcache1.separateCache = 0;
#elif SQLITE_THREADSAFE
pcache1.separateCache = sqlite3GlobalConfig.pPage==0
--
2.13.5
--
2.14.0
From 65d2934485139bf8ca6fd42405f7a8fd4145481c Mon Sep 17 00:00:00 2001
From 3b4029bed436558ae745630e970b0f6d8040fb54 Mon Sep 17 00:00:00 2001
From: dumi <dumi@chromium.org>
Date: Mon, 20 Jul 2009 23:40:51 +0000
Subject: [PATCH 03/11] Modify default VFS to support WebDatabase.
Subject: [PATCH 03/10] Modify default VFS to support WebDatabase.
The renderer WebDatabase implementation needs to broker certain requests
to the browser. This modifies SQLite to allow monkey-patching the VFS
......@@ -17,16 +17,16 @@ https://codereview.chromium.org/384075
https://codereview.chromium.org/377039
[Possibly not a complete list.]
---
third_party/sqlite/src/src/os_unix.c | 49 ++++++++++++++++++++++++++++++++++
third_party/sqlite/src/src/os_unix.c | 50 ++++++++++++++++++++++++++++++++++
third_party/sqlite/src/src/os_win.c | 8 ++++++
third_party/sqlite/src/src/sqlite.h.in | 23 ++++++++++++++++
3 files changed, 80 insertions(+)
3 files changed, 81 insertions(+)
diff --git a/third_party/sqlite/src/src/os_unix.c b/third_party/sqlite/src/src/os_unix.c
index 8ab779a35288..44f6d67ee07f 100644
index 1b7e5f344a69..6ed6f6a8fc98 100644
--- a/third_party/sqlite/src/src/os_unix.c
+++ b/third_party/sqlite/src/src/os_unix.c
@@ -1346,6 +1346,12 @@ static int fileHasMoved(unixFile *pFile){
@@ -1366,6 +1366,12 @@ static int fileHasMoved(unixFile *pFile){
return pFile->pInode!=0 && pFile->pId!=pFile->pInode->fileId.pId;
#else
struct stat buf;
......@@ -39,10 +39,11 @@ index 8ab779a35288..44f6d67ee07f 100644
return pFile->pInode!=0 &&
(osStat(pFile->zPath, &buf)!=0
|| (u64)buf.st_ino!=pFile->pInode->fileId.ino);
@@ -5640,6 +5646,44 @@ static int findCreateFileMode(
@@ -5688,6 +5694,45 @@ static int findCreateFileMode(
return rc;
}
/*
+/*
+** Initialize |unixFile| internals of |file| on behalf of chromiumOpen() in
+** WebDatabase SQLiteFileSystemPosix.cpp. Function is a subset of unixOpen(),
+** each duplicated piece is marked by "Duplicated in" comment in unixOpen().
......@@ -62,37 +63,37 @@ index 8ab779a35288..44f6d67ee07f 100644
+ memset(p, 0, sizeof(unixFile));
+
+ /* osStat() will not work in the sandbox, so findReusableFd() will always
+ ** fail, so directly include the failure-case setup then initialize pUnused.
+ ** fail, so directly include the failure-case setup then initialize
+ ** pPreallocatedUnused.
+ */
+ if( eType==SQLITE_OPEN_MAIN_DB ){
+ p->pUnused = sqlite3_malloc(sizeof(*p->pUnused));
+ if (!p->pUnused) {
+ p->pPreallocatedUnused = sqlite3_malloc(sizeof(*p->pPreallocatedUnused));
+ if (!p->pPreallocatedUnused) {
+ return SQLITE_NOMEM_BKPT;
+ }
+ p->pUnused->fd = fd;
+ p->pUnused->flags = flags;
+ p->pPreallocatedUnused->fd = fd;
+ p->pPreallocatedUnused->flags = flags;
+ }
+
+ rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);
+ if( rc!=SQLITE_OK ){
+ sqlite3_free(p->pUnused);
+ sqlite3_free(p->pPreallocatedUnused);
+ }
+ return rc;
+}
+
+/*
/*
** Open the file zPath.
**
** Previously, the SQLite OS layer used three functions in place of this
@@ -5740,6 +5784,7 @@ static int unixOpen(
@@ -5789,6 +5834,7 @@ static int unixOpen(
sqlite3_randomness(0,0);
}
+ /* Duplicated in chromium_sqlite3_fill_in_unix_sqlite3_file(). */
memset(p, 0, sizeof(unixFile));
if( eType==SQLITE_OPEN_MAIN_DB ){
@@ -5748,6 +5793,7 @@ static int unixOpen(
@@ -5797,6 +5843,7 @@ static int unixOpen(
if( pUnused ){
fd = pUnused->fd;
}else{
......@@ -100,35 +101,35 @@ index 8ab779a35288..44f6d67ee07f 100644
pUnused = sqlite3_malloc64(sizeof(*pUnused));