File: append.inter

package info (click to toggle)
hsqldb1.8.0 1.8.0.10%2Bdfsg-10
  • links: PTS
  • area: main
  • in suites: buster
  • size: 13,432 kB
  • sloc: java: 75,802; xml: 11,392; sql: 1,556; sh: 847; makefile: 57
file content (60 lines) | stat: -rw-r--r-- 1,195 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * $Id: append.inter,v 1.1 2007/08/09 03:29:27 unsaved Exp $
 *
 * Tests interactive commands :a*.
 */

\c false
/* Since running interactively, need to either invoke with --abortOnErr switch,
 * or use "\c false" Special command, to detect failures. */

CREATE TABLE t(id INTEGER GENERATED BY DEFAULT AS IDENTITY, vc VARCHAR);
INSERT INTO t (vc) VALUES('a');
INSERT INTO t (vc) VALUES('b');
INSERT INTO t (vc) VALUES('c');
INSERT INTO t (vc) VALUES('b');

SELECT count(*) FROM t
*if (*? != 4)
    \q Sanity check failed / 1
*end if

SELECT count(*) FROM t WHERE vc = 'b';
*if (*? != 2)
    \q Sanity check failed / 2
*end if

INSERT INTO t(vc) VALUES ('pref

:apost');

SELECT count(*) FROM t
*if (*? != 5)
    \q Append + repl failed / 1
*end if

SELECT vc FROM t;
SELECT count(*) FROM t WHERE vc = 'prefpost';
*if (*? != 1)
    \q Append + repl failed / 2
*end if

SELECT count(*) FROM t;

\p Intervening command making previous become command # -2.
:h
:-2a WHERE vc = 'b';

*if (*? != 2)
    \q Recall + Append + exec failed / 1
*end if

:-2
:a AND

id = 1

:;
*if (*? != 1)
    \q Recall + multi-line Append failed / 1
*end if