mini_sql 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/lib/mini_sql/postgres/prepared_binds.rb +27 -0
- data/lib/mini_sql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbfef3c29b94c4d0bdbb461b52419644f3b042236f58837a6247a84546034e26
|
4
|
+
data.tar.gz: 52b175f5f3c712f891f61fe47618584c4279e0bd9f4a0496fb545bd3574eb8ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00a003b8bdc6bdf623ad10d3702b3851b0c5bdbc5c1d82c76aa40c5dd797ef11d4bcb153d85cf323d451403d87fb90d0b12c43da3df84a5c49aa84b1d8c8c570
|
7
|
+
data.tar.gz: 11fd1b56b47b9ef11d452e1c8eca322ec35ac054a78195fe30bfbeacd1858e67092cc96248f724cab0c9d4b795b0bcdd8e75a3c678bce8ba9787973f47f33439
|
data/CHANGELOG
CHANGED
@@ -6,6 +6,33 @@ module MiniSql
|
|
6
6
|
module Postgres
|
7
7
|
class PreparedBinds < ::MiniSql::Abstract::PreparedBinds
|
8
8
|
|
9
|
+
def bind_hash(sql, hash)
|
10
|
+
sql = sql.dup
|
11
|
+
binds = []
|
12
|
+
bind_names = []
|
13
|
+
i = 0
|
14
|
+
|
15
|
+
hash.each do |k, v|
|
16
|
+
bind_outputs =
|
17
|
+
array_wrap(v).map { |vv|
|
18
|
+
binds << vv
|
19
|
+
bind_names << [BindName.new(k)]
|
20
|
+
bind_output(i += 1)
|
21
|
+
}.join(', ')
|
22
|
+
|
23
|
+
sql.gsub!(":#{k}") do
|
24
|
+
# ignore ::int and stuff like that
|
25
|
+
# $` is previous to match
|
26
|
+
if $` && $`[-1] != ":"
|
27
|
+
bind_outputs
|
28
|
+
else
|
29
|
+
":#{k}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
[sql, binds, bind_names]
|
34
|
+
end
|
35
|
+
|
9
36
|
def bind_output(i)
|
10
37
|
"$#{i}"
|
11
38
|
end
|
data/lib/mini_sql/version.rb
CHANGED
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.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|