mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Add tests to ensure an INSERT/UPDATE/DELETE immediately after virtual table construction does not fail. (CVS 3270)
FossilOrigin-Name: 144d0eb13aed4507e93edec781b1819a068f4a70
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is creating and dropping virtual tables.
|
||||
#
|
||||
# $Id: vtab1.test,v 1.21 2006/06/17 11:30:33 danielk1977 Exp $
|
||||
# $Id: vtab1.test,v 1.22 2006/06/19 03:05:10 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -32,6 +32,7 @@ ifcapable !vtab {
|
||||
# vtab1-5.*: Test queries that include joins. This brings the
|
||||
# sqlite3_index_info.estimatedCost variable into play.
|
||||
# vtab1-6.*: Test UPDATE/INSERT/DELETE on vtables.
|
||||
# vtab1-7.*: Test sqlite3_last_insert_rowid().
|
||||
#
|
||||
# This file uses the "echo" module (see src/test8.c). Refer to comments
|
||||
# in that file for the special behaviour of the Tcl $echo_module variable.
|
||||
@ -582,4 +583,5 @@ do_test vtab1.7-13 {
|
||||
}
|
||||
} {}
|
||||
|
||||
|
||||
finish_test
|
||||
|
@ -10,7 +10,7 @@
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library.
|
||||
#
|
||||
# $Id: vtab2.test,v 1.1 2006/06/17 11:30:33 danielk1977 Exp $
|
||||
# $Id: vtab2.test,v 1.2 2006/06/19 03:05:10 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -36,6 +36,5 @@ do_test vtab2-1.1 {
|
||||
main schema 6 dflt_value {} 0 {} 0 \
|
||||
main schema 7 pk {} 0 {} 0 \
|
||||
]
|
||||
|
||||
finish_test
|
||||
|
||||
|
71
test/vtab5.test
Normal file
71
test/vtab5.test
Normal file
@ -0,0 +1,71 @@
|
||||
# 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.1 2006/06/19 03:05:10 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 treal;
|
||||
}
|
||||
} {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
|
||||
|
Reference in New Issue
Block a user