diff options
author | dan miller | 2007-10-20 02:49:29 +0000 |
---|---|---|
committer | dan miller | 2007-10-20 02:49:29 +0000 |
commit | e36d23a85ebff914d74bb541558c2b6082b78edb (patch) | |
tree | 54b58fdf162e78af64055282a6035c8d2443389d /libraries/sqlite/unix/sqlite-3.5.1/test/bindxfer.test | |
parent | * Fixed an issue whereby avatar chat distances were being calculated against ... (diff) | |
download | opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.zip opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.gz opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.bz2 opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.xz |
sqlite source (unix build) added to libraries
Diffstat (limited to 'libraries/sqlite/unix/sqlite-3.5.1/test/bindxfer.test')
-rw-r--r-- | libraries/sqlite/unix/sqlite-3.5.1/test/bindxfer.test | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/test/bindxfer.test b/libraries/sqlite/unix/sqlite-3.5.1/test/bindxfer.test new file mode 100644 index 0000000..710ebc7 --- /dev/null +++ b/libraries/sqlite/unix/sqlite-3.5.1/test/bindxfer.test | |||
@@ -0,0 +1,84 @@ | |||
1 | # 2005 April 21 | ||
2 | # | ||
3 | # The author disclaims copyright to this source code. In place of | ||
4 | # a legal notice, here is a blessing: | ||
5 | # | ||
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. | ||
9 | # | ||
10 | #*********************************************************************** | ||
11 | # This file implements regression tests for SQLite library. The | ||
12 | # focus of this script testing the sqlite_transfer_bindings() API. | ||
13 | # | ||
14 | # $Id: bindxfer.test,v 1.4 2007/04/05 11:25:59 drh Exp $ | ||
15 | # | ||
16 | |||
17 | set testdir [file dirname $argv0] | ||
18 | source $testdir/tester.tcl | ||
19 | |||
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] | ||
25 | |||
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 | } | ||
33 | |||
34 | return $rc | ||
35 | } | ||
36 | |||
37 | do_test bindxfer-1.1 { | ||
38 | set DB [sqlite3_connection_pointer db] | ||
39 | execsql {CREATE TABLE t1(a,b,c);} | ||
40 | set VM1 [sqlite3_prepare $DB {SELECT ?, ?, ?} -1 TAIL] | ||
41 | set TAIL | ||
42 | } {} | ||
43 | do_test bindxfer-1.2 { | ||
44 | sqlite3_bind_parameter_count $VM1 | ||
45 | } 3 | ||
46 | do_test bindxfer-1.3 { | ||
47 | set VM2 [sqlite3_prepare $DB {SELECT ?, ?, ?} -1 TAIL] | ||
48 | set TAIL | ||
49 | } {} | ||
50 | do_test bindxfer-1.4 { | ||
51 | sqlite3_bind_parameter_count $VM2 | ||
52 | } 3 | ||
53 | do_test bindxfer-1.5 { | ||
54 | sqlite_bind $VM1 1 one normal | ||
55 | set sqlite_static_bind_value two | ||
56 | sqlite_bind $VM1 2 {} static | ||
57 | sqlite_bind $VM1 3 {} null | ||
58 | sqlite3_transfer_bindings $VM1 $VM2 | ||
59 | sqlite_step $VM1 VALUES COLNAMES | ||
60 | } SQLITE_ROW | ||
61 | do_test bindxfer-1.6 { | ||
62 | set VALUES | ||
63 | } {{} {} {}} | ||
64 | do_test bindxfer-1.7 { | ||
65 | sqlite_step $VM2 VALUES COLNAMES | ||
66 | } SQLITE_ROW | ||
67 | do_test bindxfer-1.8 { | ||
68 | set VALUES | ||
69 | } {one two {}} | ||
70 | do_test bindxfer-1.9 { | ||
71 | catch {sqlite3_finalize $VM1} | ||
72 | catch {sqlite3_finalize $VM2} | ||
73 | sqlite3_transfer_bindings $VM1 $VM2 | ||
74 | } 21 ;# SQLITE_MISUSE | ||
75 | do_test bindxfer-1.10 { | ||
76 | set VM1 [sqlite3_prepare $DB {SELECT ?, ?, ?} -1 TAIL] | ||
77 | set VM2 [sqlite3_prepare $DB {SELECT ?, ?, ?, ?} -1 TAIL] | ||
78 | sqlite3_transfer_bindings $VM1 $VM2 | ||
79 | } 1 ;# SQLITE_ERROR | ||
80 | catch {sqlite3_finalize $VM1} | ||
81 | catch {sqlite3_finalize $VM2} | ||
82 | |||
83 | |||
84 | finish_test | ||