ibm_db 2.5.0-mswin32 → 2.5.5-mswin32

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,5 +1,10 @@
1
1
  Change Log
2
2
  ==============
3
+ 2010/07/15 (IBM_DB adapter 2.5.5, driver 2.5.5) :
4
+ - Support for datatype Graphic and Vargraphic in driver and adapter [27965]
5
+ - Support for Bigint datatype in adapter.
6
+ - Fixed bug [28295] --> IBM_DB, Unicode Version, fails with encoding error against Informix Server
7
+
3
8
  2010/05/12 (IBM_DB adapter 2.5.0, driver 2.5.0) :
4
9
  - Support for Unicode with Ruby 1.9 [Data from the IBM_DB driver is returned in UTF8 format]
5
10
  - Fixed bug [27954] --> Fixed Truncation of char for bit data containing a Null Terminator
data/README CHANGED
@@ -1,5 +1,5 @@
1
1
  =====================================================================
2
- README for the IBM_DB Adapter (2.5.0) and Driver (2.5.0) (2010/05/12)
2
+ README for the IBM_DB Adapter (2.5.5) and Driver (2.5.5) (2010/07/15)
3
3
  For ActiveRecord Version >= 1.15.5 (and Rails >= 1.2.5)
4
4
  =====================================================================
5
5
 
data/ext/ibm_db.c CHANGED
@@ -12,7 +12,7 @@
12
12
  +----------------------------------------------------------------------+
13
13
  */
14
14
 
15
- #define MODULE_RELEASE "2.5.0"
15
+ #define MODULE_RELEASE "2.5.5"
16
16
 
17
17
  #ifdef HAVE_CONFIG_H
18
18
  #include "config.h"
@@ -515,6 +515,8 @@ static void _ruby_ibm_db_free_result_struct(stmt_handle* handle)
515
515
  case SQL_WCHAR:
516
516
  case SQL_VARCHAR:
517
517
  case SQL_WVARCHAR:
518
+ case SQL_GRAPHIC:
519
+ case SQL_VARGRAPHIC:
518
520
  #ifndef PASE /* i5/OS SQL_LONGVARCHAR is SQL_VARCHAR */
519
521
  case SQL_LONGVARCHAR:
520
522
  case SQL_WLONGVARCHAR:
@@ -1629,16 +1631,19 @@ static int _ruby_ibm_db_bind_column_helper(stmt_handle *stmt_res)
1629
1631
  column_type = stmt_res->column_info[i].type;
1630
1632
  row_data = &stmt_res->row_data[i].data;
1631
1633
 
1634
+ bindCol_args->col_num = (SQLUSMALLINT) i+1;
1635
+
1632
1636
  switch(column_type) {
1633
1637
  case SQL_CHAR:
1634
1638
  case SQL_WCHAR:
1635
1639
  case SQL_VARCHAR:
1636
1640
  case SQL_WVARCHAR:
1641
+ case SQL_GRAPHIC:
1642
+ case SQL_VARGRAPHIC:
1637
1643
  #ifndef PASE /* i5/OS EBCIDIC<->ASCII related - we do getdata call instead */
1638
1644
  case SQL_LONGVARCHAR:
1639
1645
  case SQL_WLONGVARCHAR:
1640
1646
 
1641
- bindCol_args->col_num = (SQLUSMALLINT) i+1;
1642
1647
  #ifdef UNICODE_SUPPORT_VERSION
1643
1648
  bindCol_args->TargetType = SQL_C_WCHAR;
1644
1649
  bindCol_args->buff_length = (stmt_res->column_info[i].size+1) * sizeof(SQLWCHAR);
@@ -1647,6 +1652,13 @@ static int _ruby_ibm_db_bind_column_helper(stmt_handle *stmt_res)
1647
1652
  #else
1648
1653
  bindCol_args->TargetType = SQL_C_CHAR;
1649
1654
  bindCol_args->buff_length = stmt_res->column_info[i].size+1;
1655
+ if( column_type == SQL_GRAPHIC || column_type == SQL_VARGRAPHIC ){
1656
+ /* Graphic string is 2 byte character string.
1657
+ * Size multiply by 2 is required only for non-unicode support version because the W equivalent functions return
1658
+ * SQLType as wchar or wvarchar, respectively. Hence is handled properly.
1659
+ */
1660
+ bindCol_args->buff_length = bindCol_args->buff_length * 2;
1661
+ }
1650
1662
  row_data->str_val = ALLOC_N(char, bindCol_args->buff_length);
1651
1663
  #endif
1652
1664
  bindCol_args->TargetValuePtr = row_data->str_val;
@@ -1668,7 +1680,6 @@ static int _ruby_ibm_db_bind_column_helper(stmt_handle *stmt_res)
1668
1680
  case SQL_LONGVARBINARY:
1669
1681
  #endif /* PASE */
1670
1682
  case SQL_VARBINARY:
1671
- bindCol_args->col_num = (SQLUSMALLINT) i+1;
1672
1683
  bindCol_args->out_length = (SQLLEN *) (&stmt_res->row_data[i].out_length);
1673
1684
 
1674
1685
  if ( stmt_res->s_bin_mode == CONVERT ) {
@@ -1703,7 +1714,6 @@ static int _ruby_ibm_db_bind_column_helper(stmt_handle *stmt_res)
1703
1714
  case SQL_TYPE_TIMESTAMP:
1704
1715
  case SQL_BIGINT:
1705
1716
  case SQL_DECFLOAT:
1706
- bindCol_args->col_num = (SQLUSMALLINT) i+1;
1707
1717
  bindCol_args->TargetType = SQL_C_CHAR;
1708
1718
  bindCol_args->buff_length = stmt_res->column_info[i].size+1;
1709
1719
  row_data->str_val = ALLOC_N(char, bindCol_args->buff_length);
@@ -1719,7 +1729,6 @@ static int _ruby_ibm_db_bind_column_helper(stmt_handle *stmt_res)
1719
1729
  break;
1720
1730
 
1721
1731
  case SQL_SMALLINT:
1722
- bindCol_args->col_num = (SQLUSMALLINT) i+1;
1723
1732
  bindCol_args->TargetType = SQL_C_DEFAULT;
1724
1733
  bindCol_args->buff_length = sizeof(row_data->s_val);
1725
1734
  bindCol_args->TargetValuePtr = &row_data->s_val;
@@ -1734,7 +1743,6 @@ static int _ruby_ibm_db_bind_column_helper(stmt_handle *stmt_res)
1734
1743
  break;
1735
1744
 
1736
1745
  case SQL_INTEGER:
1737
- bindCol_args->col_num = (SQLUSMALLINT) i+1;
1738
1746
  bindCol_args->TargetType = SQL_C_DEFAULT;
1739
1747
  bindCol_args->buff_length = sizeof(row_data->i_val);
1740
1748
  bindCol_args->TargetValuePtr = &row_data->i_val;
@@ -1750,7 +1758,6 @@ static int _ruby_ibm_db_bind_column_helper(stmt_handle *stmt_res)
1750
1758
 
1751
1759
  case SQL_REAL:
1752
1760
  case SQL_FLOAT:
1753
- bindCol_args->col_num = (SQLUSMALLINT) i+1;
1754
1761
  bindCol_args->TargetType = SQL_C_DEFAULT;
1755
1762
  bindCol_args->buff_length = sizeof(row_data->f_val);
1756
1763
  bindCol_args->TargetValuePtr = &row_data->f_val;
@@ -1765,7 +1772,6 @@ static int _ruby_ibm_db_bind_column_helper(stmt_handle *stmt_res)
1765
1772
  break;
1766
1773
 
1767
1774
  case SQL_DOUBLE:
1768
- bindCol_args->col_num = (SQLUSMALLINT) i+1;
1769
1775
  bindCol_args->TargetType = SQL_C_DEFAULT;
1770
1776
  bindCol_args->buff_length = sizeof(row_data->d_val);
1771
1777
  bindCol_args->TargetValuePtr = &row_data->d_val;
@@ -1781,7 +1787,6 @@ static int _ruby_ibm_db_bind_column_helper(stmt_handle *stmt_res)
1781
1787
 
1782
1788
  case SQL_DECIMAL:
1783
1789
  case SQL_NUMERIC:
1784
- bindCol_args->col_num = (SQLUSMALLINT) i+1;
1785
1790
  bindCol_args->TargetType = SQL_C_CHAR;
1786
1791
  bindCol_args->buff_length = stmt_res->column_info[i].size +
1787
1792
  stmt_res->column_info[i].scale + 2 + 1;
@@ -1801,7 +1806,6 @@ static int _ruby_ibm_db_bind_column_helper(stmt_handle *stmt_res)
1801
1806
  stmt_res->row_data[i].out_length = 0;
1802
1807
  stmt_res->column_info[i].loc_type = SQL_CLOB_LOCATOR;
1803
1808
 
1804
- bindCol_args->col_num = (SQLUSMALLINT) i+1;
1805
1809
  bindCol_args->TargetType = stmt_res->column_info[i].loc_type;
1806
1810
  bindCol_args->buff_length = 4;
1807
1811
  bindCol_args->TargetValuePtr = &stmt_res->column_info[i].lob_loc;
@@ -1818,7 +1822,6 @@ static int _ruby_ibm_db_bind_column_helper(stmt_handle *stmt_res)
1818
1822
  stmt_res->row_data[i].out_length = 0;
1819
1823
  stmt_res->column_info[i].loc_type = SQL_BLOB_LOCATOR;
1820
1824
 
1821
- bindCol_args->col_num = (SQLUSMALLINT) i+1;
1822
1825
  bindCol_args->TargetType = stmt_res->column_info[i].loc_type;
1823
1826
  bindCol_args->buff_length = 4;
1824
1827
  bindCol_args->TargetValuePtr = &stmt_res->column_info[i].lob_loc;
@@ -5638,13 +5641,20 @@ static int _ruby_ibm_db_bind_parameter_helper(stmt_handle *stmt_res, param_node
5638
5641
  curr->ivalue = curr->param_size;
5639
5642
  }
5640
5643
  } else {
5641
- if (curr->ivalue < ( curr->param_size * sizeof(SQLWCHAR) ) ) {
5642
- curr->ivalue = curr->param_size * sizeof(SQLWCHAR);
5644
+ if (curr->ivalue < ( (curr->param_size + 1) * sizeof(SQLWCHAR) ) ) {
5645
+ curr->ivalue = (curr->param_size + 1)* sizeof(SQLWCHAR);
5643
5646
  }
5644
5647
  }
5645
5648
  #else
5646
5649
  if (curr->ivalue < curr->param_size ) {
5647
- curr->ivalue = curr->param_size;
5650
+ curr->ivalue = curr->param_size + 1;
5651
+ }
5652
+
5653
+ if ( curr->data_type == SQL_GRAPHIC || curr->data_type == SQL_VARGRAPHIC ){
5654
+ /* graphic strings are 2 byte characters.
5655
+ * Not required for unicode support, as datatype is w equivalent of char.
5656
+ */
5657
+ curr->ivalue = curr->ivalue * 2;
5648
5658
  }
5649
5659
  #endif
5650
5660
  } else {
@@ -5663,6 +5673,12 @@ static int _ruby_ibm_db_bind_parameter_helper(stmt_handle *stmt_res, param_node
5663
5673
  if( curr->size > curr->ivalue ) {
5664
5674
  curr->ivalue = curr->size + 1;
5665
5675
  }
5676
+ if ( curr->data_type == SQL_GRAPHIC || curr->data_type == SQL_VARGRAPHIC ){
5677
+ /* graphic strings are 2 byte characters.
5678
+ * Not required for unicode support, as datatype is w equivalent of char.
5679
+ */
5680
+ curr->ivalue = curr->ivalue * 2;
5681
+ }
5666
5682
  #endif
5667
5683
  } else {
5668
5684
  #ifdef UNICODE_SUPPORT_VERSION
@@ -5673,6 +5689,12 @@ static int _ruby_ibm_db_bind_parameter_helper(stmt_handle *stmt_res, param_node
5673
5689
  }
5674
5690
  #else
5675
5691
  curr->ivalue = curr->size + 1;
5692
+ if ( curr->data_type == SQL_GRAPHIC || curr->data_type == SQL_VARGRAPHIC ){
5693
+ /* graphic strings are 2 byte characters.
5694
+ * Not required for unicode support, as datatype is w equivalent of char.
5695
+ */
5696
+ curr->ivalue = curr->ivalue * 2;
5697
+ }
5676
5698
  #endif
5677
5699
  }
5678
5700
  }
@@ -5699,11 +5721,7 @@ static int _ruby_ibm_db_bind_parameter_helper(stmt_handle *stmt_res, param_node
5699
5721
  paramValuePtr = (SQLPOINTER)curr->svalue;
5700
5722
  } else if (curr->param_type == SQL_PARAM_INPUT_OUTPUT) {
5701
5723
  curr->bind_indicator = origlen;
5702
- #ifdef UNICODE_SUPPORT_VERSION
5703
- bindParameter_args->buff_length = curr->ivalue/sizeof(SQLWCHAR);
5704
- #else
5705
5724
  bindParameter_args->buff_length = curr->ivalue;
5706
- #endif
5707
5725
  paramValuePtr = (SQLPOINTER)curr->svalue;
5708
5726
  } else {
5709
5727
  curr->bind_indicator = SQL_DATA_AT_EXEC;
@@ -5752,20 +5770,17 @@ static int _ruby_ibm_db_bind_parameter_helper(stmt_handle *stmt_res, param_node
5752
5770
 
5753
5771
  /* This option should handle most other types such as DATE, VARCHAR etc */
5754
5772
  default:
5755
- if ( curr->param_type == SQL_PARAM_OUTPUT ) {
5756
- curr->bind_indicator = curr->ivalue;
5757
- bindParameter_args->buff_length = curr->ivalue;
5758
- } else if (curr->param_type == SQL_PARAM_INPUT_OUTPUT) {
5773
+ if ( curr->param_type == SQL_PARAM_INPUT_OUTPUT ) {
5759
5774
  curr->bind_indicator = origlen;
5760
- #ifdef UNICODE_SUPPORT_VERSION
5761
- bindParameter_args->buff_length = curr->ivalue/sizeof(SQLWCHAR);
5762
- #else
5763
- bindParameter_args->buff_length = curr->ivalue;
5764
- #endif
5765
5775
  } else {
5766
- curr->bind_indicator = curr->ivalue;
5767
- bindParameter_args->buff_length = curr->ivalue/sizeof(SQLWCHAR);
5776
+ if( curr->param_type == SQL_PARAM_INPUT &&
5777
+ (curr->data_type == SQL_GRAPHIC || curr->data_type == SQL_VARGRAPHIC)){
5778
+ curr->bind_indicator = origlen;
5779
+ } else {
5780
+ curr->bind_indicator = curr->ivalue;
5781
+ }
5768
5782
  }
5783
+ bindParameter_args->buff_length = curr->ivalue;
5769
5784
  #ifdef UNICODE_SUPPORT_VERSION
5770
5785
  valueType = SQL_C_WCHAR;
5771
5786
  #else
@@ -8266,6 +8281,8 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
8266
8281
  case SQL_WCHAR:
8267
8282
  case SQL_VARCHAR:
8268
8283
  case SQL_WVARCHAR:
8284
+ case SQL_GRAPHIC:
8285
+ case SQL_VARGRAPHIC:
8269
8286
  #ifndef PASE /* i5/OS SQL_LONGVARCHAR is SQL_VARCHAR */
8270
8287
  case SQL_LONGVARCHAR:
8271
8288
  case SQL_WLONGVARCHAR:
@@ -8275,6 +8292,13 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
8275
8292
  out_ptr = (SQLPOINTER)ALLOC_N(SQLWCHAR,in_length);
8276
8293
  memset(out_ptr, '\0', in_length * sizeof(SQLWCHAR) );
8277
8294
  #else
8295
+ if( column_type == SQL_GRAPHIC || column_type == SQL_VARGRAPHIC ) {
8296
+ /* Graphic string is 2 byte character string.
8297
+ * Size multiply by 2 is required only for non-unicode support version because the W equivalent functions return
8298
+ * SQLType as wchar or wvarchar, respectively. Hence is handled properly.
8299
+ */
8300
+ in_length = in_length * 2;
8301
+ }
8278
8302
  out_ptr = (SQLPOINTER)ALLOC_N(char,in_length);
8279
8303
  memset(out_ptr, '\0', in_length);
8280
8304
  #endif
@@ -8797,6 +8821,8 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
8797
8821
  case SQL_WCHAR:
8798
8822
  case SQL_VARCHAR:
8799
8823
  case SQL_WVARCHAR:
8824
+ case SQL_GRAPHIC:
8825
+ case SQL_VARGRAPHIC:
8800
8826
  #ifndef PASE /* i5/OS SQL_LONGVARCHAR is SQL_VARCHAR */
8801
8827
  case SQL_LONGVARCHAR:
8802
8828
  case SQL_WLONGVARCHAR:
@@ -9750,11 +9776,11 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
9750
9776
  #ifndef UNICODE_SUPPORT_VERSION
9751
9777
  char buffer11[11];
9752
9778
  char buffer255[255];
9753
- char buffer2k[2048];
9779
+ char buffer3k[3072]; /*Informix server returns SQL_KEYWORDS data, which requires 2608*/
9754
9780
  #else
9755
9781
  SQLWCHAR buffer11[11];
9756
9782
  SQLWCHAR buffer255[255];
9757
- SQLWCHAR buffer2k[2048];
9783
+ SQLWCHAR buffer3k[3072]; /*Informix server returns SQL_KEYWORDS data, which requires 2608*/
9758
9784
  #endif
9759
9785
 
9760
9786
  SQLSMALLINT bufferint16;
@@ -9889,11 +9915,11 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
9889
9915
 
9890
9916
  /* KEYWORDS */
9891
9917
  getInfo_args->infoType = SQL_KEYWORDS;
9892
- getInfo_args->infoValue = (SQLPOINTER)buffer2k;
9893
- getInfo_args->buff_length = sizeof( buffer2k );
9918
+ getInfo_args->infoValue = (SQLPOINTER)buffer3k;
9919
+ getInfo_args->buff_length = sizeof( buffer3k );
9894
9920
  out_length = 0;
9895
9921
 
9896
- memset(buffer2k, '\0', sizeof(buffer2k));
9922
+ memset(buffer3k, '\0', sizeof(buffer3k));
9897
9923
  rc = _ruby_ibm_db_SQLGetInfo_helper( getInfo_args );
9898
9924
 
9899
9925
  if ( rc == SQL_ERROR ) {
@@ -9903,10 +9929,10 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
9903
9929
  VALUE keywordsStr, keywordsArray;
9904
9930
 
9905
9931
  #ifdef UNICODE_SUPPORT_VERSION
9906
- keywordsStr = _ruby_ibm_db_export_sqlwchar_to_utf8_rstr(buffer2k, out_length);
9932
+ keywordsStr = _ruby_ibm_db_export_sqlwchar_to_utf8_rstr(buffer3k, out_length);
9907
9933
  keywordsArray = rb_str_split(keywordsStr, RSTRING_PTR(_ruby_ibm_db_export_char_to_utf8_rstr(",")) );
9908
9934
  #else
9909
- keywordsStr = rb_str_new2( buffer2k );
9935
+ keywordsStr = rb_str_new2( buffer3k );
9910
9936
  keywordsArray = rb_str_split(keywordsStr, ",");
9911
9937
  #endif
9912
9938
 
@@ -232,6 +232,8 @@ module ActiveRecord
232
232
  :binary
233
233
  when /smallint/i
234
234
  :boolean
235
+ when /bigint/i
236
+ :bigint
235
237
  when /int|serial/i
236
238
  :integer
237
239
  when /decimal|numeric|decfloat/i
@@ -244,7 +246,11 @@ module ActiveRecord
244
246
  :time
245
247
  when /date/i
246
248
  :date
247
- when /clob|text|graphic/i
249
+ when /vargraphic/i
250
+ :vargraphic
251
+ when /graphic/i
252
+ :graphic
253
+ when /clob|text/i
248
254
  :text
249
255
  when /xml/i
250
256
  :xml
@@ -283,9 +289,9 @@ module ActiveRecord
283
289
  if args.last.is_a?(Hash)
284
290
  options = args.delete_at(args.length-1)
285
291
  end
286
- sql = "ALTER TABLE #{@base.quote_table_name(@table_name)} ADD COLUMN "
292
+ sql_segment = "ALTER TABLE #{@base.quote_table_name(@table_name)} ADD COLUMN "
287
293
  args.each do | name |
288
- sql << "#{@base.quote_column_name(name)} xml"
294
+ sql = sql_segment + " #{@base.quote_column_name(name)} xml"
289
295
  @base.execute(sql,"add_xml_column")
290
296
  end
291
297
  return self
@@ -303,6 +309,21 @@ module ActiveRecord
303
309
  return self
304
310
  end
305
311
 
312
+ def graphic(*args)
313
+ ibm_parse_column_attributes_args('graphic',*args)
314
+ return self
315
+ end
316
+
317
+ def vargraphic(*args)
318
+ ibm_parse_column_attributes_args('vargraphic',*args)
319
+ return self
320
+ end
321
+
322
+ def bigint(*args)
323
+ ibm_parse_column_attributes_args('bigint',*args)
324
+ return self
325
+ end
326
+
306
327
  #Method to support the new syntax of rails 2.0 migrations (short-hand definitions) for columns of type char [character]
307
328
  def char(*args)
308
329
  ibm_parse_column_attributes_args('char',*args)
@@ -343,6 +364,21 @@ module ActiveRecord
343
364
  return self
344
365
  end
345
366
 
367
+ def graphic(*args)
368
+ ibm_parse_column_attributes_args('graphic',*args)
369
+ return self
370
+ end
371
+
372
+ def vargraphic(*args)
373
+ ibm_parse_column_attributes_args('vargraphic',*args)
374
+ return self
375
+ end
376
+
377
+ def bigint(*args)
378
+ ibm_parse_column_attributes_args('bigint',*args)
379
+ return self
380
+ end
381
+
346
382
  #Method to support the new syntax of rails 2.0 migrations (short-hand definitions) for columns of type char [character]
347
383
  def char(*args)
348
384
  ibm_parse_column_attributes_args('char',*args)
@@ -456,6 +492,7 @@ module ActiveRecord
456
492
  @set_quoted_literal_replacement = IBM_DB::QUOTED_LITERAL_REPLACEMENT_ON
457
493
  end
458
494
 
495
+ @app_user = @account = @application = @workstation = nil
459
496
  # Caching database connection options (auditing and billing support)
460
497
  @app_user = conn_options[:app_user] if conn_options.has_key?(:app_user)
461
498
  @account = conn_options[:account] if conn_options.has_key?(:account)
@@ -1236,12 +1273,15 @@ module ActiveRecord
1236
1273
  :serial => { :name => "serial" }, # rowid is a supported datatype on Informix Dynamic Server
1237
1274
  :char => { :name => "char" },
1238
1275
  :double => { :name => @servertype.get_double_mapping },
1239
- :decfloat => { :name => "decfloat"}
1276
+ :decfloat => { :name => "decfloat"},
1277
+ :graphic => { :name => "graphic", :limit => 1},
1278
+ :vargraphic => { :name => "vargraphic", :limit => 1},
1279
+ :bigint => { :name => "bigint"}
1240
1280
  }
1241
1281
  end
1242
1282
 
1243
1283
  # IBM data servers do not support limits on certain data types (unlike MySQL)
1244
- # Limit is supported for the {float, decimal, numeric, varchar, clob, blob} data types.
1284
+ # Limit is supported for the {float, decimal, numeric, varchar, clob, blob, graphic, vargraphic} data types.
1245
1285
  def type_to_sql(type, limit = nil, precision = nil, scale = nil)
1246
1286
  if type.to_sym == :decfloat
1247
1287
  sql_segment = native_database_types[type.to_sym][:name].to_s
@@ -1502,7 +1542,7 @@ module ActiveRecord
1502
1542
  !column_type =~ /char|lob|graphic/i
1503
1543
  if column_type =~ /decimal/i
1504
1544
  column_type << "(#{column_length},#{column_scale})"
1505
- elsif column_type =~ /smallint|integer|double|date|time|timestamp|xml/i
1545
+ elsif column_type =~ /smallint|integer|double|date|time|timestamp|xml|bigint/i
1506
1546
  column_type << "" # override native limits incompatible with table create
1507
1547
  else
1508
1548
  column_type << "(#{column_length})"
@@ -1791,11 +1831,16 @@ To remove the column, the table must be dropped and recreated without the #{colu
1791
1831
  end
1792
1832
 
1793
1833
  def limit_not_supported_types
1794
- [:integer, :double, :date, :time, :timestamp, :xml]
1834
+ [:integer, :double, :date, :time, :timestamp, :xml, :bigint]
1795
1835
  end
1796
1836
  end # class IBM_DataServer
1797
1837
 
1798
1838
  class IBM_DB2 < IBM_DataServer
1839
+ def initialize(adapter)
1840
+ super(adapter)
1841
+ @limit = @offset = nil
1842
+ end
1843
+
1799
1844
  def rename_column(table_name, column_name, new_column_name)
1800
1845
  raise NotImplementedError, "rename_column is not implemented yet in the IBM_DB Adapter"
1801
1846
  end
@@ -1872,12 +1917,9 @@ The column datatype change to [#{data_type}] is not supported by this data serve
1872
1917
  # DB2 specific ALTER TABLE statement to add a default clause
1873
1918
  def change_column_default(table_name, column_name, default)
1874
1919
  # SQL statement which alters column's default value
1875
- if default.nil?
1876
- change_column_sql = "ALTER TABLE #{table_name} ALTER #{column_name} DROP DEFAULT"
1877
- else
1878
- change_column_sql = "ALTER TABLE #{table_name} ALTER COLUMN #{column_name} \
1920
+ change_column_sql = "ALTER TABLE #{table_name} ALTER COLUMN #{column_name} \
1879
1921
  SET WITH DEFAULT #{@adapter.quote(default)}"
1880
- end
1922
+
1881
1923
  stmt = execute(change_column_sql)
1882
1924
  reorg_table(table_name)
1883
1925
  ensure
@@ -1889,16 +1931,17 @@ SET WITH DEFAULT #{@adapter.quote(default)}"
1889
1931
  if !default.nil?
1890
1932
  change_column_default(table_name, column_name, default)
1891
1933
  end
1892
- #reorg_table(table_name)
1934
+
1893
1935
  if !null.nil?
1894
1936
  if null
1895
1937
  change_column_sql = "ALTER TABLE #{table_name} ALTER #{column_name} DROP NOT NULL"
1896
1938
  else
1897
1939
  change_column_sql = "ALTER TABLE #{table_name} ALTER #{column_name} SET NOT NULL"
1898
- end
1940
+ end
1941
+ stmt = execute(change_column_sql)
1942
+ reorg_table(table_name)
1899
1943
  end
1900
- stmt = execute(change_column_sql)
1901
- reorg_table(table_name)
1944
+
1902
1945
  ensure
1903
1946
  IBM_DB.free_stmt(stmt) if stmt
1904
1947
  end
@@ -2200,7 +2243,7 @@ SET WITH DEFAULT #{@adapter.quote(default)}"
2200
2243
  # Cobra supports parameterised timestamp,
2201
2244
  # hence overriding following method to allow timestamp datatype to be parameterised
2202
2245
  def limit_not_supported_types
2203
- [:integer, :double, :date, :time, :xml]
2246
+ [:integer, :double, :date, :time, :xml, :bigint]
2204
2247
  end
2205
2248
 
2206
2249
  # Alter table column for renaming a column
@@ -2445,10 +2488,11 @@ SET WITH DEFAULT #{@adapter.quote(default)}"
2445
2488
  change_column_sql = "ALTER TABLE #{table_name} MODIFY #{column_name} #{sql_type} NOT NULL"
2446
2489
  else
2447
2490
  change_column_sql = "ALTER TABLE #{table_name} MODIFY #{column_name} #{sql_type}"
2448
- end
2491
+ end
2492
+ stmt = execute(change_column_sql)
2493
+ reorg_table(table_name)
2449
2494
  end
2450
- stmt = execute(change_column_sql)
2451
- reorg_table(table_name)
2495
+
2452
2496
  ensure
2453
2497
  IBM_DB.free_stmt(stmt) if stmt
2454
2498
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibm_db
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.5
5
5
  platform: mswin32
6
6
  authors:
7
7
  - IBM
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-05-12 00:00:00 +05:30
12
+ date: 2010-07-15 00:00:00 +05:30
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency