SQL/MP Programming Manual for C

HP NonStop SQL/MP Programming Manual for C429847-008
1-1
1 Introduction
NonStop SQL/MP is the HP relational database management system (RDBMS) that
uses SQL to define and manipulate data in an SQL/MP database. You can run SQL
statements interactively by using the SQL/MP conversational interface (SQLCI) or
programmatically by embedding SQL statements and directives in a host-language
program written in COBOL, C, Pascal, or TAL. This manual describes the
programmatic interface to NonStop SQL/MP for C programs.
This section discusses:
Advantages of Using Embedded SQL Statements
Developing a C Program
Dynamic SQL on page 1-6
SQL/MP Version Management on page 1-7
Advantages of Using Embedded
SQL Statements
Using embedded SQL statements and directives in a C program to access an SQL/MP
database has these advantages:
A high-level, efficient database language––You code a request to access the
database using SQL statements. The SQL/MP optimizer then generates an
efficient path to perform your request.
Insulation against database changes––If a database administrator modifies an
SQL/MP database (for example, adds a column to a table), the change does not
affect the logic of your program.
Use of C statements to process data––You can access the database using SQL
statements and then use C statements to process and manipulate the data.
System support for data consistency––If you require audited tables and views, the
system maintains data consistency with the locking feature and the HP NonStop
Transaction Management Facility (TMF) subsystem.
Developing a C Program
You can embed static or dynamic SQL statements in a C source file. You embed a
static SQL statement as an actual SQL statement and run the SQL compiler to
explicitly compile the statement before you run the program. For a dynamic SQL
statement, you code a placeholder variable for the statement, and then construct,
SQL compile, and run the statement at run time.