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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 868711b6057c83666f750ab7a4e8f2ec077066feecc455433fec836ab7ee4acd
4
- data.tar.gz: 659285307152ca7a9c857743bd9f11c6f1724bbce1ce59ae8aff7f13da1de4bb
3
+ metadata.gz: 8f72d2ccd3b6849999fad62a3227113b89eb3d82bb3027a8248e63ed10cc217a
4
+ data.tar.gz: 295620bd5d48b3d49aef37b7ebaa0e24765a5920dde18237efa305080ff7f696
5
5
  SHA512:
6
- metadata.gz: ffc7cb6ffc5d61bccebb31be7c7977556e296294be8738a6328e69756cabdfe743a4f2593af891fcce3e4818b5fa4ed0ada2de86303495d0c9d4c8549934b988
7
- data.tar.gz: b6ad5342c8b61914f3869f1e53b2af7035733bdd16f132943d7ebea0efdd0fd8d8fdd3a238ae655436261f6417bea513f5543056441c0eead991c7c63bab2222
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 '
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MysqlFramework
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
@@ -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.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-10 00:00:00.000000000 Z
11
+ date: 2019-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler