Sign In
Upload
Manuals
Brands
Hp Manuals
Software
NonStop SQL/MP
Hp NonStop SQL/MP Manuals
Manuals and User Guides for Hp NonStop SQL/MP. We have
1
Hp NonStop SQL/MP manual available for free PDF download: Programming Manual
Hp NonStop SQL/MP Programming Manual (331 pages)
for C
Brand:
Hp
| Category:
Software
| Size: 2.34 MB
Table of Contents
Programming Manual for C
5
Legal Notices
3
Table of Contents
5
Table
13
April
15
August
15
December
15
February
15
About this Manual
19
Who Should Read this Guide
19
Program Development Manuals
19
Table I. Nonstop SQL/MP Library
20
Figure I. Nonstop SQL/MP Library
21
Program Development, System and OSS Manuals
22
Guardian Manuals
22
Open System Services (OSS) Manuals
22
General Syntax Notation
24
Notation Conventions
24
Hp Encourages Your Comments
26
Advantages of Using Embedded SQL Statements
27
Developing a C Program
27
Declaring and Using Host Variables
28
Embedding SQL/MP Statements and Directives
29
Table 1-1. SQL/MP Statements and Directives
29
Calling SQL/MP System Procedures
30
Example 1-1. Static SQL Statements in a C Program
30
Compiling and Executing a Host-Language Program
31
Processing Errors, Warnings, and Status Information
31
Dynamic SQL
32
Example 1-2. Dynamic SQL Statements in a C Program
32
SQL/MP Version Management
33
Specifying a Declare Section
35
2 Host Variables (Continued)
36
Coding Host Variable Names
36
Using Corresponding SQL and C Data Types
37
Table 2-1. Corresponding SQL and C Character Data Types
37
Table 2-2. Corresponding SQL and C Numeric, Date-Time, and INTERVAL Data Types
38
Data Conversion
39
Specifying Host Variables in SQL Statements
40
Declaring and Using Host Variables
41
Fixed-Length Character Data
41
Variable-Length Character Data
43
Structures
43
Decimal Data Types
45
Fixed-Point Data Types
45
Date-Time and INTERVAL Data Types
47
Table 2-3. Date-Time and INTERVAL Data Types
47
Example 2-1. Creating Valid DATETIME and INTERVAL Data Types
50
Inserting a Null Value
51
Testing for a Null Value
51
Using Indicator Variables for Null Values
51
Creating Host Variables Using the INVOKE Directive
52
Retrieving Rows with Null Values
52
Advantages of Using an INVOKE Directive
53
C Structures Generated by the INVOKE Directive
53
Example 2-2. CREATE TABLE Statements
54
Example 2-3. Structures Generated by the INVOKE Directive
55
Using Indicator Variables with the INVOKE Directive
56
Associating a Character Set with a Host Variable
58
Using INVOKE with SQLCI
58
Treatment in C Statements
59
VARCHAR Data Type
59
3 SQL/MP Statements and Directives
61
Embedding SQL Statements
61
Coding Statements and Directives
61
Placing Statements and Directives
62
Finding Information
63
Table 3-1. Summary of SQL/MP Statements and Directives
63
Table 3-2. C Compiler Pragmas for SQL/MP
67
Table 4-1. SQL/MP Statements for Data Retrieval and Modification
69
4 Data Retrieval and Modification
70
Opening and Closing Tables and Views
70
Causes of SQL Error 8204 (Lost Open Error)
70
Recovering from SQL Error 8204
71
Single-Row SELECT Statement
72
Using a Column Value to Select Data
73
Using a Primary Key Value to Select Data
74
Multirow SELECT Statement
74
A more Complex Example
75
Simple Example
75
The most Complex Example
75
INSERT Statement
76
Inserting a Null Value
77
Inserting a Single Row
77
Inserting a Timestamp Value
78
UPDATE Statement
78
Updating a Single Row
79
Updating Columns with Null Values
80
Updating Multiple Rows
80
DELETE Statement
80
Deleting a Single Row
81
Deleting Multiple Rows
81
Using SQL Cursors
82
Example 4-1. Using a Static SQL Cursor in a C Program
82
Steps for Using a Cursor
83
Cursor Position
84
Process Access ID (PAID) Requirements
84
Table 4-2. Determining the Cursor Position
84
Cursor Stability
85
Virtual Sequential Block Buffering (VSBB)
85
DECLARE CURSOR Statement
86
OPEN Statement
87
FETCH Statement
88
Multirow SELECT Statement
89
UPDATE Statement
90
Multirow DELETE Statement
91
CLOSE Statement
92
Using Foreign Cursors
92
5 SQL/MP System Procedures
95
Guardian System Procedures
96
Cextdecs Header File
96
SQL Message File
96
Table 5-1. SQL/MP System Procedures
96
Table 5-2. Guardian System Procedures that Return SQL Information
96
Sqlcadisplay
97
Table of Contents
100
Sqlcafscode
102
Sqlcagetinfolist
103
Table
103
Table 5-3. SQLCAGETINFOLIST Procedure Error Codes
105
Table 5-4. SQLCAGETINFOLIST Procedure Item Codes
105
Example 5-1. Example of the SQLCAGETINFOLIST Procedure
107
Sqlcatobuffer
108
Internal_Error_Loc
111
The Default Is y
111
Prefix_Length
111
Suffix_Length
111
Sqlgetcatalogversion
112
Sqlgetobjectversion
113
Sqlgetsystemversion
113
Sqlsadisplay
114
Detail_Params
115
Char Sio; Short *Out_Fcb_1; Short *Out_Fcb_2; } Detail_Params
115
N Do Not Use SIO; Write to Output_File_Number
115
Outfcb1
115
Specifies Whether Sequential I/O Is Used
115
Struct Detail_Params_Type
115
Y Use SIO; Ignore Output_File_Number
115
Example 5-2. Example of the SQLSADISPLAY Display
116
Table 5-5. SQLSADISPLAY Procedure Display Elements
116
6 Explicit Program Compilation
117
Table 6-1. C Compilers
118
Table 6-2. Compilation Mode and Execution Environment
118
Figure 6-1. Explicit SQL Compilation of a C Program on TNS
119
Figure 6-2. Explicit SQL Compilation of a C Program on TNS/R
120
Developing a C Program in the Guardian Environment
121
Figure 6-3. Explicit SQL Compilation of a C Program on TNS/E
121
Using TACL Defines in the Guardian Environment
122
Specifying the SQL Pragma in the Guardian Environment
123
Running the TNS C Compiler in the Guardian Environment
125
Running the TNS/R NMC and TNS/E CCOMP Compiler in the Guardian Environment
126
Binding SQL Program Files in the Guardian Environment
127
Running the SQL Compiler in the Guardian Environment
128
Required Access Authority
129
Using Current Statistics
137
Figure 6-4. SQL/MP Program File Format
140
SQL Program File Format
140
Example 6-1. Sample SQL Compiler Listing
141
SQL Compiler Listings
141
Developing a C Program in the OSS Environment
144
Using TACL Defines in the OSS Environment
145
Using the C89 Utility in the OSS Environment
146
Developing a C Program in a PC Host Environment
151
Using CONTROL Directives
151
Dynamic SQL Statements
152
Static SQL Statements
152
Dynamic SQL Statements
153
C Compiler
154
SQL Compiler
154
SQL Program Files
154
Using Compatible Compilation Tools
154
7 Program Execution
157
Required Access Authority
157
Using TACL Defines
158
Entering the TACL RUN Command
159
Running a Program in the OSS Environment
159
Running a Program at a Low PIN
160
Figure 7-1. Processes Running on a Nonstop System
160
Interactive Commands
161
Programmatic Commands
161
Pathway Environment
162
Determining Compatibility with the SQL Executor
163
8 Program Invalidation and Automatic SQL Recompilation
165
Program Invalidation
165
SQL Compiler Validation Functions
165
Causes of Program Invalidation
166
File-Label and Catalog Inconsistencies
168
Preventing Program Invalidation
168
Automatic SQL Recompilation
169
Causes of Automatic Recompilation
170
Figure 8-1. Timestamp Check
172
Recompilation (Continued)
172
Preventing Automatic Recompilations
173
Run-Time Recompilation Errors
173
9 Error and Status Reporting
181
Using the INCLUDE STRUCTURES Directive
181
Checking the Version of the C Compiler
183
Generating Structures with Different Versions
183
Sharing Structures
183
Returning Error and Warning Information
184
Checking the Sqlcode Variable
184
Example 9-1. Checking the Sqlcode Variable
185
Table 9-1. C Compiler Pseudocode for Checking the Sqlcode Variable
186
Using the WHENEVER Directive
186
Example 9-2. Enabling and Disabling the WHENEVER Directive
189
Example 9-3. Using the WHENEVER Directive
190
Returning Information from the SQLCA Structure
192
Table 9-2. C Identifiers Generated by the INCLUDE SQLCA Directive
192
Table 9-3. System Procedures for the SQLCA Structure
192
Returning Performance and Statistics Information
193
Declaring the SQLSA Structure
193
Using the SQLSA Structure
193
Table 9-4. C Identifiers Generated by the INCLUDE SQLSA Directive
194
Example 9-4. Version 300-325 SQLSA Structure
195
Example 9-5. Version 330 (or Later) SQLSA Structure
196
Table 9-5. SQLSA Structure Fields
197
10 Dynamic SQL Operations
199
Uses for Dynamic SQL
199
Dynamic SQL Statements
200
Table 10-1. Dynamic SQL Statements
200
Dynamic SQL Features
201
SQLDA Structure, Names Buffer, and Collation Buffer
201
Table 10-2. C Identifiers Generated by the INCLUDE SQLDA Directive
203
Table 10-3. SQLDA Structure Fields
203
Example 10-1. SQLDA Structure and Buffers
205
Table 10-4. SQLDA Data Type Declarations
206
Table 10-5. SQLDA Date-Time and INTERVAL Declarations
208
Input Parameters and Output Variables
209
Table 10-6. SQLDA Character-Set Ids
209
Example 10-2. Getting Parameter Values
213
Null Values
214
Dynamic Allocation of Memory
216
Figure 10-1. DESCRIBE Input's Effect on Names Buffer
216
Using Dynamic SQL Cursors
218
Example 10-3. Using Statement and Cursor Host Variables
220
Developing a Dynamic SQL Program
221
Copy any External Declarations
221
Declare the Sqlcode Variable and Host Variables
221
Specify any WHENEVER Directives
221
Specify the SQL Pragma
221
Declare an SQLSA Structure
222
Declare the SQLDA Structure and Names Buffer
222
Process the Input Parameters
222
Specify the INCLUDE STRUCTURES Directive
222
Process the Output Variables
223
Read and Compile the SQL Statement
223
Perform the Database Request and Display the Values
225
Allocate Memory for the SQLDA Structures and Names Buffers
227
Example 10-4. Allocating the SQLDA Structure
228
Example 10-5. Allocating Memory for Parameters and Columns
230
Allocate and Fill in Output Variables
231
Example 10-6. Displaying Output
232
Developing a Dynamic SQL Pathway Server
234
Dynamic SQL Sample Programs
235
Basic Dynamic SQL Program
235
Example 10-7. Basic Dynamic SQL Program
237
Detailed Dynamic SQL Program
240
Example 10-8. Detailed Dynamic SQL Program
242
Detailed Dynamic SQL Program
243
11 Character Processing Rules (CPRL) Procedures
265
Cextdecs Header File
266
CPRL Return Codes
266
Table 11-1. Character Processing Rules (CPRL) Procedures
266
Cprl_Are
267
Cprl_Arealphas
268
Cprl_Arenumerics
269
Cprl_Compare1Encoded
270
Cprl_Compare
271
Cprl_Compareobjects
272
Cprl_Decode
273
Cprl_Downshift
274
Cprl_Encode
275
Cprl_Getalphatable
276
Cprl_Getcharclasstable
277
Cprl_Getdownshifttable
278
Cprl_Getfirst
279
Cprl_Getlast
280
Cprl_Getnextinsequence
281
Cprl_Getnumtable
282
Cprl_Getspecialtable
283
Cprl_Getupshifttable
284
Cprl_Info
284
Cprl_Readobject
286
Cprl_Upshift
287
SQL/MP Sample Database
289
Figure
290
Figure A-1. SQL/MP Sample Database Relations
290
Table
290
Example A-1. COPYLIB File for Sample Database
291
Memory Considerations
295
SQL/MP Internal Structures
295
Table B-1. SQL/MP Data Structures
295
Estimating Memory Requirements
296
Using the SQLMEM Pragma
296
Table B-2. Virtual Memory Requirements for SQL Statements
297
Avoiding Memory Stack Overflows
298
Using a Local Partition
301
Using Current Statistics
302
Using TACL Defines
302
Skipping Unavailable Partitions
303
Generating SQL Data Structures
305
Generating SQLDA Structures
306
Table D-1. Changes to SQL Data Structures
306
Generating a Version 2 SQLDA Structure
307
Generating a Version 300 (or Later) SQLDA Structure
307
Version 2 SQLDA Structure
308
Version 1 SQLDA Structure
310
Planning for Future Pvus
312
RELEASE1 and RELEASE2 Options
312
SQL/MP Version Procedures
312
Advertisement
Advertisement
Related Products
HP HP NonStop Data Transformation Engine FTP Adapter
Hp NonStop RDF H-series RVUs
Hp NonStop RDF J-series RVUs
Hp NonStop SQL/MX
Hp NonStop SSL
Hp NonStop Pathway/iTS
Hp NonStop TMF
HP NonStop Transformation Engine
HP NonStop RDF
HP NonStop SQL/MX 3.0
Hp Categories
Desktop
Laptop
Server
Monitor
Switch
More Hp Manuals
Login
Sign In
OR
Sign in with Facebook
Sign in with Google
Upload manual
Upload from disk
Upload from URL