pg 1.3.4 → 1.5.3

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.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.appveyor.yml +15 -9
  4. data/.github/workflows/binary-gems.yml +43 -12
  5. data/.github/workflows/source-gem.yml +28 -20
  6. data/.gitignore +11 -2
  7. data/.travis.yml +2 -2
  8. data/{History.rdoc → History.md} +293 -122
  9. data/README.ja.md +276 -0
  10. data/README.md +286 -0
  11. data/Rakefile +15 -6
  12. data/Rakefile.cross +7 -11
  13. data/certs/larskanis-2023.pem +24 -0
  14. data/ext/errorcodes.def +4 -0
  15. data/ext/errorcodes.txt +2 -1
  16. data/ext/pg.c +14 -54
  17. data/ext/pg.h +11 -5
  18. data/ext/pg_binary_decoder.c +80 -1
  19. data/ext/pg_binary_encoder.c +225 -1
  20. data/ext/pg_coder.c +17 -8
  21. data/ext/pg_connection.c +380 -250
  22. data/ext/pg_copy_coder.c +307 -18
  23. data/ext/pg_errors.c +1 -1
  24. data/ext/pg_record_coder.c +12 -9
  25. data/ext/pg_result.c +104 -27
  26. data/ext/pg_text_decoder.c +28 -10
  27. data/ext/pg_text_encoder.c +23 -10
  28. data/ext/pg_tuple.c +35 -32
  29. data/ext/pg_type_map.c +4 -3
  30. data/ext/pg_type_map_all_strings.c +3 -3
  31. data/ext/pg_type_map_by_class.c +6 -4
  32. data/ext/pg_type_map_by_column.c +9 -5
  33. data/ext/pg_type_map_by_mri_type.c +1 -1
  34. data/ext/pg_type_map_by_oid.c +8 -5
  35. data/ext/pg_type_map_in_ruby.c +6 -3
  36. data/lib/pg/basic_type_map_based_on_result.rb +21 -1
  37. data/lib/pg/basic_type_map_for_queries.rb +13 -8
  38. data/lib/pg/basic_type_map_for_results.rb +26 -3
  39. data/lib/pg/basic_type_registry.rb +36 -33
  40. data/lib/pg/binary_decoder/date.rb +9 -0
  41. data/lib/pg/binary_decoder/timestamp.rb +26 -0
  42. data/lib/pg/binary_encoder/timestamp.rb +20 -0
  43. data/lib/pg/coder.rb +15 -13
  44. data/lib/pg/connection.rb +265 -136
  45. data/lib/pg/exceptions.rb +14 -1
  46. data/lib/pg/text_decoder/date.rb +18 -0
  47. data/lib/pg/text_decoder/inet.rb +9 -0
  48. data/lib/pg/text_decoder/json.rb +14 -0
  49. data/lib/pg/text_decoder/numeric.rb +9 -0
  50. data/lib/pg/text_decoder/timestamp.rb +30 -0
  51. data/lib/pg/text_encoder/date.rb +12 -0
  52. data/lib/pg/text_encoder/inet.rb +28 -0
  53. data/lib/pg/text_encoder/json.rb +14 -0
  54. data/lib/pg/text_encoder/numeric.rb +9 -0
  55. data/lib/pg/text_encoder/timestamp.rb +24 -0
  56. data/lib/pg/version.rb +1 -1
  57. data/lib/pg.rb +59 -19
  58. data/pg.gemspec +4 -2
  59. data/rakelib/task_extension.rb +1 -1
  60. data/translation/.po4a-version +7 -0
  61. data/translation/po/all.pot +910 -0
  62. data/translation/po/ja.po +1047 -0
  63. data/translation/po4a.cfg +12 -0
  64. data.tar.gz.sig +0 -0
  65. metadata +101 -32
  66. metadata.gz.sig +0 -0
  67. data/README.ja.rdoc +0 -13
  68. data/README.rdoc +0 -214
  69. data/lib/pg/binary_decoder.rb +0 -23
  70. data/lib/pg/constants.rb +0 -12
  71. data/lib/pg/text_decoder.rb +0 -46
  72. data/lib/pg/text_encoder.rb +0 -59
data/lib/pg/coder.rb CHANGED
@@ -6,22 +6,24 @@ module PG
6
6
  class Coder
7
7
 
8
8
  module BinaryFormatting
9
- Params = { format: 1 }
10
- def initialize( params={} )
11
- super(Params.merge(params))
9
+ def initialize(hash={}, **kwargs)
10
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) unless hash.empty?
11
+ super(format: 1, **hash, **kwargs)
12
12
  end
13
13
  end
14
14
 
15
15
 
16
16
  # Create a new coder object based on the attribute Hash.
17
- def initialize(params={})
18
- params.each do |key, val|
17
+ def initialize(hash=nil, **kwargs)
18
+ warn("PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from #{caller.first}", category: :deprecated) if hash
19
+
20
+ (hash || kwargs).each do |key, val|
19
21
  send("#{key}=", val)
20
22
  end
21
23
  end
22
24
 
23
25
  def dup
24
- self.class.new(to_h)
26
+ self.class.new(**to_h)
25
27
  end
26
28
 
27
29
  # Returns coder attributes as Hash.
@@ -43,7 +45,7 @@ module PG
43
45
  end
44
46
 
45
47
  def marshal_load(str)
46
- initialize Marshal.load(str)
48
+ initialize(**Marshal.load(str))
47
49
  end
48
50
 
49
51
  def inspect
@@ -70,11 +72,11 @@ module PG
70
72
 
71
73
  class CompositeCoder < Coder
72
74
  def to_h
73
- super.merge!({
75
+ { **super,
74
76
  elements_type: elements_type,
75
77
  needs_quotation: needs_quotation?,
76
78
  delimiter: delimiter,
77
- })
79
+ }
78
80
  end
79
81
 
80
82
  def inspect
@@ -86,19 +88,19 @@ module PG
86
88
 
87
89
  class CopyCoder < Coder
88
90
  def to_h
89
- super.merge!({
91
+ { **super,
90
92
  type_map: type_map,
91
93
  delimiter: delimiter,
92
94
  null_string: null_string,
93
- })
95
+ }
94
96
  end
95
97
  end
96
98
 
97
99
  class RecordCoder < Coder
98
100
  def to_h
99
- super.merge!({
101
+ { **super,
100
102
  type_map: type_map,
101
- })
103
+ }
102
104
  end
103
105
  end
104
106
  end # module PG