ibm_db 2.5.12-x86-mingw32 → 2.5.14-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bd58b68a2f0e1cd82f73c7637e2b05ec01b701aa
4
+ data.tar.gz: 1d2a8007e8e66622b8d0ab694a7b35ccfccae3c2
5
+ SHA512:
6
+ metadata.gz: 4d46d9650f7193d5602f1fc295fa0a8e021733c3543e6817388aaeb2d77adfec4bc21b62fbad30bd0c9eeaf1f97cc2801f6c455edb82f0569e8240f4aa0340b1
7
+ data.tar.gz: 7b5057c2699b716d350230efd53811bdd9e31f4b884448030a386172be427fa2d68a782e237bda3bd63799a1a539e2dc4943d1351adfd53a9af85b914e87d415
data/CHANGES CHANGED
@@ -1,8 +1,12 @@
1
1
  Change Log
2
2
  ==============
3
+ 2014/02/11 (IBM_DB adapter 2.5.14, driver 2.5.14) :
4
+ - Support for Rails 4
5
+ - Support for ruby-2.0
6
+
3
7
  2014/01/28 (IBM_DB adapter 2.5.12, driver 2.5.11) :
4
8
  - Supporting usage of name ibmdb as adapter along with current name ibm_db to support requirements of cloud environments
5
-
9
+
6
10
  2012/12/07 (IBM_DB adapter 2.5.11, driver 2.5.11) :
7
11
  - Fixed bug #29633 - Deletes cause too many handles to be consumed and not freed
8
12
  - Support for Mac OS CLI library loading to check create and drop db functionality - #29625
data/README CHANGED
@@ -1,5 +1,5 @@
1
1
  =====================================================================
2
- README for the IBM_DB Adapter (2.5.12) and Driver (2.5.11) (2014/01/28)
2
+ README for the IBM_DB Adapter (2.5.14) and Driver (2.5.14) (2014/02/11)
3
3
  For ActiveRecord Version >= 1.15.5 (and Rails >= 1.2.5)
4
4
  =====================================================================
5
5
 
@@ -47,7 +47,12 @@ Note : - 1) If using activerecord version below 2.0 then it requires that the ib
47
47
  Installing ri documentation for ibm_db-2.5.9-x86-mingw32...
48
48
  Installing RDoc documentation for ibm_db-2.5.9-x86-mingw32...
49
49
 
50
- Note: The manual step after install if using activerecord version below 2.0:
50
+ Note:
51
+ 1) Currently Ruby-2.0 64-bit version on Windows is not supported as there are issues related to SQL definitions with the mingW compiler
52
+ [Details can be found here https://sourceforge.net/p/mingw/bugs/2041/ ].
53
+ Support will be enabled after the abive reported issue is resolved.
54
+
55
+ 2)The manual step after install if using activerecord version below 2.0:
51
56
  add ibm_db into GEM_HOME\1.8\gems\activerecord-1.15.3\lib\active_record.rb (Line 77)
52
57
 
53
58
  2. Linux and Unix platforms:
@@ -61,7 +66,7 @@ Note : - 1) If using activerecord version below 2.0 then it requires that the ib
61
66
  Note: DB2 environment is required while using an arbitrary user account
62
67
  (other than the DB2 install user account)
63
68
  $ . /home/db2inst1/sqllib/db2profile
64
- $ export IBM_DB_DIR=DB2HOME (eg. /home/db2inst1/sqllib or /opt/ibm/db2/v9.5)
69
+ $ export IBM_DB_HOME=DB2HOME (eg. /home/db2inst1/sqllib or /opt/ibm/db2/v9.5)
65
70
  $ gem install ibm_db
66
71
  Building native extensions. This could take a while...
67
72
  Successfully installed ibm_db-2.5.9
@@ -109,12 +114,12 @@ here only for reference.
109
114
  $ . /home/db2inst1/sqllib/db2profile
110
115
 
111
116
  - To compile and link with DB2 client libraries:
112
- $ export IBM_DB_DIR=DB2HOME (eg. /home/db2inst1/sqllib or /opt/ibm/db2/v9.5)
117
+ $ export IBM_DB_HOME=DB2HOME (eg. /home/db2inst1/sqllib or /opt/ibm/db2/v9.5)
113
118
 
114
119
  Windows platforms:
115
120
  - Set ruby devkit environment:
116
121
  - To compile and link with DB2 client libraries:
117
- $ set IBM_DB_DIR=DB2HOME (eg. C:\Program Files\IBM\SQLLIB)
122
+ $ set IBM_DB_HOME=DB2HOME (eg. C:\Program Files\IBM\SQLLIB)
118
123
 
119
124
  Build the driver:
120
125
  - $ cd rubyibm_source/IBM_DB_Adapter/ibm_db/ext
data/ext/extconf.rb CHANGED
@@ -85,7 +85,7 @@ def crash(str)
85
85
  exit 1
86
86
  end
87
87
 
88
- if( RUBY_VERSION =~ /1.9/)
88
+ if( RUBY_VERSION =~ /1.9/ || RUBY_VERSION =~ /2./)
89
89
  create_header('gil_release_version')
90
90
  create_header('unicode_support_version')
91
91
  end
data/ext/ibm_db.c CHANGED
@@ -12,7 +12,7 @@
12
12
  +----------------------------------------------------------------------+
13
13
  */
14
14
 
15
- #define MODULE_RELEASE "2.5.11"
15
+ #define MODULE_RELEASE "2.5.14"
16
16
 
17
17
  #ifdef HAVE_CONFIG_H
18
18
  #include "config.h"
@@ -225,6 +225,7 @@ void Init_ibm_db(void) {
225
225
  rb_define_module_function(mDB, "next_result", ibm_db_next_result, -1);
226
226
  rb_define_module_function(mDB, "num_fields", ibm_db_num_fields, -1);
227
227
  rb_define_module_function(mDB, "num_rows", ibm_db_num_rows, -1);
228
+ rb_define_module_function(mDB, "resultCols", ibm_db_result_cols, -1);
228
229
  rb_define_module_function(mDB, "field_name", ibm_db_field_name, -1);
229
230
  rb_define_module_function(mDB, "field_display_size", ibm_db_field_display_size, -1);
230
231
  rb_define_module_function(mDB, "field_num", ibm_db_field_num, -1);
@@ -9964,6 +9965,101 @@ VALUE ibm_db_fetch_row(int argc, VALUE *argv, VALUE self)
9964
9965
 
9965
9966
  return ret_val;
9966
9967
  }
9968
+
9969
+ /* */
9970
+ /*
9971
+ *IBM_DB.resultCols -- Returns an array of column names in a result set
9972
+ *
9973
+ * ===Description
9974
+ * array IBM_DB.resultCols ( resource stmt )
9975
+ *
9976
+ * Returns an array of column names in a result set.
9977
+ *
9978
+ * ===Parameters
9979
+ * stmt
9980
+ * A valid stmt resource containing a result set.
9981
+ *
9982
+ * ===Return Values
9983
+ *
9984
+ * Returns an array of column names in the result set. Raises exception on Error.
9985
+ *
9986
+ */
9987
+ VALUE ibm_db_result_cols(int argc, VALUE *argv, VALUE self) {
9988
+ VALUE stmt = Qnil;
9989
+ VALUE ret_val = Qnil;
9990
+
9991
+ VALUE error = Qnil;
9992
+ VALUE colName = Qnil;
9993
+ VALUE return_value = Qnil;
9994
+
9995
+ stmt_handle *stmt_res = NULL;
9996
+
9997
+ int index = 0;
9998
+
9999
+ rb_scan_args(argc, argv, "1", &stmt);
10000
+
10001
+ if (!NIL_P(stmt)) {
10002
+ Data_Get_Struct(stmt, stmt_handle, stmt_res);
10003
+ } else {
10004
+ rb_warn("Invalid statement resource specified");
10005
+ return Qnil;
10006
+ }
10007
+
10008
+ if ( stmt_res->column_info == NULL ) {
10009
+ if (_ruby_ibm_db_get_result_set_info(stmt_res)<0) {
10010
+ if( stmt_res != NULL && stmt_res->ruby_stmt_err_msg != NULL ) {
10011
+ #ifdef UNICODE_SUPPORT_VERSION
10012
+ error = rb_str_concat( _ruby_ibm_db_export_char_to_utf8_rstr("Column information cannot be retrieved: "),
10013
+ _ruby_ibm_db_export_sqlwchar_to_utf8_rstr(stmt_res->ruby_stmt_err_msg,
10014
+ stmt_res->ruby_stmt_err_msg_len)
10015
+ );
10016
+ #else
10017
+ error = rb_str_cat2(rb_str_new2("Column information cannot be retrieved: "), stmt_res->ruby_stmt_err_msg );
10018
+ #endif
10019
+ } else {
10020
+ #ifdef UNICODE_SUPPORT_VERSION
10021
+ error = _ruby_ibm_db_export_char_to_utf8_rstr("Column information cannot be retrieved: <error message could not be retrieved>");
10022
+ #else
10023
+ error = rb_str_new2("Column information cannot be retrieved: <error message could not be retrieved>");
10024
+ #endif
10025
+ }
10026
+ rb_throw( RSTRING_PTR(error), Qnil );
10027
+ }
10028
+ }
10029
+
10030
+ return_value = rb_ary_new();
10031
+
10032
+ for (index=0; index<stmt_res->num_columns; index++) {
10033
+ switch(stmt_res->s_case_mode) {
10034
+ case CASE_LOWER:
10035
+ #ifdef UNICODE_SUPPORT_VERSION
10036
+ strtolower((char*)stmt_res->column_info[index].name, stmt_res->column_info[index].name_length * sizeof(SQLWCHAR));
10037
+ #else
10038
+ strtolower((char*)stmt_res->column_info[index].name, strlen((char*)stmt_res->column_info[index].name));
10039
+ #endif
10040
+ break;
10041
+ case CASE_UPPER:
10042
+ #ifdef UNICODE_SUPPORT_VERSION
10043
+ strtoupper((char*)stmt_res->column_info[index].name, stmt_res->column_info[index].name_length * sizeof(SQLWCHAR) );
10044
+ #else
10045
+ strtoupper((char*)stmt_res->column_info[index].name, strlen((char*)stmt_res->column_info[index].name));
10046
+ #endif
10047
+ break;
10048
+ case CASE_NATURAL:
10049
+ default:
10050
+ break;
10051
+ }
10052
+ #ifdef UNICODE_SUPPORT_VERSION
10053
+ colName = _ruby_ibm_db_export_sqlwchar_to_utf8_rstr(stmt_res->column_info[index].name, stmt_res->column_info[index].name_length * sizeof(SQLWCHAR) );
10054
+ #else
10055
+ colName = rb_str_new2((char*)stmt_res->column_info[index].name);
10056
+ #endif
10057
+
10058
+ rb_ary_store(return_value, index, colName);
10059
+ }
10060
+
10061
+ return return_value;
10062
+ }
9967
10063
  /* */
9968
10064
 
9969
10065
  /*
data/ext/ruby_ibm_db.h CHANGED
@@ -171,6 +171,7 @@ VALUE ibm_db_stmt_error(int argc, VALUE *argv, VALUE self);
171
171
  VALUE ibm_db_next_result(int argc, VALUE *argv, VALUE self);
172
172
  VALUE ibm_db_num_fields(int argc, VALUE *argv, VALUE self);
173
173
  VALUE ibm_db_num_rows(int argc, VALUE *argv, VALUE self);
174
+ VALUE ibm_db_result_cols(int argc, VALUE *argv, VALUE self);
174
175
  VALUE ibm_db_field_name(int argc, VALUE *argv, VALUE self);
175
176
  VALUE ibm_db_field_display_size(int argc, VALUE *argv, VALUE self);
176
177
  VALUE ibm_db_field_num(int argc, VALUE *argv, VALUE self);
@@ -9,8 +9,54 @@
9
9
  # +----------------------------------------------------------------------+
10
10
 
11
11
  require 'active_record/connection_adapters/abstract_adapter'
12
+ require 'arel/visitors/bind_visitor'
12
13
 
13
14
  module ActiveRecord
15
+ class Relation
16
+ def insert(values)
17
+ primary_key_value = nil
18
+
19
+ if primary_key && Hash === values
20
+ primary_key_value = values[values.keys.find { |k|
21
+ k.name == primary_key
22
+ }]
23
+
24
+ if !primary_key_value && connection.prefetch_primary_key?(klass.table_name)
25
+ primary_key_value = connection.next_sequence_value(klass.sequence_name)
26
+ values[klass.arel_table[klass.primary_key]] = primary_key_value
27
+ end
28
+ end
29
+
30
+ im = arel.create_insert
31
+ im.into @table
32
+
33
+ conn = @klass.connection
34
+
35
+ substitutes = values.sort_by { |arel_attr,_| arel_attr.name }
36
+ binds = substitutes.map do |arel_attr, value|
37
+ [@klass.columns_hash[arel_attr.name], value]
38
+ end
39
+
40
+ substitutes.each_with_index do |tuple, i|
41
+ tuple[1] = conn.substitute_at(binds[i][0], i)
42
+ end
43
+
44
+ if values.empty? # empty insert
45
+ im.values = Arel.sql(connection.empty_insert_statement_value(klass.primary_key))
46
+ else
47
+ im.insert substitutes
48
+ end
49
+
50
+ conn.insert(
51
+ im,
52
+ 'SQL',
53
+ primary_key,
54
+ primary_key_value,
55
+ nil,
56
+ binds)
57
+ end
58
+ end
59
+
14
60
  class Base
15
61
  # Method required to handle LOBs and XML fields.
16
62
  # An after save callback checks if a marker has been inserted through
@@ -116,6 +162,14 @@ module ActiveRecord
116
162
  require 'active_record/connection_adapters/ibm_db_pstmt'
117
163
  end
118
164
 
165
+ # Check if class TableDefinition responds to indexes method to determine if we are on AR 3 or AR 4.
166
+ # This is a interim hack ti ensure backward compatibility. To remove as we move out of AR 3 support or have a better way to determine which version of AR being run against.
167
+ checkClass = ActiveRecord::ConnectionAdapters::TableDefinition.new(nil)
168
+ if(checkClass.respond_to?(:indexes))
169
+ isAr3 = false
170
+ else
171
+ isAr3 = true
172
+ end
119
173
  # Converts all +config+ keys to symbols
120
174
  config = config.symbolize_keys
121
175
 
@@ -135,7 +189,7 @@ module ActiveRecord
135
189
  end
136
190
 
137
191
  if(config.has_key?(:dbops) && config[:dbops] == true)
138
- return ConnectionAdapters::IBM_DBAdapter.new(nil, logger, config, {})
192
+ return ConnectionAdapters::IBM_DBAdapter.new(nil, isAr3, logger, config, {})
139
193
  end
140
194
 
141
195
  # Retrieves the database alias (local catalog name) or remote name
@@ -210,7 +264,7 @@ module ActiveRecord
210
264
  if connection
211
265
  # Creates an instance of *IBM_DBAdapter* based on the +connection+
212
266
  # and credentials provided in +config+
213
- ConnectionAdapters::IBM_DBAdapter.new(connection, logger, config, conn_options)
267
+ ConnectionAdapters::IBM_DBAdapter.new(connection, isAr3, logger, config, conn_options)
214
268
  else
215
269
  # If the connection failure was not caught previoulsy, it raises a Runtime error
216
270
  raise "An unexpected error occured during connect attempt to [#{database}]"
@@ -224,6 +278,11 @@ module ActiveRecord
224
278
  end # class Base
225
279
 
226
280
  module ConnectionAdapters
281
+ module SchemaStatements
282
+ def create_table_definition(name, temporary, options)
283
+ TableDefinition.new self, name, temporary, options
284
+ end
285
+ end
227
286
  class IBM_DBColumn < Column
228
287
 
229
288
  # Casts value (which is a String) to an appropriate instance
@@ -348,7 +407,26 @@ module ActiveRecord
348
407
  end
349
408
 
350
409
  class TableDefinition
351
-
410
+
411
+ def initialize(base, name=nil, temporary=nil, options=nil)
412
+ if(self.respond_to?(:indexes))
413
+ @ar3 = false
414
+ else
415
+ @ar3 = true
416
+ end
417
+ @columns = []
418
+ @columns_hash = {}
419
+ @indexes = {}
420
+ @base = base
421
+ @temporary = temporary
422
+ @options = options
423
+ @name = name
424
+ end
425
+
426
+ def native
427
+ @base.native_database_types
428
+ end
429
+
352
430
  #Method to parse the passed arguments and create the ColumnDefinition object of the specified type
353
431
  def ibm_parse_column_attributes_args(type, *args)
354
432
  options = {}
@@ -405,8 +483,11 @@ module ActiveRecord
405
483
  # the DEFAULT option for the native XML datatype
406
484
  def column(name, type, options ={})
407
485
  # construct a column definition where @base is adaptor instance
408
- column = ColumnDefinition.new(@base, name, type)
409
-
486
+ if(@ar3)
487
+ column = ColumnDefinition.new(@base, name, type)
488
+ else
489
+ column = ColumnDefinition.new(name, type)
490
+ end
410
491
  # DB2 does not accept DEFAULT NULL option for XML
411
492
  # for table create, but does accept nullable option
412
493
  unless type.to_s == 'xml'
@@ -435,9 +516,12 @@ module ActiveRecord
435
516
  column.limit = @base.native_database_types[type.to_sym][:limit] if @base.native_database_types[type.to_sym].has_key? :limit
436
517
  end
437
518
 
438
- unless @columns.include? column
519
+ unless @columns.nil? or @columns.include? column
439
520
  @columns << column
440
521
  end
522
+
523
+ @columns_hash[name] = column
524
+
441
525
  return self
442
526
  end
443
527
  end
@@ -483,9 +567,14 @@ module ActiveRecord
483
567
  'IBM_DB'
484
568
  end
485
569
 
486
- def initialize(connection, logger, config, conn_options)
570
+ class BindSubstitution < Arel::Visitors::IBM_DB # :nodoc:
571
+ include Arel::Visitors::BindVisitor
572
+ end
573
+
574
+ def initialize(connection, ar3, logger, config, conn_options)
487
575
  # Caching database connection configuration (+connect+ or +reconnect+ support)
488
576
  @connection = connection
577
+ @isAr3 = ar3
489
578
  @conn_options = conn_options
490
579
  @database = config[:database]
491
580
  @username = config[:username]
@@ -530,29 +619,29 @@ module ActiveRecord
530
619
  when /DB2\//i # DB2 for Linux, Unix and Windows (LUW)
531
620
  case server_info.DBMS_VER
532
621
  when /09.07/i # DB2 Version 9.7 (Cobra)
533
- @servertype = IBM_DB2_LUW_COBRA.new(self)
622
+ @servertype = IBM_DB2_LUW_COBRA.new(self, isAr3)
534
623
  else # DB2 Version 9.5 or below
535
- @servertype = IBM_DB2_LUW.new(self)
624
+ @servertype = IBM_DB2_LUW.new(self, @isAr3)
536
625
  end
537
626
  when /DB2/i # DB2 for zOS
538
627
  case server_info.DBMS_VER
539
628
  when /09/ # DB2 for zOS version 9 and version 10
540
- @servertype = IBM_DB2_ZOS.new(self)
629
+ @servertype = IBM_DB2_ZOS.new(self, @isAr3)
541
630
  when /10/
542
- @servertype = IBM_DB2_ZOS.new(self)
631
+ @servertype = IBM_DB2_ZOS.new(self, @isAr3)
543
632
  when /08/ # DB2 for zOS version 8
544
- @servertype = IBM_DB2_ZOS_8.new(self)
633
+ @servertype = IBM_DB2_ZOS_8.new(self, @isAr3)
545
634
  else # DB2 for zOS version 7
546
635
  raise "Only DB2 z/OS version 8 and above are currently supported"
547
636
  end
548
637
  when /AS/i # DB2 for i5 (iSeries)
549
- @servertype = IBM_DB2_I5.new(self)
638
+ @servertype = IBM_DB2_I5.new(self, @isAr3)
550
639
  when /IDS/i # Informix Dynamic Server
551
- @servertype = IBM_IDS.new(self)
640
+ @servertype = IBM_IDS.new(self, @isAr3)
552
641
  else
553
642
  log( "server_info", "Forcing servertype to LUW: DBMS name could not be retrieved. Check if your client version is of the right level")
554
643
  warn "Forcing servertype to LUW: DBMS name could not be retrieved. Check if your client version is of the right level"
555
- @servertype = IBM_DB2_LUW.new(self)
644
+ @servertype = IBM_DB2_LUW.new(self, @isAr3)
556
645
  end
557
646
  else
558
647
  error_msg = IBM_DB.getErrormsg( @connection, IBM_DB::DB_CONN )
@@ -870,11 +959,17 @@ module ActiveRecord
870
959
  stmt = exec_query(sql, name, binds)
871
960
  end
872
961
 
962
+ cols = IBM_DB.resultCols(stmt)
963
+
873
964
  if( stmt )
874
965
  results = fetch_data(stmt)
875
966
  end
876
967
 
877
- return results
968
+ if(@isAr3)
969
+ return results
970
+ else
971
+ return ActiveRecord::Result.new(cols, results)
972
+ end
878
973
  end
879
974
 
880
975
  #Returns an array of arrays containing the field values.
@@ -911,11 +1006,11 @@ module ActiveRecord
911
1006
 
912
1007
  # Returns a record hash with the column names as keys and column values
913
1008
  # as values.
914
- def select_one(sql, name = nil)
1009
+ #def select_one(sql, name = nil)
915
1010
  # Gets the first hash from the array of hashes returned by
916
1011
  # select_all
917
- select_all(sql,name).first
918
- end
1012
+ # select_all(sql,name).first
1013
+ #end
919
1014
 
920
1015
  #inserts values from fixtures
921
1016
  #overridden to handle LOB's fixture insertion, as, in normal inserts callbacks are triggered but during fixture insertion callbacks are not triggered
@@ -953,10 +1048,10 @@ module ActiveRecord
953
1048
  col.type.to_sym == :binary
954
1049
  # Add a '?' for the parameter or a NULL if the value is nil or empty
955
1050
  # (except for a CLOB field where '' can be a value)
956
- insert_values << item.at(1)
1051
+ insert_values << quote_value_for_pstmt(item.at(1))
957
1052
  params << '?'
958
1053
  else
959
- insert_values << quote(item.at(1),col)
1054
+ insert_values << quote_value_for_pstmt(item.at(1),col)
960
1055
  params << '?'
961
1056
  end
962
1057
  end
@@ -983,6 +1078,10 @@ module ActiveRecord
983
1078
  end
984
1079
  end
985
1080
 
1081
+ def empty_insert_statement_value(pkey)
1082
+ "(#{pkey}) VALUES (DEFAULT)"
1083
+ end
1084
+
986
1085
  # Perform an insert and returns the last ID generated.
987
1086
  # This can be the ID passed to the method or the one auto-generated by the database,
988
1087
  # and retrieved by the +last_generated_id+ method.
@@ -1892,8 +1991,9 @@ module ActiveRecord
1892
1991
 
1893
1992
  # This class contains common code across DB's (DB2 LUW, zOS, i5 and IDS)
1894
1993
  class IBM_DataServer
1895
- def initialize(adapter)
1994
+ def initialize(adapter, ar3)
1896
1995
  @adapter = adapter
1996
+ @isAr3 = ar3
1897
1997
  end
1898
1998
 
1899
1999
  def last_generated_id(stmt)
@@ -1936,9 +2036,16 @@ To remove the column, the table must be dropped and recreated without the #{colu
1936
2036
  # an hash for each single record.
1937
2037
  # The loop stops when there aren't any more valid records to fetch
1938
2038
  begin
1939
- while single_hash = IBM_DB.fetch_assoc(stmt)
1940
- # Add the record to the +results+ array
1941
- results << single_hash
2039
+ if(@isAr3)
2040
+ while single_hash = IBM_DB.fetch_assoc(stmt)
2041
+ # Add the record to the +results+ array
2042
+ results << single_hash
2043
+ end
2044
+ else
2045
+ while single_hash = IBM_DB.fetch_array(stmt)
2046
+ # Add the record to the +results+ array
2047
+ results << single_hash
2048
+ end
1942
2049
  end
1943
2050
  rescue StandardError => fetch_error # Handle driver fetch errors
1944
2051
  error_msg = IBM_DB.getErrormsg(stmt, IBM_DB::DB_STMT )
@@ -2052,8 +2159,8 @@ To remove the column, the table must be dropped and recreated without the #{colu
2052
2159
  end # class IBM_DataServer
2053
2160
 
2054
2161
  class IBM_DB2 < IBM_DataServer
2055
- def initialize(adapter)
2056
- super(adapter)
2162
+ def initialize(adapter, ar3)
2163
+ super(adapter,ar3)
2057
2164
  @limit = @offset = nil
2058
2165
  end
2059
2166
 
@@ -2868,20 +2975,29 @@ module Arel
2868
2975
  class IBM_DB < Arel::Visitors::ToSql
2869
2976
  private
2870
2977
 
2871
- def visit_Arel_Nodes_Limit o
2978
+ def visit_Arel_Nodes_Limit o, a=nil
2872
2979
  visit o.expr
2873
2980
  end
2874
2981
 
2875
- def visit_Arel_Nodes_Offset o
2982
+ def visit_Arel_Nodes_Offset o, a=nil
2876
2983
  visit o.expr
2877
2984
  end
2878
2985
 
2879
- def visit_Arel_Nodes_SelectStatement o
2880
- sql = [
2881
- (visit(o.with) if o.with),
2882
- o.cores.map { |x| visit_Arel_Nodes_SelectCore x }.join,
2883
- ("ORDER BY #{o.orders.map { |x| visit x }.join(', ')}" unless o.orders.empty?),
2884
- ].compact.join ' '
2986
+ def visit_Arel_Nodes_SelectStatement o, a=nil
2987
+ #Interim fix for backward compatibility [Arel 4.0.0 and below]
2988
+ if self.method(:visit_Arel_Nodes_SelectCore).arity == 1
2989
+ sql = [
2990
+ (visit(o.with) if o.with),
2991
+ o.cores.map { |x| visit_Arel_Nodes_SelectCore x }.join,
2992
+ ("ORDER BY #{o.orders.map { |x| visit x }.join(', ')}" unless o.orders.empty?),
2993
+ ].compact.join ' '
2994
+ else
2995
+ sql = [
2996
+ (visit(o.with) if o.with),
2997
+ o.cores.map { |x| visit_Arel_Nodes_SelectCore x,a }.join,
2998
+ ("ORDER BY #{o.orders.map { |x| visit x }.join(', ')}" unless o.orders.empty?),
2999
+ ].compact.join ' '
3000
+ end
2885
3001
 
2886
3002
  if o.limit
2887
3003
  limit = visit(o.limit)
@@ -1 +1,14 @@
1
- require (RUBY_VERSION =~ /1.9/) ? 'mswin32/rb19x/ibm_db.so':'mswin32/rb18x/ibm_db.so'
1
+ if (RUBY_VERSION =~ /1.9/ )
2
+ require 'mswin32/rb19x/ibm_db.so'
3
+ elsif (RUBY_VERSION =~ /2./ )
4
+ #Check if we are on 64-bit or 32-bit ruby and load binary accordingly
5
+ machine_bits = ['ibm'].pack('p').size * 8
6
+ if machine_bits == 64
7
+ #require 'mswin32/rb2x/x64/ibm_db.so'
8
+ raise NotImplementedError, "ibm_db with Ruby 2.0 64-bit on Windows platform is not supported. Refer to README for more details"
9
+ else
10
+ require 'mswin32/rb2x/i386/ibm_db.so'
11
+ end
12
+ else
13
+ require 'mswin32/rb18x/ibm_db.so'
14
+ end
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibm_db
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.12
5
- prerelease:
4
+ version: 2.5.14
6
5
  platform: x86-mingw32
7
6
  authors:
8
7
  - IBM
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-01-28 00:00:00.000000000 Z
11
+ date: 2014-02-10 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activerecord
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 1.15.1
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 1.15.1
30
27
  description:
@@ -53,6 +50,7 @@ files:
53
50
  - lib/mswin32/ibm_db.rb
54
51
  - lib/mswin32/rb18x/ibm_db.so
55
52
  - lib/mswin32/rb19x/ibm_db.so
53
+ - lib/mswin32/rb2x/i386/ibm_db.so
56
54
  - LICENSE
57
55
  - MANIFEST
58
56
  - ParameterizedQueries README
@@ -84,29 +82,28 @@ files:
84
82
  - test/schema/zOS/ibm_db_specific_schema.rb
85
83
  homepage: http://rubyforge.org/projects/rubyibm/
86
84
  licenses: []
85
+ metadata: {}
87
86
  post_install_message:
88
87
  rdoc_options: []
89
88
  require_paths:
90
89
  - lib
91
90
  required_ruby_version: !ruby/object:Gem::Requirement
92
- none: false
93
91
  requirements:
94
- - - ! '>='
92
+ - - '>='
95
93
  - !ruby/object:Gem::Version
96
94
  version: 1.8.6
97
95
  required_rubygems_version: !ruby/object:Gem::Requirement
98
- none: false
99
96
  requirements:
100
- - - ! '>='
97
+ - - '>='
101
98
  - !ruby/object:Gem::Version
102
99
  version: '0'
103
100
  requirements:
104
101
  - ActiveRecord, at least 1.15.1
105
102
  rubyforge_project: rubyibm
106
- rubygems_version: 1.8.23
103
+ rubygems_version: 2.0.14
107
104
  signing_key:
108
- specification_version: 3
109
- summary: ! 'Rails Driver and Adapter for IBM Data Servers: {DB2 on Linux/Unix/Windows,
105
+ specification_version: 4
106
+ summary: 'Rails Driver and Adapter for IBM Data Servers: {DB2 on Linux/Unix/Windows,
110
107
  DB2 on zOS, DB2 on i5/OS, Informix (IDS)}'
111
108
  test_files:
112
109
  - test/ibm_db_test.rb