activerecord-jdbc-adapter 1.3.8 → 1.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +3 -3
- data/History.md +7 -0
- data/Rakefile +25 -20
- data/lib/arjdbc/postgresql/adapter.rb +11 -8
- data/lib/arjdbc/postgresql/column.rb +19 -17
- data/lib/arjdbc/postgresql/explain_support.rb +3 -2
- data/lib/arjdbc/postgresql/oid_types.rb +1 -0
- data/lib/arjdbc/version.rb +2 -2
- data/src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb8275489a147bf60f8705498a80efe51ec395cc
|
4
|
+
data.tar.gz: 757b6d0d663b6d94499d42bb4aa27873456b1034
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 309e8913e85548dc626989380c8b6d0f3cd5cd66e98912b30d160995cb69e1b984a2671004c7ca26b8e5c5b2e4b0ab003e451958fa6656f25643a03aca296e09
|
7
|
+
data.tar.gz: 67e41e8ef986c2d4bc113f8d85a5ed5e2ef947e353ca6dd75fa607ebb1cbbc09a0d502afafc017a29e9927bd248dd5d05c6b44ccbd8cadfe72f1ddfa3618ff63
|
data/Appraisals
CHANGED
@@ -12,17 +12,17 @@ appraise "rails31" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
appraise "rails32" do
|
15
|
-
gem "activerecord", "~> 3.2.
|
15
|
+
gem "activerecord", "~> 3.2.19", :require => false
|
16
16
|
end
|
17
17
|
|
18
18
|
appraise "rails40" do
|
19
19
|
# NOTE: make sure you're using --1.9 with AR-4.0
|
20
|
-
gem "activerecord", "~> 4.0.
|
20
|
+
gem "activerecord", "~> 4.0.8", :require => false
|
21
21
|
end
|
22
22
|
|
23
23
|
appraise "rails41" do
|
24
24
|
# NOTE: make sure you're using --1.9 with AR-4.0
|
25
|
-
gem "activerecord", "~> 4.1.
|
25
|
+
gem "activerecord", "~> 4.1.4", :require => false
|
26
26
|
end
|
27
27
|
|
28
28
|
appraise "rails42" do
|
data/History.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 1.3.9 (07/07/14)
|
2
|
+
|
3
|
+
- [postgres] improve Range's type cast - fixing minor quoting failure on AR 4.x
|
4
|
+
- [postgres] range type's :exclude_start is actually += 1 (align with AR 4.1)
|
5
|
+
- [postgres] correctly quote numeric values with string/text column types
|
6
|
+
- [postgres] backport CVE-2014-3483 and protect against CVE-2014-3482 (from AR)
|
7
|
+
|
1
8
|
## 1.3.8 (06/27/14)
|
2
9
|
|
3
10
|
- [mysql] updated so that we can run with non-official driver (+ against MariaDB)
|
data/Rakefile
CHANGED
@@ -20,21 +20,19 @@ ADAPTERS = %w[derby h2 hsqldb mssql mysql postgresql sqlite3].map { |a| "activer
|
|
20
20
|
DRIVERS = %w[derby h2 hsqldb jtds mysql postgres sqlite3].map { |a| "jdbc-#{a}" }
|
21
21
|
TARGETS = ( ADAPTERS + DRIVERS )
|
22
22
|
|
23
|
-
|
24
|
-
ruby "-S", "rake", *args
|
25
|
-
end
|
23
|
+
rake = lambda { |task| ruby "-S", "rake", task }
|
26
24
|
|
27
25
|
TARGETS.each do |target|
|
28
26
|
namespace target do
|
29
27
|
task :build do
|
30
|
-
Dir.chdir(target) { rake "build" }
|
28
|
+
Dir.chdir(target) { rake.call "build" }
|
31
29
|
cp FileList["#{target}/pkg/#{target}-*.gem"], "pkg"
|
32
30
|
end
|
33
31
|
task :install do
|
34
|
-
Dir.chdir(target) { rake "install" }
|
32
|
+
Dir.chdir(target) { rake.call "install" }
|
35
33
|
end
|
36
34
|
task :release do
|
37
|
-
Dir.chdir(target) { rake "release" }
|
35
|
+
Dir.chdir(target) { rake.call "release" }
|
38
36
|
end
|
39
37
|
end
|
40
38
|
end
|
@@ -43,37 +41,44 @@ end
|
|
43
41
|
|
44
42
|
desc "Build drivers"
|
45
43
|
task "build:drivers" => DRIVERS.map { |name| "#{name}:build" }
|
46
|
-
task "drivers:build" =>
|
44
|
+
task "drivers:build" => 'build:drivers'
|
47
45
|
|
48
46
|
desc "Install drivers"
|
49
47
|
task "install:drivers" => DRIVERS.map { |name| "#{name}:install" }
|
50
|
-
task "drivers:install" =>
|
48
|
+
task "drivers:install" => 'install:drivers'
|
51
49
|
|
52
|
-
desc "Release drivers"
|
53
|
-
task "release:drivers" => DRIVERS.map { |name| "#{name}:release" }
|
54
|
-
task "drivers:release" => DRIVERS.map { |name| "#{name}:release" }
|
50
|
+
# desc "Release drivers"
|
51
|
+
# task "release:drivers" => DRIVERS.map { |name| "#{name}:release" }
|
52
|
+
# task "drivers:release" => DRIVERS.map { |name| "#{name}:release" }
|
55
53
|
|
56
54
|
# ADAPTERS
|
57
55
|
|
58
56
|
desc "Build adapters"
|
59
57
|
task "build:adapters" => [ 'build' ] + ADAPTERS.map { |name| "#{name}:build" }
|
60
|
-
task "adapters:build" =>
|
58
|
+
task "adapters:build" => 'build:adapters'
|
61
59
|
|
62
60
|
desc "Install adapters"
|
63
61
|
task "install:adapters" => [ 'install' ] + ADAPTERS.map { |name| "#{name}:install" }
|
64
|
-
task "adapters:install" =>
|
62
|
+
task "adapters:install" => 'install:adapters'
|
65
63
|
|
66
64
|
desc "Release adapters"
|
67
65
|
task "release:adapters" => [ 'release' ] + ADAPTERS.map { |name| "#{name}:release" }
|
68
|
-
task "adapters:release" =>
|
66
|
+
task "adapters:release" => 'release:adapters'
|
67
|
+
|
68
|
+
task 'release:do' => 'build:adapters' do
|
69
|
+
gemspec = Bundler.load_gemspec('activerecord-jdbc-adapter.gemspec')
|
70
|
+
version = gemspec.version; version_tag = "v#{version}"
|
71
|
+
|
72
|
+
sh("git diff --no-patch --exit-code") { |ok| fail "git working dir is not clean" unless ok }
|
73
|
+
sh("git diff-index --quiet --cached HEAD") { |ok| fail "git index is not clean" unless ok }
|
74
|
+
|
75
|
+
sh "git tag -a -m \"AR-JDBC #{version}\" #{version_tag}"
|
76
|
+
sh "for gem in `ls pkg/*-#{version}.gem`; do gem push $gem; done"
|
77
|
+
end
|
69
78
|
|
70
79
|
# ALL
|
71
80
|
|
72
81
|
task "build:all" => [ 'build' ] + TARGETS.map { |name| "#{name}:build" }
|
73
|
-
task "all:build" =>
|
82
|
+
task "all:build" => 'build:all'
|
74
83
|
task "install:all" => [ 'install' ] + TARGETS.map { |name| "#{name}:install" }
|
75
|
-
task "all:install" =>
|
76
|
-
|
77
|
-
task :filelist do
|
78
|
-
puts FileList['pkg/**/*'].inspect
|
79
|
-
end
|
84
|
+
task "all:install" => 'install:all'
|
@@ -818,8 +818,9 @@ module ArJdbc
|
|
818
818
|
end
|
819
819
|
when Numeric
|
820
820
|
if column.respond_to?(:sql_type) && column.sql_type == 'money'
|
821
|
-
#
|
822
|
-
|
821
|
+
"'#{value}'"
|
822
|
+
elsif column.type == :string || column.type == :text
|
823
|
+
"'#{value}'"
|
823
824
|
else super
|
824
825
|
end
|
825
826
|
when String
|
@@ -849,9 +850,11 @@ module ArJdbc
|
|
849
850
|
else super
|
850
851
|
end
|
851
852
|
when Range
|
852
|
-
|
853
|
+
sql_type = column.respond_to?(:sql_type) && column.sql_type
|
854
|
+
if sql_type && sql_type[-5, 5] == 'range' && AR4_COMPAT
|
853
855
|
column_class = ::ActiveRecord::ConnectionAdapters::PostgreSQLColumn
|
854
|
-
|
856
|
+
escaped = quote_string(column_class.range_to_string(value))
|
857
|
+
"'#{escaped}'::#{sql_type}"
|
855
858
|
else super
|
856
859
|
end
|
857
860
|
when IPAddr
|
@@ -885,8 +888,8 @@ module ArJdbc
|
|
885
888
|
# "0101" will be treated as binary string
|
886
889
|
# "0100" will be treated as binary string
|
887
890
|
# ... but is kept due Rails compatibility
|
888
|
-
when
|
889
|
-
when
|
891
|
+
when /\A[01]*\Z/ then "B'#{value}'" # Bit-string notation
|
892
|
+
when /\A[0-9A-F]*\Z/i then "X'#{value}'" # Hexadecimal notation
|
890
893
|
end
|
891
894
|
end
|
892
895
|
|
@@ -1272,9 +1275,9 @@ module ActiveRecord::ConnectionAdapters
|
|
1272
1275
|
else # NOTE: AR <= 3.2 : (name, default, sql_type = nil, null = true)
|
1273
1276
|
null, sql_type, oid_type = !! sql_type, oid_type, nil
|
1274
1277
|
end
|
1275
|
-
if sql_type
|
1278
|
+
if sql_type.to_s[-2, 2] == '[]' && ArJdbc::PostgreSQL::AR4_COMPAT
|
1276
1279
|
@array = true if respond_to?(:array)
|
1277
|
-
super(name, default, sql_type[0
|
1280
|
+
super(name, default, sql_type[0..-3], null)
|
1278
1281
|
else
|
1279
1282
|
@array = false if respond_to?(:array)
|
1280
1283
|
super(name, default, sql_type, null)
|
@@ -147,41 +147,47 @@ module ArJdbc
|
|
147
147
|
when :tsvector then value
|
148
148
|
when :datetime, :timestamp then self.class.string_to_time value
|
149
149
|
else
|
150
|
-
|
151
|
-
when 'money'
|
150
|
+
if ( sql_type = self.sql_type.to_s ) == 'money'
|
152
151
|
self.class.string_to_money(value)
|
153
|
-
|
152
|
+
elsif sql_type[0, 5] == 'point'
|
154
153
|
value.is_a?(String) ? self.class.string_to_point(value) : value
|
155
|
-
|
154
|
+
elsif sql_type[0, 3] == 'bit' || sql_type[0, 6] == 'varbit'
|
156
155
|
value.is_a?(String) ? self.class.string_to_bit(value) : value
|
157
|
-
|
156
|
+
elsif sql_type[-5, 5] == 'range'
|
158
157
|
return if value.nil? || value == 'empty'
|
159
158
|
return value if value.is_a?(::Range)
|
160
159
|
|
161
160
|
extracted = extract_bounds(value)
|
162
161
|
|
163
|
-
case
|
162
|
+
case sql_type[0...-5] # range sub-type
|
164
163
|
when 'date' # :date
|
165
164
|
from = self.class.value_to_date(extracted[:from])
|
166
|
-
from
|
165
|
+
from += 1.day if extracted[:exclude_start]
|
167
166
|
to = self.class.value_to_date(extracted[:to])
|
168
167
|
when 'num' # :decimal
|
169
|
-
from = BigDecimal.new(extracted[:from].to_s)
|
168
|
+
from = ::BigDecimal.new(extracted[:from].to_s)
|
170
169
|
# FIXME: add exclude start for ::Range, same for timestamp ranges
|
171
|
-
to = BigDecimal.new(extracted[:to].to_s)
|
170
|
+
to = ::BigDecimal.new(extracted[:to].to_s)
|
172
171
|
when 'ts', 'tstz' # :time
|
173
172
|
from = self.class.string_to_time(extracted[:from])
|
174
173
|
to = self.class.string_to_time(extracted[:to])
|
175
174
|
when 'int4', 'int8' # :integer
|
176
|
-
from =
|
177
|
-
from
|
178
|
-
|
175
|
+
from = extracted[:from]
|
176
|
+
unless (from.respond_to?(:infinite?) && from.infinite?)
|
177
|
+
from = from.respond_to?(:to_i) ? from.to_i : ( value ? 1 : 0 )
|
178
|
+
end
|
179
|
+
from += 1 if extracted[:exclude_start]
|
180
|
+
to = extracted[:to]
|
181
|
+
unless (to.respond_to?(:infinite?) && to.infinite?)
|
182
|
+
to = to.respond_to?(:to_i) ? to.to_i : ( value ? 1 : 0 )
|
183
|
+
end
|
179
184
|
else
|
180
185
|
return value
|
181
186
|
end
|
182
187
|
|
183
188
|
::Range.new(from, to, extracted[:exclude_end])
|
184
|
-
else
|
189
|
+
else
|
190
|
+
super(value)
|
185
191
|
end
|
186
192
|
end
|
187
193
|
end if AR4_COMPAT
|
@@ -321,10 +327,6 @@ module ArJdbc
|
|
321
327
|
::Float::INFINITY * (options[:negative] ? -1 : 1)
|
322
328
|
end if AR4_COMPAT
|
323
329
|
|
324
|
-
def to_integer(value)
|
325
|
-
(value.respond_to?(:infinite?) && value.infinite?) ? value : value.to_i
|
326
|
-
end if AR4_COMPAT
|
327
|
-
|
328
330
|
# @note Based on *active_record/connection_adapters/postgresql/cast.rb* (4.0).
|
329
331
|
module Cast
|
330
332
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module ArJdbc
|
2
2
|
module PostgreSQL
|
3
|
+
# @private
|
3
4
|
module ExplainSupport
|
4
5
|
def supports_explain?
|
5
6
|
true
|
@@ -10,8 +11,8 @@ module ArJdbc
|
|
10
11
|
result = exec_query(sql, "EXPLAIN", binds)
|
11
12
|
ExplainPrettyPrinter.new.pp result # we can assume AR >= 3.1
|
12
13
|
end
|
13
|
-
|
14
|
-
class ExplainPrettyPrinter
|
14
|
+
# @private
|
15
|
+
class ExplainPrettyPrinter
|
15
16
|
# Pretty prints the result of a EXPLAIN in a way that resembles the output of the
|
16
17
|
# PostgreSQL shell:
|
17
18
|
#
|
data/lib/arjdbc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-jdbc-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sieger, Ola Bini, Karol Bucek and JRuby contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|