mysql_framework 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mysql_framework/sql_query.rb +14 -0
- data/lib/mysql_framework/version.rb +1 -1
- data/spec/lib/mysql_framework/sql_query_spec.rb +14 -0
- 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: 8f72d2ccd3b6849999fad62a3227113b89eb3d82bb3027a8248e63ed10cc217a
|
4
|
+
data.tar.gz: 295620bd5d48b3d49aef37b7ebaa0e24765a5920dde18237efa305080ff7f696
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 415c20462029d705dbc62dfc5268e50d56e42ac483da91324f9b931b44bcdabf4ae953d8a3886dcc1787e6e00c538e5241ab0707bfd8563cace146eff7057b97
|
7
|
+
data.tar.gz: dd434df3036490387a806b55c630f34f5a782be8ebf3034aa484e3d40a95fdd9a1f1f1cbc3dd5ebac0bc64bcb3ce15d5d221c8abe91ed432ce02d33a804f2d18
|
@@ -62,6 +62,20 @@ module MysqlFramework
|
|
62
62
|
self
|
63
63
|
end
|
64
64
|
|
65
|
+
# This method is called to specify the values to bulk insert.
|
66
|
+
def bulk_values(bulk_values)
|
67
|
+
@sql += ' VALUES'
|
68
|
+
|
69
|
+
bulk_values.each do |values|
|
70
|
+
@sql += "(#{values.map { '?' }.join(', ')}),"
|
71
|
+
@params += values
|
72
|
+
end
|
73
|
+
|
74
|
+
@sql = @sql.chomp(',')
|
75
|
+
|
76
|
+
self
|
77
|
+
end
|
78
|
+
|
65
79
|
# This method is called to specify the columns to update.
|
66
80
|
def set(values)
|
67
81
|
@sql += ' SET '
|
@@ -125,6 +125,20 @@ describe MysqlFramework::SqlQuery do
|
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
|
+
describe '#bulk_values' do
|
129
|
+
it 'sets the sql for the values statement' do
|
130
|
+
bulk_values = [
|
131
|
+
['mysql_framework', 'sage', '2016-06-28 10:00:00'],
|
132
|
+
['mysql_framework', 'sage', '2016-06-28 10:00:00']
|
133
|
+
]
|
134
|
+
|
135
|
+
subject.bulk_values(bulk_values)
|
136
|
+
|
137
|
+
expect(subject.sql).to eq('VALUES(?, ?, ?),(?, ?, ?)')
|
138
|
+
expect(subject.params).to eq(bulk_values.flatten)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
128
142
|
describe '#set' do
|
129
143
|
it 'sets the sql for the set statement' do
|
130
144
|
subject.set(name: 'mysql_framework', author: 'sage', created_at: '2016-06-28 10:00:00')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mysql_framework
|
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
|
- Sage
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|