1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/vtab9.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,70 @@
1.4 +# 2006 August 29
1.5 +#
1.6 +# The author disclaims copyright to this source code. In place of
1.7 +# a legal notice, here is a blessing:
1.8 +#
1.9 +# May you do good and not evil.
1.10 +# May you find forgiveness for yourself and forgive others.
1.11 +# May you share freely, never taking more than you give.
1.12 +#
1.13 +#***********************************************************************
1.14 +# This file implements regression tests for SQLite library. The
1.15 +# focus of this file inserting into virtual tables from a SELECT
1.16 +# statement.
1.17 +#
1.18 +# $Id: vtab9.test,v 1.2 2007/04/16 15:06:26 danielk1977 Exp $
1.19 +
1.20 +set testdir [file dirname $argv0]
1.21 +source $testdir/tester.tcl
1.22 +
1.23 +ifcapable !vtab {
1.24 + finish_test
1.25 + return
1.26 +}
1.27 +
1.28 +do_test vtab9-1.1 {
1.29 + register_echo_module [sqlite3_connection_pointer db]
1.30 + execsql {
1.31 + CREATE TABLE t0(a);
1.32 + CREATE VIRTUAL TABLE t1 USING echo(t0);
1.33 + INSERT INTO t1 SELECT 'hello';
1.34 + SELECT rowid, * FROM t1;
1.35 + }
1.36 +} {1 hello}
1.37 +
1.38 +do_test vtab9-1.2 {
1.39 + execsql {
1.40 + CREATE TABLE t2(a,b,c);
1.41 + CREATE VIRTUAL TABLE t3 USING echo(t2);
1.42 + CREATE TABLE d1(a,b,c);
1.43 + INSERT INTO d1 VALUES(1,2,3);
1.44 + INSERT INTO d1 VALUES('a','b','c');
1.45 + INSERT INTO d1 VALUES(NULL,'x',123.456);
1.46 + INSERT INTO d1 VALUES(x'6869',123456789,-12345);
1.47 + INSERT INTO t3(a,b,c) SELECT * FROM d1;
1.48 + SELECT rowid, * FROM t3;
1.49 + }
1.50 +} {1 1 2 3 2 a b c 3 {} x 123.456 4 hi 123456789 -12345}
1.51 +
1.52 +# do_test vtab9-2.1 {
1.53 +# execsql {
1.54 +# CREATE TABLE t4(a);
1.55 +# CREATE VIRTUAL TABLE t5 USING echo(t4);
1.56 +# INSERT INTO t4 VALUES('hello');
1.57 +# SELECT rowid, a FROM t5;
1.58 +# }
1.59 +# } {1 hello}
1.60 +# do_test vtab9-2.2 {
1.61 +# execsql {
1.62 +# INSERT INTO t5(rowid, a) VALUES(1, 'goodbye');
1.63 +# }
1.64 +# } {1 hello}
1.65 +# do_test vtab9-2.3 {
1.66 +# execsql {
1.67 +# REPLACE INTO t5(rowid, a) VALUES(1, 'goodbye');
1.68 +# SELECT * FROM t5;
1.69 +# }
1.70 +# } {1 goodbye}
1.71 +
1.72 +unset -nocomplain echo_module_begin_fail
1.73 +finish_test