1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Merge latest trunk changes into this branch.

FossilOrigin-Name: 82e5a6e088c58815140ad36715ac11c96527cb25
This commit is contained in:
dan
2015-05-11 18:46:42 +00:00
24 changed files with 297 additions and 140 deletions

39
test/analyzer1.test Normal file
View File

@@ -0,0 +1,39 @@
# 2015-05-11
#
# 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.
#
#***********************************************************************
#
# Quick tests for the sqlite3_analyzer tool
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
if {$tcl_platform(platform)=="windows"} {
set PROG "sqlite3_analyzer.exe"
} else {
set PROG "./sqlite3_analyzer"
}
db close
forcedelete test.db test.db-journal test.db-wal
sqlite3 db test.db
do_test analyzer1-1.0 {
db eval {
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
CREATE TABLE t2(a INT PRIMARY KEY, b) WITHOUT ROWID;
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<250)
INSERT INTO t1(a,b) SELECT x, randomblob(200) FROM c;
INSERT INTO t2(a,b) SELECT a, b FROM t1;
}
set line "exec $PROG test.db"
unset -nocomplain ::MSG
catch {eval $line} ::MSG
} {0}
do_test analyzer1-1.1 {
regexp {^/\*\* Disk-Space Utilization.*COMMIT;\W*$} $::MSG
} {1}

View File

@@ -559,7 +559,6 @@ do_execsql_test jrnlmode-8.30 { PRAGMA journal_mode=DELETE } {delete}
do_test jrnlmode-9.1 {
forcedelete test2.db
sqlite3 db2 test2.db
breakpoint
db2 eval {CREATE TEMP TABLE t(l); PRAGMA journal_mode=off;}
db2 close
} {}

View File

@@ -158,6 +158,9 @@ do_test select4-2.4 {
}} msg]
lappend v $msg
} {1 {ORDER BY clause should come after UNION not before}}
do_execsql_test select4-2.5 {
SELECT 123 AS x ORDER BY (SELECT x ORDER BY 1);
} {123}
# Except operator
#

57
test/sqldiff1.test Normal file
View File

@@ -0,0 +1,57 @@
# 2015-05-11
#
# 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.
#
#***********************************************************************
#
# Quick tests for the sqldiff tool
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
if {$tcl_platform(platform)=="windows"} {
set PROG "sqldiff.exe"
} else {
set PROG "./sqldiff"
}
db close
forcedelete test.db test2.db
sqlite3 db test.db
do_test sqldiff-1.0 {
db eval {
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
CREATE TABLE t2(a INT PRIMARY KEY, b) WITHOUT ROWID;
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
INSERT INTO t1(a,b) SELECT x, printf('abc-%d-xyz',x) FROM c;
INSERT INTO t2(a,b) SELECT a, b FROM t1;
}
db backup test2.db
db eval {
ATTACH 'test2.db' AS x2;
DELETE FROM x2.t1 WHERE a=49;
DELETE FROM x2.t2 WHERE a=48;
INSERT INTO x2.t1(a,b) VALUES(1234,'hello');
INSERT INTO x2.t2(a,b) VALUES(50.5,'xyzzy');
CREATE TABLE x2.t3(a,b,c);
INSERT INTO x2.t3 VALUES(111,222,333);
CREATE TABLE main.t4(x,y,z);
INSERT INTO t4 SELECT * FROM t3;
}
set line "exec $PROG test.db test2.db"
unset -nocomplain ::MSG
catch {eval $line} ::MSG
} {0}
do_test sqldiff-1.1 {
set ::MSG
} {DELETE FROM t1 WHERE a=49;
INSERT INTO t1(a,b) VALUES(1234,'hello');
DELETE FROM t2 WHERE a=48;
INSERT INTO t2(a,b) VALUES(50.5,'xyzzy');
CREATE TABLE t3(a,b,c);
INSERT INTO t3(rowid,a,b,c) VALUES(1,111,222,333);
DROP TABLE t4;}

View File

@@ -166,8 +166,10 @@ sqlite3 db test.db
register_dbstat_vtab db
do_execsql_test stat-5.1 {
PRAGMA auto_vacuum = OFF;
CREATE VIRTUAL TABLE temp.stat USING dbstat;
CREATE TABLE t1(x);
CREATE TABLE tx(y);
ATTACH ':memory:' AS aux1;
CREATE VIRTUAL TABLE temp.stat USING dbstat(aux1);
CREATE TABLE aux1.t1(x);
INSERT INTO t1 VALUES(zeroblob(1513));
INSERT INTO t1 VALUES(zeroblob(1514));
SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload
@@ -178,4 +180,8 @@ do_execsql_test stat-5.1 {
t1 /001+000000 4 overflow 0 1020 0 0 \
]
do_catchsql_test stat-6.1 {
CREATE VIRTUAL TABLE temp.s2 USING dbstat(mainx);
} {1 {no such database: mainx}}
finish_test