activerecord-jdbc-adapter 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/Manifest.txt +1 -0
- data/lib/arjdbc/jdbc/adapter.rb +8 -10
- data/lib/arjdbc/jdbc/adapter_java.jar +0 -0
- data/lib/arjdbc/jdbc/connection.rb +2 -2
- data/lib/arjdbc/jdbc/discover.rb +1 -1
- data/lib/arjdbc/mssql/limit_helpers.rb +2 -2
- data/lib/arjdbc/postgresql/adapter.rb +1 -1
- data/lib/arjdbc/version.rb +1 -1
- data/test/abstract_db_create.rb +4 -0
- data/test/postgres_native_type_mapping_test.rb +84 -0
- metadata +3 -2
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 1.1.3
|
2
|
+
|
3
|
+
- Remove AR version < 3 guard around some caching methods (sugg. invadersmustdie)
|
4
|
+
- Small bug in arjdbc/discover logic, thanks autotelik.
|
5
|
+
- Added bigint serial support + some testcases for native type mapping (postgres only)
|
6
|
+
- mssql: use subscript instead of #first. (Kim Toms)
|
7
|
+
- #71: fix yield called out of block error
|
8
|
+
- Silence Rake::DSL warnings for Rake > 0.9
|
9
|
+
|
1
10
|
== 1.1.2
|
2
11
|
|
3
12
|
- Update version of H2 driver from 1.1.107 to 1.3.153 (Ketan
|
data/Manifest.txt
CHANGED
@@ -125,6 +125,7 @@ test/postgres_db_create_test.rb
|
|
125
125
|
test/postgres_drop_db_test.rb
|
126
126
|
test/postgres_information_schema_leak_test.rb
|
127
127
|
test/postgres_mixed_case_test.rb
|
128
|
+
test/postgres_native_type_mapping_test.rb
|
128
129
|
test/postgres_nonseq_pkey_test.rb
|
129
130
|
test/postgres_reserved_test.rb
|
130
131
|
test/postgres_schema_search_path_test.rb
|
data/lib/arjdbc/jdbc/adapter.rb
CHANGED
@@ -202,16 +202,14 @@ module ActiveRecord
|
|
202
202
|
select(sql, name)
|
203
203
|
end
|
204
204
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
select(sql, name).first
|
214
|
-
end
|
205
|
+
# Allow query caching to work even when we override alias_method_chain'd methods
|
206
|
+
alias_chained_method :select_all, :query_cache, :jdbc_select_all
|
207
|
+
alias_chained_method :update, :query_dirty, :jdbc_update
|
208
|
+
alias_chained_method :insert, :query_dirty, :jdbc_insert
|
209
|
+
|
210
|
+
# Do we need this? Not in AR 3.
|
211
|
+
def select_one(sql, name = nil)
|
212
|
+
select(sql, name).first
|
215
213
|
end
|
216
214
|
|
217
215
|
def select_rows(sql, name = nil)
|
Binary file
|
@@ -88,10 +88,10 @@ module ActiveRecord
|
|
88
88
|
rescue ::ActiveRecord::ActiveRecordError
|
89
89
|
raise
|
90
90
|
rescue Exception => e
|
91
|
-
raise ::ActiveRecord::JDBCError.new("The driver encountered an unknown error: #{e}").tap
|
91
|
+
raise ::ActiveRecord::JDBCError.new("The driver encountered an unknown error: #{e}").tap { |err|
|
92
92
|
err.errno = 0
|
93
93
|
err.sql_exception = e
|
94
|
-
|
94
|
+
}
|
95
95
|
end
|
96
96
|
|
97
97
|
def adapter=(adapter)
|
data/lib/arjdbc/jdbc/discover.rb
CHANGED
@@ -69,10 +69,10 @@ module ::ArJdbc
|
|
69
69
|
find_select = /\b(SELECT(?:\s+DISTINCT)?)\b(.*)/im
|
70
70
|
whole, select, rest_of_query = find_select.match(sql).to_a
|
71
71
|
rest_of_query.strip!
|
72
|
-
if rest_of_query
|
72
|
+
if rest_of_query[0] == "1"
|
73
73
|
rest_of_query[0] = "*"
|
74
74
|
end
|
75
|
-
if rest_of_query
|
75
|
+
if rest_of_query[0] == "*"
|
76
76
|
from_table = LimitHelpers.get_table_name(rest_of_query)
|
77
77
|
rest_of_query = from_table + '.' + rest_of_query
|
78
78
|
end
|
@@ -41,7 +41,7 @@ module ::ArJdbc
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def simplified_type(field_type)
|
44
|
-
return :integer if field_type =~ /^serial/i
|
44
|
+
return :integer if field_type =~ /^(big|)serial/i
|
45
45
|
return :string if field_type =~ /\[\]$/i || field_type =~ /^interval/i
|
46
46
|
return :string if field_type =~ /^(?:point|lseg|box|"?path"?|polygon|circle)/i
|
47
47
|
return :datetime if field_type =~ /^timestamp/i
|
data/lib/arjdbc/version.rb
CHANGED
data/test/abstract_db_create.rb
CHANGED
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'jdbc_common'
|
2
|
+
require 'db/postgres'
|
3
|
+
|
4
|
+
class CreateNativeTypeMappingTestSchema < ActiveRecord::Migration
|
5
|
+
def self.up
|
6
|
+
execute "DROP SEQUENCE IF EXISTS seq_pk_customers"
|
7
|
+
execute "CREATE SEQUENCE seq_pk_customers"
|
8
|
+
execute %q{
|
9
|
+
CREATE TABLE customers (
|
10
|
+
bigint_serial_should_be_integer bigint default nextval('seq_pk_customers'),
|
11
|
+
integer_serial_should_be_integer integer default nextval('seq_pk_customers'),
|
12
|
+
varchar_should_be_string varchar(2),
|
13
|
+
timestamp_should_be_datetime timestamp,
|
14
|
+
bytea_should_be_binary bytea,
|
15
|
+
double_precision_should_be_float double precision,
|
16
|
+
real_should_be_float real,
|
17
|
+
bool_should_be_boolean bool,
|
18
|
+
interval_should_be_string interval,
|
19
|
+
bigint_should_be_integer bigint
|
20
|
+
)}
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.down
|
24
|
+
execute "DROP TABLE customers"
|
25
|
+
execute "DROP SEQUENCE IF EXISTS seq_pk_customers"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class Customer < ActiveRecord::Base
|
30
|
+
end
|
31
|
+
|
32
|
+
class PostgresNativeTypeMappingTest < Test::Unit::TestCase
|
33
|
+
def setup
|
34
|
+
CreateNativeTypeMappingTestSchema.up
|
35
|
+
end
|
36
|
+
|
37
|
+
def teardown
|
38
|
+
CreateNativeTypeMappingTestSchema.down
|
39
|
+
end
|
40
|
+
|
41
|
+
def column_type(column_name)
|
42
|
+
Customer.columns.detect { |c| c.name == column_name }.type
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_bigint_serial_should_be_mapped_to_integer
|
46
|
+
assert_equal :integer, column_type("bigint_serial_should_be_integer")
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_integer_serial_should_be_mapped_to_integer
|
50
|
+
assert_equal :integer, column_type("integer_serial_should_be_integer")
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_varchar_should_be_mapped_to_string
|
54
|
+
assert_equal :string, column_type("varchar_should_be_string")
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_timestamp_should_be_mapped_to_datetime
|
58
|
+
assert_equal :datetime, column_type("timestamp_should_be_datetime")
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_bytea_should_be_mapped_to_binary
|
62
|
+
assert_equal :binary, column_type("bytea_should_be_binary")
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_double_precision_should_be_mapped_to_float
|
66
|
+
assert_equal :float, column_type("double_precision_should_be_float")
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_real_should_be_mapped_to_float
|
70
|
+
assert_equal :float, column_type("real_should_be_float")
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_bool_should_be_mapped_to_boolean
|
74
|
+
assert_equal :boolean, column_type("bool_should_be_boolean")
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_interval_should_be_mapped_to_string
|
78
|
+
assert_equal :string, column_type("interval_should_be_string")
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_bigint_should_be_mapped_to_integer
|
82
|
+
assert_equal :integer, column_type("bigint_should_be_integer")
|
83
|
+
end
|
84
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: activerecord-jdbc-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.1.
|
5
|
+
version: 1.1.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Nick Sieger, Ola Bini and JRuby contributors
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-07-26 00:00:00 -05:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- test/postgres_drop_db_test.rb
|
178
178
|
- test/postgres_information_schema_leak_test.rb
|
179
179
|
- test/postgres_mixed_case_test.rb
|
180
|
+
- test/postgres_native_type_mapping_test.rb
|
180
181
|
- test/postgres_nonseq_pkey_test.rb
|
181
182
|
- test/postgres_reserved_test.rb
|
182
183
|
- test/postgres_schema_search_path_test.rb
|