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 +5 -5
- data/.rubocop.yml +1 -1
- data/lib/active_record/connection_adapters/kudu/database_statements.rb +4 -4
- data/lib/active_record/connection_adapters/kudu/quoting.rb +5 -0
- data/lib/active_record/connection_adapters/kudu/schema_statements.rb +3 -3
- data/lib/active_record/connection_adapters/kudu_adapter.rb +1 -1
- data/lib/kudu_adapter/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6acdd82cf235759fbc882d260802e0b7cbf8b5cdb3b7896512b273bd4fb58d71
|
4
|
+
data.tar.gz: 1f60bcf02fef433dc80643caebaa9707ed4da6c8c77524706baeb64ea2ae333a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72c9c188026556de099d4ab25cf48473070983b888ea9e8e3921e573a47fc1cce09799c74137d75f82ea05e9e1df4fd64f5411c2b535506aee8ac83693d57b88
|
7
|
+
data.tar.gz: 2af2c26170a6b017db20660a911ed0a3b1e428f7d182c9f529e5b6fd86171a125b0801f73c8537da91d16977d37d9b091a7969cc2f23a33c90aff809d029f9bb
|
data/.rubocop.yml
CHANGED
@@ -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
|
-
|
17
|
-
sql = sql.sub('?', bind.to_s)
|
17
|
+
sql = sql.sub('@@?', quote(bind).to_s)
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
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, :
|
376
|
-
add_column table_name, :updated_at, :
|
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 = {})
|
data/lib/kudu_adapter/version.rb
CHANGED
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.
|
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:
|
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.
|
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
|