HPlogo

ALLBASE/SQL Pascal Application Programming Guide: HP 3000 MPE/iX Computer Systems

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

HP Part Number: 36216-90082

Edition: Fourth Edition

Published: Printed in: U.S.A. 1992


Table of Contents

Preface
1 Getting Started with ALLBASE/SQL Pascal Programming
ALLBASE/SQL Pascal Programs
Program Structure
DBEnvironment Access
Authorization
File Referencing
Native Language Support
The ALLBASE/SQL Pascal Preprocessor
Effect of Preprocessing on Source Code
Effect of Preprocessing on DBEnvironments
The Stored Section
Purpose of Sections
Section Validity
Compiling and Linking the Program
ALLBASE/SQL Program Execution
Installing the Program Module
Granting Required Owner Authorization
Granting Program User Authorization
Running the Program
Maintaining ALLBASE/SQL Programs
Updating Application Programs
Changing Program-Related Authorization
Obsoleting Programs
2 Using the ALLBASE/SQL Pascal Preprocessor
The Preprocessor and Program Development
Preprocessor Modes
Preprocessor Input and Output
Source File
Output File Attributes
Preprocessor Modified Source File
Preprocessor-Generated Include Files
ALLBASE/SQL Message File
Installable Module File
Stored Sections
Invoking the Pascal Preprocessor
Syntax Checking Mode
Syntax
Description
Authorization
Example
Full Preprocessing Mode
Syntax
Parameters
Description
Authorization
Example
Using the Preprocessor UDCs
Running the Preprocessor in Job Mode
Preprocessing Errors
Preprocessor or DBEnvironment Termination
Preprocessor Invocation Errors
SQLIN Errors
DBEnvironment Errors
3 Embedding SQL Commands
General Rules for Embedding SQL
Location of SQL Commands
Prefix and Suffix
Punctuation
Pascal Comments
ALLBASE/SQL Comments
Declaring the SQLCA
Declaring Host Variables
Starting a DBE Session
Defining Transactions
Implicit Status Checking
Terminating a DBE Session
Defining and Manipulating Data
Data Definition
Data Manipulation
Explicit Status Checking
Obtaining ALLBASE/SQL Messages
4 Host Variables
Using Host Variables
Host Variable Names
Input and Output Host Variables
Indicator Variables
Bulk Processing Variables
Declaring Host Variables
Creating Declaration Sections
Using Default Data Values
Declaring Variables for Compatibility
Declaring Variables for Program Elements
5 Runtime Status Checking and the SQLCA
Purposes of Status Checking
Handling Runtime Errors and Warnings
Maintaining Data Consistency
Checking the Most Recently Executed Command
Using the SQLCA
SQLCODE
SQLERRD[3]
SQLCA.SQLWARN[0]
SQLCA.SQLWARN[1]
SQLCA.SQLWARN[2]
SQLCA.SQLWARN[3]
SQLCA.SQLWARN[6]
Approaches to Status Checking
Implicit Status Checking Techniques
Program Illustrating Implicit and Explicit Status Checking
Explicit Status Checking Techniques
6 Overview Of Data Manipulation
The Query
The SELECT Command
Selecting from Multiple Tables
Selecting Using Views
Simple Data Manipulation
Introducing the Cursor
Sequential Table Processing
Bulk Table Processing
Dynamic Operations
7 Simple Data Manipulation
SQL Commands
The SELECT Command
The INSERT Command
The UPDATE Command
The DELETE Command
Transaction Management for Simple Operations
Program Using Simple DML Operations
Procedure Select
Procedure Update
Procedure Delete
Procedure Insert
8 Processing with Cursors
SQL Cursor Commands
DECLARE CURSOR
OPEN
FETCH
UPDATE WHERE CURRENT
DELETE WHERE CURRENT
CLOSE
Transaction Management for Cursor Operations
Using KEEP CURSOR
KEEP CURSOR and Isolation Levels
KEEP CURSOR and Declaring for Update
OPEN Command Without KEEP CURSOR
OPEN Command Using KEEP CURSOR WITH LOCKS and CS Isolation Level
OPEN Command Using KEEP CURSOR WITH NOLOCKS
KEEP CURSOR and BEGIN WORK
KEEP CURSOR and COMMIT WORK
KEEP CURSOR and ROLLBACK WORK
KEEP CURSOR and Aborted Transactions
Writing Keep Cursor Applications
Examples
Common StatusCheck Procedure
Single Cursor WITH LOCKS
Multiple Cursors and Cursor Stability
Avoiding Locks on Terminal Reads
Program Using UPDATE WHERE CURRENT
Procedure FetchUpdate
Procedure DisplayUpdate
9 Bulk Table Processing
Variables Used in BULK Processing
SQL Bulk Commands
BULK SELECT
BULK FETCH
BULK INSERT
Transaction Management for BULK Operations
Program Using BULK INSERT
10 Using Dynamic Operations
Review of Preprocessing Events
Differences between Dynamic and Non-Dynamic Preprocessing
Permanently Stored vs. Temporary Sections
Examples of Non-Dynamic and Dynamic SQL Statements
Why Use Dynamic Preprocessing?
Passing Dynamic Commands to ALLBASE/SQL
Understanding the Types of Dynamic Operations
Preprocessing of Dynamic Non-Queries
Using EXECUTE IMMEDIATE
Using PREPARE and EXECUTE
Preprocessing of Dynamic Queries
Dynamically Updating and Deleting Data
Setting Up the SQLDA
Setting Up the Format Array
Setting up the Data Buffer
Using the Dynamic Query Data Structures
Parsing the Data Buffer
Preprocessing Dynamic Commands That May or May Not Be Queries
Programs Using Dynamic Command Operations
Sample Program Using Dynamic Commands of Unknown Format
Sample Program Using Dynamic Queries of Known Format
11 Programming With Constraints
Comparing Statement Level and Row Level Integrity
Using Unique and Referential Integrity Constraints
Designing an Application Using Statement Level Integrity Checks
Insert a Member in the Recreation Database
Update an Event in the Recreation Database
Delete a Club in the Recreation Database
Delete an Event in the Recreation Database
12 Programming with LONG Columns
General Concepts
Restrictions
Defining LONG Columns with a CREATE TABLE or ALTER TABLE Command
Defining Input and Output with the LONG Column I/O String
Putting Data into a LONG Column with a INSERT Command
Insert Using Host Variables for LONG Column I/O Strings
Retrieving LONG Column Data with a SELECT, FETCH, or REFETCH Command
Using the LONG Column Descriptor
Using LONG Columns with a SELECT Command
Using LONG Columns with a Dynamic FETCH Command
Changing a LONG Column with an UPDATE [WHERE CURRENT] Command
Removing LONG Column Data with a DELETE [WHERE CURRENT] Command
Coding Considerations
13 Programming with ALLBASE/SQL Functions
Programming with Date/Time Functions
Where Date/Time Functions Can Be Used
Defining and Using Host Variables with Date/Time Functions
Using Date/Time Input Functions
Using Date/Time Output Functions
Using the Date/Time ADD_MONTHS Function
Program Example for Date/Time Data
Programming with TID Data Access
Understanding TID Function Input and Output
Transaction Management with TID Access
Comparing TID Access to Other Types of Data Access
Verifying Data that is Accessed by TID
Considering Interactive User Applications
Coding Strategies
Reducing Commit Overhead for Multiple Updates with TID Access
Index

List of Figures

1-1 Creating an ALLBASE/SQL Pascal Application Program
1-2 Preprocess-Time Events
1-3 Compile-Time and Linking-Time Events
1-4 Runtime Events
2-1 Developing a Pascal ALLBASE/SQL Program
2-2 Developing a Pascal ALLBASE/SQL Program with Subprograms
2-3 Pascal Preprocessor Input and Output
2-4 Compiling Preprocessor Output
2-5 Interactive Runtime Dialog of Program PASEX2
2-6 Program PASEX2: Using Simple Select
2-7 Modified Source File for Program PASEX2
2-8 Sample Constant Include File
2-9 Sample Type Include File
2-10 Sample Variable Include File
2-11 Sample External Procedures Include File
2-12 Sample SQLMSG Showing Errors
2-13 Sample SQLMSG Showing Warning
2-14 Information in SYSTEM.SECTION on Stored Sections
2-15 UDC for Preprocessing SQLIN
2-16 UDC for Preprocessing, Compiling, and Preparing SQLIN
2-17 Sample UDC Invocation
2-18 Sample Preprocessing Job file
3-1 Sample Program pasex2
4-1 Host Variable Declarations
4-2 Declaring Host Variables for Single-Row Query Result
4-3 Declaring Host Variables for Multiple-Row Query Result
4-4 Declaring Host Variables for Dynamic Commands
4-5 Declaring Host Variables for Savepoint Numbers
4-6 Declaring Host Variables for Message Catalog Messages
4-7 Declaring Host Variables for DBEnvironment Names
5-1 Implicitly Invoking Status-Checking Routines
5-2 Explicitly Invoking Status-Checking Procedure
5-3 Using SQLERRD[3] After a BULK SELECT Operation
6-1 Sample Query Joining Multiple Tables
6-2 Effect of SQL Commands on Cursor and Active Sets
7-1 Flow Chart of Program pasex7
7-2 Flow Chart of Program pasex7 (page 2 of 2)
7-3 Runtime Dialog of Program pasex7
7-4 Program pasex7: Using SELECT, UPDATE, DELETE and INSERT
8-1 Cursor Operation without the KEEP CURSOR Feature
8-2 Cursor Operation Using KEEP CURSOR WITH LOCKS
8-3 Cursor Operation Using KEEP CURSOR WITH NOLOCKS
8-4 Flow Chart of Program pasex8
8-5 Runtime Dialog of Program pasex8
8-6 Program pasex8: Using UPDATE WHERE CURRENT
9-1 Flow Chart of Program pasex9
9-2 Runtime Dialog of Program pasex9
9-3 Program pasex9: Using BULK INSERT
10-1 Creation and Use of a Program that has a Stored Module
10-2 Creation and Use of a Program that has No Stored Module
10-3 Procedure Hosting Dynamic Non-Query Commands
10-4 Dynamic Query Data Structures and Data Assignment
10-5 Format of the Data Buffer
10-6 Parsing the Data Buffer in Program pasex10a
10-7 Flow Chart of Program pasex10a
10-8 Figure 10-7. Flow Chart of Program pasex10a (page 2 of 2)
10-9 Runtime Dialog of Program pasex10a
10-10 Program pasex10a: Dynamic Commands of Unknown Format
10-11 Flow Chart of Program pasex10b
10-12 Figure 10-10. Flow Chart of Program pasex10b (page 2 of 2)
10-13 Runtime Dialog of Program pasex10b
10-14 Program pasex10b: Dynamic Queries of Known Format
11-1 Constraints Enforced on the Recreation Database
12-1 Flow of LONG Column Data and Related Information to the Database
12-2 Flow of LONG Column Data and Related Information from the Database
13-1 Sample Program Converting Column from CHAR to DATE
13-2 Using RC and RR Transactions with BULK SELECT, SELECT, and UPDATE
13-3 Using TID Access to Reduce Commit Overhead
Feedback to webmaster