mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-31 15:44:21 +00:00
sync up our in tree sqlite with the 3.3.13 official release. Commit to follow to finish this process on the windows build.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4351 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
64133ab31a
commit
5791353cec
118 files changed
+15152
-1229
No files matched your search
+156
-16
@@ -12,7 +12,7 @@
|
||||
#
|
||||
# This file implements tests for the PRAGMA command.
|
||||
#
|
||||
# $Id: pragma.test,v 1.44 2006/08/14 14:23:43 drh Exp $
|
||||
# $Id: pragma.test,v 1.51 2007/01/27 14:26:07 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -42,7 +42,8 @@ ifcapable !pragma {
|
||||
# that the "all.test" script does.
|
||||
#
|
||||
db close
|
||||
file delete test.db
|
||||
file delete test.db test.db-journal
|
||||
file delete test3.db test3.db-journal
|
||||
sqlite3 db test.db; set DB [sqlite3_connection_pointer db]
|
||||
|
||||
ifcapable pager_pragmas {
|
||||
@@ -258,12 +259,143 @@ if {![sqlite3 -has-codec] && $sqlite_options(integrityck)} {
|
||||
btree_close $db
|
||||
execsql {PRAGMA integrity_check}
|
||||
} {{rowid 1 missing from index i2} {wrong # of entries in index i2}}
|
||||
do_test pragma-3.3 {
|
||||
execsql {PRAGMA integrity_check=1}
|
||||
} {{rowid 1 missing from index i2}}
|
||||
do_test pragma-3.4 {
|
||||
execsql {
|
||||
ATTACH DATABASE 'test.db' AS t2;
|
||||
PRAGMA integrity_check
|
||||
}
|
||||
} {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
|
||||
do_test pragma-3.5 {
|
||||
execsql {
|
||||
PRAGMA integrity_check=3
|
||||
}
|
||||
} {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2}}
|
||||
do_test pragma-3.6 {
|
||||
execsql {
|
||||
PRAGMA integrity_check=xyz
|
||||
}
|
||||
} {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
|
||||
do_test pragma-3.7 {
|
||||
execsql {
|
||||
PRAGMA integrity_check=0
|
||||
}
|
||||
} {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
|
||||
|
||||
# Add additional corruption by appending unused pages to the end of
|
||||
# the database file testerr.db
|
||||
#
|
||||
do_test pragma-3.8 {
|
||||
execsql {DETACH t2}
|
||||
file delete -force testerr.db testerr.db-journal
|
||||
set out [open testerr.db w]
|
||||
fconfigure $out -translation binary
|
||||
set in [open test.db r]
|
||||
fconfigure $in -translation binary
|
||||
puts -nonewline $out [read $in]
|
||||
seek $in 0
|
||||
puts -nonewline $out [read $in]
|
||||
close $in
|
||||
close $out
|
||||
execsql {REINDEX t2}
|
||||
execsql {PRAGMA integrity_check}
|
||||
} {ok}
|
||||
do_test pragma-3.9 {
|
||||
execsql {
|
||||
ATTACH 'testerr.db' AS t2;
|
||||
PRAGMA integrity_check
|
||||
}
|
||||
} {{*** in database t2 ***
|
||||
Page 4 is never used
|
||||
Page 5 is never used
|
||||
Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
|
||||
do_test pragma-3.10 {
|
||||
execsql {
|
||||
PRAGMA integrity_check=1
|
||||
}
|
||||
} {{*** in database t2 ***
|
||||
Page 4 is never used}}
|
||||
do_test pragma-3.11 {
|
||||
execsql {
|
||||
PRAGMA integrity_check=5
|
||||
}
|
||||
} {{*** in database t2 ***
|
||||
Page 4 is never used
|
||||
Page 5 is never used
|
||||
Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
|
||||
do_test pragma-3.12 {
|
||||
execsql {
|
||||
PRAGMA integrity_check=4
|
||||
}
|
||||
} {{*** in database t2 ***
|
||||
Page 4 is never used
|
||||
Page 5 is never used
|
||||
Page 6 is never used} {rowid 1 missing from index i2}}
|
||||
do_test pragma-3.13 {
|
||||
execsql {
|
||||
PRAGMA integrity_check=3
|
||||
}
|
||||
} {{*** in database t2 ***
|
||||
Page 4 is never used
|
||||
Page 5 is never used
|
||||
Page 6 is never used}}
|
||||
do_test pragma-3.14 {
|
||||
execsql {
|
||||
PRAGMA integrity_check(2)
|
||||
}
|
||||
} {{*** in database t2 ***
|
||||
Page 4 is never used
|
||||
Page 5 is never used}}
|
||||
do_test pragma-3.15 {
|
||||
execsql {
|
||||
ATTACH 'testerr.db' AS t3;
|
||||
PRAGMA integrity_check
|
||||
}
|
||||
} {{*** in database t2 ***
|
||||
Page 4 is never used
|
||||
Page 5 is never used
|
||||
Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2} {*** in database t3 ***
|
||||
Page 4 is never used
|
||||
Page 5 is never used
|
||||
Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
|
||||
do_test pragma-3.16 {
|
||||
execsql {
|
||||
PRAGMA integrity_check(9)
|
||||
}
|
||||
} {{*** in database t2 ***
|
||||
Page 4 is never used
|
||||
Page 5 is never used
|
||||
Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2} {*** in database t3 ***
|
||||
Page 4 is never used
|
||||
Page 5 is never used
|
||||
Page 6 is never used} {rowid 1 missing from index i2}}
|
||||
do_test pragma-3.17 {
|
||||
execsql {
|
||||
PRAGMA integrity_check=7
|
||||
}
|
||||
} {{*** in database t2 ***
|
||||
Page 4 is never used
|
||||
Page 5 is never used
|
||||
Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2} {*** in database t3 ***
|
||||
Page 4 is never used
|
||||
Page 5 is never used}}
|
||||
do_test pragma-3.18 {
|
||||
execsql {
|
||||
PRAGMA integrity_check=4
|
||||
}
|
||||
} {{*** in database t2 ***
|
||||
Page 4 is never used
|
||||
Page 5 is never used
|
||||
Page 6 is never used} {rowid 1 missing from index i2}}
|
||||
}
|
||||
do_test pragma-3.3 {
|
||||
execsql {
|
||||
DROP INDEX i2;
|
||||
}
|
||||
} {}
|
||||
do_test pragma-3.99 {
|
||||
catchsql {DETACH t3}
|
||||
catchsql {DETACH t2}
|
||||
file delete -force testerr.db testerr.db-journal
|
||||
catchsql {DROP INDEX i2}
|
||||
} {0 {}}
|
||||
|
||||
# Test modifying the cache_size of an attached database.
|
||||
ifcapable pager_pragmas {
|
||||
@@ -351,12 +483,20 @@ do_test pragma-6.2 {
|
||||
pragma table_info(t2)
|
||||
}
|
||||
} {0 a {} 0 {} 0 1 b {} 0 {} 0 2 c {} 0 {} 0}
|
||||
db nullvalue <<NULL>>
|
||||
do_test pragma-6.2.2 {
|
||||
execsql {
|
||||
CREATE TABLE t5(a TEXT DEFAULT CURRENT_TIMESTAMP, b DEFAULT (5+3));
|
||||
CREATE TABLE t5(
|
||||
a TEXT DEFAULT CURRENT_TIMESTAMP,
|
||||
b DEFAULT (5+3),
|
||||
c TEXT,
|
||||
d INTEGER DEFAULT NULL,
|
||||
e TEXT DEFAULT ''
|
||||
);
|
||||
PRAGMA table_info(t5);
|
||||
}
|
||||
} {0 a TEXT 0 CURRENT_TIMESTAMP 0 1 b {} 0 5+3 0}
|
||||
} {0 a TEXT 0 CURRENT_TIMESTAMP 0 1 b {} 0 5+3 0 2 c TEXT 0 <<NULL>> 0 3 d INTEGER 0 NULL 0 4 e TEXT 0 '' 0}
|
||||
db nullvalue {}
|
||||
ifcapable {foreignkey} {
|
||||
do_test pragma-6.3 {
|
||||
execsql {
|
||||
@@ -438,10 +578,10 @@ do_test pragma-8.1.1 {
|
||||
}
|
||||
} {}
|
||||
do_test pragma-8.1.2 {
|
||||
execsql {
|
||||
execsql2 {
|
||||
PRAGMA schema_version;
|
||||
}
|
||||
} 105
|
||||
} {schema_version 105}
|
||||
do_test pragma-8.1.3 {
|
||||
execsql {
|
||||
PRAGMA schema_version = 106;
|
||||
@@ -540,20 +680,20 @@ do_test pragma-8.1.18 {
|
||||
# Now test that the user-version can be read and written (and that we aren't
|
||||
# accidentally manipulating the schema-version instead).
|
||||
do_test pragma-8.2.1 {
|
||||
execsql {
|
||||
execsql2 {
|
||||
PRAGMA user_version;
|
||||
}
|
||||
} {0}
|
||||
} {user_version 0}
|
||||
do_test pragma-8.2.2 {
|
||||
execsql {
|
||||
PRAGMA user_version = 2;
|
||||
}
|
||||
} {}
|
||||
do_test pragma-8.2.3.1 {
|
||||
execsql {
|
||||
execsql2 {
|
||||
PRAGMA user_version;
|
||||
}
|
||||
} {2}
|
||||
} {user_version 2}
|
||||
do_test pragma-8.2.3.2 {
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
@@ -686,7 +826,7 @@ do_test pragma-9.6 {
|
||||
execsql {
|
||||
PRAGMA temp_store_directory;
|
||||
}
|
||||
} [pwd]
|
||||
} [list [pwd]]
|
||||
do_test pragma-9.7 {
|
||||
catchsql {
|
||||
PRAGMA temp_store_directory='/NON/EXISTENT/PATH/FOOBAR';
|
||||
|
||||
Reference in new issue
Block a user