kbam 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kbam.rb +7 -11
- data/lib/kbam/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d869c433d85a0ee050a6528d2c1803ef55045ad5
|
4
|
+
data.tar.gz: 1ae42ea61231ca50a5b61abd70bfb91ad83b8a08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7542e99ceedc59a0a8e1c677e3d27ca45c6841a6ef5c847aef24a8c09fc89400d16278ef7088a22757c3f509008c5081644da9c9ae75b785bc5e093a7bb1d17
|
7
|
+
data.tar.gz: e302d0b4da071ecc35dfa54be07325a17f5cca836d1c927797a2a1d56ba1feef1c147f8690cfdfc0ed8c7c00f84235e24ed64b930d47c6e645fcae6a1d6a890a
|
data/lib/kbam.rb
CHANGED
@@ -43,6 +43,7 @@ class Kbam
|
|
43
43
|
@as = "t"
|
44
44
|
@into = ""
|
45
45
|
@insert = {}
|
46
|
+
@insert_ignore = "" # will create a INSERT IGNORE statement
|
46
47
|
|
47
48
|
# meta data
|
48
49
|
@last_query = nil
|
@@ -221,8 +222,12 @@ class Kbam
|
|
221
222
|
end
|
222
223
|
end
|
223
224
|
|
224
|
-
def
|
225
|
+
def ignore
|
226
|
+
@insert_ignore = "IGNORE"
|
227
|
+
return self
|
228
|
+
end
|
225
229
|
|
230
|
+
def insert(value_pair)
|
226
231
|
@query_type = INSERT
|
227
232
|
|
228
233
|
columns = ""
|
@@ -245,7 +250,6 @@ class Kbam
|
|
245
250
|
@insert = " (#{columns}) VALUES (#{values})"
|
246
251
|
|
247
252
|
return self
|
248
|
-
|
249
253
|
end
|
250
254
|
|
251
255
|
def update(value_pair)
|
@@ -273,21 +277,17 @@ class Kbam
|
|
273
277
|
|
274
278
|
# used together with 'insert'
|
275
279
|
def into(table)
|
276
|
-
|
277
280
|
if @query_type === INSERT
|
278
|
-
@into = "INSERT INTO #{field_sanatize(table)} "
|
281
|
+
@into = "INSERT #{@insert_ignore} INTO #{field_sanatize(table)} "
|
279
282
|
elsif @query_type === UPDATE
|
280
283
|
@into = "UPDATE #{field_sanatize(table)}"
|
281
284
|
end
|
282
285
|
|
283
286
|
return self
|
284
|
-
|
285
287
|
end
|
286
288
|
|
287
289
|
def run
|
288
|
-
|
289
290
|
if @query_type === INSERT
|
290
|
-
|
291
291
|
# execute insert query
|
292
292
|
@query = "#{@into} #{@insert}"
|
293
293
|
execute
|
@@ -298,17 +298,13 @@ class Kbam
|
|
298
298
|
|
299
299
|
insert_id = query_result.first["insert_id"]
|
300
300
|
return insert_id
|
301
|
-
|
302
301
|
elsif @query_type === UPDATE
|
303
|
-
|
304
302
|
# execute insert query
|
305
303
|
@query = "#{@into} #{@update} #{compose_where}"
|
306
304
|
execute
|
307
305
|
|
308
306
|
return true
|
309
|
-
|
310
307
|
end
|
311
|
-
|
312
308
|
end
|
313
309
|
|
314
310
|
def from(from_string = nil)
|
data/lib/kbam/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kbam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leopold Burdyl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|
@@ -46,10 +46,10 @@ executables: []
|
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
+
- lib/kbam.rb
|
49
50
|
- lib/kbam/extension.rb
|
50
|
-
- lib/kbam/version.rb
|
51
51
|
- lib/kbam/sugar.rb
|
52
|
-
- lib/kbam.rb
|
52
|
+
- lib/kbam/version.rb
|
53
53
|
homepage: https://github.com/vilnius-leopold/kbam
|
54
54
|
licenses:
|
55
55
|
- MIT
|
@@ -70,8 +70,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
72
|
rubyforge_project:
|
73
|
-
rubygems_version: 2.0
|
73
|
+
rubygems_version: 2.2.0
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
|
-
summary: K'bam!
|
76
|
+
summary: K'bam!
|
77
77
|
test_files: []
|