Release 0.9.9
[davical.git] / docs / api / awl / AwlDatabase / AwlDBDialect.html
blob23b670c5131f901f1628984621f9217476252acd
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <!-- template designed by Marco Von Ballmoos -->
6 <title>Docs For Class AwlDBDialect</title>
7 <link rel="stylesheet" href="../../media/stylesheet.css" />
8 <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
9 </head>
10 <body>
11 <div class="page-body">
12 <h2 class="class-name"><img src="../../media/images/Class_logo.png"
13 alt=" Class"
14 title=" Class"
15 style="vertical-align: middle"> AwlDBDialect</h2>
17 <a name="sec-description"></a>
18 <div class="info-box">
19 <div class="info-box-title">Description</div>
20 <div class="nav-bar">
21 <span class="disabled">Description</span> |
22 <a href="#sec-descendents">Descendents</a>
23 | <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
24 | <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
26 </div>
27 <div class="info-box-body">
28 <!-- ========== Info from phpDoc block ========= -->
29 <p class="short-description">The AwlDBDialect class handles support for different SQL dialects</p>
30 <p class="description"><p>This subpackage provides dialect specific support for PostgreSQL, and may, over time, be extended to provide support for other SQL dialects.</p><p>If you are looking for the place to add support for other SQL dialects, this is the class that you should be looking at. You might also look at the AwlDatabase class which extends this one, but these are the core capabilities which most probably need attention.</p></p>
31 <p class="notes">
32 Located in <a class="field" href="_inc---AwlDBDialect.php.html">/inc/AwlDBDialect.php</a> (line <span class="field">33</span>)
33 </p>
36 <pre></pre>
38 </div>
39 </div>
41 <a name="sec-descendents"></a>
42 <div class="info-box">
43 <div class="info-box-title">Direct descendents</div>
44 <div class="nav-bar">
45 <a href="#sec-description">Description</a> |
46 <span class="disabled">Descendents</span>
47 | <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
48 | <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
50 </div>
51 <div class="info-box-body">
52 <table cellpadding="2" cellspacing="0" class="class-table">
53 <tr>
54 <th class="class-table-header">Class</th>
55 <th class="class-table-header">Description</th>
56 </tr>
57 <tr>
58 <td style="padding-right: 2em; white-space: nowrap">
59 <img src="../../media/images/Class.png"
60 alt=" class"
61 title=" class"
62 style="vertical-align: center"/>
63 <a href="../../awl/AwlDatabase/AwlDatabase.html">AwlDatabase</a>
64 </td>
65 <td>
66 Typically there will only be a single instance of the database level class in an application.
67 </td>
68 </tr>
69 </table>
70 </div>
71 </div>
74 <a name="sec-var-summary"></a>
75 <div class="info-box">
76 <div class="info-box-title">Variable Summary</span></div>
77 <div class="nav-bar">
78 <a href="#sec-description">Description</a> |
79 <a href="#sec-descendents">Descendants</a> |
80 <span class="disabled">Vars</span> (<a href="#sec-vars">details</a>)
82 <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
84 </div>
85 <div class="info-box-body">
86 <div class="var-summary">
87 <div class="var-title">
88 <img src="../../media/images/Variable.png" alt=" " />
89 <span class="var-type">mixed</span>
90 <a href="#$db" title="details" class="var-name">$db</a>
91 </div>
92 <div class="var-title">
93 <img src="../../media/images/Variable.png" alt=" " />
94 <span class="var-type">mixed</span>
95 <a href="#$dialect" title="details" class="var-name">$dialect</a>
96 </div>
97 </div>
98 </div>
99 </div>
101 <a name="sec-method-summary"></a>
102 <div class="info-box">
103 <div class="info-box-title">Method Summary</span></div>
104 <div class="nav-bar">
105 <a href="#sec-description">Description</a> |
106 <a href="#sec-descendents">Descendants</a> |
107 <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
110 <span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
111 </div>
112 <div class="info-box-body">
113 <div class="method-summary">
114 <div class="method-definition">
115 <img src="../../media/images/Constructor.png" alt=" "/>
116 <span class="method-result">AwlDBDialect</span>
117 <a href="#__construct" title="details" class="method-name">__construct</a>
118 (<span class="var-type">string</span>&nbsp;<span class="var-name">$connection_string</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$dbuser</span> = <span class="var-default">null</span>], [<span class="var-type">string</span>&nbsp;<span class="var-name">$dbpass</span> = <span class="var-default">null</span>], [<span class="var-type">array</span>&nbsp;<span class="var-name">$options</span> = <span class="var-default">null</span>])
119 </div>
120 <div class="method-definition">
121 <img src="../../media/images/Method.png" alt=" "/>
122 <span class="method-result">void</span>
123 <a href="#GetFields" title="details" class="method-name">GetFields</a>
124 (<span class="var-type">string</span>&nbsp;<span class="var-name">$tablename_string</span>)
125 </div>
126 <div class="method-definition">
127 <img src="../../media/images/Method.png" alt=" "/>
128 <span class="method-result">void</span>
129 <a href="#GetVersion" title="details" class="method-name">GetVersion</a>
130 (<span class="var-type">handle</span>&nbsp;<span class="var-name">$pdo</span>)
131 </div>
132 <div class="method-definition">
133 <img src="../../media/images/Method.png" alt=" "/>
134 <span class="method-result">void</span>
135 <a href="#Quote" title="details" class="method-name">Quote</a>
136 (<span class="var-type">mixed</span>&nbsp;<span class="var-name">$value</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$value_type</span> = <span class="var-default">null</span>])
137 </div>
138 <div class="method-definition">
139 <img src="../../media/images/Method.png" alt=" "/>
140 <span class="method-result">The</span>
141 <a href="#ReplaceNamedParameters" title="details" class="method-name">ReplaceNamedParameters</a>
142 (<span class="var-type">string</span>&nbsp;<span class="var-name">0</span>, <span class="var-type">mixed</span>&nbsp;<span class="var-name">1</span>)
143 </div>
144 <div class="method-definition">
145 <img src="../../media/images/Method.png" alt=" "/>
146 <span class="method-result">The</span>
147 <a href="#ReplaceParameters" title="details" class="method-name">ReplaceParameters</a>
148 (<span class="var-type">string</span>&nbsp;<span class="var-name">0</span>, <span class="var-type">mixed</span>&nbsp;<span class="var-name">1</span>)
149 </div>
150 <div class="method-definition">
151 <img src="../../media/images/Method.png" alt=" "/>
152 <span class="method-result">void</span>
153 <a href="#SetSearchPath" title="details" class="method-name">SetSearchPath</a>
154 ([<span class="var-type"></span>&nbsp;<span class="var-name">$search_path</span> = <span class="var-default">null</span>])
155 </div>
156 <div class="method-definition">
157 <img src="../../media/images/Method.png" alt=" "/>
158 <span class="method-result">void</span>
159 <a href="#TranslateSQL" title="details" class="method-name">TranslateSQL</a>
160 (<span class="var-type"></span>&nbsp;<span class="var-name">$sql_string</span>)
161 </div>
162 </div>
163 </div>
164 </div>
166 <a name="sec-vars"></a>
167 <div class="info-box">
168 <div class="info-box-title">Variables</div>
169 <div class="nav-bar">
170 <a href="#sec-description">Description</a> |
171 <a href="#sec-descendents">Descendents</a> |
172 <a href="#sec-var-summary">Vars</a> (<span class="disabled">details</span>)
176 <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
178 </div>
179 <div class="info-box-body">
181 <a name="var$db" id="$db"><!-- --></A>
182 <div class="evenrow">
184 <div class="var-header">
185 <img src="../../media/images/Variable.png" />
186 <span class="var-title">
187 <span class="var-type">mixed</span>
188 <span class="var-name">$db</span>
189 (line <span class="line-number">46</span>)
190 </span>
191 </div>
193 <!-- ========== Info from phpDoc block ========= -->
194 <p class="short-description">Holds the PDO database connection</p>
195 <ul class="tags">
196 <li><span class="field">access:</span> protected</li>
197 </ul>
203 </div>
204 <a name="var$dialect" id="$dialect"><!-- --></A>
205 <div class="oddrow">
207 <div class="var-header">
208 <img src="../../media/images/Variable.png" />
209 <span class="var-title">
210 <span class="var-type">mixed</span>
211 <span class="var-name">$dialect</span>
212 (line <span class="line-number">41</span>)
213 </span>
214 </div>
216 <!-- ========== Info from phpDoc block ========= -->
217 <p class="short-description">Holds the name of the database dialect</p>
218 <ul class="tags">
219 <li><span class="field">access:</span> protected</li>
220 </ul>
226 </div>
228 </div>
229 </div>
231 <a name="sec-methods"></a>
232 <div class="info-box">
233 <div class="info-box-title">Methods</div>
234 <div class="nav-bar">
235 <a href="#sec-description">Description</a> |
236 <a href="#sec-descendents">Descendents</a> |
237 <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
238 <a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
240 </div>
241 <div class="info-box-body">
242 <A NAME='method_detail'></A>
243 <a name="method__construct" id="__construct"><!-- --></a>
244 <div class="evenrow">
246 <div class="method-header">
247 <img src="../../media/images/Constructor.png" />
248 <span class="method-title">Constructor __construct</span> (line <span class="line-number">68</span>)
249 </div>
251 <!-- ========== Info from phpDoc block ========= -->
252 <p class="short-description">Parses the connection string to ascertain the database dialect. Returns true if the dialect is supported and fails if the dialect is not supported. All code to support any given database should be within in an external include.</p>
253 <p class="description"><p>The database will be opened.</p></p>
255 <div class="method-signature">
256 <span class="method-result">AwlDBDialect</span>
257 <span class="method-name">
258 __construct
259 </span>
260 (<span class="var-type">string</span>&nbsp;<span class="var-name">$connection_string</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$dbuser</span> = <span class="var-default">null</span>], [<span class="var-type">string</span>&nbsp;<span class="var-name">$dbpass</span> = <span class="var-default">null</span>], [<span class="var-type">array</span>&nbsp;<span class="var-name">$options</span> = <span class="var-default">null</span>])
261 </div>
263 <ul class="parameters">
264 <li>
265 <span class="var-type">string</span>
266 <span class="var-name">$connection_string</span><span class="var-description">: The PDO connection string, in all it's glory</span> </li>
267 <li>
268 <span class="var-type">string</span>
269 <span class="var-name">$dbuser</span><span class="var-description">: The database username to connect as</span> </li>
270 <li>
271 <span class="var-type">string</span>
272 <span class="var-name">$dbpass</span><span class="var-description">: The database password to connect with</span> </li>
273 <li>
274 <span class="var-type">array</span>
275 <span class="var-name">$options</span><span class="var-description">: An array of driver options</span> </li>
276 </ul>
279 </div>
280 <a name="methodGetFields" id="GetFields"><!-- --></a>
281 <div class="oddrow">
283 <div class="method-header">
284 <img src="../../media/images/Method.png" />
285 <span class="method-title">GetFields</span> (line <span class="line-number">134</span>)
286 </div>
288 <!-- ========== Info from phpDoc block ========= -->
289 <p class="short-description">Returns the SQL for the current database dialect which will return a two-column resultset containing a list of fields and their associated data types.</p>
291 <div class="method-signature">
292 <span class="method-result">void</span>
293 <span class="method-name">
294 GetFields
295 </span>
296 (<span class="var-type">string</span>&nbsp;<span class="var-name">$tablename_string</span>)
297 </div>
299 <ul class="parameters">
300 <li>
301 <span class="var-type">string</span>
302 <span class="var-name">$tablename_string</span><span class="var-description">: The name of the table we want fields from</span> </li>
303 </ul>
306 </div>
307 <a name="methodGetVersion" id="GetVersion"><!-- --></a>
308 <div class="evenrow">
310 <div class="method-header">
311 <img src="../../media/images/Method.png" />
312 <span class="method-title">GetVersion</span> (line <span class="line-number">105</span>)
313 </div>
315 <!-- ========== Info from phpDoc block ========= -->
316 <p class="short-description">Sets the current search path for the database.</p>
318 <div class="method-signature">
319 <span class="method-result">void</span>
320 <span class="method-name">
321 GetVersion
322 </span>
323 (<span class="var-type">handle</span>&nbsp;<span class="var-name">$pdo</span>)
324 </div>
326 <ul class="parameters">
327 <li>
328 <span class="var-type">handle</span>
329 <span class="var-name">$pdo</span><span class="var-description">: A handle to an opened database</span> </li>
330 </ul>
333 </div>
334 <a name="methodQuote" id="Quote"><!-- --></a>
335 <div class="oddrow">
337 <div class="method-header">
338 <img src="../../media/images/Method.png" />
339 <span class="method-title">Quote</span> (line <span class="line-number">178</span>)
340 </div>
342 <!-- ========== Info from phpDoc block ========= -->
343 <p class="short-description">Returns $value escaped in an appropriate way for this database dialect.</p>
345 <div class="method-signature">
346 <span class="method-result">void</span>
347 <span class="method-name">
348 Quote
349 </span>
350 (<span class="var-type">mixed</span>&nbsp;<span class="var-name">$value</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$value_type</span> = <span class="var-default">null</span>])
351 </div>
353 <ul class="parameters">
354 <li>
355 <span class="var-type">mixed</span>
356 <span class="var-name">$value</span><span class="var-description">: The value to be escaped</span> </li>
357 <li>
358 <span class="var-type">string</span>
359 <span class="var-name">$value_type</span><span class="var-description">: The type of escaping desired. If blank this will be worked out from the type of the $value. The special type of 'identifier' can also be used for escaping of SQL identifiers.</span> </li>
360 </ul>
363 </div>
364 <a name="methodReplaceNamedParameters" id="ReplaceNamedParameters"><!-- --></a>
365 <div class="evenrow">
367 <div class="method-header">
368 <img src="../../media/images/Method.png" />
369 <span class="method-title">ReplaceNamedParameters</span> (line <span class="line-number">322</span>)
370 </div>
372 <!-- ========== Info from phpDoc block ========= -->
373 <p class="short-description">Replaces named query parameters of the form :name with appropriately escaped substitutions.</p>
374 <p class="description"><p>The function takes a variable number of arguments, the first is the SQL string, with replaceable ':name' characters (a la DBI). The subsequent parameters being the values to replace into the SQL string.</p><p>The values passed to the routine are analyzed for type, and quoted if they appear to need quoting. This can go wrong for (e.g.) NULL or other special SQL values which are not straightforwardly identifiable as needing quoting (or not).</p></p>
375 <ul class="tags">
376 <li><span class="field">return:</span> built query string</li>
377 </ul>
379 <div class="method-signature">
380 <span class="method-result">The</span>
381 <span class="method-name">
382 ReplaceNamedParameters
383 </span>
384 (<span class="var-type">string</span>&nbsp;<span class="var-name">0</span>, <span class="var-type">mixed</span>&nbsp;<span class="var-name">1</span>)
385 </div>
387 <ul class="parameters">
388 <li>
389 <span class="var-type">string</span>
390 <span class="var-name">0</span><span class="var-description">: The query string with replacable ':name' identifiers</span> </li>
391 <li>
392 <span class="var-type">mixed</span>
393 <span class="var-name">1</span><span class="var-description">: A ':name' =&gt; 'value' hash of values to replace into the SQL string.</span> </li>
394 </ul>
397 </div>
398 <a name="methodReplaceParameters" id="ReplaceParameters"><!-- --></a>
399 <div class="oddrow">
401 <div class="method-header">
402 <img src="../../media/images/Method.png" />
403 <span class="method-title">ReplaceParameters</span> (line <span class="line-number">266</span>)
404 </div>
406 <!-- ========== Info from phpDoc block ========= -->
407 <p class="short-description">Replaces query parameters with appropriately escaped substitutions.</p>
408 <p class="description"><p>The function takes a variable number of arguments, the first is the SQL string, with replaceable '?' characters (a la DBI). The subsequent parameters being the values to replace into the SQL string.</p><p>The values passed to the routine are analyzed for type, and quoted if they appear to need quoting. This can go wrong for (e.g.) NULL or other special SQL values which are not straightforwardly identifiable as needing quoting (or not). In such cases the parameter can be forced to be inserted unquoted by passing it as &quot;array( 'plain' =&gt; $param )&quot;.</p></p>
409 <ul class="tags">
410 <li><span class="field">return:</span> built query string</li>
411 </ul>
413 <div class="method-signature">
414 <span class="method-result">The</span>
415 <span class="method-name">
416 ReplaceParameters
417 </span>
418 (<span class="var-type">string</span>&nbsp;<span class="var-name">0</span>, <span class="var-type">mixed</span>&nbsp;<span class="var-name">1</span>)
419 </div>
421 <ul class="parameters">
422 <li>
423 <span class="var-type">string</span>
424 <span class="var-name">0</span><span class="var-description">: The query string with replacable '?' characters.</span> </li>
425 <li>
426 <span class="var-type">mixed</span>
427 <span class="var-name">1</span><span class="var-description">: The values to replace into the SQL string.</span> </li>
428 </ul>
431 </div>
432 <a name="methodSetSearchPath" id="SetSearchPath"><!-- --></a>
433 <div class="evenrow">
435 <div class="method-header">
436 <img src="../../media/images/Method.png" />
437 <span class="method-title">SetSearchPath</span> (line <span class="line-number">87</span>)
438 </div>
440 <!-- ========== Info from phpDoc block ========= -->
441 <p class="short-description">Sets the current search path for the database.</p>
443 <div class="method-signature">
444 <span class="method-result">void</span>
445 <span class="method-name">
446 SetSearchPath
447 </span>
448 ([<span class="var-type"></span>&nbsp;<span class="var-name">$search_path</span> = <span class="var-default">null</span>])
449 </div>
451 <ul class="parameters">
452 <li>
453 <span class="var-type"></span>
454 <span class="var-name">$search_path</span> </li>
455 </ul>
458 </div>
459 <a name="methodTranslateSQL" id="TranslateSQL"><!-- --></a>
460 <div class="oddrow">
462 <div class="method-header">
463 <img src="../../media/images/Method.png" />
464 <span class="method-title">TranslateSQL</span> (line <span class="line-number">164</span>)
465 </div>
467 <!-- ========== Info from phpDoc block ========= -->
468 <p class="short-description">Translates the given SQL string into a form that will hopefully work for this database dialect. This hook is intended to be used by developers to provide support for differences in database operation by translating the query string in an arbitrary way, such as through a file or database lookup.</p>
469 <p class="description"><p>The actual translation to other SQL dialects will be application-specific, so that any routines called by this will be external to this library, or will use resources loaded from some source external to this library.</p><p>The application developer is expected to use this functionality to solve harder translation problems, but is less likely to call this directly, hopefully switching -&gt;Prepare to -&gt;PrepareTranslated in those cases, and then adding that statement to whatever SQL translation infrastructure is in place.</p></p>
471 <div class="method-signature">
472 <span class="method-result">void</span>
473 <span class="method-name">
474 TranslateSQL
475 </span>
476 (<span class="var-type"></span>&nbsp;<span class="var-name">$sql_string</span>)
477 </div>
479 <ul class="parameters">
480 <li>
481 <span class="var-type"></span>
482 <span class="var-name">$sql_string</span> </li>
483 </ul>
486 </div>
488 </div>
489 </div>
492 <p class="notes" id="credit">
493 Documentation generated on Sat, 17 Apr 2010 12:32:23 +1200 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.2</a>
494 </p>
495 </div></body>
496 </html>