OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / include / mos / class / database.php
1 <?php
2 /**
3 * @version              $Id: database.php 1982 2009-06-15 06:59:55Z fishbone $
4 * @package              Joomla.Framework
5 * @subpackage   Database
6 * @copyright    Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
7 * @license              GNU/GPL, see LICENSE.php
8 * Joomla! is free software. This version may have been modified pursuant
9 * to the GNU General Public License, and as distributed it includes or
10 * is derivative of works licensed under the GNU General Public License or
11 * other free or open source software licenses.
12 * See COPYRIGHT.php for copyright notices and details.
13 */
14
15 // Check to ensure this file is within the rest of the framework
16 //defined('JPATH_BASE') or die();
17
18 /**
19  * Database connector class
20  *
21  * @abstract
22  * @package             Joomla.Framework
23  * @subpackage  Database
24  * @since               1.0
25  */
26 class JDatabase extends JObject
27 {
28         /**
29          * The database driver name
30          *
31          * @var string
32          */
33         var $name                       = '';
34
35         /**
36          * The query sql string
37          *
38          * @var string
39          **/
40         var $_sql                       = '';
41
42         /**
43          * The database error number
44          *
45          * @var int
46          **/
47         var $_errorNum          = 0;
48
49         /**
50          * The database error message
51          *
52          * @var string
53          */
54         var $_errorMsg          = '';
55
56         /**
57          * The prefix used on all database tables
58          *
59          * @var string
60          */
61         var $_table_prefix      = '';
62
63         /**
64          * The connector resource
65          *
66          * @var resource
67          */
68         var $_resource          = '';
69
70         /**
71          * The last query cursor
72          *
73          * @var resource
74          */
75         var $_cursor            = null;
76
77         /**
78          * Debug option
79          *
80          * @var boolean
81          */
82         var $_debug                     = 0;
83
84         /**
85          * The limit for the query
86          *
87          * @var int
88          */
89         var $_limit                     = 0;
90
91         /**
92          * The for offset for the limit
93          *
94          * @var int
95          */
96         var $_offset            = 0;
97
98         /**
99          * The number of queries performed by the object instance
100          *
101          * @var int
102          */
103         var $_ticker            = 0;
104
105         /**
106          * A log of queries
107          *
108          * @var array
109          */
110         var $_log                       = null;
111
112         /**
113          * The null/zero date string
114          *
115          * @var string
116          */
117         var $_nullDate          = null;
118
119         /**
120          * Quote for named objects
121          *
122          * @var string
123          */
124         var $_nameQuote         = null;
125
126         /**
127          * UTF-8 support
128          *
129          * @var boolean
130          * @since       1.5
131          */
132         //var $_utf                     = 0;
133         var $_utf                       = 1;
134
135         /**
136          * The fields that are to be quote
137          *
138          * @var array
139          * @since       1.5
140          */
141         var $_quoted    = null;
142
143         /**
144          *  Legacy compatibility
145          *
146          * @var bool
147          * @since       1.5
148          */
149         var $_hasQuoted = null;
150
151         /**
152         * Database object constructor
153         *
154         * @access       public
155         * @param        array   List of options used to configure the connection
156         * @since        1.5
157         */
158         function __construct( $options )
159         {
160                 $prefix         = array_key_exists('prefix', $options)  ? $options['prefix']    : 'jos_';
161
162                 // Determine utf-8 support
163         //      $this->_utf = $this->hasUTF();
164
165                 //Set charactersets (needed for MySQL 4.1.2+)
166 /*              if ($this->_utf){
167                         $this->setUTF();
168                 }*/
169
170                 $this->_table_prefix    = $prefix;
171                 $this->_ticker                  = 0;
172                 $this->_errorNum                = 0;
173                 $this->_log                             = array();
174                 $this->_quoted                  = array();
175                 $this->_hasQuoted               = false;
176
177                 // Register faked "destructor" in PHP4 to close all connections we might have made
178                 if (version_compare(PHP_VERSION, '5') == -1) {
179                         register_shutdown_function(array(&$this, '__destruct'));
180                 }
181         }
182
183         /**
184          * Returns a reference to the global Database object, only creating it
185          * if it doesn't already exist.
186          *
187          * The 'driver' entry in the parameters array specifies the database driver
188          * to be used (defaults to 'mysql' if omitted). All other parameters are
189          * database driver dependent.
190          *
191          * @param array Parameters to be passed to the database driver
192          * @return JDatabase A database object
193          * @since 1.5
194         */
195         function &getInstance( $options = array() )
196         {
197                 static $instances;
198
199                 if (!isset( $instances )) {
200                         $instances = array();
201                 }
202
203                 $signature = serialize( $options );
204
205                 if (empty($instances[$signature]))
206                 {
207                 /*
208                         $driver         = array_key_exists('driver', $options)          ? $options['driver']    : 'mysql';
209                         $select         = array_key_exists('select', $options)          ? $options['select']    : true;
210                         $database       = array_key_exists('database', $options)        ? $options['database']  : null;
211
212                         $driver = preg_replace('/[^A-Z0-9_\.-]/i', '', $driver);
213                         $path   = dirname(__FILE__).DS.'database'.DS.$driver.'.php';
214
215                         if (file_exists($path)) {
216                                 require_once($path);
217                         } else {
218                                 JError::setErrorHandling(E_ERROR, 'die'); //force error type to die
219                                 $error = JError::raiseError( 500, JTEXT::_('Unable to load Database Driver:') .$driver);
220                                 return $error;
221                         }
222
223                         $adapter        = 'JDatabase'.$driver;
224                         $instance       = new $adapter($options);
225
226                         if ( $error = $instance->getErrorMsg() )
227                         {
228                                 JError::setErrorHandling(E_ERROR, 'ignore'); //force error type to die
229                                 $error = JError::raiseError( 500, JTEXT::_('Unable to connect to the database:') .$error);
230                                 return $error;
231                         }
232
233
234                         $instances[$signature] = & $instance;
235                         */
236                         $instances[$signature] = new JDatabase($options);
237                 }
238
239                 return $instances[$signature];
240         }
241
242         /**
243          * Database object destructor
244          *
245          * @abstract
246          * @access private
247          * @return boolean
248          * @since 1.5
249          */
250         function __destruct()
251         {
252                 return true;
253         }
254
255         /**
256          * Get the database connectors
257          *
258          * @access public
259          * @return array An array of available session handlers
260          */
261         function getConnectors()
262         {
263                 /*
264                 jimport('joomla.filesystem.folder');
265                 $handlers = JFolder::files(dirname(__FILE__).DS.'database', '.php$');
266
267                 $names = array();
268                 foreach($handlers as $handler)
269                 {
270                         $name = substr($handler, 0, strrpos($handler, '.'));
271                         $class = 'JDatabase'.ucfirst($name);
272
273                         if(!class_exists($class)) {
274                                 require_once(dirname(__FILE__).DS.'database'.DS.$name.'.php');
275                         }
276
277                         if(call_user_func_array( array( trim($class), 'test' ), null)) {
278                                 $names[] = $name;
279                         }
280                 }
281                 return $names;
282                 */
283                 return array();
284         }
285
286         /**
287          * Test to see if the MySQLi connector is available
288          *
289          * @static
290          * @access public
291          * @return boolean  True on success, false otherwise.
292          */
293         /*function test()
294         {
295                 return false;
296         }*?
297
298         /**
299          * Determines if the connection to the server is active.
300          *
301          * @access      public
302          * @return      boolean
303          * @since       1.5
304          */
305         /*function connected()
306         {
307                 return false;
308         }*/
309
310         /**
311          * Determines UTF support
312          *
313          * @abstract
314          * @access public
315          * @return boolean
316          * @since 1.5
317          */
318         /*function hasUTF() {
319                 return false;
320         }*/
321
322         /**
323          * Custom settings for UTF support
324          *
325          * @abstract
326          * @access public
327          * @since 1.5
328          */
329         /*function setUTF() {
330         }*/
331
332         /**
333          * Adds a field or array of field names to the list that are to be quoted
334          *
335          * @access public
336          * @param mixed Field name or array of names
337          * @since 1.5
338          */
339         function addQuoted( $quoted )
340         {
341                 if (is_string( $quoted )) {
342                         $this->_quoted[] = $quoted;
343                 } else {
344                         $this->_quoted = array_merge( $this->_quoted, (array)$quoted );
345                 }
346                 $this->_hasQuoted = true;
347         }
348
349         /**
350          * Splits a string of queries into an array of individual queries
351          *
352          * @access public
353          * @param string The queries to split
354          * @return array queries
355          */
356         function splitSql( $queries )
357         {
358                 $start = 0;
359                 $open = false;
360                 $open_char = '';
361                 $end = strlen($queries);
362                 $query_split = array();
363                 for($i=0;$i<$end;$i++) {
364                         $current = substr($queries,$i,1);
365                         if(($current == '"' || $current == '\'')) {
366                                 $n = 2;
367                                 while(substr($queries,$i - $n + 1, 1) == '\\' && $n < $i) {
368                                         $n ++;
369                                 }
370                                 if($n%2==0) {
371                                         if ($open) {
372                                                 if($current == $open_char) {
373                                                         $open = false;
374                                                         $open_char = '';
375                                                 }
376                                         } else {
377                                                 $open = true;
378                                                 $open_char = $current;
379                                         }
380                                 }
381                         }
382                         if(($current == ';' && !$open)|| $i == $end - 1) {
383                                 $query_split[] = substr($queries, $start, ($i - $start + 1));
384                                 $start = $i + 1;
385                         }
386                 }
387
388                 return $query_split;
389         }
390
391
392
393         /**
394          * Checks if field name needs to be quoted
395          *
396          * @access public
397          * @param string The field name
398          * @return bool
399          */
400         function isQuoted( $fieldName )
401         {
402                 if ($this->_hasQuoted) {
403                         return in_array( $fieldName, $this->_quoted );
404                 } else {
405                         return true;
406                 }
407         }
408
409         /**
410          * Sets the debug level on or off
411          *
412          * @access public
413          * @param int 0 = off, 1 = on
414          */
415         function debug( $level ) {
416                 $this->_debug = intval( $level );
417         }
418
419         /**
420          * Get the database UTF-8 support
421          *
422          * @access public
423          * @return boolean
424          * @since 1.5
425          */
426         function getUTFSupport() {
427                 return $this->_utf;
428         }
429
430         /**
431          * Get the error number
432          *
433          * @access public
434          * @return int The error number for the most recent query
435          */
436         function getErrorNum() {
437                 return $this->_errorNum;
438         }
439
440
441         /**
442          * Get the error message
443          *
444          * @access public
445          * @return string The error message for the most recent query
446          */
447         function getErrorMsg($escaped = false)
448         {
449                 if($escaped) {
450                         return addslashes($this->_errorMsg);
451                 } else {
452                         return $this->_errorMsg;
453                 }
454         }
455
456         /**
457          * Get a database escaped string
458          *
459          * @param       string  The string to be escaped
460          * @param       boolean Optional parameter to provide extra escaping
461          * @return      string
462          * @access      public
463          * @abstract
464          */
465         function getEscaped( $text, $extra = false )
466         {
467                 return;
468         }
469
470         /**
471          * Get a database error log
472          *
473          * @access public
474          * @return array
475          */
476         function getLog( )
477         {
478                 return $this->_log;
479         }
480
481         /**
482          * Get the total number of queries made
483          *
484          * @access public
485          * @return array
486          */
487         function getTicker( )
488         {
489                 return $this->_ticker;
490         }
491
492         /**
493          * Quote an identifier name (field, table, etc)
494          *
495          * @access      public
496          * @param       string  The name
497          * @return      string  The quoted name
498          */
499         function nameQuote( $s )
500         {
501                 // Only quote if the name is not using dot-notation
502                 if (strpos( $s, '.' ) === false)
503                 {
504                         $q = $this->_nameQuote;
505                         if (strlen( $q ) == 1) {
506                                 return $q . $s . $q;
507                         } else {
508                                 return $q{0} . $s . $q{1};
509                         }
510                 }
511                 else {
512                         return $s;
513                 }
514         }
515         /**
516          * Get the database table prefix
517          *
518          * @access public
519          * @return string The database prefix
520          */
521         function getPrefix()
522         {
523                 return $this->_table_prefix;
524         }
525
526         /**
527          * Get the database null date
528          *
529          * @access public
530          * @return string Quoted null/zero date string
531          */
532         function getNullDate()
533         {
534                 return $this->_nullDate;
535         }
536
537         /**
538          * Sets the SQL query string for later execution.
539          *
540          * This function replaces a string identifier <var>$prefix</var> with the
541          * string held is the <var>_table_prefix</var> class variable.
542          *
543          * @access public
544          * @param string The SQL query
545          * @param string The offset to start selection
546          * @param string The number of results to return
547          * @param string The common table prefix
548          */
549         function setQuery( $sql, $offset = 0, $limit = 0, $prefix='#__' )
550         {
551                 $this->_sql             = $this->replacePrefix( $sql, $prefix );
552                 $this->_limit   = (int) $limit;
553                 $this->_offset  = (int) $offset;
554         }
555
556         /**
557          * This function replaces a string identifier <var>$prefix</var> with the
558          * string held is the <var>_table_prefix</var> class variable.
559          *
560          * @access public
561          * @param string The SQL query
562          * @param string The common table prefix
563          */
564         function replacePrefix( $sql, $prefix='#__' )
565         {
566                 $sql = trim( $sql );
567
568                 $escaped = false;
569                 $quoteChar = '';
570
571                 $n = strlen( $sql );
572
573                 $startPos = 0;
574                 $literal = '';
575                 while ($startPos < $n) {
576                         $ip = strpos($sql, $prefix, $startPos);
577                         if ($ip === false) {
578                                 break;
579                         }
580
581                         $j = strpos( $sql, "'", $startPos );
582                         $k = strpos( $sql, '"', $startPos );
583                         if (($k !== FALSE) && (($k < $j) || ($j === FALSE))) {
584                                 $quoteChar      = '"';
585                                 $j                      = $k;
586                         } else {
587                                 $quoteChar      = "'";
588                         }
589
590                         if ($j === false) {
591                                 $j = $n;
592                         }
593
594                         $literal .= str_replace( $prefix, $this->_table_prefix,substr( $sql, $startPos, $j - $startPos ) );
595                         $startPos = $j;
596
597                         $j = $startPos + 1;
598
599                         if ($j >= $n) {
600                                 break;
601                         }
602
603                         // quote comes first, find end of quote
604                         while (TRUE) {
605                                 $k = strpos( $sql, $quoteChar, $j );
606                                 $escaped = false;
607                                 if ($k === false) {
608                                         break;
609                                 }
610                                 $l = $k - 1;
611                                 while ($l >= 0 && $sql{$l} == '\\') {
612                                         $l--;
613                                         $escaped = !$escaped;
614                                 }
615                                 if ($escaped) {
616                                         $j      = $k+1;
617                                         continue;
618                                 }
619                                 break;
620                         }
621                         if ($k === FALSE) {
622                                 // error in the query - no end quote; ignore it
623                                 break;
624                         }
625                         $literal .= substr( $sql, $startPos, $k - $startPos + 1 );
626                         $startPos = $k+1;
627                 }
628                 if ($startPos < $n) {
629                         $literal .= substr( $sql, $startPos, $n - $startPos );
630                 }
631                 return $literal;
632         }
633
634         /**
635          * Get the active query
636          *
637          * @access public
638          * @return string The current value of the internal SQL vairable
639          */
640         function getQuery()
641         {
642                 return $this->_sql;
643         }
644
645         /**
646          * Execute the query
647          *
648          * @abstract
649          * @access public
650          * @return mixed A database resource if successful, FALSE if not.
651          */
652         function query()
653         {
654                 return;
655         }
656
657         /**
658          * Get the affected rows by the most recent query
659          *
660          * @abstract
661          * @access public
662          * @return int The number of affected rows in the previous operation
663          * @since 1.0.5
664          */
665         function getAffectedRows()
666         {
667                 return;
668         }
669
670         /**
671         * Execute a batch query
672         *
673         * @abstract
674         * @access public
675         * @return mixed A database resource if successful, FALSE if not.
676         */
677         function queryBatch( $abort_on_error=true, $p_transaction_safe = false)
678         {
679                 return false;
680         }
681
682         /**
683          * Diagnostic function
684          *
685          * @abstract
686          * @access public
687          */
688         function explain()
689         {
690                 return;
691         }
692
693         /**
694          * Get the number of rows returned by the most recent query
695          *
696          * @abstract
697          * @access public
698          * @param object Database resource
699          * @return int The number of rows
700          */
701         function getNumRows( $cur=null )
702         {
703                 return;
704         }
705
706         /**
707          * This method loads the first field of the first row returned by the query.
708          *
709          * @abstract
710          * @access public
711          * @return The value returned in the query or null if the query failed.
712          */
713         function loadResult()
714         {
715                 return;
716         }
717
718         /**
719          * Load an array of single field results into an array
720          *
721          * @abstract
722          */
723         function loadResultArray($numinarray = 0)
724         {
725                 return;
726         }
727
728         /**
729         * Fetch a result row as an associative array
730         *
731         * @abstract
732         */
733         function loadAssoc()
734         {
735                 return;
736         }
737
738         /**
739          * Load a associactive list of database rows
740          *
741          * @abstract
742          * @access public
743          * @param string The field name of a primary key
744          * @return array If key is empty as sequential list of returned records.
745          */
746         function loadAssocList( $key='' )
747         {
748                 return;
749         }
750
751         /**
752          * This global function loads the first row of a query into an object
753          *
754          *
755          * @abstract
756          * @access public
757          * @param object
758          */
759         function loadObject( )
760         {
761                 return;
762         }
763
764         /**
765         * Load a list of database objects
766         *
767         * @abstract
768         * @access public
769         * @param string The field name of a primary key
770         * @return array If <var>key</var> is empty as sequential list of returned records.
771
772         * If <var>key</var> is not empty then the returned array is indexed by the value
773         * the database key.  Returns <var>null</var> if the query fails.
774         */
775         function loadObjectList( $key='' )
776         {
777                 return;
778         }
779
780         /**
781          * Load the first row returned by the query
782          *
783          * @abstract
784          * @access public
785          * @return The first row of the query.
786          */
787         function loadRow()
788         {
789                 return;
790         }
791
792         /**
793         * Load a list of database rows (numeric column indexing)
794         *
795         * If <var>key</var> is not empty then the returned array is indexed by the value
796         * the database key.  Returns <var>null</var> if the query fails.
797         *
798         * @abstract
799         * @access public
800         * @param string The field name of a primary key
801         * @return array
802         */
803         function loadRowList( $key='' )
804         {
805                 return;
806         }
807
808         /**
809          * Inserts a row into a table based on an objects properties
810          * @param       string  The name of the table
811          * @param       object  An object whose properties match table fields
812          * @param       string  The name of the primary key. If provided the object property is updated.
813          */
814         function insertObject( $table, &$object, $keyName = NULL )
815         {
816                 return;
817         }
818
819         /**
820          * Update an object in the database
821          *
822          * @abstract
823          * @access public
824          * @param string
825          * @param object
826          * @param string
827          * @param boolean
828          */
829         function updateObject( $table, &$object, $keyName, $updateNulls=true )
830         {
831                 return;
832         }
833
834         /**
835          * Print out an error statement
836          *
837          * @param boolean If TRUE, displays the last SQL statement sent to the database
838          * @return string A standised error message
839          */
840         function stderr( $showSQL = false )
841         {
842                 if ( $this->_errorNum != 0 ) {
843                         return "DB function failed with error number $this->_errorNum"
844                         ."<br /><font color=\"red\">$this->_errorMsg</font>"
845                         .($showSQL ? "<br />SQL = <pre>$this->_sql</pre>" : '');
846                 } else {
847                         return "DB function reports no errors";
848                 }
849         }
850
851         /**
852          * Get the ID generated from the previous INSERT operation
853          *
854          * @abstract
855          * @access public
856          * @return mixed
857          */
858         function insertid()
859         {
860                 return;
861         }
862
863         /**
864          * Get the database collation
865          *
866          * @abstract
867          * @access public
868          * @return string Collation in use
869          */
870         function getCollation()
871         {
872                 return;
873         }
874
875         /**
876          * Get the version of the database connector
877          *
878          * @abstract
879          */
880         function getVersion()
881         {
882                 return 'Not available for this connector';
883         }
884
885         /**
886          * List tables in a database
887          *
888          * @abstract
889          * @access public
890          * @return array A list of all the tables in the database
891          */
892         function getTableList()
893         {
894                 return;
895         }
896
897         /**
898          * Shows the CREATE TABLE statement that creates the given tables
899          *
900          * @abstract
901          * @access      public
902          * @param       array|string    A table name or a list of table names
903          * @return      array A list the create SQL for the tables
904          */
905         function getTableCreate( $tables )
906         {
907                 return;
908         }
909
910         /**
911          * Retrieves information about the given tables
912          *
913          * @abstract
914          * @access      public
915          * @param       array|string    A table name or a list of table names
916          * @param       boolean                 Only return field types, default true
917          * @return      array An array of fields by table
918          */
919         function getTableFields( $tables, $typeonly = true )
920         {
921                 return;
922         }
923
924         // ----
925         // ADODB Compatibility Functions
926         // ----
927
928         /**
929         * Get a quoted database escaped string
930         *
931         * @param        string  A string
932         * @param        boolean Default true to escape string, false to leave the string unchanged
933         * @return       string
934         * @access public
935         */
936         function Quote( $text, $escaped = true )
937         {
938                 return '\''.($escaped ? $this->getEscaped( $text ) : $text).'\'';
939         }
940
941         /**
942          * ADODB compatability function
943          *
944          * @access      public
945          * @param       string SQL
946          * @since       1.5
947          */
948         function GetCol( $query )
949         {
950                 $this->setQuery( $query );
951                 return $this->loadResultArray();
952         }
953
954         /**
955          * ADODB compatability function
956          *
957          * @access      public
958          * @param       string SQL
959          * @return      object
960          * @since       1.5
961          */
962         function Execute( $query )
963         {
964                 jimport( 'joomla.database.recordset' );
965
966                 $query = trim( $query );
967                 $this->setQuery( $query );
968                 if (eregi( '^select', $query )) {
969                         $result = $this->loadRowList();
970                         return new JRecordSet( $result );
971                 } else {
972                         $result = $this->query();
973                         if ($result === false) {
974                                 return false;
975                         } else {
976                                 return new JRecordSet( array() );
977                         }
978                 }
979         }
980
981         /**
982          * ADODB compatability function
983          *
984          * @access public
985          * @since 1.5
986          */
987         function SelectLimit( $query, $count, $offset=0 )
988         {
989                 jimport( 'joomla.database.recordset' );
990
991                 $this->setQuery( $query, $offset, $count );
992                 $result = $this->loadRowList();
993                 return new JRecordSet( $result );
994         }
995
996         /**
997          * ADODB compatability function
998          *
999          * @access public
1000          * @since 1.5
1001          */
1002         function PageExecute( $sql, $nrows, $page, $inputarr=false, $secs2cache=0 )
1003         {
1004                 jimport( 'joomla.database.recordset' );
1005
1006                 $this->setQuery( $sql, $page*$nrows, $nrows );
1007                 $result = $this->loadRowList();
1008                 return new JRecordSet( $result );
1009         }
1010         /**
1011          * ADODB compatability function
1012          *
1013          * @access public
1014          * @param string SQL
1015          * @return array
1016          * @since 1.5
1017          */
1018         function GetRow( $query )
1019         {
1020                 $this->setQuery( $query );
1021                 $result = $this->loadRowList();
1022                 return $result[0];
1023         }
1024
1025         /**
1026          * ADODB compatability function
1027          *
1028          * @access public
1029          * @param string SQL
1030          * @return mixed
1031          * @since 1.5
1032          */
1033         function GetOne( $query )
1034         {
1035                 $this->setQuery( $query );
1036                 $result = $this->loadResult();
1037                 return $result;
1038         }
1039
1040         /**
1041          * ADODB compatability function
1042          *
1043          * @since 1.5
1044          */
1045         function BeginTrans()
1046         {
1047         }
1048
1049         /**
1050          * ADODB compatability function
1051          *
1052          * @since 1.5
1053          */
1054         function RollbackTrans()
1055         {
1056         }
1057
1058         /**
1059          * ADODB compatability function
1060          *
1061          * @since 1.5
1062          */
1063         function CommitTrans()
1064         {
1065         }
1066
1067         /**
1068          * ADODB compatability function
1069          *
1070          * @since 1.5
1071          */
1072         function ErrorMsg()
1073         {
1074                 return $this->getErrorMsg();
1075         }
1076
1077         /**
1078          * ADODB compatability function
1079          *
1080          * @since 1.5
1081          */
1082         function ErrorNo()
1083         {
1084                 return $this->getErrorNum();
1085         }
1086
1087         /**
1088          * ADODB compatability function
1089          *
1090          * @since 1.5
1091          */
1092         function GenID( $foo1=null, $foo2=null )
1093         {
1094                 return '0';
1095         }
1096 }