00001 <?php 00006 class Oracle8Connection extends MConnection 00007 { 00011 var $executemode = OCI_COMMIT_ON_SUCCESS; 00012 00022 function __construct($conf) 00023 { 00024 parent::__construct($conf); 00025 } 00026 00040 function _connect($dbhost, $LoginDB, $LoginUID, $LoginPWD, $persistent = true) 00041 { 00042 if ($persistent) 00043 { 00044 $this->id = OCIPLogon($LoginUID, $LoginPWD, $LoginDB); 00045 } 00046 else 00047 { 00048 $this->id = OCILogon($LoginUID, $LoginPWD, $LoginDB); 00049 } 00050 } 00051 00059 function _close() 00060 { 00061 OCILogOff ($this->id); 00062 } 00063 00073 function _error($resource = null) 00074 { 00075 $err = oci_error($resource ? $resource : $this->id); 00076 return ($err ? $err['message'] : false); 00077 } 00078 00088 function _parse($sql) 00089 { 00090 $statement = oci_parse($this->id, $sql); 00091 return $statement; 00092 } 00093 00105 function _bind($stmt, $ph, $pv) 00106 { 00107 ocibindbyname($stmt, $ph, $pv); 00108 } 00109 00119 function _execute($sql) 00120 { 00121 if ($statement = oci_parse($this->id, $sql)) 00122 { 00123 if ($success = oci_execute($statement, $this->executemode)) 00124 { 00125 $this->affectedrows = oci_num_rows($statement); 00126 oci_free_statement ($statement); 00127 } 00128 else 00129 { 00130 $this->traceback[] = $this->_error($statement); 00131 } 00132 } 00133 else 00134 { 00135 $this->traceback[] = $this->_error(); 00136 } 00137 00138 return $success; 00139 } 00140 00148 function _createquery() 00149 { 00150 return new Oracle8Query(); 00151 } 00152 00162 function _chartotimestamp($timestamp, $format='DD/MM/YYYY HH24:MI:SS') 00163 { 00164 return ":TO_DATE('" . $timestamp . "','$format') "; 00165 } 00166 00176 function _chartodate($date, $format='DD/MM/YYYY') 00177 { 00178 return ":TO_DATE('" . $date . "','$format') "; 00179 } 00180 00190 function _timestamptochar($timestamp, $format='DD/MM/YYYY HH24:MI:SS') 00191 { 00192 return "TO_CHAR($timestamp,'$format') "; 00193 } 00194 00204 function _datetochar($date, $format='DD/MM/YYYY') 00205 { 00206 return "TO_CHAR($date,'$format') "; 00207 } 00208 } 00209 ?>