mini_sql 1.1.1 → 1.1.2

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: df275ffff82e8f6fc97b466178d50bcb8e3d5af55167f811abce10356e248770
4
- data.tar.gz: 7b943e8a2dca0d546c0140d0957d4712d4f11610f169caefcd01aa7ea8e75e9a
3
+ metadata.gz: 335047554a8bf88fb9f9c3152d5f7056806ee541667ca47ffdfe678d85d16f2e
4
+ data.tar.gz: fa574144f2ca9e8427b5d72292af8fbb67e8e89b799bd2ab550639edd6f0eca0
5
5
  SHA512:
6
- metadata.gz: 5fda186dcae83e032b1f120782edd86c8d1d7e276afeb040479fca4e5cc6a52e40499f45df5c9a3303c7823e0e9fed128c17b422bdd12903fa50c4198732c25b
7
- data.tar.gz: affcf46e3c8cfffd001fbef3c5d49f938c694a7b85412df7855938fb1326330a386d0557021bd2b1156f7e0bd10a6c1c560cc171190e0ff21e5a06e3375ee984
6
+ metadata.gz: b5b92a31e176d19b2c006dfec04884c295e7e9d6eaf04d5222f777b2e4d012225efb8e46699b9be7ad1cd103e87cc1637096a0bbef6cae0dfec928545e5a2538
7
+ data.tar.gz: '0685f098c60980117f0278a0f0887b0bd95f6d06ace0aeeba520dd163a7422b686b7d7f4009e29de97f8b713900b206174d3765903f4b6e28c953cfd174f03c3'
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 2021-03-22 - 1.1.2
2
+
3
+ - FEATURE: improve compatability with clients overriding raw_connection
4
+
1
5
  2021-03-22 - 1.1.1
2
6
 
3
7
  - FIX: compatability with ActiveRecord param encoder
@@ -9,12 +9,14 @@ module MiniSql
9
9
  @raw_connection = raw_connection
10
10
  @param_encoder = (args && args[:param_encoder]) || InlineParamEncoder.new(self)
11
11
  @deserializer_cache = (args && args[:deserializer_cache]) || DeserializerCache.new
12
-
13
- @prepared = PreparedConnection.new(self, @deserializer_cache)
14
12
  end
15
13
 
16
14
  def prepared(condition = true)
17
- condition ? @prepared : self
15
+ if condition
16
+ @prepared ||= PreparedConnection.new(self, @deserializer_cache)
17
+ else
18
+ self
19
+ end
18
20
  end
19
21
 
20
22
  def query_single(sql, *params)
@@ -40,8 +40,6 @@ module MiniSql
40
40
  @deserializer_cache = (args && args[:deserializer_cache]) || self.class.default_deserializer_cache
41
41
  @param_encoder = (args && args[:param_encoder]) || InlineParamEncoder.new(self)
42
42
  @type_map = args && args[:type_map]
43
-
44
- @prepared = PreparedConnection.new(self, @deserializer_cache)
45
43
  end
46
44
 
47
45
  def type_map
@@ -49,7 +47,11 @@ module MiniSql
49
47
  end
50
48
 
51
49
  def prepared(condition = true)
52
- condition ? @prepared : self
50
+ if condition
51
+ @prepared ||= PreparedConnection.new(self, @deserializer_cache)
52
+ else
53
+ self
54
+ end
53
55
  end
54
56
 
55
57
  # Returns a flat array containing all results.
@@ -9,12 +9,14 @@ module MiniSql
9
9
  @raw_connection = raw_connection
10
10
  @param_encoder = (args && args[:param_encoder]) || InlineParamEncoder.new(self)
11
11
  @deserializer_cache = (args && args[:deserializer_cache]) || DeserializerCache.new
12
-
13
- @prepared = PreparedConnection.new(self, @deserializer_cache)
14
12
  end
15
13
 
16
14
  def prepared(condition = true)
17
- condition ? @prepared : self
15
+ if condition
16
+ @prepared ||= PreparedConnection.new(self, @deserializer_cache)
17
+ else
18
+ self
19
+ end
18
20
  end
19
21
 
20
22
  def query_single(sql, *params)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module MiniSql
3
- VERSION = "1.1.1"
3
+ VERSION = "1.1.2"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-22 00:00:00.000000000 Z
11
+ date: 2021-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler