1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-10-23 21:49:02 +03:00
Files
sqlite/test/complete_sql.sql
drh f19a90c569 Improvements to the display of DDL SQL statements in the CLI and in
the sqldiff command-line tool in order to close comments and similar
in the case of a corrupt schema, and avoid possible SQL injection
attacks.  ANT-2026-9VFH4DZS.

FossilOrigin-Name: 028a92f9c353d3b400551954de2e09c1723076491f79ff767dd24b452654fda8
2026-10-08 18:34:12 +00:00

116 lines
2.3 KiB
SQL

#!sqlite3
#
# 2026-10-08
#
# 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.
#
#***********************************************************************
#
# Test cases for the "shell_complete_sql()" function in the CLI.
#
# ./sqlite3 test/complete_sql.sql
#
#
.testcase 100
.mode line --limits off
SELECT shell_complete_sql('CREATE TABLE t1(a) /*') AS out;
.check <<END
out: CREATE TABLE t1(a) /**/
END
.testcase 110
SELECT shell_complete_sql('CREATE TABLE t1(a) --') AS out;
.check <<END
out: CREATE TABLE t1(a) --
END
.testcase 120
SELECT shell_complete_sql('CREATE TABLE t1(a CHECK(a<>''/*''))') AS out;
.check <<END
out: CREATE TABLE t1(a CHECK(a<>'/*'))
END
.testcase 130
SELECT shell_complete_sql('CREATE TABLE t1(a) ''one') AS out;
.check <<END
out: CREATE TABLE t1(a) 'one'
END
.testcase 140
SELECT shell_complete_sql('CREATE TABLE t1(a) "one') AS out;
.check <<END
out: CREATE TABLE t1(a) "one"
END
.testcase 150
SELECT shell_complete_sql('CREATE TABLE t1(a) `one') AS out;
.check <<END
out: CREATE TABLE t1(a) `one`
END
.testcase 160
SELECT shell_complete_sql('CREATE TABLE t1(a) [one') AS out;
.check <<END
out: CREATE TABLE t1(a) [one]
END
.testcase 170
SELECT shell_complete_sql('CREATE TRIGGER t1(a) [one') AS out;
.check <<END
out: CREATE TRIGGER t1(a) [one];END
END
.testcase 180
SELECT shell_complete_sql('CREATE TRIGGER t1(a) [one]') AS out;
.check <<END
out: CREATE TRIGGER t1(a) [one];END
END
.testcase 190
SELECT shell_complete_sql('CREATE TRIGGER t1(a) [one];') AS out;
.check <<END
out: CREATE TRIGGER t1(a) [one];END
END
.testcase 200
SELECT shell_complete_sql('CREATE TABLE t1(a);') AS out;
.check <<END
out: CREATE TABLE t1(a);
END
.testcase 210
SELECT shell_complete_sql(' ') AS out;
.check <<END
out:
END
.testcase 220
SELECT shell_complete_sql(' /* only') AS out;
.check <<END
out: /* only*/
END
.testcase 300
SELECT shell_complete_sql('SELECT (((''',1) AS out;
.check <<END
out: SELECT ((('')));
END
.testcase 310
SELECT shell_complete_sql('SELECT (((/*',1) AS out;
.check <<END
out: SELECT (((/**/)));
END
.testcase 320
SELECT shell_complete_sql('SELECT (((/*',3) AS out;
.check <<END
out: */)));
END