Same fix as r45172 for classes/iconimage:
[AROS-Contrib.git] / sqlite3 / test / quote.test
blob14d676e6f0096e5f70981e5a4fa41afe68ea35e6
1 # 2001 September 15
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 file is the ability to specify table and column names
13 # as quoted strings.
15 # $Id: quote.test,v 1.4 2004/08/20 18:34:20 drh Exp $
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
20 # Create a table with a strange name and with strange column names.
22 do_test quote-1.0 {
23   set r [catch {
24     execsql {CREATE TABLE '@abc' ( '#xyz' int, '!pqr' text );}
25   } msg]
26   lappend r $msg
27 } {0 {}}
29 # Insert, update and query the table.
31 do_test quote-1.1 {
32   set r [catch {
33     execsql {INSERT INTO '@abc' VALUES(5,'hello')}
34   } msg]
35   lappend r $msg
36 } {0 {}}
37 do_test quote-1.2 {
38   set r [catch {
39     execsql {SELECT * FROM '@abc'}
40   } msg ]
41   lappend r $msg
42 } {0 {5 hello}}
43 do_test quote-1.3 {
44   set r [catch {
45     execsql {SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'}
46   } msg ]
47   lappend r $msg
48 } {0 {hello 10}}
49 do_test quote-1.3.1 {
50   catchsql {
51     SELECT '!pqr', '#xyz'+5 FROM '@abc'
52   }
53 } {0 {!pqr 5.0}}
54 do_test quote-1.3.2 {
55   catchsql {
56     SELECT "!pqr", "#xyz"+5 FROM '@abc'
57   }
58 } {0 {hello 10}}
59 do_test quote-1.3 {
60   set r [catch {
61     execsql {SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'}
62   } msg ]
63   lappend r $msg
64 } {0 {hello 10}}
65 do_test quote-1.4 {
66   set r [catch {
67     execsql {UPDATE '@abc' SET '#xyz'=11}
68   } msg ]
69   lappend r $msg
70 } {0 {}}
71 do_test quote-1.5 {
72   set r [catch {
73     execsql {SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'}
74   } msg ]
75   lappend r $msg
76 } {0 {hello 16}}
78 # Drop the table with the strange name.
80 do_test quote-1.6 {
81   set r [catch {
82     execsql {DROP TABLE '@abc'}
83   } msg ]
84   lappend r $msg
85 } {0 {}}
88 finish_test