pg 1.6.0.rc1-x86_64-linux
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.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +4 -0
- data/BSDL +22 -0
- data/Contributors.rdoc +46 -0
- data/Gemfile +23 -0
- data/History.md +958 -0
- data/LICENSE +56 -0
- data/Manifest.txt +72 -0
- data/POSTGRES +23 -0
- data/README-OS_X.rdoc +68 -0
- data/README-Windows.rdoc +56 -0
- data/README.ja.md +300 -0
- data/README.md +286 -0
- data/Rakefile +161 -0
- data/certs/ged.pem +24 -0
- data/certs/kanis@comcard.de.pem +20 -0
- data/certs/larskanis-2022.pem +26 -0
- data/certs/larskanis-2023.pem +24 -0
- data/certs/larskanis-2024.pem +24 -0
- data/ext/errorcodes.def +1043 -0
- data/ext/errorcodes.rb +45 -0
- data/ext/errorcodes.txt +494 -0
- data/ext/extconf.rb +282 -0
- data/ext/gvl_wrappers.c +32 -0
- data/ext/gvl_wrappers.h +297 -0
- data/ext/pg.c +703 -0
- data/ext/pg.h +390 -0
- data/ext/pg_binary_decoder.c +460 -0
- data/ext/pg_binary_encoder.c +583 -0
- data/ext/pg_cancel_connection.c +360 -0
- data/ext/pg_coder.c +622 -0
- data/ext/pg_connection.c +4869 -0
- data/ext/pg_copy_coder.c +921 -0
- data/ext/pg_errors.c +95 -0
- data/ext/pg_record_coder.c +522 -0
- data/ext/pg_result.c +1764 -0
- data/ext/pg_text_decoder.c +1008 -0
- data/ext/pg_text_encoder.c +833 -0
- data/ext/pg_tuple.c +572 -0
- data/ext/pg_type_map.c +200 -0
- data/ext/pg_type_map_all_strings.c +130 -0
- data/ext/pg_type_map_by_class.c +271 -0
- data/ext/pg_type_map_by_column.c +355 -0
- data/ext/pg_type_map_by_mri_type.c +313 -0
- data/ext/pg_type_map_by_oid.c +388 -0
- data/ext/pg_type_map_in_ruby.c +333 -0
- data/ext/pg_util.c +149 -0
- data/ext/pg_util.h +65 -0
- data/ext/vc/pg.sln +26 -0
- data/ext/vc/pg_18/pg.vcproj +216 -0
- data/ext/vc/pg_19/pg_19.vcproj +209 -0
- data/lib/2.7/pg_ext.so +0 -0
- data/lib/3.0/pg_ext.so +0 -0
- data/lib/3.1/pg_ext.so +0 -0
- data/lib/3.2/pg_ext.so +0 -0
- data/lib/3.3/pg_ext.so +0 -0
- data/lib/pg/basic_type_map_based_on_result.rb +67 -0
- data/lib/pg/basic_type_map_for_queries.rb +202 -0
- data/lib/pg/basic_type_map_for_results.rb +104 -0
- data/lib/pg/basic_type_registry.rb +311 -0
- data/lib/pg/binary_decoder/date.rb +9 -0
- data/lib/pg/binary_decoder/timestamp.rb +26 -0
- data/lib/pg/binary_encoder/timestamp.rb +20 -0
- data/lib/pg/cancel_connection.rb +30 -0
- data/lib/pg/coder.rb +106 -0
- data/lib/pg/connection.rb +1027 -0
- data/lib/pg/exceptions.rb +31 -0
- data/lib/pg/result.rb +43 -0
- data/lib/pg/text_decoder/date.rb +21 -0
- data/lib/pg/text_decoder/inet.rb +9 -0
- data/lib/pg/text_decoder/json.rb +17 -0
- data/lib/pg/text_decoder/numeric.rb +9 -0
- data/lib/pg/text_decoder/timestamp.rb +30 -0
- data/lib/pg/text_encoder/date.rb +13 -0
- data/lib/pg/text_encoder/inet.rb +31 -0
- data/lib/pg/text_encoder/json.rb +17 -0
- data/lib/pg/text_encoder/numeric.rb +9 -0
- data/lib/pg/text_encoder/timestamp.rb +24 -0
- data/lib/pg/tuple.rb +30 -0
- data/lib/pg/type_map_by_column.rb +16 -0
- data/lib/pg/version.rb +4 -0
- data/lib/pg.rb +144 -0
- data/misc/openssl-pg-segfault.rb +31 -0
- data/misc/postgres/History.txt +9 -0
- data/misc/postgres/Manifest.txt +5 -0
- data/misc/postgres/README.txt +21 -0
- data/misc/postgres/Rakefile +21 -0
- data/misc/postgres/lib/postgres.rb +16 -0
- data/misc/ruby-pg/History.txt +9 -0
- data/misc/ruby-pg/Manifest.txt +5 -0
- data/misc/ruby-pg/README.txt +21 -0
- data/misc/ruby-pg/Rakefile +21 -0
- data/misc/ruby-pg/lib/ruby/pg.rb +16 -0
- data/pg.gemspec +36 -0
- data/ports/x86_64-linux/lib/libpq-ruby-pg.so.1 +0 -0
- data/rakelib/task_extension.rb +46 -0
- data/sample/array_insert.rb +20 -0
- data/sample/async_api.rb +102 -0
- data/sample/async_copyto.rb +39 -0
- data/sample/async_mixed.rb +56 -0
- data/sample/check_conn.rb +21 -0
- data/sample/copydata.rb +71 -0
- data/sample/copyfrom.rb +81 -0
- data/sample/copyto.rb +19 -0
- data/sample/cursor.rb +21 -0
- data/sample/disk_usage_report.rb +177 -0
- data/sample/issue-119.rb +94 -0
- data/sample/losample.rb +69 -0
- data/sample/minimal-testcase.rb +17 -0
- data/sample/notify_wait.rb +72 -0
- data/sample/pg_statistics.rb +285 -0
- data/sample/replication_monitor.rb +222 -0
- data/sample/test_binary_values.rb +33 -0
- data/sample/wal_shipper.rb +434 -0
- data/sample/warehouse_partitions.rb +311 -0
- data.tar.gz.sig +0 -0
- metadata +252 -0
- metadata.gz.sig +0 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'pg' unless defined?( PG )
|
5
|
+
|
6
|
+
|
7
|
+
module PG
|
8
|
+
|
9
|
+
class Error < StandardError
|
10
|
+
def initialize(msg=nil, connection: nil, result: nil)
|
11
|
+
@connection = connection
|
12
|
+
@result = result
|
13
|
+
super(msg)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class NotAllCopyDataRetrieved < PG::Error
|
18
|
+
end
|
19
|
+
class LostCopyState < PG::Error
|
20
|
+
end
|
21
|
+
class NotInBlockingMode < PG::Error
|
22
|
+
end
|
23
|
+
|
24
|
+
# PG::Connection#transaction uses this exception to distinguish a deliberate rollback from other exceptional situations.
|
25
|
+
# Normally, raising an exception will cause the .transaction method to rollback the database transaction and pass on the exception.
|
26
|
+
# But if you raise an PG::RollbackTransaction exception, then the database transaction will be rolled back, without passing on the exception.
|
27
|
+
class RollbackTransaction < StandardError
|
28
|
+
end
|
29
|
+
|
30
|
+
end # module PG
|
31
|
+
|
data/lib/pg/result.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'pg' unless defined?( PG )
|
5
|
+
|
6
|
+
|
7
|
+
class PG::Result
|
8
|
+
|
9
|
+
# Apply a type map for all value retrieving methods.
|
10
|
+
#
|
11
|
+
# +type_map+: a PG::TypeMap instance.
|
12
|
+
#
|
13
|
+
# This method is equal to #type_map= , but returns self, so that calls can be chained.
|
14
|
+
#
|
15
|
+
# See also PG::BasicTypeMapForResults
|
16
|
+
def map_types!(type_map)
|
17
|
+
self.type_map = type_map
|
18
|
+
return self
|
19
|
+
end
|
20
|
+
|
21
|
+
# Set the data type for all field name returning methods.
|
22
|
+
#
|
23
|
+
# +type+: a Symbol defining the field name type.
|
24
|
+
#
|
25
|
+
# This method is equal to #field_name_type= , but returns self, so that calls can be chained.
|
26
|
+
def field_names_as(type)
|
27
|
+
self.field_name_type = type
|
28
|
+
return self
|
29
|
+
end
|
30
|
+
|
31
|
+
### Return a String representation of the object suitable for debugging.
|
32
|
+
def inspect
|
33
|
+
str = self.to_s
|
34
|
+
str[-1,0] = if cleared?
|
35
|
+
" cleared"
|
36
|
+
else
|
37
|
+
" status=#{res_status(result_status)} ntuples=#{ntuples} nfields=#{nfields} cmd_tuples=#{cmd_tuples}"
|
38
|
+
end
|
39
|
+
return str
|
40
|
+
end
|
41
|
+
|
42
|
+
end # class PG::Result
|
43
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'date'
|
5
|
+
|
6
|
+
module PG
|
7
|
+
module TextDecoder
|
8
|
+
# This is a decoder class for conversion of PostgreSQL date type to Ruby Date values.
|
9
|
+
#
|
10
|
+
# As soon as this class is used, it requires the ruby standard library 'date'.
|
11
|
+
class Date < SimpleDecoder
|
12
|
+
def decode(string, tuple=nil, field=nil)
|
13
|
+
if string =~ /\A(\d{4})-(\d\d)-(\d\d)\z/
|
14
|
+
::Date.new $1.to_i, $2.to_i, $3.to_i
|
15
|
+
else
|
16
|
+
string
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end # module PG
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module PG
|
7
|
+
module TextDecoder
|
8
|
+
# This is a decoder class for conversion of PostgreSQL JSON/JSONB type to Ruby Hash, Array, String, Numeric, nil values.
|
9
|
+
#
|
10
|
+
# As soon as this class is used, it requires the ruby standard library 'json'.
|
11
|
+
class JSON < SimpleDecoder
|
12
|
+
def decode(string, tuple=nil, field=nil)
|
13
|
+
::JSON.parse(string, quirks_mode: true)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end # module PG
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module PG
|
5
|
+
module TextDecoder
|
6
|
+
# Convenience classes for timezone options
|
7
|
+
class TimestampUtc < Timestamp
|
8
|
+
def initialize(hash={}, **kwargs)
|
9
|
+
warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
|
10
|
+
super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_UTC)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
class TimestampUtcToLocal < Timestamp
|
14
|
+
def initialize(hash={}, **kwargs)
|
15
|
+
warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
|
16
|
+
super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_LOCAL)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
class TimestampLocal < Timestamp
|
20
|
+
def initialize(hash={}, **kwargs)
|
21
|
+
warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
|
22
|
+
super(**hash, **kwargs, flags: PG::Coder::TIMESTAMP_DB_LOCAL | PG::Coder::TIMESTAMP_APP_LOCAL)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# For backward compatibility:
|
27
|
+
TimestampWithoutTimeZone = TimestampLocal
|
28
|
+
TimestampWithTimeZone = Timestamp
|
29
|
+
end
|
30
|
+
end # module PG
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module PG
|
5
|
+
module TextEncoder
|
6
|
+
# This is a encoder class for conversion of Ruby Date values to PostgreSQL date type.
|
7
|
+
class Date < SimpleEncoder
|
8
|
+
def encode(value)
|
9
|
+
value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d") : value
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end # module PG
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'ipaddr'
|
5
|
+
|
6
|
+
module PG
|
7
|
+
module TextEncoder
|
8
|
+
# This is a encoder class for conversion of Ruby IPAddr values to PostgreSQL inet type.
|
9
|
+
#
|
10
|
+
# As soon as this class is used, it requires the ruby standard library 'ipaddr'.
|
11
|
+
class Inet < SimpleEncoder
|
12
|
+
def encode(value)
|
13
|
+
case value
|
14
|
+
when IPAddr
|
15
|
+
default_prefix = (value.family == Socket::AF_INET ? 32 : 128)
|
16
|
+
s = value.to_s
|
17
|
+
if value.respond_to?(:prefix)
|
18
|
+
prefix = value.prefix
|
19
|
+
else
|
20
|
+
range = value.to_range
|
21
|
+
prefix = default_prefix - Math.log(((range.end.to_i - range.begin.to_i) + 1), 2).to_i
|
22
|
+
end
|
23
|
+
s << "/" << prefix.to_s if prefix != default_prefix
|
24
|
+
s
|
25
|
+
else
|
26
|
+
value
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end # module PG
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module PG
|
7
|
+
module TextEncoder
|
8
|
+
# This is a encoder class for conversion of Ruby Hash, Array, String, Numeric, nil values to PostgreSQL JSON/JSONB type.
|
9
|
+
#
|
10
|
+
# As soon as this class is used, it requires the ruby standard library 'json'.
|
11
|
+
class JSON < SimpleEncoder
|
12
|
+
def encode(value)
|
13
|
+
::JSON.generate(value, quirks_mode: true)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end # module PG
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module PG
|
5
|
+
module TextEncoder
|
6
|
+
class TimestampWithoutTimeZone < SimpleEncoder
|
7
|
+
def encode(value)
|
8
|
+
value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d %H:%M:%S.%N") : value
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class TimestampUtc < SimpleEncoder
|
13
|
+
def encode(value)
|
14
|
+
value.respond_to?(:utc) ? value.utc.strftime("%Y-%m-%d %H:%M:%S.%N") : value
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class TimestampWithTimeZone < SimpleEncoder
|
19
|
+
def encode(value)
|
20
|
+
value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d %H:%M:%S.%N %:z") : value
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end # module PG
|
data/lib/pg/tuple.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'pg' unless defined?( PG )
|
5
|
+
|
6
|
+
|
7
|
+
class PG::Tuple
|
8
|
+
|
9
|
+
### Return a String representation of the object suitable for debugging.
|
10
|
+
def inspect
|
11
|
+
"#<#{self.class} #{self.map{|k,v| "#{k}: #{v.inspect}" }.join(", ") }>"
|
12
|
+
end
|
13
|
+
|
14
|
+
def has_key?(key)
|
15
|
+
field_map.has_key?(key)
|
16
|
+
end
|
17
|
+
alias key? has_key?
|
18
|
+
|
19
|
+
def keys
|
20
|
+
field_names || field_map.keys.freeze
|
21
|
+
end
|
22
|
+
|
23
|
+
def each_key(&block)
|
24
|
+
if fn=field_names
|
25
|
+
fn.each(&block)
|
26
|
+
else
|
27
|
+
field_map.each_key(&block)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'pg' unless defined?( PG )
|
5
|
+
|
6
|
+
class PG::TypeMapByColumn
|
7
|
+
# Returns the type oids of the assigned coders.
|
8
|
+
def oids
|
9
|
+
coders.map{|c| c.oid if c }
|
10
|
+
end
|
11
|
+
|
12
|
+
def inspect
|
13
|
+
type_strings = coders.map{|c| c ? c.inspect_short : 'nil' }
|
14
|
+
"#<#{self.class} #{type_strings.join(' ')}>"
|
15
|
+
end
|
16
|
+
end
|
data/lib/pg/version.rb
ADDED
data/lib/pg.rb
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
|
2
|
+
# -*- ruby -*-
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
# The top-level PG namespace.
|
6
|
+
module PG
|
7
|
+
|
8
|
+
# Is this file part of a fat binary gem with bundled libpq?
|
9
|
+
# This path must be enabled by add_dll_directory on Windows.
|
10
|
+
gplat = Gem::Platform.local
|
11
|
+
bundled_libpq_path = Dir[File.expand_path("../ports/#{gplat.cpu}-#{gplat.os}*/lib", __dir__)].first
|
12
|
+
if bundled_libpq_path
|
13
|
+
POSTGRESQL_LIB_PATH = bundled_libpq_path
|
14
|
+
else
|
15
|
+
# Try to load libpq path as found by extconf.rb
|
16
|
+
begin
|
17
|
+
require "pg/postgresql_lib_path"
|
18
|
+
rescue LoadError
|
19
|
+
# rake-compiler doesn't use regular "make install", but uses it's own install tasks.
|
20
|
+
# It therefore doesn't copy pg/postgresql_lib_path.rb in case of "rake compile".
|
21
|
+
POSTGRESQL_LIB_PATH = false
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
add_dll_path = proc do |path, &block|
|
26
|
+
if RUBY_PLATFORM =~/(mswin|mingw)/i && path
|
27
|
+
BUNDLED_LIBPQ_WITH_UNIXSOCKET = false
|
28
|
+
begin
|
29
|
+
require 'ruby_installer/runtime'
|
30
|
+
RubyInstaller::Runtime.add_dll_directory(path, &block)
|
31
|
+
rescue LoadError
|
32
|
+
old_path = ENV['PATH']
|
33
|
+
ENV['PATH'] = "#{path};#{old_path}"
|
34
|
+
block.call
|
35
|
+
ENV['PATH'] = old_path
|
36
|
+
end
|
37
|
+
else
|
38
|
+
# libpq is found by a relative rpath in the cross compiled extension dll
|
39
|
+
# or by the system library loader
|
40
|
+
block.call
|
41
|
+
BUNDLED_LIBPQ_WITH_UNIXSOCKET = RUBY_PLATFORM=~/linux/i && PG::IS_BINARY_GEM
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Add a load path to the one retrieved from pg_config
|
46
|
+
add_dll_path.call(POSTGRESQL_LIB_PATH) do
|
47
|
+
begin
|
48
|
+
# Try the <major>.<minor> subdirectory for fat binary gems
|
49
|
+
major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
|
50
|
+
raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
|
51
|
+
require "#{major_minor}/pg_ext"
|
52
|
+
rescue LoadError
|
53
|
+
require 'pg_ext'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Get the PG library version.
|
58
|
+
#
|
59
|
+
# +include_buildnum+ is no longer used and any value passed will be ignored.
|
60
|
+
def self.version_string( include_buildnum=nil )
|
61
|
+
"%s %s" % [ self.name, VERSION ]
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
### Convenience alias for PG::Connection.new.
|
66
|
+
def self.connect( *args, &block )
|
67
|
+
Connection.new( *args, &block )
|
68
|
+
end
|
69
|
+
|
70
|
+
if defined?(Ractor.make_shareable)
|
71
|
+
def self.make_shareable(obj)
|
72
|
+
Ractor.make_shareable(obj)
|
73
|
+
end
|
74
|
+
else
|
75
|
+
def self.make_shareable(obj)
|
76
|
+
obj.freeze
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
module BinaryDecoder
|
81
|
+
%i[ TimestampUtc TimestampUtcToLocal TimestampLocal ].each do |klass|
|
82
|
+
autoload klass, 'pg/binary_decoder/timestamp'
|
83
|
+
end
|
84
|
+
autoload :Date, 'pg/binary_decoder/date'
|
85
|
+
end
|
86
|
+
module BinaryEncoder
|
87
|
+
%i[ TimestampUtc TimestampLocal ].each do |klass|
|
88
|
+
autoload klass, 'pg/binary_encoder/timestamp'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
module TextDecoder
|
92
|
+
%i[ TimestampUtc TimestampUtcToLocal TimestampLocal TimestampWithoutTimeZone TimestampWithTimeZone ].each do |klass|
|
93
|
+
autoload klass, 'pg/text_decoder/timestamp'
|
94
|
+
end
|
95
|
+
autoload :Date, 'pg/text_decoder/date'
|
96
|
+
autoload :Inet, 'pg/text_decoder/inet'
|
97
|
+
autoload :JSON, 'pg/text_decoder/json'
|
98
|
+
autoload :Numeric, 'pg/text_decoder/numeric'
|
99
|
+
end
|
100
|
+
module TextEncoder
|
101
|
+
%i[ TimestampUtc TimestampWithoutTimeZone TimestampWithTimeZone ].each do |klass|
|
102
|
+
autoload klass, 'pg/text_encoder/timestamp'
|
103
|
+
end
|
104
|
+
autoload :Date, 'pg/text_encoder/date'
|
105
|
+
autoload :Inet, 'pg/text_encoder/inet'
|
106
|
+
autoload :JSON, 'pg/text_encoder/json'
|
107
|
+
autoload :Numeric, 'pg/text_encoder/numeric'
|
108
|
+
end
|
109
|
+
|
110
|
+
autoload :BasicTypeMapBasedOnResult, 'pg/basic_type_map_based_on_result'
|
111
|
+
autoload :BasicTypeMapForQueries, 'pg/basic_type_map_for_queries'
|
112
|
+
autoload :BasicTypeMapForResults, 'pg/basic_type_map_for_results'
|
113
|
+
autoload :BasicTypeRegistry, 'pg/basic_type_registry'
|
114
|
+
require 'pg/exceptions'
|
115
|
+
require 'pg/coder'
|
116
|
+
require 'pg/type_map_by_column'
|
117
|
+
require 'pg/connection'
|
118
|
+
require 'pg/cancel_connection'
|
119
|
+
require 'pg/result'
|
120
|
+
require 'pg/tuple'
|
121
|
+
autoload :VERSION, 'pg/version'
|
122
|
+
|
123
|
+
|
124
|
+
# Avoid "uninitialized constant Truffle::WarningOperations" on Truffleruby up to 22.3.1
|
125
|
+
if RUBY_ENGINE=="truffleruby" && !defined?(Truffle::WarningOperations)
|
126
|
+
module TruffleFixWarn
|
127
|
+
def warn(str, category=nil)
|
128
|
+
super(str)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
Warning.extend(TruffleFixWarn)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Ruby-3.4+ prints a warning, if bigdecimal is required but not in the Gemfile.
|
135
|
+
# But it's a false positive, since we enable bigdecimal depending features only if it's available.
|
136
|
+
# And most people don't need these features.
|
137
|
+
def self.require_bigdecimal_without_warning
|
138
|
+
oldverb, $VERBOSE = $VERBOSE, nil
|
139
|
+
require "bigdecimal"
|
140
|
+
ensure
|
141
|
+
$VERBOSE = oldverb
|
142
|
+
end
|
143
|
+
|
144
|
+
end # module PG
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
PGHOST = 'localhost'
|
4
|
+
PGDB = 'test'
|
5
|
+
#SOCKHOST = 'github.com'
|
6
|
+
SOCKHOST = 'it-trac.laika.com'
|
7
|
+
|
8
|
+
# Load pg first, so the libssl.so that libpq is linked against is loaded.
|
9
|
+
require 'pg'
|
10
|
+
$stderr.puts "connecting to postgres://#{PGHOST}/#{PGDB}"
|
11
|
+
conn = PG.connect( PGHOST, :dbname => PGDB )
|
12
|
+
|
13
|
+
# Now load OpenSSL, which might be linked against a different libssl.
|
14
|
+
require 'socket'
|
15
|
+
require 'openssl'
|
16
|
+
$stderr.puts "Connecting to #{SOCKHOST}"
|
17
|
+
sock = TCPSocket.open( SOCKHOST, 443 )
|
18
|
+
ctx = OpenSSL::SSL::SSLContext.new
|
19
|
+
sock = OpenSSL::SSL::SSLSocket.new( sock, ctx )
|
20
|
+
sock.sync_close = true
|
21
|
+
|
22
|
+
# The moment of truth...
|
23
|
+
$stderr.puts "Attempting to connect..."
|
24
|
+
begin
|
25
|
+
sock.connect
|
26
|
+
rescue Errno
|
27
|
+
$stderr.puts "Got an error connecting, but no segfault."
|
28
|
+
else
|
29
|
+
$stderr.puts "Nope, no segfault!"
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
= postgres
|
2
|
+
|
3
|
+
* https://github.com/ged/ruby-pg
|
4
|
+
|
5
|
+
== Description
|
6
|
+
|
7
|
+
This is an old, deprecated version of the Ruby PostgreSQL driver that hasn't
|
8
|
+
been maintained or supported since early 2008.
|
9
|
+
|
10
|
+
You should install/require 'pg' instead.
|
11
|
+
|
12
|
+
If you need the 'postgres' gem for legacy code that can't be converted, you can
|
13
|
+
still install it using an explicit version, like so:
|
14
|
+
|
15
|
+
gem install postgres -v '0.7.9.2008.01.28'
|
16
|
+
gem uninstall postgres -v '>0.7.9.2008.01.28'
|
17
|
+
|
18
|
+
If you have any questions, the nice folks in the Google group can help:
|
19
|
+
|
20
|
+
http://goo.gl/OjOPP / ruby-pg@googlegroups.com
|
21
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'hoe'
|
6
|
+
require 'pp'
|
7
|
+
|
8
|
+
Hoe.spec 'postgres' do
|
9
|
+
self.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
10
|
+
self.dependency 'pg', '~> 0'
|
11
|
+
self.spec_extras[:date] = Date.parse( '2008/01/30' )
|
12
|
+
|
13
|
+
line = '-' * 75
|
14
|
+
msg = paragraphs_of( 'README.txt', 3..-1 )
|
15
|
+
msg.unshift( line )
|
16
|
+
msg.push( line )
|
17
|
+
|
18
|
+
self.spec_extras[:post_install_message] = msg.join( "\n\n" ) + "\n"
|
19
|
+
end
|
20
|
+
|
21
|
+
# vim: syntax=ruby
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
module Postgres
|
6
|
+
|
7
|
+
VERSION = '0.8.1'
|
8
|
+
|
9
|
+
gemdir = Pathname( __FILE__ ).dirname.parent
|
10
|
+
readme = gemdir + 'README.txt'
|
11
|
+
|
12
|
+
header, message = readme.read.split( /^== Description/m )
|
13
|
+
abort( message.strip )
|
14
|
+
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
= ruby-pg
|
2
|
+
|
3
|
+
* https://github.com/ged/ruby-pg
|
4
|
+
|
5
|
+
== Description
|
6
|
+
|
7
|
+
This is an old, deprecated version of the 'pg' gem that hasn't been
|
8
|
+
maintained or supported since early 2008.
|
9
|
+
|
10
|
+
You should install/require 'pg' instead.
|
11
|
+
|
12
|
+
If you need ruby-pg for legacy code that can't be converted, you can still
|
13
|
+
install it using an explicit version, like so:
|
14
|
+
|
15
|
+
gem install ruby-pg -v '0.7.9.2008.01.28'
|
16
|
+
gem uninstall ruby-pg -v '>0.7.9.2008.01.28'
|
17
|
+
|
18
|
+
If you have any questions, the nice folks in the Google group can help:
|
19
|
+
|
20
|
+
http://goo.gl/OjOPP / ruby-pg@googlegroups.com
|
21
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'hoe'
|
6
|
+
require 'pp'
|
7
|
+
|
8
|
+
Hoe.spec 'ruby-pg' do
|
9
|
+
self.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
10
|
+
self.dependency 'pg', '~> 0'
|
11
|
+
self.spec_extras[:date] = Date.parse( '2008/01/30' )
|
12
|
+
|
13
|
+
line = '-' * 75
|
14
|
+
msg = paragraphs_of( 'README.txt', 3..-1 )
|
15
|
+
msg.unshift( line )
|
16
|
+
msg.push( line )
|
17
|
+
|
18
|
+
self.spec_extras[:post_install_message] = msg.join( "\n\n" ) + "\n"
|
19
|
+
end
|
20
|
+
|
21
|
+
# vim: syntax=ruby
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
module Pg
|
6
|
+
|
7
|
+
VERSION = '0.8.0'
|
8
|
+
|
9
|
+
gemdir = Pathname( __FILE__ ).dirname.parent.parent
|
10
|
+
readme = gemdir + 'README.txt'
|
11
|
+
|
12
|
+
header, message = readme.read.split( /^== Description/m )
|
13
|
+
abort( message.strip )
|
14
|
+
|
15
|
+
end
|
16
|
+
|