MYSQLSafe 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,10 +52,10 @@ module MYSQLSafe
52
52
  private
53
53
  def tick_sql(sql, table_array, column_array)
54
54
  ticked_sql = sql.delete("`")
55
- table_array.each do |name|
55
+ table_array.uniq.each do |name|
56
56
  ticked_sql = ticked_sql.gsub(name, "`#{name}`")
57
57
  end
58
- column_array.each do |col|
58
+ column_array.uniq.each do |col|
59
59
  ticked_sql = ticked_sql.gsub(col, "`#{col}`")
60
60
  end
61
61
 
@@ -1,3 +1,3 @@
1
1
  module MYSQLSafe
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -38,12 +38,28 @@ describe MYSQLSafe::Base do
38
38
  it "should allow connections to be made, and return an array" do
39
39
  @obj = help.set_variables(@obj)
40
40
  success = @obj.connect_safe("SELECT * FROM performance_test LIMIT 1")
41
+ success.to_s.wont_include "MYSQL Error"
41
42
  success.must_be_instance_of Array
42
43
  end
43
44
 
44
45
  it "should allow table=value syntax" do
45
46
  @obj = help.set_variables(@obj)
46
47
  success = @obj.connect_safe("SELECT * FROM performance_test WHERE test_int=1 LIMIT 1")
48
+ success.to_s.wont_include "MYSQL Error"
49
+ success.must_be_instance_of Array
50
+ end
51
+
52
+ it "should allow mysql ticking" do
53
+ @obj = help.set_variables(@obj)
54
+ success = @obj.connect_safe("SELECT * FROM `performance_test` WHERE `test_int` = 1 LIMIT 1")
55
+ success.to_s.wont_include "MYSQL Error"
56
+ success.must_be_instance_of Array
57
+ end
58
+
59
+ it "should allow column selection" do
60
+ @obj = help.set_variables(@obj)
61
+ success = @obj.connect_safe("SELECT `test_int`, `test_varchar` FROM `performance_test` WHERE `test_int` = 1 LIMIT 1")
62
+ success.to_s.wont_include "MYSQL Error"
47
63
  success.must_be_instance_of Array
48
64
  end
49
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: MYSQLSafe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: