| 1 |
lars |
1 |
<?php
|
|
|
2 |
// +----------------------------------------------------------------------+
|
|
|
3 |
// | PHP Version 4 |
|
|
|
4 |
// +----------------------------------------------------------------------+
|
|
|
5 |
// | Copyright (c) 1998-2004 Manuel Lemos, Tomas V.V.Cox, |
|
|
|
6 |
// | Stig. S. Bakken, Lukas Smith |
|
|
|
7 |
// | All rights reserved. |
|
|
|
8 |
// +----------------------------------------------------------------------+
|
|
|
9 |
// | MDB is a merge of PEAR DB and Metabases that provides a unified DB |
|
|
|
10 |
// | API as well as database abstraction for PHP applications. |
|
|
|
11 |
// | This LICENSE is in the BSD license style. |
|
|
|
12 |
// | |
|
|
|
13 |
// | Redistribution and use in source and binary forms, with or without |
|
|
|
14 |
// | modification, are permitted provided that the following conditions |
|
|
|
15 |
// | are met: |
|
|
|
16 |
// | |
|
|
|
17 |
// | Redistributions of source code must retain the above copyright |
|
|
|
18 |
// | notice, this list of conditions and the following disclaimer. |
|
|
|
19 |
// | |
|
|
|
20 |
// | Redistributions in binary form must reproduce the above copyright |
|
|
|
21 |
// | notice, this list of conditions and the following disclaimer in the |
|
|
|
22 |
// | documentation and/or other materials provided with the distribution. |
|
|
|
23 |
// | |
|
|
|
24 |
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
|
|
25 |
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
|
|
26 |
// | or promote products derived from this software without specific prior|
|
|
|
27 |
// | written permission. |
|
|
|
28 |
// | |
|
|
|
29 |
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
|
|
30 |
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
|
|
31 |
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
|
|
32 |
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
|
|
33 |
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
|
|
34 |
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
|
|
35 |
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
|
|
36 |
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
|
|
37 |
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
|
|
38 |
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
|
|
39 |
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
|
|
40 |
// | POSSIBILITY OF SUCH DAMAGE. |
|
|
|
41 |
// +----------------------------------------------------------------------+
|
|
|
42 |
// | Author: YOUR NAME <YOUR EMAIL> |
|
|
|
43 |
// +----------------------------------------------------------------------+
|
|
|
44 |
//
|
|
|
45 |
// $Id: skeleton.php,v 1.16.4.2 2004/03/12 16:19:31 lsmith Exp $
|
|
|
46 |
//
|
|
|
47 |
|
|
|
48 |
// This is just a skeleton MDB driver.
|
|
|
49 |
// There may be methods missing as this skeleton is based on the methods
|
|
|
50 |
// implemented by the MySQL and PostGreSQL drivers in MDB.
|
|
|
51 |
// Some methods may not have to be implemented in the driver, because the
|
|
|
52 |
// implementation in common.php is compatible with the given RDBMS.
|
|
|
53 |
// In each of the listed methods I have added comments that tell you where
|
|
|
54 |
// to look for a "reference" implementation.
|
|
|
55 |
// Some of these methods have been expanded or changed slightly in MDB.
|
|
|
56 |
// Looking in the relevant MDB Wrapper should give you some pointers, some
|
|
|
57 |
// other difference you will only discover by looking at one of the existing
|
|
|
58 |
// MDB driver or the common implementation in common.php.
|
|
|
59 |
// One thing that will definately have to be modified in all "reference"
|
|
|
60 |
// implementations of Metabase methods is the error handling.
|
|
|
61 |
// Anyways don't worry if you are having problems: Lukas Smith is here to help!
|
|
|
62 |
|
|
|
63 |
require_once('MDB/Common.php');
|
|
|
64 |
|
|
|
65 |
/**
|
|
|
66 |
* MDB XXX driver
|
|
|
67 |
*
|
|
|
68 |
* @package MDB
|
|
|
69 |
* @category Database
|
|
|
70 |
* @author YOUR NAME <YOUR EMAIL>
|
|
|
71 |
*/
|
|
|
72 |
class MDB_xxx extends MDB_Common
|
|
|
73 |
{
|
|
|
74 |
// Most of the class variables are taken from the corresponding Metabase driver.
|
|
|
75 |
// Few are taken from the corresponding PEAR DB driver.
|
|
|
76 |
// Some are MDB specific.
|
|
|
77 |
var $connection = 0;
|
|
|
78 |
var $connected_host;
|
|
|
79 |
var $connected_user;
|
|
|
80 |
var $connected_password;
|
|
|
81 |
var $connected_port;
|
|
|
82 |
var $opened_persistent = '';
|
|
|
83 |
|
|
|
84 |
var $escape_quotes = "\\";
|
|
|
85 |
var $decimal_factor = 1.0;
|
|
|
86 |
|
|
|
87 |
var $highest_fetched_row = array();
|
|
|
88 |
var $columns = array();
|
|
|
89 |
|
|
|
90 |
// }}}
|
|
|
91 |
// {{{ constructor
|
|
|
92 |
|
|
|
93 |
/**
|
|
|
94 |
* Constructor
|
|
|
95 |
*/
|
|
|
96 |
function MDB_xxx()
|
|
|
97 |
{
|
|
|
98 |
$this->MDB_common();
|
|
|
99 |
$this->phptype = 'xxx';
|
|
|
100 |
$this->dbsyntax = 'xxx';
|
|
|
101 |
|
|
|
102 |
// most of the following codes needs to be taken from the corresponding Metabase driver setup() methods
|
|
|
103 |
|
|
|
104 |
// the error code maps from corresponding PEAR DB driver constructor
|
|
|
105 |
|
|
|
106 |
// also please remember to "register" all driver specific options here like so
|
|
|
107 |
// $this->options['option_name'] = 'non NULL default value';
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
// }}}
|
|
|
111 |
// {{{ errorNative()
|
|
|
112 |
|
|
|
113 |
/**
|
|
|
114 |
* Get the native error code of the last error (if any) that
|
|
|
115 |
* occured on the current connection.
|
|
|
116 |
*
|
|
|
117 |
* @access public
|
|
|
118 |
*
|
|
|
119 |
* @return int native XXX error code
|
|
|
120 |
*/
|
|
|
121 |
function errorNative()
|
|
|
122 |
{
|
|
|
123 |
// take this method from the corresponding PEAR DB driver: errorNative()
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
// }}}
|
|
|
127 |
// {{{ xxxRaiseError()
|
|
|
128 |
|
|
|
129 |
/**
|
|
|
130 |
* This method is used to communicate an error and invoke error
|
|
|
131 |
* callbacks etc. Basically a wrapper for MDB::raiseError
|
|
|
132 |
* that checks for native error msgs.
|
|
|
133 |
*
|
|
|
134 |
* @param integer $errno error code
|
|
|
135 |
* @param string $message userinfo message
|
|
|
136 |
* @return object a PEAR error object
|
|
|
137 |
* @access public
|
|
|
138 |
* @see PEAR_Error
|
|
|
139 |
*/
|
|
|
140 |
function xxxRaiseError($errno = NULL, $message = NULL)
|
|
|
141 |
{
|
|
|
142 |
// take this method from the corresponding PEAR DB driver: xxxRaiseError()
|
|
|
143 |
}
|
|
|
144 |
|
|
|
145 |
// }}}
|
|
|
146 |
// {{{ autoCommit()
|
|
|
147 |
|
|
|
148 |
/**
|
|
|
149 |
* Define whether database changes done on the database be automatically
|
|
|
150 |
* committed. This function may also implicitly start or end a transaction.
|
|
|
151 |
*
|
|
|
152 |
* @param boolean $auto_commit flag that indicates whether the database
|
|
|
153 |
* changes should be committed right after
|
|
|
154 |
* executing every query statement. If this
|
|
|
155 |
* argument is 0 a transaction implicitly
|
|
|
156 |
* started. Otherwise, if a transaction is
|
|
|
157 |
* in progress it is ended by committing any
|
|
|
158 |
* database changes that were pending.
|
|
|
159 |
*
|
|
|
160 |
* @access public
|
|
|
161 |
*
|
|
|
162 |
* @return mixed MDB_OK on success, a MDB error on failure
|
|
|
163 |
*/
|
|
|
164 |
function autoCommit($auto_commit)
|
|
|
165 |
{
|
|
|
166 |
// take this from the corresponding Metabase driver: AutoCommitTransactions()
|
|
|
167 |
// the MetabaseShutdownTransactions function is handled by the PEAR desctructor
|
|
|
168 |
}
|
|
|
169 |
|
|
|
170 |
// }}}
|
|
|
171 |
// {{{ commit()
|
|
|
172 |
|
|
|
173 |
/**
|
|
|
174 |
* Commit the database changes done during a transaction that is in
|
|
|
175 |
* progress. This function may only be called when auto-committing is
|
|
|
176 |
* disabled, otherwise it will fail. Therefore, a new transaction is
|
|
|
177 |
* implicitly started after committing the pending changes.
|
|
|
178 |
*
|
|
|
179 |
* @access public
|
|
|
180 |
*
|
|
|
181 |
* @return mixed MDB_OK on success, a MDB error on failure
|
|
|
182 |
*/
|
|
|
183 |
function commit()
|
|
|
184 |
{
|
|
|
185 |
// take this from the corresponding Metabase driver: CommitTransaction()
|
|
|
186 |
}
|
|
|
187 |
|
|
|
188 |
// }}}
|
|
|
189 |
// {{{ rollback()
|
|
|
190 |
|
|
|
191 |
/**
|
|
|
192 |
* Cancel any database changes done during a transaction that is in
|
|
|
193 |
* progress. This function may only be called when auto-committing is
|
|
|
194 |
* disabled, otherwise it will fail. Therefore, a new transaction is
|
|
|
195 |
* implicitly started after canceling the pending changes.
|
|
|
196 |
*
|
|
|
197 |
* @access public
|
|
|
198 |
*
|
|
|
199 |
* @return mixed MDB_OK on success, a MDB error on failure
|
|
|
200 |
*/
|
|
|
201 |
function rollback()
|
|
|
202 |
{
|
|
|
203 |
// take this from the corresponding Metabase driver: RollbackTransaction()
|
|
|
204 |
}
|
|
|
205 |
|
|
|
206 |
// }}}
|
|
|
207 |
// {{{ connect()
|
|
|
208 |
|
|
|
209 |
/**
|
|
|
210 |
* Connect to the database
|
|
|
211 |
*
|
|
|
212 |
* @return TRUE on success, MDB_Error on failure
|
|
|
213 |
**/
|
|
|
214 |
function connect()
|
|
|
215 |
{
|
|
|
216 |
// take this from the corresponding Metabase driver: Connect() and Setup()
|
|
|
217 |
if (PEAR::isError(PEAR::loadExtension($this->phptype))) {
|
|
|
218 |
return(PEAR::raiseError(NULL, MDB_ERROR_NOT_FOUND,
|
|
|
219 |
NULL, NULL, 'extension '.$this->phptype.' is not compiled into PHP',
|
|
|
220 |
'MDB_Error', TRUE));
|
|
|
221 |
}
|
|
|
222 |
}
|
|
|
223 |
|
|
|
224 |
// }}}
|
|
|
225 |
// {{{ _close()
|
|
|
226 |
/**
|
|
|
227 |
* all the RDBMS specific things needed close a DB connection
|
|
|
228 |
*
|
|
|
229 |
* @access private
|
|
|
230 |
*
|
|
|
231 |
*/
|
|
|
232 |
function _close()
|
|
|
233 |
{
|
|
|
234 |
// take this from the corresponding Metabase driver: Close()
|
|
|
235 |
}
|
|
|
236 |
|
|
|
237 |
// }}}
|
|
|
238 |
// {{{ query()
|
|
|
239 |
|
|
|
240 |
/**
|
|
|
241 |
* Send a query to the database and return any results
|
|
|
242 |
*
|
|
|
243 |
* @access public
|
|
|
244 |
*
|
|
|
245 |
* @param string $query the SQL query
|
|
|
246 |
* @param array $types array that contains the types of the columns in
|
|
|
247 |
* the result set
|
|
|
248 |
*
|
|
|
249 |
* @return mixed a result handle or MDB_OK on success, a MDB error on failure
|
|
|
250 |
*/
|
|
|
251 |
function query($query, $types = NULL)
|
|
|
252 |
{
|
|
|
253 |
// take this from the corresponding Metabase driver: Query()
|
|
|
254 |
}
|
|
|
255 |
|
|
|
256 |
// }}}
|
|
|
257 |
// {{{ subSelect()
|
|
|
258 |
|
|
|
259 |
/**
|
|
|
260 |
* simple subselect emulation for Mysql
|
|
|
261 |
*
|
|
|
262 |
* @access public
|
|
|
263 |
*
|
|
|
264 |
* @param string $query the SQL query for the subselect that may only
|
|
|
265 |
* return a column
|
|
|
266 |
* @param string $quote determines if the data needs to be quoted before
|
|
|
267 |
* being returned
|
|
|
268 |
*
|
|
|
269 |
* @return string the query
|
|
|
270 |
*/
|
|
|
271 |
function subSelect($query, $quote = FALSE)
|
|
|
272 |
{
|
|
|
273 |
// This is a new method that only needs to be added if the RDBMS does
|
|
|
274 |
// not support sub-selects. See the MySQL driver for an example
|
|
|
275 |
}
|
|
|
276 |
|
|
|
277 |
// }}}
|
|
|
278 |
// {{{ replace()
|
|
|
279 |
|
|
|
280 |
/**
|
|
|
281 |
* Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT
|
|
|
282 |
* query, except that if there is already a row in the table with the same
|
|
|
283 |
* key field values, the REPLACE query just updates its values instead of
|
|
|
284 |
* inserting a new row.
|
|
|
285 |
*
|
|
|
286 |
* The REPLACE type of query does not make part of the SQL standards. Since
|
|
|
287 |
* practically only MySQL implements it natively, this type of query is
|
|
|
288 |
* emulated through this method for other DBMS using standard types of
|
|
|
289 |
* queries inside a transaction to assure the atomicity of the operation.
|
|
|
290 |
*
|
|
|
291 |
* @access public
|
|
|
292 |
*
|
|
|
293 |
* @param string $table name of the table on which the REPLACE query will
|
|
|
294 |
* be executed.
|
|
|
295 |
* @param array $fields associative array that describes the fields and the
|
|
|
296 |
* values that will be inserted or updated in the specified table. The
|
|
|
297 |
* indexes of the array are the names of all the fields of the table. The
|
|
|
298 |
* values of the array are also associative arrays that describe the
|
|
|
299 |
* values and other properties of the table fields.
|
|
|
300 |
*
|
|
|
301 |
* Here follows a list of field properties that need to be specified:
|
|
|
302 |
*
|
|
|
303 |
* Value:
|
|
|
304 |
* Value to be assigned to the specified field. This value may be
|
|
|
305 |
* of specified in database independent type format as this
|
|
|
306 |
* function can perform the necessary datatype conversions.
|
|
|
307 |
*
|
|
|
308 |
* Default:
|
|
|
309 |
* this property is required unless the Null property
|
|
|
310 |
* is set to 1.
|
|
|
311 |
*
|
|
|
312 |
* Type
|
|
|
313 |
* Name of the type of the field. Currently, all types Metabase
|
|
|
314 |
* are supported except for clob and blob.
|
|
|
315 |
*
|
|
|
316 |
* Default: text
|
|
|
317 |
*
|
|
|
318 |
* Null
|
|
|
319 |
* Boolean property that indicates that the value for this field
|
|
|
320 |
* should be set to NULL.
|
|
|
321 |
*
|
|
|
322 |
* The default value for fields missing in INSERT queries may be
|
|
|
323 |
* specified the definition of a table. Often, the default value
|
|
|
324 |
* is already NULL, but since the REPLACE may be emulated using
|
|
|
325 |
* an UPDATE query, make sure that all fields of the table are
|
|
|
326 |
* listed in this function argument array.
|
|
|
327 |
*
|
|
|
328 |
* Default: 0
|
|
|
329 |
*
|
|
|
330 |
* Key
|
|
|
331 |
* Boolean property that indicates that this field should be
|
|
|
332 |
* handled as a primary key or at least as part of the compound
|
|
|
333 |
* unique index of the table that will determine the row that will
|
|
|
334 |
* updated if it exists or inserted a new row otherwise.
|
|
|
335 |
*
|
|
|
336 |
* This function will fail if no key field is specified or if the
|
|
|
337 |
* value of a key field is set to NULL because fields that are
|
|
|
338 |
* part of unique index they may not be NULL.
|
|
|
339 |
*
|
|
|
340 |
* Default: 0
|
|
|
341 |
*
|
|
|
342 |
* @return mixed MDB_OK on success, a MDB error on failure
|
|
|
343 |
*/
|
|
|
344 |
function replace($table, $fields)
|
|
|
345 |
{
|
|
|
346 |
// take this from the corresponding Metabase driver: Replace()
|
|
|
347 |
}
|
|
|
348 |
|
|
|
349 |
// }}}
|
|
|
350 |
// {{{ getColumnNames()
|
|
|
351 |
|
|
|
352 |
/**
|
|
|
353 |
* Retrieve the names of columns returned by the DBMS in a query result.
|
|
|
354 |
*
|
|
|
355 |
* @param resource $result result identifier
|
|
|
356 |
* @return mixed an associative array variable
|
|
|
357 |
* that will hold the names of columns. The
|
|
|
358 |
* indexes of the array are the column names
|
|
|
359 |
* mapped to lower case and the values are the
|
|
|
360 |
* respective numbers of the columns starting
|
|
|
361 |
* from 0. Some DBMS may not return any
|
|
|
362 |
* columns when the result set does not
|
|
|
363 |
* contain any rows.
|
|
|
364 |
*
|
|
|
365 |
* a MDB error on failure
|
|
|
366 |
* @access public
|
|
|
367 |
*/
|
|
|
368 |
function getColumnNames($result)
|
|
|
369 |
{
|
|
|
370 |
// take this from the corresponding Metabase driver: GetColumnNames()
|
|
|
371 |
}
|
|
|
372 |
|
|
|
373 |
// }}}
|
|
|
374 |
// {{{ numCols()
|
|
|
375 |
|
|
|
376 |
/**
|
|
|
377 |
* Count the number of columns returned by the DBMS in a query result.
|
|
|
378 |
*
|
|
|
379 |
* @param resource $result result identifier
|
|
|
380 |
* @access public
|
|
|
381 |
* @return mixed integer value with the number of columns, a MDB error
|
|
|
382 |
* on failure
|
|
|
383 |
*/
|
|
|
384 |
function numCols($result)
|
|
|
385 |
{
|
|
|
386 |
// take this from the corresponding Metabase driver: NumberOfColumns()
|
|
|
387 |
}
|
|
|
388 |
|
|
|
389 |
// }}}
|
|
|
390 |
// {{{ endOfResult()
|
|
|
391 |
|
|
|
392 |
/**
|
|
|
393 |
* check if the end of the result set has been reached
|
|
|
394 |
*
|
|
|
395 |
* @param resource $result result identifier
|
|
|
396 |
* @return mixed TRUE or FALSE on sucess, a MDB error on failure
|
|
|
397 |
* @access public
|
|
|
398 |
*/
|
|
|
399 |
function endOfResult($result)
|
|
|
400 |
{
|
|
|
401 |
// take this from the corresponding Metabase driver: EndOfResult()
|
|
|
402 |
}
|
|
|
403 |
|
|
|
404 |
// }}}
|
|
|
405 |
// {{{ _retrieveLob()
|
|
|
406 |
|
|
|
407 |
/**
|
|
|
408 |
* fetch a float value from a result set
|
|
|
409 |
*
|
|
|
410 |
* @param int $lob handle to a lob created by the createLob() function
|
|
|
411 |
* @return mixed MDB_OK on success, a MDB error on failure
|
|
|
412 |
* @access private
|
|
|
413 |
*/
|
|
|
414 |
function _retrieveLob($lob)
|
|
|
415 |
{
|
|
|
416 |
// take this from the corresponding Metabase driver: RetrieveLOB()
|
|
|
417 |
}
|
|
|
418 |
|
|
|
419 |
// }}}
|
|
|
420 |
// {{{ endOfResultLob()
|
|
|
421 |
|
|
|
422 |
/**
|
|
|
423 |
* Determine whether it was reached the end of the large object and
|
|
|
424 |
* therefore there is no more data to be read for the its input stream.
|
|
|
425 |
*
|
|
|
426 |
* @param int $lob handle to a lob created by the createLob() function
|
|
|
427 |
* @return mixed TRUE or FALSE on success, a MDB error on failure
|
|
|
428 |
* @access public
|
|
|
429 |
*/
|
|
|
430 |
function endOfResultLob($lob)
|
|
|
431 |
{
|
|
|
432 |
// take this from the corresponding Metabase driver: EndOfResultLOB()
|
|
|
433 |
}
|
|
|
434 |
|
|
|
435 |
// }}}
|
|
|
436 |
// {{{ _readResultLob()
|
|
|
437 |
|
|
|
438 |
/**
|
|
|
439 |
* Read data from large object input stream.
|
|
|
440 |
*
|
|
|
441 |
* @param int $lob handle to a lob created by the createLob() function
|
|
|
442 |
* @param blob $data reference to a variable that will hold data to be
|
|
|
443 |
* read from the large object input stream
|
|
|
444 |
* @param int $length integer value that indicates the largest ammount of
|
|
|
445 |
* data to be read from the large object input stream.
|
|
|
446 |
* @return mixed length on success, a MDB error on failure
|
|
|
447 |
* @access private
|
|
|
448 |
*/
|
|
|
449 |
function _readResultLob($lob, &$data, $length)
|
|
|
450 |
{
|
|
|
451 |
// take this from the corresponding Metabase driver: ReadResultLOB()
|
|
|
452 |
}
|
|
|
453 |
|
|
|
454 |
// }}}
|
|
|
455 |
// {{{ _destroyResultLob()
|
|
|
456 |
|
|
|
457 |
/**
|
|
|
458 |
* Free any resources allocated during the lifetime of the large object
|
|
|
459 |
* handler object.
|
|
|
460 |
*
|
|
|
461 |
* @param int $lob handle to a lob created by the createLob() function
|
|
|
462 |
* @access private
|
|
|
463 |
*/
|
|
|
464 |
function _destroyResultLob($lob)
|
|
|
465 |
{
|
|
|
466 |
// take this from the corresponding Metabase driver: DestroyResultLOB()
|
|
|
467 |
}
|
|
|
468 |
|
|
|
469 |
// }}}
|
|
|
470 |
// {{{ fetch()
|
|
|
471 |
|
|
|
472 |
/**
|
|
|
473 |
* fetch value from a result set
|
|
|
474 |
*
|
|
|
475 |
* @param resource $result result identifier
|
|
|
476 |
* @param int $row number of the row where the data can be found
|
|
|
477 |
* @param int $field field number where the data can be found
|
|
|
478 |
* @return mixed string on success, a MDB error on failure
|
|
|
479 |
* @access public
|
|
|
480 |
*/
|
|
|
481 |
function fetch($result, $row, $field)
|
|
|
482 |
{
|
|
|
483 |
// take this from the corresponding Metabase driver: FetchResult()
|
|
|
484 |
}
|
|
|
485 |
|
|
|
486 |
// }}}
|
|
|
487 |
// {{{ fetchClob()
|
|
|
488 |
|
|
|
489 |
/**
|
|
|
490 |
* fetch a clob value from a result set
|
|
|
491 |
*
|
|
|
492 |
* @param resource $result result identifier
|
|
|
493 |
* @param int $row number of the row where the data can be found
|
|
|
494 |
* @param int $field field number where the data can be found
|
|
|
495 |
* @return mixed content of the specified data cell, a MDB error on failure,
|
|
|
496 |
* a MDB error on failure
|
|
|
497 |
* @access public
|
|
|
498 |
*/
|
|
|
499 |
function fetchClob($result, $row, $field)
|
|
|
500 |
{
|
|
|
501 |
// take this from the corresponding Metabase driver: FetchCLOB()
|
|
|
502 |
}
|
|
|
503 |
|
|
|
504 |
// }}}
|
|
|
505 |
// {{{ fetchBlob()
|
|
|
506 |
|
|
|
507 |
/**
|
|
|
508 |
* fetch a blob value from a result set
|
|
|
509 |
*
|
|
|
510 |
* @param resource $result result identifier
|
|
|
511 |
* @param int $row number of the row where the data can be found
|
|
|
512 |
* @param int $field field number where the data can be found
|
|
|
513 |
* @return mixed content of the specified data cell, a MDB error on failure
|
|
|
514 |
* @access public
|
|
|
515 |
*/
|
|
|
516 |
function fetchBlob($result, $row, $field)
|
|
|
517 |
{
|
|
|
518 |
// take this from the corresponding Metabase driver: FetchBLOB()
|
|
|
519 |
}
|
|
|
520 |
|
|
|
521 |
// }}}
|
|
|
522 |
// {{{ resultIsNull()
|
|
|
523 |
|
|
|
524 |
/**
|
|
|
525 |
* Determine whether the value of a query result located in given row and
|
|
|
526 |
* field is a NULL.
|
|
|
527 |
*
|
|
|
528 |
* @param resource $result result identifier
|
|
|
529 |
* @param int $row number of the row where the data can be found
|
|
|
530 |
* @param int $field field number where the data can be found
|
|
|
531 |
* @return mixed TRUE or FALSE on success, a MDB error on failure
|
|
|
532 |
* @access public
|
|
|
533 |
*/
|
|
|
534 |
function resultIsNull($result, $row, $field)
|
|
|
535 |
{
|
|
|
536 |
// take this from the corresponding Metabase driver: ResultIsNull()
|
|
|
537 |
}
|
|
|
538 |
|
|
|
539 |
// }}}
|
|
|
540 |
// {{{ convertResult()
|
|
|
541 |
|
|
|
542 |
/**
|
|
|
543 |
* convert a value to a RDBMS indepdenant MDB type
|
|
|
544 |
*
|
|
|
545 |
* @param mixed $value value to be converted
|
|
|
546 |
* @param int $type constant that specifies which type to convert to
|
|
|
547 |
* @return mixed converted value
|
|
|
548 |
* @access public
|
|
|
549 |
*/
|
|
|
550 |
function convertResult($value, $type)
|
|
|
551 |
{
|
|
|
552 |
// take this from the corresponding Metabase driver: ConvertResult()
|
|
|
553 |
}
|
|
|
554 |
|
|
|
555 |
// }}}
|
|
|
556 |
// {{{ numRows()
|
|
|
557 |
|
|
|
558 |
/**
|
|
|
559 |
* returns the number of rows in a result object
|
|
|
560 |
*
|
|
|
561 |
* @param ressource $result a valid result ressouce pointer
|
|
|
562 |
* @return mixed MDB_Error or the number of rows
|
|
|
563 |
* @access public
|
|
|
564 |
*/
|
|
|
565 |
function numRows($result)
|
|
|
566 |
{
|
|
|
567 |
// take this from the corresponding Metabase driver: NumberOfRows()
|
|
|
568 |
}
|
|
|
569 |
|
|
|
570 |
// }}}
|
|
|
571 |
// {{{ freeResult()
|
|
|
572 |
|
|
|
573 |
/**
|
|
|
574 |
* Free the internal resources associated with $result.
|
|
|
575 |
*
|
|
|
576 |
* @param $result result identifier
|
|
|
577 |
* @return bool TRUE on success, FALSE if $result is invalid
|
|
|
578 |
* @access public
|
|
|
579 |
*/
|
|
|
580 |
function freeResult($result)
|
|
|
581 |
{
|
|
|
582 |
// take this from the corresponding Metabase driver: FreeResult()
|
|
|
583 |
}
|
|
|
584 |
|
|
|
585 |
// }}}
|
|
|
586 |
// {{{ get*Declaration()
|
|
|
587 |
|
|
|
588 |
// take phpdoc comments from MDB common.php: get*Declaration()
|
|
|
589 |
|
|
|
590 |
function get*Declaration($name, $field)
|
|
|
591 |
{
|
|
|
592 |
// take this from the corresponding Metabase driver: Get*FieldValue()
|
|
|
593 |
}
|
|
|
594 |
|
|
|
595 |
// }}}
|
|
|
596 |
// {{{ get*Value()
|
|
|
597 |
|
|
|
598 |
/**
|
|
|
599 |
* Convert a text value into a DBMS specific format that is suitable to
|
|
|
600 |
* compose query statements.
|
|
|
601 |
*
|
|
|
602 |
* @param resource $prepared_query query handle from prepare()
|
|
|
603 |
* @param $parameter
|
|
|
604 |
* @param $clob
|
|
|
605 |
* @return string text string that represents the given argument value in
|
|
|
606 |
* a DBMS specific format.
|
|
|
607 |
* @access public
|
|
|
608 |
*/
|
|
|
609 |
function get*Value($prepared_query, $parameter, $clob)
|
|
|
610 |
{
|
|
|
611 |
// take this from the corresponding Metabase driver: Get*FieldValue()
|
|
|
612 |
}
|
|
|
613 |
|
|
|
614 |
// }}}
|
|
|
615 |
// {{{ getClobValue()
|
|
|
616 |
|
|
|
617 |
/**
|
|
|
618 |
* Convert a text value into a DBMS specific format that is suitable to
|
|
|
619 |
* compose query statements.
|
|
|
620 |
*
|
|
|
621 |
* @param resource $prepared_query query handle from prepare()
|
|
|
622 |
* @param $parameter
|
|
|
623 |
* @param $clob
|
|
|
624 |
* @return string text string that represents the given argument value in
|
|
|
625 |
* a DBMS specific format.
|
|
|
626 |
* @access public
|
|
|
627 |
*/
|
|
|
628 |
function getClobValue($prepared_query, $parameter, $clob)
|
|
|
629 |
{
|
|
|
630 |
// take this from the corresponding Metabase driver: GetCLOBFieldValue()
|
|
|
631 |
}
|
|
|
632 |
|
|
|
633 |
// }}}
|
|
|
634 |
// {{{ freeClobValue()
|
|
|
635 |
|
|
|
636 |
/**
|
|
|
637 |
* free a chracter large object
|
|
|
638 |
*
|
|
|
639 |
* @param resource $prepared_query query handle from prepare()
|
|
|
640 |
* @param string $clob
|
|
|
641 |
* @param string $value
|
|
|
642 |
* @return MDB_OK
|
|
|
643 |
* @access public
|
|
|
644 |
*/
|
|
|
645 |
function freeClobValue($prepared_query, $clob, &$value)
|
|
|
646 |
{
|
|
|
647 |
// take this from the corresponding Metabase driver: FreeClobValue()
|
|
|
648 |
}
|
|
|
649 |
|
|
|
650 |
// }}}
|
|
|
651 |
// {{{ getBlobValue()
|
|
|
652 |
|
|
|
653 |
/**
|
|
|
654 |
* Convert a text value into a DBMS specific format that is suitable to
|
|
|
655 |
* compose query statements.
|
|
|
656 |
*
|
|
|
657 |
* @param resource $prepared_query query handle from prepare()
|
|
|
658 |
* @param $parameter
|
|
|
659 |
* @param $blob
|
|
|
660 |
* @return string text string that represents the given argument value in
|
|
|
661 |
* a DBMS specific format.
|
|
|
662 |
* @access public
|
|
|
663 |
*/
|
|
|
664 |
function getBlobValue($prepared_query, $parameter, $blob)
|
|
|
665 |
{
|
|
|
666 |
// take this from the corresponding Metabase driver: GetBLOBFieldValue()
|
|
|
667 |
}
|
|
|
668 |
|
|
|
669 |
// }}}
|
|
|
670 |
// {{{ freeBlobValue()
|
|
|
671 |
|
|
|
672 |
/**
|
|
|
673 |
* free a binary large object
|
|
|
674 |
*
|
|
|
675 |
* @param resource $prepared_query query handle from prepare()
|
|
|
676 |
* @param string $blob
|
|
|
677 |
* @return MDB_OK
|
|
|
678 |
* @access public
|
|
|
679 |
*/
|
|
|
680 |
function freeBlobValue($prepared_query, $blob)
|
|
|
681 |
{
|
|
|
682 |
// take this from the corresponding Metabase driver: FreeBlobValue()
|
|
|
683 |
}
|
|
|
684 |
|
|
|
685 |
// }}}
|
|
|
686 |
// {{{ nextId()
|
|
|
687 |
|
|
|
688 |
/**
|
|
|
689 |
* returns the next free id of a sequence
|
|
|
690 |
*
|
|
|
691 |
* @param string $seq_name name of the sequence
|
|
|
692 |
* @param boolean $ondemand when true the seqence is
|
|
|
693 |
* automatic created, if it
|
|
|
694 |
* not exists
|
|
|
695 |
*
|
|
|
696 |
* @return mixed MDB_Error or id
|
|
|
697 |
* @access public
|
|
|
698 |
*/
|
|
|
699 |
function nextId($seq_name, $ondemand = FALSE)
|
|
|
700 |
{
|
|
|
701 |
// take this from the corresponding PEAR DB driver: nextId()
|
|
|
702 |
}
|
|
|
703 |
|
|
|
704 |
|
|
|
705 |
// }}}
|
|
|
706 |
// {{{ currId()
|
|
|
707 |
|
|
|
708 |
/**
|
|
|
709 |
* returns the current id of a sequence
|
|
|
710 |
*
|
|
|
711 |
* @param string $seq_name name of the sequence
|
|
|
712 |
* @return mixed MDB_Error or id
|
|
|
713 |
* @access public
|
|
|
714 |
*/
|
|
|
715 |
function currId($seq_name)
|
|
|
716 |
{
|
|
|
717 |
// take this from the corresponding Metabase driver: GetSequenceCurrentValue()
|
|
|
718 |
}
|
|
|
719 |
|
|
|
720 |
// }}}
|
|
|
721 |
// {{{ fetchInto()
|
|
|
722 |
|
|
|
723 |
/**
|
|
|
724 |
* Fetch a row and insert the data into an existing array.
|
|
|
725 |
*
|
|
|
726 |
* @param resource $result result identifier
|
|
|
727 |
* @param int $fetchmode how the array data should be indexed
|
|
|
728 |
* @param int $rownum the row number to fetch
|
|
|
729 |
* @return int data array on success, a MDB error on failure
|
|
|
730 |
* @access public
|
|
|
731 |
*/
|
|
|
732 |
function fetchInto($result, $fetchmode = MDB_FETCHMODE_DEFAULT, $rownum = 0)
|
|
|
733 |
{
|
|
|
734 |
// take this from the corresponding Metabase driver: FetchResultArray()
|
|
|
735 |
// possibly you also need to take code from Metabases FetchRow() method
|
|
|
736 |
// note Metabases FetchRow() method should not be confused with MDB's fetchRow()
|
|
|
737 |
}
|
|
|
738 |
|
|
|
739 |
// }}}
|
|
|
740 |
// {{{ nextResult()
|
|
|
741 |
|
|
|
742 |
/**
|
|
|
743 |
* Move the internal mysql result pointer to the next available result
|
|
|
744 |
* Currently not supported
|
|
|
745 |
*
|
|
|
746 |
* @param a valid result resource
|
|
|
747 |
* @return true if a result is available otherwise return false
|
|
|
748 |
* @access public
|
|
|
749 |
*/
|
|
|
750 |
function nextResult($result)
|
|
|
751 |
{
|
|
|
752 |
// take this from the corresponding PEAR DB driver: nextResult()
|
|
|
753 |
}
|
|
|
754 |
|
|
|
755 |
// }}}
|
|
|
756 |
// {{{ tableInfo()
|
|
|
757 |
|
|
|
758 |
/**
|
|
|
759 |
* returns meta data about the result set
|
|
|
760 |
*
|
|
|
761 |
* @param resource $result result identifier
|
|
|
762 |
* @param mixed $mode depends on implementation
|
|
|
763 |
* @return array an nested array, or a MDB error
|
|
|
764 |
* @access public
|
|
|
765 |
*/
|
|
|
766 |
function tableInfo($result, $mode = NULL) {
|
|
|
767 |
// take this from the corresponding PEAR DB driver: tableInfo()
|
|
|
768 |
}
|
|
|
769 |
}
|
|
|
770 |
|
|
|
771 |
?>
|