CDXLPlay added with permission from Fredik Wikstrom.
[AROS-Contrib.git] / sqlite3 / test / bindxfer.test
blob0d0bea0de00030d3c8834a66b8013e51bd33be5b
1 # 2005 April 21
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
12 # focus of this script testing the sqlite_transfer_bindings() API.
14 # $Id: bindxfer.test,v 1.1 2005/04/22 02:38:39 drh Exp $
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
20 proc sqlite_step {stmt VALS COLS} {
21   upvar #0 $VALS vals
22   upvar #0 $COLS cols
23   set vals [list]
24   set cols [list]
26   set rc [sqlite3_step $stmt]
27   for {set i 0} {$i < [sqlite3_column_count $stmt]} {incr i} {
28     lappend cols [sqlite3_column_name $stmt $i]
29   }
30   for {set i 0} {$i < [sqlite3_data_count $stmt]} {incr i} {
31     lappend vals [sqlite3_column_text $stmt $i]
32   }
34   return $rc
37 do_test bindxfer-1.1 {
38   db close
39   set DB [sqlite3 db test.db]
40   execsql {CREATE TABLE t1(a,b,c);}
41   set VM1 [sqlite3_prepare $DB {SELECT ?, ?, ?} -1 TAIL]
42   set TAIL
43 } {}
44 do_test bindxfer-1.2 {
45   sqlite3_bind_parameter_count $VM1
46 } 3
47 do_test bindxfer-1.3 {
48   set VM2 [sqlite3_prepare $DB {SELECT ?, ?, ?} -1 TAIL]
49   set TAIL
50 } {}
51 do_test bindxfer-1.4 {
52   sqlite3_bind_parameter_count $VM2
53 } 3
54 do_test bindxfer-1.5 {
55   sqlite_bind $VM1 1 one normal
56   set sqlite_static_bind_value two
57   sqlite_bind $VM1 2 {} static
58   sqlite_bind $VM1 3 {} null
59   sqlite3_transfer_bindings $VM1 $VM2
60   sqlite_step $VM1 VALUES COLNAMES
61 } SQLITE_ROW
62 do_test bindxfer-1.6 {
63   set VALUES
64 } {{} {} {}}
65 do_test bindxfer-1.7 {
66   sqlite_step $VM2 VALUES COLNAMES
67 } SQLITE_ROW
68 do_test bindxfer-1.8 {
69   set VALUES
70 } {one two {}}
71 catch {sqlite3_finalize $VM1}
72 catch {sqlite3_finalize $VM2}
74 finish_test