activerecord-netezza-adapter 0.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Robb Kidd
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # Activerecord::Netezza::Adapter
2
+
3
+ ActiveRecord JDBC adapter for Netezza backends.
4
+
5
+ Netezza does not have a data type to map to `:text` and `:binary`. You can
6
+ use [activerecord-jdbc-adapter][arjdbc.git] to connect if you remove those
7
+ data types from the type converter lookup hash `AR_TO_JDBC_TYPES`. Here's
8
+ the monkey patch to do so:
9
+
10
+ [arjdbc.git]: https://github.com/jruby/activerecord-jdbc-adapter
11
+
12
+ ```ruby
13
+ require 'arjdbc/jdbc/type_converter'
14
+
15
+ module ActiveRecord
16
+ module ConnectionAdapters
17
+ class JdbcTypeConverter
18
+ AR_TO_JDBC_TYPES.delete(:text)
19
+ AR_TO_JDBC_TYPES.delete(:binary)
20
+ end
21
+ end
22
+ end
23
+ ```
24
+
25
+ The disadvantage of the monkeypatch is that within a codebase using
26
+ ARJDBC and the patch, no other JDBC driver will have the `:text` and
27
+ `:binary` data types. This gem is intended to confine the removal of
28
+ types to only database connections using this adapter.
29
+
30
+ The organization of the adapter was cribbed wholesale from
31
+ [Nick Sieger's CacheDB adapter][cachedb.git].
32
+ Any errors are my own.
33
+
34
+ [cachedb.git]: https://github.com/nicksieger/activerecord-cachedb-adapter
35
+
36
+ ## Installation
37
+
38
+ Add these lines to your application's Gemfile:
39
+
40
+ ```ruby
41
+ gem 'activerecord-netezza-adapter',
42
+ :git => 'https://github.com/robbkidd/activerecord-netezza-adapter'
43
+ ```
44
+
45
+ And then execute:
46
+
47
+ $ bundle
48
+
49
+ Or install it yourself as:
50
+
51
+ $ gem install activerecord-netezza-adapter
52
+
53
+ Place the Netezza JDBC driver--not distributed with this gem--in
54
+ your JRuby classpath.
55
+
56
+ For example, place nzjdbc3.jar in vendor/lib/java. If using Warbler
57
+ to deploy your app as a WAR, include the following in config/warble.rb
58
+
59
+ ```ruby
60
+ config.java_libs += FileList["vendor/lib/java/*.jar"]
61
+ ```
62
+
63
+ ## Usage
64
+
65
+ Define your database connection information as expected:
66
+
67
+ ```yaml
68
+ development:
69
+ adapter: netezza
70
+ host: nzhostname
71
+ database: dbname
72
+ user: username
73
+ password: $up3r$3cr3t!
74
+ ```
75
+
76
+
77
+ ## Contributing
78
+
79
+ 1. Fork it
80
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
81
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
82
+ 4. Push to the branch (`git push origin my-new-feature`)
83
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/activerecord-netezza-adapter', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Robb Kidd"]
6
+ gem.email = ["robb@thekidds.org"]
7
+ gem.summary = %q{ActiveRecord JDBC adapter for Netezza}
8
+ gem.description = %q{ActiveRecord adapter for Netezza. Only for user with JRuby.
9
+ Requires a separate Netezza JDBC driver.}
10
+ gem.homepage = "http://github.com/robbkidd/activerecord-netezza-adapter"
11
+
12
+ gem.platform = Gem::Platform.new([nil, 'java', nil])
13
+ gem.files = %w[
14
+ LICENSE
15
+ README.md
16
+ Rakefile
17
+ activerecord-netezza-adapter.gemspec
18
+ lib/active_record/connection_adapters/netezza_adapter.rb
19
+ lib/activerecord-netezza-adapter.rb
20
+ lib/arjdbc/netezza.rb
21
+ lib/arjdbc/netezza/adapter.rb
22
+ lib/arjdbc/netezza/connection_methods.rb
23
+ lib/arjdbc/discover.rb
24
+ ]
25
+ gem.name = "activerecord-netezza-adapter"
26
+ gem.require_paths = ["lib"]
27
+ gem.version = ArJdbc::Netezza::VERSION
28
+
29
+ gem.add_dependency(%q<activerecord-jdbc-adapter>, ['>= 1.0.0'])
30
+
31
+ end
@@ -0,0 +1 @@
1
+ require 'arjdbc/netezza'
@@ -0,0 +1,5 @@
1
+ module ArJdbc
2
+ module Netezza
3
+ VERSION = "0.1"
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ # arjdbc/discover.rb: Declare ArJdbc.extension modules in this file
2
+ # that loads a custom module and adapter.
3
+
4
+ module ::ArJdbc
5
+ extension :Netezza do |name|
6
+ if name =~ /netezza/i
7
+ require 'arjdbc/netezza'
8
+ true
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ require 'arjdbc/jdbc'
2
+ require 'arjdbc/netezza/connection_methods'
3
+ require 'arjdbc/netezza/adapter'
@@ -0,0 +1,19 @@
1
+ module ::ArJdbc
2
+ module Netezza
3
+ def self.arel2_visitors(config)
4
+ { 'netezza' => ::Arel::Visitors::ToSql }
5
+ end
6
+
7
+ def self.column_selector
8
+ [ /netezza/i, lambda { | cfg, col | col.extend( ::ArJdbc::Netezza::Column ) } ]
9
+ end
10
+
11
+ module Column
12
+ end
13
+
14
+ def modify_types(tp)
15
+ tp[:text] = nil
16
+ tp[:binary] = nil
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,10 @@
1
+ class ActiveRecord::Base
2
+ class << self
3
+ def netezza_connection( config )
4
+ config[:port] ||= 5480
5
+ config[:url] ||= "jdbc:netezza://#{config[:host]}:#{config[:port]}/#{config[:database]}"
6
+ config[:driver] ||= "org.netezza.Driver"
7
+ jdbc_connection(config)
8
+ end
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activerecord-netezza-adapter
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: "0.1"
6
+ platform: java
7
+ authors:
8
+ - Robb Kidd
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-08-09 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activerecord-jdbc-adapter
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.0.0
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ description: |-
27
+ ActiveRecord adapter for Netezza. Only for user with JRuby.
28
+ Requires a separate Netezza JDBC driver.
29
+ email:
30
+ - robb@thekidds.org
31
+ executables: []
32
+
33
+ extensions: []
34
+
35
+ extra_rdoc_files: []
36
+
37
+ files:
38
+ - LICENSE
39
+ - README.md
40
+ - Rakefile
41
+ - activerecord-netezza-adapter.gemspec
42
+ - lib/active_record/connection_adapters/netezza_adapter.rb
43
+ - lib/activerecord-netezza-adapter.rb
44
+ - lib/arjdbc/netezza.rb
45
+ - lib/arjdbc/netezza/adapter.rb
46
+ - lib/arjdbc/netezza/connection_methods.rb
47
+ - lib/arjdbc/discover.rb
48
+ homepage: http://github.com/robbkidd/activerecord-netezza-adapter
49
+ licenses: []
50
+
51
+ post_install_message:
52
+ rdoc_options: []
53
+
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: "0"
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ requirements: []
69
+
70
+ rubyforge_project:
71
+ rubygems_version: 1.8.24
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: ActiveRecord JDBC adapter for Netezza
75
+ test_files: []
76
+