pgtk 0.12.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54cb8f69f002389612e9b89bb2514fecbb351c5aed6d70eb1ed570bc4ec45b6d
4
- data.tar.gz: 0f4c36563a1eae3360ce0b3e50ef2f80e91fdc4a7a14b35efa9282499f1b9b20
3
+ metadata.gz: '0229db9fb7094b463af3fc42c60b90d3175faba8ad08d2d43d5af299ce011b8e'
4
+ data.tar.gz: cede9f139659cdfb9419f846bca9110338be3ee77f5ee791781324951816de85
5
5
  SHA512:
6
- metadata.gz: 53a8780bf422b4660d8a360c5580918a6fa84158d9f0111f382932167f1f8bd027b6135b690ff8b56500c71fae4920ef646ae46ae90d6d178d31c53f1763a347
7
- data.tar.gz: 5551171c38c80efca7d9dca950c251387634889682085e546de58bafc8f8ffd6579d5beaf2993cdbe34897fbc22047e861c6c6cf3b7dcbed37328e50d6a519ea
6
+ metadata.gz: d8aac510a305077c23d3c1e9247b1276f8a5ca116f7e208bcc3f7877226454ec090938a8e59d84bec32cd3236e288c30f32214dfaab9489ec80a699f185d99cd
7
+ data.tar.gz: e6b9e18fac1f1405ab51364f963288096dd99e5de1ee2676b052b90b8d33cbf11433eefd02ab97ddb4757aabf4c34144f387b34b504937150d8eed3c091f2dde
data/.0pdd.yml CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2024 Yegor Bugayenko
1
+ # Copyright (c) 2019-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2024 Yegor Bugayenko
1
+ # Copyright (c) 2019-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2024 Yegor Bugayenko
1
+ # Copyright (c) 2019-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -43,5 +43,3 @@ jobs:
43
43
  - uses: codecov/codecov-action@v5
44
44
  with:
45
45
  token: ${{ secrets.CODECOV_TOKEN }}
46
- file: coverage/.resultset.json
47
- fail_ci_if_error: true
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2024 Yegor Bugayenko
1
+ # Copyright (c) 2019-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2024 Yegor Bugayenko
1
+ # Copyright (c) 2019-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2024 Yegor Bugayenko
1
+ # Copyright (c) 2019-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2024 Yegor Bugayenko
1
+ # Copyright (c) 2019-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2024 Yegor Bugayenko
1
+ # Copyright (c) 2019-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2024 Yegor Bugayenko
1
+ # Copyright (c) 2019-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2024 Yegor Bugayenko
1
+ # Copyright (c) 2019-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
data/.gitignore CHANGED
@@ -4,3 +4,5 @@ coverage/
4
4
  .bundle/
5
5
  .DS_Store
6
6
  rdoc/
7
+ doc/
8
+ .yardoc/
data/.rubocop.yml CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2024 Yegor Bugayenko
1
+ # Copyright (c) 2019-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
data/.rultor.yml CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2024 Yegor Bugayenko
1
+ # Copyright (c) 2019-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
data/.simplecov CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2024 Yegor Bugayenko
3
+ # Copyright (c) 2019-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/.yamllint.yml CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2024 Yegor Bugayenko
1
+ # Copyright (c) 2019-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2024 Yegor Bugayenko
3
+ # Copyright (c) 2019-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -33,3 +33,4 @@ gem 'rubocop-rspec', '3.3.0', require: false
33
33
  gem 'simplecov', '0.22.0', require: false
34
34
  gem 'simplecov-cobertura', '~>2.1'
35
35
  gem 'xcop', '0.7.1', require: false
36
+ gem 'yard', '0.9.37', require: false
data/Gemfile.lock CHANGED
@@ -185,6 +185,7 @@ GEM
185
185
  nokogiri (~> 1.10)
186
186
  rainbow (~> 3.0)
187
187
  slop (~> 4.4)
188
+ yard (0.9.37)
188
189
  zeitwerk (2.7.1)
189
190
 
190
191
  PLATFORMS
@@ -204,6 +205,7 @@ DEPENDENCIES
204
205
  simplecov (= 0.22.0)
205
206
  simplecov-cobertura (~> 2.1)
206
207
  xcop (= 0.7.1)
208
+ yard (= 0.9.37)
207
209
 
208
210
  BUNDLED WITH
209
211
  2.5.16
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2019-2024 Yegor Bugayenko
3
+ Copyright (c) 2019-2025 Yegor Bugayenko
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the 'Software'), to deal
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2024 Yegor Bugayenko
3
+ # Copyright (c) 2019-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -33,7 +33,7 @@ def version
33
33
  Gem::Specification.load(Dir['*.gemspec'].first).version
34
34
  end
35
35
 
36
- task default: %i[clean test rubocop xcop copyright]
36
+ task default: %i[clean test rubocop xcop copyright yard]
37
37
 
38
38
  require 'rake/testtask'
39
39
  desc 'Run all unit tests'
@@ -44,13 +44,10 @@ Rake::TestTask.new(:test) do |test|
44
44
  test.verbose = false
45
45
  end
46
46
 
47
- require 'rdoc/task'
48
- desc 'Build RDoc documentation'
49
- Rake::RDocTask.new do |rdoc|
50
- rdoc.rdoc_dir = 'rdoc'
51
- rdoc.title = "#{name} #{version}"
52
- rdoc.rdoc_files.include('README*')
53
- rdoc.rdoc_files.include('lib/**/*.rb')
47
+ require 'yard'
48
+ desc 'Build Yard documentation'
49
+ YARD::Rake::YardocTask.new do |t|
50
+ t.files = ['lib/**/*.rb']
54
51
  end
55
52
 
56
53
  require 'rubocop/rake_task'
@@ -65,7 +62,7 @@ desc 'Validate all XML/XSL/XSD/HTML files for formatting'
65
62
  Xcop::RakeTask.new :xcop do |task|
66
63
  task.license = 'LICENSE.txt'
67
64
  task.includes = ['**/*.xml', '**/*.xsl', '**/*.xsd', '**/*.html']
68
- task.excludes = ['target/**/*', 'coverage/**/*', 'vendor/**/*']
65
+ task.excludes = ['target/**/*', 'coverage/**/*', 'vendor/**/*', 'doc/**/*']
69
66
  end
70
67
 
71
68
  task :copyright do
data/cucumber.yml CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2024 Yegor Bugayenko
1
+ # Copyright (c) 2019-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2024 Yegor Bugayenko
3
+ # Copyright (c) 2019-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -30,7 +30,7 @@ require_relative '../pgtk'
30
30
 
31
31
  # Liquibase rake task.
32
32
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
33
- # Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
33
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
34
34
  # License:: MIT
35
35
  class Pgtk::LiquibaseTask < Rake::TaskLib
36
36
  attr_accessor :name, :master, :yaml, :quiet, :liquibase_version, :postgresql_version
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2024 Yegor Bugayenko
3
+ # Copyright (c) 2019-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -33,7 +33,7 @@ require_relative '../pgtk'
33
33
 
34
34
  # Pgsql rake task.
35
35
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
36
- # Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
36
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
37
37
  # License:: MIT
38
38
  class Pgtk::PgsqlTask < Rake::TaskLib
39
39
  attr_accessor :name, :dir, :fresh_start, :user, :password, :dbname, :yaml, :quiet, :port, :config
data/lib/pgtk/pool.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2024 Yegor Bugayenko
3
+ # Copyright (c) 2019-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,10 +27,13 @@ require_relative 'wire'
27
27
 
28
28
  # Pool.
29
29
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
30
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
31
31
  # License:: MIT
32
32
  class Pgtk::Pool
33
33
  # Constructor.
34
+ #
35
+ # @param [Pgtk::Wire] wire The wire
36
+ # @param [Object] log The log
34
37
  def initialize(wire, log: Loog::NULL)
35
38
  @wire = wire
36
39
  @log = log
@@ -38,6 +41,8 @@ class Pgtk::Pool
38
41
  end
39
42
 
40
43
  # Get the version of PostgreSQL server.
44
+ #
45
+ # @return [String] Version of PostgreSQL server
41
46
  def version
42
47
  @version ||= exec('SHOW server_version')[0]['server_version'].split[0]
43
48
  end
@@ -48,6 +53,8 @@ class Pgtk::Pool
48
53
  # keep in mind that not all servers will allow you to have many connections
49
54
  # open at the same time. For example, Heroku free PostgreSQL database
50
55
  # allows only one connection open.
56
+ #
57
+ # @param [Integer] max Total amount of PostgreSQL connections in the pool
51
58
  def start(max = 8)
52
59
  max.times do
53
60
  @pool << @wire.connection
@@ -101,6 +108,11 @@ class Pgtk::Pool
101
108
  #
102
109
  # More details about +exec_params+, which is called here, you can find
103
110
  # here: https://www.rubydoc.info/gems/pg/0.17.1/PG%2FConnection:exec_params
111
+ #
112
+ # @param [String] query The SQL query with params inside (possibly)
113
+ # @param [Array] args List of arguments
114
+ # @param [Integer] result Should be 0 for text results, 1 for binary
115
+ # @yield [Hash] Rows
104
116
  def exec(query, args = [], result = 0, &block)
105
117
  connect do |c|
106
118
  t = Txn.new(c, @log)
@@ -142,17 +154,33 @@ class Pgtk::Pool
142
154
  @log = log
143
155
  end
144
156
 
157
+ # Exec a single parameterized command.
158
+ # @param [String] query The SQL query with params inside (possibly)
159
+ # @param [Array] args List of arguments
160
+ # @param [Integer] result Should be 0 for text results, 1 for binary
161
+ # @yield [Hash] Rows
145
162
  def exec(query, args = [], result = 0)
146
163
  start = Time.now
147
164
  sql = query.is_a?(Array) ? query.join(' ') : query
148
165
  begin
149
- out = @conn.exec_params(sql, args, result) do |res|
150
- if block_given?
151
- yield res
166
+ out =
167
+ if args.empty?
168
+ @conn.exec(sql) do |res|
169
+ if block_given?
170
+ yield res
171
+ else
172
+ res.each.to_a
173
+ end
174
+ end
152
175
  else
153
- res.each.to_a
176
+ @conn.exec_params(sql, args, result) do |res|
177
+ if block_given?
178
+ yield res
179
+ else
180
+ res.each.to_a
181
+ end
182
+ end
154
183
  end
155
- end
156
184
  rescue StandardError => e
157
185
  @log.error("#{sql}: #{e.message}")
158
186
  raise e
data/lib/pgtk/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2024 Yegor Bugayenko
3
+ # Copyright (c) 2019-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -24,9 +24,9 @@ require_relative '../pgtk'
24
24
 
25
25
  # Pgtk version.
26
26
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
27
- # Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
27
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
28
28
  # License:: MIT
29
29
  module Pgtk
30
30
  # Current version of the library.
31
- VERSION = '0.12.0'
31
+ VERSION = '0.12.1'
32
32
  end
data/lib/pgtk/wire.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2024 Yegor Bugayenko
3
+ # Copyright (c) 2019-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,14 +27,14 @@ require_relative '../pgtk'
27
27
 
28
28
  # Wires.
29
29
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
30
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
31
31
  # License:: MIT
32
32
  module Pgtk::Wire
33
33
  end
34
34
 
35
35
  # Simple wire with details.
36
36
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
37
- # Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
37
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
38
38
  # License:: MIT
39
39
  class Pgtk::Wire::Direct
40
40
  # Constructor.
@@ -59,7 +59,7 @@ end
59
59
 
60
60
  # Using ENV variable.
61
61
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
62
- # Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
62
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
63
63
  # License:: MIT
64
64
  class Pgtk::Wire::Env
65
65
  # Constructor.
@@ -85,7 +85,7 @@ end
85
85
 
86
86
  # Using configuration from YAML file.
87
87
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
88
- # Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
88
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
89
89
  # License:: MIT
90
90
  class Pgtk::Wire::Yaml
91
91
  # Constructor.
data/lib/pgtk.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2024 Yegor Bugayenko
3
+ # Copyright (c) 2019-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -22,7 +22,7 @@
22
22
 
23
23
  # Pgtk main module.
24
24
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
25
- # Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
25
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Pgtk
28
28
  # Nothing here.
data/pgtk.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2024 Yegor Bugayenko
3
+ # Copyright (c) 2019-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/resources/pom.xml CHANGED
@@ -2,7 +2,7 @@
2
2
  <!--
3
3
  (The MIT License)
4
4
 
5
- Copyright (c) 2019-2024 Yegor Bugayenko
5
+ Copyright (c) 2019-2025 Yegor Bugayenko
6
6
 
7
7
  Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  of this software and associated documentation files (the 'Software'), to deal
data/test/test__helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2024 Yegor Bugayenko
3
+ # Copyright (c) 2019-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2024 Yegor Bugayenko
3
+ # Copyright (c) 2019-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -70,6 +70,7 @@ class TestLiquibaseTask < Minitest::Test
70
70
  t.yaml = File.join(dir, 'xxx.yml')
71
71
  t.postgresql_version = '42.7.1'
72
72
  t.liquibase_version = '4.25.1'
73
+ t.quiet = true
73
74
  end
74
75
  Rake::Task['liquibase'].invoke
75
76
  end
@@ -79,6 +80,7 @@ class TestLiquibaseTask < Minitest::Test
79
80
  Pgtk::LiquibaseTask.new(:lb) do |t|
80
81
  t.master = 'the-file-doesnt-exist.xml'
81
82
  t.yaml = { 'pgsql' => {} }
83
+ t.quiet = true
82
84
  end
83
85
  ex = assert_raises do
84
86
  Rake::Task['lb'].invoke
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2024 Yegor Bugayenko
3
+ # Copyright (c) 2019-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -58,7 +58,7 @@ class TestPgsqlTask < Minitest::Test
58
58
  t.password = 'the password'
59
59
  t.dbname = 'test'
60
60
  t.yaml = File.join(dir, 'cfg.yml')
61
- t.quiet = false
61
+ t.quiet = true
62
62
  t.config = {
63
63
  log_directory: dir,
64
64
  logging_collector: 'on',
data/test/test_pool.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2024 Yegor Bugayenko
3
+ # Copyright (c) 2019-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -54,6 +54,17 @@ class TestPool < Minitest::Test
54
54
  end
55
55
  end
56
56
 
57
+ def test_complex_query
58
+ bootstrap do |pool|
59
+ pool.exec(
60
+ "
61
+ INSERT INTO book (title) VALUES ('one');
62
+ INSERT INTO book (title) VALUES ('two');
63
+ "
64
+ )
65
+ end
66
+ end
67
+
57
68
  def test_logs_sql
58
69
  log = Loog::Buffer.new
59
70
  bootstrap(log: log) do |pool|
@@ -128,7 +139,7 @@ class TestPool < Minitest::Test
128
139
  t.password = 'A B C привет ! & | !'
129
140
  t.dbname = 'test'
130
141
  t.yaml = File.join(dir, 'cfg.yml')
131
- t.quiet = false
142
+ t.quiet = true
132
143
  t.fresh_start = true
133
144
  t.port = port
134
145
  end
@@ -136,11 +147,11 @@ class TestPool < Minitest::Test
136
147
  task.invoke
137
148
  pool = Pgtk::Pool.new(
138
149
  Pgtk::Wire::Yaml.new(File.join(dir, 'cfg.yml')),
139
- log: Loog::VERBOSE
150
+ log: Loog::NULL
140
151
  )
141
152
  pool.start(1)
142
153
  pool.exec('SELECT * FROM pg_catalog.pg_tables')
143
- qbash("pg_ctl -D #{Shellwords.escape(File.join(dir, 'pgsql'))} stop", log: $stdout)
154
+ qbash("pg_ctl -D #{Shellwords.escape(File.join(dir, 'pgsql'))} stop", log: nil)
144
155
  cycle = 0
145
156
  loop do
146
157
  begin
@@ -176,7 +187,7 @@ class TestPool < Minitest::Test
176
187
 
177
188
  private
178
189
 
179
- def bootstrap(log: Loog::VERBOSE)
190
+ def bootstrap(log: Loog::NULL)
180
191
  Dir.mktmpdir 'test' do |dir|
181
192
  id = rand(100..999)
182
193
  Pgtk::PgsqlTask.new("pgsql#{id}") do |t|
@@ -2,7 +2,7 @@
2
2
  <!--
3
3
  (The MIT License)
4
4
 
5
- Copyright (c) 2019-2024 Yegor Bugayenko
5
+ Copyright (c) 2019-2025 Yegor Bugayenko
6
6
 
7
7
  Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  of this software and associated documentation files (the 'Software'), to deal
@@ -2,7 +2,7 @@
2
2
  <!--
3
3
  (The MIT License)
4
4
 
5
- Copyright (c) 2019-2024 Yegor Bugayenko
5
+ Copyright (c) 2019-2025 Yegor Bugayenko
6
6
 
7
7
  Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  of this software and associated documentation files (the 'Software'), to deal
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgtk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-27 00:00:00.000000000 Z
11
+ date: 2025-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace