/usr/local/miolo2/classes/database/firebird/mconnection.class

Go to the documentation of this file.
00001 <?php
00006 class FirebirdConnection extends MConnection
00007 {
00017     function __construct($conf)
00018     {
00019         parent::__construct($conf);
00020     }
00021 
00036     function _connect($dbhost, $LoginDB, $LoginUID, $LoginPWD, $persistent = true, $parameters = null)
00037     {
00038         $buffers = (isset($parameters['buffers'])) ? ($parameters['buffers']) : (null);
00039         $characterset = (isset($parameters['characterset'])) ? ($parameters['characterset']) : (null);
00040         $dialect = (isset($parameters['dialect'])) ? ($parameters['dialect']) : (null);
00041         $role = (isset($parameters['role'])) ? ($parameters['role']) : (null);
00042 
00043         if (false && $persistent)
00044         {
00045             $this->id = ibase_pconnect($LoginDB, $LoginUID, $LoginPWD, $characterset, $buffers, $dialect, $role);
00046         }
00047         else
00048         {
00049             $this->id = ibase_connect($LoginDB, $LoginUID, $LoginPWD, $characterset, $buffers, $dialect, $role);
00050         }
00051     }
00052 
00060     function _close()
00061     {
00062         ibase_close ($this->id);
00063     }
00064 
00074     function _error($resource = null)
00075     {
00076         return ibase_errmsg();
00077     }
00078 
00088     function _parse(&$sql)
00089     {
00090         $sql = preg_replace("/:((.+) /", "\?", $sql);
00091         $statement = ibase_prepare($this->id, $sql);
00092         return $statement;
00093     }
00094 
00106     function _bind($stmt, $ph, $pv)
00107     {
00108     }
00109 
00119     function _execute($sql)
00120     {
00121         $prepared = ibase_prepare($this->id, $sql);
00122 
00123         if ($prepared)
00124         {
00125             $rs = ibase_execute($prepared);
00126             $success = false;
00127 
00128             if ($rs)
00129             {
00130                 $success = true;
00131                 $this->affectedrows = ibase_affected_rows($this->id);
00132                 ibase_free_result ($rs);
00133             }
00134             else
00135             {
00136                 $this->traceback[] = $this->_error($this->id);
00137             }
00138         }
00139         else
00140         {
00141             $this->traceback[] = $this->_error($this->id);
00142         }
00143 
00144         return $success;
00145     }
00146 
00154     function _createquery()
00155     {
00156         return new FirebirdQuery();
00157     }
00158 
00168     function _chartotimestamp($timestamp)
00169     {
00170         return "'" . substr($timestamp, 7, 4) . '/' . substr($timestamp, 4, 2) . '/' . substr($timestamp, 1, 2) . ' ' . substr($timestamp, 11);
00171     }
00172 
00182     function _chartodate($date)
00183     {
00184         return $date;
00185     }
00186 
00196     function _timestamptochar($timestamp)
00197     {
00198         return $timestamp;
00199     }
00200 
00210     function _datetochar($date)
00211     {
00212         return $date;
00213     }
00214 }
00215 ?>
CopyLeft (L) 2001-2006 - [MIOLO Development Team] SOLIS - Cooperativa de Soluções Livres - Lajeado/RS - Brasil