diff options
Diffstat (limited to 'usr/src/lib/libsqlite/test/fkey1.test')
-rw-r--r-- | usr/src/lib/libsqlite/test/fkey1.test | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/usr/src/lib/libsqlite/test/fkey1.test b/usr/src/lib/libsqlite/test/fkey1.test new file mode 100644 index 0000000000..4e0b4d6400 --- /dev/null +++ b/usr/src/lib/libsqlite/test/fkey1.test @@ -0,0 +1,56 @@ + +#pragma ident "%Z%%M% %I% %E% SMI" + +# 2001 September 15 +# +# 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. +# +# This file implements tests for foreign keys. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +# Create a table and some data to work with. +# +do_test fkey1-1.0 { + execsql { + CREATE TABLE t1( + a INTEGER PRIMARY KEY, + b INTEGER + REFERENCES t1 ON DELETE CASCADE + REFERENCES t2, + c TEXT, + FOREIGN KEY (b,c) REFERENCES t2(x,y) ON UPDATE CASCADE + ); + } +} {} +do_test fkey1-1.1 { + execsql { + CREATE TABLE t2( + x INTEGER PRIMARY KEY, + y TEXT + ); + } +} {} +do_test fkey1-1.2 { + execsql { + CREATE TABLE t3( + a INTEGER REFERENCES t2, + b INTEGER REFERENCES t1, + FOREIGN KEY (a,b) REFERENCES t2(x,y) + ); + } +} {} + + + +finish_test |