rebel 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rebel/sql.rb +14 -14
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47b8475aea6af01062a69b77ca4d2cc481eb7618
|
4
|
+
data.tar.gz: 0b1bf87ece00986f4e25f0d464eea2e2bc1d982f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19ac899c3914354c7477478090d6bdb0591c0d67578b3caef231cea9e4073d2f3e29ab6362b9e6b3f11788793bb3e3f12c7e9caa2cdee7a07029159deb3923b6
|
7
|
+
data.tar.gz: b0bc608f8036b831b5e6eb7432f594232ff32d2e05cfe72c81159f298d1ae67b4d0907faf35a2aefb08e9bea1481acc8b30c4e30782be29a66d07e5d3904531f
|
data/lib/rebel/sql.rb
CHANGED
@@ -165,62 +165,62 @@ module Rebel::SQL
|
|
165
165
|
end
|
166
166
|
|
167
167
|
def create_table(table_name, desc)
|
168
|
-
<<-SQL
|
168
|
+
raw <<-SQL
|
169
169
|
CREATE TABLE #{name(table_name)} (
|
170
170
|
#{list(desc.map { |k, v| "#{name(k)} #{v}" })}
|
171
|
-
)
|
171
|
+
)
|
172
172
|
SQL
|
173
173
|
end
|
174
174
|
|
175
175
|
def drop_table(table_name)
|
176
|
-
<<-SQL
|
177
|
-
DROP TABLE #{name(table_name)}
|
176
|
+
raw <<-SQL
|
177
|
+
DROP TABLE #{name(table_name)}
|
178
178
|
SQL
|
179
179
|
end
|
180
180
|
|
181
181
|
def select(*fields, from: nil, where: nil, inner: nil, left: nil, right: nil)
|
182
|
-
<<-SQL
|
182
|
+
raw <<-SQL
|
183
183
|
SELECT #{names(*fields)} FROM #{name(from)}
|
184
184
|
#{inner?(inner)}
|
185
185
|
#{left?(left)}
|
186
186
|
#{right?(right)}
|
187
|
-
#{where?(where)}
|
187
|
+
#{where?(where)}
|
188
188
|
SQL
|
189
189
|
end
|
190
190
|
|
191
191
|
def insert_into(table_name, *rows)
|
192
|
-
<<-SQL
|
192
|
+
raw <<-SQL
|
193
193
|
INSERT INTO #{name(table_name)} (#{names(*rows.first.keys)})
|
194
|
-
VALUES #{list(rows.map { |r| "(#{values(*r.values)})" })}
|
194
|
+
VALUES #{list(rows.map { |r| "(#{values(*r.values)})" })}
|
195
195
|
SQL
|
196
196
|
end
|
197
197
|
|
198
198
|
def update(table_name, set: nil, where: nil, inner: nil, left: nil, right: nil)
|
199
199
|
raise ArgumentError if set.nil?
|
200
200
|
|
201
|
-
<<-SQL
|
201
|
+
raw <<-SQL
|
202
202
|
UPDATE #{name(table_name)}
|
203
203
|
SET #{assign_clause(set)}
|
204
204
|
#{inner?(inner)}
|
205
205
|
#{left?(left)}
|
206
206
|
#{right?(right)}
|
207
|
-
#{where?(where)}
|
207
|
+
#{where?(where)}
|
208
208
|
SQL
|
209
209
|
end
|
210
210
|
|
211
211
|
def delete_from(table_name, where: nil, inner: nil, left: nil, right: nil)
|
212
|
-
<<-SQL
|
212
|
+
raw <<-SQL
|
213
213
|
DELETE FROM #{name(table_name)}
|
214
214
|
#{inner?(inner)}
|
215
215
|
#{left?(left)}
|
216
216
|
#{right?(right)}
|
217
|
-
#{where?(where)}
|
217
|
+
#{where?(where)}
|
218
218
|
SQL
|
219
219
|
end
|
220
220
|
|
221
221
|
def truncate(table_name)
|
222
|
-
<<-SQL
|
223
|
-
TRUNCATE #{name(table_name)}
|
222
|
+
raw <<-SQL
|
223
|
+
TRUNCATE #{name(table_name)}
|
224
224
|
SQL
|
225
225
|
end
|
226
226
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rebel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loic Nageleisen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: SQL-flavoured Ruby, or is it the other way around?
|
14
14
|
email: loic.nageleisen@gmail.com
|
@@ -38,7 +38,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
38
|
version: '0'
|
39
39
|
requirements: []
|
40
40
|
rubyforge_project:
|
41
|
-
rubygems_version: 2.
|
41
|
+
rubygems_version: 2.6.11
|
42
42
|
signing_key:
|
43
43
|
specification_version: 4
|
44
44
|
summary: Fight against the Object tyranny
|