HP c-tree-SQL ISQL and Tools manual Transaction Processing Tutorial, ISQLTutorial4.sql

Models: c-tree-SQL ISQL and Tools

1 99
Download 99 pages 4.83 Kb
Page 23
Image 23

Quick Tour

2.4TRANSACTION PROCESSING TUTORIAL

iSQL_Tutorial4.sql

This tutorial will introduce the concept of transaction processing, based on the relational model of the previous tutorial. Records will be added to tables orderlist and orderitems as a single transac- tion.

Transaction processing in iSQL is handled by two statements:

1.COMMIT WORK that makes the changes done during the transaction permanent and starts a new transaction.

2.ROLLBACK WORK that undoes all the changes done during the transaction, reverts the database to the status before the start of the transaction, and start a new transaction.

Notice that iSQL automatically starts a transaction when launched.

This example, like all others in this set of documentation, will take the creation and use of a database and fit it into a simple four step flow of initialization, definition, management, and completion. (Init, define, manage, and you're done!)

Now let's break into the four areas.

2.4.1Init

The initialize step is as simple as launching the iSQL tool. The syntax for this is as follows:

isql [-u user_name] [-a password] [connect_string]

At the command line prompt type:

isql -u ADMIN -a ADMIN myDatabase

iSQL responds with the following prompt:

ISQL>

At this point, any valid SQL statement terminated with a semi-colon may be submitted.

2.4.2Define

In this case define consists of the CREATE TABLE statement. This is done in a single iSQL statement in which specific fields are defined. Upon successful creation of the tables, the changes made to the database by this transaction are made permanent by executing the COMMIT WORK statement.

FairCom Corporation

2-13

Page 23
Image 23
HP c-tree-SQL ISQL and Tools manual Transaction Processing Tutorial, ISQLTutorial4.sql