ibm_db 2.5.26-x86-mingw32 → 2.5.27-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +5 -1
- data/README +1 -1
- data/ext/ibm_db.c +437 -351
- data/ext/ruby_ibm_db.h +241 -240
- data/ext/ruby_ibm_db_cli.c +32 -26
- data/ext/ruby_ibm_db_cli.h +15 -4
- data/lib/active_record/connection_adapters/ibm_db_adapter.rb +1 -0
- data/lib/mswin32/ibm_db.rb +2 -2
- data/lib/mswin32/rb22x/i386/ibm_db.so +0 -0
- metadata +2 -2
data/ext/ruby_ibm_db.h
CHANGED
@@ -1,240 +1,241 @@
|
|
1
|
-
/*
|
2
|
-
+----------------------------------------------------------------------+
|
3
|
-
| Licensed Materials - Property of IBM |
|
4
|
-
| |
|
5
|
-
| (C) Copyright IBM Corporation 2006
|
6
|
-
+----------------------------------------------------------------------+
|
7
|
-
| Authors: Sushant Koduru, Lynh Nguyen, Kanchana Padmanabhan, |
|
8
|
-
| Dan Scott, Helmut Tessarek, Kellen Bombardier, Sam Ruby |
|
9
|
-
| Ambrish Bhargava, Tarun Pasrija, Praveen Devarao
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
#
|
15
|
-
|
16
|
-
|
17
|
-
#include <
|
18
|
-
#include <
|
19
|
-
#include <
|
20
|
-
|
21
|
-
|
22
|
-
#
|
23
|
-
#
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
#
|
28
|
-
#
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
#
|
33
|
-
#define
|
34
|
-
#define
|
35
|
-
#
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
*
|
40
|
-
*
|
41
|
-
|
42
|
-
#
|
43
|
-
#define
|
44
|
-
#define
|
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
|
-
#define
|
77
|
-
|
78
|
-
|
79
|
-
#define
|
80
|
-
|
81
|
-
|
82
|
-
#define
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
#define
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
#define
|
94
|
-
#define
|
95
|
-
#define
|
96
|
-
|
97
|
-
|
98
|
-
#
|
99
|
-
#define
|
100
|
-
#define
|
101
|
-
#define
|
102
|
-
#
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
#define
|
107
|
-
#define
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
#define
|
112
|
-
#define
|
113
|
-
#define
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
#define
|
118
|
-
#define
|
119
|
-
#define
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
*
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
VALUE
|
139
|
-
VALUE
|
140
|
-
VALUE
|
141
|
-
VALUE
|
142
|
-
VALUE
|
143
|
-
VALUE
|
144
|
-
VALUE
|
145
|
-
VALUE
|
146
|
-
VALUE
|
147
|
-
VALUE
|
148
|
-
VALUE
|
149
|
-
VALUE
|
150
|
-
VALUE
|
151
|
-
VALUE
|
152
|
-
VALUE
|
153
|
-
VALUE
|
154
|
-
VALUE
|
155
|
-
VALUE
|
156
|
-
VALUE
|
157
|
-
VALUE
|
158
|
-
VALUE
|
159
|
-
VALUE
|
160
|
-
VALUE
|
161
|
-
VALUE
|
162
|
-
VALUE
|
163
|
-
VALUE
|
164
|
-
VALUE
|
165
|
-
VALUE
|
166
|
-
VALUE
|
167
|
-
VALUE
|
168
|
-
VALUE
|
169
|
-
VALUE
|
170
|
-
VALUE
|
171
|
-
VALUE
|
172
|
-
VALUE
|
173
|
-
VALUE
|
174
|
-
VALUE
|
175
|
-
VALUE
|
176
|
-
VALUE
|
177
|
-
VALUE
|
178
|
-
VALUE
|
179
|
-
VALUE
|
180
|
-
VALUE
|
181
|
-
VALUE
|
182
|
-
VALUE
|
183
|
-
VALUE
|
184
|
-
VALUE
|
185
|
-
VALUE
|
186
|
-
VALUE
|
187
|
-
VALUE
|
188
|
-
VALUE
|
189
|
-
VALUE
|
190
|
-
VALUE
|
191
|
-
VALUE
|
192
|
-
VALUE
|
193
|
-
VALUE
|
194
|
-
VALUE
|
195
|
-
VALUE
|
196
|
-
VALUE
|
197
|
-
VALUE
|
198
|
-
VALUE
|
199
|
-
VALUE
|
200
|
-
VALUE
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
SQLWCHAR
|
211
|
-
SQLWCHAR
|
212
|
-
SQLWCHAR
|
213
|
-
|
214
|
-
|
215
|
-
char
|
216
|
-
char
|
217
|
-
char
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
*
|
237
|
-
*
|
238
|
-
*
|
239
|
-
*
|
240
|
-
|
1
|
+
/*
|
2
|
+
+----------------------------------------------------------------------+
|
3
|
+
| Licensed Materials - Property of IBM |
|
4
|
+
| |
|
5
|
+
| (C) Copyright IBM Corporation 2006 - 2015 |
|
6
|
+
+----------------------------------------------------------------------+
|
7
|
+
| Authors: Sushant Koduru, Lynh Nguyen, Kanchana Padmanabhan, |
|
8
|
+
| Dan Scott, Helmut Tessarek, Kellen Bombardier, Sam Ruby |
|
9
|
+
| Ambrish Bhargava, Tarun Pasrija, Praveen Devarao, |
|
10
|
+
| Arvind Gupta |
|
11
|
+
+----------------------------------------------------------------------+
|
12
|
+
*/
|
13
|
+
|
14
|
+
#ifndef RUBY_IBM_DB_H
|
15
|
+
#define RUBY_IBM_DB_H
|
16
|
+
|
17
|
+
#include <stdio.h>
|
18
|
+
#include <string.h>
|
19
|
+
#include <stdlib.h>
|
20
|
+
#include <sqlcli1.h>
|
21
|
+
|
22
|
+
#ifndef SQL_XML
|
23
|
+
#define SQL_XML -370
|
24
|
+
#endif
|
25
|
+
|
26
|
+
/* Needed for Backward compatibility */
|
27
|
+
#ifndef SQL_DECFLOAT
|
28
|
+
#define SQL_DECFLOAT -360
|
29
|
+
#endif
|
30
|
+
|
31
|
+
/* needed for backward compatibility (SQL_ATTR_ROWCOUNT_PREFETCH not defined prior to DB2 9.5.0.3) */
|
32
|
+
#ifndef SQL_ATTR_ROWCOUNT_PREFETCH
|
33
|
+
#define SQL_ATTR_ROWCOUNT_PREFETCH 2592
|
34
|
+
#define SQL_ROWCOUNT_PREFETCH_OFF 0
|
35
|
+
#define SQL_ROWCOUNT_PREFETCH_ON 1
|
36
|
+
#endif
|
37
|
+
|
38
|
+
/* SQL_ATTR_USE_TRUSTED_CONTEXT,
|
39
|
+
* SQL_ATTR_TRUSTED_CONTEXT_USERID and
|
40
|
+
* SQL_ATTR_TRUSTED_CONTEXT_PASSWORD
|
41
|
+
* not defined prior to DB2 v9 */
|
42
|
+
#ifndef SQL_ATTR_USE_TRUSTED_CONTEXT
|
43
|
+
#define SQL_ATTR_USE_TRUSTED_CONTEXT 2561
|
44
|
+
#define SQL_ATTR_TRUSTED_CONTEXT_USERID 2562
|
45
|
+
#define SQL_ATTR_TRUSTED_CONTEXT_PASSWORD 2563
|
46
|
+
#endif
|
47
|
+
|
48
|
+
#ifndef SQL_ATTR_REPLACE_QUOTED_LITERALS
|
49
|
+
#define SQL_ATTR_REPLACE_QUOTED_LITERALS 2586
|
50
|
+
#endif
|
51
|
+
|
52
|
+
/* CLI v9.1 FP3 and below has a SQL_ATTR_REPLACE_QUOTED_LITERALS value of 116
|
53
|
+
* We need to support both the new and old values for compatibility with older
|
54
|
+
* versions of CLI. CLI v9.1 FP4 and beyond changed this value to 2586
|
55
|
+
*/
|
56
|
+
#define SQL_ATTR_REPLACE_QUOTED_LITERALS_OLDVALUE 116
|
57
|
+
|
58
|
+
/* If using a DB2 CLI version which doesn't support this functionality, explicitly
|
59
|
+
* define this. We will rely on DB2 CLI to throw an error when SQLGetStmtAttr is
|
60
|
+
* called.
|
61
|
+
*/
|
62
|
+
#ifndef SQL_ATTR_GET_GENERATED_VALUE
|
63
|
+
#define SQL_ATTR_GET_GENERATED_VALUE 2578
|
64
|
+
#endif
|
65
|
+
|
66
|
+
#ifdef _WIN32
|
67
|
+
#define RUBY_IBM_DB_API __declspec(dllexport)
|
68
|
+
#else
|
69
|
+
#define RUBY_IBM_DB_API
|
70
|
+
#endif
|
71
|
+
|
72
|
+
/* strlen(" SQLCODE=") added in */
|
73
|
+
#define DB2_MAX_ERR_MSG_LEN (SQL_MAX_MESSAGE_LENGTH + SQL_SQLSTATE_SIZE + 10)
|
74
|
+
|
75
|
+
/*Used to find the type of resource and the error type required*/
|
76
|
+
#define DB_ERRMSG 1
|
77
|
+
#define DB_ERR_STATE 2
|
78
|
+
|
79
|
+
#define DB_CONN 1
|
80
|
+
#define DB_STMT 2
|
81
|
+
|
82
|
+
#define CONN_ERROR 1
|
83
|
+
#define STMT_ERROR 2
|
84
|
+
|
85
|
+
/*Used to decide if LITERAL REPLACEMENT should be turned on or not*/
|
86
|
+
#define SET_QUOTED_LITERAL_REPLACEMENT_ON 1
|
87
|
+
#define SET_QUOTED_LITERAL_REPLACEMENT_OFF 0
|
88
|
+
|
89
|
+
/* DB2 instance environment variable */
|
90
|
+
#define DB2_VAR_INSTANCE "DB2INSTANCE="
|
91
|
+
|
92
|
+
/******** Makes code compatible with the options used by the user */
|
93
|
+
#define BINARY 1
|
94
|
+
#define CONVERT 2
|
95
|
+
#define PASSTHRU 3
|
96
|
+
#define PARAM_FILE 11
|
97
|
+
|
98
|
+
#ifdef PASE
|
99
|
+
#define SQL_IS_INTEGER 0
|
100
|
+
#define SQL_BEST_ROWID 0
|
101
|
+
#define SQLLEN long
|
102
|
+
#define SQLFLOAT double
|
103
|
+
#endif
|
104
|
+
|
105
|
+
/*fetch*/
|
106
|
+
#define FETCH_INDEX 0x01
|
107
|
+
#define FETCH_ASSOC 0x02
|
108
|
+
#define FETCH_BOTH 0x03
|
109
|
+
|
110
|
+
/* Change column case */
|
111
|
+
#define ATTR_CASE 3271982
|
112
|
+
#define CASE_NATURAL 0
|
113
|
+
#define CASE_LOWER 1
|
114
|
+
#define CASE_UPPER 2
|
115
|
+
|
116
|
+
/* maximum sizes */
|
117
|
+
#define USERID_LEN 16
|
118
|
+
#define ACCTSTR_LEN 200
|
119
|
+
#define APPLNAME_LEN 32
|
120
|
+
#define WRKSTNNAME_LEN 18
|
121
|
+
|
122
|
+
/*
|
123
|
+
* Enum for Decfloat Rounding Modes
|
124
|
+
* */
|
125
|
+
enum
|
126
|
+
{
|
127
|
+
ROUND_HALF_EVEN = 0,
|
128
|
+
ROUND_HALF_UP,
|
129
|
+
ROUND_DOWN,
|
130
|
+
ROUND_CEILING,
|
131
|
+
ROUND_FLOOR
|
132
|
+
}ROUNDING_MODE;
|
133
|
+
|
134
|
+
void Init_ibm_db();
|
135
|
+
|
136
|
+
/* Function Declarations */
|
137
|
+
|
138
|
+
VALUE ibm_db_connect(int argc, VALUE *argv, VALUE self);
|
139
|
+
VALUE ibm_db_createDB(int argc, VALUE *argv, VALUE self);
|
140
|
+
VALUE ibm_db_dropDB(int argc, VALUE *argv, VALUE self);
|
141
|
+
VALUE ibm_db_createDBNX(int argc, VALUE *argv, VALUE self);
|
142
|
+
VALUE ibm_db_commit(int argc, VALUE *argv, VALUE self);
|
143
|
+
VALUE ibm_db_pconnect(int argc, VALUE *argv, VALUE self);
|
144
|
+
VALUE ibm_db_autocommit(int argc, VALUE *argv, VALUE self);
|
145
|
+
VALUE ibm_db_bind_param(int argc, VALUE *argv, VALUE self);
|
146
|
+
VALUE ibm_db_close(int argc, VALUE *argv, VALUE self);
|
147
|
+
VALUE ibm_db_columnprivileges(int argc, VALUE *argv, VALUE self);
|
148
|
+
VALUE ibm_db_column_privileges(int argc, VALUE *argv, VALUE self);
|
149
|
+
VALUE ibm_db_columns(int argc, VALUE *argv, VALUE self);
|
150
|
+
VALUE ibm_db_foreignkeys(int argc, VALUE *argv, VALUE self);
|
151
|
+
VALUE ibm_db_foreign_keys(int argc, VALUE *argv, VALUE self);
|
152
|
+
VALUE ibm_db_primarykeys(int argc, VALUE *argv, VALUE self);
|
153
|
+
VALUE ibm_db_primary_keys(int argc, VALUE *argv, VALUE self);
|
154
|
+
VALUE ibm_db_procedure_columns(int argc, VALUE *argv, VALUE self);
|
155
|
+
VALUE ibm_db_procedures(int argc, VALUE *argv, VALUE self);
|
156
|
+
VALUE ibm_db_specialcolumns(int argc, VALUE *argv, VALUE self);
|
157
|
+
VALUE ibm_db_special_columns(int argc, VALUE *argv, VALUE self);
|
158
|
+
VALUE ibm_db_statistics(int argc, VALUE *argv, VALUE self);
|
159
|
+
VALUE ibm_db_tableprivileges(int argc, VALUE *argv, VALUE self);
|
160
|
+
VALUE ibm_db_table_privileges(int argc, VALUE *argv, VALUE self);
|
161
|
+
VALUE ibm_db_tables(int argc, VALUE *argv, VALUE self);
|
162
|
+
VALUE ibm_db_commit(int argc, VALUE *argv, VALUE self);
|
163
|
+
VALUE ibm_db_exec(int argc, VALUE *argv, VALUE self);
|
164
|
+
VALUE ibm_db_prepare(int argc, VALUE *argv, VALUE self);
|
165
|
+
VALUE ibm_db_execute(int argc, VALUE *argv, VALUE self);
|
166
|
+
VALUE ibm_db_conn_errormsg(int argc, VALUE *argv, VALUE self);
|
167
|
+
VALUE ibm_db_stmt_errormsg(int argc, VALUE *argv, VALUE self);
|
168
|
+
VALUE ibm_db_getErrormsg(int argc, VALUE *argv, VALUE self);
|
169
|
+
VALUE ibm_db_getErrorstate(int argc, VALUE *argv, VALUE self);
|
170
|
+
VALUE ibm_db_conn_error(int argc, VALUE *argv, VALUE self);
|
171
|
+
VALUE ibm_db_stmt_error(int argc, VALUE *argv, VALUE self);
|
172
|
+
VALUE ibm_db_next_result(int argc, VALUE *argv, VALUE self);
|
173
|
+
VALUE ibm_db_num_fields(int argc, VALUE *argv, VALUE self);
|
174
|
+
VALUE ibm_db_num_rows(int argc, VALUE *argv, VALUE self);
|
175
|
+
VALUE ibm_db_result_cols(int argc, VALUE *argv, VALUE self);
|
176
|
+
VALUE ibm_db_field_name(int argc, VALUE *argv, VALUE self);
|
177
|
+
VALUE ibm_db_field_display_size(int argc, VALUE *argv, VALUE self);
|
178
|
+
VALUE ibm_db_field_num(int argc, VALUE *argv, VALUE self);
|
179
|
+
VALUE ibm_db_field_precision(int argc, VALUE *argv, VALUE self);
|
180
|
+
VALUE ibm_db_field_scale(int argc, VALUE *argv, VALUE self);
|
181
|
+
VALUE ibm_db_field_type(int argc, VALUE *argv, VALUE self);
|
182
|
+
VALUE ibm_db_field_width(int argc, VALUE *argv, VALUE self);
|
183
|
+
VALUE ibm_db_cursor_type(int argc, VALUE *argv, VALUE self);
|
184
|
+
VALUE ibm_db_rollback(int argc, VALUE *argv, VALUE self);
|
185
|
+
VALUE ibm_db_free_stmt(int argc, VALUE *argv, VALUE self);
|
186
|
+
VALUE ibm_db_result(int argc, VALUE *argv, VALUE self);
|
187
|
+
VALUE ibm_db_fetch_row(int argc, VALUE *argv, VALUE self);
|
188
|
+
VALUE ibm_db_fetch_assoc(int argc, VALUE *argv, VALUE self);
|
189
|
+
VALUE ibm_db_fetch_array(int argc, VALUE *argv, VALUE self);
|
190
|
+
VALUE ibm_db_fetch_both(int argc, VALUE *argv, VALUE self);
|
191
|
+
VALUE ibm_db_result_all(int argc, VALUE *argv, VALUE self);
|
192
|
+
VALUE ibm_db_free_result(int argc, VALUE *argv, VALUE self);
|
193
|
+
VALUE ibm_db_set_option(int argc, VALUE *argv, VALUE self);
|
194
|
+
VALUE ibm_db_setoption(int argc, VALUE *argv, VALUE self);
|
195
|
+
VALUE ibm_db_get_option(int argc, VALUE *argv, VALUE self);
|
196
|
+
VALUE ibm_db_get_last_serial_value(int argc, VALUE *argv, VALUE self);
|
197
|
+
VALUE ibm_db_getoption(int argc, VALUE *argv, VALUE self);
|
198
|
+
VALUE ibm_db_fetch_object(int argc, VALUE *argv, VALUE self);
|
199
|
+
VALUE ibm_db_server_info(int argc, VALUE *argv, VALUE self);
|
200
|
+
VALUE ibm_db_client_info(int argc, VALUE *argv, VALUE self);
|
201
|
+
VALUE ibm_db_active(int argc, VALUE *argv, VALUE self);
|
202
|
+
|
203
|
+
/*
|
204
|
+
Declare any global variables you may need between the BEGIN
|
205
|
+
and END macros here:
|
206
|
+
*/
|
207
|
+
struct _ibm_db_globals {
|
208
|
+
int bin_mode;
|
209
|
+
#ifdef UNICODE_SUPPORT_VERSION
|
210
|
+
SQLWCHAR __ruby_conn_err_msg[DB2_MAX_ERR_MSG_LEN];
|
211
|
+
SQLWCHAR __ruby_stmt_err_msg[DB2_MAX_ERR_MSG_LEN];
|
212
|
+
SQLWCHAR __ruby_conn_err_state[SQL_SQLSTATE_SIZE + 1];
|
213
|
+
SQLWCHAR __ruby_stmt_err_state[SQL_SQLSTATE_SIZE + 1];
|
214
|
+
#else
|
215
|
+
char __ruby_conn_err_msg[DB2_MAX_ERR_MSG_LEN];
|
216
|
+
char __ruby_stmt_err_msg[DB2_MAX_ERR_MSG_LEN];
|
217
|
+
char __ruby_conn_err_state[SQL_SQLSTATE_SIZE + 1];
|
218
|
+
char __ruby_stmt_err_state[SQL_SQLSTATE_SIZE + 1];
|
219
|
+
#endif
|
220
|
+
|
221
|
+
#ifdef PASE /* i5/OS ease of use turn off commit */
|
222
|
+
long i5_allow_commit;
|
223
|
+
#endif /* PASE */
|
224
|
+
};
|
225
|
+
|
226
|
+
/*
|
227
|
+
TODO: make this threadsafe
|
228
|
+
*/
|
229
|
+
|
230
|
+
#define IBM_DB_G(v) (ibm_db_globals->v)
|
231
|
+
|
232
|
+
#endif /* RUBY_IBM_DB_H */
|
233
|
+
|
234
|
+
|
235
|
+
/*
|
236
|
+
* Local variables:
|
237
|
+
* tab-width: 4
|
238
|
+
* c-basic-offset: 4
|
239
|
+
* indent-tabs-mode: t
|
240
|
+
* End:
|
241
|
+
*/
|