sqlconstructor 0.1
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.
- checksums.yaml +15 -0
- data/LICENSE.md +16 -0
- data/README.md +161 -0
- data/Rakefile +11 -0
- data/doc/Object.html +267 -0
- data/doc/Rakefile.html +150 -0
- data/doc/SQLAliasedList.html +717 -0
- data/doc/SQLColumn.html +326 -0
- data/doc/SQLCondList.html +318 -0
- data/doc/SQLConditional.html +1082 -0
- data/doc/SQLConditional/BasicCond.html +325 -0
- data/doc/SQLConstructor.html +763 -0
- data/doc/SQLConstructor/BasicDelete.html +383 -0
- data/doc/SQLConstructor/BasicDelete_mysql.html +368 -0
- data/doc/SQLConstructor/BasicInsert.html +339 -0
- data/doc/SQLConstructor/BasicInsert_mysql.html +325 -0
- data/doc/SQLConstructor/BasicJoin.html +408 -0
- data/doc/SQLConstructor/BasicJoin_mysql.html +439 -0
- data/doc/SQLConstructor/BasicSelect.html +554 -0
- data/doc/SQLConstructor/BasicSelect_example.html +288 -0
- data/doc/SQLConstructor/BasicSelect_mysql.html +466 -0
- data/doc/SQLConstructor/BasicUnion.html +396 -0
- data/doc/SQLConstructor/BasicUpdate.html +409 -0
- data/doc/SQLConstructor/BasicUpdate_mysql.html +310 -0
- data/doc/SQLConstructor/GenericQuery.html +797 -0
- data/doc/SQLConstructor/QAttr.html +398 -0
- data/doc/SQLConstructorTest.html +603 -0
- data/doc/SQLExporter.html +382 -0
- data/doc/SQLExporter/Exporter_generic.html +413 -0
- data/doc/SQLExporter/Exporter_mysql.html +395 -0
- data/doc/SQLObject.html +525 -0
- data/doc/SQLValList.html +322 -0
- data/doc/SQLValue.html +375 -0
- data/doc/created.rid +12 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +356 -0
- data/doc/js/darkfish.js +118 -0
- data/doc/js/jquery.js +32 -0
- data/doc/js/quicksearch.js +114 -0
- data/doc/js/thickbox-compressed.js +10 -0
- data/doc/lib/dialects/example-constructor_rb.html +52 -0
- data/doc/lib/dialects/mysql-constructor_rb.html +52 -0
- data/doc/lib/dialects/mysql-exporter_rb.html +54 -0
- data/doc/lib/sqlconditional_rb.html +64 -0
- data/doc/lib/sqlconstructor_rb.html +52 -0
- data/doc/lib/sqlerrors_rb.html +54 -0
- data/doc/lib/sqlexporter_rb.html +55 -0
- data/doc/lib/sqlobject_rb.html +54 -0
- data/doc/rdoc.css +763 -0
- data/doc/test/queries_rb.html +56 -0
- data/doc/test_rb.html +52 -0
- data/lib/dialects/example-constructor.rb +45 -0
- data/lib/dialects/mysql-constructor.rb +247 -0
- data/lib/dialects/mysql-exporter.rb +108 -0
- data/lib/sqlconditional.rb +196 -0
- data/lib/sqlconstructor.rb +708 -0
- data/lib/sqlerrors.rb +15 -0
- data/lib/sqlexporter.rb +125 -0
- data/lib/sqlobject.rb +284 -0
- data/test/queries.rb +92 -0
- metadata +121 -0
@@ -0,0 +1,325 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Class: SQLConditional::BasicCond</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
<script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
+
<script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
+
<script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body id="top" class="class">
|
19
|
+
|
20
|
+
<div id="metadata">
|
21
|
+
<div id="home-metadata">
|
22
|
+
<div id="home-section" class="section">
|
23
|
+
<h3 class="section-header">
|
24
|
+
<a href="../index.html">Home</a>
|
25
|
+
<a href="../index.html#classes">Classes</a>
|
26
|
+
<a href="../index.html#methods">Methods</a>
|
27
|
+
</h3>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div id="file-metadata">
|
32
|
+
<div id="file-list-section" class="section">
|
33
|
+
<h3 class="section-header">In Files</h3>
|
34
|
+
<div class="section-body">
|
35
|
+
<ul>
|
36
|
+
|
37
|
+
<li><a href="../lib/sqlconditional_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
+
class="thickbox" title="lib/sqlconditional.rb">lib/sqlconditional.rb</a></li>
|
39
|
+
|
40
|
+
</ul>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div id="class-metadata">
|
48
|
+
|
49
|
+
<!-- Parent Class -->
|
50
|
+
<div id="parent-class-section" class="section">
|
51
|
+
<h3 class="section-header">Parent</h3>
|
52
|
+
|
53
|
+
<p class="link"><a href="../Object.html">Object</a></p>
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
<!-- Method Quickref -->
|
64
|
+
<div id="method-list-section" class="section">
|
65
|
+
<h3 class="section-header">Methods</h3>
|
66
|
+
<ul class="link-list">
|
67
|
+
|
68
|
+
<li><a href="#method-c-new">::new</a></li>
|
69
|
+
|
70
|
+
<li><a href="#method-i-to_s">#to_s</a></li>
|
71
|
+
|
72
|
+
</ul>
|
73
|
+
</div>
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="project-metadata">
|
80
|
+
|
81
|
+
|
82
|
+
<div id="fileindex-section" class="section project-section">
|
83
|
+
<h3 class="section-header">Files</h3>
|
84
|
+
<ul>
|
85
|
+
|
86
|
+
<li class="file"><a href="../Rakefile.html">Rakefile</a></li>
|
87
|
+
|
88
|
+
</ul>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
<div id="classindex-section" class="section project-section">
|
93
|
+
<h3 class="section-header">Class/Module Index
|
94
|
+
<span class="search-toggle"><img src="../images/find.png"
|
95
|
+
height="16" width="16" alt="[+]"
|
96
|
+
title="show/hide quicksearch" /></span></h3>
|
97
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
98
|
+
<fieldset>
|
99
|
+
<legend>Quicksearch</legend>
|
100
|
+
<input type="text" name="quicksearch" value=""
|
101
|
+
class="quicksearch-field" />
|
102
|
+
</fieldset>
|
103
|
+
</form>
|
104
|
+
|
105
|
+
<ul class="link-list">
|
106
|
+
|
107
|
+
<li><a href="../SQLConstructor.html">SQLConstructor</a></li>
|
108
|
+
|
109
|
+
<li><a href="../SQLConstructor/BasicDelete.html">SQLConstructor::BasicDelete</a></li>
|
110
|
+
|
111
|
+
<li><a href="../SQLConstructor/BasicDelete_mysql.html">SQLConstructor::BasicDelete_mysql</a></li>
|
112
|
+
|
113
|
+
<li><a href="../SQLConstructor/BasicInsert.html">SQLConstructor::BasicInsert</a></li>
|
114
|
+
|
115
|
+
<li><a href="../SQLConstructor/BasicInsert_mysql.html">SQLConstructor::BasicInsert_mysql</a></li>
|
116
|
+
|
117
|
+
<li><a href="../SQLConstructor/BasicJoin.html">SQLConstructor::BasicJoin</a></li>
|
118
|
+
|
119
|
+
<li><a href="../SQLConstructor/BasicJoin_mysql.html">SQLConstructor::BasicJoin_mysql</a></li>
|
120
|
+
|
121
|
+
<li><a href="../SQLConstructor/BasicSelect.html">SQLConstructor::BasicSelect</a></li>
|
122
|
+
|
123
|
+
<li><a href="../SQLConstructor/BasicSelect_example.html">SQLConstructor::BasicSelect_example</a></li>
|
124
|
+
|
125
|
+
<li><a href="../SQLConstructor/BasicSelect_mysql.html">SQLConstructor::BasicSelect_mysql</a></li>
|
126
|
+
|
127
|
+
<li><a href="../SQLConstructor/BasicUnion.html">SQLConstructor::BasicUnion</a></li>
|
128
|
+
|
129
|
+
<li><a href="../SQLConstructor/BasicUpdate.html">SQLConstructor::BasicUpdate</a></li>
|
130
|
+
|
131
|
+
<li><a href="../SQLConstructor/BasicUpdate_mysql.html">SQLConstructor::BasicUpdate_mysql</a></li>
|
132
|
+
|
133
|
+
<li><a href="../SQLConstructor/GenericQuery.html">SQLConstructor::GenericQuery</a></li>
|
134
|
+
|
135
|
+
<li><a href="../SQLConstructor/QAttr.html">SQLConstructor::QAttr</a></li>
|
136
|
+
|
137
|
+
<li><a href="../SQLExporter.html">SQLExporter</a></li>
|
138
|
+
|
139
|
+
<li><a href="../SQLExporter/Exporter_generic.html">SQLExporter::Exporter_generic</a></li>
|
140
|
+
|
141
|
+
<li><a href="../SQLExporter/Exporter_mysql.html">SQLExporter::Exporter_mysql</a></li>
|
142
|
+
|
143
|
+
<li><a href="../SQLConditional.html">SQLConditional</a></li>
|
144
|
+
|
145
|
+
<li><a href="../SQLConditional/BasicCond.html">SQLConditional::BasicCond</a></li>
|
146
|
+
|
147
|
+
<li><a href="../Object.html">Object</a></li>
|
148
|
+
|
149
|
+
<li><a href="../SQLAliasedList.html">SQLAliasedList</a></li>
|
150
|
+
|
151
|
+
<li><a href="../SQLColumn.html">SQLColumn</a></li>
|
152
|
+
|
153
|
+
<li><a href="../SQLCondList.html">SQLCondList</a></li>
|
154
|
+
|
155
|
+
<li><a href="../SQLConstructorTest.html">SQLConstructorTest</a></li>
|
156
|
+
|
157
|
+
<li><a href="../SQLObject.html">SQLObject</a></li>
|
158
|
+
|
159
|
+
<li><a href="../SQLValList.html">SQLValList</a></li>
|
160
|
+
|
161
|
+
<li><a href="../SQLValue.html">SQLValue</a></li>
|
162
|
+
|
163
|
+
</ul>
|
164
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
165
|
+
</div>
|
166
|
+
|
167
|
+
|
168
|
+
</div>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<div id="documentation">
|
172
|
+
<h1 class="class">SQLConditional::BasicCond</h1>
|
173
|
+
|
174
|
+
<div id="description" class="description">
|
175
|
+
|
176
|
+
<p>Internal class which represents a basic logical operation.</p>
|
177
|
+
|
178
|
+
</div><!-- description -->
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
<div id="5Buntitled-5D" class="documentation-section">
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
<!-- Constants -->
|
190
|
+
<div id="constants-list" class="section">
|
191
|
+
<h3 class="section-header">Constants</h3>
|
192
|
+
<dl>
|
193
|
+
|
194
|
+
<dt><a name="LHS">LHS</a></dt>
|
195
|
+
|
196
|
+
<dd class="description"></dd>
|
197
|
+
|
198
|
+
|
199
|
+
<dt><a name="MIDDLE">MIDDLE</a></dt>
|
200
|
+
|
201
|
+
<dd class="description"></dd>
|
202
|
+
|
203
|
+
|
204
|
+
<dt><a name="RHS">RHS</a></dt>
|
205
|
+
|
206
|
+
<dd class="description"></dd>
|
207
|
+
|
208
|
+
|
209
|
+
</dl>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
<!-- Methods -->
|
216
|
+
|
217
|
+
<div id="public-class-method-details" class="method-section section">
|
218
|
+
<h3 class="section-header">Public Class Methods</h3>
|
219
|
+
|
220
|
+
|
221
|
+
<div id="new-method" class="method-detail ">
|
222
|
+
<a name="method-c-new"></a>
|
223
|
+
|
224
|
+
|
225
|
+
<div class="method-heading">
|
226
|
+
<span class="method-name">new</span><span
|
227
|
+
class="method-args">( operator, type, *objects )</span>
|
228
|
+
<span class="method-click-advice">click to toggle source</span>
|
229
|
+
</div>
|
230
|
+
|
231
|
+
|
232
|
+
<div class="method-description">
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
<div class="method-source-code" id="new-source">
|
239
|
+
<pre>
|
240
|
+
<span class="ruby-comment"># File lib/sqlconditional.rb, line 168</span>
|
241
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span> ( <span class="ruby-identifier">operator</span>, <span class="ruby-identifier">type</span>, *<span class="ruby-identifier">objects</span> )
|
242
|
+
<span class="ruby-ivar">@operator</span>, <span class="ruby-ivar">@type</span>, <span class="ruby-ivar">@objects</span> = <span class="ruby-identifier">operator</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">type</span>, <span class="ruby-identifier">objects</span>
|
243
|
+
<span class="ruby-ivar">@string</span> = <span class="ruby-keyword">nil</span>
|
244
|
+
<span class="ruby-keyword">end</span></pre>
|
245
|
+
</div><!-- new-source -->
|
246
|
+
|
247
|
+
</div>
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
</div><!-- new-method -->
|
253
|
+
|
254
|
+
|
255
|
+
</div><!-- public-class-method-details -->
|
256
|
+
|
257
|
+
<div id="public-instance-method-details" class="method-section section">
|
258
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
259
|
+
|
260
|
+
|
261
|
+
<div id="to_s-method" class="method-detail ">
|
262
|
+
<a name="method-i-to_s"></a>
|
263
|
+
|
264
|
+
|
265
|
+
<div class="method-heading">
|
266
|
+
<span class="method-name">to_s</span><span
|
267
|
+
class="method-args">()</span>
|
268
|
+
<span class="method-click-advice">click to toggle source</span>
|
269
|
+
</div>
|
270
|
+
|
271
|
+
|
272
|
+
<div class="method-description">
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
<div class="method-source-code" id="to_s-source">
|
279
|
+
<pre>
|
280
|
+
<span class="ruby-comment"># File lib/sqlconditional.rb, line 173</span>
|
281
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
|
282
|
+
<span class="ruby-keyword">return</span> <span class="ruby-ivar">@string</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@string</span>
|
283
|
+
<span class="ruby-ivar">@string</span> = <span class="ruby-string">" "</span>
|
284
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@objects</span>.<span class="ruby-identifier">empty?</span>
|
285
|
+
<span class="ruby-ivar">@string</span> <span class="ruby-operator">+=</span> <span class="ruby-string">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@operator</span> <span class="ruby-operator">+</span> <span class="ruby-string">" "</span>
|
286
|
+
<span class="ruby-keyword">else</span>
|
287
|
+
<span class="ruby-keyword">case</span> <span class="ruby-ivar">@type</span>
|
288
|
+
<span class="ruby-keyword">when</span> <span class="ruby-constant">LHS</span>
|
289
|
+
<span class="ruby-ivar">@string</span> = <span class="ruby-ivar">@operator</span> <span class="ruby-operator">+</span> <span class="ruby-string">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@objects</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_s</span>
|
290
|
+
<span class="ruby-keyword">when</span> <span class="ruby-constant">RHS</span>
|
291
|
+
<span class="ruby-ivar">@string</span> = <span class="ruby-ivar">@objects</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@operator</span>
|
292
|
+
<span class="ruby-keyword">when</span> <span class="ruby-constant">MIDDLE</span>
|
293
|
+
<span class="ruby-ivar">@string</span> = <span class="ruby-ivar">@objects</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> <span class="ruby-string">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@operator</span> <span class="ruby-operator">+</span> <span class="ruby-string">" "</span>
|
294
|
+
<span class="ruby-operator">:</span> <span class="ruby-ivar">@objects</span>.<span class="ruby-identifier">join</span>( <span class="ruby-string">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@operator</span> <span class="ruby-operator">+</span> <span class="ruby-string">" "</span> )
|
295
|
+
<span class="ruby-keyword">else</span>
|
296
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>, <span class="ruby-constant">ERR_UNKNOWN_OPERATOR_TYPE</span>
|
297
|
+
<span class="ruby-keyword">end</span>
|
298
|
+
<span class="ruby-keyword">end</span>
|
299
|
+
<span class="ruby-keyword">end</span></pre>
|
300
|
+
</div><!-- to_s-source -->
|
301
|
+
|
302
|
+
</div>
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
</div><!-- to_s-method -->
|
308
|
+
|
309
|
+
|
310
|
+
</div><!-- public-instance-method-details -->
|
311
|
+
|
312
|
+
</div><!-- 5Buntitled-5D -->
|
313
|
+
|
314
|
+
|
315
|
+
</div><!-- documentation -->
|
316
|
+
|
317
|
+
<div id="validator-badges">
|
318
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
319
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
320
|
+
Rdoc Generator</a> 2</small>.</p>
|
321
|
+
</div>
|
322
|
+
|
323
|
+
</body>
|
324
|
+
</html>
|
325
|
+
|
@@ -0,0 +1,763 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Class: SQLConstructor</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
<script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
+
<script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
+
<script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body id="top" class="class">
|
19
|
+
|
20
|
+
<div id="metadata">
|
21
|
+
<div id="home-metadata">
|
22
|
+
<div id="home-section" class="section">
|
23
|
+
<h3 class="section-header">
|
24
|
+
<a href="./index.html">Home</a>
|
25
|
+
<a href="./index.html#classes">Classes</a>
|
26
|
+
<a href="./index.html#methods">Methods</a>
|
27
|
+
</h3>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div id="file-metadata">
|
32
|
+
<div id="file-list-section" class="section">
|
33
|
+
<h3 class="section-header">In Files</h3>
|
34
|
+
<div class="section-body">
|
35
|
+
<ul>
|
36
|
+
|
37
|
+
<li><a href="./lib/sqlconstructor_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
+
class="thickbox" title="lib/sqlconstructor.rb">lib/sqlconstructor.rb</a></li>
|
39
|
+
|
40
|
+
</ul>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div id="class-metadata">
|
48
|
+
|
49
|
+
<!-- Parent Class -->
|
50
|
+
<div id="parent-class-section" class="section">
|
51
|
+
<h3 class="section-header">Parent</h3>
|
52
|
+
|
53
|
+
<p class="link"><a href="SQLObject.html">SQLObject</a></p>
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
<!-- Namespace Contents -->
|
62
|
+
<div id="namespace-list-section" class="section">
|
63
|
+
<h3 class="section-header">Namespace</h3>
|
64
|
+
<ul class="link-list">
|
65
|
+
|
66
|
+
<li><span class="type">CLASS</span> <a href="SQLConstructor/BasicDelete.html">SQLConstructor::BasicDelete</a></li>
|
67
|
+
|
68
|
+
<li><span class="type">CLASS</span> <a href="SQLConstructor/BasicDelete_mysql.html">SQLConstructor::BasicDelete_mysql</a></li>
|
69
|
+
|
70
|
+
<li><span class="type">CLASS</span> <a href="SQLConstructor/BasicInsert.html">SQLConstructor::BasicInsert</a></li>
|
71
|
+
|
72
|
+
<li><span class="type">CLASS</span> <a href="SQLConstructor/BasicInsert_mysql.html">SQLConstructor::BasicInsert_mysql</a></li>
|
73
|
+
|
74
|
+
<li><span class="type">CLASS</span> <a href="SQLConstructor/BasicJoin.html">SQLConstructor::BasicJoin</a></li>
|
75
|
+
|
76
|
+
<li><span class="type">CLASS</span> <a href="SQLConstructor/BasicJoin_mysql.html">SQLConstructor::BasicJoin_mysql</a></li>
|
77
|
+
|
78
|
+
<li><span class="type">CLASS</span> <a href="SQLConstructor/BasicSelect.html">SQLConstructor::BasicSelect</a></li>
|
79
|
+
|
80
|
+
<li><span class="type">CLASS</span> <a href="SQLConstructor/BasicSelect_example.html">SQLConstructor::BasicSelect_example</a></li>
|
81
|
+
|
82
|
+
<li><span class="type">CLASS</span> <a href="SQLConstructor/BasicSelect_mysql.html">SQLConstructor::BasicSelect_mysql</a></li>
|
83
|
+
|
84
|
+
<li><span class="type">CLASS</span> <a href="SQLConstructor/BasicUnion.html">SQLConstructor::BasicUnion</a></li>
|
85
|
+
|
86
|
+
<li><span class="type">CLASS</span> <a href="SQLConstructor/BasicUpdate.html">SQLConstructor::BasicUpdate</a></li>
|
87
|
+
|
88
|
+
<li><span class="type">CLASS</span> <a href="SQLConstructor/BasicUpdate_mysql.html">SQLConstructor::BasicUpdate_mysql</a></li>
|
89
|
+
|
90
|
+
<li><span class="type">CLASS</span> <a href="SQLConstructor/GenericQuery.html">SQLConstructor::GenericQuery</a></li>
|
91
|
+
|
92
|
+
<li><span class="type">CLASS</span> <a href="SQLConstructor/QAttr.html">SQLConstructor::QAttr</a></li>
|
93
|
+
|
94
|
+
</ul>
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
<!-- Method Quickref -->
|
100
|
+
<div id="method-list-section" class="section">
|
101
|
+
<h3 class="section-header">Methods</h3>
|
102
|
+
<ul class="link-list">
|
103
|
+
|
104
|
+
<li><a href="#method-c-new">::new</a></li>
|
105
|
+
|
106
|
+
<li><a href="#method-i-_getGenericQuery">#_getGenericQuery</a></li>
|
107
|
+
|
108
|
+
<li><a href="#method-i-delete">#delete</a></li>
|
109
|
+
|
110
|
+
<li><a href="#method-i-insert">#insert</a></li>
|
111
|
+
|
112
|
+
<li><a href="#method-i-method_missing">#method_missing</a></li>
|
113
|
+
|
114
|
+
<li><a href="#method-i-select">#select</a></li>
|
115
|
+
|
116
|
+
<li><a href="#method-i-to_s">#to_s</a></li>
|
117
|
+
|
118
|
+
<li><a href="#method-i-to_str">#to_str</a></li>
|
119
|
+
|
120
|
+
<li><a href="#method-i-update">#update</a></li>
|
121
|
+
|
122
|
+
</ul>
|
123
|
+
</div>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
</div>
|
128
|
+
|
129
|
+
<div id="project-metadata">
|
130
|
+
|
131
|
+
|
132
|
+
<div id="fileindex-section" class="section project-section">
|
133
|
+
<h3 class="section-header">Files</h3>
|
134
|
+
<ul>
|
135
|
+
|
136
|
+
<li class="file"><a href="./Rakefile.html">Rakefile</a></li>
|
137
|
+
|
138
|
+
</ul>
|
139
|
+
</div>
|
140
|
+
|
141
|
+
|
142
|
+
<div id="classindex-section" class="section project-section">
|
143
|
+
<h3 class="section-header">Class/Module Index
|
144
|
+
<span class="search-toggle"><img src="./images/find.png"
|
145
|
+
height="16" width="16" alt="[+]"
|
146
|
+
title="show/hide quicksearch" /></span></h3>
|
147
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
148
|
+
<fieldset>
|
149
|
+
<legend>Quicksearch</legend>
|
150
|
+
<input type="text" name="quicksearch" value=""
|
151
|
+
class="quicksearch-field" />
|
152
|
+
</fieldset>
|
153
|
+
</form>
|
154
|
+
|
155
|
+
<ul class="link-list">
|
156
|
+
|
157
|
+
<li><a href="./SQLConstructor.html">SQLConstructor</a></li>
|
158
|
+
|
159
|
+
<li><a href="./SQLConstructor/BasicDelete.html">SQLConstructor::BasicDelete</a></li>
|
160
|
+
|
161
|
+
<li><a href="./SQLConstructor/BasicDelete_mysql.html">SQLConstructor::BasicDelete_mysql</a></li>
|
162
|
+
|
163
|
+
<li><a href="./SQLConstructor/BasicInsert.html">SQLConstructor::BasicInsert</a></li>
|
164
|
+
|
165
|
+
<li><a href="./SQLConstructor/BasicInsert_mysql.html">SQLConstructor::BasicInsert_mysql</a></li>
|
166
|
+
|
167
|
+
<li><a href="./SQLConstructor/BasicJoin.html">SQLConstructor::BasicJoin</a></li>
|
168
|
+
|
169
|
+
<li><a href="./SQLConstructor/BasicJoin_mysql.html">SQLConstructor::BasicJoin_mysql</a></li>
|
170
|
+
|
171
|
+
<li><a href="./SQLConstructor/BasicSelect.html">SQLConstructor::BasicSelect</a></li>
|
172
|
+
|
173
|
+
<li><a href="./SQLConstructor/BasicSelect_example.html">SQLConstructor::BasicSelect_example</a></li>
|
174
|
+
|
175
|
+
<li><a href="./SQLConstructor/BasicSelect_mysql.html">SQLConstructor::BasicSelect_mysql</a></li>
|
176
|
+
|
177
|
+
<li><a href="./SQLConstructor/BasicUnion.html">SQLConstructor::BasicUnion</a></li>
|
178
|
+
|
179
|
+
<li><a href="./SQLConstructor/BasicUpdate.html">SQLConstructor::BasicUpdate</a></li>
|
180
|
+
|
181
|
+
<li><a href="./SQLConstructor/BasicUpdate_mysql.html">SQLConstructor::BasicUpdate_mysql</a></li>
|
182
|
+
|
183
|
+
<li><a href="./SQLConstructor/GenericQuery.html">SQLConstructor::GenericQuery</a></li>
|
184
|
+
|
185
|
+
<li><a href="./SQLConstructor/QAttr.html">SQLConstructor::QAttr</a></li>
|
186
|
+
|
187
|
+
<li><a href="./SQLExporter.html">SQLExporter</a></li>
|
188
|
+
|
189
|
+
<li><a href="./SQLExporter/Exporter_generic.html">SQLExporter::Exporter_generic</a></li>
|
190
|
+
|
191
|
+
<li><a href="./SQLExporter/Exporter_mysql.html">SQLExporter::Exporter_mysql</a></li>
|
192
|
+
|
193
|
+
<li><a href="./SQLConditional.html">SQLConditional</a></li>
|
194
|
+
|
195
|
+
<li><a href="./SQLConditional/BasicCond.html">SQLConditional::BasicCond</a></li>
|
196
|
+
|
197
|
+
<li><a href="./Object.html">Object</a></li>
|
198
|
+
|
199
|
+
<li><a href="./SQLAliasedList.html">SQLAliasedList</a></li>
|
200
|
+
|
201
|
+
<li><a href="./SQLColumn.html">SQLColumn</a></li>
|
202
|
+
|
203
|
+
<li><a href="./SQLCondList.html">SQLCondList</a></li>
|
204
|
+
|
205
|
+
<li><a href="./SQLConstructorTest.html">SQLConstructorTest</a></li>
|
206
|
+
|
207
|
+
<li><a href="./SQLObject.html">SQLObject</a></li>
|
208
|
+
|
209
|
+
<li><a href="./SQLValList.html">SQLValList</a></li>
|
210
|
+
|
211
|
+
<li><a href="./SQLValue.html">SQLValue</a></li>
|
212
|
+
|
213
|
+
</ul>
|
214
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
<div id="documentation">
|
222
|
+
<h1 class="class">SQLConstructor</h1>
|
223
|
+
|
224
|
+
<div id="description" class="description">
|
225
|
+
<table class="rdoc-list"><tr><td class="rdoc-term"><p>Author</p></td>
|
226
|
+
<td>
|
227
|
+
<p>Vasiliy Korol (<a href="mailto:vakorol@mail.ru">vakorol@mail.ru</a>)</p>
|
228
|
+
</td></tr><tr><td class="rdoc-term"><p>Copyright</p></td>
|
229
|
+
<td>
|
230
|
+
<p>Vasiliy Korol © 2014</p>
|
231
|
+
</td></tr><tr><td class="rdoc-term"><p>License</p></td>
|
232
|
+
<td>
|
233
|
+
<p>Distributes under terms of GPLv2</p>
|
234
|
+
</td></tr></table>
|
235
|
+
|
236
|
+
<p>This class implements methods to construct a valid SQL query. SQL SELECT,
|
237
|
+
DELETE, UPDATE and INSERT clauses are supported.</p>
|
238
|
+
|
239
|
+
<p>There’s also an experimental implementation of MySQL index hints.</p>
|
240
|
+
|
241
|
+
<p>Column values and other data that should be escaped is passed to the
|
242
|
+
methods as strings. Column and table names, aliases and everything that
|
243
|
+
goes unescaped is passed as symbols.</p>
|
244
|
+
|
245
|
+
<h3>Typical usage:</h3>
|
246
|
+
|
247
|
+
<pre>sql = SQLConstructor.new
|
248
|
+
sql.select( :col1, :col2 ).from( :table ).where.eq( :col3, 16 ).and.lt( :col4, 5 )
|
249
|
+
p sql</pre>
|
250
|
+
|
251
|
+
<p>will result in:</p>
|
252
|
+
|
253
|
+
<pre>SELECT col1,col2 FROM table WHERE (col3 = 16 AND col4 < 5)</pre>
|
254
|
+
|
255
|
+
<p>One can also construct complex queries like:</p>
|
256
|
+
|
257
|
+
<pre>sql = SQLConstructor.new( :tidy => true, :dialect => 'mysql' )
|
258
|
+
inner_select1 = SQLConstructor.new( :tidy => true )
|
259
|
+
inner_select1.select( :"MAX(h.item_id)" ).from( :item_data => :d ).
|
260
|
+
inner_join( :call_data => :h ).on.eq( :"d.item_nm", :call_ref ).where.
|
261
|
+
eq( :"d.item_num", :"g.item_num" ).group_by( :"h.venue_nm" ).having.eq( :"COUNT(*)", 1 )
|
262
|
+
inner_select2 = SQLConstructor.new( :dialect => 'mysql', :tidy => true )
|
263
|
+
inner_select2.select( :"d.item_num" ).from( :item_data => :d ).
|
264
|
+
inner_join( :call_data => :h ).on.eq( :"d.item_nm", :call_ref ).
|
265
|
+
group_by( :"h.venue_nm" ).having.eq( :"COUNT(*)", 1 )
|
266
|
+
sql.update( :guest => :g ).set( :link_id => inner_select1).
|
267
|
+
where.in( :"g.item_num", inner_select2 )
|
268
|
+
p sql</pre>
|
269
|
+
|
270
|
+
<p>It will produce:</p>
|
271
|
+
|
272
|
+
<pre>UPDATE
|
273
|
+
guest g
|
274
|
+
SET link_id=
|
275
|
+
(SELECT
|
276
|
+
MAX(h.item_id)
|
277
|
+
FROM item_data d
|
278
|
+
INNER JOIN call_data h
|
279
|
+
ON
|
280
|
+
(d.item_nm = call_ref)
|
281
|
+
WHERE
|
282
|
+
(d.item_num = g.item_num)
|
283
|
+
GROUP BY h.venue_nm
|
284
|
+
HAVING
|
285
|
+
(COUNT(*) = 1)
|
286
|
+
)
|
287
|
+
WHERE
|
288
|
+
(g.item_num IN
|
289
|
+
(SELECT
|
290
|
+
d.item_num
|
291
|
+
FROM item_data d
|
292
|
+
INNER JOIN call_data h
|
293
|
+
ON
|
294
|
+
(d.item_nm = call_ref)
|
295
|
+
GROUP BY h.venue_nm
|
296
|
+
HAVING
|
297
|
+
(COUNT(*) = 1)
|
298
|
+
))</pre>
|
299
|
+
|
300
|
+
<p>Queries can be modified “on the fly”, which can be useful for dynamic
|
301
|
+
construction:</p>
|
302
|
+
|
303
|
+
<pre>sql.delete.from( :datas ).where.ne( :x, "SOME TEXT" ).order_by( :y )
|
304
|
+
p sql
|
305
|
+
|
306
|
+
DELETE
|
307
|
+
FROM datas
|
308
|
+
WHERE
|
309
|
+
(x != 'SOME TEXT')
|
310
|
+
ORDER BY y
|
311
|
+
|
312
|
+
sql._remove( :order_by )
|
313
|
+
sql._get( :from ).push( :dataf )
|
314
|
+
p sql
|
315
|
+
|
316
|
+
DELETE
|
317
|
+
FROM datas,dataf
|
318
|
+
WHERE
|
319
|
+
(x != 'SOME TEXT')</pre>
|
320
|
+
|
321
|
+
</div><!-- description -->
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
<div id="5Buntitled-5D" class="documentation-section">
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
<!-- Attributes -->
|
335
|
+
<div id="attribute-method-details" class="method-section section">
|
336
|
+
<h3 class="section-header">Attributes</h3>
|
337
|
+
|
338
|
+
|
339
|
+
<div id="dialect-attribute-method" class="method-detail">
|
340
|
+
<a name="dialect"></a>
|
341
|
+
|
342
|
+
<div class="method-heading attribute-method-heading">
|
343
|
+
<span class="method-name">dialect</span><span
|
344
|
+
class="attribute-access-type">[R]</span>
|
345
|
+
</div>
|
346
|
+
|
347
|
+
<div class="method-description">
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
</div>
|
352
|
+
</div>
|
353
|
+
|
354
|
+
<div id="exporter-attribute-method" class="method-detail">
|
355
|
+
<a name="exporter"></a>
|
356
|
+
|
357
|
+
<a name="exporter="></a>
|
358
|
+
|
359
|
+
<div class="method-heading attribute-method-heading">
|
360
|
+
<span class="method-name">exporter</span><span
|
361
|
+
class="attribute-access-type">[RW]</span>
|
362
|
+
</div>
|
363
|
+
|
364
|
+
<div class="method-description">
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
</div>
|
369
|
+
</div>
|
370
|
+
|
371
|
+
<div id="obj-attribute-method" class="method-detail">
|
372
|
+
<a name="obj"></a>
|
373
|
+
|
374
|
+
<div class="method-heading attribute-method-heading">
|
375
|
+
<span class="method-name">obj</span><span
|
376
|
+
class="attribute-access-type">[R]</span>
|
377
|
+
</div>
|
378
|
+
|
379
|
+
<div class="method-description">
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
</div>
|
384
|
+
</div>
|
385
|
+
|
386
|
+
<div id="tidy-attribute-method" class="method-detail">
|
387
|
+
<a name="tidy"></a>
|
388
|
+
|
389
|
+
<a name="tidy="></a>
|
390
|
+
|
391
|
+
<div class="method-heading attribute-method-heading">
|
392
|
+
<span class="method-name">tidy</span><span
|
393
|
+
class="attribute-access-type">[RW]</span>
|
394
|
+
</div>
|
395
|
+
|
396
|
+
<div class="method-description">
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
</div>
|
401
|
+
</div>
|
402
|
+
|
403
|
+
</div><!-- attribute-method-details -->
|
404
|
+
|
405
|
+
|
406
|
+
<!-- Methods -->
|
407
|
+
|
408
|
+
<div id="public-class-method-details" class="method-section section">
|
409
|
+
<h3 class="section-header">Public Class Methods</h3>
|
410
|
+
|
411
|
+
|
412
|
+
<div id="new-method" class="method-detail ">
|
413
|
+
<a name="method-c-new"></a>
|
414
|
+
|
415
|
+
|
416
|
+
<div class="method-heading">
|
417
|
+
<span class="method-name">new</span><span
|
418
|
+
class="method-args">( params = nil )</span>
|
419
|
+
<span class="method-click-advice">click to toggle source</span>
|
420
|
+
</div>
|
421
|
+
|
422
|
+
|
423
|
+
<div class="method-description">
|
424
|
+
|
425
|
+
<p>Class constructor. Accepts an optional argument with a hash of parameters
|
426
|
+
:dialect and :tidy to set the <a href="SQLExporter.html">SQLExporter</a>
|
427
|
+
object in @exporter, or :exporter to receive a predefined <a
|
428
|
+
href="SQLExporter.html">SQLExporter</a> object.</p>
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
<div class="method-source-code" id="new-source">
|
433
|
+
<pre>
|
434
|
+
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 108</span>
|
435
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span> ( <span class="ruby-identifier">params</span> = <span class="ruby-keyword">nil</span> )
|
436
|
+
<span class="ruby-ivar">@dialect</span>, <span class="ruby-ivar">@string</span>, <span class="ruby-ivar">@obj</span>, <span class="ruby-ivar">@tidy</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-keyword">false</span>
|
437
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
|
438
|
+
<span class="ruby-ivar">@dialect</span> = <span class="ruby-identifier">params</span>[ <span class="ruby-value">:dialect</span> ]
|
439
|
+
<span class="ruby-ivar">@tidy</span> = <span class="ruby-identifier">params</span>[ <span class="ruby-value">:tidy</span> ]
|
440
|
+
<span class="ruby-ivar">@exporter</span> = <span class="ruby-identifier">params</span>[ <span class="ruby-value">:exporter</span> ]
|
441
|
+
<span class="ruby-keyword">end</span>
|
442
|
+
<span class="ruby-ivar">@exporter</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">SQLExporter</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@dialect</span>, <span class="ruby-ivar">@tidy</span>
|
443
|
+
<span class="ruby-ivar">@dialect</span> = <span class="ruby-ivar">@exporter</span>.<span class="ruby-identifier">dialect</span>
|
444
|
+
<span class="ruby-keyword">end</span></pre>
|
445
|
+
</div><!-- new-source -->
|
446
|
+
|
447
|
+
</div>
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
</div><!-- new-method -->
|
453
|
+
|
454
|
+
|
455
|
+
</div><!-- public-class-method-details -->
|
456
|
+
|
457
|
+
<div id="public-instance-method-details" class="method-section section">
|
458
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
459
|
+
|
460
|
+
|
461
|
+
<div id="delete-method" class="method-detail ">
|
462
|
+
<a name="method-i-delete"></a>
|
463
|
+
|
464
|
+
|
465
|
+
<div class="method-heading">
|
466
|
+
<span class="method-name">delete</span><span
|
467
|
+
class="method-args">()</span>
|
468
|
+
<span class="method-click-advice">click to toggle source</span>
|
469
|
+
</div>
|
470
|
+
|
471
|
+
|
472
|
+
<div class="method-description">
|
473
|
+
|
474
|
+
<p>Add a DELETE statement. Returns an instance of <a
|
475
|
+
href="http://%dialect%">BasicDelete_</a> class.</p>
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
<div class="method-source-code" id="delete-source">
|
480
|
+
<pre>
|
481
|
+
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 131</span>
|
482
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">delete</span>
|
483
|
+
<span class="ruby-identifier">_getGenericQuery</span> <span class="ruby-string">'delete'</span>
|
484
|
+
<span class="ruby-keyword">end</span></pre>
|
485
|
+
</div><!-- delete-source -->
|
486
|
+
|
487
|
+
</div>
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
</div><!-- delete-method -->
|
493
|
+
|
494
|
+
|
495
|
+
<div id="insert-method" class="method-detail ">
|
496
|
+
<a name="method-i-insert"></a>
|
497
|
+
|
498
|
+
|
499
|
+
<div class="method-heading">
|
500
|
+
<span class="method-name">insert</span><span
|
501
|
+
class="method-args">()</span>
|
502
|
+
<span class="method-click-advice">click to toggle source</span>
|
503
|
+
</div>
|
504
|
+
|
505
|
+
|
506
|
+
<div class="method-description">
|
507
|
+
|
508
|
+
<p>Add a INSERT statement Returns an instance of <a
|
509
|
+
href="http://%dialect%">BasicInsert_</a> class.</p>
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
<div class="method-source-code" id="insert-source">
|
514
|
+
<pre>
|
515
|
+
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 139</span>
|
516
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">insert</span>
|
517
|
+
<span class="ruby-identifier">_getGenericQuery</span> <span class="ruby-string">'insert'</span>
|
518
|
+
<span class="ruby-keyword">end</span></pre>
|
519
|
+
</div><!-- insert-source -->
|
520
|
+
|
521
|
+
</div>
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
</div><!-- insert-method -->
|
527
|
+
|
528
|
+
|
529
|
+
<div id="method_missing-method" class="method-detail ">
|
530
|
+
<a name="method-i-method_missing"></a>
|
531
|
+
|
532
|
+
|
533
|
+
<div class="method-heading">
|
534
|
+
<span class="method-name">method_missing</span><span
|
535
|
+
class="method-args">( method, *args )</span>
|
536
|
+
<span class="method-click-advice">click to toggle source</span>
|
537
|
+
</div>
|
538
|
+
|
539
|
+
|
540
|
+
<div class="method-description">
|
541
|
+
|
542
|
+
<p>Pass all unknown methods to @obj or throw an exception if the call already
|
543
|
+
originated from @obj.</p>
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
<div class="method-source-code" id="method_missing-source">
|
548
|
+
<pre>
|
549
|
+
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 165</span>
|
550
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">method_missing</span> ( <span class="ruby-identifier">method</span>, *<span class="ruby-identifier">args</span> )
|
551
|
+
<span class="ruby-keyword">return</span> <span class="ruby-ivar">@obj</span>.<span class="ruby-identifier">send</span>( <span class="ruby-identifier">method</span>, *<span class="ruby-identifier">args</span> ) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@obj</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@obj</span>.<span class="ruby-identifier">child_caller</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@obj</span>
|
552
|
+
<span class="ruby-comment"># raise an exception if the call is "bouncing" between self and @obj</span>
|
553
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">NoMethodError</span>, <span class="ruby-constant">ERR_UNKNOWN_METHOD</span> <span class="ruby-operator">+</span>
|
554
|
+
<span class="ruby-node">": '#{method.to_s}' from #{@obj.class.name}"</span>
|
555
|
+
<span class="ruby-keyword">end</span></pre>
|
556
|
+
</div><!-- method_missing-source -->
|
557
|
+
|
558
|
+
</div>
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
</div><!-- method_missing-method -->
|
564
|
+
|
565
|
+
|
566
|
+
<div id="select-method" class="method-detail ">
|
567
|
+
<a name="method-i-select"></a>
|
568
|
+
|
569
|
+
|
570
|
+
<div class="method-heading">
|
571
|
+
<span class="method-name">select</span><span
|
572
|
+
class="method-args">( *cols )</span>
|
573
|
+
<span class="method-click-advice">click to toggle source</span>
|
574
|
+
</div>
|
575
|
+
|
576
|
+
|
577
|
+
<div class="method-description">
|
578
|
+
|
579
|
+
<p>Add a SELECT statement with columns specified by *cols. Returns an instance
|
580
|
+
of <a href="http://%dialect%">BasicSelect_</a> class.</p>
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
<div class="method-source-code" id="select-source">
|
585
|
+
<pre>
|
586
|
+
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 123</span>
|
587
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">select</span> ( *<span class="ruby-identifier">cols</span> )
|
588
|
+
<span class="ruby-identifier">_getGenericQuery</span> <span class="ruby-string">'select'</span>, *<span class="ruby-identifier">cols</span>
|
589
|
+
<span class="ruby-keyword">end</span></pre>
|
590
|
+
</div><!-- select-source -->
|
591
|
+
|
592
|
+
</div>
|
593
|
+
|
594
|
+
|
595
|
+
|
596
|
+
|
597
|
+
</div><!-- select-method -->
|
598
|
+
|
599
|
+
|
600
|
+
<div id="to_s-method" class="method-detail ">
|
601
|
+
<a name="method-i-to_s"></a>
|
602
|
+
|
603
|
+
|
604
|
+
<div class="method-heading">
|
605
|
+
<span class="method-name">to_s</span><span
|
606
|
+
class="method-args">()</span>
|
607
|
+
<span class="method-click-advice">click to toggle source</span>
|
608
|
+
</div>
|
609
|
+
|
610
|
+
|
611
|
+
<div class="method-description">
|
612
|
+
|
613
|
+
<p>Convert object to string by calling the .export() method of the @exporter
|
614
|
+
object.</p>
|
615
|
+
|
616
|
+
|
617
|
+
|
618
|
+
<div class="method-source-code" id="to_s-source">
|
619
|
+
<pre>
|
620
|
+
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 155</span>
|
621
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
|
622
|
+
<span class="ruby-comment"># return @string if @string</span>
|
623
|
+
<span class="ruby-ivar">@obj</span>.<span class="ruby-identifier">inline</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">inline</span>
|
624
|
+
<span class="ruby-ivar">@string</span> = <span class="ruby-ivar">@exporter</span>.<span class="ruby-identifier">export</span> <span class="ruby-ivar">@obj</span>
|
625
|
+
<span class="ruby-keyword">end</span></pre>
|
626
|
+
</div><!-- to_s-source -->
|
627
|
+
|
628
|
+
</div>
|
629
|
+
|
630
|
+
|
631
|
+
<div class="aliases">
|
632
|
+
Also aliased as: <a href="SQLConstructor.html#method-i-to_str">to_str</a>
|
633
|
+
</div>
|
634
|
+
|
635
|
+
|
636
|
+
|
637
|
+
</div><!-- to_s-method -->
|
638
|
+
|
639
|
+
|
640
|
+
<div id="to_str-method" class="method-detail method-alias">
|
641
|
+
<a name="method-i-to_str"></a>
|
642
|
+
|
643
|
+
|
644
|
+
<div class="method-heading">
|
645
|
+
<span class="method-name">to_str</span><span
|
646
|
+
class="method-args">()</span>
|
647
|
+
<span class="method-click-advice">click to toggle source</span>
|
648
|
+
</div>
|
649
|
+
|
650
|
+
|
651
|
+
<div class="method-description">
|
652
|
+
|
653
|
+
<p>Dirty hack to make .join work on an array of SQLConstructors</p>
|
654
|
+
|
655
|
+
|
656
|
+
|
657
|
+
</div>
|
658
|
+
|
659
|
+
|
660
|
+
|
661
|
+
|
662
|
+
<div class="aliases">
|
663
|
+
Alias for: <a href="SQLConstructor.html#method-i-to_s">to_s</a>
|
664
|
+
</div>
|
665
|
+
|
666
|
+
</div><!-- to_str-method -->
|
667
|
+
|
668
|
+
|
669
|
+
<div id="update-method" class="method-detail ">
|
670
|
+
<a name="method-i-update"></a>
|
671
|
+
|
672
|
+
|
673
|
+
<div class="method-heading">
|
674
|
+
<span class="method-name">update</span><span
|
675
|
+
class="method-args">( *tabs )</span>
|
676
|
+
<span class="method-click-advice">click to toggle source</span>
|
677
|
+
</div>
|
678
|
+
|
679
|
+
|
680
|
+
<div class="method-description">
|
681
|
+
|
682
|
+
<p>Add a UPDATE statement Returns an instance of <a
|
683
|
+
href="http://%dialect%">BasicUpdate_</a> class.</p>
|
684
|
+
|
685
|
+
|
686
|
+
|
687
|
+
<div class="method-source-code" id="update-source">
|
688
|
+
<pre>
|
689
|
+
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 147</span>
|
690
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">update</span> ( *<span class="ruby-identifier">tabs</span> )
|
691
|
+
<span class="ruby-identifier">_getGenericQuery</span> <span class="ruby-string">'update'</span>, *<span class="ruby-identifier">tabs</span>
|
692
|
+
<span class="ruby-keyword">end</span></pre>
|
693
|
+
</div><!-- update-source -->
|
694
|
+
|
695
|
+
</div>
|
696
|
+
|
697
|
+
|
698
|
+
|
699
|
+
|
700
|
+
</div><!-- update-method -->
|
701
|
+
|
702
|
+
|
703
|
+
</div><!-- public-instance-method-details -->
|
704
|
+
|
705
|
+
<div id="private-instance-method-details" class="method-section section">
|
706
|
+
<h3 class="section-header">Private Instance Methods</h3>
|
707
|
+
|
708
|
+
|
709
|
+
<div id="_getGenericQuery-method" class="method-detail ">
|
710
|
+
<a name="method-i-_getGenericQuery"></a>
|
711
|
+
|
712
|
+
|
713
|
+
<div class="method-heading">
|
714
|
+
<span class="method-name">_getGenericQuery</span><span
|
715
|
+
class="method-args">( type, *args )</span>
|
716
|
+
<span class="method-click-advice">click to toggle source</span>
|
717
|
+
</div>
|
718
|
+
|
719
|
+
|
720
|
+
<div class="method-description">
|
721
|
+
|
722
|
+
<p>Returns an instance of Basic* child dialect-specific class</p>
|
723
|
+
|
724
|
+
|
725
|
+
|
726
|
+
<div class="method-source-code" id="_getGenericQuery-source">
|
727
|
+
<pre>
|
728
|
+
<span class="ruby-comment"># File lib/sqlconstructor.rb, line 180</span>
|
729
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">_getGenericQuery</span> ( <span class="ruby-identifier">type</span>, *<span class="ruby-identifier">args</span> )
|
730
|
+
<span class="ruby-identifier">class_basic</span> = <span class="ruby-string">'Basic'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">capitalize</span>
|
731
|
+
<span class="ruby-identifier">class_child</span> = <span class="ruby-identifier">class_basic</span> <span class="ruby-operator">+</span> <span class="ruby-string">'_'</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@dialect</span>
|
732
|
+
<span class="ruby-keyword">begin</span>
|
733
|
+
<span class="ruby-ivar">@obj</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">const_get</span>( <span class="ruby-identifier">class_child</span> ).<span class="ruby-identifier">new</span> <span class="ruby-keyword">self</span>, *<span class="ruby-identifier">args</span>
|
734
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">NameError</span>
|
735
|
+
<span class="ruby-ivar">@obj</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">const_get</span>( <span class="ruby-identifier">class_basic</span> ).<span class="ruby-identifier">new</span> <span class="ruby-keyword">self</span>, *<span class="ruby-identifier">args</span>
|
736
|
+
<span class="ruby-keyword">end</span>
|
737
|
+
<span class="ruby-keyword">end</span></pre>
|
738
|
+
</div><!-- _getGenericQuery-source -->
|
739
|
+
|
740
|
+
</div>
|
741
|
+
|
742
|
+
|
743
|
+
|
744
|
+
|
745
|
+
</div><!-- _getGenericQuery-method -->
|
746
|
+
|
747
|
+
|
748
|
+
</div><!-- private-instance-method-details -->
|
749
|
+
|
750
|
+
</div><!-- 5Buntitled-5D -->
|
751
|
+
|
752
|
+
|
753
|
+
</div><!-- documentation -->
|
754
|
+
|
755
|
+
<div id="validator-badges">
|
756
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
757
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
758
|
+
Rdoc Generator</a> 2</small>.</p>
|
759
|
+
</div>
|
760
|
+
|
761
|
+
</body>
|
762
|
+
</html>
|
763
|
+
|