activerecord-jdbcvertica-adapter 0.0.1 → 0.0.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: e5459f0f11071a51788a81dbf27ea7aac63e2600
4
- data.tar.gz: 4d35b4c163bbc92826a2855bf1f3f977e3f726bc
3
+ metadata.gz: ef8c99593c309ea5022843f5e859fb227ac8cad0
4
+ data.tar.gz: fafac54837575e44c2942da0870a2b2b055defc4
5
5
  SHA512:
6
- metadata.gz: faa8b2172233defd616bc05b03564d5116a5b778e2f95b00924b268065553b4137231b93e4351d732e54d884e125574316afff0114f5f605926b1b3b208b5ef2
7
- data.tar.gz: 129db38199c19ae24803907f259714251109d20cd7a677f7aa2266fc271b44ff601ef728969840fa5821b08b51e5bc1b6030558d217ccd325160d342bd4c8d3e
6
+ metadata.gz: c991d5d66846f4281e6c2c3edac37bb2acd3504f6937eb51989ab4c67cd24d95ad943c6b0e90fb742d3f4d2c68495f0764aa08863f0db3ffa5daf1675d3049b2
7
+ data.tar.gz: 36b62487759985b87e310f947eb29f5dc7c60f32346af1cf94278756045ce96b38377c4c571752f779f75df029a5d1ad76ed7a9f54df12e9668c923f0baf1ac2
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  # Activerecord::Jdbcvertica::Adapter
2
-
3
- TODO: Write a gem description
2
+ ActiveRecord adapter for Vertica databases (version 5,6,7) that works on Jruby with Vertica JDBC adapter
4
3
 
5
4
  ## Installation
6
5
 
@@ -18,8 +17,6 @@ Or install it yourself as:
18
17
 
19
18
  ## Usage
20
19
 
21
- TODO: Write usage instructions here
22
-
23
20
  ## Contributing
24
21
 
25
22
  1. Fork it
@@ -1,7 +1,7 @@
1
1
  module Activerecord
2
2
  module Jdbcvertica
3
3
  module Adapter
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  end
@@ -6,7 +6,7 @@ module ::ArJdbc
6
6
  ADAPTER_NAME = 'Vertica'.freeze
7
7
 
8
8
  NATIVE_DATABASE_TYPES = {
9
- :primary_key => "auto_increment",
9
+ :primary_key => "auto_increment primary key",
10
10
  :string => { :name => "varchar", :limit => 255 },
11
11
  :text => { :name => "varchar", :limit => 15000 },
12
12
  :integer => { :name => "integer" },
@@ -40,6 +40,18 @@ module ::ArJdbc
40
40
  NATIVE_DATABASE_TYPES
41
41
  end
42
42
 
43
+ ##
44
+ # Vertica should "auto-discover" the primary key if marked on the table
45
+ #
46
+ def primary_keys(table)
47
+ @primary_keys ||= {}
48
+ return @primary_keys[table] if @primary_keys[table]
49
+
50
+ keys = self.execute("SELECT column_name FROM v_catalog.primary_keys WHERE table_name = '#{table}';")
51
+ @primary_keys[table] = [ keys.first['column_name'] ]
52
+ @primary_keys[table]
53
+ end
54
+
43
55
  ##
44
56
  # Vertica does not allow the table name to prefix the columns when
45
57
  # setting a value, this is not a pleasant work-around, but it works
@@ -48,15 +60,15 @@ module ::ArJdbc
48
60
  quote_column_name(attr)
49
61
  end
50
62
 
63
+ def rename_index(*args)
64
+ raise ArgumentError, "rename_index does not work on Vertica"
65
+ end
66
+
51
67
  end
52
68
  end
53
69
 
54
70
  module ActiveRecord::ConnectionAdapters
55
71
  class VerticaAdapter < JdbcAdapter
56
72
  include ::ArJdbc::Vertica
57
-
58
- def rename_index(*args)
59
- raise ArgumentError, "rename_index does not work on Vertica"
60
- end
61
73
  end
62
74
  end
@@ -22,8 +22,7 @@ class CreateFullObject < ::ActiveRecord::Migration
22
22
  end
23
23
  end
24
24
 
25
- class FullObject < ::ActiveRecord::Base;
26
- self.primary_key = "id"
25
+ class FullObject < ::ActiveRecord::Base
27
26
  end
28
27
 
29
28
  describe ::FullObject do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-jdbcvertica-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.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: 2013-12-17 00:00:00.000000000 Z
11
+ date: 2013-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord