alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

HSQLDB example source code file (dsv-constcols.sql)

This example HSQLDB source code file (dsv-constcols.sql) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - HSQLDB tags/keywords

and, const_cols, count, count, dsv_const_cols, failed, from, from, int, is, is, select, where, where

The HSQLDB dsv-constcols.sql source code

/*
 * $Id$
 *
 * Tests setting column values with *DSV_CONST_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
* *DSV_CONST_COLS= d = 2007-05-14 0:00:00  |   a  =  139  

CREATE TABLE t (i INT, a INT, d DATE);

\m dsv-constcols.dsv
SELECT COUNT(*) FROM t WHERE a = 139 AND d = '2007-05-14';

/* The d const value will override the .dsv-specified values. */
*if (*? != 2)
    \q Import using constants for int and date columns failed
*end if

DELETE from t;
* *DSV_CONST_COLS=
\m dsv-constcols.dsv

SELECT COUNT(*) FROM t WHERE a IS null AND d IS null;
*if (*? != 1)
    \q Failed to reset CONST_COLS behavior (1)
*end if

SELECT COUNT(*) FROM t WHERE a IS null AND d = '2006-12-11';
*if (*? != 1)
    \q Failed to reset CONST_COLS behavior (2)
*end if

Other HSQLDB examples (source code examples)

Here is a short list of links related to this HSQLDB dsv-constcols.sql source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.