[8] | 1 | UNIT SQLAPREP;
|
---|
| 2 |
|
---|
| 3 | {***************************************************************************
|
---|
| 4 | *
|
---|
| 5 | Module Name = SQLAPREP.H *
|
---|
| 6 | *
|
---|
| 7 | Descriptive Name = External Include file for Precompiler Services *
|
---|
| 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 | Global equates and structures *
|
---|
| 15 | Precompiler and Runtime Command Interfaces *
|
---|
| 16 | *
|
---|
| 17 | ****************************************************************************}
|
---|
| 18 |
|
---|
| 19 | INTERFACE
|
---|
| 20 |
|
---|
| 21 | USES sql,sqlcodes,Os2Def;
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | TYPE
|
---|
| 25 | /* SQLDA: SQL Descriptor Area - Variable descriptor */
|
---|
| 26 | PSQLDA=^TSQLDA;
|
---|
| 27 | TSQLDA=RECORD
|
---|
| 28 | sqldaid:CSTRING[7]; /* Eye catcher = 'SQLDA ' */
|
---|
| 29 | sqldabc:LONG; /* SQLDA size in bytes=16+44*SQLN */
|
---|
| 30 | sqln:SHORT; /* Number of SQLVAR elements */
|
---|
| 31 | sqld:SHORT; /* # of used SQLVAR elements */
|
---|
| 32 | sqlvar:RECORD /* Variable Description */
|
---|
| 33 | sqltype:SHORT; /* Variable data type */
|
---|
| 34 | sqllen:SHORT; /* Variable data length */
|
---|
| 35 | sqldata:POINTER; /* Pointer to variable data value*/
|
---|
| 36 | sqlind:POINTER; /* Pointer to Null indicator */
|
---|
| 37 | sqlname:RECORD /* Variable Name */
|
---|
| 38 | alength:SHORT; /* Name length [1..30] */
|
---|
| 39 | data:CSTRING[29]; /* Variable or Column name */
|
---|
| 40 | END;
|
---|
| 41 | END;
|
---|
| 42 | END;
|
---|
| 43 |
|
---|
| 44 | /* macro for allocating SQLDA */
|
---|
| 45 | { SQLDASIZE(n) (sizeof(struct sqlda) + (n-1)*sizeof(struct sqlvar))}
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 | /*
|
---|
| 49 | ** Macro used to calculate size of a precompiler option array, an input
|
---|
| 50 | ** parameter of SQLAINIT.
|
---|
| 51 | */
|
---|
| 52 |
|
---|
| 53 | { SQLA_NUM_OPTIONS(n) (sizeof(struct sqla_options_header) + \
|
---|
| 54 | (n)*sizeof(struct sqla_option) )}
|
---|
| 55 |
|
---|
| 56 | CONST
|
---|
| 57 | /*
|
---|
| 58 | ** Values used for option[n].type, an input parameter of SQLAINIT.
|
---|
| 59 | */
|
---|
| 60 |
|
---|
| 61 | SQLA_FORMAT = SQL_FRMT_OPT ;/* Option: date/time format */
|
---|
| 62 | SQLA_ACCESS_PLAN = 2 ;/* Option: access plan creation */
|
---|
| 63 | SQLA_BIND_FILE = 3 ;/* Option: bind file creation */
|
---|
| 64 | SQLA_ISOLATION = SQL_ISO_OPT ;/* Option: isolation level */
|
---|
| 65 | SQLA_BLOCK = SQL_BLOCK_OPT;/* Option: record blocking */
|
---|
| 66 | SQLA_STDS_LEVEL = 7 ;/* Option: standards compliance */
|
---|
| 67 |
|
---|
| 68 | /*
|
---|
| 69 | ** Values used for option[n].val when option[n].type is SQLA_FORMAT in
|
---|
| 70 | ** the Precompiler Option Array.
|
---|
| 71 | */
|
---|
| 72 |
|
---|
| 73 | SQLA_POA_DEF = 0;/* Default date/time format */
|
---|
| 74 | SQLA_POA_USA = 1;/* USA date/time format */
|
---|
| 75 | SQLA_POA_EUR = 2;/* European date/time format */
|
---|
| 76 | SQLA_POA_ISO = 3;/* International date/time format */
|
---|
| 77 | SQLA_POA_JIS = 4;/* Japanese date/time format */
|
---|
| 78 | SQLA_POA_LOC = 5;/* Local date/time format */
|
---|
| 79 |
|
---|
| 80 | /*
|
---|
| 81 | ** Values used for option[n].val when option[n].type is SQLA_ACCESS_PLAN in
|
---|
| 82 | ** the Precompiler Option Array.
|
---|
| 83 | */
|
---|
| 84 |
|
---|
| 85 | SQLA_CREATE_PLAN = 1;/* Create an access plan */
|
---|
| 86 | SQLA_NO_PLAN = 0;/* Do not create an access plan */
|
---|
| 87 |
|
---|
| 88 | /*
|
---|
| 89 | ** Values used for option[n].val when option[n].type is SQLA_BIND_FILE in
|
---|
| 90 | ** the Precompiler Option Array.
|
---|
| 91 | */
|
---|
| 92 |
|
---|
| 93 | SQLA_CREATE_BIND_FILE=1;/* Create a bind file */
|
---|
| 94 | SQLA_NO_BIND_FILE =0;/* Do not create a bind file */
|
---|
| 95 |
|
---|
| 96 | /*
|
---|
| 97 | ** Values used for option[n].val when option[n].type is SQLA_ISOLATION in
|
---|
| 98 | ** the Precompiler Option Array.
|
---|
| 99 | */
|
---|
| 100 |
|
---|
| 101 | SQLA_REPEATABLE_READ =SQL_REP_READ ;/* RR isolation level */
|
---|
| 102 | SQLA_CURSOR_STABILITY=SQL_CURSOR_STAB;/* CS Isolation level */
|
---|
| 103 | SQLA_UNCOMMITTED_READ=SQL_UNCOM_READ ;/* UR Isolation level */
|
---|
| 104 |
|
---|
| 105 | /*
|
---|
| 106 | ** Values used for option[n].val when option[n].type is SQLA_BLOCK in
|
---|
| 107 | ** the Precompiler Option Array.
|
---|
| 108 | */
|
---|
| 109 |
|
---|
| 110 | SQLA_BLOCK_UNAMBIG = SQL_BL_UNAMBIG;
|
---|
| 111 | SQLA_BLOCK_ALL = SQL_BL_ALL;
|
---|
| 112 | SQLA_NO_BLOCK = SQL_NO_BL;
|
---|
| 113 |
|
---|
| 114 | /*
|
---|
| 115 | ** Values used for option[n].val when option[n].type is SQLA_STDS_LEVEL in
|
---|
| 116 | ** the Precompiler Option Array.
|
---|
| 117 | */
|
---|
| 118 |
|
---|
| 119 | SQLA_STND_NONE = 0;/* No compliance required */
|
---|
| 120 | SQLA_STND_MIA = 1;/* Comply with MIA standard */
|
---|
| 121 |
|
---|
| 122 | /*
|
---|
| 123 | ** Values used for location, an input parameter of SQLAAHVR.
|
---|
| 124 | */
|
---|
| 125 |
|
---|
| 126 | SQLA_DECLARE_SECT = 0;/* Add host var found in a declare section */
|
---|
| 127 | SQLA_SQL_STMT = 1;/* Add host var found in an SQL statement */
|
---|
| 128 |
|
---|
| 129 | /*
|
---|
| 130 | ** Values assigned to task[n].func, an output parameter of SQLACMPL.
|
---|
| 131 | */
|
---|
| 132 |
|
---|
| 133 | SQLA_START = 0;/* Generate a call to sqlastrt */
|
---|
| 134 | SQLA_DECLARE = 1;/* Begin or end parsing hvar declarations */
|
---|
| 135 | SQLA_INCLUDE = 2;/* Generate code for an SQLCA or SQLDA */
|
---|
| 136 | SQLA_ALLOC_INPUT = 3;/* Allocate an input SQLDA using SQLAALOC */
|
---|
| 137 | SQLA_ALLOC_OUTPUT = 4;/* Allocate an output SQLDA using SQLAALOC */
|
---|
| 138 | SQLA_SETS = 5;/* Register a host variable using SQLASETS */
|
---|
| 139 | SQLA_USDA_INPUT = 6;/* Register an input user-defined SQLDA */
|
---|
| 140 | SQLA_USDA_OUTPUT = 7;/* Register an output user-defined SQLDA */
|
---|
| 141 | SQLA_CALL = 8;/* Generate a call to SQLACALL */
|
---|
| 142 | SQLA_DEALLOC = 9;/* Generate a call to SQLADLOC */
|
---|
| 143 | SQLA_STOP =10;/* Generate a call to SQLASTOP */
|
---|
| 144 | SQLA_SQLERROR =11;/* Generate code for WHENEVER SQLERROR */
|
---|
| 145 | SQLA_SQLWARNING =12;/* Generate code for WHENEVER SQLWARNING */
|
---|
| 146 | SQLA_NOT_FOUND =13;/* Generate code for WHENEVER NOT_FOUND */
|
---|
| 147 | SQLA_CONNECT_EXCL =14;/* Generate code for an SQL */
|
---|
| 148 | /* 'CONNECT TO x IN EXCLUSIVE MODE' */
|
---|
| 149 | /* statement */
|
---|
| 150 | SQLA_CONNECT_RESET =15;/* Generate code for an SQL */
|
---|
| 151 | /* 'CONNECT RESET' statement */
|
---|
| 152 | SQLA_CONNECT_SHARE =16;/* Generate code for an SQL */
|
---|
| 153 | /* 'CONNECT TO x [IN SHARE MODE]' */
|
---|
| 154 | /* statement */
|
---|
| 155 | SQLA_INC_TEXTFILE =17;/* Process an INCLUDE text-file stmt */
|
---|
| 156 |
|
---|
| 157 | /*
|
---|
| 158 | ** Values returned in task[n].val when task[n].func is SQLA_DECLARE.
|
---|
| 159 | ** This is an output parameter of SQLACMPL.
|
---|
| 160 | */
|
---|
| 161 |
|
---|
| 162 | SQLA_BEGIN = 0;
|
---|
| 163 | SQLA_END = 1;
|
---|
| 164 |
|
---|
| 165 | /*
|
---|
| 166 | ** Values returned in task[n].val when task[n].func is SQLA_INCLUDE.
|
---|
| 167 | ** This is an output parameter of SQLACMPL.
|
---|
| 168 | */
|
---|
| 169 |
|
---|
| 170 | SQLA_SQLCA =10;
|
---|
| 171 | SQLA_SQLDA =11;
|
---|
| 172 |
|
---|
| 173 | /*
|
---|
| 174 | ** Values returned in task[n].val when task[n].func is SQLA_CALL.
|
---|
| 175 | ** This is an output parameter of SQLACMPL.
|
---|
| 176 | */
|
---|
| 177 |
|
---|
| 178 | SQLA_CLOSE =20;
|
---|
| 179 | SQLA_COMMIT =21;
|
---|
| 180 | SQLA_DESCRIBE =22;
|
---|
| 181 | SQLA_EXECIMMD =23;
|
---|
| 182 | SQLA_EXECUTE =24;
|
---|
| 183 | SQLA_FETCH =25;
|
---|
| 184 | SQLA_OPEN =26;
|
---|
| 185 | SQLA_PREPARE =27;
|
---|
| 186 | SQLA_ROLLBACK =28;
|
---|
| 187 | SQLA_CONNECT =29;
|
---|
| 188 |
|
---|
| 189 | /*
|
---|
| 190 | ** Values assigned to token[n].use, an output parameter of SQLACMPL.
|
---|
| 191 | */
|
---|
| 192 |
|
---|
| 193 | SQLA_INPUT_HVAR =0;/* Input host var, no indicator var */
|
---|
| 194 | SQLA_INPUT_WITH_IND =1;/* Input host var followed by indicator var */
|
---|
| 195 | SQLA_OUTPUT_HVAR =2;/* Output host var, no indicator var */
|
---|
| 196 | SQLA_OUTPUT_WITH_IND=3;/* Output host var followed by indicator var*/
|
---|
| 197 | SQLA_INDICATOR =4;/* Indicator variable */
|
---|
| 198 | SQLA_USER_SQLDA =5;/* SQLDA structure */
|
---|
| 199 | SQLA_INVALID_USE =6;/* Host variable type does not match use */
|
---|
| 200 | SQLA_INVALID_ID =7;/* Host variable token ID is not valid */
|
---|
| 201 |
|
---|
| 202 | /*
|
---|
| 203 | ** Values assigned to stmt_type, an output parameter of SQLACMPL.
|
---|
| 204 | */
|
---|
| 205 |
|
---|
| 206 | SQLA_TYPE_BEGIN = 0;
|
---|
| 207 | SQLA_TYPE_CLOSE =10;
|
---|
| 208 | SQLA_TYPE_COMMIT =20;
|
---|
| 209 | SQLA_TYPE_CONNECT_NOP =23;
|
---|
| 210 | SQLA_TYPE_CONNECT_EXCLUSIVE=24;
|
---|
| 211 | SQLA_TYPE_CONNECT_RESET =25;
|
---|
| 212 | SQLA_TYPE_CONNECT_SHARE =26;
|
---|
| 213 | SQLA_TYPE_DECLARE_SELECT =30;
|
---|
| 214 | SQLA_TYPE_DECLARE_SNAME =40;
|
---|
| 215 | SQLA_TYPE_DESCRIBE =50;
|
---|
| 216 | SQLA_TYPE_END =60;
|
---|
| 217 | SQLA_TYPE_EXECUTE =70;
|
---|
| 218 | SQLA_TYPE_EXECUTE_IMM =80;
|
---|
| 219 | SQLA_TYPE_FETCH =90;
|
---|
| 220 | SQLA_TYPE_INCLUDE_SQLCA =100;
|
---|
| 221 | SQLA_TYPE_INCLUDE_SQLDA =110;
|
---|
| 222 | SQLA_TYPE_INCLUDE_TEXTFILE=115;
|
---|
| 223 | SQLA_TYPE_OPEN =120;
|
---|
| 224 | SQLA_TYPE_PREPARE =130;
|
---|
| 225 | SQLA_TYPE_ROLLBACK =140;
|
---|
| 226 | SQLA_TYPE_SELECT =150;
|
---|
| 227 | SQLA_TYPE_SELECT_INTO =160;
|
---|
| 228 | SQLA_TYPE_WHEN_NOT_FOUND =170;
|
---|
| 229 | SQLA_TYPE_WHEN_SQLERROR =180;
|
---|
| 230 | SQLA_TYPE_WHEN_SQLWARNING =190;
|
---|
| 231 | SQLA_TYPE_OTHER =200;
|
---|
| 232 |
|
---|
| 233 | /*
|
---|
| 234 | ** Values used for term_option, an input parameter of SQLAFINI.
|
---|
| 235 | */
|
---|
| 236 |
|
---|
| 237 | SQLA_SAVE = 1;/* Save the access plan and/or bind file */
|
---|
| 238 | SQLA_DISCARD = 0;/* Discard the access plan and/or bind file */
|
---|
| 239 |
|
---|
| 240 | /*
|
---|
| 241 | ** Miscellaneous Constants
|
---|
| 242 | */
|
---|
| 243 |
|
---|
| 244 | SQL_MAX_FILE_NAME_LENGTH = 128;/* size of SQLAINIT file name buffer */
|
---|
| 245 | SQL_CMPL_BUFSIZ = 128;/* size of SQLACMPL output buffers */
|
---|
| 246 | SQL_PID_LENGTH = 40;/* length of precompiler pid */
|
---|
| 247 |
|
---|
| 248 | /*
|
---|
| 249 | ** Return codes from Precompiler Services and Runtime Services functions.
|
---|
| 250 | */
|
---|
| 251 |
|
---|
| 252 | SQLA_SQLCA_BAD = -1;/* sqlca pointer/length invalid */
|
---|
| 253 | SQLA_CHECK_SQLCA = 0;/* check sqlca completion status */
|
---|
| 254 |
|
---|
| 255 | /*
|
---|
| 256 | ** Values returned in sqlca.sqlcode by Precompiler or Runtime Services
|
---|
| 257 | */
|
---|
| 258 |
|
---|
| 259 | SQLA_RC_CHAR_BAD = SQL_RC_E007;
|
---|
| 260 | SQLA_RC_STRING_NOT_TERMINATED = SQL_RC_E010;
|
---|
| 261 | SQLA_RC_EMPTY_DEL_IDENT = SQL_RC_E013;
|
---|
| 262 | SQLA_RC_BFILE_OPEN_ERROR =-31;
|
---|
| 263 | SQLA_RC_BFILE_DISK_ERROR =-32;
|
---|
| 264 | SQLA_RC_SECTION_LIMIT =-51;
|
---|
| 265 | SQLA_RC_MEMORY_BAD =-83;
|
---|
| 266 | SQLA_RC_SNAME_DUP =-85;
|
---|
| 267 | SQLA_RC_STMT_LIMIT = SQL_RC_E101;
|
---|
| 268 | SQLA_RC_NUMBER_BAD = SQL_RC_E103;
|
---|
| 269 | SQLA_RC_STMT_SYNTAX_BAD = SQL_RC_E104;
|
---|
| 270 | SQLA_RC_GSTRING_BAD = SQL_RC_E105; /* DBCS only */
|
---|
| 271 | SQLA_RC_IDENTIFIER_LIMIT = SQL_RC_E107;
|
---|
| 272 | SQLA_RC_QUALIFIER_BAD = SQL_RC_E108;
|
---|
| 273 | SQLA_RC_DDSBAD = SQL_RC_E142;
|
---|
| 274 | SQLA_RC_DDSIGN = SQL_RC_W143;
|
---|
| 275 | SQLA_RC_DDSWRN = SQL_RC_W143;
|
---|
| 276 | SQLA_RC_KEYWORD_BAD = SQL_RC_E199;
|
---|
| 277 | SQLA_RC_HVAR_NOT_DEC =-306;
|
---|
| 278 | SQLA_RC_HVAR_DUP_NAME =-307;
|
---|
| 279 | SQLA_RC_HVAR_LIMIT =-308;
|
---|
| 280 | SQLA_RC_STMT_HVAR_LIMIT =-310;
|
---|
| 281 | SQLA_RC_HVAR_USE_BAD =-324;
|
---|
| 282 | SQLA_RC_CURSOR_DUP =-505;
|
---|
| 283 | SQLA_RC_STMT_MODIFY_ALL = 513;
|
---|
| 284 | SQLA_RC_DISK_FULL = SQL_RC_E968;
|
---|
| 285 | SQLA_RC_FATAL_ERROR =-4901;
|
---|
| 286 | SQLA_RC_PARM_CHARS_BAD =-4902;
|
---|
| 287 | SQLA_RC_PARM_LENGTH_BAD = SQLA_RC_OPTION_LEN_BAD;
|
---|
| 288 | SQLA_RC_PARM_POINTER_BAD = SQLA_RC_OPTION_PTR_BAD;
|
---|
| 289 | SQLA_RC_PARM_RANGE_BAD = SQLA_RC_OPTION_SIZE_BAD;
|
---|
| 290 | SQLA_RC_HVAR_SQLTYPE_BAD =-4911;
|
---|
| 291 | SQLA_RC_HVAR_SQLLEN_BAD =-4912;
|
---|
| 292 | SQLA_RC_HVAR_TOKEN_ID_DUP =-4913;
|
---|
| 293 | SQLA_RC_HVAR_TOKEN_ID_BAD =-4914;
|
---|
| 294 | SQLA_RC_INIT_DUP =-4915;
|
---|
| 295 | SQLA_RC_INIT_REQUIRED =-4916;
|
---|
| 296 | SQLA_RC_OPTION_BAD = SQLA_RC_OPTION_DATA_BAD;
|
---|
| 297 | SQLA_RC_TERM_OPTION_BAD =-4918;
|
---|
| 298 | SQLA_RC_TASK_ARRAY_LIMIT =-4919;
|
---|
| 299 | SQLA_RC_STMT_CLAUSE_BAD =-4940;/* Prep version of -109 */
|
---|
| 300 | SQLA_RC_STMT_BLANK =-4941;/* Prep version of -198 */
|
---|
| 301 | SQLA_RC_SELECT_HVAR_TYPE_BAD=-4942;/* Prep version of -303 */
|
---|
| 302 | SQLA_RC_SELECT_LIST_BAD = 4943;/* Prep version of -313 */
|
---|
| 303 | SQLA_RC_COLUMN_NOT_NULLABLE =-4944;/* Prep version of -407 */
|
---|
| 304 | SQLA_RC_STMT_MARKER_BAD =-4945;/* Prep version of -418 */
|
---|
| 305 | SQLA_RC_CURSOR_NOT_DECLARED =-4946;/* Prep version of -504 */
|
---|
| 306 | SQLA_RC_SQLDA_ID_BAD =-4951;
|
---|
| 307 | SQLA_RC_SQLVAR_INDEX_BAD =-4952;
|
---|
| 308 | SQLA_RC_CALL_TYPE_BAD =-4953;
|
---|
| 309 | SQLA_RC_SECTION_BAD =-4954;
|
---|
| 310 |
|
---|
| 311 | /*
|
---|
| 312 | ** Temporary value used in sqlca.sqlcode after an SQLAALOC function. Runtime
|
---|
| 313 | ** code can check sqlca.sqlcode to determine whether or not the SQLASETV
|
---|
| 314 | ** function needs to be called to initialize the sqlda sqlvar elements.
|
---|
| 315 | */
|
---|
| 316 |
|
---|
| 317 | SQLA_RC_SQLVARS_SET = 4959;/* sqlvars already initialized */
|
---|
| 318 |
|
---|
| 319 | /*
|
---|
| 320 | ** Errors that cause Precompiler Services to enter the fatal error state.
|
---|
| 321 | ** After encountering one of these types of errors, Precompiler Services
|
---|
| 322 | ** requires an SQLAFINI and SQLAINIT call before it will continue.
|
---|
| 323 | */
|
---|
| 324 |
|
---|
| 325 | SQLA_RC_INV_INSERT = SQL_RC_E803 ;
|
---|
| 326 | SQLA_RC_INV_SQLDA_ADR = SQL_RC_E822 ;
|
---|
| 327 | SQLA_RC_SYS_ERROR = SQL_RC_E902 ;
|
---|
| 328 | SQLA_RC_DEADLOCK_ERR = SQL_RC_E911 ;
|
---|
| 329 | SQLA_RC_FAT_SYS_ERR = SQL_RC_E912 ;
|
---|
| 330 | SQLA_RC_TOO_MANY_LKS = SQL_RC_E930 ;
|
---|
| 331 | SQLA_RC_STORAGE_ERR = SQL_RC_E954 ;
|
---|
| 332 | SQLA_RC_DB_HEAP_ERR = SQL_RC_E956 ;
|
---|
| 333 | SQLA_RC_TOOMANY_OFLS = SQL_RC_E958 ;
|
---|
| 334 | SQLA_RC_TOOMANY_FILES = SQL_RC_E960 ;
|
---|
| 335 | SQLA_RC_LOG_FULL = SQL_RC_E964 ;
|
---|
| 336 | SQLA_RC_FILE_SYS_FULL = SQL_RC_E968 ;
|
---|
| 337 | SQLA_RC_READ_ONLY_FIL = SQL_RC_E970 ;
|
---|
| 338 | SQLA_RC_INCORRECT_DSK = SQL_RC_E972 ;
|
---|
| 339 | SQLA_RC_DB_DRV_LOCKED = SQL_RC_E974 ;
|
---|
| 340 | SQLA_RC_DRV_DOOR_OPEN = SQL_RC_E976 ;
|
---|
| 341 | SQLA_RC_DISK_WRT_PRO = SQL_RC_E978 ;
|
---|
| 342 | SQLA_RC_DISK_ERROR = SQL_RC_E980 ;
|
---|
| 343 | SQLA_RC_DISK_ERR = SQL_RC_E982 ;
|
---|
| 344 | SQLA_RC_COMM_RB_ERR = SQL_RC_E984 ;
|
---|
| 345 | SQLA_RC_CAT_FILE_ERR = SQL_RC_E985 ;
|
---|
| 346 | SQLA_RC_TAB_FILE_ERR = SQL_RC_E986 ;
|
---|
| 347 | SQLA_RC_INDEX_ERR = SQL_RC_E990 ;
|
---|
| 348 | SQLA_RC_REL_NUM_BAD = SQL_RC_E992 ;
|
---|
| 349 | SQLA_RC_CTRL_BREAK = -4994;/* Prep version of -952 */
|
---|
| 350 | SQLA_RC_CODEPAGE_BAD = -4995;/* Country info not found */
|
---|
| 351 | SQLA_RC_SQLUSER_BAD = -4997;/* Prep version of -1046 */
|
---|
| 352 | SQLA_RC_DB_DISCONNECTED = -4998;/* Prep version of -900 */
|
---|
| 353 | SQLA_RC_INTERNAL_ERR = -4999;/* Precompiler Services err */
|
---|
| 354 |
|
---|
| 355 | /*********************** Precompiler Services Structures *******************/
|
---|
| 356 | TYPE
|
---|
| 357 | /*
|
---|
| 358 | ** Precompiler Option Array. Used with SQLAINIT.
|
---|
| 359 | */
|
---|
| 360 | PSQLA_OPTIONS=^TSQLA_OPTIONS;
|
---|
| 361 | TSQLA_OPTIONS=RECORD
|
---|
| 362 | header:RECORD
|
---|
| 363 | allocated:ULONG;
|
---|
| 364 | used:ULONG;
|
---|
| 365 | END;
|
---|
| 366 | option:RECORD
|
---|
| 367 | atype:ULONG;
|
---|
| 368 | aval:ULONG;
|
---|
| 369 | END;
|
---|
| 370 | END;
|
---|
| 371 |
|
---|
| 372 | TYPE
|
---|
| 373 | /*
|
---|
| 374 | ** Program ID. Used by Precompiler Services and Runtime Services
|
---|
| 375 | */
|
---|
| 376 | PSQLA_PROGRAM_ID=^TSQLA_PROGRAM_ID;
|
---|
| 377 | TSQLA_PROGRAM_ID=RECORD
|
---|
| 378 | alength:WORD;
|
---|
| 379 | rp_rel_num:WORD;
|
---|
| 380 | db_rel_num:WORD;
|
---|
| 381 | bf_rel_num:WORD;
|
---|
| 382 | sqluser:CSTRING[7];
|
---|
| 383 | planname:CSTRING[7];
|
---|
| 384 | contoken:CSTRING[7];
|
---|
| 385 | buffer:CSTRING[7];
|
---|
| 386 | END;
|
---|
| 387 |
|
---|
| 388 | TYPE
|
---|
| 389 | /*
|
---|
| 390 | ** Precompiler Task Array. Used with SQLACMPL.
|
---|
| 391 | */
|
---|
| 392 | PSQLA_TASKS=^TSQLA_TASKS;
|
---|
| 393 | TSQLA_TASKS=RECORD
|
---|
| 394 | header:RECORD
|
---|
| 395 | allocated:ULONG;
|
---|
| 396 | used:ULONG;
|
---|
| 397 | END;
|
---|
| 398 | task:RECORD
|
---|
| 399 | func:ULONG;
|
---|
| 400 | aval:ULONG;
|
---|
| 401 | END;
|
---|
| 402 | END;
|
---|
| 403 |
|
---|
| 404 | TYPE
|
---|
| 405 | /*
|
---|
| 406 | ** Token return structure. Used to return length and offset of
|
---|
| 407 | ** a token within an SQL statement. Overlaid on top of the val
|
---|
| 408 | ** member of the task array.
|
---|
| 409 | */
|
---|
| 410 | PSQLA_RETURN_TOKEN=^TSQLA_RETURN_TOKEN;
|
---|
| 411 | TSQLA_RETURN_TOKEN=RECORD
|
---|
| 412 | offset:WORD;
|
---|
| 413 | alength:WORD;
|
---|
| 414 | END;
|
---|
| 415 |
|
---|
| 416 | TYPE
|
---|
| 417 | /*
|
---|
| 418 | ** Precompiler Token ID Array. Used with SQLACMPL
|
---|
| 419 | */
|
---|
| 420 | PSQLA_TOKENS=^TSQLA_TOKENS;
|
---|
| 421 | TSQLA_TOKENS=RECORD
|
---|
| 422 | header:RECORD
|
---|
| 423 | allocated:ULONG;
|
---|
| 424 | used:ULONG;
|
---|
| 425 | END;
|
---|
| 426 | token:RECORD
|
---|
| 427 | id:ULONG;
|
---|
| 428 | use:ULONG;
|
---|
| 429 | END;
|
---|
| 430 | END;
|
---|
| 431 |
|
---|
| 432 |
|
---|
| 433 | IMPORTS
|
---|
| 434 | /* ADD A HOST VARIABLE DECLARATION */
|
---|
| 435 | FUNCTION sqlaahvr (VAR hostnamelen:WORD; /* host variable name length */
|
---|
| 436 | hostname:CSTRING; /* host variable name */
|
---|
| 437 | VAR HostData:WORD; /* host variable SQL data type */
|
---|
| 438 | VAR VarLen:WORD; /* host variable length */
|
---|
| 439 | TokenID:POINTER; /* host variable token id */
|
---|
| 440 | VAR HostLoc:WORD; /* host variable location */
|
---|
| 441 | reserved:POINTER; /* reserved */
|
---|
| 442 | asqlca : TSQLCA):INTEGER; /* SQLCA */
|
---|
| 443 | APIENTRY; 'SQLAI32' name 'sqlaahvr';
|
---|
| 444 |
|
---|
| 445 | /* COMPILE AN SQL STATEMENT */
|
---|
| 446 | FUNCTION sqlacmpl (VAR len:WORD; /* SQL statement text length */
|
---|
| 447 | statement:CSTRING; /* SQL statement text */
|
---|
| 448 | VAR linenum:WORD; /* source line number */
|
---|
| 449 | VAR asqla_tasks:TSQLA_TASKS; /* task array */
|
---|
| 450 | VAR asqla_tokens:TSQLA_TOKENS; /* token id array */
|
---|
| 451 | VAR sectionnum:WORD; /* section number */
|
---|
| 452 | VAR sqlstattype:WORD; /* type of SQL statement */
|
---|
| 453 | buffer1:CSTRING; /* 128 byte string buffer 1 */
|
---|
| 454 | buffer2:CSTRING; /* 128 byte string buffer 2 */
|
---|
| 455 | buffer3:CSTRING; /* 128 byte string buffer 3 */
|
---|
| 456 | reserved:POINTER; /* reserved */
|
---|
| 457 | VAR asqlca:TSQLCA):INTEGER; /* SQLCA */
|
---|
| 458 | APIENTRY; 'SQLAI32' name 'sqlacmpl';
|
---|
| 459 |
|
---|
| 460 | /* TERMINATE AN ACCESS PLAN */
|
---|
| 461 | FUNCTION sqlafini (VAR bindfile:WORD; /* save/discard plan/bind file */
|
---|
| 462 | reserved:POINTER; /* reserved */
|
---|
| 463 | VAR asqlca:TSQLCA):INTEGER; /* SQLCA */
|
---|
| 464 | APIENTRY; 'SQLAI32' name 'sqlafini';
|
---|
| 465 |
|
---|
| 466 | /* INITIALIZE AN ACCESS PLAN */
|
---|
| 467 | FUNCTION sqlainit (VAR prognamelen:WORD; /* program name length */
|
---|
| 468 | ProgName:CSTRING; /* program name */
|
---|
| 469 | VAR DatabaseNameLen:WORD; /* database name length */
|
---|
| 470 | DataBase:CSTRING; /* database name */
|
---|
| 471 | VAR passwdlen:WORD; /* password length */
|
---|
| 472 | passwd:CSTRING; /* database password */
|
---|
| 473 | VAR bindfilenamelen:WORD; /* bind file name length */
|
---|
| 474 | bindfile:CSTRING; /* bind file name */
|
---|
| 475 | VAR asqla_options:TSQLA_OPTIONS; /* precompiler option array */
|
---|
| 476 | VAR asqla_program_id:TSQLA_PROGRAM_ID; /* precompiler program ID */
|
---|
| 477 | reserved:POINTER; /* reserved */
|
---|
| 478 | VAR asqlca:TSQLCA):INTEGER; /* SQLCA */
|
---|
| 479 | APIENTRY; 'SQLAI32' name 'sqlainit';
|
---|
| 480 |
|
---|
| 481 | /* ADD A HOST VARIABLE DECLARATION */
|
---|
| 482 | FUNCTION SQLGAHVR (VAR hostnamelen:WORD; /* host variable name length */
|
---|
| 483 | hostname:CSTRING; /* host variable name */
|
---|
| 484 | VAR sqldatatype:WORD; /* host variable SQL data type */
|
---|
| 485 | VAR hostvarlen:WORD; /* host variable length */
|
---|
| 486 | tokenid:POINTER; /* host variable token id */
|
---|
| 487 | VAR loc:WORD; /* host variable location */
|
---|
| 488 | reserved:POINTER; /* reserved */
|
---|
| 489 | VAR asqlca:TSQLCA):INTEGER; /* SQLCA */
|
---|
| 490 | APIENTRY; 'SQLAPI32' name 'SQLGAHVR';
|
---|
| 491 |
|
---|
| 492 | /* COMPILE AN SQL STATEMENT */
|
---|
| 493 | FUNCTION SQLGCMPL (VAR textlen:WORD; /* SQL statement text length */
|
---|
| 494 | statement:CSTRING; /* SQL statement text */
|
---|
| 495 | VAR linenum:WORD; /* source line number */
|
---|
| 496 | VAR asqla_tasks:TSQLA_TASKS; /* task array */
|
---|
| 497 | VAR asqla_tokens:TSQLA_TOKENS; /* token id array */
|
---|
| 498 | VAR section:WORD; /* section number */
|
---|
| 499 | VAR sqltype:WORD; /* type of SQL statement */
|
---|
| 500 | buffer1:CSTRING; /* 128 byte string buffer 1 */
|
---|
| 501 | buffer2:CSTRING; /* 128 byte string buffer 2 */
|
---|
| 502 | buffer3:CSTRING; /* 128 byte string buffer 3 */
|
---|
| 503 | reserved:POINTER; /* reserved */
|
---|
| 504 | VAR asqlca:TSQLCA):INTEGER; /* SQLCA */
|
---|
| 505 | APIENTRY; 'SQLAPI32' name 'SQLGCMPL';
|
---|
| 506 |
|
---|
| 507 | /* TERMINATE AN ACCESS PLAN */
|
---|
| 508 | FUNCTION SQLGFINI (VAR bindfile:WORD; /* save/discard plan/bind file */
|
---|
| 509 | reserved:POINTER; /* reserved */
|
---|
| 510 | VAR asqlca:TSQLCA):INTEGER; /* SQLCA */
|
---|
| 511 | APIENTRY; 'SQLAPI32' name 'SQLGFINI';
|
---|
| 512 |
|
---|
| 513 | /* INITIALIZE AN ACCESS PLAN */
|
---|
| 514 | FUNCTION SQLGINIT (VAR ProgNameLen:WORD; /* program name length */
|
---|
| 515 | ProgName:CSTRING; /* program name */
|
---|
| 516 | VAR databasenamelen:WORD; /* database name length */
|
---|
| 517 | database:CSTRING; /* database name */
|
---|
| 518 | VAR passwdlen:WORD; /* password length */
|
---|
| 519 | passwd:CSTRING; /* database password */
|
---|
| 520 | VAR bindfilelen:WORD; /* bind file name length */
|
---|
| 521 | bindfile:CSTRING; /* bind file name */
|
---|
| 522 | VAR asqla_options:TSQLA_OPTIONS; /* precompiler option array */
|
---|
| 523 | VAR asqla_program_id:TSQLA_PROGRAM_ID; /* precompiler program ID */
|
---|
| 524 | reserved:POINTER; /* reserved */
|
---|
| 525 | VAR asqlca:TSQLCA):INTEGER; /* SQLCA */
|
---|
| 526 | APIENTRY; 'SQLAPI32' name 'SQLGINIT';
|
---|
| 527 |
|
---|
| 528 | /* Begin Runtime Services prototypes : **************************************/
|
---|
| 529 |
|
---|
| 530 | FUNCTION sqlaaloc (id:LONGWORD; /* sqlda identification number */
|
---|
| 531 | elems:LONGWORD; /* number of sqlvar elements needed */
|
---|
| 532 | statementid:LONGWORD; /* statement identification number */
|
---|
| 533 | reserved:POINTER):INTEGER; /* reserved */
|
---|
| 534 | APIENTRY; 'SQLAK32' name 'sqlaaloc';
|
---|
| 535 |
|
---|
| 536 | FUNCTION sqlacall (typ:LONGWORD; /* function call type */
|
---|
| 537 | aplan:LONGWORD; /* access plan section */
|
---|
| 538 | id:LONGWORD; /* input SQLDA ID */
|
---|
| 539 | outputid:LONGWORD;/* output SQLDA ID */
|
---|
| 540 | reserved:POINTER):INTEGER; /* reserved */
|
---|
| 541 | APIENTRY; 'SQLAK32' name 'sqlacall';
|
---|
| 542 |
|
---|
| 543 | FUNCTION sqladloc (id:LONGWORD; /* SQLDA ID */
|
---|
| 544 | reserved:POINTER):INTEGER; /* reserved */
|
---|
| 545 | APIENTRY; 'SQLAK32' name 'sqladloc';
|
---|
| 546 |
|
---|
| 547 | FUNCTION sqlasets (textlen:LONGWORD; /* SQL statement text length */
|
---|
| 548 | statement:POINTER; /* SQL statement text */
|
---|
| 549 | reserved:POINTER):INTEGER; /* reserved */
|
---|
| 550 | APIENTRY; 'SQLAK32' name 'sqlasets';
|
---|
| 551 |
|
---|
| 552 | FUNCTION sqlasetv (id:LONGWORD; /* SQLDA ID */
|
---|
| 553 | elem:LONGWORD; /* sqlvar element */
|
---|
| 554 | datatype:LONGWORD;/* SQL data type */
|
---|
| 555 | len:LONGWORD; /* declared length */
|
---|
| 556 | hostvaradr:POINTER; /* address of host var */
|
---|
| 557 | indicatoradr:POINTER; /* address of indicator var */
|
---|
| 558 | reserved:POINTER):INTEGER; /* reserved */
|
---|
| 559 | APIENTRY; 'SQLAK32' name 'sqlasetv';
|
---|
| 560 |
|
---|
| 561 | FUNCTION sqlastop (reserved:POINTER):INTEGER; /* reserved */
|
---|
| 562 | APIENTRY; 'SQLAK32' name 'sqlastop';
|
---|
| 563 |
|
---|
| 564 | FUNCTION sqlastrt (ProgId:POINTER; /* runtime program ID */
|
---|
| 565 | reserved:POINTER; /* reserved */
|
---|
| 566 | VAR asqlca:TSQLCA):INTEGER; /* SQLCA */
|
---|
| 567 | APIENTRY; 'SQLAK32' name 'sqlastrt';
|
---|
| 568 |
|
---|
| 569 | FUNCTION sqlausda (id:LONGWORD; /* SQLDA id */
|
---|
| 570 | VAR asqlda:TSQLDA; /* SQLDA pointer */
|
---|
| 571 | reserved:POINTER):INTEGER; /* Reserved */
|
---|
| 572 | APIENTRY; 'SQLAK32' name 'sqlausda';
|
---|
| 573 |
|
---|
| 574 | END;
|
---|
| 575 |
|
---|
| 576 | IMPLEMENTATION
|
---|
| 577 |
|
---|
| 578 | END.
|
---|