Hitachi

Hitachi Advanced Database Application Development Guide


A.4 Sample application program execution procedure

The following explains the procedure for executing the sample application program (sample1).

To execute the sample program:

  1. Start sample1's executable file.

  2. The message shown below is displayed. Choose the SQL statement to be executed (1, 2, or 3). The subsections below explain the operating method for each of these SQL statements.

       ***** HADB CLI Function Sample Program *****
       1. Search (specify search range)
       2. Add
       3. Delete
       4. Exit
       Please specify a menu item (1 - 4):
Organization of this subsection

(1) SELECT statement is selected (1 is selected)

Retrieval processing specifying a US state code (STATECODE) is performed. The following SQL statement is executed:

SELECT "STATECODE","STATENAME","ZIPCODE","ADDRESS","AREA"
    FROM "SAMPLE"
    WHERE "STATECODE" BETWEEN ? AND ?

When the SELECT statement is selected, the following messages are output to the standard output:

• Please specify the minimum number of search conditions (1 - 50): (waits for an entry)Specify a value for the first dynamic parameter (minimum value).
• Please specify the maximum number of search conditions (1 - 50): (waits for an entry)Specify a value for the second dynamic parameter (maximum value).

The SELECT statement is executed based on the values you have entered.

Note

If the above two entries are both null (only the Enter key is pressed), the SELECT statement is executed with 1 assumed for the first dynamic parameter and 50 for the second dynamic parameter.

(2) INSERT statement is selected (2 is selected)

Rows are added to the SAMPLE table. The following SQL statement is executed:

INSERT INTO "SAMPLE" VALUES (?,?,?,?,?)

When the INSERT statement is selected, the following messages are output to the standard output:

• Please specify a state code : (waits for an entry)Specify a value for the first dynamic parameter (state code).
• Please specify a state name : (waits for an entry)Specify a value for the second dynamic parameter (state name).
• Please specify a zip code : (waits for an entry)Specify a value for the third dynamic parameter (zip code).
• Please specify an address : (waits for an entry)Specify a value for the fourth dynamic parameter (state capitol).
• Please specify an area : (waits for an entry)Specify a value for the fifth dynamic parameter (area).

The INSERT statement is executed based on the values you have entered.

If an invalid value is specified, an SQL error occurs.

(3) DELETE statement is selected (3 is selected)

Rows are deleted from the SAMPLE table. The following SQL statement is executed:

DELETE FROM "SAMPLE" WHERE "STATECODE" = ?

When the DELETE statement is selected, the following message is output to the standard output:

• Please specify the state code of the row to be deleted : (waits for an entry)Specify a value for the dynamic parameter (state code of the row to be deleted).

The DELETE statement is executed based on the value you have entered.

If an invalid value is specified, an SQL error occurs.