Programmer's Manual Contents

Chapter 1 Introduction

Mimer SQL User Interfaces
Documentation Objectives
Intended Audience
Organization of this Manual
Related Mimer SQL Publications
Suggestions for Further Reading
Definitions, Terms and Trademarks

Chapter 2 Creating Mimer SQL Applications

Using the ODBC Database API
Using the JDBC Database API
Using Embedded Mimer SQL
The Scope of Embedded Mimer SQL
General Principles for Embedding SQL Statements
Processing Embedded SQL
Essential Program Structure
Linking Applications

Chapter 3 Idents and Database Connections

Mimer SQL Idents
Access to the Database
System Privileges
Object Privileges
Access Privileges
About Privileges
Connecting to a Database
Changing Connection
Program Idents - ENTER and LEAVE

Chapter 4 Communicating with the Application Program

Host Variable Usage
Declaring Host Variables
Using Variables in Statements
Indicator Variables
The SQLSTATE Variable
The Diagnostics Area
The SQL Descriptor Area

Chapter 5 Accessing Database Objects

Retrieving Data Using Cursors
General Framework
Declaring Host Variables
Declaring the Cursor
Opening the Cursor
Retrieving Data
Closing the Cursor
Retrieving Single Rows
Retrieving Data from Multiple Tables
The 'Parts explosion' Problem
Entering Data into Tables
Cursor-independent Operations
Updating and Deleting Through Cursors

Chapter 6 Transaction Handling and Database Security

Transaction Principles
Concurrency Control
Transaction Control Statements
Starting Transactions
Ending Transactions
Optimizing Transactions
Consistency Within Transactions
Exception Diagnostics Within Transactions
Setting Default Transaction Options
Statements in Transactions
Cursors in Transactions
Error Handling in Transactions
Transactions and Logging
Protection Against Data Loss
System Interruptions
Hardware Failure

Chapter 7 Dynamic SQL

Principles of Dynamic SQL
SQL Statements and Dynamic SQL
General Summary of Dynamic SQL Processing
SQL Descriptor Area
The Structure of the SQL Descriptor Area
Preparing Statements
Extended Dynamic Cursors
Describing Prepared Statements
Describing Output Variables
Describing Input Variables
Handling Prepared Statements
Executable Statements
Result Set Statements
Example Framework for Dynamic SQL Programs
Example Framework

Chapter 8 Persistent Stored Modules

Syntactic Components of a Routine Definition
Routine Parameters
Routine Language Indicator
Routine Deterministic Clause
Routine Access Clause
Scope in Routines - the Compound SQL Statement
Declaring Variables
The ROW Data Type
Row Value Expression
SQL Constructs in Routines
Assignment Using SET
Conditional Execution Using IF
Conditional Execution - the CASE Statement
Iteration Using LOOP
Iteration Using WHILE
Iteration Using REPEAT
Invoking Procedures - CALL
Invoking Functions - Use as a Value Expression
Comments in Routines
Data Manipulation
Write Operations
Using Cursors
Result Set Procedures
Managing Exception Conditions
Declaring Condition Names
Declaring Exception Handlers
Access Rights
The Mimer SQL PSM Debugger
Starting the PSM Debugger
Logging In
Choosing a Routine
Specifying the Input Parameters
Viewing the Source Code for a Routine
Watching Variables and Input Parameters
Setting Breakpoints
Executing a Routine

Chapter 9 Triggers

Creating a Trigger
Trigger Time
Trigger Event
Trigger Action
New and Old Table Aliases
Altered Table Rows
Comments on Triggers

Chapter 10 Handling Errors and Exception Conditions

Syntax Errors
Semantic Errors
Run-time Errors
Testing for Run-time Errors and Exception Conditions

Appendix A Host Language Dependent Apects

Embedded SQL in C/C++ Programs
SQL Statement Format
Host Variables
Preprocessor Output Format
Scope Rules
Embedded SQL in COBOL Programs
SQL Statement Format
Host Variables
Preprocessor Output Format
Scope Rules
Embedded SQL in FORTRAN Programs
SQL Statement Format
Host Variables
Preprocessor Output Format
Scope Rules

Appendix B Return Codes

SQLSTATE Return Codes
Internal Mimer SQL Return Codes
Warnings and Messages
ODBC Errors and Warnings
Data-dependent Errors
Limits Exceeded
SQL Statement Errors
Program-dependent Errors
Databank and Table Errors
Miscellaneous Errors
Internal Errors
Communication Errors
JDBC Errors

Appendix C Deprecated Features

Parameter Marker Representation

Appendix D Application Program Examples

Building the EXAMPLE Program
C Source Code for the EXAMPLE Program
COBOL Source Code for the EXAMPLE Program
FORTRAN Source Code for the EXAMPLE Program
DSQLSAMP Program Using Dynamic SQL
Building the DSQLSAMP Program
Source Code for the DSQLSAMP Program in C
FREQCALL Program Using Dynamic SQL and a Stored Procedure
Building the FREQCALL Program
C Source Code for the FREQCALL Program
COBOL Source Code for the FREQCALL Program
FORTRAN Source Code for the FREQCALL Program
WAKECALL Program Using Dynamic SQL and a Result-set Procedure
Building the WAKECALL Program
C Source Code for the WAKECALL Program
COBOL Source Code for the WAKECALL Program
FORTRAN Source Code for the WAKECALL Program
BLOBSAMP Program Using Dynamic SQL for Handling Binary Data
Building the BLOBSAMP Program
Source Code for the BLOBSAMP Program in C
OSQLSAMP Program Using Dynamic SQL
Building the OSQLSAMP program
Source Code for the OSQLSAMP Program in C