| 14 |
## $Id$ |
## $Id$ |
| 15 |
## -------------------------------------------------------------------------- |
## -------------------------------------------------------------------------- |
| 16 |
## $Log$ |
## $Log$ |
| 17 |
|
## Revision 1.5 2003/03/28 06:56:52 joko |
| 18 |
|
## updated logging/debugging code |
| 19 |
|
## |
| 20 |
## Revision 1.4 2003/03/28 03:00:12 joko |
## Revision 1.4 2003/03/28 03:00:12 joko |
| 21 |
## enhanced error- and exception-handling |
## enhanced error- and exception-handling |
| 22 |
## |
## |
| 141 |
//print Dumper($args); |
//print Dumper($args); |
| 142 |
if (is_array($args)) { |
if (is_array($args)) { |
| 143 |
foreach ($args as $key => $val) { |
foreach ($args as $key => $val) { |
| 144 |
|
//print "key: $key<br/>"; |
| 145 |
$key = strtoupper($key); |
$key = strtoupper($key); |
| 146 |
$this->$key = $val; |
$this->$key = $val; |
| 147 |
} |
} |
| 171 |
|
|
| 172 |
$this->log(get_class($this) . "->send: " . $command, PEAR_LOG_DEBUG); |
$this->log(get_class($this) . "->send: " . $command, PEAR_LOG_DEBUG); |
| 173 |
|
|
| 174 |
|
/* |
| 175 |
if (!$this->isConnected()) { |
if (!$this->isConnected()) { |
| 176 |
$this->_raiseException( "->send[ command=$command ]: not connected while trying to send command!"); |
$this->_raiseException( "->send[ command=$command ]: not connected while trying to send command!"); |
| 177 |
return; |
return; |
| 178 |
} |
} |
| 179 |
|
*/ |
| 180 |
|
|
| 181 |
// do 'encode' here and ... |
// do 'encode' here and ... |
| 182 |
if ($options[utf8]) { |
if ($options[utf8]) { |
| 278 |
|
|
| 279 |
function _raiseException($message, $code = null) { |
function _raiseException($message, $code = null) { |
| 280 |
|
|
| 281 |
|
$classname = get_class($this); |
| 282 |
|
|
| 283 |
// aggregate errors for this run/query |
// aggregate errors for this run/query |
| 284 |
$this->_add_error($message, $code); |
$this->_add_error($classname . $message, $code); |
| 285 |
|
|
| 286 |
// spout out the error message of the raised exception |
// spout out the error message of the raised exception |
| 287 |
$this->log(get_class($this) . $message, PEAR_LOG_ERR); |
$this->log($classname . $message, PEAR_LOG_ERR); |
| 288 |
|
|
| 289 |
// handle some stuff regarding more special behaviour (will this get rule-based sometimes?) |
// handle some stuff regarding more special behaviour (will this get rule-based sometimes?) |
| 290 |
|
|
| 292 |
$connect_condition = $this->FORCE_CONNECT = ($this->isConnected() && $this->DISCONNECT_ON_ERROR); |
$connect_condition = $this->FORCE_CONNECT = ($this->isConnected() && $this->DISCONNECT_ON_ERROR); |
| 293 |
if ($connect_condition) { |
if ($connect_condition) { |
| 294 |
$message = '->_raiseException: [DISCONNECT_ON_ERROR] done transparently. Please reconnect manually.'; |
$message = '->_raiseException: [DISCONNECT_ON_ERROR] done transparently. Please reconnect manually.'; |
| 295 |
$this->_add_error($message, $code); |
$this->_add_error($classname . $message, $code); |
| 296 |
//$this->log(get_class($this) . $message, PEAR_LOG_WARNING); |
//$this->log($classname . $message, PEAR_LOG_WARNING); |
| 297 |
$this->log(get_class($this) . $message, PEAR_LOG_ERR); |
$this->log($classname . $message, PEAR_LOG_ERR); |
| 298 |
$this->meta[connected] = 0; |
$this->meta[connected] = 0; |
| 299 |
$this->_save_meta(); |
$this->_save_meta(); |
| 300 |
} |
} |