sl@0: # 2005 August 18 sl@0: # sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #************************************************************************* sl@0: # This file implements regression tests for SQLite library. The sl@0: # focus of this file is testing corner cases of the DEFAULT syntax sl@0: # on table definitions. sl@0: # sl@0: # $Id: default.test,v 1.2 2005/08/20 03:03:04 drh Exp $ sl@0: # sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: sl@0: ifcapable bloblit { sl@0: do_test default-1.1 { sl@0: execsql { sl@0: CREATE TABLE t1( sl@0: a INTEGER, sl@0: b BLOB DEFAULT x'6869' sl@0: ); sl@0: INSERT INTO t1(a) VALUES(1); sl@0: SELECT * from t1; sl@0: } sl@0: } {1 hi} sl@0: } sl@0: do_test default-1.2 { sl@0: execsql { sl@0: CREATE TABLE t2( sl@0: x INTEGER, sl@0: y INTEGER DEFAULT NULL sl@0: ); sl@0: INSERT INTO t2(x) VALUES(1); sl@0: SELECT * FROM t2; sl@0: } sl@0: } {1 {}} sl@0: do_test default-1.3 { sl@0: catchsql { sl@0: CREATE TABLE t3( sl@0: x INTEGER, sl@0: y INTEGER DEFAULT (max(x,5)) sl@0: ) sl@0: } sl@0: } {1 {default value of column [y] is not constant}} sl@0: sl@0: finish_test