mini_sql 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mini_sql/builder.rb +9 -3
- data/lib/mini_sql/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c805e0578de8d26ad5b1ab75e0a43e11fa87cfa7742f872405598d26194537d0
|
4
|
+
data.tar.gz: 26cc5f52280ef8fe6fd031f7aceb0fc696765259f81ce472353d127a9b216107
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b420b642d7e64839037eeb9ba7204ff654ae536e097cbe9e02c510753d98cb06f4e6d811975bd400f6b8b28d7e29dfa7dbcd5aeee34bbec42133fc6c3c5e166
|
7
|
+
data.tar.gz: f505f8ec94c6bf04c977eddedaffdcd5dadb6825e49e09b9f8f37652bfc6846831c39b63bac913a9e70aea4cc50400a2c8b6d761fae9c415ae12e1f4f3f8fddf
|
data/lib/mini_sql/builder.rb
CHANGED
@@ -11,8 +11,8 @@ class MiniSql::Builder
|
|
11
11
|
|
12
12
|
[:set, :where2, :where, :order_by, :limit, :left_join, :join, :offset, :select].each do |k|
|
13
13
|
define_method k do |data, *args|
|
14
|
-
|
15
|
-
|
14
|
+
if Hash === args && args.length > 0
|
15
|
+
@args ||= {}
|
16
16
|
@args.merge!(args)
|
17
17
|
elsif args && args.length > 0
|
18
18
|
data = @connection.param_encoder.encode(data, *args)
|
@@ -56,7 +56,13 @@ class MiniSql::Builder
|
|
56
56
|
class_eval <<~RUBY
|
57
57
|
def #{m}(hash_args = nil)
|
58
58
|
hash_args = @args.merge(hash_args) if hash_args && @args
|
59
|
-
|
59
|
+
hash_args ||= @args
|
60
|
+
|
61
|
+
if hash_args
|
62
|
+
@connection.#{m}(to_sql, hash_args)
|
63
|
+
else
|
64
|
+
@connection.#{m}(to_sql)
|
65
|
+
end
|
60
66
|
end
|
61
67
|
RUBY
|
62
68
|
end
|
data/lib/mini_sql/version.rb
CHANGED