mini_sql 1.0 → 1.0.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: 3d668e0b456e27a572040825399ca9477d6c4404bfc09e6e87b1330a106491a0
4
- data.tar.gz: 3fb2027b34d3837e06f6c92b7075f8811296c0750c5c4c3ae48d6053189a4000
3
+ metadata.gz: 78a25d1d6af83ae3c2f74f85c4a920a2a1019324ce8904bf3feda15b4ee486df
4
+ data.tar.gz: 5d686631612a51a4134cf964c40bb41a883e19fa9847498668eca9f03e2f9816
5
5
  SHA512:
6
- metadata.gz: 60449b0a92a13aa471dbc1dd6db2b8ba0571bca67f81bd46644bf8678ab794b5447e59cd3ea7a24d4732bcdb8eca44c9dfec748c57418d826444305395f62190
7
- data.tar.gz: a249f769da221d659d1b4dceaf3dd153578fbda3f0951bdac938d178923a54ad852106629d76be38b5c4ad83c4175592b9971223f8e0aab49e91a48747ad7148
6
+ metadata.gz: 2c862314017d5be1cfe429b1632ae350d3f123ef7312506437eec04f9023e309dbdb7c366eb6afe88d65d4137accd43627856ae823bc11707a51c358219a19ed
7
+ data.tar.gz: 6e3ac51e042bdbaff790a272c8e9207512d436493b005a4fe268128204125e44c3a955eef9ae38a3db2e07f207f86ee4dedbaa59145f0257055347581434b79f
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 2020-12-31 - 1.0.1
2
+
3
+ - FIX: revert perf fix broke param_encoder interface, we were expecting never to be called if no encoding was to happen
4
+
1
5
  2020-12-30 - 1.0
2
6
 
3
7
  - Added serialization support using MiniSql::Serializer.to_json / .from_json
@@ -9,8 +9,6 @@ module MiniSql
9
9
  end
10
10
 
11
11
  def encode(sql, *params)
12
- return sql unless params && params.length > 0
13
-
14
12
  if Hash === (hash = params[0])
15
13
  raise ArgumentError, "Only one hash param is allowed, multiple were sent" if params.length > 1
16
14
  encode_hash(sql, hash)
@@ -50,7 +50,9 @@ module MiniSql
50
50
  private
51
51
 
52
52
  def run(sql, as, params)
53
- sql = param_encoder.encode(sql, *params)
53
+ if params && params.length > 0
54
+ sql = param_encoder.encode(sql, *params)
55
+ end
54
56
  raw_connection.query(
55
57
  sql,
56
58
  as: as,
@@ -97,7 +97,9 @@ module MiniSql
97
97
 
98
98
  def query_each(sql, *params)
99
99
  raise StandardError, "Please supply a block when calling query_each" if !block_given?
100
- sql = param_encoder.encode(sql, *params)
100
+ if params && params.length > 0
101
+ sql = param_encoder.encode(sql, *params)
102
+ end
101
103
 
102
104
  raw_connection.send_query(sql)
103
105
  raw_connection.set_single_row_mode
@@ -128,7 +130,9 @@ module MiniSql
128
130
 
129
131
  def query_each_hash(sql, *params)
130
132
  raise StandardError, "Please supply a block when calling query_each_hash" if !block_given?
131
- sql = param_encoder.encode(sql, *params)
133
+ if params && params.length > 0
134
+ sql = param_encoder.encode(sql, *params)
135
+ end
132
136
 
133
137
  raw_connection.send_query(sql)
134
138
  raw_connection.set_single_row_mode
@@ -191,7 +195,9 @@ module MiniSql
191
195
  private
192
196
 
193
197
  def run(sql, params)
194
- sql = param_encoder.encode(sql, *params)
198
+ if params && params.length > 0
199
+ sql = param_encoder.encode(sql, *params)
200
+ end
195
201
  raw_connection.async_exec(sql)
196
202
  end
197
203
 
@@ -89,7 +89,9 @@ module MiniSql
89
89
  private
90
90
 
91
91
  def run(sql, params)
92
- sql = param_encoder.encode(sql, *params)
92
+ if params && params.length > 0
93
+ sql = param_encoder.encode(sql, *params)
94
+ end
93
95
  conn = raw_connection
94
96
  conn.typemap = self.class.typemap
95
97
  conn.execute(sql)
@@ -63,7 +63,9 @@ module MiniSql
63
63
  private
64
64
 
65
65
  def run(sql, *params)
66
- sql = param_encoder.encode(sql, *params)
66
+ if params && params.length > 0
67
+ sql = param_encoder.encode(sql, *params)
68
+ end
67
69
  if block_given?
68
70
  stmt = SQLite3::Statement.new(raw_connection, sql)
69
71
  yield stmt.execute
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module MiniSql
3
- VERSION = "1.0"
3
+ VERSION = "1.0.1"
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.0'
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-29 00:00:00.000000000 Z
11
+ date: 2020-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -242,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
242
  - !ruby/object:Gem::Version
243
243
  version: '0'
244
244
  requirements: []
245
- rubygems_version: 3.2.3
245
+ rubygems_version: 3.2.2
246
246
  signing_key:
247
247
  specification_version: 4
248
248
  summary: A fast, safe, simple direct SQL executor