8 CREATE TABLE test (id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT,descr TEXT);
9 -- [sql2cpp] name=select_all
11 SELECT name,descr FROM test;
14 let tt stmt scheme params
=
15 let print_scheme = RA.Scheme.to_string
in
16 let print_params = Stmt.params_to_string
in
19 Parser.parse_stmt stmt
21 | _
-> assert_failure
"parsing failed"
23 assert_equal ~printer
:print_scheme scheme s1
;
24 assert_equal ~printer
:print_params params p1
27 tt "CREATE TABLE test (id INT, str TEXT, name TEXT)"
30 tt "SELECT str FROM test WHERE id=?"
33 tt "SELECT x,y+? AS z FROM (SELECT id AS y,CONCAT(str,name) AS x FROM test WHERE id=@id*2) ORDER BY x,x+y LIMIT @lim"
34 [attr
"x" Text
; attr
"z" Int
]
35 [Next
,Some Int
; Named
"id", Some Int
; Named
"lim",Some Int
; ];
36 tt "select test.name,other.name from test, test as other where test.id=other.id + @delta"
37 [attr
"name" Text
; attr
"name" Text
]
38 [Named
"delta", Some Int
];
47 let test_suite = "main" >::: tests in
48 ignore
(run_test_tt
test_suite)