pg_jruby 0.14.1.rc1-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 782608f451aebd291bb0c2081f735e401b39abaa
4
+ data.tar.gz: 8b22644fffd58f284c1c8154764082fb1a24dde4
5
+ SHA512:
6
+ metadata.gz: 15d5ff7f2a125287b98111624cfa63dd692e473e2986480262793a6b818d71be9620033e56193f62eea3899473d3bae906b22bdc7fdde02b5807826b344b8aff
7
+ data.tar.gz: 5257b765e157ecd6111db1795fd3523252ce6744e24bee469da57b3c2e3410a4088a4c3357446ad519f7347239cc8ca5b351222c9549e7b0edf5d3c2aa26c33b
File without changes
@@ -0,0 +1,7 @@
1
+ === 1.0.0 / 2012-10-25
2
+
3
+ * BUG
4
+ * Prepared statements that don't return results hung
5
+ * Result::getvalue dies on NULL value
6
+ * Result::cmd_tuples should return the number of affected rows
7
+ * Connection::connect passes the 'options' properly to the backend.
@@ -0,0 +1,11 @@
1
+ CHANGELOG.rdoc
2
+ Manifest.txt
3
+ README.rdoc
4
+ Rakefile
5
+ bin/pg
6
+ lib/pg.rb
7
+ lib/pg/result.rb
8
+ lib/pg/constants.rb
9
+ lib/pg/connection.rb
10
+ lib/pg/exceptions.rb
11
+ lib/pg_ext.jar
@@ -0,0 +1,122 @@
1
+ = pg
2
+
3
+ * https://github.com/headius/jruby-pg
4
+
5
+ == DESCRIPTION:
6
+
7
+ This is a native implementation of the Postsgres protocol written
8
+ entirely in Java. The project was started by @headius as a ruby-pg
9
+ replacement for JRuby that uses the JDBC driver and private API of
10
+ Postgres. Unfortunately ruby-pg (which uses libpq under the hood)
11
+ exposed a lot of features of Postgres that were impossible to
12
+ implement or were complicated given the nature of the JDBC and the
13
+ encapsulation of many features that are exposed in ruby-pg.
14
+
15
+ *WARNING* this gem is not production ready yet. There are many
16
+ bugs that needs to be fixed and more testing. So please checkout
17
+ the code and submit pull requests with some fixes. If your Java-Fu
18
+ isn't that great you can still contribute by submitting test cases
19
+ and We'll be happy to fix them.
20
+
21
+ == FEATURES:
22
+
23
+ * A ruby-pg drop in replacement for JRuby
24
+ * Async operations are supported
25
+ * Large Object API
26
+ * SSL connections
27
+ * Copy operations
28
+ * Zero dependencies on other jars and gems
29
+ * All active record test suite pass (except 5 tests see PROBLEMS).
30
+
31
+ == PROBLEMS:
32
+
33
+ * Due to a bug in JRuby Array#delete
34
+ (https://github.com/jruby/jruby/issues/411) you'll need JRuby 1.7.1
35
+ or later.
36
+ * Due to a bug in the json gem
37
+ (https://github.com/flori/json/pull/152) and (https://github.com/flori/json/pull/155)
38
+ you'll need gem version
39
+ 1.7.7 or later.
40
+ * We currently have some failing tests when we run the activerecord test suite.
41
+ The failing tests are due to the inconsistencies between JRuby and MRI (see
42
+ https://github.com/jruby/jruby/issues/540 and https://github.com/jruby/jruby/pull/539)
43
+ * The current implementation targets postgres protocol V3 (introduced in v 7.4)
44
+ only. I'll wait until someone ask for support of earlier versions.
45
+ * Run pg_search test suites on this implementation
46
+ * lo_import and lo_export are not implemented yet
47
+ * More Documentation especially in the parts that deal with the protocol.
48
+ * Profiling the library would be awesome, but will try to get it running first
49
+ then optimize.
50
+ * JRuby 1.6.x (1.8 mode) needs to be tested.
51
+
52
+ == REQUIREMENTS:
53
+
54
+ * Just a Postgres server and the gem.
55
+
56
+ == INSTALL:
57
+
58
+ * Currently we don't have the gem on rubygems, but I'll work on that if we can
59
+ get a stable version out.
60
+
61
+ == DEVELOPERS:
62
+
63
+ You'll need postgres to be installed on your system. In order for you
64
+ to be able to run rails test suite, you'll also need the +hstore+ extension
65
+ which is also available in the +postgresql-contrib+ Ubuntu package (see
66
+ http://www.postgresql.org/docs/9.0/static/hstore.html
67
+ for more info) and +postgresql-server-dev+ to get the pg_config binary.
68
+
69
+ You'll also need to create a new super user using your username and no password. You can
70
+ use the following command to do that:
71
+
72
+ $ sudo -u postgres createuser -s <insert your username here>
73
+
74
+ You'll also need to add the following line in the your pg_hba.conf (in order to disable password authentication):
75
+
76
+ host all <insert your username here> 127.0.0.1/32 trust
77
+
78
+ After checking out the source, run:
79
+
80
+ $ rake
81
+
82
+ This task will install any missing dependencies, run the tests/specs.
83
+
84
+ There are currently two test suites that run, the ruby-pg specs and
85
+ more specs targetted towards the JRuby implementation details in
86
+ jruby-spec. When you run `rake` both test suites are merged under
87
+ the 'spec' directory.
88
+
89
+ You can set +PG_TEST_SLL+ to 1, e.g.
90
+
91
+ $ PG_TEST_SLL=1 rake
92
+
93
+ to run the entire test suite using SSL sockets instead of plain sockets. Also
94
+
95
+ $ test_all.sh
96
+
97
+ runs the test suite with and without SSL.
98
+
99
+ == LICENSE:
100
+
101
+ (The MIT License)
102
+
103
+ Copyright (c) 2012 John V. Shahid and Charles Nutter.
104
+
105
+ Permission is hereby granted, free of charge, to any person obtaining
106
+ a copy of this software and associated documentation files (the
107
+ 'Software'), to deal in the Software without restriction, including
108
+ without limitation the rights to use, copy, modify, merge, publish,
109
+ distribute, sublicense, and/or sell copies of the Software, and to
110
+ permit persons to whom the Software is furnished to do so, subject to
111
+ the following conditions:
112
+
113
+ The above copyright notice and this permission notice shall be
114
+ included in all copies or substantial portions of the Software.
115
+
116
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
117
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
118
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
119
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
120
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
121
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
122
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,95 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ require 'git'
6
+ require 'logger'
7
+
8
+ Hoe.plugin :gemspec
9
+ Hoe.plugin :bundler
10
+ Hoe.plugin :test
11
+
12
+ HOE = Hoe.spec 'pg_jruby' do
13
+ self.readme_file = ['README', ENV['HLANG'], 'rdoc'].compact.join('.')
14
+ self.history_file = ['CHANGELOG', ENV['HLANG'], 'rdoc'].compact.join('.')
15
+
16
+ developer('Charles Nutter', 'headius@headius.com')
17
+ developer('John Shahid', 'jvshahid@gmail.com')
18
+
19
+ self.extra_dev_deps += [
20
+ ["hoe-bundler", ">= 1.1"],
21
+ ["hoe-gemspec", ">= 1.0"],
22
+ ["rake", ">= 0.9"],
23
+ ["rake-compiler", "= 0.8.0"],
24
+ ["git"],
25
+ ["logger"],
26
+ ["rspec"]
27
+ ]
28
+
29
+ self.spec_extras = { :platform => 'java' }
30
+
31
+ self.clean_globs = ['spec/*', 'tmp_test_specs', 'tmp']
32
+ end
33
+
34
+ require "rake/javaextensiontask"
35
+ Rake::JavaExtensionTask.new("pg_ext", HOE.spec) do |ext|
36
+ jruby_home = RbConfig::CONFIG['prefix']
37
+ ext.ext_dir = 'ext/java'
38
+ ext.lib_dir = 'lib'
39
+ jars = ["#{jruby_home}/lib/jruby.jar"] + FileList['lib/*.jar']
40
+ ext.classpath = jars.map { |x| File.expand_path x }.join ':'
41
+ end
42
+
43
+ def remote
44
+ "git://github.com/jvshahid/ruby-pg.git"
45
+ end
46
+
47
+ desc 'fetch the specs from the ruby-pg repo'
48
+ task 'get-ruby-pg-specs' do
49
+ if Dir.glob('spec/*').empty?
50
+ FileUtils.rm_rf '/tmp/checkout'
51
+ g = Git.clone(remote, '/tmp/checkout', :log => Logger.new(STDOUT))
52
+ g.checkout('fix_path_to_pg_binaries')
53
+ FileUtils.cp_r Dir.glob('/tmp/checkout/spec/*'), 'spec/'
54
+ end
55
+ end
56
+
57
+ desc "make sure the spec directory has the latest ruby-pg and jruby-pg specs"
58
+ task :'sync-files' => 'get-ruby-pg-specs'
59
+
60
+ Rake::Task[:spec].prerequisites << 'sync-files'
61
+ Rake::Task[:spec].prerequisites << :compile
62
+ Rake::Task[:spec].prerequisites << :java_debug
63
+ Rake::Task[:spec].prerequisites << :import_certs
64
+
65
+ desc "import server certificates"
66
+ task :import_certs do
67
+ puts "Importing server certificates now, don't freak out, this will need sudo access."
68
+ puts "For more info on what this is doing take a look at certs/import_key.sh"
69
+ system 'certs/import_key.sh'
70
+ end
71
+
72
+ # sync specs from jruby-spec to spec/jruby
73
+ target_dir = 'spec/jruby'
74
+ directory target_dir
75
+ Dir.chdir 'jruby-spec' do
76
+ Dir.glob('**/*').each do |f|
77
+ file_name = "jruby-spec/#{f}"
78
+ new_name = "#{target_dir}/#{f}"
79
+ t = file new_name => [file_name, target_dir] do |t|
80
+ if File.directory? file_name
81
+ FileUtils.mkpath new_name
82
+ else
83
+ puts "copying #{file_name} to #{new_name}, pwd: #{Dir.pwd}"
84
+ FileUtils.chmod 0644, new_name if File.exist?(new_name)
85
+ FileUtils.cp file_name, new_name
86
+ File.chmod 0444, new_name
87
+ end
88
+ end
89
+ Rake::Task[:'sync-files'].prerequisites << t
90
+ end
91
+ end
92
+ task :java_debug do
93
+ ENV['JAVA_OPTS'] = '-Xdebug -Xrunjdwp:transport=dt_socket,address=8080,server=y,suspend=n' if ENV['JAVA_DEBUG'] == '1'
94
+ end
95
+ # vim: syntax=ruby
data/bin/pg ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ abort "you need to write me"
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if RUBY_PLATFORM == 'java'
4
+ require 'pg_ext'
5
+ require 'jruby'
6
+ org.jruby.pg.Postgresql.new.load(JRuby.runtime, false)
7
+ else
8
+ begin
9
+ require 'pg_ext'
10
+ rescue LoadError
11
+ # If it's a Windows binary gem, try the <major>.<minor> subdirectory
12
+ if RUBY_PLATFORM =~/(mswin|mingw)/i
13
+ major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
14
+ raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
15
+ require "#{major_minor}/pg_ext"
16
+ else
17
+ raise
18
+ end
19
+
20
+ end
21
+ end
22
+
23
+
24
+ # The top-level PG namespace.
25
+ module PG
26
+
27
+ # Library version
28
+ VERSION = '0.14.1.rc1'
29
+
30
+ # VCS revision
31
+ REVISION = %q$Revision$
32
+
33
+
34
+ ### Get the PG library version. If +include_buildnum+ is +true+, include the build ID.
35
+ def self::version_string( include_buildnum=false )
36
+ vstring = "%s %s" % [ self.name, VERSION ]
37
+ vstring << " (build %s)" % [ REVISION[/: ([[:xdigit:]]+)/, 1] || '0' ] if include_buildnum
38
+ return vstring
39
+ end
40
+
41
+
42
+ ### Convenience alias for PG::Connection.new.
43
+ def self::connect( *args )
44
+ return PG::Connection.new( *args )
45
+ end
46
+
47
+
48
+ require 'pg/exceptions'
49
+ require 'pg/constants'
50
+ require 'pg/connection'
51
+ require 'pg/result'
52
+
53
+ end # module PG
54
+
55
+
56
+ # Backward-compatible aliase
57
+ PGError = PG::Error
58
+
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pg' unless defined?( PG )
4
+
5
+ # The PG connection class.
6
+ class PG::Connection
7
+
8
+ # The order the options are passed to the ::connect method.
9
+ CONNECT_ARGUMENT_ORDER = %w[host port options tty dbname user password]
10
+
11
+
12
+ ### Quote the given +value+ for use in a connection-parameter string.
13
+ def self::quote_connstr( value )
14
+ return "'" + value.to_s.gsub( /[\\']/ ) {|m| '\\' + m } + "'"
15
+ end
16
+
17
+ def escape_literal str
18
+ "'#{escape_literal_native str}'"
19
+ end
20
+
21
+ def escape_identifier str
22
+ "\"#{escape_literal_native str}\""
23
+ end
24
+
25
+ ### Parse the connection +args+ into a connection-parameter string. See PG::Connection.new
26
+ ### for valid arguments.
27
+ def self::parse_connect_args( *args )
28
+ return '' if args.empty?
29
+
30
+ # This will be swapped soon for code that makes options like those required for
31
+ # PQconnectdbParams()/PQconnectStartParams(). For now, stick to an options string for
32
+ # PQconnectdb()/PQconnectStart().
33
+ connopts = []
34
+
35
+ # Handle an options hash first
36
+ if args.last.is_a?( Hash )
37
+ opthash = args.pop
38
+ opthash.each do |key, val|
39
+ connopts.push( "%s=%s" % [key, PG::Connection.quote_connstr(val)] )
40
+ end
41
+ end
42
+
43
+ # Option string style
44
+ if args.length == 1 && args.first.to_s.index( '=' )
45
+ connopts.unshift( args.first )
46
+
47
+ # Append positional parameters
48
+ else
49
+ args.each_with_index do |val, i|
50
+ next unless val # Skip nil placeholders
51
+
52
+ key = CONNECT_ARGUMENT_ORDER[ i ] or
53
+ raise ArgumentError, "Extra positional parameter %d: %p" % [ i+1, val ]
54
+ connopts.push( "%s=%s" % [key, PG::Connection.quote_connstr(val.to_s)] )
55
+ end
56
+ end
57
+
58
+ return connopts.join(' ')
59
+ end
60
+
61
+
62
+ # Backward-compatibility aliases for stuff that's moved into PG.
63
+ class << self
64
+ define_method( :isthreadsafe, &PG.method(:isthreadsafe) )
65
+ end
66
+
67
+
68
+ end # class PG::Connection
69
+
70
+ # Backward-compatible alias
71
+ PGconn = PG::Connection
72
+
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pg' unless defined?( PG )
4
+
5
+
6
+ module PG::Constants
7
+
8
+ # Most of these are defined in the extension.
9
+
10
+ end # module PG::Constants
11
+
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pg' unless defined?( PG )
4
+
5
+
6
+ module PG
7
+
8
+ class Error < StandardError
9
+ attr_reader :result
10
+
11
+ def initialize msg = "", result = nil
12
+ super msg
13
+ @result = result
14
+ end
15
+ end
16
+
17
+ end # module PG
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pg' unless defined?( PG )
4
+
5
+
6
+ class PG::Result
7
+
8
+ end # class PG::Result
9
+
10
+ # Backward-compatible alias
11
+ PGresult = PG::Result
Binary file
metadata ADDED
@@ -0,0 +1,202 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pg_jruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.14.1.rc1
5
+ platform: java
6
+ authors:
7
+ - Charles Nutter
8
+ - John Shahid
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-11-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rdoc
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: '3.10'
21
+ requirement: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ~>
24
+ - !ruby/object:Gem::Version
25
+ version: '3.10'
26
+ prerelease: false
27
+ type: :development
28
+ - !ruby/object:Gem::Dependency
29
+ name: hoe-bundler
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '1.1'
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '1.1'
40
+ prerelease: false
41
+ type: :development
42
+ - !ruby/object:Gem::Dependency
43
+ name: hoe-gemspec
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '1.0'
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '1.0'
54
+ prerelease: false
55
+ type: :development
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0.9'
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0.9'
68
+ prerelease: false
69
+ type: :development
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake-compiler
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '='
75
+ - !ruby/object:Gem::Version
76
+ version: 0.8.0
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - '='
80
+ - !ruby/object:Gem::Version
81
+ version: 0.8.0
82
+ prerelease: false
83
+ type: :development
84
+ - !ruby/object:Gem::Dependency
85
+ name: git
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ prerelease: false
97
+ type: :development
98
+ - !ruby/object:Gem::Dependency
99
+ name: logger
100
+ version_requirements: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ prerelease: false
111
+ type: :development
112
+ - !ruby/object:Gem::Dependency
113
+ name: rspec
114
+ version_requirements: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ prerelease: false
125
+ type: :development
126
+ - !ruby/object:Gem::Dependency
127
+ name: hoe
128
+ version_requirements: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ~>
131
+ - !ruby/object:Gem::Version
132
+ version: '3.1'
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ~>
136
+ - !ruby/object:Gem::Version
137
+ version: '3.1'
138
+ prerelease: false
139
+ type: :development
140
+ description: |-
141
+ This is a native implementation of the Postsgres protocol written
142
+ entirely in Java. The project was started by @headius as a ruby-pg
143
+ replacement for JRuby that uses the JDBC driver and private API of
144
+ Postgres. Unfortunately ruby-pg (which uses libpq under the hood)
145
+ exposed a lot of features of Postgres that were impossible to
146
+ implement or were complicated given the nature of the JDBC and the
147
+ encapsulation of many features that are exposed in ruby-pg.
148
+
149
+ *WARNING* this gem is not production ready yet. There are many
150
+ bugs that needs to be fixed and more testing. So please checkout
151
+ the code and submit pull requests with some fixes. If your Java-Fu
152
+ isn't that great you can still contribute by submitting test cases
153
+ and We'll be happy to fix them.
154
+ email:
155
+ - headius@headius.com
156
+ - jvshahid@gmail.com
157
+ executables:
158
+ - pg
159
+ extensions: []
160
+ extra_rdoc_files:
161
+ - CHANGELOG.rdoc
162
+ - Manifest.txt
163
+ - README.rdoc
164
+ files:
165
+ - CHANGELOG.rdoc
166
+ - Manifest.txt
167
+ - README.rdoc
168
+ - Rakefile
169
+ - bin/pg
170
+ - lib/pg.rb
171
+ - lib/pg/result.rb
172
+ - lib/pg/constants.rb
173
+ - lib/pg/connection.rb
174
+ - lib/pg/exceptions.rb
175
+ - lib/pg_ext.jar
176
+ - .gemtest
177
+ homepage: https://github.com/headius/jruby-pg
178
+ licenses: []
179
+ metadata: {}
180
+ post_install_message:
181
+ rdoc_options:
182
+ - --main
183
+ - README.rdoc
184
+ require_paths:
185
+ - lib
186
+ required_ruby_version: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - '>='
189
+ - !ruby/object:Gem::Version
190
+ version: '0'
191
+ required_rubygems_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - '>'
194
+ - !ruby/object:Gem::Version
195
+ version: 1.3.1
196
+ requirements: []
197
+ rubyforge_project: pg_jruby
198
+ rubygems_version: 2.1.9
199
+ signing_key:
200
+ specification_version: 4
201
+ summary: This is a native implementation of the Postsgres protocol written entirely in Java
202
+ test_files: []