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
15 # $Id: quote.test,v 1.7 2007/04/25 11:32:30 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.
23 catchsql {CREATE TABLE '@abc' ( '#xyz' int, '!pqr' text );}
26 # Insert, update and query the table.
29 catchsql {INSERT INTO '@abc' VALUES(5,'hello')}
32 catchsql {SELECT * FROM '@abc'}
35 catchsql {SELECT * FROM [@abc]} ;# SqlServer compatibility
38 catchsql {SELECT * FROM `@abc`} ;# MySQL compatibility
42 SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'
47 SELECT '!pqr', '#xyz'+5 FROM '@abc'
52 SELECT "!pqr", "#xyz"+5 FROM '@abc'
57 SELECT [!pqr], `#xyz`+5 FROM '@abc'
62 execsql {SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'}
68 execsql {UPDATE '@abc' SET '#xyz'=11}
74 execsql {SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'}
79 # Drop the table with the strange name.
83 execsql {DROP TABLE '@abc'}