aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/sqlite/unix/sqlite-3.5.1/test/quote.test
diff options
context:
space:
mode:
authordan miller2007-10-20 02:49:29 +0000
committerdan miller2007-10-20 02:49:29 +0000
commite36d23a85ebff914d74bb541558c2b6082b78edb (patch)
tree54b58fdf162e78af64055282a6035c8d2443389d /libraries/sqlite/unix/sqlite-3.5.1/test/quote.test
parent* Fixed an issue whereby avatar chat distances were being calculated against ... (diff)
downloadopensim-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/quote.test')
-rw-r--r--libraries/sqlite/unix/sqlite-3.5.1/test/quote.test89
1 files changed, 89 insertions, 0 deletions
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/test/quote.test b/libraries/sqlite/unix/sqlite-3.5.1/test/quote.test
new file mode 100644
index 0000000..f13d6f9
--- /dev/null
+++ b/libraries/sqlite/unix/sqlite-3.5.1/test/quote.test
@@ -0,0 +1,89 @@
1# 2001 September 15
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 file is the ability to specify table and column names
13# as quoted strings.
14#
15# $Id: quote.test,v 1.7 2007/04/25 11:32:30 drh Exp $
16
17set testdir [file dirname $argv0]
18source $testdir/tester.tcl
19
20# Create a table with a strange name and with strange column names.
21#
22do_test quote-1.0 {
23 catchsql {CREATE TABLE '@abc' ( '#xyz' int, '!pqr' text );}
24} {0 {}}
25
26# Insert, update and query the table.
27#
28do_test quote-1.1 {
29 catchsql {INSERT INTO '@abc' VALUES(5,'hello')}
30} {0 {}}
31do_test quote-1.2.1 {
32 catchsql {SELECT * FROM '@abc'}
33} {0 {5 hello}}
34do_test quote-1.2.2 {
35 catchsql {SELECT * FROM [@abc]} ;# SqlServer compatibility
36} {0 {5 hello}}
37do_test quote-1.2.3 {
38 catchsql {SELECT * FROM `@abc`} ;# MySQL compatibility
39} {0 {5 hello}}
40do_test quote-1.3 {
41 catchsql {
42 SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'
43 }
44} {0 {hello 10}}
45do_test quote-1.3.1 {
46 catchsql {
47 SELECT '!pqr', '#xyz'+5 FROM '@abc'
48 }
49} {0 {!pqr 5}}
50do_test quote-1.3.2 {
51 catchsql {
52 SELECT "!pqr", "#xyz"+5 FROM '@abc'
53 }
54} {0 {hello 10}}
55do_test quote-1.3.3 {
56 catchsql {
57 SELECT [!pqr], `#xyz`+5 FROM '@abc'
58 }
59} {0 {hello 10}}
60do_test quote-1.3.4 {
61 set r [catch {
62 execsql {SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'}
63 } msg ]
64 lappend r $msg
65} {0 {hello 10}}
66do_test quote-1.4 {
67 set r [catch {
68 execsql {UPDATE '@abc' SET '#xyz'=11}
69 } msg ]
70 lappend r $msg
71} {0 {}}
72do_test quote-1.5 {
73 set r [catch {
74 execsql {SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'}
75 } msg ]
76 lappend r $msg
77} {0 {hello 16}}
78
79# Drop the table with the strange name.
80#
81do_test quote-1.6 {
82 set r [catch {
83 execsql {DROP TABLE '@abc'}
84 } msg ]
85 lappend r $msg
86} {0 {}}
87
88
89finish_test