Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Unified Diff: third_party/sqlite/sqlite-src-3070603/test/quote.test

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/sqlite/sqlite-src-3070603/test/quote.test
diff --git a/third_party/sqlite/sqlite-src-3070603/test/quote.test b/third_party/sqlite/sqlite-src-3070603/test/quote.test
new file mode 100644
index 0000000000000000000000000000000000000000..f13d6f9ee9485e28fd986bba226896fa9cca4d92
--- /dev/null
+++ b/third_party/sqlite/sqlite-src-3070603/test/quote.test
@@ -0,0 +1,89 @@
+# 2001 September 15
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library. The
+# focus of this file is the ability to specify table and column names
+# as quoted strings.
+#
+# $Id: quote.test,v 1.7 2007/04/25 11:32:30 drh Exp $
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+# Create a table with a strange name and with strange column names.
+#
+do_test quote-1.0 {
+ catchsql {CREATE TABLE '@abc' ( '#xyz' int, '!pqr' text );}
+} {0 {}}
+
+# Insert, update and query the table.
+#
+do_test quote-1.1 {
+ catchsql {INSERT INTO '@abc' VALUES(5,'hello')}
+} {0 {}}
+do_test quote-1.2.1 {
+ catchsql {SELECT * FROM '@abc'}
+} {0 {5 hello}}
+do_test quote-1.2.2 {
+ catchsql {SELECT * FROM [@abc]} ;# SqlServer compatibility
+} {0 {5 hello}}
+do_test quote-1.2.3 {
+ catchsql {SELECT * FROM `@abc`} ;# MySQL compatibility
+} {0 {5 hello}}
+do_test quote-1.3 {
+ catchsql {
+ SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'
+ }
+} {0 {hello 10}}
+do_test quote-1.3.1 {
+ catchsql {
+ SELECT '!pqr', '#xyz'+5 FROM '@abc'
+ }
+} {0 {!pqr 5}}
+do_test quote-1.3.2 {
+ catchsql {
+ SELECT "!pqr", "#xyz"+5 FROM '@abc'
+ }
+} {0 {hello 10}}
+do_test quote-1.3.3 {
+ catchsql {
+ SELECT [!pqr], `#xyz`+5 FROM '@abc'
+ }
+} {0 {hello 10}}
+do_test quote-1.3.4 {
+ set r [catch {
+ execsql {SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'}
+ } msg ]
+ lappend r $msg
+} {0 {hello 10}}
+do_test quote-1.4 {
+ set r [catch {
+ execsql {UPDATE '@abc' SET '#xyz'=11}
+ } msg ]
+ lappend r $msg
+} {0 {}}
+do_test quote-1.5 {
+ set r [catch {
+ execsql {SELECT '@abc'.'!pqr', '@abc'.'#xyz'+5 FROM '@abc'}
+ } msg ]
+ lappend r $msg
+} {0 {hello 16}}
+
+# Drop the table with the strange name.
+#
+do_test quote-1.6 {
+ set r [catch {
+ execsql {DROP TABLE '@abc'}
+ } msg ]
+ lappend r $msg
+} {0 {}}
+
+
+finish_test
« no previous file with comments | « third_party/sqlite/sqlite-src-3070603/test/quota.test ('k') | third_party/sqlite/sqlite-src-3070603/test/randexpr1.tcl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698