1 | UNIT SQL;
|
---|
2 |
|
---|
3 | {*************************************************************************
|
---|
4 | * *
|
---|
5 | * Module Name = SQL.H *
|
---|
6 | * *
|
---|
7 | * Descriptive Name = External Include file for Database Manager *
|
---|
8 | * *
|
---|
9 | * Copyright = 5622-044 (C) Copyright IBM Corp. 1988, 1993 *
|
---|
10 | * Licensed Material - Program Property of IBM *
|
---|
11 | * Refer to Copyright Instructions Form Number G120-3083 *
|
---|
12 | * *
|
---|
13 | * Function = Include File defining *
|
---|
14 | * System Constants *
|
---|
15 | * SQLCA/SQLDA Constants *
|
---|
16 | * Dynamic Link Interface to BINDER *
|
---|
17 | * Error Message Retrieval Interface *
|
---|
18 | * Authorization Constants *
|
---|
19 | * *
|
---|
20 | *************************************************************************}
|
---|
21 |
|
---|
22 | INTERFACE
|
---|
23 |
|
---|
24 | USES OS2Def;
|
---|
25 |
|
---|
26 | TYPE
|
---|
27 | /* SQL Communication Area - SQLCA */
|
---|
28 | PSQLCA=^TSQLCA;
|
---|
29 | TSQLCA=RECORD
|
---|
30 | sqlcaid: ARRAY[0..7] OF BYTE; /* Eyecatcher = 'SQLCA ' */
|
---|
31 | sqlcabc:LONG; /* SQLCA size in bytes = 136 */
|
---|
32 | sqlcode:LONG; /* SQL return code */
|
---|
33 | sqlerrml:SHORT; /* Length for SQLERRMC */
|
---|
34 | sqlerrmc: ARRAY[0..69] OF BYTE; /* Error message tokens */
|
---|
35 | sqlerrp:ARRAY[0..7] OF BYTE; /* Diagnostic information */
|
---|
36 | sqlerrd:ARRAY[0..5] OF LONG; /* Diagnostic information */
|
---|
37 | sqlwarn:ARRAY[0..10] OF BYTE; /* Warning flags */
|
---|
38 | sqlstate:ARRAY[0..4] OF BYTE; /* State corresponding to SQLCODE */
|
---|
39 | END;
|
---|
40 |
|
---|
41 | VAR
|
---|
42 | sqlca:TSQLCA;
|
---|
43 |
|
---|
44 | VAR
|
---|
45 | SQLCODE :LONG ABSOLUTE sqlca.sqlcode;
|
---|
46 | SQLWARN0 :BYTE ABSOLUTE sqlca.sqlwarn[0];
|
---|
47 | SQLWARN1 :BYTE ABSOLUTE sqlca.sqlwarn[1];
|
---|
48 | SQLWARN2 :BYTE ABSOLUTE sqlca.sqlwarn[2];
|
---|
49 | SQLWARN3 :BYTE ABSOLUTE sqlca.sqlwarn[3];
|
---|
50 | SQLWARN4 :BYTE ABSOLUTE sqlca.sqlwarn[4];
|
---|
51 | SQLWARN5 :BYTE ABSOLUTE sqlca.sqlwarn[5];
|
---|
52 | SQLWARN6 :BYTE ABSOLUTE sqlca.sqlwarn[6];
|
---|
53 | SQLWARN7 :BYTE ABSOLUTE sqlca.sqlwarn[7];
|
---|
54 | SQLWARN8 :BYTE ABSOLUTE sqlca.sqlwarn[8];
|
---|
55 | SQLWARN9 :BYTE ABSOLUTE sqlca.sqlwarn[9];
|
---|
56 | SQLWARNA :BYTE ABSOLUTE sqlca.sqlwarn[10];
|
---|
57 |
|
---|
58 | CONST
|
---|
59 | /* System Constants */
|
---|
60 |
|
---|
61 | SQL_KEYPMAX = 16 ; /* Maximum nbr of key parts in Index */
|
---|
62 | SQL_KEYLMAX = 255 ; /* Maximum key length */
|
---|
63 | SQL_SORTFLDLMT = 254 ; /* Maximum size of field for sort */
|
---|
64 | SQL_MAXRECL = 4005 ; /* Maximum record length */
|
---|
65 | SQL_MAXTABLES = 15 ; /* Maximum nbr of tables in a SELECT */
|
---|
66 | SQL_MAXSEL_ITEMS = 255 ; /* Maximum nbr of items in a SELECT */
|
---|
67 | SQL_MAXVARS = 880 ; /* Maximum nbr of unique Host Vars */
|
---|
68 | SQL_MAXVARS_STMT = 1489 ; /* Maximum nbr of Host Vars per stmt */
|
---|
69 | SQL_MAXSTMTS = 400 ; /* Maximum nbr of Sections in a Plan */
|
---|
70 | SQL_MAXCOLS = 255 ; /* Maximum nbr of columns in a table */
|
---|
71 | SQL_MAX_STMT_SIZ = 32765 ; /* Maximum statement size */
|
---|
72 |
|
---|
73 | SQL_SMALL_LENGTH = 2 ; /* Size of a SMALLINT */
|
---|
74 | SQL_MAXSMALLVAL = 32767 ; /* Maximum value of a SMALLINT */
|
---|
75 | SQL_MINSMALLVAL = -32768 ; /* Minimum value of a SMALLINT */
|
---|
76 | SQL_INT_LENGTH = 4 ; /* Size of an INTEGER */
|
---|
77 | SQL_MAXINTVAL = maxint ; /* Maximum value of an INTEGER */
|
---|
78 | SQL_MININTVAL = minint ; /* Minimum value of an INTEGER */
|
---|
79 | SQL_FLOAT_LENGTH = 8 ; /* Size of a FLOAT */
|
---|
80 | SQL_DEFDEC_PRECISION= 5 ; /* Default precision for DECIMAL */
|
---|
81 | SQL_DEFDEC_SCALE = 0 ; /* Default scale for DECIMAL */
|
---|
82 | SQL_MAXDECIMAL = 31 ; /* Maximum scale/prec. for DECIMAL */
|
---|
83 | SQL_DEFCHAR = 1 ; /* Default length for a CHAR */
|
---|
84 | SQL_MAXCHAR = 254 ; /* Maximum length of a CHAR */
|
---|
85 | SQL_MAXLSTR = 255 ; /* Maximum length of an LSTRING */
|
---|
86 | SQL_MAXVCHAR=(SQL_MAXRECL-5); /* Maximum length of a VARCHAR */
|
---|
87 | SQL_MAXVGRAPH = 2000 ; /* Maximum length of a VARGRAPHIC */
|
---|
88 | SQL_VCHAROH = 4 ; /* Overhead for VARCHAR in record */
|
---|
89 | SQL_LONGMAX = 32700 ; /* Maximum length of a LONG VARCHAR */
|
---|
90 | SQL_LONGGRMAX = 16350 ; /* Max. length of a LONG VARGRAPHIC */
|
---|
91 | SQL_LVCHAROH = 24 ; /* Overhead for LONG VARCHAR in rec. */
|
---|
92 | SQL_TIME_LENGTH = 3 ; /* Size of a TIME field */
|
---|
93 | SQL_TIME_STRLEN = 8 ; /* Size of a TIME field output */
|
---|
94 | SQL_TIME_MINSTRLEN= 5 ; /* Size of a non-USA TIME field output
|
---|
95 | without seconds */
|
---|
96 | SQL_DATE_LENGTH = 4 ; /* Size of a DATE field */
|
---|
97 | SQL_DATE_STRLEN = 10 ; /* Size of a DATE field output */
|
---|
98 | SQL_STAMP_LENGTH = 10 ; /* Size of a TIMESTAMP field */
|
---|
99 | SQL_STAMP_STRLEN = 26 ; /* Size of a TIMESTAMP field output */
|
---|
100 | SQL_STAMP_MINSTRLEN= 19 ; /* Size of a TIMESTAMP field output
|
---|
101 | without microseconds */
|
---|
102 | SQL_IND_LENGTH = 2 ; /* Size of a indicator value */
|
---|
103 |
|
---|
104 | SQL_LG_IDENT = 18 ; /* Maximum length of Long Identifer */
|
---|
105 | SQL_SH_IDENT = 8 ; /* Maximum length of Short Identifer */
|
---|
106 | SQL_MN_IDENT = 1 ; /* Minimum length of Identifiers */
|
---|
107 | SQL_MAX_VAR_NAME = 30 ; /* Max size of Host Variable Name */
|
---|
108 |
|
---|
109 |
|
---|
110 |
|
---|
111 | /* Codepages */
|
---|
112 | SQL_CP_437 = 437 ; /* Codepage 437 - US, Europe */
|
---|
113 | SQL_CP_813 = 813 ; /* Codepage 813 - AIX Greece */
|
---|
114 | SQL_CP_819 = 819 ; /* Codepage 819 - ISO 8859-1 */
|
---|
115 | SQL_CP_850 = 850 ; /* Codepage 850 - International PC */
|
---|
116 | SQL_CP_852 = 852 ; /* Codepage 852 - OS2 Latin2 */
|
---|
117 | SQL_CP_857 = 857 ; /* Codepage 857 - OS2 Turkey */
|
---|
118 | SQL_CP_860 = 860 ; /* Codepage 860 - Portuguese */
|
---|
119 | SQL_CP_862 = 862 ; /* Codepage 860 - OS2 Hebrew */
|
---|
120 | SQL_CP_863 = 863 ; /* Codepage 863 - Canadian-French */
|
---|
121 | SQL_CP_864 = 864 ; /* Codepage 863 - OS2 Arabic */
|
---|
122 | SQL_CP_865 = 865 ; /* Codepage 865 - Norway, Denmark */
|
---|
123 | SQL_CP_869 = 869 ; /* Codepage 869 - OS2 Greece */
|
---|
124 | SQL_CP_891 = 891 ; /* Codepage 891 - Korean */
|
---|
125 | SQL_CP_897 = 897 ; /* Codepage 897 - Japanese */
|
---|
126 | SQL_CP_903 = 903 ; /* Codepage 903 - Chinese */
|
---|
127 | SQL_CP_904 = 904 ; /* Codepage 904 - Taiwan */
|
---|
128 | SQL_CP_912 = 912 ; /* Codepage 912 - AIX Latin2 */
|
---|
129 | SQL_CP_916 = 916 ; /* Codepage 916 - AIX Hebrew */
|
---|
130 | SQL_CP_920 = 920 ; /* Codepage 920 - AIX Turkey */
|
---|
131 | SQL_CP_1040 = 1040 ; /* Codepage 1040 - Extended Korean */
|
---|
132 | SQL_CP_1041 = 1041 ; /* Codepage 1041 - Extended Japanese */
|
---|
133 | SQL_CP_1042 = 1042 ; /* Codepage 1042 - Extended Chinese */
|
---|
134 | SQL_CP_1043 = 1043 ; /* Codepage 1043 - Extended Taiwan */
|
---|
135 | SQL_CP_1046 = 1046 ; /* Codepage 1046 - AIX Arabic */
|
---|
136 | SQL_CP_1088 = 1088 ; /* Codepage 1088 - Korea Std */
|
---|
137 | SQL_CP_1089 = 1089 ; /* Codepage1089 - AIX Arabic */
|
---|
138 |
|
---|
139 | /* DBCS Codepages */
|
---|
140 | SQL_CP_926 = 926 ; /* Codepage 926 - Korean */
|
---|
141 | SQL_CP_951 = 951 ; /* Codepage 951 - New Korean */
|
---|
142 | SQL_CP_301 = 301 ; /* Codepage 301 - Japanese */
|
---|
143 | SQL_CP_928 = 928 ; /* Codepage 928 - Chinese */
|
---|
144 | SQL_CP_927 = 927 ; /* Codepage 927 - Taiwan */
|
---|
145 |
|
---|
146 | /* Combined Codepages */
|
---|
147 | SQL_CP_934 = 934 ; /* Codepage 891 + 926 - Korean */
|
---|
148 | SQL_CP_949 = 949 ; /* CP 1088 + 951 - Korean Std */
|
---|
149 | SQL_CP_932 = 932 ; /* Codepage 897 + 301 - Japanese */
|
---|
150 | SQL_CP_936 = 936 ; /* Codepage 903 + 928 - Chinese */
|
---|
151 | SQL_CP_938 = 938 ; /* Codepage 904 + 927 - Taiwan */
|
---|
152 | SQL_CP_944 = 944 ; /* Codepage 1040 + 926 - Ext.Korean */
|
---|
153 | SQL_CP_942 = 942 ; /* Codepage 1041 + 301 - Ext.Japanese*/
|
---|
154 | SQL_CP_946 = 946 ; /* Codepage 1042 + 928 - Ext.Chinese */
|
---|
155 | SQL_CP_948 = 948 ; /* Codepage 1043 + 927 - Ext.Taiwan */
|
---|
156 |
|
---|
157 | /* Datastream Types */
|
---|
158 | SQL_JPN_PC = 1;/* Japanese-PC */
|
---|
159 | SQL_CHN_PC = 2;/* Chinese-PC */
|
---|
160 | SQL_KOR_PC = 3;/* Korean-PC */
|
---|
161 | SQL_KSC_PC = 4;/* New Korean-PC */
|
---|
162 | SQL_SBC_PC = 0;/* Single byte PC */
|
---|
163 | SQL_UNKN_PC = 255;/* Unknown */
|
---|
164 |
|
---|
165 | /* SQLCA Constants */
|
---|
166 |
|
---|
167 | SQL_RC_INVALID_SQLCA = -1; /* Invalid SQLCA address */
|
---|
168 |
|
---|
169 | /* Size of SQLCA */
|
---|
170 | SQLCA_SIZE = sizeof(sqlca);
|
---|
171 |
|
---|
172 | /* SQL Error message token delimiter */
|
---|
173 | SQL_ERRMC_PRES =$FF; /* delimiter for string entry */
|
---|
174 |
|
---|
175 | /* Offset in SQLERRD - Diagnostic information */
|
---|
176 | SQL_ERRD_RC =0 ; /* return code */
|
---|
177 | SQL_ERRD_REAS =1 ; /* reason code */
|
---|
178 | SQL_ERRD_CNT =2 ; /* nbr rows inserted/updated/deleted */
|
---|
179 | SQL_ERRD_OPTM =3 ; /* optimizer information */
|
---|
180 | SQL_ERRD_DCNT =4 ; /* nbr of cascaded deletes/updates */
|
---|
181 | SQL_ERRD_LINE =4 ; /* line number for recompile error */
|
---|
182 | SQL_ERRD_DIAG =5 ; /* diagnostics */
|
---|
183 |
|
---|
184 | /* Indexes in SQLWARN - Warning flags */
|
---|
185 | SQL_WARN_ANY =0; /* composite - set if any warnings */
|
---|
186 | SQL_WARN_TRUNC=1; /* string column truncated */
|
---|
187 | SQL_WARN_NUL =2; /* null values eliminated */
|
---|
188 | SQL_WARN_MISM =3; /* nbr of columns/host vars mismatch */
|
---|
189 | SQL_WARN_ALLR =4; /* no WHERE clause in update/delete */
|
---|
190 | SQL_WARN_DATE =6; /* date has been truncated */
|
---|
191 |
|
---|
192 | /* Values for Warning flags in SQLWARN */
|
---|
193 | SQL_WARNING ='W'; /* warning indicator */
|
---|
194 | SQL_NULL_TRN ='N'; /* null terminator truncated warning */
|
---|
195 | SQL_NO_WARN =' '; /* no warning indicator */
|
---|
196 |
|
---|
197 |
|
---|
198 |
|
---|
199 | /* SQLDA Constants */
|
---|
200 |
|
---|
201 | /* increment for type with null indicator */
|
---|
202 | SQL_TYP_NULINC = 1 ;
|
---|
203 |
|
---|
204 | /* Variable Types */
|
---|
205 | SQL_TYP_DATE = 384 ; /* DATE */
|
---|
206 | SQL_TYP_NDATE = (SQL_TYP_DATE+SQL_TYP_NULINC);
|
---|
207 |
|
---|
208 | SQL_TYP_TIME = 388 ; /* TIME */
|
---|
209 | SQL_TYP_NTIME = (SQL_TYP_TIME+SQL_TYP_NULINC);
|
---|
210 |
|
---|
211 | SQL_TYP_STAMP = 392 ; /* TIMESTAMP */
|
---|
212 | SQL_TYP_NSTAMP = (SQL_TYP_STAMP+SQL_TYP_NULINC);
|
---|
213 |
|
---|
214 | SQL_TYP_VARCHAR = 448 ; /* VARCHAR(i) - varying length string
|
---|
215 | (2 byte length) */
|
---|
216 | SQL_TYP_NVARCHAR = (SQL_TYP_VARCHAR+SQL_TYP_NULINC);
|
---|
217 |
|
---|
218 | SQL_TYP_CHAR = 452 ; /* CHAR(i) - fixed length string */
|
---|
219 | SQL_TYP_NCHAR = (SQL_TYP_CHAR+SQL_TYP_NULINC);
|
---|
220 |
|
---|
221 | SQL_TYP_LONG = 456 ; /* LONG VARCHAR - varying length
|
---|
222 | string */
|
---|
223 | SQL_TYP_NLONG = (SQL_TYP_LONG+SQL_TYP_NULINC);
|
---|
224 |
|
---|
225 | SQL_TYP_CSTR = 460 ; /* varying length string for C
|
---|
226 | (null terminated) */
|
---|
227 | SQL_TYP_NCSTR = (SQL_TYP_CSTR+SQL_TYP_NULINC);
|
---|
228 |
|
---|
229 | SQL_TYP_VARGRAPH = 464 ; /* VARGRAPHIC(i) - varying length
|
---|
230 | graphic string (2 byte length) */
|
---|
231 | SQL_TYP_NVARGRAPH = (SQL_TYP_VARGRAPH+SQL_TYP_NULINC);
|
---|
232 |
|
---|
233 | SQL_TYP_GRAPHIC = 468 ; /* GRAPHIC(i) - fixed length graphic
|
---|
234 | string */
|
---|
235 | SQL_TYP_NGRAPHIC = (SQL_TYP_GRAPHIC+SQL_TYP_NULINC);
|
---|
236 |
|
---|
237 | SQL_TYP_LONGRAPH = 472 ; /* LONG VARGRAPHIC(i) - varying length
|
---|
238 | graphic string */
|
---|
239 | SQL_TYP_NLONGRAPH = (SQL_TYP_LONGRAPH+SQL_TYP_NULINC);
|
---|
240 |
|
---|
241 | SQL_TYP_LSTR = 476 ; /* varying length string for Pascal
|
---|
242 | (1-byte length) */
|
---|
243 | SQL_TYP_NLSTR = (SQL_TYP_LSTR+SQL_TYP_NULINC);
|
---|
244 |
|
---|
245 | SQL_TYP_FLOAT = 480 ; /* FLOAT - 8-byte floating point */
|
---|
246 | SQL_TYP_NFLOAT = (SQL_TYP_FLOAT+SQL_TYP_NULINC);
|
---|
247 |
|
---|
248 | SQL_TYP_DECIMAL = 484 ; /* DECIMAL (m,n) */
|
---|
249 | SQL_TYP_NDECIMAL = (SQL_TYP_DECIMAL+SQL_TYP_NULINC);
|
---|
250 |
|
---|
251 | SQL_TYP_ZONED = 488 ; /* Zoned Decimal -> DECIMAL (m,n) */
|
---|
252 | SQL_TYP_NZONED = (SQL_TYP_ZONED+SQL_TYP_NULINC); /* &01 */
|
---|
253 |
|
---|
254 | SQL_TYP_INTEGER = 496 ; /* INTEGER - 4-byte signed integer */
|
---|
255 | SQL_TYP_NINTEGER = (SQL_TYP_INTEGER+SQL_TYP_NULINC);
|
---|
256 |
|
---|
257 | SQL_TYP_SMALL = 500 ; /* SMALLINT - 2-byte signed integer*/
|
---|
258 | SQL_TYP_NSMALL = (SQL_TYP_SMALL+SQL_TYP_NULINC);
|
---|
259 |
|
---|
260 | SQL_TYP_NUMERIC = 504 ; /* NUMERIC -> DECIMAL (m,n) &01 */
|
---|
261 | SQL_TYP_NNUMERIC = (SQL_TYP_NUMERIC+SQL_TYP_NULINC); /* &01 */
|
---|
262 |
|
---|
263 |
|
---|
264 |
|
---|
265 | /* Return Codes for sqlabind and sqlabndr */
|
---|
266 |
|
---|
267 | SQLA_RC_BINDERROR = -1 ; /* Bind execution failed */
|
---|
268 | SQLA_RC_BAD_BINDNAME = -2 ; /* Invalid bind file */
|
---|
269 | SQLA_RC_BAD_DBNAME = -3 ; /* Invalid database */
|
---|
270 | SQLA_RC_BAD_PASSWD = -4 ; /* Invalid password
|
---|
271 | (not used after Release 2) */
|
---|
272 | SQLA_RC_BAD_MSGNAME = -5 ; /* Invalid message file */
|
---|
273 | SQLA_RC_BAD_FORMAT = -6 ; /* Invalid format */
|
---|
274 | SQLA_RC_OPEN_ERROR = -31; /* Error opening list file */
|
---|
275 | SQLA_RC_BAD_BNDFILE = -39; /* Bind file corrupted */
|
---|
276 | SQLA_RC_LIST_ERROR = -40; /* Bind list errors */
|
---|
277 | SQLA_RC_INTERRUPT = -94; /* Interrupt */
|
---|
278 |
|
---|
279 | /* Additional return Codes for sqlabndr only */
|
---|
280 | SQLA_RC_OPTION_LEN_BAD =-4903;/* Option array length is invalid */
|
---|
281 | SQLA_RC_OPTION_PTR_BAD =-4904;/* Option array ptr is invalid */
|
---|
282 | SQLA_RC_OPTION_SIZE_BAD=-4905;/* Option array size is invalid */
|
---|
283 | SQLA_RC_OPTION_DATA_BAD=-4917;/* Option array data is invalid */
|
---|
284 |
|
---|
285 | /* Values used for the date/time format parameter of sqlabind */
|
---|
286 | SQL_FMT_DEF = 'DEF' ; /* FORMAT = Default for Country Code */
|
---|
287 | SQL_FMT_USA = 'USA' ; /* FORMAT = USA */
|
---|
288 | SQL_FMT_EUR = 'EUR' ; /* FORMAT = EUR */
|
---|
289 | SQL_FMT_ISO = 'ISO' ; /* FORMAT = ISO */
|
---|
290 | SQL_FMT_JIS = 'JIS' ; /* FORMAT = JIS */
|
---|
291 | SQL_FMT_LOC = 'LOC' ; /* FORMAT = LOCAL */
|
---|
292 |
|
---|
293 |
|
---|
294 | TYPE
|
---|
295 | /* Structures used system wide */
|
---|
296 | PSQLCHAR=^TSQLCHAR;
|
---|
297 | TSQLCHAR=RECORD
|
---|
298 | length:SHORT;
|
---|
299 | data:BYTE;
|
---|
300 | END;
|
---|
301 |
|
---|
302 | VAR
|
---|
303 | sqlchar:TSQLCHAR;
|
---|
304 |
|
---|
305 | TYPE
|
---|
306 | /* Structure used to store binder options when calling sqlabndr */
|
---|
307 | PSQLOPT=^TSQLOPT;
|
---|
308 | TSQLOPT=RECORD
|
---|
309 | header:RECORD /* Header for sqlopt structur */
|
---|
310 | allocated:ULONG; /* Number of options allocated */
|
---|
311 | used:ULONG; /* Number of options used */
|
---|
312 | END;
|
---|
313 | option:RECORD
|
---|
314 | atype:ULONG; /* Type of bind option */
|
---|
315 | val:ULONG; /* Value of bind option */
|
---|
316 | END;
|
---|
317 | END;
|
---|
318 |
|
---|
319 | VAR
|
---|
320 | sqlopt:TSQLOPT;
|
---|
321 |
|
---|
322 | CONST
|
---|
323 | /* Values used for option[n].type in the sqlopt structure of sqlabndr */
|
---|
324 | SQL_FRMT_OPT = 1 ; /* Option for date/time format */
|
---|
325 | SQL_ISO_OPT = 4 ; /* Option for isolation level */
|
---|
326 | SQL_BLOCK_OPT = 5 ; /* Option for record blocking */
|
---|
327 | SQL_GRANT_OPT = 6 ; /* Option for granting privileges */
|
---|
328 |
|
---|
329 | /* Values used for option[n].val when option[n].type is SQL_FRMT_OPT */
|
---|
330 | /* These can be also be used for the date/time format parameter of sqlabind */
|
---|
331 | SQL_FMT_0 ='0'; /* FORMAT = Default for Country Code */
|
---|
332 | SQL_FMT_1 ='1'; /* FORMAT = USA */
|
---|
333 | SQL_FMT_2 ='2'; /* FORMAT = EUR */
|
---|
334 | SQL_FMT_3 ='3'; /* FORMAT = ISO */
|
---|
335 | SQL_FMT_4 ='4'; /* FORMAT = JIS */
|
---|
336 | SQL_FMT_5 ='5'; /* FORMAT = LOCAL */
|
---|
337 |
|
---|
338 | /* Values used for option[n].val when option[n].type is SQL_ISO_OPT */
|
---|
339 | SQL_REP_READ = 0 ; /* Repeatable read level */
|
---|
340 | SQL_CURSOR_STAB = 1 ; /* Cursor stability level */
|
---|
341 | SQL_UNCOM_READ = 2 ; /* Uncommitted read level */
|
---|
342 |
|
---|
343 | /* Values used for option[n].val when option[n].type is SQL_BLOCK_OPT */
|
---|
344 | SQL_BL_UNAMBIG = 0 ; /* Block Unambiguous cursors */
|
---|
345 | SQL_BL_ALL = 1 ; /* Block All cursors */
|
---|
346 | SQL_NO_BL = 2 ; /* Block No cursors */
|
---|
347 |
|
---|
348 |
|
---|
349 | /* Return Codes for sqlaintp */
|
---|
350 | SQLA_ERR_BADCC =-1 ; /* insufficient memory for msg file */
|
---|
351 | SQLA_ERR_NOCOD =-2 ; /* no error code in SQLCA */
|
---|
352 | SQLA_ERR_NOMSG =-3 ; /* requested message not found */
|
---|
353 | SQLA_ERR_BADLL =-4 ; /* specified line length negative */
|
---|
354 | SQLA_ERR_BADCA =-5 ; /* invalid sqlca/buffer addr/length */
|
---|
355 |
|
---|
356 |
|
---|
357 |
|
---|
358 | /* Administrative/Database Authorizations returned from Get Administrative
|
---|
359 | Authorizations function */
|
---|
360 |
|
---|
361 | /* Authorizations granted explicitly to user */
|
---|
362 | SQL_SYSADM =$0001 ; /* SYSADM Authority */
|
---|
363 | SQL_DBADM =$0002 ; /* DBADM Authority */
|
---|
364 | SQL_CREATETAB =$0004 ; /* CREATETAB Privilege */
|
---|
365 | SQL_BINDADD =$0008 ; /* BINDADD Privilege */
|
---|
366 | SQL_CONNECT =$0010 ; /* CONNECT Privilege */
|
---|
367 |
|
---|
368 | /* Composite of authorizations granted explicitly to user,
|
---|
369 | to groups of which user is a member, and to PUBLIC */
|
---|
370 | SQL_SYSADM_GRP =(SQL_SYSADM SHL 8);
|
---|
371 | SQL_DBADM_GRP =(SQL_DBADM SHL 8);
|
---|
372 | SQL_CREATETAB_GRP =(SQL_CREATETAB SHL 8);
|
---|
373 | SQL_BINDADD_GRP =(SQL_BINDADD SHL 8);
|
---|
374 | SQL_CONNECT_GRP =(SQL_CONNECT SHL 8);
|
---|
375 |
|
---|
376 | /* Table/View Authorizations/Dependencies Bit definitions
|
---|
377 | in SYSTABAUTH.TABAUTH and SYSPLANDEP.TABAUTH */
|
---|
378 | SQL_TAB_CTL =$0001 ; /* Control Authority */
|
---|
379 | SQL_TAB_ALT =$0002 ; /* Alter Privilege */
|
---|
380 | SQL_TAB_DEL =$0004 ; /* Delete Privilege/Dependency */
|
---|
381 | SQL_TAB_IDX =$0008 ; /* Index Privilege */
|
---|
382 | SQL_TAB_INS =$0010 ; /* Insert Privilege/Dependency */
|
---|
383 | SQL_TAB_SEL =$0020 ; /* Select Privilege/Dependency */
|
---|
384 | SQL_TAB_UPD =$0040 ; /* Update Privilege/Dependency */
|
---|
385 | SQL_TAB_REF =$0080 ; /* Reference Privilege */
|
---|
386 | SQL_TAB_KEY =$2000 ; /* Key Dependency */
|
---|
387 | SQL_TAB_CAS =$4000 ; /* Cascade Dependency */
|
---|
388 |
|
---|
389 | /* Definitions for application remote interface */
|
---|
390 | SQLZ_DISCONNECT_PROC = 1; /* Unload Progam */
|
---|
391 | SQLZ_HOLD_PROC = 2; /* Keep program loaded */
|
---|
392 |
|
---|
393 |
|
---|
394 | IMPORTS
|
---|
395 | /* Binder Interface Parameters/Return Codes */
|
---|
396 | FUNCTION sqlabind (name:CSTRING; /* program name */
|
---|
397 | database:CSTRING; /* database */
|
---|
398 | spare:CSTRING; /* spare */
|
---|
399 | msgfile:CSTRING; /* message file */
|
---|
400 | datetimefmt:CSTRING; /* date/time format */
|
---|
401 | VAR asqlca:TSQLCA):INTEGER; /* SQLCA */
|
---|
402 | APIENTRY; 'SQLA32' name 'sqlabind';
|
---|
403 | FUNCTION sqlabndr (name:CSTRING; /* program name */
|
---|
404 | database:CSTRING; /* database */
|
---|
405 | msgfile:CSTRING; /* message file */
|
---|
406 | VAR asqlopt:TSQLOPT; /* binder options */
|
---|
407 | VAR asqlca:TSQLCA):INTEGER; /* SQLCA */
|
---|
408 | APIENTRY; 'SQLA32' name 'sqlabndr';
|
---|
409 |
|
---|
410 | /* Generic Dynamic Link Interface to the Binder */
|
---|
411 | FUNCTION SQLGBIND (spare1:LONGWORD; /* spare1 */
|
---|
412 | msgfilelen:LONGWORD; /* Message file length */
|
---|
413 | fmtoptlen:LONGWORD; /* Format option length */
|
---|
414 | PlanNameLen:LONGWORD; /* Plan name length */
|
---|
415 | DataBaseNameLen:LONGWORD; /* Database name length */
|
---|
416 | VAR asqlca:TSQLCA; /* SQLCA */
|
---|
417 | spare2:CSTRING; /* spare2 */
|
---|
418 | msgfile:CSTRING; /* Message file */
|
---|
419 | DateTimeFmt:CSTRING; /* Date/time format */
|
---|
420 | ProgName:CSTRING; /* Program name */
|
---|
421 | DataBase:CSTRING):INTEGER; /* Database */
|
---|
422 | APIENTRY; 'SQLAPI32' name 'SQLGBIND';
|
---|
423 | FUNCTION SQLGBNDR (PlanNameLen:LONGWORD; /* Plan name length */
|
---|
424 | DataBaseNameLen:LONGWORD; /* Database name length */
|
---|
425 | MsgFileLen:LONGWORD; /* Message file length */
|
---|
426 | ProgName:CSTRING; /* program name */
|
---|
427 | DataBase:CSTRING; /* database */
|
---|
428 | MsgFile:CSTRING; /* message file */
|
---|
429 | VAR asqlopt :TSQLOPT; /* binder options */
|
---|
430 | VAR asqlca : TSQLCA):INTEGER; /* SQLCA */
|
---|
431 | APIENTRY; 'SQLAPI32' name 'SQLGBNDR';
|
---|
432 |
|
---|
433 | /* Error Message Retrieval Interface Parameters/Return Codes */
|
---|
434 |
|
---|
435 | /* Error Message Retrieval Macro */
|
---|
436 | {sqlaintp(msgbuf,bufsize,linesize,sqlcaptr) \
|
---|
437 | sqlaintp_api(msgbuf,bufsize,linesize, \
|
---|
438 | (char *)"sqlzk001.mo",sqlcaptr)}
|
---|
439 | FUNCTION sqlaintp_api (VAR buffer; /* buffer for message text */
|
---|
440 | BufSize:LONGWORD; /* buffer size */
|
---|
441 | linewidth:LONGWORD; /* line width */
|
---|
442 | msgfile:CSTRING; /* message file */
|
---|
443 | VAR asqlca:TSQLCA):INTEGER; /* SQLCA */
|
---|
444 | APIENTRY; 'SQLA32' name 'sqlaintp_api';
|
---|
445 |
|
---|
446 | /* Generic Dynamic Link Interface to Error Message Retrieval */
|
---|
447 | FUNCTION SQLGINTP (bufsize:LONGWORD; /* buffer size */
|
---|
448 | linewidth:LONGWORD; /* line width */
|
---|
449 | VAR asqlca :TSQLCA; /* SQLCA */
|
---|
450 | VAR buffer):INTEGER; /* buffer */
|
---|
451 | APIENTRY; 'SQLAPI32' name 'SQLGINTP';
|
---|
452 | END;
|
---|
453 |
|
---|
454 | IMPLEMENTATION
|
---|
455 |
|
---|
456 | END.
|
---|