Previous Topic: Access IssuesNext Topic: hsql Tab-Delimited Output Example


hsql Standard Output Example

This example shows how to generate reports based on information entered in the standard Problem Report form.

You create a file named probrep.sql in your working directory containing the following SQL statements:

SELECT
	formname,datereported,reportedby,category, 
	application,hardware,operatingsystem,document, 
	revisionnum,problemdescr
FROM
	harform,harproblemreport
WHERE
	harproblemreport.formobjid = harform.formobjid
ORDER BY
	formname

Issue the following command:

hsql -f probrep.sql -o probrep.out

The following text is an example of probrep.out:

FORMNAME = STR-9245
DATEREPORTED = 17-SEP-96
REPORTEDBY = john
CATEGORY = software
APPLICATION = Application A
HARDWARE = Sun 4
OPERATINGSYSTEM = SunOS
DOCUMENT = 
REVISIONNUM =
PROBLEMDESCR =

File update routine generates errors when there is concurrent access to the file. To create the problem, follow these steps:

  1. Open the file for edit with vi
  2. Run Application A with this file name specified
  3. Executable core dumps when it tries to open the file.

Information for each selected form shows in the same format, separated by two blank lines.

Suppose you add the -nh option to the previous command as follows:

hsql -nh -f probrep.sql -o probrep.out

The content of probrep.out now is as follows:

STR-9245
17-SEP-96
john
software
Application A
Sun 4
SunOS

File update routine generates errors when there is concurrent access to the file. To create the problem, follow these steps:

  1. Open the file for edit with vi.
  2. Run Application A with this file name specified.
  3. Executable core dumps when it tries to open the file.