kbam 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/kbam.rb +7 -11
  3. data/lib/kbam/version.rb +1 -1
  4. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 395a5a5f6f132a89a3cd3db04bebcdfda450b719
4
- data.tar.gz: 1f461bb7e8311aa0ae97a1b987460c65e98000e4
3
+ metadata.gz: d869c433d85a0ee050a6528d2c1803ef55045ad5
4
+ data.tar.gz: 1ae42ea61231ca50a5b61abd70bfb91ad83b8a08
5
5
  SHA512:
6
- metadata.gz: 18049726d8952ec0d2541c883f9371998a2c52d819a60d1a283f77e0ea9f25a025f6eef988f7c08a93e76cd1617869091cd55b24c5f48a6a64ce9881e1b64c32
7
- data.tar.gz: 7e034f07660900bbc19c9ca5d61a517ad99b12b9d25f82b8bc698a229e093c119c05a123bc0982d7578bec74bc9d79c14e6adbcd0ce97062b5f8d0a3c47b1ccb
6
+ metadata.gz: c7542e99ceedc59a0a8e1c677e3d27ca45c6841a6ef5c847aef24a8c09fc89400d16278ef7088a22757c3f509008c5081644da9c9ae75b785bc5e093a7bb1d17
7
+ data.tar.gz: e302d0b4da071ecc35dfa54be07325a17f5cca836d1c927797a2a1d56ba1feef1c147f8690cfdfc0ed8c7c00f84235e24ed64b930d47c6e645fcae6a1d6a890a
@@ -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 insert(value_pair)
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)
@@ -1,3 +1,3 @@
1
1
  class Kbam
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
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.1
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: 2013-12-16 00:00:00.000000000 Z
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.7
73
+ rubygems_version: 2.2.0
74
74
  signing_key:
75
75
  specification_version: 4
76
- summary: K'bam! UNSTABLE - only for testing!
76
+ summary: K'bam!
77
77
  test_files: []