00001 <?php 00002 00003 class ODBCConnection extends MConnection 00004 { 00005 function __construct($conf) 00006 { 00007 parent::__construct($conf); 00008 } 00009 00010 function _connect($dbhost, $LoginDB, $LoginUID, $LoginPWD, $persistent = true) 00011 { 00012 if ($persistent) 00013 { 00014 $this->id = odbc_pconnect($dbhost,$LoginDB, $LoginUID); 00015 } 00016 else 00017 { 00018 $this->id = odbc_connect($dbhost,$LoginDB, $LoginUID); 00019 } 00020 } 00021 00022 function _close() 00023 { 00024 odbc_close($this->id); 00025 } 00026 00027 function _error($resource = null) 00028 { 00029 return (($error = odbc_error($this->id)) ? odbc_errormsg($this->id) : false); 00030 } 00031 00032 function _execute($sql) 00033 { 00034 if ($statement = odbc_prepare($this->id, $sql)) 00035 { 00036 if ($success = odbc_execute($statement)) 00037 { 00038 $this->affectedrows = odbc_num_rows($statement); 00039 odbc_free_result($statement); 00040 } 00041 else 00042 { 00043 $this->traceback[] = $this->_error($statement); 00044 } 00045 } 00046 else 00047 { 00048 $this->traceback[] = $this->_error(); 00049 } 00050 00051 return $success; 00052 } 00053 00054 function _createquery() 00055 { 00056 return new ODBCQuery(); 00057 } 00058 00059 function _chartotimestamp($timestamp) 00060 { 00061 return $timestamp; 00062 } 00063 00064 function _chartodate($date) 00065 { 00066 return $date; 00067 } 00068 00069 function _timestamptochar($timestamp) 00070 { 00071 return $timestamp; 00072 } 00073 00074 function _datetochar($date) 00075 { 00076 return $date; 00077 } 00078 } 00079 ?>