3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library. The focus
12 # of this file is testing the interaction of SQLite manifest types
13 # with Tcl dual-representations.
15 # $Id: types3.test,v 1.8 2008/04/28 13:02:58 drh Exp $
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
21 # A variable with only a string representation comes in as TEXT
25 concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
28 # A variable with an integer representation comes in as INTEGER
30 set V [expr {int(1+2)}]
31 concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
33 set V [expr {1+12345678012345}]
34 if {[tcl_variable_type V]=="wideInt"} {
36 set V [expr {1+123456789012345}]
37 concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
41 set V [expr {1+123456789012345}]
42 concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
46 # A double variable comes in as REAL
49 concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
52 # A byte-array variable comes in a BLOB if it has no string representation
53 # or as TEXT if there is a string representation.
56 set V [binary format a3 abc]
57 concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
62 concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
65 # Check to make sure return values are of the right types.
69 set V [db one {SELECT x'616263'}]
74 set V [db one {SELECT 123}]
77 set Vx [expr {1+wide(123456789123456)}]
79 set V [db one {SELECT 1234567890123456}]
81 } [tcl_variable_type Vx]
82 do_test types3-2.4.1 {
83 set V [db one {SELECT 1234567890123456.1}]
86 do_test types3-2.4.2 {
87 set V [db one {SELECT 1234567890123.456}]
91 set V [db one {SELECT '1234567890123456.0'}]
95 set V [db one {SELECT NULL}]