File: dsv-omits.sql

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 (48 lines) | stat: -rw-r--r-- 1,247 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
/*
 * $Id: dsv-omits.sql,v 1.1 2007/08/09 03:28:36 unsaved Exp $
 *
 * Tests omitting columns via header line and *DSV_SKIP_COLS
 */

/** This is the default on UNIX.
 *  Our *.dsv test files are stored as binaries, so this is required
 *  to run tests on Windows: */
* *DSV_ROW_DELIM = \n

CREATE TABLE t (i INT, a INT, b INT, c INT);

\m dsv-omits.dsv
SELECT COUNT(*) FROM t
WHERE i IS NOT null AND a IS NOT null AND b IS NOT null AND c IS NOT null;

*if (*? != 2)
    \q Import using header line - column-skips failed
*end if

/** Repeat test with some non-default DSV settings */
* *DSV_SKIP_COLS =   c|   a 

DELETE FROM t;
\m dsv-omits.dsv

SELECT COUNT(*) FROM t
WHERE i IS NOT null AND b IS NOT null AND a IS null AND c IS null;

*if (*? != 2)
    \q Import using header line - AND *DSV_SKIP_COLS column-skips failed
*end if

/* Now test that behavior reverts when PL variable is cleared */
* *DSV_SKIP_COLS =
* listvalues

DELETE FROM t;
\m dsv-omits.dsv
SELECT COUNT(*) FROM t
WHERE i IS NOT null AND a IS NOT null AND b IS NOT null AND c IS NOT null;
\p Post everything

*if (*? != 2)
    SELECT * FROM t;
    \q *DSV_SKIP_COLS behavior failed to revert when variable was cleared
*end if