sqlite/test/vtab5.test

73 lines
1.7 KiB
Plaintext

# 2006 June 10
#
# 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.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# $Id: vtab5.test,v 1.2 2006/06/19 04:49:35 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !vtab {
finish_test
return
}
# The following tests - vtab5-1.* - ensure that an INSERT, DELETE or UPDATE
# statement can be executed immediately after a CREATE or schema reload. The
# point here is testing that the parser always calls xConnect() before the
# schema of a virtual table is used.
register_echo_module [sqlite3_connection_pointer db]
do_test vtab5-1.1 {
execsql {
CREATE TABLE treal(a VARCHAR(16), b INTEGER, c FLOAT);
INSERT INTO treal VALUES('a', 'b', 'c');
CREATE VIRTUAL TABLE techo USING echo(treal);
}
} {}
do_test vtab5.1.2 {
execsql {
SELECT * FROM techo;
}
} {a b c}
do_test vtab5.1.3 {
db close
sqlite3 db test.db
register_echo_module [sqlite3_connection_pointer db]
execsql {
INSERT INTO techo VALUES('c', 'd', 'e');
SELECT * FROM techo;
}
} {a b c c d e}
do_test vtab5.1.4 {
db close
sqlite3 db test.db
register_echo_module [sqlite3_connection_pointer db]
execsql {
UPDATE techo SET a = 10;
SELECT * FROM techo;
}
} {10 b c 10 d e}
do_test vtab5.1.5 {
db close
sqlite3 db test.db
register_echo_module [sqlite3_connection_pointer db]
execsql {
DELETE FROM techo WHERE b > 'c';
SELECT * FROM techo;
}
} {10 b c}
finish_test