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,382 @@
|
|
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: SQLExporter</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/sqlexporter_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
+
class="thickbox" title="lib/sqlexporter.rb">lib/sqlexporter.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
|
+
<!-- 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="SQLExporter/Exporter_generic.html">SQLExporter::Exporter_generic</a></li>
|
67
|
+
|
68
|
+
<li><span class="type">CLASS</span> <a href="SQLExporter/Exporter_mysql.html">SQLExporter::Exporter_mysql</a></li>
|
69
|
+
|
70
|
+
</ul>
|
71
|
+
</div>
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
<!-- Method Quickref -->
|
76
|
+
<div id="method-list-section" class="section">
|
77
|
+
<h3 class="section-header">Methods</h3>
|
78
|
+
<ul class="link-list">
|
79
|
+
|
80
|
+
<li><a href="#method-c-new">::new</a></li>
|
81
|
+
|
82
|
+
<li><a href="#method-i-export">#export</a></li>
|
83
|
+
|
84
|
+
</ul>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="project-metadata">
|
92
|
+
|
93
|
+
|
94
|
+
<div id="fileindex-section" class="section project-section">
|
95
|
+
<h3 class="section-header">Files</h3>
|
96
|
+
<ul>
|
97
|
+
|
98
|
+
<li class="file"><a href="./Rakefile.html">Rakefile</a></li>
|
99
|
+
|
100
|
+
</ul>
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
<div id="classindex-section" class="section project-section">
|
105
|
+
<h3 class="section-header">Class/Module Index
|
106
|
+
<span class="search-toggle"><img src="./images/find.png"
|
107
|
+
height="16" width="16" alt="[+]"
|
108
|
+
title="show/hide quicksearch" /></span></h3>
|
109
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
110
|
+
<fieldset>
|
111
|
+
<legend>Quicksearch</legend>
|
112
|
+
<input type="text" name="quicksearch" value=""
|
113
|
+
class="quicksearch-field" />
|
114
|
+
</fieldset>
|
115
|
+
</form>
|
116
|
+
|
117
|
+
<ul class="link-list">
|
118
|
+
|
119
|
+
<li><a href="./SQLConstructor.html">SQLConstructor</a></li>
|
120
|
+
|
121
|
+
<li><a href="./SQLConstructor/BasicDelete.html">SQLConstructor::BasicDelete</a></li>
|
122
|
+
|
123
|
+
<li><a href="./SQLConstructor/BasicDelete_mysql.html">SQLConstructor::BasicDelete_mysql</a></li>
|
124
|
+
|
125
|
+
<li><a href="./SQLConstructor/BasicInsert.html">SQLConstructor::BasicInsert</a></li>
|
126
|
+
|
127
|
+
<li><a href="./SQLConstructor/BasicInsert_mysql.html">SQLConstructor::BasicInsert_mysql</a></li>
|
128
|
+
|
129
|
+
<li><a href="./SQLConstructor/BasicJoin.html">SQLConstructor::BasicJoin</a></li>
|
130
|
+
|
131
|
+
<li><a href="./SQLConstructor/BasicJoin_mysql.html">SQLConstructor::BasicJoin_mysql</a></li>
|
132
|
+
|
133
|
+
<li><a href="./SQLConstructor/BasicSelect.html">SQLConstructor::BasicSelect</a></li>
|
134
|
+
|
135
|
+
<li><a href="./SQLConstructor/BasicSelect_example.html">SQLConstructor::BasicSelect_example</a></li>
|
136
|
+
|
137
|
+
<li><a href="./SQLConstructor/BasicSelect_mysql.html">SQLConstructor::BasicSelect_mysql</a></li>
|
138
|
+
|
139
|
+
<li><a href="./SQLConstructor/BasicUnion.html">SQLConstructor::BasicUnion</a></li>
|
140
|
+
|
141
|
+
<li><a href="./SQLConstructor/BasicUpdate.html">SQLConstructor::BasicUpdate</a></li>
|
142
|
+
|
143
|
+
<li><a href="./SQLConstructor/BasicUpdate_mysql.html">SQLConstructor::BasicUpdate_mysql</a></li>
|
144
|
+
|
145
|
+
<li><a href="./SQLConstructor/GenericQuery.html">SQLConstructor::GenericQuery</a></li>
|
146
|
+
|
147
|
+
<li><a href="./SQLConstructor/QAttr.html">SQLConstructor::QAttr</a></li>
|
148
|
+
|
149
|
+
<li><a href="./SQLExporter.html">SQLExporter</a></li>
|
150
|
+
|
151
|
+
<li><a href="./SQLExporter/Exporter_generic.html">SQLExporter::Exporter_generic</a></li>
|
152
|
+
|
153
|
+
<li><a href="./SQLExporter/Exporter_mysql.html">SQLExporter::Exporter_mysql</a></li>
|
154
|
+
|
155
|
+
<li><a href="./SQLConditional.html">SQLConditional</a></li>
|
156
|
+
|
157
|
+
<li><a href="./SQLConditional/BasicCond.html">SQLConditional::BasicCond</a></li>
|
158
|
+
|
159
|
+
<li><a href="./Object.html">Object</a></li>
|
160
|
+
|
161
|
+
<li><a href="./SQLAliasedList.html">SQLAliasedList</a></li>
|
162
|
+
|
163
|
+
<li><a href="./SQLColumn.html">SQLColumn</a></li>
|
164
|
+
|
165
|
+
<li><a href="./SQLCondList.html">SQLCondList</a></li>
|
166
|
+
|
167
|
+
<li><a href="./SQLConstructorTest.html">SQLConstructorTest</a></li>
|
168
|
+
|
169
|
+
<li><a href="./SQLObject.html">SQLObject</a></li>
|
170
|
+
|
171
|
+
<li><a href="./SQLValList.html">SQLValList</a></li>
|
172
|
+
|
173
|
+
<li><a href="./SQLValue.html">SQLValue</a></li>
|
174
|
+
|
175
|
+
</ul>
|
176
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
|
180
|
+
</div>
|
181
|
+
</div>
|
182
|
+
|
183
|
+
<div id="documentation">
|
184
|
+
<h1 class="class">SQLExporter</h1>
|
185
|
+
|
186
|
+
<div id="description" class="description">
|
187
|
+
|
188
|
+
<p>This class implements the interface for exprting <a
|
189
|
+
href="SQLConstructor.html">SQLConstructor</a> objects to strings.</p>
|
190
|
+
|
191
|
+
</div><!-- description -->
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
<div id="5Buntitled-5D" class="documentation-section">
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
<!-- Constants -->
|
203
|
+
<div id="constants-list" class="section">
|
204
|
+
<h3 class="section-header">Constants</h3>
|
205
|
+
<dl>
|
206
|
+
|
207
|
+
<dt><a name="DEFAULT_DIALECT">DEFAULT_DIALECT</a></dt>
|
208
|
+
|
209
|
+
<dd class="description"></dd>
|
210
|
+
|
211
|
+
|
212
|
+
</dl>
|
213
|
+
</div>
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
<!-- Attributes -->
|
218
|
+
<div id="attribute-method-details" class="method-section section">
|
219
|
+
<h3 class="section-header">Attributes</h3>
|
220
|
+
|
221
|
+
|
222
|
+
<div id="dialect-attribute-method" class="method-detail">
|
223
|
+
<a name="dialect"></a>
|
224
|
+
|
225
|
+
<a name="dialect="></a>
|
226
|
+
|
227
|
+
<div class="method-heading attribute-method-heading">
|
228
|
+
<span class="method-name">dialect</span><span
|
229
|
+
class="attribute-access-type">[RW]</span>
|
230
|
+
</div>
|
231
|
+
|
232
|
+
<div class="method-description">
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
</div>
|
237
|
+
</div>
|
238
|
+
|
239
|
+
<div id="separator-attribute-method" class="method-detail">
|
240
|
+
<a name="separator"></a>
|
241
|
+
|
242
|
+
<div class="method-heading attribute-method-heading">
|
243
|
+
<span class="method-name">separator</span><span
|
244
|
+
class="attribute-access-type">[R]</span>
|
245
|
+
</div>
|
246
|
+
|
247
|
+
<div class="method-description">
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
</div>
|
252
|
+
</div>
|
253
|
+
|
254
|
+
<div id="tidy-attribute-method" class="method-detail">
|
255
|
+
<a name="tidy"></a>
|
256
|
+
|
257
|
+
<a name="tidy="></a>
|
258
|
+
|
259
|
+
<div class="method-heading attribute-method-heading">
|
260
|
+
<span class="method-name">tidy</span><span
|
261
|
+
class="attribute-access-type">[RW]</span>
|
262
|
+
</div>
|
263
|
+
|
264
|
+
<div class="method-description">
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
</div>
|
269
|
+
</div>
|
270
|
+
|
271
|
+
</div><!-- attribute-method-details -->
|
272
|
+
|
273
|
+
|
274
|
+
<!-- Methods -->
|
275
|
+
|
276
|
+
<div id="public-class-method-details" class="method-section section">
|
277
|
+
<h3 class="section-header">Public Class Methods</h3>
|
278
|
+
|
279
|
+
|
280
|
+
<div id="new-method" class="method-detail ">
|
281
|
+
<a name="method-c-new"></a>
|
282
|
+
|
283
|
+
|
284
|
+
<div class="method-heading">
|
285
|
+
<span class="method-name">new</span><span
|
286
|
+
class="method-args">( dialect = DEFAULT_DIALECT, tidy = false )</span>
|
287
|
+
<span class="method-click-advice">click to toggle source</span>
|
288
|
+
</div>
|
289
|
+
|
290
|
+
|
291
|
+
<div class="method-description">
|
292
|
+
|
293
|
+
<p>Class constructor. Called with two optional arguments - dialect and tidy.
|
294
|
+
Dialect determines the translator class (e.g., <a
|
295
|
+
href="SQLExporter/Exporter_mysql.html">Exporter_mysql</a>,
|
296
|
+
Exporter_informix etc). Tidy determines whether the output should be
|
297
|
+
formatted and human-readable.</p>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
<div class="method-source-code" id="new-source">
|
302
|
+
<pre>
|
303
|
+
<span class="ruby-comment"># File lib/sqlexporter.rb, line 18</span>
|
304
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span> ( <span class="ruby-identifier">dialect</span> = <span class="ruby-constant">DEFAULT_DIALECT</span>, <span class="ruby-identifier">tidy</span> = <span class="ruby-keyword">false</span> )
|
305
|
+
<span class="ruby-identifier">dialect</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">DEFAULT_DIALECT</span>
|
306
|
+
<span class="ruby-identifier">dialect_class</span> = <span class="ruby-string">"Exporter_"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">dialect</span>.<span class="ruby-identifier">to_s</span>
|
307
|
+
<span class="ruby-keyword">begin</span>
|
308
|
+
<span class="ruby-ivar">@translator</span> = <span class="ruby-constant">SQLExporter</span>.<span class="ruby-identifier">const_get</span>( <span class="ruby-identifier">dialect_class</span> ).<span class="ruby-identifier">new</span>( <span class="ruby-identifier">tidy</span> )
|
309
|
+
<span class="ruby-keyword">rescue</span>
|
310
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>, <span class="ruby-constant">ERR_UNKNOWN_DIALECT</span> <span class="ruby-operator">+</span> <span class="ruby-string">": "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">dialect</span>.<span class="ruby-identifier">to_s</span>
|
311
|
+
<span class="ruby-keyword">end</span>
|
312
|
+
<span class="ruby-ivar">@dialect</span>, <span class="ruby-ivar">@tidy</span> = <span class="ruby-identifier">dialect</span>, <span class="ruby-identifier">tidy</span>
|
313
|
+
<span class="ruby-ivar">@separator</span> = <span class="ruby-ivar">@translator</span>.<span class="ruby-identifier">separator</span>
|
314
|
+
<span class="ruby-keyword">end</span></pre>
|
315
|
+
</div><!-- new-source -->
|
316
|
+
|
317
|
+
</div>
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
</div><!-- new-method -->
|
323
|
+
|
324
|
+
|
325
|
+
</div><!-- public-class-method-details -->
|
326
|
+
|
327
|
+
<div id="public-instance-method-details" class="method-section section">
|
328
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
329
|
+
|
330
|
+
|
331
|
+
<div id="export-method" class="method-detail ">
|
332
|
+
<a name="method-i-export"></a>
|
333
|
+
|
334
|
+
|
335
|
+
<div class="method-heading">
|
336
|
+
<span class="method-name">export</span><span
|
337
|
+
class="method-args">( obj )</span>
|
338
|
+
<span class="method-click-advice">click to toggle source</span>
|
339
|
+
</div>
|
340
|
+
|
341
|
+
|
342
|
+
<div class="method-description">
|
343
|
+
|
344
|
+
<p>The main method to export the obj to string. Calls the @translator’s
|
345
|
+
export method.</p>
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
<div class="method-source-code" id="export-source">
|
350
|
+
<pre>
|
351
|
+
<span class="ruby-comment"># File lib/sqlexporter.rb, line 34</span>
|
352
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">export</span> ( <span class="ruby-identifier">obj</span> )
|
353
|
+
<span class="ruby-identifier">string</span> = <span class="ruby-ivar">@translator</span>.<span class="ruby-identifier">export</span> <span class="ruby-identifier">obj</span>
|
354
|
+
<span class="ruby-identifier">string</span> = <span class="ruby-ivar">@separator</span> <span class="ruby-operator">+</span> <span class="ruby-string">"("</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">string</span> <span class="ruby-operator">+</span> <span class="ruby-string">")"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">inline</span>
|
355
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">string</span>
|
356
|
+
<span class="ruby-keyword">end</span></pre>
|
357
|
+
</div><!-- export-source -->
|
358
|
+
|
359
|
+
</div>
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
</div><!-- export-method -->
|
365
|
+
|
366
|
+
|
367
|
+
</div><!-- public-instance-method-details -->
|
368
|
+
|
369
|
+
</div><!-- 5Buntitled-5D -->
|
370
|
+
|
371
|
+
|
372
|
+
</div><!-- documentation -->
|
373
|
+
|
374
|
+
<div id="validator-badges">
|
375
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
376
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
377
|
+
Rdoc Generator</a> 2</small>.</p>
|
378
|
+
</div>
|
379
|
+
|
380
|
+
</body>
|
381
|
+
</html>
|
382
|
+
|
@@ -0,0 +1,413 @@
|
|
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: SQLExporter::Exporter_generic</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/sqlexporter_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
+
class="thickbox" title="lib/sqlexporter.rb">lib/sqlexporter.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-export">#export</a></li>
|
71
|
+
|
72
|
+
<li><a href="#method-i-gen_joins">#gen_joins</a></li>
|
73
|
+
|
74
|
+
<li><a href="#method-i-method_missing">#method_missing</a></li>
|
75
|
+
|
76
|
+
</ul>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
</div>
|
82
|
+
|
83
|
+
<div id="project-metadata">
|
84
|
+
|
85
|
+
|
86
|
+
<div id="fileindex-section" class="section project-section">
|
87
|
+
<h3 class="section-header">Files</h3>
|
88
|
+
<ul>
|
89
|
+
|
90
|
+
<li class="file"><a href="../Rakefile.html">Rakefile</a></li>
|
91
|
+
|
92
|
+
</ul>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
<div id="classindex-section" class="section project-section">
|
97
|
+
<h3 class="section-header">Class/Module Index
|
98
|
+
<span class="search-toggle"><img src="../images/find.png"
|
99
|
+
height="16" width="16" alt="[+]"
|
100
|
+
title="show/hide quicksearch" /></span></h3>
|
101
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
102
|
+
<fieldset>
|
103
|
+
<legend>Quicksearch</legend>
|
104
|
+
<input type="text" name="quicksearch" value=""
|
105
|
+
class="quicksearch-field" />
|
106
|
+
</fieldset>
|
107
|
+
</form>
|
108
|
+
|
109
|
+
<ul class="link-list">
|
110
|
+
|
111
|
+
<li><a href="../SQLConstructor.html">SQLConstructor</a></li>
|
112
|
+
|
113
|
+
<li><a href="../SQLConstructor/BasicDelete.html">SQLConstructor::BasicDelete</a></li>
|
114
|
+
|
115
|
+
<li><a href="../SQLConstructor/BasicDelete_mysql.html">SQLConstructor::BasicDelete_mysql</a></li>
|
116
|
+
|
117
|
+
<li><a href="../SQLConstructor/BasicInsert.html">SQLConstructor::BasicInsert</a></li>
|
118
|
+
|
119
|
+
<li><a href="../SQLConstructor/BasicInsert_mysql.html">SQLConstructor::BasicInsert_mysql</a></li>
|
120
|
+
|
121
|
+
<li><a href="../SQLConstructor/BasicJoin.html">SQLConstructor::BasicJoin</a></li>
|
122
|
+
|
123
|
+
<li><a href="../SQLConstructor/BasicJoin_mysql.html">SQLConstructor::BasicJoin_mysql</a></li>
|
124
|
+
|
125
|
+
<li><a href="../SQLConstructor/BasicSelect.html">SQLConstructor::BasicSelect</a></li>
|
126
|
+
|
127
|
+
<li><a href="../SQLConstructor/BasicSelect_example.html">SQLConstructor::BasicSelect_example</a></li>
|
128
|
+
|
129
|
+
<li><a href="../SQLConstructor/BasicSelect_mysql.html">SQLConstructor::BasicSelect_mysql</a></li>
|
130
|
+
|
131
|
+
<li><a href="../SQLConstructor/BasicUnion.html">SQLConstructor::BasicUnion</a></li>
|
132
|
+
|
133
|
+
<li><a href="../SQLConstructor/BasicUpdate.html">SQLConstructor::BasicUpdate</a></li>
|
134
|
+
|
135
|
+
<li><a href="../SQLConstructor/BasicUpdate_mysql.html">SQLConstructor::BasicUpdate_mysql</a></li>
|
136
|
+
|
137
|
+
<li><a href="../SQLConstructor/GenericQuery.html">SQLConstructor::GenericQuery</a></li>
|
138
|
+
|
139
|
+
<li><a href="../SQLConstructor/QAttr.html">SQLConstructor::QAttr</a></li>
|
140
|
+
|
141
|
+
<li><a href="../SQLExporter.html">SQLExporter</a></li>
|
142
|
+
|
143
|
+
<li><a href="../SQLExporter/Exporter_generic.html">SQLExporter::Exporter_generic</a></li>
|
144
|
+
|
145
|
+
<li><a href="../SQLExporter/Exporter_mysql.html">SQLExporter::Exporter_mysql</a></li>
|
146
|
+
|
147
|
+
<li><a href="../SQLConditional.html">SQLConditional</a></li>
|
148
|
+
|
149
|
+
<li><a href="../SQLConditional/BasicCond.html">SQLConditional::BasicCond</a></li>
|
150
|
+
|
151
|
+
<li><a href="../Object.html">Object</a></li>
|
152
|
+
|
153
|
+
<li><a href="../SQLAliasedList.html">SQLAliasedList</a></li>
|
154
|
+
|
155
|
+
<li><a href="../SQLColumn.html">SQLColumn</a></li>
|
156
|
+
|
157
|
+
<li><a href="../SQLCondList.html">SQLCondList</a></li>
|
158
|
+
|
159
|
+
<li><a href="../SQLConstructorTest.html">SQLConstructorTest</a></li>
|
160
|
+
|
161
|
+
<li><a href="../SQLObject.html">SQLObject</a></li>
|
162
|
+
|
163
|
+
<li><a href="../SQLValList.html">SQLValList</a></li>
|
164
|
+
|
165
|
+
<li><a href="../SQLValue.html">SQLValue</a></li>
|
166
|
+
|
167
|
+
</ul>
|
168
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
|
172
|
+
</div>
|
173
|
+
</div>
|
174
|
+
|
175
|
+
<div id="documentation">
|
176
|
+
<h1 class="class">SQLExporter::Exporter_generic</h1>
|
177
|
+
|
178
|
+
<div id="description" class="description">
|
179
|
+
|
180
|
+
<p>The exporter class of a ‘generic’ sql dialect. This should be the parent
|
181
|
+
for all dialect-specific exporter classes.</p>
|
182
|
+
|
183
|
+
</div><!-- description -->
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
<div id="5Buntitled-5D" class="documentation-section">
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
<!-- Attributes -->
|
197
|
+
<div id="attribute-method-details" class="method-section section">
|
198
|
+
<h3 class="section-header">Attributes</h3>
|
199
|
+
|
200
|
+
|
201
|
+
<div id="separator-attribute-method" class="method-detail">
|
202
|
+
<a name="separator"></a>
|
203
|
+
|
204
|
+
<div class="method-heading attribute-method-heading">
|
205
|
+
<span class="method-name">separator</span><span
|
206
|
+
class="attribute-access-type">[R]</span>
|
207
|
+
</div>
|
208
|
+
|
209
|
+
<div class="method-description">
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
</div>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
</div><!-- attribute-method-details -->
|
217
|
+
|
218
|
+
|
219
|
+
<!-- Methods -->
|
220
|
+
|
221
|
+
<div id="public-class-method-details" class="method-section section">
|
222
|
+
<h3 class="section-header">Public Class Methods</h3>
|
223
|
+
|
224
|
+
|
225
|
+
<div id="new-method" class="method-detail ">
|
226
|
+
<a name="method-c-new"></a>
|
227
|
+
|
228
|
+
|
229
|
+
<div class="method-heading">
|
230
|
+
<span class="method-name">new</span><span
|
231
|
+
class="method-args">( tidy )</span>
|
232
|
+
<span class="method-click-advice">click to toggle source</span>
|
233
|
+
</div>
|
234
|
+
|
235
|
+
|
236
|
+
<div class="method-description">
|
237
|
+
|
238
|
+
<p>Class constructor.</p>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
<div class="method-source-code" id="new-source">
|
243
|
+
<pre>
|
244
|
+
<span class="ruby-comment"># File lib/sqlexporter.rb, line 52</span>
|
245
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span> ( <span class="ruby-identifier">tidy</span> )
|
246
|
+
<span class="ruby-ivar">@tidy</span> = <span class="ruby-identifier">tidy</span>
|
247
|
+
<span class="ruby-ivar">@separator</span> = <span class="ruby-ivar">@tidy</span> <span class="ruby-operator">?</span> <span class="ruby-string">"\n"</span> <span class="ruby-operator">:</span> <span class="ruby-string">" "</span>
|
248
|
+
<span class="ruby-keyword">end</span></pre>
|
249
|
+
</div><!-- new-source -->
|
250
|
+
|
251
|
+
</div>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
</div><!-- new-method -->
|
257
|
+
|
258
|
+
|
259
|
+
</div><!-- public-class-method-details -->
|
260
|
+
|
261
|
+
<div id="public-instance-method-details" class="method-section section">
|
262
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
263
|
+
|
264
|
+
|
265
|
+
<div id="export-method" class="method-detail ">
|
266
|
+
<a name="method-i-export"></a>
|
267
|
+
|
268
|
+
|
269
|
+
<div class="method-heading">
|
270
|
+
<span class="method-name">export</span><span
|
271
|
+
class="method-args">( obj )</span>
|
272
|
+
<span class="method-click-advice">click to toggle source</span>
|
273
|
+
</div>
|
274
|
+
|
275
|
+
|
276
|
+
<div class="method-description">
|
277
|
+
|
278
|
+
<p>exports a string with a query from object. this method should be called
|
279
|
+
from a child class with defined constant arrays
|
280
|
+
[select|delete|update|insert]_syntax. methods defined in the array are
|
281
|
+
called in the specified order for the object obj.</p>
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
<div class="method-source-code" id="export-source">
|
286
|
+
<pre>
|
287
|
+
<span class="ruby-comment"># File lib/sqlexporter.rb, line 63</span>
|
288
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">export</span> ( <span class="ruby-identifier">obj</span> )
|
289
|
+
<span class="ruby-identifier">rules_const_name</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">sub</span>( <span class="ruby-regexp">/^.+?::Basic([^_]+).+/</span>, <span class="ruby-string">'\1'</span> ).<span class="ruby-identifier">upcase</span> <span class="ruby-operator">+</span> <span class="ruby-string">"_SYNTAX"</span>
|
290
|
+
<span class="ruby-keyword">begin</span>
|
291
|
+
<span class="ruby-identifier">rules</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">const_get</span>( <span class="ruby-identifier">rules_const_name</span>.<span class="ruby-identifier">to_sym</span> )
|
292
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">NameError</span>
|
293
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>, <span class="ruby-constant">ERR_INVALID_RULES</span> <span class="ruby-operator">+</span> <span class="ruby-string">" '"</span> <span class="ruby-operator">+</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">send</span>( <span class="ruby-value">:dialect</span> ) <span class="ruby-operator">+</span> <span class="ruby-string">"'"</span>
|
294
|
+
<span class="ruby-keyword">end</span>
|
295
|
+
<span class="ruby-identifier">string</span> = <span class="ruby-string">""</span>
|
296
|
+
<span class="ruby-identifier">rules</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule</span><span class="ruby-operator">|</span>
|
297
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">String</span>
|
298
|
+
<span class="ruby-identifier">string</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">rule</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@separator</span>
|
299
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Symbol</span>
|
300
|
+
<span class="ruby-identifier">res</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">send</span>( <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">obj</span> ).<span class="ruby-identifier">to_s</span>
|
301
|
+
<span class="ruby-identifier">string</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">res</span>
|
302
|
+
<span class="ruby-identifier">string</span> <span class="ruby-operator">+=</span> <span class="ruby-ivar">@separator</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">empty?</span>
|
303
|
+
<span class="ruby-keyword">end</span>
|
304
|
+
<span class="ruby-keyword">end</span>
|
305
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">string</span>
|
306
|
+
<span class="ruby-keyword">end</span></pre>
|
307
|
+
</div><!-- export-source -->
|
308
|
+
|
309
|
+
</div>
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
</div><!-- export-method -->
|
315
|
+
|
316
|
+
|
317
|
+
<div id="gen_joins-method" class="method-detail ">
|
318
|
+
<a name="method-i-gen_joins"></a>
|
319
|
+
|
320
|
+
|
321
|
+
<div class="method-heading">
|
322
|
+
<span class="method-name">gen_joins</span><span
|
323
|
+
class="method-args">( obj )</span>
|
324
|
+
<span class="method-click-advice">click to toggle source</span>
|
325
|
+
</div>
|
326
|
+
|
327
|
+
|
328
|
+
<div class="method-description">
|
329
|
+
|
330
|
+
<p>Generic representation of the JOIN clause</p>
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
<div class="method-source-code" id="gen_joins-source">
|
335
|
+
<pre>
|
336
|
+
<span class="ruby-comment"># File lib/sqlexporter.rb, line 86</span>
|
337
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">gen_joins</span> ( <span class="ruby-identifier">obj</span> )
|
338
|
+
<span class="ruby-identifier">arr_joins</span> = [ ]
|
339
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">gen_joins</span>
|
340
|
+
<span class="ruby-identifier">arr_joins</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">gen_joins</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">join</span><span class="ruby-operator">|</span> <span class="ruby-identifier">join</span>.<span class="ruby-identifier">to_s</span> }
|
341
|
+
<span class="ruby-keyword">end</span>
|
342
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">arr_joins</span>.<span class="ruby-identifier">join</span>( <span class="ruby-ivar">@separator</span> )
|
343
|
+
<span class="ruby-keyword">end</span></pre>
|
344
|
+
</div><!-- gen_joins-source -->
|
345
|
+
|
346
|
+
</div>
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
</div><!-- gen_joins-method -->
|
352
|
+
|
353
|
+
|
354
|
+
<div id="method_missing-method" class="method-detail ">
|
355
|
+
<a name="method-i-method_missing"></a>
|
356
|
+
|
357
|
+
|
358
|
+
<div class="method-heading">
|
359
|
+
<span class="method-name">method_missing</span><span
|
360
|
+
class="method-args">( method, *args )</span>
|
361
|
+
<span class="method-click-advice">click to toggle source</span>
|
362
|
+
</div>
|
363
|
+
|
364
|
+
|
365
|
+
<div class="method-description">
|
366
|
+
|
367
|
+
<p>Construct an expression string for an object’s attribute defined in in the
|
368
|
+
METHODS constant array.</p>
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
<div class="method-source-code" id="method_missing-source">
|
373
|
+
<pre>
|
374
|
+
<span class="ruby-comment"># File lib/sqlexporter.rb, line 98</span>
|
375
|
+
<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> )
|
376
|
+
<span class="ruby-identifier">obj</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]
|
377
|
+
<span class="ruby-keyword">return</span> <span class="ruby-string">''</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">SQLObject</span>
|
378
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-string">""</span>
|
379
|
+
<span class="ruby-identifier">_attr</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">method</span>
|
380
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">_attr</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Array</span>
|
381
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">_attr</span>.<span class="ruby-identifier">join</span> <span class="ruby-ivar">@separator</span>
|
382
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">_attr</span>
|
383
|
+
<span class="ruby-identifier">result</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">_attr</span>.<span class="ruby-identifier">to_s</span>
|
384
|
+
<span class="ruby-keyword">end</span>
|
385
|
+
|
386
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
387
|
+
<span class="ruby-keyword">end</span></pre>
|
388
|
+
</div><!-- method_missing-source -->
|
389
|
+
|
390
|
+
</div>
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
</div><!-- method_missing-method -->
|
396
|
+
|
397
|
+
|
398
|
+
</div><!-- public-instance-method-details -->
|
399
|
+
|
400
|
+
</div><!-- 5Buntitled-5D -->
|
401
|
+
|
402
|
+
|
403
|
+
</div><!-- documentation -->
|
404
|
+
|
405
|
+
<div id="validator-badges">
|
406
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
407
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
408
|
+
Rdoc Generator</a> 2</small>.</p>
|
409
|
+
</div>
|
410
|
+
|
411
|
+
</body>
|
412
|
+
</html>
|
413
|
+
|