-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathphp_ibm_db2_int.h
276 lines (240 loc) · 8.73 KB
/
php_ibm_db2_int.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#if !defined(_MSC_VER) || _MSC_VER >= 1600
#include <stdint.h>
#else
#ifdef _WIN64
typedef int64_t intptr_t;
typedef uint64_t uintptr_t;
#else
typedef int32_t intptr_t;
typedef uint32_t uintptr_t;
#endif
#endif
/*
* Added in IBM i 7.5, also in LUW 11.1 MP1/FP1
* see: https://www.ibm.com/docs/en/db2/11.1?topic=database-mod-pack-fix-pack-updates#c0061179__FP1
*/
#ifndef SQL_BOOLEAN
#define SQL_BOOLEAN 16
#endif
/* Needed for backward compatibility (SQL_ATTR_DBC_SYS_NAMING not defined prior to DB2 10.1.0.2) */
#ifndef SQL_ATTR_DBC_SYS_NAMING
#define SQL_ATTR_DBC_SYS_NAMING 3017
#endif
/* needed for backward compatibility (SQL_XML not defined prior to DB2 v9) */
#ifndef SQL_XML
#define SQL_XML -370
#endif
/* needed for backward compatibility (SQL_ATTR_ROWCOUNT_PREFETCH not defined prior to DB2 9.5.0.3) */
#ifndef SQL_ATTR_ROWCOUNT_PREFETCH
#define SQL_ATTR_ROWCOUNT_PREFETCH 2592
#define SQL_ROWCOUNT_PREFETCH_OFF 0
#define SQL_ROWCOUNT_PREFETCH_ON 1
#endif
/* SQL_ATTR_USE_TRUSTED_CONTEXT,
* SQL_ATTR_TRUSTED_CONTEXT_USERID and
* SQL_ATTR_TRUSTED_CONTEXT_PASSWORD
* not defined prior to DB2 v9 */
#ifndef SQL_ATTR_USE_TRUSTED_CONTEXT
#define SQL_ATTR_USE_TRUSTED_CONTEXT 2561
#define SQL_ATTR_TRUSTED_CONTEXT_USERID 2562
#define SQL_ATTR_TRUSTED_CONTEXT_PASSWORD 2563
#endif
/* Needed for Backward compatibility */
#ifndef SQL_DECFLOAT
#define SQL_DECFLOAT -360
#endif
/* This is used in db2_last_insert_id.
* We allocate a buffer of size 32 as per
* recommendations from the CLI IDS team */
#define MAX_IDENTITY_DIGITS 32
/* Used in _php_parse_options */
#define DB2_ERRMSG 1
#define DB2_ERR 2
/* DB2 instance environment variable */
#define DB2_VAR_INSTANCE "DB2INSTANCE="
/* Visual name for the connection */
#define DB2_CONN_NAME "DB2 Connection"
/* Visual name for the persistent connection */
#define DB2_PCONN_NAME "DB2 Persistent Connection"
/* Visual name for the statement */
#define DB2_STMT_NAME "DB2 Statement"
/******** Makes code compatible with the options used by the user */
#define DB2_BINARY 1
#define DB2_CONVERT 2
#define DB2_PASSTHRU 3
/* maximum sizes */
#define USERID_LEN 16
#define ACCTSTR_LEN 200
#define APPLNAME_LEN 32
#define WRKSTNNAME_LEN 18
/* 1.9.7 - LUW DB2 Connect 10.5 missing SQL_UTF8_CHAR, set to fake/unused ordinal */
#ifndef SQL_UTF8_CHAR
#define SQL_UTF8_CHAR -334
#endif
#ifdef PASE
/* IBM i generically changed (remove ifdef PASE) */
#define SQL_IS_INTEGER 0
#define SQL_IS_UINTEGER 0
#define SQL_BEST_ROWID 0
#define SQLLEN long
#define SQLFLOAT double
#define SQLUINTEGER SQLINTEGER
#define SQLUSMALLINT SQLSMALLINT
/* IBM i long is same ordinal, set to fake/unused ordinal (remove ifdef PASE) */
#undef SQL_LONGVARCHAR
#define SQL_LONGVARCHAR -334
#undef SQL_LONGVARGRAPHIC
#define SQL_LONGVARGRAPHIC -335
#undef SQL_LONGVARBINARY
#define SQL_LONGVARBINARY -336
#undef SQL_WLONGVARCHAR
#define SQL_WLONGVARCHAR -337
/* IBM i support V6R1+, ignore V5R4- (remove ifdef PASE) */
#undef SQL_BINARY
#define SQL_BINARY -2
#undef SQL_VARBINARY
#define SQL_VARBINARY -3
#undef SQL_C_BINARY
#define SQL_C_BINARY SQL_BINARY
/* IBM i mv from ibm_db2.c to php_ibm_db2.h (correct) */
#define SQL_ATTR_INFO_USERID 10103
#define SQL_ATTR_INFO_WRKSTNNAME 10104
#define SQL_ATTR_INFO_APPLNAME 10105
#define SQL_ATTR_INFO_ACCTSTR 10106
#define SQL_ATTR_QUERY_TIMEOUT SQL_QUERY_TIMEOUT
/* orig - IBM i SQL_ATTR_JOB_SORT_SEQUENCE (customer request DB2 PTF) */
#define SQL_ATTR_CONN_SORT_SEQUENCE 10046
#define SQL_HEX_SORT_SEQUENCE 0
#define SQL_JOB_SORT_SEQUENCE 1
#define SQL_JOBRUN_SORT_SEQUENCE 2
/* 1.9.7 - IBM i consultant request switch subsystem QSQSRVR job (customer workload issues) */
#ifndef SQL_ATTR_SERVERMODE_SUBSYSTEM
#define SQL_ATTR_SERVERMODE_SUBSYSTEM 10204
#endif
/* 1.9.7 - IBM i monitor switch user profile applications (customer security issue) */
#define DB2_IBM_I_PROFILE_UID_MAX 10
/* 1.9.7 - IBM i force UTF-8 CCSID (DBCS customer issue) */
extern int SQLOverrideCCSID400(int newCCSID);
#endif /* PASE */
#ifndef PASE
#define DB2_SCROLLABLE SQL_CURSOR_KEYSET_DRIVEN
#define DB2_FORWARD_ONLY SQL_SCROLL_FORWARD_ONLY
#else
#define DB2_SCROLLABLE SQL_CURSOR_DYNAMIC
#define DB2_FORWARD_ONLY SQL_CURSOR_FORWARD_ONLY
#define SQL_SCROLL_FORWARD_ONLY SQL_CURSOR_FORWARD_ONLY
#endif
/* CB 20200826 - This is documented, but not defined by headers in 7.2/7.4 */
#ifndef SQL_ATTR_NON_HEXCCSID
#define SQL_ATTR_NON_HEXCCSID 10203
#endif
/* 1.9.7 - IBM i + LUW 10.5 system naming on (*libl)/file.mbr */
#define DB2_I5_NAMING_ON SQL_TRUE
#define DB2_I5_NAMING_OFF SQL_FALSE
/* 1.9.7 - IBM i + LUW 10.5 new IBM i attributes */
#ifndef SQL_ATTR_DECIMAL_SEP
#define SQL_ATTR_DATE_FMT 3025
#define SQL_ATTR_DATE_SEP 3026
#define SQL_ATTR_TIME_FMT 3027
#define SQL_ATTR_TIME_SEP 3028
#define SQL_ATTR_DECIMAL_SEP 3029
#endif
/* 1.9.7 - LUW to IBM i need isolation mode *NONE (required non journal CRTLIB) */
#ifndef SQL_TXN_NO_COMMIT
#define SQL_TXN_NO_COMMIT SQL_TXN_NOCOMMIT
#endif
#define DB2_I5_TXN_NO_COMMIT SQL_TXN_NO_COMMIT
#define DB2_I5_TXN_READ_UNCOMMITTED SQL_TXN_READ_UNCOMMITTED
#define DB2_I5_TXN_READ_COMMITTED SQL_TXN_READ_COMMITTED
#define DB2_I5_TXN_REPEATABLE_READ SQL_TXN_REPEATABLE_READ
#define DB2_I5_TXN_SERIALIZABLE SQL_TXN_SERIALIZABLE
/* 1.9.7 - PASE change to LUW IBMi style (reserve non-IBMi other for LUW) */
#ifdef PASE
#define SQL_IBMi_FMT_ISO SQL_FMT_ISO
#define SQL_IBMi_FMT_USA SQL_FMT_USA
#define SQL_IBMi_FMT_EUR SQL_FMT_EUR
#define SQL_IBMi_FMT_JIS SQL_FMT_JIS
#define SQL_IBMi_FMT_MDY SQL_FMT_MDY
#define SQL_IBMi_FMT_DMY SQL_FMT_DMY
#define SQL_IBMi_FMT_YMD SQL_FMT_YMD
#define SQL_IBMi_FMT_JUL SQL_FMT_JUL
#define SQL_IBMi_FMT_HMS SQL_FMT_HMS
#define SQL_IBMi_FMT_JOB SQL_FMT_JOB
#endif /* PASE */
/* 1.9.7 - LUW to IBM i needed for backward compatibility (not defined prior to DB2 10.5) */
#ifndef SQL_IBMi_FMT_ISO
#define SQL_IBMi_FMT_ISO 1
#define SQL_IBMi_FMT_USA 2
#define SQL_IBMi_FMT_EUR 3
#define SQL_IBMi_FMT_JIS 4
#define SQL_IBMi_FMT_MDY 5
#define SQL_IBMi_FMT_DMY 6
#define SQL_IBMi_FMT_YMD 7
#define SQL_IBMi_FMT_JUL 8
#define SQL_IBMi_FMT_HMS 9
#define SQL_IBMi_FMT_JOB 10
#define SQL_SEP_SLASH 1
#define SQL_SEP_DASH 2
#define SQL_SEP_PERIOD 3
#define SQL_SEP_COMMA 4
#define SQL_SEP_BLANK 5
#define SQL_SEP_COLON 6
#define SQL_SEP_JOB 7
#endif
/* 1.9.7 - LUW to IBM i new option attributes using IBMi_ (not defined prior to DB2 10.5) */
#define DB2_I5_FMT_ISO SQL_IBMi_FMT_ISO
#define DB2_I5_FMT_USA SQL_IBMi_FMT_USA
#define DB2_I5_FMT_EUR SQL_IBMi_FMT_EUR
#define DB2_I5_FMT_JIS SQL_IBMi_FMT_JIS
#define DB2_I5_FMT_MDY SQL_IBMi_FMT_MDY
#define DB2_I5_FMT_DMY SQL_IBMi_FMT_DMY
#define DB2_I5_FMT_YMD SQL_IBMi_FMT_YMD
#define DB2_I5_FMT_JUL SQL_IBMi_FMT_JUL
#define DB2_I5_FMT_JOB SQL_IBMi_FMT_JOB
#define DB2_I5_FMT_HMS SQL_IBMi_FMT_HMS
/* 1.9.7 - LUW to IBM i new option attributes match (not defined prior to DB2 10.5) */
#define DB2_I5_SEP_SLASH SQL_SEP_SLASH
#define DB2_I5_SEP_DASH SQL_SEP_DASH
#define DB2_I5_SEP_PERIOD SQL_SEP_PERIOD
#define DB2_I5_SEP_COMMA SQL_SEP_COMMA
#define DB2_I5_SEP_BLANK SQL_SEP_BLANK
#define DB2_I5_SEP_COLON SQL_SEP_COLON
#define DB2_I5_SEP_JOB SQL_SEP_JOB
#ifdef PASE
#define DB2_I5_FETCH_ON SQL_TRUE
#define DB2_I5_FETCH_OFF SQL_FALSE
#define DB2_I5_JOB_SORT_ON SQL_TRUE
#define DB2_I5_JOB_SORT_OFF SQL_FALSE
#define DB2_I5_DBCS_ALLOC_ON SQL_TRUE
#define DB2_I5_DBCS_ALLOC_OFF SQL_FALSE
#define DB2_I5_CHAR_TRIM_ON SQL_TRUE
#define DB2_I5_CHAR_TRIM_OFF SQL_FALSE
#define DB2_FIRST_IO SQL_FIRST_IO
#define DB2_ALL_IO SQL_ALL_IO
#endif
#define DB2_AUTOCOMMIT_ON SQL_AUTOCOMMIT_ON
#define DB2_AUTOCOMMIT_OFF SQL_AUTOCOMMIT_OFF
#define DB2_ROWCOUNT_PREFETCH_OFF SQL_ROWCOUNT_PREFETCH_OFF
#define DB2_ROWCOUNT_PREFETCH_ON SQL_ROWCOUNT_PREFETCH_ON
#ifndef PASE
#define DB2_DEFERRED_PREPARE_ON SQL_DEFERRED_PREPARE_ON
#define DB2_DEFERRED_PREPARE_OFF SQL_DEFERRED_PREPARE_OFF
#endif
#define DB2_PARAM_IN SQL_PARAM_INPUT
#define DB2_PARAM_OUT SQL_PARAM_OUTPUT
#define DB2_PARAM_INOUT SQL_PARAM_INPUT_OUTPUT
#define DB2_PARAM_FILE 11
/******** end DB2 defines */
/*fetch*/
#define DB2_FETCH_INDEX 0x01
#define DB2_FETCH_ASSOC 0x02
#define DB2_FETCH_BOTH 0x03
/* Change column case */
#define DB2_CASE_NATURAL 0
#define DB2_CASE_LOWER 1
#define DB2_CASE_UPPER 2
/* Trusted context case */
#define DB2_TRUSTED_CONTEXT_ENABLE SQL_ATTR_USE_TRUSTED_CONTEXT