activerecord-jdbcvertica-adapter 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c504c3898547326269ed564b4fc3b3727319357
4
- data.tar.gz: 9d0c43f696fc4dd2b2edc73293becd80f8778a74
3
+ metadata.gz: 5dbec5c833688c257a491023ac4c705edf3073da
4
+ data.tar.gz: 0f7795385af9facee847028910947b5026c8b39c
5
5
  SHA512:
6
- metadata.gz: ce2c6e47d4c9c740370b356a0be6c6a8d6aa643bd7a246ba8d40d94436fcd79e5d19fb890f49b299bca49e0d37818b28922e99d5c6574c6b3721b3489c155564
7
- data.tar.gz: 5e2c723b053d018814a1d6bdb32a374dcd1744ed9e60d0df972af2c1768791936c0492257b97688d7b5993260b967183ef3859a9c37bff69102ba2ae8b1495e2
6
+ metadata.gz: 050b16f9b05b68011d43253d37c0fc408eebea0094a4f5ee008adda649baed4fa05205e6f3ef647e970be6dcbdddfb141041e95ca30531f1c9d21fef095d0f86
7
+ data.tar.gz: 4c10b2a4f21c39f712c4abcfeed7c8b5244b5a835c4749362b0aefccac1b0151379b5457ea152570027eb3f733d45b5e6e56b76c2909fa8b0dbf71ed7ce010ed
@@ -1,4 +1,4 @@
1
1
  require 'java'
2
- require 'activerecord-jdbcvertica-adapter/jars/vertica-jdbc-7.0.0-0.jar'
2
+ require 'activerecord-jdbcvertica-adapter/jars/vertica-jdbc-7.2.3-0.jar'
3
3
 
4
4
  require 'arjdbc/vertica'
@@ -0,0 +1,4 @@
1
+ require 'java'
2
+ require 'activerecord-jdbcvertica-adapter/jars/vertica-jdbc-8.0.1-0.jar'
3
+
4
+ require 'arjdbc/vertica'
@@ -1,7 +1,7 @@
1
1
  module Activerecord
2
2
  module Jdbcvertica
3
3
  module Adapter
4
- VERSION = "0.1.2"
4
+ VERSION = "0.2.0"
5
5
  end
6
6
  end
7
7
  end
@@ -112,6 +112,7 @@ module ::ArJdbc
112
112
  ::ActiveRecord::ConnectionAdapters::VerticaColumn.new(
113
113
  raw_column['column_name'],
114
114
  raw_column['column_default'],
115
+ raw_column['data_type_id'],
115
116
  raw_column['data_type'],
116
117
  raw_column['is_nullable'],
117
118
  raw_column['is_identity']
@@ -2,12 +2,82 @@ module ActiveRecord
2
2
 
3
3
  module ConnectionAdapters
4
4
  class VerticaColumn < Column
5
- def initialize(name, default, sql_type = nil, null = true, primary_key = false)
6
- super(name, self.class.extract_value_from_default(default), sql_type, null)
5
+ def initialize(name, default, data_type_id, sql_type = nil, null = true, primary_key = false)
6
+ super(name,
7
+ self.class.extract_value_from_default(default),
8
+ self.class.cast_type_from_data_type_id(data_type_id) || self.class.cast_type_from_sql_type(sql_type),
9
+ sql_type,
10
+ null)
7
11
  # Might need to set if it is primary key below? don't know
8
12
  # self.primary = primary_key
9
13
  end
10
14
 
15
+ def self.cast_type_from_data_type_id(data_type_id)
16
+ case data_type_id
17
+ when 5 #, 'bool', :bool
18
+ ::ActiveRecord::Type::Boolean.new
19
+ when 6 #, 'integer', :integer
20
+ ::ActiveRecord::Type::Integer.new
21
+ when 7 #, 'float', :float
22
+ ::ActiveRecord::Type::Float.new
23
+ when 8 #, 'char', :unicode_string
24
+ ::ActiveRecord::Type::String.new
25
+ when 9 #, 'varchar', :unicode_string
26
+ ::ActiveRecord::Type::String.new
27
+ when 10 #, 'date', :date
28
+ ::ActiveRecord::Type::Date.new
29
+ when 11 #, 'time'
30
+ ::ActiveRecord::Type::Time.new
31
+ when 12 #, 'timestamp', :timestamp
32
+ ::ActiveRecord::Type::DateTime.new
33
+ when 13 #, 'timestamp_tz', :timestamp
34
+ ::ActiveRecord::Type::DateTime.new
35
+ when 14 #, 'time_tz'
36
+ ::ActiveRecord::Type::DateTime.new
37
+ when 16 #, 'numeric', :bigdecimal
38
+ ::ActiveRecord::Type::Decimal.new
39
+ when 17 #, 'bytes', :binary_string
40
+ ::ActiveRecord::Type::Binary.new
41
+ when 115 #, 'long varchar', :unicode_string
42
+ ::ActiveRecord::Type::String.new
43
+ else
44
+ nil
45
+ end
46
+ end
47
+
48
+ def self.cast_type_from_sql_type(sql_type)
49
+ case "#{sql_type}"
50
+ when /bool/i # :bool
51
+ ::ActiveRecord::Type::Boolean.new
52
+ when /integer/i # :integer
53
+ ::ActiveRecord::Type::Integer.new
54
+ when /float/i # :float
55
+ ::ActiveRecord::Type::Float.new
56
+ when /^char/i # :unicode_string
57
+ ::ActiveRecord::Type::String.new
58
+ when /varchar/i # :unicode_string
59
+ ::ActiveRecord::Type::String.new
60
+ when /long varchar/i # :unicode_string
61
+ ::ActiveRecord::Type::String.new
62
+ when /date/i # :date
63
+ ::ActiveRecord::Type::Date.new
64
+ when /time$/i
65
+ ::ActiveRecord::Type::Time.new
66
+ when /timestamp$/i # :timestamp
67
+ ::ActiveRecord::Type::DateTime.new
68
+ when /timestamp_tz/i # :timestamp
69
+ ::ActiveRecord::Type::DateTime.new
70
+ when /time_tz/i
71
+ ::ActiveRecord::Type::DateTime.new
72
+ when /numeric/i # :bigdecimal
73
+ ::ActiveRecord::Type::Decimal.new
74
+ when /bytes/i # :binary_string
75
+ ::ActiveRecord::Type::Binary.new
76
+ else
77
+ nil
78
+ end
79
+ end
80
+
11
81
  def self.extract_value_from_default(default)
12
82
  case default
13
83
  # Numeric types
@@ -35,8 +35,10 @@ class ActiveRecord::Base
35
35
 
36
36
  class << self
37
37
  # connection methods should be the same
38
+ alias_method :vertica8_connection, :vertica5_connection
38
39
  alias_method :vertica7_connection, :vertica5_connection
39
40
  alias_method :vertica6_connection, :vertica5_connection
41
+ alias_method :jdbcvertica8_connection, :vertica5_connection
40
42
  alias_method :jdbcvertica7_connection, :vertica5_connection
41
43
  alias_method :jdbcvertica6_connection, :vertica5_connection
42
44
  alias_method :jdbcvertica5_connection, :vertica5_connection
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-jdbcvertica-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Dewitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-18 00:00:00.000000000 Z
11
+ date: 2017-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - '>='
16
+ - - ">="
17
17
  - !ruby/object:Gem::Version
18
18
  version: '0'
19
19
  name: activerecord
@@ -21,13 +21,13 @@ dependencies:
21
21
  type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - '>='
30
+ - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: '0'
33
33
  name: activerecord-jdbc-adapter
@@ -35,13 +35,13 @@ dependencies:
35
35
  type: :runtime
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  name: bundler
@@ -49,13 +49,13 @@ dependencies:
49
49
  type: :development
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - '>='
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  name: mocha
@@ -63,13 +63,13 @@ dependencies:
63
63
  type: :development
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - '>='
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  name: pry
@@ -77,13 +77,13 @@ dependencies:
77
77
  type: :development
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  requirement: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  name: rake
@@ -91,17 +91,17 @@ dependencies:
91
91
  type: :development
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- description: ' An ActiveRecord adapter for Vertica databases (jdbc based) '
97
+ description: " An ActiveRecord adapter for Vertica databases (jdbc based) "
98
98
  email:
99
99
  - brandonsdewitt@gmail.com
100
100
  executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - .gitignore
104
+ - ".gitignore"
105
105
  - Gemfile
106
106
  - LICENSE.txt
107
107
  - README.md
@@ -110,8 +110,10 @@ files:
110
110
  - lib/active_record/connection_adapters/vertica5_adapter.rb
111
111
  - lib/active_record/connection_adapters/vertica6_adapter.rb
112
112
  - lib/active_record/connection_adapters/vertica7_adapter.rb
113
+ - lib/active_record/connection_adapters/vertica8_adapter.rb
113
114
  - lib/activerecord-jdbcvertica-adapter.rb
114
- - lib/activerecord-jdbcvertica-adapter/jars/vertica-jdbc-7.0.0-0.jar
115
+ - lib/activerecord-jdbcvertica-adapter/jars/vertica-jdbc-7.2.3-0.jar
116
+ - lib/activerecord-jdbcvertica-adapter/jars/vertica-jdbc-8.0.1-0.jar
115
117
  - lib/activerecord-jdbcvertica-adapter/jars/vertica-jdk5-6.1.3-0.jar
116
118
  - lib/activerecord-jdbcvertica-adapter/railtie.rb
117
119
  - lib/activerecord-jdbcvertica-adapter/version.rb
@@ -136,17 +138,17 @@ require_paths:
136
138
  - lib
137
139
  required_ruby_version: !ruby/object:Gem::Requirement
138
140
  requirements:
139
- - - '>='
141
+ - - ">="
140
142
  - !ruby/object:Gem::Version
141
143
  version: '0'
142
144
  required_rubygems_version: !ruby/object:Gem::Requirement
143
145
  requirements:
144
- - - '>='
146
+ - - ">="
145
147
  - !ruby/object:Gem::Version
146
148
  version: '0'
147
149
  requirements: []
148
150
  rubyforge_project:
149
- rubygems_version: 2.1.9
151
+ rubygems_version: 2.4.8
150
152
  signing_key:
151
153
  specification_version: 4
152
154
  summary: An ActiveRecord adapter JDBC