ibm_db 2.5.26-universal-darwin-14 → 2.6.1-universal-darwin-14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES +11 -0
- data/MANIFEST +14 -14
- data/README +225 -225
- data/ext/Makefile.nt32 +181 -181
- data/ext/Makefile.nt32.191 +212 -212
- data/ext/extconf.rb +264 -261
- data/ext/extconf_MacOS.rb +269 -0
- data/ext/ibm_db.c +11879 -11793
- data/ext/ruby_ibm_db.h +241 -240
- data/ext/ruby_ibm_db_cli.c +851 -845
- data/ext/ruby_ibm_db_cli.h +500 -489
- data/init.rb +41 -41
- data/lib/IBM_DB.rb +27 -19
- data/lib/active_record/connection_adapters/ibm_db_adapter.rb +3339 -3289
- data/lib/active_record/connection_adapters/ibmdb_adapter.rb +1 -1
- data/lib/active_record/vendor/db2-i5-zOS.yaml +328 -328
- data/test/cases/adapter_test.rb +207 -207
- data/test/cases/associations/belongs_to_associations_test.rb +711 -711
- data/test/cases/associations/cascaded_eager_loading_test.rb +181 -181
- data/test/cases/associations/has_and_belongs_to_many_associations_test.rb +851 -851
- data/test/cases/associations/join_model_test.rb +743 -743
- data/test/cases/attribute_methods_test.rb +822 -822
- data/test/cases/base_test.rb +2133 -2133
- data/test/cases/calculations_test.rb +482 -482
- data/test/cases/migration_test.rb +2408 -2408
- data/test/cases/persistence_test.rb +642 -642
- data/test/cases/query_cache_test.rb +257 -257
- data/test/cases/relations_test.rb +1182 -1182
- data/test/cases/schema_dumper_test.rb +256 -256
- data/test/cases/transaction_callbacks_test.rb +300 -300
- data/test/cases/validations/uniqueness_validation_test.rb +299 -299
- data/test/cases/xml_serialization_test.rb +408 -408
- data/test/config.yml +154 -154
- data/test/connections/native_ibm_db/connection.rb +43 -43
- data/test/ibm_db_test.rb +24 -24
- data/test/models/warehouse_thing.rb +4 -4
- data/test/schema/schema.rb +751 -751
- metadata +6 -8
- data/lib/linux/rb18x/ibm_db.bundle +0 -0
- data/lib/linux/rb19x/ibm_db.bundle +0 -0
- data/lib/linux/rb20x/ibm_db.bundle +0 -0
- data/lib/linux/rb21x/ibm_db.bundle +0 -0
data/ext/ruby_ibm_db_cli.h
CHANGED
@@ -1,489 +1,500 @@
|
|
1
|
-
/*
|
2
|
-
+----------------------------------------------------------------------+
|
3
|
-
| Licensed Materials - Property of IBM |
|
4
|
-
| |
|
5
|
-
| (C) Copyright IBM Corporation 2009
|
6
|
-
+----------------------------------------------------------------------+
|
7
|
-
| Authors: Praveen Devarao
|
8
|
-
+----------------------------------------------------------------------+
|
9
|
-
*/
|
10
|
-
|
11
|
-
#ifndef RUBY_IBM_DB_CLI_H
|
12
|
-
#define RUBY_IBM_DB_CLI_H
|
13
|
-
|
14
|
-
#ifdef _WIN32
|
15
|
-
#include <windows.h>
|
16
|
-
#else
|
17
|
-
#include <dlfcn.h>
|
18
|
-
#endif
|
19
|
-
|
20
|
-
#ifdef _WIN32
|
21
|
-
#define DLOPEN LoadLibrary
|
22
|
-
#define DLSYM GetProcAddress
|
23
|
-
#define DLCLOSE FreeLibrary
|
24
|
-
#define LIBDB2 "db2cli.dll"
|
25
|
-
#elif _AIX
|
26
|
-
#define DLOPEN dlopen
|
27
|
-
#define DLSYM dlsym
|
28
|
-
#define DLCLOSE dlclose
|
29
|
-
#ifdef __64BIT__
|
30
|
-
/*64-bit library in the archive libdb2.a*/
|
31
|
-
#define LIBDB2 "libdb2.a(shr_64.o)"
|
32
|
-
#else
|
33
|
-
/*32-bit library in the archive libdb2.a*/
|
34
|
-
#define LIBDB2 "libdb2.a(shr.o)"
|
35
|
-
#endif
|
36
|
-
#elif __APPLE__
|
37
|
-
#define DLOPEN dlopen
|
38
|
-
#define DLSYM dlsym
|
39
|
-
#define DLCLOSE dlclose
|
40
|
-
#define LIBDB2 "libdb2.dylib"
|
41
|
-
#else
|
42
|
-
#define DLOPEN dlopen
|
43
|
-
#define DLSYM dlsym
|
44
|
-
#define DLCLOSE dlclose
|
45
|
-
#define LIBDB2 "libdb2.so.1"
|
46
|
-
#endif
|
47
|
-
|
48
|
-
#include <ruby.h>
|
49
|
-
#include <stdio.h>
|
50
|
-
#include <string.h>
|
51
|
-
#include <stdlib.h>
|
52
|
-
#include <sqlcli1.h>
|
53
|
-
|
54
|
-
/* Defines a linked list structure for caching param data */
|
55
|
-
typedef struct _param_cache_node {
|
56
|
-
SQLSMALLINT data_type; /* Datatype */
|
57
|
-
SQLUINTEGER param_size; /* param size */
|
58
|
-
SQLSMALLINT nullable; /* is Nullable */
|
59
|
-
SQLSMALLINT scale; /* Decimal scale */
|
60
|
-
SQLUINTEGER file_options; /* File options if PARAM_FILE */
|
61
|
-
SQLINTEGER bind_indicator; /* indicator variable for SQLBindParameter */
|
62
|
-
int param_num; /* param number in stmt */
|
63
|
-
int param_type; /* Type of param - INP/OUT/INP-OUT/FILE */
|
64
|
-
int size; /* Size of param */
|
65
|
-
char *varname; /* bound variable name */
|
66
|
-
SQLBIGINT ivalue; /* Temp storage value */
|
67
|
-
SQLDOUBLE fvalue; /* Temp storage value */
|
68
|
-
SQLPOINTER svalue; /* Temp storage value */
|
69
|
-
struct _param_cache_node *next; /* Pointer to next node */
|
70
|
-
} param_node;
|
71
|
-
|
72
|
-
typedef struct _conn_handle_struct {
|
73
|
-
SQLHANDLE henv;
|
74
|
-
SQLHANDLE hdbc;
|
75
|
-
long auto_commit;
|
76
|
-
long c_bin_mode;
|
77
|
-
long c_case_mode;
|
78
|
-
long c_cursor_type;
|
79
|
-
int handle_active;
|
80
|
-
int transaction_active;
|
81
|
-
SQLSMALLINT error_recno_tracker;
|
82
|
-
SQLSMALLINT errormsg_recno_tracker;
|
83
|
-
int flag_pconnect; /* Indicates that this connection is persistent */
|
84
|
-
|
85
|
-
int errorType; /*Indicates Whether the error logged in ruby_error_msg is a statement error or connection error*/
|
86
|
-
|
87
|
-
SQLPOINTER ruby_error_msg;
|
88
|
-
SQLPOINTER ruby_error_state;
|
89
|
-
SQLSMALLINT ruby_error_msg_len;
|
90
|
-
|
91
|
-
SQLINTEGER sqlcode;
|
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
|
-
SQLSMALLINT
|
118
|
-
|
119
|
-
SQLINTEGER
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
SQLHANDLE
|
130
|
-
|
131
|
-
long
|
132
|
-
long
|
133
|
-
|
134
|
-
SQLSMALLINT
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
param_node *
|
139
|
-
|
140
|
-
|
141
|
-
int
|
142
|
-
int
|
143
|
-
int
|
144
|
-
int
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
SQLPOINTER
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
} stmt_handle;
|
155
|
-
|
156
|
-
/*
|
157
|
-
Structure holding the data to be passed to SQLConnect or SQLDriverConnect CLI call
|
158
|
-
*/
|
159
|
-
typedef struct _ibm_db_connect_args_struct {
|
160
|
-
#ifdef UNICODE_SUPPORT_VERSION
|
161
|
-
SQLWCHAR *database;
|
162
|
-
SQLWCHAR *uid;
|
163
|
-
SQLWCHAR *password;
|
164
|
-
#else
|
165
|
-
SQLCHAR *database;
|
166
|
-
SQLCHAR *uid;
|
167
|
-
SQLCHAR *password;
|
168
|
-
#endif
|
169
|
-
SQLSMALLINT database_len;
|
170
|
-
SQLSMALLINT uid_len;
|
171
|
-
SQLSMALLINT password_len;
|
172
|
-
int ctlg_conn; /*Indicates if the connection is a cataloged connection or not*/
|
173
|
-
SQLHANDLE *hdbc;
|
174
|
-
} connect_args;
|
175
|
-
|
176
|
-
/*
|
177
|
-
Structure holding the necessary info to be passed to SQLEndTran CLI call
|
178
|
-
*/
|
179
|
-
typedef struct _ibm_db_end_tran_args_struct {
|
180
|
-
SQLHANDLE *hdbc;
|
181
|
-
SQLSMALLINT handleType;
|
182
|
-
SQLSMALLINT completionType;
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
SQLSMALLINT
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
SQLWCHAR *
|
216
|
-
SQLWCHAR *
|
217
|
-
SQLWCHAR *
|
218
|
-
SQLWCHAR *
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
SQLCHAR *
|
223
|
-
SQLCHAR *
|
224
|
-
SQLCHAR *
|
225
|
-
SQLCHAR *
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
SQLSMALLINT
|
230
|
-
SQLSMALLINT
|
231
|
-
SQLSMALLINT
|
232
|
-
SQLSMALLINT
|
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
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
SQLSMALLINT
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
int
|
452
|
-
|
453
|
-
|
454
|
-
int
|
455
|
-
int
|
456
|
-
|
457
|
-
int
|
458
|
-
int
|
459
|
-
int
|
460
|
-
int
|
461
|
-
int
|
462
|
-
int
|
463
|
-
int
|
464
|
-
int
|
465
|
-
int
|
466
|
-
int
|
467
|
-
int
|
468
|
-
int
|
469
|
-
int
|
470
|
-
int
|
471
|
-
int
|
472
|
-
int
|
473
|
-
int
|
474
|
-
int
|
475
|
-
int
|
476
|
-
int
|
477
|
-
int
|
478
|
-
int
|
479
|
-
int
|
480
|
-
int
|
481
|
-
int
|
482
|
-
int
|
483
|
-
int
|
484
|
-
int
|
485
|
-
|
486
|
-
int
|
487
|
-
int
|
488
|
-
|
489
|
-
|
1
|
+
/*
|
2
|
+
+----------------------------------------------------------------------+
|
3
|
+
| Licensed Materials - Property of IBM |
|
4
|
+
| |
|
5
|
+
| (C) Copyright IBM Corporation 2009 - 2015 |
|
6
|
+
+----------------------------------------------------------------------+
|
7
|
+
| Authors: Praveen Devarao, Arvind Gupta |
|
8
|
+
+----------------------------------------------------------------------+
|
9
|
+
*/
|
10
|
+
|
11
|
+
#ifndef RUBY_IBM_DB_CLI_H
|
12
|
+
#define RUBY_IBM_DB_CLI_H
|
13
|
+
|
14
|
+
#ifdef _WIN32
|
15
|
+
#include <windows.h>
|
16
|
+
#else
|
17
|
+
#include <dlfcn.h>
|
18
|
+
#endif
|
19
|
+
|
20
|
+
#ifdef _WIN32
|
21
|
+
#define DLOPEN LoadLibrary
|
22
|
+
#define DLSYM GetProcAddress
|
23
|
+
#define DLCLOSE FreeLibrary
|
24
|
+
#define LIBDB2 "db2cli.dll"
|
25
|
+
#elif _AIX
|
26
|
+
#define DLOPEN dlopen
|
27
|
+
#define DLSYM dlsym
|
28
|
+
#define DLCLOSE dlclose
|
29
|
+
#ifdef __64BIT__
|
30
|
+
/*64-bit library in the archive libdb2.a*/
|
31
|
+
#define LIBDB2 "libdb2.a(shr_64.o)"
|
32
|
+
#else
|
33
|
+
/*32-bit library in the archive libdb2.a*/
|
34
|
+
#define LIBDB2 "libdb2.a(shr.o)"
|
35
|
+
#endif
|
36
|
+
#elif __APPLE__
|
37
|
+
#define DLOPEN dlopen
|
38
|
+
#define DLSYM dlsym
|
39
|
+
#define DLCLOSE dlclose
|
40
|
+
#define LIBDB2 "libdb2.dylib"
|
41
|
+
#else
|
42
|
+
#define DLOPEN dlopen
|
43
|
+
#define DLSYM dlsym
|
44
|
+
#define DLCLOSE dlclose
|
45
|
+
#define LIBDB2 "libdb2.so.1"
|
46
|
+
#endif
|
47
|
+
|
48
|
+
#include <ruby.h>
|
49
|
+
#include <stdio.h>
|
50
|
+
#include <string.h>
|
51
|
+
#include <stdlib.h>
|
52
|
+
#include <sqlcli1.h>
|
53
|
+
|
54
|
+
/* Defines a linked list structure for caching param data */
|
55
|
+
typedef struct _param_cache_node {
|
56
|
+
SQLSMALLINT data_type; /* Datatype */
|
57
|
+
SQLUINTEGER param_size; /* param size */
|
58
|
+
SQLSMALLINT nullable; /* is Nullable */
|
59
|
+
SQLSMALLINT scale; /* Decimal scale */
|
60
|
+
SQLUINTEGER file_options; /* File options if PARAM_FILE */
|
61
|
+
SQLINTEGER bind_indicator; /* indicator variable for SQLBindParameter */
|
62
|
+
int param_num; /* param number in stmt */
|
63
|
+
int param_type; /* Type of param - INP/OUT/INP-OUT/FILE */
|
64
|
+
int size; /* Size of param */
|
65
|
+
char *varname; /* bound variable name */
|
66
|
+
SQLBIGINT ivalue; /* Temp storage value */
|
67
|
+
SQLDOUBLE fvalue; /* Temp storage value */
|
68
|
+
SQLPOINTER svalue; /* Temp storage value */
|
69
|
+
struct _param_cache_node *next; /* Pointer to next node */
|
70
|
+
} param_node;
|
71
|
+
|
72
|
+
typedef struct _conn_handle_struct {
|
73
|
+
SQLHANDLE henv;
|
74
|
+
SQLHANDLE hdbc;
|
75
|
+
long auto_commit;
|
76
|
+
long c_bin_mode;
|
77
|
+
long c_case_mode;
|
78
|
+
long c_cursor_type;
|
79
|
+
int handle_active;
|
80
|
+
int transaction_active;
|
81
|
+
SQLSMALLINT error_recno_tracker;
|
82
|
+
SQLSMALLINT errormsg_recno_tracker;
|
83
|
+
int flag_pconnect; /* Indicates that this connection is persistent */
|
84
|
+
|
85
|
+
int errorType; /*Indicates Whether the error logged in ruby_error_msg is a statement error or connection error*/
|
86
|
+
|
87
|
+
SQLPOINTER ruby_error_msg;
|
88
|
+
SQLPOINTER ruby_error_state;
|
89
|
+
SQLSMALLINT ruby_error_msg_len;
|
90
|
+
|
91
|
+
SQLINTEGER sqlcode;
|
92
|
+
} conn_handle;
|
93
|
+
|
94
|
+
typedef union {
|
95
|
+
SQLINTEGER i_val;
|
96
|
+
SQLDOUBLE d_val;
|
97
|
+
SQLFLOAT f_val;
|
98
|
+
SQLSMALLINT s_val;
|
99
|
+
SQLPOINTER str_val;
|
100
|
+
} ibm_db_row_data_type;
|
101
|
+
|
102
|
+
typedef struct {
|
103
|
+
SQLINTEGER out_length;
|
104
|
+
ibm_db_row_data_type data;
|
105
|
+
} ibm_db_row_type;
|
106
|
+
|
107
|
+
typedef struct _ibm_db_result_set_info_struct {
|
108
|
+
#ifdef UNICODE_SUPPORT_VERSION
|
109
|
+
SQLWCHAR *name;
|
110
|
+
long name_length;
|
111
|
+
#else
|
112
|
+
SQLCHAR *name;
|
113
|
+
#endif
|
114
|
+
SQLSMALLINT type;
|
115
|
+
SQLUINTEGER size;
|
116
|
+
SQLSMALLINT scale;
|
117
|
+
SQLSMALLINT nullable;
|
118
|
+
SQLINTEGER lob_loc;
|
119
|
+
SQLINTEGER loc_ind;
|
120
|
+
SQLSMALLINT loc_type;
|
121
|
+
} ibm_db_result_set_info;
|
122
|
+
|
123
|
+
typedef struct _row_hash_struct {
|
124
|
+
VALUE hash;
|
125
|
+
} row_hash_struct;
|
126
|
+
|
127
|
+
typedef struct _stmt_handle_struct {
|
128
|
+
SQLHANDLE hdbc;
|
129
|
+
SQLHANDLE hstmt;
|
130
|
+
long s_bin_mode;
|
131
|
+
long cursor_type;
|
132
|
+
long s_case_mode;
|
133
|
+
SQLSMALLINT error_recno_tracker;
|
134
|
+
SQLSMALLINT errormsg_recno_tracker;
|
135
|
+
|
136
|
+
/* Parameter Caching variables */
|
137
|
+
param_node *head_cache_list;
|
138
|
+
param_node *current_node;
|
139
|
+
|
140
|
+
int num_params; /* Number of Params */
|
141
|
+
int file_param; /* if option passed in is FILE_PARAM */
|
142
|
+
int num_columns;
|
143
|
+
int is_executing;
|
144
|
+
int is_freed; /* Indicates if the SQLFreeHandle is been called on the handle or not.*/
|
145
|
+
|
146
|
+
ibm_db_result_set_info *column_info;
|
147
|
+
ibm_db_row_type *row_data;
|
148
|
+
|
149
|
+
SQLPOINTER ruby_stmt_err_msg;
|
150
|
+
SQLPOINTER ruby_stmt_err_state;
|
151
|
+
SQLSMALLINT ruby_stmt_err_msg_len;
|
152
|
+
SQLINTEGER sqlcode;
|
153
|
+
int rc;
|
154
|
+
} stmt_handle;
|
155
|
+
|
156
|
+
/*
|
157
|
+
Structure holding the data to be passed to SQLConnect or SQLDriverConnect CLI call
|
158
|
+
*/
|
159
|
+
typedef struct _ibm_db_connect_args_struct {
|
160
|
+
#ifdef UNICODE_SUPPORT_VERSION
|
161
|
+
SQLWCHAR *database;
|
162
|
+
SQLWCHAR *uid;
|
163
|
+
SQLWCHAR *password;
|
164
|
+
#else
|
165
|
+
SQLCHAR *database;
|
166
|
+
SQLCHAR *uid;
|
167
|
+
SQLCHAR *password;
|
168
|
+
#endif
|
169
|
+
SQLSMALLINT database_len;
|
170
|
+
SQLSMALLINT uid_len;
|
171
|
+
SQLSMALLINT password_len;
|
172
|
+
int ctlg_conn; /*Indicates if the connection is a cataloged connection or not*/
|
173
|
+
SQLHANDLE *hdbc;
|
174
|
+
} connect_args;
|
175
|
+
|
176
|
+
/*
|
177
|
+
Structure holding the necessary info to be passed to SQLEndTran CLI call
|
178
|
+
*/
|
179
|
+
typedef struct _ibm_db_end_tran_args_struct {
|
180
|
+
SQLHANDLE *hdbc;
|
181
|
+
SQLSMALLINT handleType;
|
182
|
+
SQLSMALLINT completionType;
|
183
|
+
int rc;
|
184
|
+
} end_tran_args;
|
185
|
+
|
186
|
+
/*
|
187
|
+
Structure holding the necessary info to be passed to SQLDescribeparam CLI call
|
188
|
+
*/
|
189
|
+
typedef struct _ibm_db_describeparam_args_struct {
|
190
|
+
stmt_handle *stmt_res;
|
191
|
+
SQLUSMALLINT param_no;
|
192
|
+
SQLSMALLINT sql_data_type;
|
193
|
+
SQLUINTEGER sql_precision;
|
194
|
+
SQLSMALLINT sql_scale;
|
195
|
+
SQLSMALLINT sql_nullable;
|
196
|
+
int rc;
|
197
|
+
} describeparam_args;
|
198
|
+
|
199
|
+
/*
|
200
|
+
Structure holding the necessary info to be passed to SQLDescribeCol CLI call
|
201
|
+
*/
|
202
|
+
typedef struct _ibm_db_describecol_args_struct {
|
203
|
+
stmt_handle *stmt_res;
|
204
|
+
SQLUSMALLINT col_no;
|
205
|
+
SQLSMALLINT name_length;
|
206
|
+
SQLSMALLINT buff_length;
|
207
|
+
} describecol_args;
|
208
|
+
/*
|
209
|
+
Structure holding the necessary info to be passed to CLI calls like SQLColumns
|
210
|
+
SQLForeignKeys etc. The same structure is used to get the SP parameters, with table_name as proc_name
|
211
|
+
*/
|
212
|
+
typedef struct _ibm_db_metadata_args_struct {
|
213
|
+
stmt_handle *stmt_res;
|
214
|
+
#ifdef UNICODE_SUPPORT_VERSION
|
215
|
+
SQLWCHAR *qualifier;
|
216
|
+
SQLWCHAR *owner;
|
217
|
+
SQLWCHAR *table_name;
|
218
|
+
SQLWCHAR *proc_name; /*Used for call SQLProcedureColumns*/
|
219
|
+
SQLWCHAR *column_name;
|
220
|
+
SQLWCHAR *table_type;
|
221
|
+
#else
|
222
|
+
SQLCHAR *qualifier;
|
223
|
+
SQLCHAR *owner;
|
224
|
+
SQLCHAR *table_name;
|
225
|
+
SQLCHAR *proc_name; /*Used for call SQLProcedureColumns*/
|
226
|
+
SQLCHAR *column_name;
|
227
|
+
SQLCHAR *table_type;
|
228
|
+
#endif
|
229
|
+
SQLSMALLINT qualifier_len;
|
230
|
+
SQLSMALLINT owner_len;
|
231
|
+
SQLSMALLINT table_name_len;
|
232
|
+
SQLSMALLINT proc_name_len; /*Used for call SQLProcedureColumns*/
|
233
|
+
SQLSMALLINT column_name_len;
|
234
|
+
SQLSMALLINT table_type_len;
|
235
|
+
int scope; /*Used in SQLSpecialColumns To determine the scope of the unique row identifier*/
|
236
|
+
int unique; /*Used in SQLStatistics to determine if only unique indexes are to be fetched or all*/
|
237
|
+
int rc;
|
238
|
+
|
239
|
+
} metadata_args;
|
240
|
+
|
241
|
+
/*
|
242
|
+
Structure holding the necessary info to be passed to SQLPrepare and SQLExecDirect CLI call
|
243
|
+
*/
|
244
|
+
typedef struct _ibm_db_exec_direct_args_struct {
|
245
|
+
stmt_handle *stmt_res;
|
246
|
+
#ifdef UNICODE_SUPPORT_VERSION
|
247
|
+
SQLWCHAR *stmt_string;
|
248
|
+
#else
|
249
|
+
SQLCHAR *stmt_string;
|
250
|
+
#endif
|
251
|
+
long stmt_string_len;
|
252
|
+
int rc;
|
253
|
+
} exec_cum_prepare_args;
|
254
|
+
|
255
|
+
/*
|
256
|
+
Structure holding the necessary info to be passed to SQLCreateDB and SQLDropDB CLI call
|
257
|
+
*/
|
258
|
+
typedef struct _ibm_db_create_drop_db_args_struct {
|
259
|
+
conn_handle *conn_res;
|
260
|
+
#ifdef UNICODE_SUPPORT_VERSION
|
261
|
+
SQLWCHAR *dbName;
|
262
|
+
SQLWCHAR *codeSet;
|
263
|
+
SQLWCHAR *mode;
|
264
|
+
#else
|
265
|
+
SQLCHAR *dbName;
|
266
|
+
SQLCHAR *codeSet;
|
267
|
+
SQLCHAR *mode;
|
268
|
+
#endif
|
269
|
+
long dbName_string_len;
|
270
|
+
long codeSet_string_len;
|
271
|
+
long mode_string_len;
|
272
|
+
int rc;
|
273
|
+
} create_drop_db_args;
|
274
|
+
|
275
|
+
/*
|
276
|
+
Structure holding the necessary info to be passed to SQLParamData and SQLPutData CLI call
|
277
|
+
*/
|
278
|
+
typedef struct _ibm_db_param_and_put_data_struct {
|
279
|
+
stmt_handle *stmt_res;
|
280
|
+
SQLPOINTER valuePtr;
|
281
|
+
} param_cum_put_data_args;
|
282
|
+
|
283
|
+
/*
|
284
|
+
Structure holding the necessary info to be passed to SQLNextResult CLI call
|
285
|
+
*/
|
286
|
+
typedef struct _ibm_db_next_result_args_struct {
|
287
|
+
SQLHSTMT *new_hstmt;
|
288
|
+
stmt_handle *stmt_res;
|
289
|
+
int rc;
|
290
|
+
} next_result_args;
|
291
|
+
|
292
|
+
/*
|
293
|
+
Structure holding the necessary info to be passed to calls SQLNumResultCols/SQLNumParams
|
294
|
+
*/
|
295
|
+
typedef struct _ibm_db_row_col_count_struct {
|
296
|
+
stmt_handle *stmt_res;
|
297
|
+
SQLSMALLINT count;
|
298
|
+
int rc;
|
299
|
+
} row_col_count_args;
|
300
|
+
|
301
|
+
/*
|
302
|
+
Structure holding the necessary info to be passed to call SQLRowcount
|
303
|
+
*/
|
304
|
+
typedef struct _ibm_db_row_count_struct {
|
305
|
+
stmt_handle *stmt_res;
|
306
|
+
SQLINTEGER count;
|
307
|
+
int rc;
|
308
|
+
} sql_row_count_args;
|
309
|
+
|
310
|
+
/*
|
311
|
+
Structure holding the necessary info to be passed to call SQLColAttributes
|
312
|
+
*/
|
313
|
+
typedef struct _ibm_db_col_attr_struct {
|
314
|
+
stmt_handle *stmt_res;
|
315
|
+
SQLSMALLINT col_num;
|
316
|
+
SQLSMALLINT FieldIdentifier;
|
317
|
+
SQLINTEGER num_attr;
|
318
|
+
int rc;
|
319
|
+
} col_attr_args;
|
320
|
+
|
321
|
+
/*
|
322
|
+
Structure holding the necessary info to be passed to call SQLBindCol
|
323
|
+
*/
|
324
|
+
typedef struct _ibm_db_bind_col_struct {
|
325
|
+
stmt_handle *stmt_res;
|
326
|
+
SQLUSMALLINT col_num;
|
327
|
+
SQLSMALLINT TargetType;
|
328
|
+
SQLPOINTER TargetValuePtr;
|
329
|
+
SQLLEN buff_length;
|
330
|
+
SQLLEN *out_length;
|
331
|
+
} bind_col_args;
|
332
|
+
|
333
|
+
/*
|
334
|
+
Structure holding the necessary info to be passed to call SQLGetData
|
335
|
+
*/
|
336
|
+
typedef struct _ibm_db_get_data_args_struct {
|
337
|
+
stmt_handle *stmt_res;
|
338
|
+
SQLSMALLINT col_num;
|
339
|
+
SQLSMALLINT targetType;
|
340
|
+
SQLPOINTER buff;
|
341
|
+
SQLLEN buff_length;
|
342
|
+
SQLLEN *out_length;
|
343
|
+
} get_data_args;
|
344
|
+
|
345
|
+
/*
|
346
|
+
Structure holding the necessary info to be passed to call SQLGetLength
|
347
|
+
*/
|
348
|
+
typedef struct _ibm_db_get_data_length_struct {
|
349
|
+
SQLHSTMT *new_hstmt;
|
350
|
+
SQLSMALLINT col_num;
|
351
|
+
stmt_handle *stmt_res;
|
352
|
+
SQLINTEGER *sLength;
|
353
|
+
|
354
|
+
} get_length_args;
|
355
|
+
|
356
|
+
/*
|
357
|
+
Structure holding the necessary info to be passed to call SQLGetSubString
|
358
|
+
*/
|
359
|
+
typedef struct _ibm_db_get_data_subString_struct {
|
360
|
+
SQLHSTMT *new_hstmt;
|
361
|
+
SQLSMALLINT col_num;
|
362
|
+
stmt_handle *stmt_res;
|
363
|
+
SQLUINTEGER forLength;
|
364
|
+
SQLSMALLINT targetCType;
|
365
|
+
SQLPOINTER buffer;
|
366
|
+
SQLLEN buff_length;
|
367
|
+
SQLINTEGER *out_length;
|
368
|
+
|
369
|
+
} get_subString_args;
|
370
|
+
|
371
|
+
/*
|
372
|
+
Structure holding the necessary info to be passed to call SQLFetchScroll and SQLFetch
|
373
|
+
*/
|
374
|
+
typedef struct _ibm_db_fetch_data_struct {
|
375
|
+
stmt_handle *stmt_res;
|
376
|
+
SQLSMALLINT fetchOrientation;
|
377
|
+
SQLLEN fetchOffset;
|
378
|
+
} fetch_data_args;
|
379
|
+
|
380
|
+
/*
|
381
|
+
Structure holding the necessary info to be passed to calls SQLSetStmtAttr/SQLSetConnectAttr/SQLEnvAttr
|
382
|
+
*/
|
383
|
+
typedef struct _ibm_db_set_handle_attr_struct {
|
384
|
+
SQLHANDLE *handle;
|
385
|
+
SQLINTEGER attribute;
|
386
|
+
SQLPOINTER valuePtr;
|
387
|
+
SQLINTEGER strLength;
|
388
|
+
|
389
|
+
} set_handle_attr_args;
|
390
|
+
|
391
|
+
/*
|
392
|
+
Structure holding the necessary info to be passed to call SQLGetStmtAttr and SQLGetConnectAttr
|
393
|
+
*/
|
394
|
+
typedef struct _ibm_db_get_handle_attr_struct {
|
395
|
+
SQLHANDLE *handle;
|
396
|
+
SQLINTEGER attribute;
|
397
|
+
SQLPOINTER valuePtr;
|
398
|
+
SQLINTEGER buff_length;
|
399
|
+
SQLINTEGER *out_length;
|
400
|
+
} get_handle_attr_args;
|
401
|
+
|
402
|
+
/*
|
403
|
+
Structure holding the necessary info to be passed to call SQLBindParameter
|
404
|
+
*/
|
405
|
+
typedef struct _ibm_db_bind_parameter_struct {
|
406
|
+
stmt_handle *stmt_res;
|
407
|
+
SQLSMALLINT param_num;
|
408
|
+
SQLSMALLINT IOType;
|
409
|
+
SQLSMALLINT valueType;
|
410
|
+
SQLSMALLINT paramType;
|
411
|
+
SQLULEN colSize;
|
412
|
+
SQLSMALLINT decimalDigits;
|
413
|
+
SQLPOINTER paramValPtr;
|
414
|
+
SQLLEN buff_length;
|
415
|
+
SQLLEN *out_length;
|
416
|
+
} bind_parameter_args;
|
417
|
+
|
418
|
+
/*
|
419
|
+
Structure holding the necessary info to be passed to call SQLGetInfo
|
420
|
+
*/
|
421
|
+
typedef struct _ibm_db_get_info_struct {
|
422
|
+
conn_handle *conn_res;
|
423
|
+
SQLUSMALLINT infoType;
|
424
|
+
SQLPOINTER infoValue;
|
425
|
+
SQLSMALLINT buff_length;
|
426
|
+
SQLSMALLINT *out_length;
|
427
|
+
VALUE return_value;
|
428
|
+
} get_info_args;
|
429
|
+
|
430
|
+
/*
|
431
|
+
Structure holding the necessary info to be passed to call SQLGetDiagRec
|
432
|
+
*/
|
433
|
+
typedef struct _ibm_db_get_diagRec_struct {
|
434
|
+
SQLSMALLINT hType;
|
435
|
+
SQLHANDLE handle;
|
436
|
+
SQLSMALLINT recNum;
|
437
|
+
SQLPOINTER SQLState;
|
438
|
+
SQLPOINTER msgText;
|
439
|
+
SQLINTEGER *NativeErrorPtr;
|
440
|
+
SQLSMALLINT buff_length;
|
441
|
+
SQLSMALLINT *text_length_ptr;
|
442
|
+
int return_code;
|
443
|
+
} get_diagRec_args;
|
444
|
+
|
445
|
+
/*
|
446
|
+
Structure holding the necessary info to be passed to call SQLFreestmt
|
447
|
+
*/
|
448
|
+
typedef struct _ibm_db_free_stmt_struct {
|
449
|
+
stmt_handle *stmt_res;
|
450
|
+
SQLUSMALLINT option;
|
451
|
+
int rc;
|
452
|
+
} free_stmt_args;
|
453
|
+
|
454
|
+
int _ruby_ibm_db_SQLConnect_helper(connect_args *data);
|
455
|
+
int _ruby_ibm_db_SQLDisconnect_helper(SQLHANDLE *hdbc);
|
456
|
+
void _ruby_ibm_db_Connection_level_UBF(void *data);
|
457
|
+
int _ruby_ibm_db_SQLEndTran(end_tran_args *endtran_args);
|
458
|
+
int _ruby_ibm_db_SQLDescribeParam_helper(describeparam_args *data);
|
459
|
+
int _ruby_ibm_db_SQLDescribeCol_helper(describecol_args *data);
|
460
|
+
int _ruby_ibm_db_SQLBindCol_helper(bind_col_args *data);
|
461
|
+
int _ruby_ibm_db_SQLColumnPrivileges_helper(metadata_args *data);
|
462
|
+
int _ruby_ibm_db_SQLColumns_helper(metadata_args *data);
|
463
|
+
int _ruby_ibm_db_SQLPrimaryKeys_helper(metadata_args *data);
|
464
|
+
int _ruby_ibm_db_SQLForeignKeys_helper(metadata_args *data);
|
465
|
+
int _ruby_ibm_db_SQLProcedureColumns_helper(metadata_args *data);
|
466
|
+
int _ruby_ibm_db_SQLProcedures_helper(metadata_args *data);
|
467
|
+
int _ruby_ibm_db_SQLSpecialColumns_helper(metadata_args *data);
|
468
|
+
int _ruby_ibm_db_SQLStatistics_helper(metadata_args *data);
|
469
|
+
int _ruby_ibm_db_SQLTablePrivileges_helper(metadata_args *data);
|
470
|
+
int _ruby_ibm_db_SQLTables_helper(metadata_args *data);
|
471
|
+
int _ruby_ibm_db_SQLExecDirect_helper(exec_cum_prepare_args *data);
|
472
|
+
int _ruby_ibm_db_SQLPrepare_helper(exec_cum_prepare_args *data);
|
473
|
+
int _ruby_ibm_db_SQLFreeStmt_helper(free_stmt_args *data);
|
474
|
+
int _ruby_ibm_db_SQLExecute_helper(stmt_handle *stmt_res);
|
475
|
+
int _ruby_ibm_db_SQLParamData_helper(param_cum_put_data_args *data);
|
476
|
+
int _ruby_ibm_db_SQLColAttributes_helper(col_attr_args *data);
|
477
|
+
int _ruby_ibm_db_SQLPutData_helper(param_cum_put_data_args *data);
|
478
|
+
int _ruby_ibm_db_SQLGetData_helper(get_data_args *data);
|
479
|
+
int _ruby_ibm_db_SQLGetLength_helper(get_length_args *data);
|
480
|
+
int _ruby_ibm_db_SQLGetSubString_helper(get_subString_args *data);
|
481
|
+
int _ruby_ibm_db_SQLNextResult_helper(next_result_args *data);
|
482
|
+
int _ruby_ibm_db_SQLFetchScroll_helper(fetch_data_args *data);
|
483
|
+
int _ruby_ibm_db_SQLFetch_helper(fetch_data_args *data);
|
484
|
+
int _ruby_ibm_db_SQLNumResultCols_helper(row_col_count_args *data);
|
485
|
+
int _ruby_ibm_db_SQLNumParams_helper(row_col_count_args *data);
|
486
|
+
int _ruby_ibm_db_SQLRowCount_helper(sql_row_count_args *data);
|
487
|
+
int _ruby_ibm_db_SQLGetInfo_helper(get_info_args *data);
|
488
|
+
int _ruby_ibm_db_SQLGetDiagRec_helper(get_diagRec_args *data);
|
489
|
+
int _ruby_ibm_db_SQLSetStmtAttr_helper(set_handle_attr_args *data);
|
490
|
+
int _ruby_ibm_db_SQLSetConnectAttr_helper(set_handle_attr_args *data);
|
491
|
+
int _ruby_ibm_db_SQLSetEnvAttr_helper(set_handle_attr_args *data);
|
492
|
+
int _ruby_ibm_db_SQLGetStmtAttr_helper(get_handle_attr_args *data);
|
493
|
+
int _ruby_ibm_db_SQLGetConnectAttr_helper(get_handle_attr_args *data);
|
494
|
+
int _ruby_ibm_db_SQLBindFileToParam_helper(stmt_handle *stmt_res, param_node *curr);
|
495
|
+
int _ruby_ibm_db_SQLBindParameter_helper(bind_parameter_args *data);
|
496
|
+
void _ruby_ibm_db_Statement_level_UBF(stmt_handle *stmt_res);
|
497
|
+
int _ruby_ibm_db_SQLCreateDB_helper(create_drop_db_args *data);
|
498
|
+
int _ruby_ibm_db_SQLDropDB_helper(create_drop_db_args *data);
|
499
|
+
|
500
|
+
#endif /* RUBY_IBM_DB_CLI_H */
|