2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A# The author disclaims copyright to this source code. In place of
2N/A# a legal notice, here is a blessing:
2N/A# May you do good and not evil.
2N/A# May you find forgiveness for yourself and forgive others.
2N/A# May you share freely, never taking more than you give.
2N/A#***********************************************************************
2N/A# This file implements regression tests for SQLite library. The
2N/A# focus of this file is exercising the code in
main.c. 2N/Aset testdir [file dirname $argv0]
2N/A# Tests of the sqlite_complete() function.
2N/A db complete {This is a test}
2N/A db complete {DROP TABLE 'xyz;}
2N/A db complete {DROP TABLE 'xyz';}
2N/A db complete {DROP TABLE "xyz;}
2N/A db complete {DROP TABLE "xyz';}
2N/A db complete {DROP TABLE "xyz";}
2N/A db complete {DROP TABLE xyz; hi}
2N/A db complete {DROP TABLE xyz; }
2N/A db complete {DROP TABLE xyz; -- hi }
2N/A db complete {DROP TABLE xyz; -- hi
2N/A db complete {SELECT a-b FROM t1; }
2N/A db complete {SELECT a-b FROM t1 }
2N/A CREATE TABLE abc(x,y);
2N/A CREATE TRIGGER xyz AFTER DELETE abc BEGIN UPDATE pqr;
2N/A CREATE TRIGGER xyz AFTER DELETE abc BEGIN UPDATE pqr; END;
2N/A CREATE TRIGGER xyz AFTER DELETE abc BEGIN
2N/A CREATE TRIGGER xyz AFTER DELETE backend BEGIN
2N/A CREATE TRIGGER xyz AFTER DELETE end BEGIN
2N/A SELECT a, b FROM end;
2N/A CREATE TRIGGER xyz AFTER DELETE end BEGIN
2N/A SELECT a, b FROM end;
2N/A CREATE TRIGGER xyz AFTER DELETE end BEGIN
2N/A SELECT a, b FROM end;
2N/A SELECT a, b FROM end;
2N/A CREATE TRIGGER xyz AFTER DELETE [;end;] BEGIN
2N/A CREATE TRIGGER xyz AFTER DELETE backend BEGIN
2N/A UPDATE pqr SET a=[;end;];;;
2N/A TRIGGER xyz AFTER DELETE backend BEGIN
2N/Ado_test main-1.27.1 {
2N/A TRIGGERX xyz AFTER DELETE backend BEGIN
2N/Ado_test main-1.27.2 {
2N/A CREATE/**/TRIGGER xyz AFTER DELETE backend BEGIN
2N/Ado_test main-1.27.3 {
2N/A /* */ EXPLAIN -- A comment
2N/A CREATE/**/TRIGGER xyz AFTER DELETE backend BEGIN
2N/Ado_test main-1.27.4 {
2N/A CREATE TRIGGER xyz AFTER DELETE backend BEGIN
2N/Ado_test main-1.27.5 {
2N/A CREATE TEMP TRIGGER xyz AFTER DELETE backend BEGIN
2N/A CREATE TEMP TRIGGER xyz AFTER DELETE backend BEGIN
2N/A CREATE TRIGGER xyz AFTER DELETE backend BEGIN
2N/A EXPLAIN select * from xyz;
2N/A CREATE TABLE /* In comment ; */
2N/A CREATE TABLE /* In comment ; */ hi;
2N/A CREATE TABLE /* In comment ; */;
2N/A db complete {hi /**/ there;}
2N/A db complete {hi there/***/;}
2N/A# Try to open a database with a corrupt database file.
2N/A if {$v} {lappend v $msg} {lappend v {}}
2N/A foreach f [glob -nocomplain testdb/*] {file delete -force $f}
2N/A file delete -force testdb
2N/A set v [catch {execsql {SELECT * from T1 where x!!5}} msg]
2N/A} {1 {unrecognized token: "!!"}}
2N/A foreach f [glob -nocomplain testdb/*] {file delete -force $f}
2N/A file delete -force testdb
2N/A set v [catch {execsql {SELECT * from T1 where @x}} msg]
2N/A} {1 {unrecognized token: "@"}}
2N/A foreach f [glob -nocomplain testdb/*] {file delete -force $f}
2N/A file delete -force testdb
2N/A create table T1(X REAL);
2N/A insert into T1 values(0.5);
2N/A insert into T1 values(0.5e2);
2N/A insert into T1 values(0.5e-002);
2N/A insert into T1 values(5e-002);
2N/A insert into T1 values(-5.0e-2);
2N/A insert into T1 values(-5.1e-2);
2N/A insert into T1 values(0.5e2);
2N/A insert into T1 values(0.5E+02);
2N/A insert into T1 values(5E+02);
2N/A insert into T1 values(5.0E+03);
2N/A select x*10 from T1 order by x*5;
2N/A} {-0.51 -0.5 0.05 0.5 5 500 500 500 5000 50000}
2N/A set v [catch {execsql {create bogus}} msg]
2N/A} {1 {near "bogus": syntax error}}
2N/A set v [catch {execsql {create}} msg]
2N/A} {1 {near "create": syntax error}}