cipherstash-pg 1.0.0.beta.1-arm64-darwin-22 → 1.0.0.beta.4-arm64-darwin-22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.appveyor.yml +42 -0
- data/.gems +6 -0
- data/.gemtest +0 -0
- data/.github/workflows/binary-gems.yml +117 -0
- data/.github/workflows/source-gem.yml +137 -0
- data/.gitignore +19 -0
- data/.hgsigs +34 -0
- data/.hgtags +41 -0
- data/.irbrc +23 -0
- data/.pryrc +23 -0
- data/.tm_properties +21 -0
- data/.travis.yml +49 -0
- data/Gemfile +3 -3
- data/Gemfile.lock +45 -0
- data/{History.rdoc → History.md} +168 -153
- data/README.ja.md +266 -0
- data/README.md +272 -0
- data/Rakefile +65 -104
- data/Rakefile.cross +298 -0
- data/certs/larskanis-2023.pem +24 -0
- data/cipherstash-pg.gemspec +0 -0
- data/lib/2.7/pg_ext.bundle +0 -0
- data/lib/3.0/pg_ext.bundle +0 -0
- data/lib/3.1/pg_ext.bundle +0 -0
- data/lib/3.2/pg_ext.bundle +0 -0
- data/lib/cipherstash-pg/basic_type_map_based_on_result.rb +11 -0
- data/lib/cipherstash-pg/basic_type_map_for_queries.rb +113 -0
- data/lib/cipherstash-pg/basic_type_map_for_results.rb +30 -0
- data/lib/cipherstash-pg/basic_type_registry.rb +206 -0
- data/lib/cipherstash-pg/binary_decoder.rb +21 -0
- data/lib/cipherstash-pg/coder.rb +82 -0
- data/lib/cipherstash-pg/connection.rb +467 -0
- data/lib/cipherstash-pg/constants.rb +3 -0
- data/lib/cipherstash-pg/exceptions.rb +19 -0
- data/lib/cipherstash-pg/result.rb +22 -0
- data/lib/cipherstash-pg/text_decoder.rb +43 -0
- data/lib/cipherstash-pg/text_encoder.rb +67 -0
- data/lib/cipherstash-pg/tuple.rb +24 -0
- data/lib/cipherstash-pg/type_map_by_column.rb +11 -0
- data/lib/cipherstash-pg/version.rb +3 -0
- data/lib/cipherstash-pg.rb +56 -11
- data/lib/libpq.5.dylib +0 -0
- data/misc/openssl-pg-segfault.rb +15 -25
- data/misc/postgres/Rakefile +13 -20
- data/misc/postgres/lib/postgres.rb +10 -14
- data/misc/ruby-pg/Rakefile +13 -20
- data/misc/ruby-pg/lib/ruby/pg.rb +10 -14
- data/rakelib/task_extension.rb +17 -31
- data/sample/array_insert.rb +7 -20
- data/sample/async_api.rb +54 -96
- data/sample/async_copyto.rb +20 -35
- data/sample/async_mixed.rb +22 -50
- data/sample/check_conn.rb +8 -20
- data/sample/copydata.rb +18 -68
- data/sample/copyfrom.rb +26 -78
- data/sample/copyto.rb +10 -16
- data/sample/cursor.rb +9 -19
- data/sample/disk_usage_report.rb +89 -174
- data/sample/issue-119.rb +45 -93
- data/sample/losample.rb +48 -66
- data/sample/minimal-testcase.rb +6 -17
- data/sample/notify_wait.rb +21 -67
- data/sample/pg_statistics.rb +100 -281
- data/sample/replication_monitor.rb +119 -218
- data/sample/test_binary_values.rb +14 -30
- data/sample/wal_shipper.rb +199 -431
- data/sample/warehouse_partitions.rb +157 -307
- data/translation/.po4a-version +7 -0
- data/translation/po/all.pot +875 -0
- data/translation/po/ja.po +868 -0
- data/translation/po4a.cfg +9 -0
- metadata +50 -28
- data/README.ja.rdoc +0 -13
- data/README.rdoc +0 -233
- data/lib/pg/basic_type_map_based_on_result.rb +0 -47
- data/lib/pg/basic_type_map_for_queries.rb +0 -193
- data/lib/pg/basic_type_map_for_results.rb +0 -81
- data/lib/pg/basic_type_registry.rb +0 -301
- data/lib/pg/binary_decoder.rb +0 -23
- data/lib/pg/coder.rb +0 -104
- data/lib/pg/connection.rb +0 -878
- data/lib/pg/constants.rb +0 -12
- data/lib/pg/exceptions.rb +0 -18
- data/lib/pg/result.rb +0 -43
- data/lib/pg/text_decoder.rb +0 -46
- data/lib/pg/text_encoder.rb +0 -59
- data/lib/pg/tuple.rb +0 -30
- data/lib/pg/type_map_by_column.rb +0 -16
- data/lib/pg/version.rb +0 -4
- data/lib/pg.rb +0 -55
data/lib/pg/constants.rb
DELETED
data/lib/pg/exceptions.rb
DELETED
@@ -1,18 +0,0 @@
|
|
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
|
-
end # module PG
|
18
|
-
|
data/lib/pg/result.rb
DELETED
@@ -1,43 +0,0 @@
|
|
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
|
-
|
data/lib/pg/text_decoder.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'date'
|
5
|
-
require 'json'
|
6
|
-
|
7
|
-
module PG
|
8
|
-
module TextDecoder
|
9
|
-
class Date < SimpleDecoder
|
10
|
-
def decode(string, tuple=nil, field=nil)
|
11
|
-
if string =~ /\A(\d{4})-(\d\d)-(\d\d)\z/
|
12
|
-
::Date.new $1.to_i, $2.to_i, $3.to_i
|
13
|
-
else
|
14
|
-
string
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class JSON < SimpleDecoder
|
20
|
-
def decode(string, tuple=nil, field=nil)
|
21
|
-
::JSON.parse(string, quirks_mode: true)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# Convenience classes for timezone options
|
26
|
-
class TimestampUtc < Timestamp
|
27
|
-
def initialize(params={})
|
28
|
-
super(params.merge(flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_UTC))
|
29
|
-
end
|
30
|
-
end
|
31
|
-
class TimestampUtcToLocal < Timestamp
|
32
|
-
def initialize(params={})
|
33
|
-
super(params.merge(flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_LOCAL))
|
34
|
-
end
|
35
|
-
end
|
36
|
-
class TimestampLocal < Timestamp
|
37
|
-
def initialize(params={})
|
38
|
-
super(params.merge(flags: PG::Coder::TIMESTAMP_DB_LOCAL | PG::Coder::TIMESTAMP_APP_LOCAL))
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# For backward compatibility:
|
43
|
-
TimestampWithoutTimeZone = TimestampLocal
|
44
|
-
TimestampWithTimeZone = Timestamp
|
45
|
-
end
|
46
|
-
end # module PG
|
data/lib/pg/text_encoder.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'json'
|
5
|
-
require 'ipaddr'
|
6
|
-
|
7
|
-
module PG
|
8
|
-
module TextEncoder
|
9
|
-
class Date < SimpleEncoder
|
10
|
-
def encode(value)
|
11
|
-
value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d") : value
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
class TimestampWithoutTimeZone < SimpleEncoder
|
16
|
-
def encode(value)
|
17
|
-
value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d %H:%M:%S.%N") : value
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
class TimestampUtc < SimpleEncoder
|
22
|
-
def encode(value)
|
23
|
-
value.respond_to?(:utc) ? value.utc.strftime("%Y-%m-%d %H:%M:%S.%N") : value
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
class TimestampWithTimeZone < SimpleEncoder
|
28
|
-
def encode(value)
|
29
|
-
value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d %H:%M:%S.%N %:z") : value
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class JSON < SimpleEncoder
|
34
|
-
def encode(value)
|
35
|
-
::JSON.generate(value, quirks_mode: true)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
class Inet < SimpleEncoder
|
40
|
-
def encode(value)
|
41
|
-
case value
|
42
|
-
when IPAddr
|
43
|
-
default_prefix = (value.family == Socket::AF_INET ? 32 : 128)
|
44
|
-
s = value.to_s
|
45
|
-
if value.respond_to?(:prefix)
|
46
|
-
prefix = value.prefix
|
47
|
-
else
|
48
|
-
range = value.to_range
|
49
|
-
prefix = default_prefix - Math.log(((range.end.to_i - range.begin.to_i) + 1), 2).to_i
|
50
|
-
end
|
51
|
-
s << "/" << prefix.to_s if prefix != default_prefix
|
52
|
-
s
|
53
|
-
else
|
54
|
-
value
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end # module PG
|
data/lib/pg/tuple.rb
DELETED
@@ -1,30 +0,0 @@
|
|
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
|
@@ -1,16 +0,0 @@
|
|
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
DELETED
data/lib/pg.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
|
2
|
-
# -*- ruby -*-
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
# The top-level PG namespace.
|
6
|
-
module PG
|
7
|
-
|
8
|
-
# cipherstash-pg *always* ships a "fat" gem with precompiled libs for each popular major.minor version
|
9
|
-
# of Ruby that is still in use.
|
10
|
-
major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
|
11
|
-
raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
|
12
|
-
begin
|
13
|
-
require "#{major_minor}/pg_ext"
|
14
|
-
rescue => e
|
15
|
-
STDERR.puts "Failed to load pg_ext for #{RUBY_VERSION.dump}"
|
16
|
-
exit 1
|
17
|
-
end
|
18
|
-
|
19
|
-
class NotAllCopyDataRetrieved < PG::Error
|
20
|
-
end
|
21
|
-
class NotInBlockingMode < PG::Error
|
22
|
-
end
|
23
|
-
|
24
|
-
# Get the PG library version.
|
25
|
-
#
|
26
|
-
# +include_buildnum+ is no longer used and any value passed will be ignored.
|
27
|
-
def self.version_string( include_buildnum=nil )
|
28
|
-
"%s %s" % [ self.name, VERSION ]
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
### Convenience alias for PG::Connection.new.
|
33
|
-
def self.connect( *args, &block )
|
34
|
-
Connection.new( *args, &block )
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
require 'pg/exceptions'
|
39
|
-
require 'pg/constants'
|
40
|
-
require 'pg/coder'
|
41
|
-
require 'pg/binary_decoder'
|
42
|
-
require 'pg/text_encoder'
|
43
|
-
require 'pg/text_decoder'
|
44
|
-
require 'pg/basic_type_registry'
|
45
|
-
require 'pg/basic_type_map_based_on_result'
|
46
|
-
require 'pg/basic_type_map_for_queries'
|
47
|
-
require 'pg/basic_type_map_for_results'
|
48
|
-
require 'pg/type_map_by_column'
|
49
|
-
require 'pg/connection'
|
50
|
-
require 'pg/result'
|
51
|
-
require 'pg/tuple'
|
52
|
-
require 'pg/version'
|
53
|
-
|
54
|
-
end # module PG
|
55
|
-
|