activerecord-mysql2rgeo-adapter 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_record/connection_adapters/mysql2rgeo/column_methods.rb +2 -2
- data/lib/active_record/connection_adapters/mysql2rgeo/create_connection.rb +2 -2
- data/lib/active_record/connection_adapters/mysql2rgeo/schema_statements.rb +2 -6
- data/lib/active_record/connection_adapters/mysql2rgeo/version.rb +1 -1
- data/lib/active_record/connection_adapters/mysql2rgeo_adapter.rb +13 -4
- data/lib/active_record/type/spatial.rb +13 -13
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a35cacf27708b88079361795afb35a4673ceb7c
|
4
|
+
data.tar.gz: af091d82862dabd35ebeaf824402ff41549d0250
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a3c6341b3d00589d31a4fddb8a8cbbbbfa0f20a411fedf02f48953f8cdb81fcc7b90617e1f4e00a38440927208f76487d5758138c2994fac2a751340cf767a4
|
7
|
+
data.tar.gz: 30c1d75c52971c065ff6f39c37dd015cd40781a7638bba5eb5ee86607d5fd3c2da73b3bceded05a681ca966922d11d2516d766834904d1f11cf0b94bb2522d54
|
@@ -8,16 +8,12 @@ module ActiveRecord
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def type_to_sql(type, limit = nil, precision = nil, scale = nil, array = nil)
|
11
|
-
if (info =
|
11
|
+
if (info = RGeo::ActiveRecord.geometric_type_from_name(type.to_s.delete("_")))
|
12
12
|
type = limit[:type] || type if limit.is_a?(::Hash)
|
13
13
|
type = "geometry" if type.to_s == "spatial"
|
14
14
|
type = type.to_s.delete("_").upcase
|
15
15
|
end
|
16
|
-
super
|
17
|
-
end
|
18
|
-
|
19
|
-
def spatial_column_constructor(name)
|
20
|
-
RGeo::ActiveRecord::DEFAULT_SPATIAL_COLUMN_CONSTRUCTORS[name]
|
16
|
+
super
|
21
17
|
end
|
22
18
|
|
23
19
|
# override
|
@@ -3,15 +3,22 @@
|
|
3
3
|
|
4
4
|
# :stopdoc:
|
5
5
|
|
6
|
-
require "active_record/connection_adapters/mysql2_adapter"
|
7
6
|
require "rgeo/active_record"
|
7
|
+
|
8
|
+
# autoload AbstractAdapter to avoid circular require and void context warnings
|
9
|
+
module ActiveRecord
|
10
|
+
module ConnectionAdapters
|
11
|
+
AbstractAdapter
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
require "active_record/connection_adapters/mysql2_adapter"
|
8
16
|
require "active_record/connection_adapters/mysql2rgeo/version"
|
9
17
|
require "active_record/connection_adapters/mysql2rgeo/column_methods"
|
10
18
|
require "active_record/connection_adapters/mysql2rgeo/schema_statements"
|
11
19
|
require "active_record/connection_adapters/mysql2rgeo/spatial_table_definition"
|
12
20
|
require "active_record/connection_adapters/mysql2rgeo/spatial_column"
|
13
21
|
require "active_record/connection_adapters/mysql2rgeo/spatial_expressions"
|
14
|
-
require "arel/visitors/bind_visitor"
|
15
22
|
require "active_record/connection_adapters/mysql2rgeo/arel_tosql"
|
16
23
|
require "active_record/type/spatial"
|
17
24
|
require "active_record/connection_adapters/mysql2rgeo/create_connection"
|
@@ -39,8 +46,6 @@ module ActiveRecord
|
|
39
46
|
# http://postgis.17.x6.nabble.com/Default-SRID-td5001115.html
|
40
47
|
DEFAULT_SRID = 0
|
41
48
|
|
42
|
-
ADAPTER_NAME = "Mysql2Rgeo".freeze
|
43
|
-
|
44
49
|
def initialize(connection, logger, connection_options, config)
|
45
50
|
super
|
46
51
|
|
@@ -48,6 +53,10 @@ module ActiveRecord
|
|
48
53
|
@visitor.extend(DetermineIfPreparableVisitor) if self.class.type_cast_config_to_boolean(config.fetch(:prepared_statements) { true })
|
49
54
|
end
|
50
55
|
|
56
|
+
def adapter_name
|
57
|
+
"Mysql2Rgeo".freeze
|
58
|
+
end
|
59
|
+
|
51
60
|
def self.spatial_column_options(key)
|
52
61
|
SPATIAL_COLUMN_OPTIONS[key]
|
53
62
|
end
|
@@ -22,9 +22,9 @@ module ActiveRecord
|
|
22
22
|
def self.parse_sql_type(sql_type)
|
23
23
|
geo_type, srid, has_z, has_m = nil, 0, false, false
|
24
24
|
|
25
|
-
if sql_type =~ /
|
25
|
+
if sql_type =~ /(geography|geometry)\((.*)\)$/i
|
26
26
|
# geometry(Point,4326)
|
27
|
-
params = Regexp.last_match(
|
27
|
+
params = Regexp.last_match(2).split(",")
|
28
28
|
if params.size > 1
|
29
29
|
if params.first =~ /([a-z]+[^zm])(z?)(m?)/i
|
30
30
|
has_z = !Regexp.last_match(2).empty?
|
@@ -45,25 +45,25 @@ module ActiveRecord
|
|
45
45
|
[geo_type, srid, has_z, has_m]
|
46
46
|
end
|
47
47
|
|
48
|
-
def
|
49
|
-
|
48
|
+
def spatial_factory
|
49
|
+
@spatial_factory ||=
|
50
|
+
RGeo::ActiveRecord::SpatialFactoryStore.instance.factory(
|
51
|
+
geo_type: @geo_type,
|
52
|
+
sql_type: @sql_type,
|
53
|
+
srid: @srid
|
54
|
+
)
|
50
55
|
end
|
51
56
|
|
52
|
-
def
|
53
|
-
:geometry
|
57
|
+
def klass
|
58
|
+
type == :geometry ? RGeo::Feature::Geometry : super
|
54
59
|
end
|
55
60
|
|
56
61
|
def spatial?
|
57
62
|
true
|
58
63
|
end
|
59
64
|
|
60
|
-
def
|
61
|
-
|
62
|
-
RGeo::ActiveRecord::SpatialFactoryStore.instance.factory(
|
63
|
-
geo_type: @geo_type,
|
64
|
-
sql_type: @sql_type,
|
65
|
-
srid: @srid
|
66
|
-
)
|
65
|
+
def type
|
66
|
+
:geometry
|
67
67
|
end
|
68
68
|
|
69
69
|
# support setting an RGeo object or a WKT string
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-mysql2rgeo-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yongdae Hwang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '6.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '6.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.6.
|
137
|
+
rubygems_version: 2.6.13
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: ActiveRecord adapter for MySQL, based on RGeo.
|