activerecord-jdbcvertica-adapter 0.1.1 → 0.1.2

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: 19cfc35f15a9f23356a1a6f1e8e2e3218a0b1d79
4
- data.tar.gz: 6fe19177720c5a296a692ae5d72343b576c82868
3
+ metadata.gz: 4c504c3898547326269ed564b4fc3b3727319357
4
+ data.tar.gz: 9d0c43f696fc4dd2b2edc73293becd80f8778a74
5
5
  SHA512:
6
- metadata.gz: 49d7dab9570e8494e759f65dc2b2b57e05eefebd298e4292ab29ce374f4e4039a0f3fb20d6b56b1811bf76d13e02e0b5382a65a50c9e176d90e9651498f23512
7
- data.tar.gz: 72a2447a0ed4b14d9399ef76f86bf0edf79e45a3d1ed3d66eb6f705c750cb5ef6fe0e010f690d4c3ff560d4de727ffe0e0193ad5ae7cf49b583e80c85b298f5d
6
+ metadata.gz: ce2c6e47d4c9c740370b356a0be6c6a8d6aa643bd7a246ba8d40d94436fcd79e5d19fb890f49b299bca49e0d37818b28922e99d5c6574c6b3721b3489c155564
7
+ data.tar.gz: 5e2c723b053d018814a1d6bdb32a374dcd1744ed9e60d0df972af2c1768791936c0492257b97688d7b5993260b967183ef3859a9c37bff69102ba2ae8b1495e2
@@ -1,7 +1,7 @@
1
1
  module Activerecord
2
2
  module Jdbcvertica
3
3
  module Adapter
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,30 @@
1
1
  class ActiveRecord::Base
2
+ def self.parse_port_from_host(host)
3
+ # looking for vertica_host_1:2098
4
+ return nil unless host.include?(":")
5
+ host.split(":").last
6
+ end
7
+
8
+ def self.trim_port_from_host(host)
9
+ return host unless host.include?(":")
10
+ host_parts = host.split(":")
11
+ host_parts.pop
12
+ host_parts.join(":")
13
+ end
14
+
2
15
  def self.vertica5_connection(config)
3
- config[:port] ||= 5433
4
- config[:url] = "jdbc:vertica://#{config[:host]}:#{config[:port]}/#{config[:database]}"
16
+ current_host = nil
17
+ current_port = nil
18
+
19
+ if config[:hosts] && config[:hosts].is_a?(Array)
20
+ current_host = config[:hosts].sample
21
+ current_port = parse_port_from_host(current_host)
22
+ current_host = trim_port_from_host(current_host)
23
+ end
24
+
25
+ current_host ||= config[:host]
26
+ current_port ||= config[:port]
27
+ config[:url] = "jdbc:vertica://#{current_host}:#{current_port}/#{config[:database]}"
5
28
  config[:driver] = "com.vertica.jdbc.Driver"
6
29
  config[:prepared_statements] = false
7
30
  config[:connection_alive_sql] = "SELECT 1;"
metadata CHANGED
@@ -1,99 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-jdbcvertica-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Dewitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-27 00:00:00.000000000 Z
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activerecord
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
14
  requirement: !ruby/object:Gem::Requirement
21
15
  requirements:
22
16
  - - '>='
23
17
  - !ruby/object:Gem::Version
24
18
  version: '0'
19
+ name: activerecord
25
20
  prerelease: false
26
21
  type: :runtime
27
- - !ruby/object:Gem::Dependency
28
- name: activerecord-jdbc-adapter
29
22
  version_requirements: !ruby/object:Gem::Requirement
30
23
  requirements:
31
24
  - - '>='
32
25
  - !ruby/object:Gem::Version
33
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
34
28
  requirement: !ruby/object:Gem::Requirement
35
29
  requirements:
36
30
  - - '>='
37
31
  - !ruby/object:Gem::Version
38
32
  version: '0'
33
+ name: activerecord-jdbc-adapter
39
34
  prerelease: false
40
35
  type: :runtime
41
- - !ruby/object:Gem::Dependency
42
- name: bundler
43
36
  version_requirements: !ruby/object:Gem::Requirement
44
37
  requirements:
45
38
  - - '>='
46
39
  - !ruby/object:Gem::Version
47
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
48
42
  requirement: !ruby/object:Gem::Requirement
49
43
  requirements:
50
44
  - - '>='
51
45
  - !ruby/object:Gem::Version
52
46
  version: '0'
47
+ name: bundler
53
48
  prerelease: false
54
49
  type: :development
55
- - !ruby/object:Gem::Dependency
56
- name: mocha
57
50
  version_requirements: !ruby/object:Gem::Requirement
58
51
  requirements:
59
52
  - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
62
56
  requirement: !ruby/object:Gem::Requirement
63
57
  requirements:
64
58
  - - '>='
65
59
  - !ruby/object:Gem::Version
66
60
  version: '0'
61
+ name: mocha
67
62
  prerelease: false
68
63
  type: :development
69
- - !ruby/object:Gem::Dependency
70
- name: pry
71
64
  version_requirements: !ruby/object:Gem::Requirement
72
65
  requirements:
73
66
  - - '>='
74
67
  - !ruby/object:Gem::Version
75
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
76
70
  requirement: !ruby/object:Gem::Requirement
77
71
  requirements:
78
72
  - - '>='
79
73
  - !ruby/object:Gem::Version
80
74
  version: '0'
75
+ name: pry
81
76
  prerelease: false
82
77
  type: :development
83
- - !ruby/object:Gem::Dependency
84
- name: rake
85
78
  version_requirements: !ruby/object:Gem::Requirement
86
79
  requirements:
87
80
  - - '>='
88
81
  - !ruby/object:Gem::Version
89
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
90
84
  requirement: !ruby/object:Gem::Requirement
91
85
  requirements:
92
86
  - - '>='
93
87
  - !ruby/object:Gem::Version
94
88
  version: '0'
89
+ name: rake
95
90
  prerelease: false
96
91
  type: :development
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
97
  description: ' An ActiveRecord adapter for Vertica databases (jdbc based) '
98
98
  email:
99
99
  - brandonsdewitt@gmail.com