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 #***********************************************************************
12 # This file implements tests for CARRAY extension
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 set testprefix carray01
23 load_static_extension db carray
25 # Parameter $stmt must be a prepared statement created using
26 # the sqlite3_prepare_v2 command and with parameters fully bound.
27 # This routine simply runs the statement, gathers the result, and
28 # returns a list containing the result.
30 # If the optional second argument is true, then the stmt is finalized
33 proc run_stmt {stmt} {
35 while {[sqlite3_step $stmt]=="SQLITE_ROW"} {
36 for {set i 0} {$i<[sqlite3_data_count $stmt]} {incr i} {
37 lappend r [sqlite3_column_text $stmt $i]
45 set STMT [sqlite3_prepare_v2 db {SELECT 5 IN carray(?3)} -1]
46 sqlite3_carray_bind $STMT 3 1 2 3 4 5 6 7
50 sqlite3_carray_bind -static $STMT 3 1 2 3 4 5 6 7
54 set STMT2 [sqlite3_prepare_v2 db {
55 SELECT DISTINCT typeof(value) FROM carray(?3)} -1]
56 sqlite3_carray_bind $STMT2 3 1 2 3 4 5 6 7
60 sqlite3_carray_bind $STMT 3 1 2 3 4 6 7
64 sqlite3_carray_bind -int64 $STMT 3 1 2 3 4 5 6 7
68 sqlite3_carray_bind -int64 $STMT2 3 1 2 3 4 5 6 7
72 sqlite3_carray_bind -int64 -transient $STMT 3 1 2 3 4 5 6 7
76 sqlite3_carray_bind -int64 -static $STMT 3 1 2 3 4 5 6 7
80 sqlite3_carray_bind -int32 -transient $STMT 3 1 2 3 4 5 6 7
84 sqlite3_carray_bind -int32 -static $STMT 3 1 2 3 4 5 6 7
88 sqlite3_carray_bind -int32 $STMT 3 1 2 3 4 5 6 7
92 sqlite3_carray_bind -int64 $STMT 3 1 2 3 4 6 7
96 sqlite3_carray_bind -int64 -transient $STMT 3 1 2 3 4 6 7
100 sqlite3_carray_bind -int64 -static $STMT 3 1 2 3 4 6 7
104 sqlite3_carray_bind -double $STMT 3 1 2 3 4 5 6 7
108 sqlite3_carray_bind -double -transient $STMT 3 1 2 3 4 5 6 7
112 sqlite3_carray_bind -double -static $STMT 3 1 2 3 4 5 6 7
116 sqlite3_carray_bind -double $STMT2 3 1 2 3 4 5 6 7
120 sqlite3_carray_bind -double $STMT 3 1 2 3 4 6 7
124 sqlite3_carray_bind -double $STMT 3 1 2 3 4 5 6 7
128 sqlite3_carray_bind -text -static $STMT 3 1 2 3 4 6 7
132 sqlite3_carray_bind -text -static $STMT2 3 1 2 3 4 6 7
136 sqlite3_carray_bind -text -transient $STMT 3 1 2 3 4 5 6 7
140 sqlite3_carray_bind -blob -static $STMT 3 1 2 3 4 5 6 7
144 sqlite3_carray_bind -blob -static $STMT2 3 1 2 3 4 5 6 7
148 sqlite3_carray_bind -blob -transient $STMT 3 1 2 3 4 5 6 7
152 sqlite3_carray_bind $STMT 3
156 sqlite3_finalize $STMT
157 sqlite3_finalize $STMT2