ibm_db 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/CHANGES +6 -0
  2. data/README +1 -66
  3. data/ext/ibm_db.c +41 -34
  4. data/ext/ruby_ibm_db.h +7 -1
  5. metadata +3 -3
data/CHANGES CHANGED
@@ -1,5 +1,11 @@
1
1
  Change Log
2
2
  ==============
3
+ 2007/09/28 (IBM_DB adapter 0.9.0, driver 0.9.0):
4
+ - Fixed ibm_db gem 0.8.5 incompatibility with DB2 CLI 9.1 FP3 and below
5
+
6
+ 2007/09/13 (IBM_DB adapter 0.8.5, driver 0.8.5):
7
+ - Fixed Ruby driver crash on Windows Vista [#13357]
8
+
3
9
  2007/07/05 (IBM_DB adapter 0.8.0, driver 0.7.0):
4
10
  - Support for Informix Dynamic Server 11.10
5
11
  - New driver method get_last_serial_value to retrieve last inserted serial
data/README CHANGED
@@ -1,73 +1,8 @@
1
1
  =====================================================================
2
- README for the IBM_DB Adapter 0.8.0 and Driver 0.7.0 (2007/07/11)
2
+ README for the IBM_DB Adapter 0.9.0 and Driver 0.9.0 (2007/09/28)
3
3
  For ActiveRecord Version 1.15.3 (and Rails 1.2.3)
4
4
  =====================================================================
5
5
 
6
- Change Log
7
- ==============
8
- 2007/07/11 (IBM_DB adapter 0.8.0, driver 0.7.0):
9
- - Support for Informix Dynamic Server 11.10 and beyond
10
- - New driver method get_last_serial_value to retrieve last inserted serial
11
- value for Informix Dynamic Server
12
-
13
- 2007/06/19 (IBM_DB adapter 0.7.5, driver 0.6.0):
14
- - Driver code (ibm_db.c) remains at the same level: 0.6.0 (no changes)
15
- - Fixed client attributes initialization on connection setup [11264]
16
- - Fixed rake db:schema:dump native data types limits incompatible with table create
17
-
18
- 2007/06/01 (IBM_DB adapter 0.7.0, driver 0.6.0):
19
- - Driver code (ibm_db.c) remains at the same level: 0.6.0 (no changes)
20
- - Fixed remaining failure on {:null => true} option for XML data type [#10877]
21
- - Fixed handling of {:id => false} option during table creation in DB2 for zOS
22
- - Fixed handle_lobs failures in table creation for has_many/belongs_to [#10701]
23
- - Fixe db2-i5-zOS.yaml content (removed inadvertent tab) [#11234]
24
-
25
- 2007/05/10 (IBM_DB adapter 0.6.5, driver 0.6.0):
26
- - Driver code (ibm_db.c) remains at the same level: 0.6.0 (no changes)
27
- - Fixed regression for reconnect after being inactive (connection recycle)
28
- - Fixed rake db:schema:load failures on boolean data type [#10683]
29
- - Fixed XML default option (:null => true for XML data type) [#10754]
30
- - Fixed DB2 for zOS version 9 handling of column changes for DEFAULT NULL
31
-
32
- 2007/04/30 (0.6.0):
33
- - Support for remote connections to DB2 Universal Database on z/OS version 9
34
- - Support for result set pagination via ActiveRecord add_limit_offset! method
35
- for DB2 Universal Database on z/OS and i5/OS
36
- - Defect fixes
37
- - Improved documentation
38
-
39
- 2007/04/20 (0.4.6):
40
- - Fixed XML columns creation default value (NOT NULL)
41
- - Fixed border case for IS NULL in where clauses
42
- - Improved documentation (connection attributes)
43
-
44
- 2007/04/20 (0.4.5):
45
- - Fixed reconnect problems: driver (IBM_DB::active) and adapter (active)
46
- - Client connection attribute rename (app_user to replace user)
47
- - Improved support for ROWID data type (DB2 for zOS version 8 and 9)
48
-
49
- 2007/03/21 (0.4.0):
50
- - Support added for remote connectivity to DB2 zOS version 8
51
- - Support added for remote connectivity to DB2 i5 v5r3 and v5r4
52
- - Improved migration support (added change_column method)
53
- - Support for setting and retrieving values for client attributes (user,
54
- account, application, workstation)
55
-
56
- 2006/10/31 (0.2.0):
57
- - Significant performance improvements
58
- - Improved stored procedure support at driver level
59
- - Added support for Large Object data types (LOBs) greater than 32K (BLOB, CLOB, XML) in size
60
- - Added XML data type support for native storage of XML documents
61
- - Significant quality improvements, through many bug fixes in the driver and adapter
62
- - Improved migration support (added add_column and remove_column methods)
63
-
64
- 2006/06/07 (0.1.0):
65
-
66
- - Fixed compatibility issue with other adapters
67
- - If a schema is omitted in database.yml, the username is now used as default schema
68
- - Introduced descriptive CLI error messages when a connection or an execute statement fails
69
- - Introduced check against schema in method 'indexes'
70
-
71
6
  Supported Operating Systems
72
7
  ============================
73
8
  - Linux 32/64 bit
@@ -10,7 +10,7 @@
10
10
  +----------------------------------------------------------------------+
11
11
  */
12
12
 
13
- #define MODULE_RELEASE "0.7.0"
13
+ #define MODULE_RELEASE "0.9.0"
14
14
 
15
15
  #ifdef HAVE_CONFIG_H
16
16
  #include "config.h"
@@ -324,9 +324,9 @@ static void _ruby_ibm_db_free_conn_struct(conn_handle *handle)
324
324
  }
325
325
  if ( handle != NULL ) {
326
326
  if ( handle->flag_pconnect ) {
327
- free(handle);
327
+ ruby_xfree(handle);
328
328
  } else {
329
- free(handle);
329
+ ruby_xfree(handle);
330
330
  }
331
331
  }
332
332
  }
@@ -355,7 +355,7 @@ static void _ruby_ibm_db_mark_row_struct(row_hash_struct *handle)
355
355
  /* static void _ruby_ibm_db_free_row_struct */
356
356
  static void _ruby_ibm_db_free_row_struct(row_hash_struct *handle)
357
357
  {
358
- free(handle);
358
+ ruby_xfree(handle);
359
359
  }
360
360
  /* */
361
361
 
@@ -375,11 +375,11 @@ static void _ruby_ibm_db_free_result_struct(stmt_handle* handle)
375
375
  curr_ptr = curr_ptr->next;
376
376
 
377
377
  if (prev_ptr->varname) {
378
- free(prev_ptr->varname);
378
+ ruby_xfree(prev_ptr->varname);
379
379
  }
380
380
 
381
- if (prev_ptr->svalue) free(prev_ptr->svalue);
382
- free(prev_ptr);
381
+ if (prev_ptr->svalue) ruby_xfree(prev_ptr->svalue);
382
+ ruby_xfree(prev_ptr);
383
383
 
384
384
  prev_ptr = curr_ptr;
385
385
  }
@@ -400,21 +400,21 @@ static void _ruby_ibm_db_free_result_struct(stmt_handle* handle)
400
400
  case SQL_NUMERIC:
401
401
  case SQL_XML:
402
402
  if ( handle->row_data[i].data.str_val != NULL ) {
403
- free(handle->row_data[i].data.str_val);
403
+ ruby_xfree(handle->row_data[i].data.str_val);
404
404
  handle->row_data[i].data.str_val = NULL;
405
405
  }
406
406
  }
407
407
  }
408
- free(handle->row_data);
408
+ ruby_xfree(handle->row_data);
409
409
  handle->row_data = NULL;
410
410
  }
411
411
 
412
412
  /* free column info cache */
413
413
  if ( handle->column_info ) {
414
414
  for (i=0; i<handle->num_columns; i++) {
415
- free(handle->column_info[i].name);
415
+ ruby_xfree(handle->column_info[i].name);
416
416
  }
417
- free(handle->column_info);
417
+ ruby_xfree(handle->column_info);
418
418
  handle->column_info = NULL;
419
419
  handle->num_columns = 0;
420
420
  }
@@ -470,7 +470,7 @@ static void _ruby_ibm_db_free_stmt_struct(stmt_handle *handle)
470
470
 
471
471
  if ( handle ) {
472
472
  _ruby_ibm_db_free_result_struct(handle);
473
- free(handle);
473
+ ruby_xfree(handle);
474
474
  }
475
475
  }
476
476
  /* */
@@ -1202,16 +1202,23 @@ static VALUE _ruby_ibm_db_connect_helper( int argc, VALUE *argv, int isPersisten
1202
1202
  /* Set SQL_ATTR_REPLACE_QUOTED_LITERALS connection attribute to
1203
1203
  * enable CLI numeric literal feature. This is equivalent to
1204
1204
  * PATCH2=71 in the db2cli.ini file
1205
+ * Note, for backward compatibility with older CLI drivers having a
1206
+ * different value for SQL_ATTR_REPLACE_QUOTED_LITERALS, we call
1207
+ * SQLSetConnectAttr() with both the old and new value
1205
1208
  */
1206
1209
  #ifndef PASE
1207
1210
  /* Only enable this feature if we are not connected to an Informix data server */
1208
1211
  if (!is_informix) {
1209
1212
  rc = SQLSetConnectAttr((SQLHDBC)conn_res->hdbc, SQL_ATTR_REPLACE_QUOTED_LITERALS, (SQLPOINTER)(enable_numeric_literals), SQL_IS_INTEGER);
1213
+ if (rc != SQL_SUCCESS)
1214
+ rc = SQLSetConnectAttr((SQLHDBC)conn_res->hdbc, SQL_ATTR_REPLACE_QUOTED_LITERALS_OLDVALUE, (SQLPOINTER)(enable_numeric_literals), SQL_IS_INTEGER);
1210
1215
  }
1211
1216
  #else
1212
1217
  /* Only enable this feature if we are not connected to an Informix data server */
1213
1218
  if (!is_informix) {
1214
1219
  rc = SQLSetConnectAttr((SQLHDBC)conn_res->hdbc, SQL_ATTR_REPLACE_QUOTED_LITERALS, (SQLPOINTER)(&enable_numeric_literals), SQL_IS_INTEGER);
1220
+ if (rc != SQL_SUCCESS)
1221
+ rc = SQLSetConnectAttr((SQLHDBC)conn_res->hdbc, SQL_ATTR_REPLACE_QUOTED_LITERALS_OLDVALUE, (SQLPOINTER)(&enable_numeric_literals), SQL_IS_INTEGER);
1215
1222
  }
1216
1223
  #endif
1217
1224
  if (rc != SQL_SUCCESS) {
@@ -1229,7 +1236,7 @@ static VALUE _ruby_ibm_db_connect_helper( int argc, VALUE *argv, int isPersisten
1229
1236
  conn_res);
1230
1237
  rb_hash_aset(persistent_list, rb_str_new2(hKey), entry);
1231
1238
  }
1232
- free(hKey);
1239
+ ruby_xfree(hKey);
1233
1240
  }
1234
1241
 
1235
1242
  if ( rc != SQL_SUCCESS ) {
@@ -1239,7 +1246,7 @@ static VALUE _ruby_ibm_db_connect_helper( int argc, VALUE *argv, int isPersisten
1239
1246
 
1240
1247
  /* free memory */
1241
1248
  if (conn_res != NULL) {
1242
- free(conn_res);
1249
+ ruby_xfree(conn_res);
1243
1250
  }
1244
1251
 
1245
1252
  return Qfalse;
@@ -1521,7 +1528,7 @@ static void _ruby_ibm_db_add_param_cache( stmt_handle *stmt_res, int param_no, c
1521
1528
  /* Var lengths can be variable and different in both cases. */
1522
1529
  /* This shouldn't happen often anyway */
1523
1530
  if ( varname != NULL) {
1524
- free(curr->varname);
1531
+ ruby_xfree(curr->varname);
1525
1532
  curr->varname = estrndup(varname, varname_len);
1526
1533
  }
1527
1534
  }
@@ -2502,11 +2509,11 @@ VALUE ibm_db_special_columns(int argc, VALUE *argv, VALUE self)
2502
2509
  * The name of the table.
2503
2510
  *
2504
2511
  * unique
2505
- * An integer value representing the type of index information to return.
2506
- * 0
2507
- * Return only the information for unique indexes on the table.
2508
- * 1
2509
- * Return the information for all indexes on the table.
2512
+ * An boolean value representing the type of index information to return.
2513
+ *
2514
+ * False Return only the information for unique indexes on the table.
2515
+ *
2516
+ * True Return the information for all indexes on the table.
2510
2517
  *
2511
2518
  * ===Return Values
2512
2519
  *
@@ -2969,7 +2976,7 @@ VALUE ibm_db_exec(int argc, VALUE *argv, VALUE self)
2969
2976
  rc = SQLAllocHandle(SQL_HANDLE_STMT, conn_res->hdbc, &(stmt_res->hstmt));
2970
2977
  if ( rc < SQL_SUCCESS ) {
2971
2978
  _ruby_ibm_db_check_sql_errors(conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, -1, 1);
2972
- free(return_str);
2979
+ ruby_xfree(return_str);
2973
2980
  return rc;
2974
2981
  }
2975
2982
 
@@ -2987,11 +2994,11 @@ VALUE ibm_db_exec(int argc, VALUE *argv, VALUE self)
2987
2994
  if ( rc < SQL_SUCCESS ) {
2988
2995
  _ruby_ibm_db_check_sql_errors(stmt_res->hstmt, SQL_HANDLE_STMT, -1, 0, return_str, DB2_ERRMSG, stmt_res->errormsg_recno_tracker);
2989
2996
  SQLFreeHandle( SQL_HANDLE_STMT, stmt_res->hstmt );
2990
- free(stmt_res);
2991
- free(return_str);
2997
+ ruby_xfree(stmt_res);
2998
+ ruby_xfree(return_str);
2992
2999
  return Qfalse;
2993
3000
  }
2994
- free(return_str);
3001
+ ruby_xfree(return_str);
2995
3002
 
2996
3003
  return Data_Wrap_Struct(le_stmt_struct,
2997
3004
  _ruby_ibm_db_mark_stmt_struct, _ruby_ibm_db_free_stmt_struct,
@@ -3449,7 +3456,7 @@ void var_assign(char *name, VALUE value) {
3449
3456
  strcat(statement, "=");
3450
3457
  strcat(statement, expr);
3451
3458
  rb_eval_string(statement);
3452
- free(statement);
3459
+ ruby_xfree(statement);
3453
3460
  #endif
3454
3461
  }
3455
3462
 
@@ -3630,10 +3637,10 @@ VALUE ibm_db_execute(int argc, VALUE *argv, VALUE self)
3630
3637
 
3631
3638
  /* Free Values */
3632
3639
  if ( prev_ptr->svalue) {
3633
- free(prev_ptr->svalue);
3640
+ ruby_xfree(prev_ptr->svalue);
3634
3641
  }
3635
3642
 
3636
- free(prev_ptr);
3643
+ ruby_xfree(prev_ptr);
3637
3644
 
3638
3645
  prev_ptr = curr_ptr;
3639
3646
  }
@@ -4766,11 +4773,11 @@ VALUE ibm_db_result(int argc, VALUE *argv, VALUE self)
4766
4773
  return Qfalse;
4767
4774
  }
4768
4775
  if (out_length == SQL_NULL_DATA) {
4769
- free(out_ptr);
4776
+ ruby_xfree(out_ptr);
4770
4777
  return Qnil;
4771
4778
  } else {
4772
4779
  return_value = rb_str_new2((char*)out_ptr);
4773
- free(out_ptr);
4780
+ ruby_xfree(out_ptr);
4774
4781
  return return_value;
4775
4782
  }
4776
4783
  break;
@@ -5017,7 +5024,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(int argc, VALUE *argv, int op)
5017
5024
  }
5018
5025
  rc = _ruby_ibm_db_get_data(stmt_res, i+1, SQL_C_CHAR, out_ptr, tmp_length+1, &out_length);
5019
5026
  if ( rc == SQL_ERROR ) {
5020
- free(out_ptr);
5027
+ ruby_xfree(out_ptr);
5021
5028
  return Qfalse;
5022
5029
  }
5023
5030
  if (out_length == SQL_NULL_DATA) {
@@ -5161,7 +5168,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(int argc, VALUE *argv, int op)
5161
5168
 
5162
5169
  rc = _ruby_ibm_db_get_data2(stmt_res, i+1, lob_bind_type, (char *)out_ptr, tmp_length, &out_length);
5163
5170
  if (rc == SQL_ERROR) {
5164
- free(out_ptr);
5171
+ ruby_xfree(out_ptr);
5165
5172
  out_length = 0;
5166
5173
  }
5167
5174
 
@@ -5207,7 +5214,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(int argc, VALUE *argv, int op)
5207
5214
  }
5208
5215
  rc = _ruby_ibm_db_get_data(stmt_res, i+1, SQL_C_BINARY, out_ptr, tmp_length, &out_length);
5209
5216
  if (rc == SQL_ERROR) {
5210
- free(out_ptr);
5217
+ ruby_xfree(out_ptr);
5211
5218
  return Qfalse;
5212
5219
  }
5213
5220
 
@@ -5246,7 +5253,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(int argc, VALUE *argv, int op)
5246
5253
 
5247
5254
  rc = _ruby_ibm_db_get_data2(stmt_res, i+1, SQL_C_CHAR, out_ptr, tmp_length+1, &out_length);
5248
5255
  if (rc == SQL_ERROR) {
5249
- free(out_ptr);
5256
+ ruby_xfree(out_ptr);
5250
5257
  tmp_length = 0;
5251
5258
  } else {
5252
5259
  out_ptr[tmp_length] = '\0';
@@ -5423,7 +5430,7 @@ VALUE ibm_db_fetch_object(int argc, VALUE *argv, VALUE self)
5423
5430
  _ruby_ibm_db_mark_row_struct, _ruby_ibm_db_free_row_struct,
5424
5431
  row_res);
5425
5432
  } else {
5426
- free(row_res);
5433
+ ruby_xfree(row_res);
5427
5434
  return Qfalse;
5428
5435
  }
5429
5436
  }
@@ -22,9 +22,15 @@
22
22
  #endif
23
23
 
24
24
  #ifndef SQL_ATTR_REPLACE_QUOTED_LITERALS
25
- #define SQL_ATTR_REPLACE_QUOTED_LITERALS 116
25
+ #define SQL_ATTR_REPLACE_QUOTED_LITERALS 2586
26
26
  #endif
27
27
 
28
+ /* CLI v9.1 FP3 and below has a SQL_ATTR_REPLACE_QUOTED_LITERALS value of 116
29
+ * We need to support both the new and old values for compatibility with older
30
+ * versions of CLI. CLI v9.1 FP4 and beyond changed this value to 2586
31
+ */
32
+ #define SQL_ATTR_REPLACE_QUOTED_LITERALS_OLDVALUE 116
33
+
28
34
  /* If using a DB2 CLI version which doesn't support this functionality, explicitly
29
35
  * define this. We will rely on DB2 CLI to throw an error when SQLGetStmtAttr is
30
36
  * called.
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
2
+ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: ibm_db
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.8.0
7
- date: 2007-08-08 00:00:00 -04:00
6
+ version: 0.9.0
7
+ date: 2007-10-15 00:00:00 -04:00
8
8
  summary: "Rails Driver and Adapter for IBM Data Servers: {LUW, zOS, i5, IDS}"
9
9
  require_paths:
10
10
  - lib