ibm_db 2.0.0-mswin32 → 2.5.0-mswin32

Sign up to get free protection for your applications and to get access to all the features.
data/ext/ruby_ibm_db.h CHANGED
@@ -201,10 +201,18 @@ VALUE ibm_db_active(int argc, VALUE *argv, VALUE self);
201
201
  */
202
202
  struct _ibm_db_globals {
203
203
  int bin_mode;
204
- char __ruby_conn_err_msg[DB2_MAX_ERR_MSG_LEN];
205
- char __ruby_conn_err_state[SQL_SQLSTATE_SIZE + 1];
206
- char __ruby_stmt_err_msg[DB2_MAX_ERR_MSG_LEN];
207
- char __ruby_stmt_err_state[SQL_SQLSTATE_SIZE + 1];
204
+ #ifdef UNICODE_SUPPORT_VERSION
205
+ SQLWCHAR __ruby_conn_err_msg[DB2_MAX_ERR_MSG_LEN];
206
+ SQLWCHAR __ruby_stmt_err_msg[DB2_MAX_ERR_MSG_LEN];
207
+ SQLWCHAR __ruby_conn_err_state[SQL_SQLSTATE_SIZE + 1];
208
+ SQLWCHAR __ruby_stmt_err_state[SQL_SQLSTATE_SIZE + 1];
209
+ #else
210
+ char __ruby_conn_err_msg[DB2_MAX_ERR_MSG_LEN];
211
+ char __ruby_stmt_err_msg[DB2_MAX_ERR_MSG_LEN];
212
+ char __ruby_conn_err_state[SQL_SQLSTATE_SIZE + 1];
213
+ char __ruby_stmt_err_state[SQL_SQLSTATE_SIZE + 1];
214
+ #endif
215
+
208
216
  #ifdef PASE /* i5/OS ease of use turn off commit */
209
217
  long i5_allow_commit;
210
218
  #endif /* PASE */
@@ -29,12 +29,23 @@
29
29
  */
30
30
  int _ruby_ibm_db_SQLConnect_helper(connect_args *data) {
31
31
  if(data->ctlg_conn == 1) {
32
+ #ifndef UNICODE_SUPPORT_VERSION
32
33
  return SQLConnect( (SQLHDBC)*(data->hdbc), (SQLCHAR *)data->database,
33
34
  (SQLSMALLINT)data->database_len, (SQLCHAR *)data->uid, (SQLSMALLINT)data->uid_len,
34
35
  (SQLCHAR *)data->password, (SQLSMALLINT)data->password_len );
36
+ #else
37
+ return SQLConnectW( (SQLHDBC)*(data->hdbc), data->database,
38
+ data->database_len, data->uid, data->uid_len,
39
+ data->password, data->password_len );
40
+ #endif
35
41
  } else {
42
+ #ifndef UNICODE_SUPPORT_VERSION
36
43
  return SQLDriverConnect( (SQLHDBC) *(data->hdbc), (SQLHWND)NULL,
37
44
  (SQLCHAR*)data->database, SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT );
45
+ #else
46
+ return SQLDriverConnectW( (SQLHDBC) *(data->hdbc), (SQLHWND)NULL,
47
+ data->database, SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT );
48
+ #endif
38
49
  }
39
50
  }
40
51
 
@@ -84,10 +95,17 @@ int _ruby_ibm_db_SQLDescribeCol_helper(describecol_args *data) {
84
95
 
85
96
  data->stmt_res->is_executing = 1;
86
97
 
98
+ #ifdef UNICODE_SUPPORT_VERSION
99
+ rc = SQLDescribeColW( (SQLHSTMT)data->stmt_res->hstmt, (SQLSMALLINT)(data->col_no),
100
+ data->stmt_res->column_info[i].name, data->buff_length, &(data->name_length),
101
+ &(data->stmt_res->column_info[i].type), &(data->stmt_res->column_info[i].size),
102
+ &(data->stmt_res->column_info[i].scale), &(data->stmt_res->column_info[i].nullable) );
103
+ #else
87
104
  rc = SQLDescribeCol( (SQLHSTMT)data->stmt_res->hstmt, (SQLSMALLINT)(data->col_no),
88
105
  data->stmt_res->column_info[i].name, data->buff_length, &(data->name_length),
89
106
  &(data->stmt_res->column_info[i].type), &(data->stmt_res->column_info[i].size),
90
107
  &(data->stmt_res->column_info[i].scale), &(data->stmt_res->column_info[i].nullable) );
108
+ #endif
91
109
 
92
110
  data->stmt_res->is_executing = 0;
93
111
 
@@ -119,8 +137,15 @@ int _ruby_ibm_db_SQLColumnPrivileges_helper(metadata_args *data) {
119
137
 
120
138
  data->stmt_res->is_executing = 1;
121
139
 
122
- rc = SQLColumnPrivileges( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, SQL_NTS,
123
- data->owner,SQL_NTS, data->table_name,SQL_NTS, data->column_name,SQL_NTS );
140
+ #ifndef UNICODE_SUPPORT_VERSION
141
+ rc = SQLColumnPrivileges( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len,
142
+ data->owner, data->owner_len, data->table_name, data->table_name_len,
143
+ data->column_name, data->column_name_len );
144
+ #else
145
+ rc = SQLColumnPrivilegesW( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len,
146
+ data->owner, data->owner_len, data->table_name, data->table_name_len,
147
+ data->column_name, data->column_name_len );
148
+ #endif
124
149
 
125
150
  data->stmt_res->is_executing = 0;
126
151
 
@@ -136,8 +161,15 @@ int _ruby_ibm_db_SQLColumns_helper(metadata_args *data) {
136
161
 
137
162
  data->stmt_res->is_executing = 1;
138
163
 
139
- rc = SQLColumns( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, SQL_NTS,
140
- data->owner,SQL_NTS, data->table_name,SQL_NTS, data->column_name,SQL_NTS );
164
+ #ifndef UNICODE_SUPPORT_VERSION
165
+ rc = SQLColumns( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len,
166
+ data->owner, data->owner_len, data->table_name, data->table_name_len,
167
+ data->column_name, data->column_name_len );
168
+ #else
169
+ rc = SQLColumnsW( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len,
170
+ data->owner, data->owner_len, data->table_name, data->table_name_len,
171
+ data->column_name, data->column_name_len );
172
+ #endif
141
173
 
142
174
  data->stmt_res->is_executing = 0;
143
175
 
@@ -152,8 +184,13 @@ int _ruby_ibm_db_SQLPrimaryKeys_helper(metadata_args *data) {
152
184
 
153
185
  data->stmt_res->is_executing = 1;
154
186
 
155
- rc = SQLPrimaryKeys( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, SQL_NTS,
156
- data->owner, SQL_NTS, data->table_name,SQL_NTS );
187
+ #ifndef UNICODE_SUPPORT_VERSION
188
+ rc = SQLPrimaryKeys( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len,
189
+ data->owner, data->owner_len, data->table_name, data->table_name_len );
190
+ #else
191
+ rc = SQLPrimaryKeysW( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len,
192
+ data->owner, data->owner_len, data->table_name, data->table_name_len );
193
+ #endif
157
194
 
158
195
  data->stmt_res->is_executing = 0;
159
196
 
@@ -161,16 +198,22 @@ int _ruby_ibm_db_SQLPrimaryKeys_helper(metadata_args *data) {
161
198
  }
162
199
 
163
200
  /*
164
- This function calls SQLForeignKeys cli call to get the list of primay key columns and the associated metadata
201
+ This function calls SQLForeignKeys cli call to get the list of foreign key columns and the associated metadata
165
202
  */
166
203
  int _ruby_ibm_db_SQLForeignKeys_helper(metadata_args *data) {
167
204
  int rc = 0;
168
205
 
169
206
  data->stmt_res->is_executing = 1;
170
207
 
171
- rc = SQLForeignKeys( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, SQL_NTS,
172
- data->owner, SQL_NTS, data->table_name ,SQL_NTS, NULL, SQL_NTS,
208
+ #ifndef UNICODE_SUPPORT_VERSION
209
+ rc = SQLForeignKeys( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len,
210
+ data->owner, data->owner_len, data->table_name , data->table_name_len, NULL, SQL_NTS,
211
+ NULL, SQL_NTS, NULL, SQL_NTS );
212
+ #else
213
+ rc = SQLForeignKeysW( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len,
214
+ data->owner, data->owner_len, data->table_name , data->table_name_len, NULL, SQL_NTS,
173
215
  NULL, SQL_NTS, NULL, SQL_NTS );
216
+ #endif
174
217
 
175
218
  data->stmt_res->is_executing = 0;
176
219
 
@@ -186,8 +229,13 @@ int _ruby_ibm_db_SQLProcedureColumns_helper(metadata_args *data) {
186
229
 
187
230
  data->stmt_res->is_executing = 1;
188
231
 
189
- rc = SQLProcedureColumns( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, SQL_NTS, data->owner,
190
- SQL_NTS, data->proc_name, SQL_NTS, data->column_name, SQL_NTS );
232
+ #ifndef UNICODE_SUPPORT_VERSION
233
+ rc = SQLProcedureColumns( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len, data->owner,
234
+ data->owner_len, data->proc_name, data->proc_name_len, data->column_name, data->column_name_len );
235
+ #else
236
+ rc = SQLProcedureColumnsW( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len, data->owner,
237
+ data->owner_len, data->proc_name, data->proc_name_len, data->column_name, data->column_name_len );
238
+ #endif
191
239
 
192
240
  data->stmt_res->is_executing = 0;
193
241
 
@@ -203,8 +251,13 @@ int _ruby_ibm_db_SQLProcedures_helper(metadata_args *data) {
203
251
 
204
252
  data->stmt_res->is_executing = 1;
205
253
 
206
- rc = SQLProcedures( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, SQL_NTS, data->owner,
207
- SQL_NTS, data->proc_name, SQL_NTS );
254
+ #ifndef UNICODE_SUPPORT_VERSION
255
+ rc = SQLProcedures( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len, data->owner,
256
+ data->owner_len, data->proc_name, data->proc_name_len );
257
+ #else
258
+ rc = SQLProceduresW( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len, data->owner,
259
+ data->owner_len, data->proc_name, data->proc_name_len );
260
+ #endif
208
261
 
209
262
  data->stmt_res->is_executing = 0;
210
263
 
@@ -220,8 +273,15 @@ int _ruby_ibm_db_SQLSpecialColumns_helper(metadata_args *data) {
220
273
 
221
274
  data->stmt_res->is_executing = 1;
222
275
 
223
- rc = SQLSpecialColumns( (SQLHSTMT) data->stmt_res->hstmt,SQL_BEST_ROWID, data->qualifier, SQL_NTS,
224
- data->owner,SQL_NTS, data->table_name,SQL_NTS,(SQLUSMALLINT)data->scope,SQL_NULLABLE );
276
+ #ifndef UNICODE_SUPPORT_VERSION
277
+ rc = SQLSpecialColumns( (SQLHSTMT) data->stmt_res->hstmt, SQL_BEST_ROWID, data->qualifier, data->qualifier_len,
278
+ data->owner, data->owner_len, data->table_name, data->table_name_len,
279
+ (SQLUSMALLINT)data->scope, SQL_NULLABLE );
280
+ #else
281
+ rc = SQLSpecialColumnsW( (SQLHSTMT) data->stmt_res->hstmt, SQL_BEST_ROWID, data->qualifier, data->qualifier_len,
282
+ data->owner, data->owner_len, data->table_name, data->table_name_len,
283
+ (SQLUSMALLINT)data->scope, SQL_NULLABLE );
284
+ #endif
225
285
 
226
286
  data->stmt_res->is_executing = 0;
227
287
 
@@ -236,8 +296,13 @@ int _ruby_ibm_db_SQLStatistics_helper(metadata_args *data) {
236
296
 
237
297
  data->stmt_res->is_executing = 1;
238
298
 
239
- rc = SQLStatistics( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, SQL_NTS, data->owner,
240
- SQL_NTS, data->table_name, SQL_NTS, (SQLUSMALLINT)data->unique, SQL_QUICK );
299
+ #ifndef UNICODE_SUPPORT_VERSION
300
+ rc = SQLStatistics( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len, data->owner,
301
+ data->owner_len, data->table_name, data->table_name_len, (SQLUSMALLINT)data->unique, SQL_QUICK );
302
+ #else
303
+ rc = SQLStatisticsW( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len, data->owner,
304
+ data->owner_len, data->table_name, data->table_name_len, (SQLUSMALLINT)data->unique, SQL_QUICK );
305
+ #endif
241
306
 
242
307
  data->stmt_res->is_executing = 0;
243
308
 
@@ -253,8 +318,13 @@ int _ruby_ibm_db_SQLTablePrivileges_helper(metadata_args *data) {
253
318
 
254
319
  data->stmt_res->is_executing = 1;
255
320
 
256
- rc = SQLTablePrivileges( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, SQL_NTS, data->owner,
257
- SQL_NTS, data->table_name, SQL_NTS );
321
+ #ifndef UNICODE_SUPPORT_VERSION
322
+ rc = SQLTablePrivileges( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len,
323
+ data->owner, data->owner_len, data->table_name, data->table_name_len );
324
+ #else
325
+ rc = SQLTablePrivilegesW( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len,
326
+ data->owner, data->owner_len, data->table_name, data->table_name_len );
327
+ #endif
258
328
 
259
329
  data->stmt_res->is_executing = 0;
260
330
 
@@ -270,8 +340,13 @@ int _ruby_ibm_db_SQLTables_helper(metadata_args *data) {
270
340
 
271
341
  data->stmt_res->is_executing = 1;
272
342
 
273
- rc = SQLTables( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, SQL_NTS, data->owner,
274
- SQL_NTS, data->table_name, SQL_NTS, data->table_type, SQL_NTS );
343
+ #ifndef UNICODE_SUPPORT_VERSION
344
+ rc = SQLTables( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len, data->owner,
345
+ data->owner_len, data->table_name, data->table_name_len, data->table_type, data->table_type_len );
346
+ #else
347
+ rc = SQLTablesW( (SQLHSTMT) data->stmt_res->hstmt, data->qualifier, data->qualifier_len, data->owner,
348
+ data->owner_len, data->table_name, data->table_name_len, data->table_type, data->table_type_len );
349
+ #endif
275
350
 
276
351
  data->stmt_res->is_executing = 0;
277
352
 
@@ -286,7 +361,11 @@ int _ruby_ibm_db_SQLExecDirect_helper(exec_cum_prepare_args *data) {
286
361
 
287
362
  data->stmt_res->is_executing = 1;
288
363
 
364
+ #ifndef UNICODE_SUPPORT_VERSION
289
365
  rc = SQLExecDirect( (SQLHSTMT) data->stmt_res->hstmt, data->stmt_string, (SQLINTEGER)data->stmt_string_len );
366
+ #else
367
+ rc = SQLExecDirectW( (SQLHSTMT) data->stmt_res->hstmt, data->stmt_string, (SQLINTEGER)data->stmt_string_len );
368
+ #endif
290
369
 
291
370
  data->stmt_res->is_executing = 0;
292
371
 
@@ -301,7 +380,11 @@ int _ruby_ibm_db_SQLPrepare_helper(exec_cum_prepare_args *data) {
301
380
 
302
381
  data->stmt_res->is_executing = 1;
303
382
 
383
+ #ifndef UNICODE_SUPPORT_VERSION
304
384
  rc = SQLPrepare( (SQLHSTMT) data->stmt_res->hstmt, data->stmt_string, (SQLINTEGER)data->stmt_string_len );
385
+ #else
386
+ rc = SQLPrepareW( (SQLHSTMT) data->stmt_res->hstmt, data->stmt_string, (SQLINTEGER)data->stmt_string_len );
387
+ #endif
305
388
 
306
389
  data->stmt_res->is_executing = 0;
307
390
 
@@ -533,29 +616,46 @@ int _ruby_ibm_db_SQLRowCount_helper(sql_row_count_args *data) {
533
616
  This function calls SQLGetInfo cli call to get general information about DBMS, which the app is connected to
534
617
  */
535
618
  int _ruby_ibm_db_SQLGetInfo_helper(get_info_args *data) {
619
+ #ifndef UNICODE_SUPPORT_VERSION
536
620
  return SQLGetInfo( data->conn_res->hdbc, data->infoType, data->infoValue, data->buff_length, data->out_length);
621
+ #else
622
+ return SQLGetInfoW( data->conn_res->hdbc, data->infoType, data->infoValue, data->buff_length, data->out_length);
623
+ #endif
537
624
  }
538
625
 
539
626
  /*
540
627
  This function calls SQLGetDiagRec cli call to get the current values of a diagnostic record that contains error
541
628
  */
542
629
  int _ruby_ibm_db_SQLGetDiagRec_helper(get_diagRec_args *data) {
630
+ #ifdef UNICODE_SUPPORT_VERSION
631
+ return SQLGetDiagRecW( data->hType, data->handle, data->recNum, data->SQLState, data->NativeErrorPtr,
632
+ data->msgText, data->buff_length, data->text_length_ptr );
633
+ #else
543
634
  return SQLGetDiagRec(data->hType, data->handle, data->recNum, data->SQLState, data->NativeErrorPtr,
544
635
  data->msgText, data->buff_length, data->text_length_ptr );
636
+ #endif
545
637
  }
546
638
 
547
639
  /*
548
640
  This function calls SQLSetStmtAttr cli call to set attributes related to a statement
549
641
  */
550
642
  int _ruby_ibm_db_SQLSetStmtAttr_helper(set_handle_attr_args *data) {
643
+ #ifndef UNICODE_SUPPORT_VERSION
551
644
  return SQLSetStmtAttr( (SQLHSTMT) *(data->handle), data->attribute, data->valuePtr, data->strLength );
645
+ #else
646
+ return SQLSetStmtAttrW( (SQLHSTMT) *(data->handle), data->attribute, data->valuePtr, data->strLength );
647
+ #endif
552
648
  }
553
649
 
554
650
  /*
555
651
  This function calls SQLSetConnectAttr cli call to set attributes that govern aspects of connections
556
652
  */
557
653
  int _ruby_ibm_db_SQLSetConnectAttr_helper(set_handle_attr_args *data) {
654
+ #ifndef UNICODE_SUPPORT_VERSION
558
655
  return SQLSetConnectAttr( (SQLHDBC) *(data->handle), data->attribute, data->valuePtr, data->strLength );
656
+ #else
657
+ return SQLSetConnectAttrW( (SQLHDBC) *(data->handle), data->attribute, data->valuePtr, data->strLength );
658
+ #endif
559
659
  }
560
660
 
561
661
  /*
@@ -567,6 +667,10 @@ int _ruby_ibm_db_SQLSetEnvAttr_helper(set_handle_attr_args *data) {
567
667
 
568
668
  /*
569
669
  This function calls SQLGetStmtAttr cli call to set an environment attribute
670
+
671
+ The unicode equivalent of SQLGetStmtAttr is not used because the attributes being retrieved currently are not of type char or binary (SQL_IS_INTEGER). If support for retrieving a string type is provided then use the SQLGetStmtAttrW function accordingly
672
+ In get_last_serial_id although we are retrieving a char type, it is converted back to an integer (atoi). The char to integer conversion function in unicode equivalent will be more complicated and is unnecessary for this case.
673
+
570
674
  */
571
675
  int _ruby_ibm_db_SQLGetStmtAttr_helper(get_handle_attr_args *data) {
572
676
  return SQLGetStmtAttr( (SQLHSTMT) *(data->handle), data->attribute, data->valuePtr,
@@ -577,8 +681,13 @@ int _ruby_ibm_db_SQLGetStmtAttr_helper(get_handle_attr_args *data) {
577
681
  This function calls SQLGetConnectAttr cli call to set an environment attribute
578
682
  */
579
683
  int _ruby_ibm_db_SQLGetConnectAttr_helper(get_handle_attr_args *data) {
684
+ #ifndef UNICODE_SUPPORT_VERSION
580
685
  return SQLGetConnectAttr( (SQLHDBC) *(data->handle), data->attribute, data->valuePtr,
581
686
  data->buff_length, data->out_length);
687
+ #else
688
+ return SQLGetConnectAttrW( (SQLHDBC) *(data->handle), data->attribute, data->valuePtr,
689
+ data->buff_length, data->out_length);
690
+ #endif
582
691
  }
583
692
 
584
693
  /*
@@ -31,7 +31,7 @@ typedef struct _param_cache_node {
31
31
  char *varname; /* bound variable name */
32
32
  SQLBIGINT ivalue; /* Temp storage value */
33
33
  SQLDOUBLE fvalue; /* Temp storage value */
34
- SQLCHAR *svalue; /* Temp storage value */
34
+ SQLPOINTER svalue; /* Temp storage value */
35
35
  struct _param_cache_node *next; /* Pointer to next node */
36
36
  } param_node;
37
37
 
@@ -49,8 +49,9 @@ typedef struct _conn_handle_struct {
49
49
 
50
50
  int errorType; /*Indicates Whether the error logged in ruby_error_msg is a statement error or connection error*/
51
51
 
52
- char *ruby_error_msg;
53
- char *ruby_error_state;
52
+ SQLPOINTER ruby_error_msg;
53
+ SQLPOINTER ruby_error_state;
54
+ SQLSMALLINT ruby_error_msg_len;
54
55
 
55
56
  } conn_handle;
56
57
 
@@ -59,7 +60,7 @@ typedef union {
59
60
  SQLDOUBLE d_val;
60
61
  SQLFLOAT f_val;
61
62
  SQLSMALLINT s_val;
62
- SQLCHAR *str_val;
63
+ SQLPOINTER str_val;
63
64
  } ibm_db_row_data_type;
64
65
 
65
66
  typedef struct {
@@ -68,7 +69,12 @@ typedef struct {
68
69
  } ibm_db_row_type;
69
70
 
70
71
  typedef struct _ibm_db_result_set_info_struct {
72
+ #ifdef UNICODE_SUPPORT_VERSION
73
+ SQLWCHAR *name;
74
+ long name_length;
75
+ #else
71
76
  SQLCHAR *name;
77
+ #endif
72
78
  SQLSMALLINT type;
73
79
  SQLUINTEGER size;
74
80
  SQLSMALLINT scale;
@@ -104,20 +110,27 @@ typedef struct _stmt_handle_struct {
104
110
  ibm_db_result_set_info *column_info;
105
111
  ibm_db_row_type *row_data;
106
112
 
107
- char *ruby_stmt_err_msg;
108
- char *ruby_stmt_err_state;
113
+ SQLPOINTER ruby_stmt_err_msg;
114
+ SQLPOINTER ruby_stmt_err_state;
115
+ SQLSMALLINT ruby_stmt_err_msg_len;
109
116
  } stmt_handle;
110
117
 
111
118
  /*
112
119
  Structure holding the data to be passed to SQLConnect or SQLDriverConnect CLI call
113
120
  */
114
121
  typedef struct _ibm_db_connect_args_struct {
115
- char *database;
116
- char *uid;
117
- char *password;
118
- long database_len;
119
- long uid_len;
120
- long password_len;
122
+ #ifdef UNICODE_SUPPORT_VERSION
123
+ SQLWCHAR *database;
124
+ SQLWCHAR *uid;
125
+ SQLWCHAR *password;
126
+ #else
127
+ SQLCHAR *database;
128
+ SQLCHAR *uid;
129
+ SQLCHAR *password;
130
+ #endif
131
+ SQLSMALLINT database_len;
132
+ SQLSMALLINT uid_len;
133
+ SQLSMALLINT password_len;
121
134
  int ctlg_conn; /*Indicates if the connection is a cataloged connection or not*/
122
135
  SQLHANDLE *hdbc;
123
136
  } connect_args;
@@ -158,12 +171,27 @@ typedef struct _ibm_db_describecol_args_struct {
158
171
  */
159
172
  typedef struct _ibm_db_metadata_args_struct {
160
173
  stmt_handle *stmt_res;
174
+ #ifdef UNICODE_SUPPORT_VERSION
175
+ SQLWCHAR *qualifier;
176
+ SQLWCHAR *owner;
177
+ SQLWCHAR *table_name;
178
+ SQLWCHAR *proc_name; /*Used for call SQLProcedureColumns*/
179
+ SQLWCHAR *column_name;
180
+ SQLWCHAR *table_type;
181
+ #else
161
182
  SQLCHAR *qualifier;
162
183
  SQLCHAR *owner;
163
184
  SQLCHAR *table_name;
164
185
  SQLCHAR *proc_name; /*Used for call SQLProcedureColumns*/
165
186
  SQLCHAR *column_name;
166
187
  SQLCHAR *table_type;
188
+ #endif
189
+ SQLSMALLINT qualifier_len;
190
+ SQLSMALLINT owner_len;
191
+ SQLSMALLINT table_name_len;
192
+ SQLSMALLINT proc_name_len; /*Used for call SQLProcedureColumns*/
193
+ SQLSMALLINT column_name_len;
194
+ SQLSMALLINT table_type_len;
167
195
  int scope; /*Used in SQLSpecialColumns To determine the scope of the unique row identifier*/
168
196
  int unique; /*Used in SQLStatistics to determine if only unique indexes are to be fetched or all*/
169
197
 
@@ -174,7 +202,11 @@ typedef struct _ibm_db_metadata_args_struct {
174
202
  */
175
203
  typedef struct _ibm_db_exec_direct_args_struct {
176
204
  stmt_handle *stmt_res;
205
+ #ifdef UNICODE_SUPPORT_VERSION
206
+ SQLWCHAR *stmt_string;
207
+ #else
177
208
  SQLCHAR *stmt_string;
209
+ #endif
178
210
  long stmt_string_len;
179
211
  } exec_cum_prepare_args;
180
212
 
@@ -240,7 +272,7 @@ typedef struct _ibm_db_get_data_args_struct {
240
272
  stmt_handle *stmt_res;
241
273
  SQLSMALLINT col_num;
242
274
  SQLSMALLINT targetType;
243
- SQLPOINTER *buff;
275
+ SQLPOINTER buff;
244
276
  SQLLEN buff_length;
245
277
  SQLLEN *out_length;
246
278
  } get_data_args;
@@ -336,9 +368,9 @@ typedef struct _ibm_db_get_diagRec_struct {
336
368
  SQLSMALLINT hType;
337
369
  SQLHANDLE handle;
338
370
  SQLSMALLINT recNum;
339
- SQLCHAR *SQLState;
371
+ SQLPOINTER SQLState;
372
+ SQLPOINTER msgText;
340
373
  SQLINTEGER *NativeErrorPtr;
341
- SQLCHAR *msgText;
342
374
  SQLSMALLINT buff_length;
343
375
  SQLSMALLINT *text_length_ptr;
344
376
  } get_diagRec_args;