ibm_db 3.0.3 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08df9633383cda42b54cea8516587e9abe849ad0
4
- data.tar.gz: 95cf8644f94e68a0d4c052ad9b2e9b89095db6b8
3
+ metadata.gz: c68c3f7765c3fadc93bc0fc821aebc829e5cbaf2
4
+ data.tar.gz: 3509e467e7bcfe0cf678209b0ab8b4d04fbeb7b2
5
5
  SHA512:
6
- metadata.gz: 99282fcc40b412a8ff16feb5271d1f906b6bda1323773b88927021c4b99b43f44d858a5bbd88c8ab0a3f8964568150ccff1e78e3f2d5fdf0fa7893978c98e5a0
7
- data.tar.gz: 8ec0b30a7b01e930228ff054bd86287ec33f28d97316fa9d849f358b574d7967ad00e2e01211f1b9cda1aaf09dfc2eac8383299f8eafd1ce634698118ff8663f
6
+ metadata.gz: b3f896591c7a0ed6b05c7c9b1b9386b578e0b732d1c5f0e60ce45f979933c4b72ffd3e40bc454f0873d9e89e17f1c2281039ccf794ac021795671a0712d57bd8
7
+ data.tar.gz: d1d517d0c611c83810980fa52f3f6349bf0d0bf4ff64fd012e1d4bbb04ff5fb800ee230b80181a7b69f8c0296399db9ba1179bb574ceee842d849be0919c11ad
data/CHANGES CHANGED
@@ -1,5 +1,8 @@
1
1
  Change Log
2
2
  ==============
3
+ 2016/07/08 (IBM_DB adapter 3.0.4, driver 3.0.3)
4
+ - Fixed issue #58 - non-string query parameters do nor get prepared.
5
+
3
6
  2016/06/17 (IBM_DB adapter 3.0.3, driver 3.0.3)
4
7
  - Fixed issue #59 - Can't Update Binary Files Using 3.0.x (with Ruby 2.1.0 and Rails 4.2.6)
5
8
 
@@ -159,9 +159,9 @@ module ActiveRecord
159
159
  raise LoadError, "Failed to load IBM_DB Ruby driver."
160
160
  end
161
161
 
162
- if( config.has_key?(:parameterized) && config[:parameterized] == true )
163
- require 'active_record/connection_adapters/ibm_db_pstmt'
164
- end
162
+ #if( config.has_key?(:parameterized) && config[:parameterized] == true )
163
+ # require 'active_record/connection_adapters/ibm_db_pstmt'
164
+ #end
165
165
 
166
166
  # Check if class TableDefinition responds to indexes method to determine if we are on AR 3 or AR 4.
167
167
  # 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.
@@ -617,14 +617,6 @@ module ActiveRecord
617
617
  @authentication = config[:authentication] || nil
618
618
  @timeout = config[:timeout] || 0 # default timeout value is 0
619
619
 
620
- if( config.has_key?(:parameterized) && config[:parameterized] == true )
621
- @pstmt_support_on = true
622
- @set_quoted_literal_replacement = IBM_DB::QUOTED_LITERAL_REPLACEMENT_OFF
623
- else
624
- @pstmt_support_on = false
625
- @set_quoted_literal_replacement = IBM_DB::QUOTED_LITERAL_REPLACEMENT_ON
626
- end
627
-
628
620
  @app_user = @account = @application = @workstation = nil
629
621
  # Caching database connection options (auditing and billing support)
630
622
  @app_user = conn_options[:app_user] if conn_options.has_key?(:app_user)
@@ -701,6 +693,16 @@ module ActiveRecord
701
693
  if(@arelVersion >= 3 )
702
694
  @visitor = Arel::Visitors::IBM_DB.new self
703
695
  end
696
+
697
+ if(config.has_key?(:parameterized) && config[:parameterized] == true)
698
+ @pstmt_support_on = true
699
+ @prepared_statements = true
700
+ @set_quoted_literal_replacement = IBM_DB::QUOTED_LITERAL_REPLACEMENT_OFF
701
+ else
702
+ @pstmt_support_on = false
703
+ @prepared_statements = false
704
+ @set_quoted_literal_replacement = IBM_DB::QUOTED_LITERAL_REPLACEMENT_ON
705
+ end
704
706
  end
705
707
 
706
708
  # Optional connection attribute: database name space qualifier
@@ -770,7 +772,7 @@ module ActiveRecord
770
772
  else
771
773
  arel
772
774
  end
773
- end
775
+ end
774
776
  end
775
777
  # This adapter supports migrations.
776
778
  # Current limitations:
@@ -1146,16 +1148,9 @@ module ActiveRecord
1146
1148
  if binds.nil? || binds.empty?
1147
1149
  return insert_direct(sql, name, pk, id_value, sequence_name)
1148
1150
  end
1149
-
1150
- new_binds = Hash.new
1151
- param_array = binds.map do |column,value|
1152
- if column && column.sql_type.to_s =~ /binary|blob/i
1153
- new_binds [column] = value
1154
- end
1155
- end
1156
-
1151
+
1157
1152
  clear_query_cache if defined? clear_query_cache
1158
- if stmt = exec_insert(sql, name, new_binds)
1153
+ if stmt = exec_insert(sql, name, binds)
1159
1154
  begin
1160
1155
  @sql << sql
1161
1156
  return id_value || @servertype.last_generated_id(stmt)
@@ -1333,15 +1328,8 @@ module ActiveRecord
1333
1328
  if binds.nil? || binds.empty?
1334
1329
  update_direct(sql, name)
1335
1330
  else
1336
- begin
1337
- new_binds = Hash.new
1338
- param_array = binds.map do |column,value|
1339
- if column && column.sql_type.to_s =~ /binary|blob/i
1340
- new_binds [column] = value
1341
- end
1342
- end
1343
-
1344
- if stmt = exec_query(sql,name,new_binds)
1331
+ begin
1332
+ if stmt = exec_query(sql,name,binds)
1345
1333
  IBM_DB.num_rows(stmt)
1346
1334
  end
1347
1335
  ensure
@@ -1963,7 +1951,7 @@ module ActiveRecord
1963
1951
  #PKTABLE_NAME:: fk_row[2] Name of the table containing the primary key.
1964
1952
  #PKCOLUMN_NAME:: fk_row[3] Name of the column containing the primary key.
1965
1953
  #FKTABLE_NAME:: fk_row[6] Name of the table containing the foreign key.
1966
- #FKCOLUMN_NAME: fk_row[7] Name of the column containing the foreign key.
1954
+ #FKCOLUMN_NAME:: fk_row[7] Name of the column containing the foreign key.
1967
1955
  #FK_NAME:: fk_row[11] The name of the foreign key.
1968
1956
 
1969
1957
  table_name = @servertype.set_case(table_name.to_s)
@@ -1981,7 +1969,7 @@ module ActiveRecord
1981
1969
  primary_key: fk_row[3],
1982
1970
  }
1983
1971
  options[:on_update] = extract_foreign_key_action(fk_row[9])
1984
- options[:on_delete] = extract_foreign_key_action(fk_row[10])
1972
+ options[:on_delete] = extract_foreign_key_action(fk_row[10])
1985
1973
  foreignKeys << ForeignKeyDefinition.new(fk_row[6], table_name, options)
1986
1974
  end
1987
1975
 
@@ -2486,14 +2474,16 @@ SET WITH DEFAULT #{@adapter.quote(default)}"
2486
2474
  end
2487
2475
 
2488
2476
  if(limit.nil?)
2489
- retHash["startSegment"] = "SELECT O.* FROM (SELECT I.*, ROW_NUMBER() OVER () sys_row_num FROM ( SELECT "
2477
+ #retHash["startSegment"] = "SELECT O.* FROM (SELECT I.*, ROW_NUMBER() OVER () sys_row_num FROM ( SELECT "
2478
+ retHash["startSegment"] = "SELECT O.* FROM (SELECT I.*, ROW_NUMBER() OVER () sys_row_num FROM ( "
2490
2479
  retHash["endSegment"] = " ) AS I) AS O WHERE sys_row_num > #{offset}"
2491
2480
  return retHash
2492
2481
  end
2493
2482
 
2494
2483
  # Defines what will be the last record
2495
2484
  last_record = offset.to_i + limit.to_i
2496
- retHash["startSegment"] = "SELECT O.* FROM (SELECT I.*, ROW_NUMBER() OVER () sys_row_num FROM ( SELECT "
2485
+ #retHash["startSegment"] = "SELECT O.* FROM (SELECT I.*, ROW_NUMBER() OVER () sys_row_num FROM ( SELECT "
2486
+ retHash["startSegment"] = "SELECT O.* FROM (SELECT I.*, ROW_NUMBER() OVER () sys_row_num FROM ( "
2497
2487
  retHash["endSegment"] = " ) AS I) AS O WHERE sys_row_num BETWEEN #{offset+1} AND #{last_record}"
2498
2488
  return retHash
2499
2489
  end
@@ -2558,14 +2548,12 @@ SET WITH DEFAULT #{@adapter.quote(default)}"
2558
2548
  # This method generates the default blob value specified for
2559
2549
  # DB2 Dataservers
2560
2550
  def set_binary_default(value)
2561
- #"BLOB('#{value}')"
2562
- "?"
2551
+ "BLOB('#{value}')"
2563
2552
  end
2564
2553
 
2565
2554
  # This method generates the blob value specified for DB2 Dataservers
2566
2555
  def set_binary_value
2567
- #"BLOB('?')"
2568
- "?"
2556
+ "BLOB('?')"
2569
2557
  end
2570
2558
 
2571
2559
  # This method generates the default clob value specified for
@@ -3075,7 +3063,7 @@ end
3075
3063
  @arelVersion = Arel::VERSION.to_i
3076
3064
  rescue
3077
3065
  @arelVersion = 0
3078
- end
3066
+ end
3079
3067
  if(@arelVersion < 6)
3080
3068
 
3081
3069
  def visit_Arel_Nodes_Limit o, a=nil
@@ -3165,11 +3153,14 @@ else
3165
3153
  limOffClause = @connection.get_limit_offset_clauses(limit,offset)
3166
3154
 
3167
3155
  if( !limOffClause["startSegment"].empty? )
3168
- collector.changeFirstSegment(limOffClause["startSegment"])
3156
+ #collector.changeFirstSegment(limOffClause["startSegment"])
3157
+ collector.value.prepend(limOffClause["startSegment"])
3169
3158
  end
3170
3159
 
3171
3160
  if( !limOffClause["endSegment"].empty? )
3172
- collector.changeEndSegment(limOffClause["endSegment"])
3161
+ #collector.changeEndSegment(limOffClause["endSegment"])
3162
+ collector << SPACE
3163
+ collector << limOffClause["endSegment"]
3173
3164
  end
3174
3165
 
3175
3166
  #Initialize a new Collector and set its value to the sql string built so far with any limit and ofset modifications
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibm_db
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - IBM
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-20 00:00:00.000000000 Z
11
+ date: 2016-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord