kudu_adapter 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a16fccf807f95dbd8a16bf90c03314fda9564a6d
4
- data.tar.gz: 3f10e1d226527b8550e4950c03632d9d9a2060cb
2
+ SHA256:
3
+ metadata.gz: 6acdd82cf235759fbc882d260802e0b7cbf8b5cdb3b7896512b273bd4fb58d71
4
+ data.tar.gz: 1f60bcf02fef433dc80643caebaa9707ed4da6c8c77524706baeb64ea2ae333a
5
5
  SHA512:
6
- metadata.gz: 05f9b3a9ac337b3b93bf6ad3f2df444bacf8982ca67fcc61d9c071783732a8a6e2e89d74d3944a7cb1fd18a3768ad830734ece62dcdfbe191deb677450943869
7
- data.tar.gz: ce8a364831494992b183ba50af1b2cb922ca154c44b657b688bd69a62e7417c1c57a6e10d5bbb0368c89b47739901069d37d4cced164cfc80281f3caa5bea24c
6
+ metadata.gz: 72c9c188026556de099d4ab25cf48473070983b888ea9e8e3921e573a47fc1cce09799c74137d75f82ea05e9e1df4fd64f5411c2b535506aee8ac83693d57b88
7
+ data.tar.gz: 2af2c26170a6b017db20660a911ed0a3b1e428f7d182c9f529e5b6fd86171a125b0801f73c8537da91d16977d37d9b091a7969cc2f23a33c90aff809d029f9bb
data/.rubocop.yml CHANGED
@@ -5,4 +5,4 @@ AllCops:
5
5
 
6
6
  Metrics/LineLength:
7
7
  Enabled: true
8
- Max: 120
8
+ Max: 120
@@ -10,14 +10,14 @@ module ActiveRecord
10
10
  # :nodoc:
11
11
  def exec_query(sql, _ = 'SQL', binds = [], prepare: false)
12
12
  ::Rails.logger.warn 'Prepared statements are not supported' if prepare
13
-
13
+ # Important because of replacing ? marks and if we have replaced string with ? inside...
14
+ sql = sql.gsub('?', '@@?')
14
15
  unless without_prepared_statement? binds
15
16
  type_casted_binds(binds).each do |bind|
16
- bind = quote(bind)
17
- sql = sql.sub('?', bind.to_s)
17
+ sql = sql.sub('@@?', quote(bind).to_s)
18
18
  end
19
19
  end
20
- #::Rails.logger.info 'QUERY : ' + sql.to_s
20
+ ::Rails.logger.info 'QUERY : ' + sql.to_s
21
21
  result = connection.query sql
22
22
  columns = result.first&.keys.to_a
23
23
  rows = result.map { |row| row.fetch_values(*columns) }
@@ -18,6 +18,11 @@ module ActiveRecord
18
18
  quote_column_name table_name
19
19
  end
20
20
 
21
+ def quote_string(s)
22
+ # This will make proper single quote in text
23
+ s.gsub('\\', '\&\&').gsub("'", "\\\\\\\\'")
24
+ end
25
+
21
26
  def quote_default_expression(value, column) # :nodoc:
22
27
  if value.is_a?(Proc)
23
28
  value.call
@@ -72,7 +72,7 @@ module ActiveRecord
72
72
  table_structure(table_name).map do |col_def|
73
73
  type = if col_def[:type] == 'int'
74
74
  :integer
75
- elsif col_def[:type] == 'bigint' && /_at$/ =~ col_def[:name]
75
+ elsif col_def[:type] == 'bigint' && /(_at|_date|_time)$/ =~ col_def[:name]
76
76
  :datetime
77
77
  else
78
78
  col_def[:type].to_sym
@@ -372,8 +372,8 @@ module ActiveRecord
372
372
 
373
373
  def add_timestamps(table_name, options = {})
374
374
  options[:null] = false if options[:null].nil?
375
- add_column table_name, :created_at, :bigint, options
376
- add_column table_name, :updated_at, :bigint, options
375
+ add_column table_name, :created_at, :datetime, options
376
+ add_column table_name, :updated_at, :datetime, options
377
377
  end
378
378
 
379
379
  def remove_timestamps(table_name, options = {})
@@ -92,7 +92,7 @@ module ActiveRecord
92
92
  end
93
93
 
94
94
  def disconnect!
95
- @connection.close
95
+ @connection.close if @connection.open?
96
96
  @connection = nil
97
97
  end
98
98
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KuduAdapter
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kudu_adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paweł Smoliński
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-14 00:00:00.000000000 Z
12
+ date: 2018-10-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: arel
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
196
  version: '0'
197
197
  requirements: []
198
198
  rubyforge_project:
199
- rubygems_version: 2.6.12
199
+ rubygems_version: 2.7.7
200
200
  signing_key:
201
201
  specification_version: 4
202
202
  summary: ActiveRecord adapter for Cloudera's Kudu over Impala database