db2 2.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGES +181 -0
- data/LICENSE +18 -0
- data/MANIFEST +14 -0
- data/ParameterizedQueries README +39 -0
- data/README +282 -0
- data/ext/Makefile.nt32 +181 -0
- data/ext/extconf.rb +66 -0
- data/ext/ibm_db.c +11166 -0
- data/ext/ruby_ibm_db.h +236 -0
- data/ext/ruby_ibm_db_cli.c +738 -0
- data/ext/ruby_ibm_db_cli.h +431 -0
- data/init.rb +42 -0
- data/lib/IBM_DB.rb +2 -0
- data/lib/active_record/connection_adapters/ibm_db_adapter.rb +2558 -0
- data/lib/active_record/connection_adapters/ibm_db_pstmt.rb +1965 -0
- data/lib/active_record/vendor/db2-i5-zOS.yaml +328 -0
- data/test/cases/adapter_test.rb +202 -0
- data/test/cases/associations/belongs_to_associations_test.rb +486 -0
- data/test/cases/associations/cascaded_eager_loading_test.rb +183 -0
- data/test/cases/associations/eager_test.rb +862 -0
- data/test/cases/associations/has_and_belongs_to_many_associations_test.rb +917 -0
- data/test/cases/associations/has_many_through_associations_test.rb +461 -0
- data/test/cases/associations/join_model_test.rb +793 -0
- data/test/cases/attribute_methods_test.rb +621 -0
- data/test/cases/base_test.rb +1486 -0
- data/test/cases/calculations_test.rb +362 -0
- data/test/cases/finder_test.rb +1088 -0
- data/test/cases/fixtures_test.rb +684 -0
- data/test/cases/migration_test.rb +2014 -0
- data/test/cases/schema_dumper_test.rb +232 -0
- data/test/cases/validations/uniqueness_validation_test.rb +283 -0
- data/test/connections/native_ibm_db/connection.rb +42 -0
- data/test/ibm_db_test.rb +25 -0
- data/test/models/warehouse_thing.rb +5 -0
- data/test/schema/i5/ibm_db_specific_schema.rb +135 -0
- data/test/schema/ids/ibm_db_specific_schema.rb +138 -0
- data/test/schema/luw/ibm_db_specific_schema.rb +135 -0
- data/test/schema/schema.rb +647 -0
- data/test/schema/zOS/ibm_db_specific_schema.rb +206 -0
- metadata +105 -0
@@ -0,0 +1,431 @@
|
|
1
|
+
/*
|
2
|
+
+----------------------------------------------------------------------+
|
3
|
+
| Licensed Materials - Property of IBM |
|
4
|
+
| |
|
5
|
+
| (C) Copyright IBM Corporation 2009, 2010 |
|
6
|
+
+----------------------------------------------------------------------+
|
7
|
+
| Authors: Praveen Devarao |
|
8
|
+
+----------------------------------------------------------------------+
|
9
|
+
*/
|
10
|
+
|
11
|
+
#ifndef RUBY_IBM_DB_CLI_H
|
12
|
+
#define RUBY_IBM_DB_CLI_H
|
13
|
+
|
14
|
+
#include <ruby.h>
|
15
|
+
#include <stdio.h>
|
16
|
+
#include <string.h>
|
17
|
+
#include <stdlib.h>
|
18
|
+
#include <sqlcli1.h>
|
19
|
+
|
20
|
+
/* Defines a linked list structure for caching param data */
|
21
|
+
typedef struct _param_cache_node {
|
22
|
+
SQLSMALLINT data_type; /* Datatype */
|
23
|
+
SQLUINTEGER param_size; /* param size */
|
24
|
+
SQLSMALLINT nullable; /* is Nullable */
|
25
|
+
SQLSMALLINT scale; /* Decimal scale */
|
26
|
+
SQLUINTEGER file_options; /* File options if PARAM_FILE */
|
27
|
+
SQLINTEGER bind_indicator; /* indicator variable for SQLBindParameter */
|
28
|
+
int param_num; /* param number in stmt */
|
29
|
+
int param_type; /* Type of param - INP/OUT/INP-OUT/FILE */
|
30
|
+
int size; /* Size of param */
|
31
|
+
char *varname; /* bound variable name */
|
32
|
+
SQLBIGINT ivalue; /* Temp storage value */
|
33
|
+
SQLDOUBLE fvalue; /* Temp storage value */
|
34
|
+
SQLPOINTER svalue; /* Temp storage value */
|
35
|
+
struct _param_cache_node *next; /* Pointer to next node */
|
36
|
+
} param_node;
|
37
|
+
|
38
|
+
typedef struct _conn_handle_struct {
|
39
|
+
SQLHANDLE henv;
|
40
|
+
SQLHANDLE hdbc;
|
41
|
+
long auto_commit;
|
42
|
+
long c_bin_mode;
|
43
|
+
long c_case_mode;
|
44
|
+
long c_cursor_type;
|
45
|
+
int handle_active;
|
46
|
+
int transaction_active;
|
47
|
+
SQLSMALLINT error_recno_tracker;
|
48
|
+
SQLSMALLINT errormsg_recno_tracker;
|
49
|
+
int flag_pconnect; /* Indicates that this connection is persistent */
|
50
|
+
|
51
|
+
int errorType; /*Indicates Whether the error logged in ruby_error_msg is a statement error or connection error*/
|
52
|
+
|
53
|
+
SQLPOINTER ruby_error_msg;
|
54
|
+
SQLPOINTER ruby_error_state;
|
55
|
+
SQLSMALLINT ruby_error_msg_len;
|
56
|
+
|
57
|
+
} conn_handle;
|
58
|
+
|
59
|
+
typedef union {
|
60
|
+
SQLINTEGER i_val;
|
61
|
+
SQLDOUBLE d_val;
|
62
|
+
SQLFLOAT f_val;
|
63
|
+
SQLSMALLINT s_val;
|
64
|
+
SQLPOINTER str_val;
|
65
|
+
} ibm_db_row_data_type;
|
66
|
+
|
67
|
+
typedef struct {
|
68
|
+
SQLINTEGER out_length;
|
69
|
+
ibm_db_row_data_type data;
|
70
|
+
} ibm_db_row_type;
|
71
|
+
|
72
|
+
typedef struct _ibm_db_result_set_info_struct {
|
73
|
+
#ifdef UNICODE_SUPPORT_VERSION
|
74
|
+
SQLWCHAR *name;
|
75
|
+
long name_length;
|
76
|
+
#else
|
77
|
+
SQLCHAR *name;
|
78
|
+
#endif
|
79
|
+
SQLSMALLINT type;
|
80
|
+
SQLUINTEGER size;
|
81
|
+
SQLSMALLINT scale;
|
82
|
+
SQLSMALLINT nullable;
|
83
|
+
SQLINTEGER lob_loc;
|
84
|
+
SQLINTEGER loc_ind;
|
85
|
+
SQLSMALLINT loc_type;
|
86
|
+
} ibm_db_result_set_info;
|
87
|
+
|
88
|
+
typedef struct _row_hash_struct {
|
89
|
+
VALUE hash;
|
90
|
+
} row_hash_struct;
|
91
|
+
|
92
|
+
typedef struct _stmt_handle_struct {
|
93
|
+
SQLHANDLE hdbc;
|
94
|
+
SQLHANDLE hstmt;
|
95
|
+
long s_bin_mode;
|
96
|
+
long cursor_type;
|
97
|
+
long s_case_mode;
|
98
|
+
SQLSMALLINT error_recno_tracker;
|
99
|
+
SQLSMALLINT errormsg_recno_tracker;
|
100
|
+
|
101
|
+
/* Parameter Caching variables */
|
102
|
+
param_node *head_cache_list;
|
103
|
+
param_node *current_node;
|
104
|
+
|
105
|
+
int num_params; /* Number of Params */
|
106
|
+
int file_param; /* if option passed in is FILE_PARAM */
|
107
|
+
int num_columns;
|
108
|
+
int is_executing;
|
109
|
+
int is_freed; /* Indicates if the SQLFreeHandle is been called on the handle or not.*/
|
110
|
+
|
111
|
+
ibm_db_result_set_info *column_info;
|
112
|
+
ibm_db_row_type *row_data;
|
113
|
+
|
114
|
+
SQLPOINTER ruby_stmt_err_msg;
|
115
|
+
SQLPOINTER ruby_stmt_err_state;
|
116
|
+
SQLSMALLINT ruby_stmt_err_msg_len;
|
117
|
+
} stmt_handle;
|
118
|
+
|
119
|
+
/*
|
120
|
+
Structure holding the data to be passed to SQLConnect or SQLDriverConnect CLI call
|
121
|
+
*/
|
122
|
+
typedef struct _ibm_db_connect_args_struct {
|
123
|
+
#ifdef UNICODE_SUPPORT_VERSION
|
124
|
+
SQLWCHAR *database;
|
125
|
+
SQLWCHAR *uid;
|
126
|
+
SQLWCHAR *password;
|
127
|
+
#else
|
128
|
+
SQLCHAR *database;
|
129
|
+
SQLCHAR *uid;
|
130
|
+
SQLCHAR *password;
|
131
|
+
#endif
|
132
|
+
SQLSMALLINT database_len;
|
133
|
+
SQLSMALLINT uid_len;
|
134
|
+
SQLSMALLINT password_len;
|
135
|
+
int ctlg_conn; /*Indicates if the connection is a cataloged connection or not*/
|
136
|
+
SQLHANDLE *hdbc;
|
137
|
+
} connect_args;
|
138
|
+
|
139
|
+
/*
|
140
|
+
Structure holding the necessary info to be passed to SQLEndTran CLI call
|
141
|
+
*/
|
142
|
+
typedef struct _ibm_db_end_tran_args_struct {
|
143
|
+
SQLHANDLE *hdbc;
|
144
|
+
SQLSMALLINT handleType;
|
145
|
+
SQLSMALLINT completionType;
|
146
|
+
} end_tran_args;
|
147
|
+
|
148
|
+
/*
|
149
|
+
Structure holding the necessary info to be passed to SQLDescribeparam CLI call
|
150
|
+
*/
|
151
|
+
typedef struct _ibm_db_describeparam_args_struct {
|
152
|
+
stmt_handle *stmt_res;
|
153
|
+
SQLUSMALLINT param_no;
|
154
|
+
SQLSMALLINT sql_data_type;
|
155
|
+
SQLUINTEGER sql_precision;
|
156
|
+
SQLSMALLINT sql_scale;
|
157
|
+
SQLSMALLINT sql_nullable;
|
158
|
+
} describeparam_args;
|
159
|
+
|
160
|
+
/*
|
161
|
+
Structure holding the necessary info to be passed to SQLDescribeCol CLI call
|
162
|
+
*/
|
163
|
+
typedef struct _ibm_db_describecol_args_struct {
|
164
|
+
stmt_handle *stmt_res;
|
165
|
+
SQLUSMALLINT col_no;
|
166
|
+
SQLSMALLINT name_length;
|
167
|
+
SQLSMALLINT buff_length;
|
168
|
+
} describecol_args;
|
169
|
+
/*
|
170
|
+
Structure holding the necessary info to be passed to CLI calls like SQLColumns
|
171
|
+
SQLForeignKeys etc. The same structure is used to get the SP parameters, with table_name as proc_name
|
172
|
+
*/
|
173
|
+
typedef struct _ibm_db_metadata_args_struct {
|
174
|
+
stmt_handle *stmt_res;
|
175
|
+
#ifdef UNICODE_SUPPORT_VERSION
|
176
|
+
SQLWCHAR *qualifier;
|
177
|
+
SQLWCHAR *owner;
|
178
|
+
SQLWCHAR *table_name;
|
179
|
+
SQLWCHAR *proc_name; /*Used for call SQLProcedureColumns*/
|
180
|
+
SQLWCHAR *column_name;
|
181
|
+
SQLWCHAR *table_type;
|
182
|
+
#else
|
183
|
+
SQLCHAR *qualifier;
|
184
|
+
SQLCHAR *owner;
|
185
|
+
SQLCHAR *table_name;
|
186
|
+
SQLCHAR *proc_name; /*Used for call SQLProcedureColumns*/
|
187
|
+
SQLCHAR *column_name;
|
188
|
+
SQLCHAR *table_type;
|
189
|
+
#endif
|
190
|
+
SQLSMALLINT qualifier_len;
|
191
|
+
SQLSMALLINT owner_len;
|
192
|
+
SQLSMALLINT table_name_len;
|
193
|
+
SQLSMALLINT proc_name_len; /*Used for call SQLProcedureColumns*/
|
194
|
+
SQLSMALLINT column_name_len;
|
195
|
+
SQLSMALLINT table_type_len;
|
196
|
+
int scope; /*Used in SQLSpecialColumns To determine the scope of the unique row identifier*/
|
197
|
+
int unique; /*Used in SQLStatistics to determine if only unique indexes are to be fetched or all*/
|
198
|
+
|
199
|
+
} metadata_args;
|
200
|
+
|
201
|
+
/*
|
202
|
+
Structure holding the necessary info to be passed to SQLPrepare and SQLExecDirect CLI call
|
203
|
+
*/
|
204
|
+
typedef struct _ibm_db_exec_direct_args_struct {
|
205
|
+
stmt_handle *stmt_res;
|
206
|
+
#ifdef UNICODE_SUPPORT_VERSION
|
207
|
+
SQLWCHAR *stmt_string;
|
208
|
+
#else
|
209
|
+
SQLCHAR *stmt_string;
|
210
|
+
#endif
|
211
|
+
long stmt_string_len;
|
212
|
+
} exec_cum_prepare_args;
|
213
|
+
|
214
|
+
/*
|
215
|
+
Structure holding the necessary info to be passed to SQLParamData and SQLPutData CLI call
|
216
|
+
*/
|
217
|
+
typedef struct _ibm_db_param_and_put_data_struct {
|
218
|
+
stmt_handle *stmt_res;
|
219
|
+
SQLPOINTER valuePtr;
|
220
|
+
} param_cum_put_data_args;
|
221
|
+
|
222
|
+
/*
|
223
|
+
Structure holding the necessary info to be passed to SQLNextResult CLI call
|
224
|
+
*/
|
225
|
+
typedef struct _ibm_db_next_result_args_struct {
|
226
|
+
SQLHSTMT *new_hstmt;
|
227
|
+
stmt_handle *stmt_res;
|
228
|
+
|
229
|
+
} next_result_args;
|
230
|
+
|
231
|
+
/*
|
232
|
+
Structure holding the necessary info to be passed to calls SQLNumResultCols/SQLNumParams
|
233
|
+
*/
|
234
|
+
typedef struct _ibm_db_row_col_count_struct {
|
235
|
+
stmt_handle *stmt_res;
|
236
|
+
SQLSMALLINT count;
|
237
|
+
} row_col_count_args;
|
238
|
+
|
239
|
+
/*
|
240
|
+
Structure holding the necessary info to be passed to call SQLRowcount
|
241
|
+
*/
|
242
|
+
typedef struct _ibm_db_row_count_struct {
|
243
|
+
stmt_handle *stmt_res;
|
244
|
+
SQLINTEGER count;
|
245
|
+
} sql_row_count_args;
|
246
|
+
|
247
|
+
/*
|
248
|
+
Structure holding the necessary info to be passed to call SQLColAttributes
|
249
|
+
*/
|
250
|
+
typedef struct _ibm_db_col_attr_struct {
|
251
|
+
stmt_handle *stmt_res;
|
252
|
+
SQLSMALLINT col_num;
|
253
|
+
SQLSMALLINT FieldIdentifier;
|
254
|
+
SQLINTEGER num_attr;
|
255
|
+
} col_attr_args;
|
256
|
+
|
257
|
+
/*
|
258
|
+
Structure holding the necessary info to be passed to call SQLBindCol
|
259
|
+
*/
|
260
|
+
typedef struct _ibm_db_bind_col_struct {
|
261
|
+
stmt_handle *stmt_res;
|
262
|
+
SQLUSMALLINT col_num;
|
263
|
+
SQLSMALLINT TargetType;
|
264
|
+
SQLPOINTER TargetValuePtr;
|
265
|
+
SQLLEN buff_length;
|
266
|
+
SQLLEN *out_length;
|
267
|
+
} bind_col_args;
|
268
|
+
|
269
|
+
/*
|
270
|
+
Structure holding the necessary info to be passed to call SQLGetData
|
271
|
+
*/
|
272
|
+
typedef struct _ibm_db_get_data_args_struct {
|
273
|
+
stmt_handle *stmt_res;
|
274
|
+
SQLSMALLINT col_num;
|
275
|
+
SQLSMALLINT targetType;
|
276
|
+
SQLPOINTER buff;
|
277
|
+
SQLLEN buff_length;
|
278
|
+
SQLLEN *out_length;
|
279
|
+
} get_data_args;
|
280
|
+
|
281
|
+
/*
|
282
|
+
Structure holding the necessary info to be passed to call SQLGetLength
|
283
|
+
*/
|
284
|
+
typedef struct _ibm_db_get_data_length_struct {
|
285
|
+
SQLHSTMT *new_hstmt;
|
286
|
+
SQLSMALLINT col_num;
|
287
|
+
stmt_handle *stmt_res;
|
288
|
+
SQLINTEGER *sLength;
|
289
|
+
|
290
|
+
} get_length_args;
|
291
|
+
|
292
|
+
/*
|
293
|
+
Structure holding the necessary info to be passed to call SQLGetSubString
|
294
|
+
*/
|
295
|
+
typedef struct _ibm_db_get_data_subString_struct {
|
296
|
+
SQLHSTMT *new_hstmt;
|
297
|
+
SQLSMALLINT col_num;
|
298
|
+
stmt_handle *stmt_res;
|
299
|
+
SQLUINTEGER forLength;
|
300
|
+
SQLSMALLINT targetCType;
|
301
|
+
SQLPOINTER buffer;
|
302
|
+
SQLLEN buff_length;
|
303
|
+
SQLINTEGER *out_length;
|
304
|
+
|
305
|
+
} get_subString_args;
|
306
|
+
|
307
|
+
/*
|
308
|
+
Structure holding the necessary info to be passed to call SQLFetchScroll and SQLFetch
|
309
|
+
*/
|
310
|
+
typedef struct _ibm_db_fetch_data_struct {
|
311
|
+
stmt_handle *stmt_res;
|
312
|
+
SQLSMALLINT fetchOrientation;
|
313
|
+
SQLLEN fetchOffset;
|
314
|
+
} fetch_data_args;
|
315
|
+
|
316
|
+
/*
|
317
|
+
Structure holding the necessary info to be passed to calls SQLSetStmtAttr/SQLSetConnectAttr/SQLEnvAttr
|
318
|
+
*/
|
319
|
+
typedef struct _ibm_db_set_handle_attr_struct {
|
320
|
+
SQLHANDLE *handle;
|
321
|
+
SQLINTEGER attribute;
|
322
|
+
SQLPOINTER valuePtr;
|
323
|
+
SQLINTEGER strLength;
|
324
|
+
|
325
|
+
} set_handle_attr_args;
|
326
|
+
|
327
|
+
/*
|
328
|
+
Structure holding the necessary info to be passed to call SQLGetStmtAttr and SQLGetConnectAttr
|
329
|
+
*/
|
330
|
+
typedef struct _ibm_db_get_handle_attr_struct {
|
331
|
+
SQLHANDLE *handle;
|
332
|
+
SQLINTEGER attribute;
|
333
|
+
SQLPOINTER valuePtr;
|
334
|
+
SQLINTEGER buff_length;
|
335
|
+
SQLINTEGER *out_length;
|
336
|
+
} get_handle_attr_args;
|
337
|
+
|
338
|
+
/*
|
339
|
+
Structure holding the necessary info to be passed to call SQLBindParameter
|
340
|
+
*/
|
341
|
+
typedef struct _ibm_db_bind_parameter_struct {
|
342
|
+
stmt_handle *stmt_res;
|
343
|
+
SQLSMALLINT param_num;
|
344
|
+
SQLSMALLINT IOType;
|
345
|
+
SQLSMALLINT valueType;
|
346
|
+
SQLSMALLINT paramType;
|
347
|
+
SQLULEN colSize;
|
348
|
+
SQLSMALLINT decimalDigits;
|
349
|
+
SQLPOINTER paramValPtr;
|
350
|
+
SQLLEN buff_length;
|
351
|
+
SQLLEN *out_length;
|
352
|
+
} bind_parameter_args;
|
353
|
+
|
354
|
+
/*
|
355
|
+
Structure holding the necessary info to be passed to call SQLGetInfo
|
356
|
+
*/
|
357
|
+
typedef struct _ibm_db_get_info_struct {
|
358
|
+
conn_handle *conn_res;
|
359
|
+
SQLUSMALLINT infoType;
|
360
|
+
SQLPOINTER infoValue;
|
361
|
+
SQLSMALLINT buff_length;
|
362
|
+
SQLSMALLINT *out_length;
|
363
|
+
} get_info_args;
|
364
|
+
|
365
|
+
/*
|
366
|
+
Structure holding the necessary info to be passed to call SQLGetDiagRec
|
367
|
+
*/
|
368
|
+
typedef struct _ibm_db_get_diagRec_struct {
|
369
|
+
SQLSMALLINT hType;
|
370
|
+
SQLHANDLE handle;
|
371
|
+
SQLSMALLINT recNum;
|
372
|
+
SQLPOINTER SQLState;
|
373
|
+
SQLPOINTER msgText;
|
374
|
+
SQLINTEGER *NativeErrorPtr;
|
375
|
+
SQLSMALLINT buff_length;
|
376
|
+
SQLSMALLINT *text_length_ptr;
|
377
|
+
} get_diagRec_args;
|
378
|
+
|
379
|
+
/*
|
380
|
+
Structure holding the necessary info to be passed to call SQLFreestmt
|
381
|
+
*/
|
382
|
+
typedef struct _ibm_db_free_stmt_struct {
|
383
|
+
stmt_handle *stmt_res;
|
384
|
+
SQLUSMALLINT option;
|
385
|
+
} free_stmt_args;
|
386
|
+
|
387
|
+
int _ruby_ibm_db_SQLConnect_helper(connect_args *data);
|
388
|
+
int _ruby_ibm_db_SQLDisconnect_helper(SQLHANDLE *hdbc);
|
389
|
+
void _ruby_ibm_db_Connection_level_UBF(void *data);
|
390
|
+
int _ruby_ibm_db_SQLEndTran(end_tran_args *endtran_args);
|
391
|
+
int _ruby_ibm_db_SQLDescribeParam_helper(describeparam_args *data);
|
392
|
+
int _ruby_ibm_db_SQLDescribeCol_helper(describecol_args *data);
|
393
|
+
int _ruby_ibm_db_SQLBindCol_helper(bind_col_args *data);
|
394
|
+
int _ruby_ibm_db_SQLColumnPrivileges_helper(metadata_args *data);
|
395
|
+
int _ruby_ibm_db_SQLColumns_helper(metadata_args *data);
|
396
|
+
int _ruby_ibm_db_SQLPrimaryKeys_helper(metadata_args *data);
|
397
|
+
int _ruby_ibm_db_SQLForeignKeys_helper(metadata_args *data);
|
398
|
+
int _ruby_ibm_db_SQLProcedureColumns_helper(metadata_args *data);
|
399
|
+
int _ruby_ibm_db_SQLProcedures_helper(metadata_args *data);
|
400
|
+
int _ruby_ibm_db_SQLSpecialColumns_helper(metadata_args *data);
|
401
|
+
int _ruby_ibm_db_SQLStatistics_helper(metadata_args *data);
|
402
|
+
int _ruby_ibm_db_SQLTablePrivileges_helper(metadata_args *data);
|
403
|
+
int _ruby_ibm_db_SQLTables_helper(metadata_args *data);
|
404
|
+
int _ruby_ibm_db_SQLExecDirect_helper(exec_cum_prepare_args *data);
|
405
|
+
int _ruby_ibm_db_SQLPrepare_helper(exec_cum_prepare_args *data);
|
406
|
+
int _ruby_ibm_db_SQLFreeStmt_helper(free_stmt_args *data);
|
407
|
+
int _ruby_ibm_db_SQLExecute_helper(stmt_handle *stmt_res);
|
408
|
+
int _ruby_ibm_db_SQLParamData_helper(param_cum_put_data_args *data);
|
409
|
+
int _ruby_ibm_db_SQLColAttributes_helper(col_attr_args *data);
|
410
|
+
int _ruby_ibm_db_SQLPutData_helper(param_cum_put_data_args *data);
|
411
|
+
int _ruby_ibm_db_SQLGetData_helper(get_data_args *data);
|
412
|
+
int _ruby_ibm_db_SQLGetLength_helper(get_length_args *data);
|
413
|
+
int _ruby_ibm_db_SQLGetSubString_helper(get_subString_args *data);
|
414
|
+
int _ruby_ibm_db_SQLNextResult_helper(next_result_args *data);
|
415
|
+
int _ruby_ibm_db_SQLFetchScroll_helper(fetch_data_args *data);
|
416
|
+
int _ruby_ibm_db_SQLFetch_helper(fetch_data_args *data);
|
417
|
+
int _ruby_ibm_db_SQLNumResultCols_helper(row_col_count_args *data);
|
418
|
+
int _ruby_ibm_db_SQLNumParams_helper(row_col_count_args *data);
|
419
|
+
int _ruby_ibm_db_SQLRowCount_helper(sql_row_count_args *data);
|
420
|
+
int _ruby_ibm_db_SQLGetInfo_helper(get_info_args *data);
|
421
|
+
int _ruby_ibm_db_SQLGetDiagRec_helper(get_diagRec_args *data);
|
422
|
+
int _ruby_ibm_db_SQLSetStmtAttr_helper(set_handle_attr_args *data);
|
423
|
+
int _ruby_ibm_db_SQLSetConnectAttr_helper(set_handle_attr_args *data);
|
424
|
+
int _ruby_ibm_db_SQLSetEnvAttr_helper(set_handle_attr_args *data);
|
425
|
+
int _ruby_ibm_db_SQLGetStmtAttr_helper(get_handle_attr_args *data);
|
426
|
+
int _ruby_ibm_db_SQLGetConnectAttr_helper(get_handle_attr_args *data);
|
427
|
+
int _ruby_ibm_db_SQLBindFileToParam_helper(stmt_handle *stmt_res, param_node *curr);
|
428
|
+
int _ruby_ibm_db_SQLBindParameter_helper(bind_parameter_args *data);
|
429
|
+
void _ruby_ibm_db_Statement_level_UBF(stmt_handle *stmt_res);
|
430
|
+
|
431
|
+
#endif /* RUBY_IBM_DB_CLI_H */
|
data/init.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# +----------------------------------------------------------------------+
|
2
|
+
# | Licensed Materials - Property of IBM |
|
3
|
+
# | |
|
4
|
+
# | (C) Copyright IBM Corporation 2006, 2007. |
|
5
|
+
# +----------------------------------------------------------------------+
|
6
|
+
|
7
|
+
require 'pathname'
|
8
|
+
|
9
|
+
begin
|
10
|
+
puts ".. Attempt to load IBM_DB Ruby driver for IBM Data Servers for this platform: #{RUBY_PLATFORM}"
|
11
|
+
unless defined? IBM_DB
|
12
|
+
# find IBM_DB driver path relative init.rb
|
13
|
+
drv_path = Pathname.new(File.dirname(__FILE__)) + 'lib'
|
14
|
+
drv_path += (RUBY_PLATFORM =~ /mswin32/) ? 'mswin32' : 'linux32'
|
15
|
+
puts ".. Locate IBM_DB Ruby driver path: #{drv_path}"
|
16
|
+
drv_lib = drv_path + 'ibm_db.so'
|
17
|
+
require "#{drv_lib.to_s}"
|
18
|
+
puts ".. Successfuly loaded IBM_DB Ruby driver: #{drv_lib}"
|
19
|
+
end
|
20
|
+
rescue
|
21
|
+
raise LoadError, "Failed to load IBM_DB Driver !?"
|
22
|
+
end
|
23
|
+
|
24
|
+
# Include IBM_DB in the list of supported adapters
|
25
|
+
RAILS_CONNECTION_ADAPTERS << 'ibm_db'
|
26
|
+
# load IBM_DB Adapter provided by the plugin
|
27
|
+
require 'active_record/connection_adapters/ibm_db_adapter'
|
28
|
+
|
29
|
+
# Override the frameworks initialization to re-enable ActiveRecord after being
|
30
|
+
# disabled during plugin install (i.e. config.frameworks -= [ :active_record ])
|
31
|
+
[:load_environment,\
|
32
|
+
:initialize_database,\
|
33
|
+
:initialize_logger,\
|
34
|
+
:initialize_framework_logging,\
|
35
|
+
:initialize_framework_settings,\
|
36
|
+
:initialize_framework_views,\
|
37
|
+
:initialize_dependency_mechanism,\
|
38
|
+
:load_environment ].each do |routine|
|
39
|
+
Rails::Initializer.run(routine) do |config|
|
40
|
+
config.frameworks = [:active_record]
|
41
|
+
end
|
42
|
+
end
|