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

HSQLDB example source code file (TestSelfModify.txt)

This example HSQLDB source code file (TestSelfModify.txt) 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

app, app2, from, from, insert, insert, into, into, newapp, resultset, select, select, value, values

The HSQLDB TestSelfModify.txt source code

--
-- TestSelfModify.txt
--

-- TestSelfModify.txt is used by TestSelf.java to test the database
--
-- This is part of a three part suite of scripts to test persistence in the same DB
--
-- Comment lines must start with -- and are ignored
-- Lines starting with spaces belongs to last line
-- Checked lines start with comments containing <tag> where  is:
--   c <rows>     ResultSet expects a with  columns
--   r <string>   ResultSet expected with  result in first row/column
--   u <count>    Update count  expected
--   e            Exception must occur
--
--bug #824031 continued
--scripting test for order of indexes
/*c1*/SELECT * FROM APP WHERE APP_NAME = 'Eran';
/*c1*/SELECT * FROM APP WHERE APP_NAME = 'Shelly';
/*c2*/SELECT * FROM APP;
--
-- TEST 1
-- Correct handling of index creation for foreign keys
-- insert some values
/*u1*/insert into verein values ('abcdefg');
/*u1*/insert into verein values ('hijklmn');
/*u1*/insert into verein values ('opqrstu');
/*u1*/insert into verein values ('vwxyz');
/*u1*/insert into bewerb values ('abcdefg',1);
/*e*/insert into bewerb values ('abcdefg',2);
/*u1*/insert into bewerb values ('hijklmn',5);
/*e*/insert into bewerb values ('hijklmn',6);
/*u1*/insert into bewerb values ('opqrstu',8);
/*e*/insert into bewerb values ('opqrstu',9);
/*u1*/insert into bewerb values ('vwxyz',10);

--test identity increment
INSERT INTO APP2 (VALUE) VALUES(11);
INSERT INTO APP2 (VALUE) VALUES(12);

--test result of update before previous shutdown
/*r
  14,newdir,NULL,NULL,NULL
*/select * from file;

--test insert into table

SELECT * INTO NEWAPP FROM APP;
/*c1*/SELECT * FROM NEWAPP WHERE APP_NAME = 'Eran';
/*c1*/SELECT * FROM NEWAPP WHERE APP_NAME = 'Shelly';
/*c2*/SELECT * FROM NEWAPP;

INSERT INTO NEWAPP (SELECT * FROM APP)
/*c2*/SELECT * FROM NEWAPP WHERE APP_NAME = 'Eran';
/*c2*/SELECT * FROM NEWAPP WHERE APP_NAME = 'Shelly';
/*c4*/SELECT * FROM NEWAPP;

-- SHUTDOWN is necessary for test1
/*u0*/SHUTDOWN;

Other HSQLDB examples (source code examples)

Here is a short list of links related to this HSQLDB TestSelfModify.txt 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.