pgtk 0.18.0 → 0.18.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3c09e42b393c24a720d0ca3c63da7d4618cfa430fd40122a516525ef64e0e9c
4
- data.tar.gz: 0bf318a887749f9edf00e78a5b229321d77804a36e1afb4a248e8952c757e5b3
3
+ metadata.gz: 82c748e501e64031a5809d1bf9de16e1a84c34355e900d7402d6f1e0041f958a
4
+ data.tar.gz: 493f523e2c414d38448b8d64d1a3b32a22c1fb8aed1f502955759907747b1091
5
5
  SHA512:
6
- metadata.gz: c4ff1a0b73c3d8c7a7f9d917b08284e534f38cd09034b8bb8a031c6ad3412546faf10cbb79a5e66f1f991098bf221642303949fa08d5490e584ed0064b76f70c
7
- data.tar.gz: 7632624121254f3c0c8a428c3a0187ec112c813f7ac7fadd1a271ecc11db65b92afe8c27cfe45dadb9aa42893849129dd7e0f0d56783c9ac91640face5b1ec97
6
+ metadata.gz: 41553fc9dc6f702ff4c04ce2165077dd172afc76d585b72957321daa7a9608082705d86e48393d469f58c87d92a92dbd36e915d088e73ea68d7530c9090c5053
7
+ data.tar.gz: 7d064ca8fa4c3ab44d7b536a5eb63284badc44b7643da8451be5839e0fa5fe791254b0a9f119a69e3456cf7038d14b732870725eed658cb64c061b3ff9a3990c
data/lib/pgtk/stash.rb CHANGED
@@ -41,12 +41,13 @@ class Pgtk::Stash
41
41
  #
42
42
  # @param [String, Array<String>] query The SQL query to execute
43
43
  # @param [Array] params Query parameters
44
+ # @param [Integer] result Should be 0 for text results, 1 for binary
44
45
  # @return [PG::Result] Query result
45
- def exec(query, params = [])
46
+ def exec(query, params = [], result = 0)
46
47
  pure = (query.is_a?(Array) ? query.join(' ') : query).gsub(/\s+/, ' ').strip
47
48
  if /(^|\s)(INSERT|DELETE|UPDATE|LOCK)\s/.match?(pure) || /(^|\s)pg_[a-z_]+\(/.match?(pure)
48
49
  tables = pure.scan(/(?<=^|\s)(?:UPDATE|INSERT INTO|DELETE FROM|TRUNCATE)\s([a-z]+)(?=[^a-z]|$)/).map(&:first).uniq
49
- ret = @pgsql.exec(pure, params)
50
+ ret = @pgsql.exec(pure, params, result)
50
51
  @entrance.with_write_lock do
51
52
  tables.each do |t|
52
53
  @stash[:tables][t]&.each do |q|
@@ -60,7 +61,7 @@ class Pgtk::Stash
60
61
  @entrance.with_write_lock { @stash[:queries][pure] ||= {} }
61
62
  ret = @stash[:queries][pure][key]
62
63
  if ret.nil?
63
- ret = @pgsql.exec(pure, params)
64
+ ret = @pgsql.exec(pure, params, result)
64
65
  if pure.start_with?('SELECT ') && !pure.include?(' NOW() ')
65
66
  @entrance.with_write_lock do
66
67
  @stash[:queries][pure] ||= {}
data/lib/pgtk/version.rb CHANGED
@@ -11,5 +11,5 @@ require_relative '../pgtk'
11
11
  # License:: MIT
12
12
  module Pgtk
13
13
  # Current version of the library.
14
- VERSION = '0.18.0'
14
+ VERSION = '0.18.1'
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgtk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko