1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/default.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,52 @@
1.4 +# 2005 August 18
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 is testing corner cases of the DEFAULT syntax
1.16 +# on table definitions.
1.17 +#
1.18 +# $Id: default.test,v 1.2 2005/08/20 03:03:04 drh Exp $
1.19 +#
1.20 +
1.21 +set testdir [file dirname $argv0]
1.22 +source $testdir/tester.tcl
1.23 +
1.24 +ifcapable bloblit {
1.25 + do_test default-1.1 {
1.26 + execsql {
1.27 + CREATE TABLE t1(
1.28 + a INTEGER,
1.29 + b BLOB DEFAULT x'6869'
1.30 + );
1.31 + INSERT INTO t1(a) VALUES(1);
1.32 + SELECT * from t1;
1.33 + }
1.34 + } {1 hi}
1.35 +}
1.36 +do_test default-1.2 {
1.37 + execsql {
1.38 + CREATE TABLE t2(
1.39 + x INTEGER,
1.40 + y INTEGER DEFAULT NULL
1.41 + );
1.42 + INSERT INTO t2(x) VALUES(1);
1.43 + SELECT * FROM t2;
1.44 + }
1.45 +} {1 {}}
1.46 +do_test default-1.3 {
1.47 + catchsql {
1.48 + CREATE TABLE t3(
1.49 + x INTEGER,
1.50 + y INTEGER DEFAULT (max(x,5))
1.51 + )
1.52 + }
1.53 +} {1 {default value of column [y] is not constant}}
1.54 +
1.55 +finish_test