epoxy 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -2
- data/VERSION +1 -1
- data/lib/epoxy.rb +2 -0
- data/test/test_epoxy.rb +84 -9
- metadata +15 -4
data/Rakefile
CHANGED
@@ -10,6 +10,7 @@ begin
|
|
10
10
|
gem.email = "erik@hollensbe.org"
|
11
11
|
gem.homepage = "http://github.com/erikh/epoxy"
|
12
12
|
gem.authors = ["Erik Hollensbe"]
|
13
|
+
gem.add_development_dependency 'rdoc'
|
13
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
15
|
end
|
15
16
|
Jeweler::GemcutterTasks.new
|
@@ -45,12 +46,13 @@ task :to_blog => [:clobber_rdoc, :rdoc] do
|
|
45
46
|
sh "rm -fr $git/blog/content/docs/epoxy && mv rdoc $git/blog/content/docs/epoxy"
|
46
47
|
end
|
47
48
|
|
48
|
-
require '
|
49
|
-
|
49
|
+
require 'rdoc/task'
|
50
|
+
RDoc::Task.new do |rdoc|
|
50
51
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
51
52
|
|
52
53
|
rdoc.rdoc_dir = 'rdoc'
|
53
54
|
rdoc.title = "epoxy #{version}"
|
55
|
+
rdoc.main = "README.rdoc"
|
54
56
|
rdoc.rdoc_files.include('README*')
|
55
57
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
56
58
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/epoxy.rb
CHANGED
data/test/test_epoxy.rb
CHANGED
@@ -9,35 +9,110 @@ class TestEpoxy < Test::Unit::TestCase
|
|
9
9
|
assert_equal("select * from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def test_02_literal_question_mark
|
13
13
|
ep = Epoxy.new("select ?? from foo where bar=?")
|
14
14
|
assert_equal("select ? from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
15
|
+
|
16
|
+
ep = Epoxy.new("select ??? from foo where bar=?")
|
17
|
+
assert_equal("select ?'foo' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
18
|
+
|
19
|
+
ep = Epoxy.new("select ???? from foo where bar=?")
|
20
|
+
assert_equal("select ?? from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
21
|
+
|
22
|
+
ep = Epoxy.new("select ????? from foo where bar=?")
|
23
|
+
assert_equal("select ??'foo' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
24
|
+
|
25
|
+
ep = Epoxy.new("select '?' from foo where bar=?")
|
26
|
+
assert_equal("select '?' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
27
|
+
|
28
|
+
ep = Epoxy.new("select '?'? from foo where bar=?")
|
29
|
+
assert_equal("select '?''foo' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
30
|
+
|
31
|
+
ep = Epoxy.new("select '?''?' from foo where bar=?")
|
32
|
+
assert_equal("select '?''?' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
33
|
+
|
34
|
+
ep = Epoxy.new("select ?'?' from foo where bar=?")
|
35
|
+
assert_equal("select 'foo''?' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
36
|
+
|
37
|
+
ep = Epoxy.new("select ?'?'? from foo where bar=?")
|
38
|
+
assert_equal("select 'foo''?''foo' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
39
|
+
|
40
|
+
ep = Epoxy.new("select '?'?'? from foo where bar=?")
|
41
|
+
assert_equal("select '?''foo'''foo' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
42
|
+
|
43
|
+
ep = Epoxy.new("select '?'?'?' from foo where bar=?")
|
44
|
+
assert_equal("select '?''foo''?' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
45
|
+
|
46
|
+
ep = Epoxy.new("select '?'?? from foo where bar=?")
|
47
|
+
assert_equal("select '?'? from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
48
|
+
|
49
|
+
ep = Epoxy.new("select '?'??? from foo where bar=?")
|
50
|
+
assert_equal("select '?'?'foo' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
51
|
+
|
52
|
+
ep = Epoxy.new("select ??'?'??? from foo where bar=?")
|
53
|
+
assert_equal("select ?'?'?'foo' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
54
|
+
|
55
|
+
ep = Epoxy.new("select ???'?'??? from foo where bar=?")
|
56
|
+
assert_equal("select ?'foo''?'?'foo' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
57
|
+
|
58
|
+
ep = Epoxy.new("select ''? from foo where bar=?")
|
59
|
+
assert_equal("select '''foo' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
60
|
+
|
61
|
+
ep = Epoxy.new("select '''? from foo where bar=?")
|
62
|
+
assert_equal("select ''''foo' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
63
|
+
|
64
|
+
ep = Epoxy.new("select ''?' from foo where bar=?")
|
65
|
+
assert_equal("select '''foo'' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
66
|
+
|
67
|
+
ep = Epoxy.new("select ''?'' from foo where bar=?")
|
68
|
+
assert_equal("select '''foo''' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
69
|
+
|
70
|
+
ep = Epoxy.new("select ''??' from foo where bar=?")
|
71
|
+
assert_equal("select ''?' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
72
|
+
|
73
|
+
ep = Epoxy.new("select '?''?' from foo where bar=?")
|
74
|
+
assert_equal("select '?''?' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
75
|
+
|
76
|
+
ep = Epoxy.new("select '?'''?' from foo where bar=?")
|
77
|
+
assert_equal("select '?''''foo'' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
78
|
+
|
79
|
+
ep = Epoxy.new("select '?''''?' from foo where bar=?")
|
80
|
+
assert_equal("select '?''''?' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
81
|
+
|
82
|
+
ep = Epoxy.new("select '??' from foo where bar=?")
|
83
|
+
assert_equal("select '??' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
84
|
+
|
85
|
+
ep = Epoxy.new("select '???' from foo where bar=?")
|
86
|
+
assert_equal("select '???' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
87
|
+
|
88
|
+
ep = Epoxy.new("select ''???' from foo where bar=?")
|
89
|
+
assert_equal("select ''?'foo'' from foo where bar='foo'", ep.quote { |x| "'foo'" })
|
15
90
|
end
|
16
91
|
|
17
92
|
def test_03_quotes_already
|
18
93
|
ep = Epoxy.new("select * from \"foo\" where bar=?")
|
19
94
|
assert_equal("select * from \"foo\" where bar='foo'", ep.quote { |x| "'foo'" })
|
20
|
-
|
95
|
+
|
21
96
|
ep = Epoxy.new("select * from 'foo' where bar=?")
|
22
97
|
assert_equal("select * from 'foo' where bar='foo'", ep.quote { |x| "'foo'" })
|
23
98
|
end
|
24
|
-
|
99
|
+
|
25
100
|
def test_04_holy_shit
|
26
101
|
ep = Epoxy.new("select * from \"'foo'\" where bar=?")
|
27
102
|
assert_equal("select * from \"'foo'\" where bar='foo'", ep.quote { |x| "'foo'" })
|
28
|
-
|
103
|
+
|
29
104
|
ep = Epoxy.new("select * from E\"'foo'\" where bar=?")
|
30
105
|
assert_equal("select * from E\"'foo'\" where bar='foo'", ep.quote { |x| "'foo'" })
|
31
|
-
|
106
|
+
|
32
107
|
ep = Epoxy.new("select * from E\"''foo''\" where bar=?")
|
33
108
|
assert_equal("select * from E\"''foo''\" where bar='foo'", ep.quote { |x| "'foo'" })
|
34
|
-
|
109
|
+
|
35
110
|
ep = Epoxy.new("select * from E\"\\''foo''\" where bar=?")
|
36
111
|
assert_equal("select * from E\"\\''foo''\" where bar='foo'", ep.quote { |x| "'foo'" })
|
37
|
-
|
112
|
+
|
38
113
|
ep = Epoxy.new("select * from E\"\\''foo\\''\" where bar=?")
|
39
114
|
assert_equal("select * from E\"\\''foo\\''\" where bar='foo'", ep.quote { |x| "'foo'" })
|
40
|
-
|
115
|
+
|
41
116
|
ep = Epoxy.new("select * from foo where bar='?'")
|
42
117
|
assert_equal("select * from foo where bar='?'", ep.quote { |x| "'foo'" })
|
43
118
|
end
|
@@ -47,7 +122,7 @@ class TestEpoxy < Test::Unit::TestCase
|
|
47
122
|
-- a comment!
|
48
123
|
select * from foo where bar=?
|
49
124
|
}.strip)
|
50
|
-
|
125
|
+
|
51
126
|
assert_equal(%Q{
|
52
127
|
-- a comment!
|
53
128
|
select * from foo where bar='foo'
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Erik Hollensbe
|
@@ -16,8 +16,19 @@ cert_chain: []
|
|
16
16
|
|
17
17
|
date: 2010-05-27 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rdoc
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :development
|
31
|
+
version_requirements: *id001
|
21
32
|
description: Parse binds in SQL or any other data query language, quote, even configure for client-side binding. It all works!
|
22
33
|
email: erik@hollensbe.org
|
23
34
|
executables: []
|