Skip to content

Commit 8eea785

Browse files
committed
Merge pull request #298 from dave-swift/master
Swapped trigger_error for exceptions
2 parents 47461b1 + 483efad commit 8eea785

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

MysqliDb.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ protected function _buildLimit ($numRows) {
11891189
protected function _prepareQuery()
11901190
{
11911191
if (!$stmt = $this->mysqli()->prepare($this->_query)) {
1192-
trigger_error("Problem preparing query ($this->_query) " . $this->mysqli()->error, E_USER_ERROR);
1192+
throw new Exception("Problem preparing query ($this->_query) " . $this->mysqli()->error);
11931193
}
11941194
if ($this->traceEnabled)
11951195
$this->traceStartQ = microtime (true);
@@ -1314,7 +1314,7 @@ public function interval ($diff, $func = "NOW()") {
13141314
if (!empty ($matches[2])) $items = $matches[2];
13151315
if (!empty ($matches[3])) $type = $matches[3];
13161316
if (!in_array($type, array_keys($types)))
1317-
trigger_error ("invalid interval type in '{$diff}'");
1317+
throw new Exception("invalid interval type in '{$diff}'");
13181318
$func .= " ".$incr ." interval ". $items ." ".$types[$type] . " ";
13191319
}
13201320
return $func;
@@ -1341,7 +1341,7 @@ public function now ($diff = null, $func = "NOW()") {
13411341
*/
13421342
public function inc($num = 1) {
13431343
if(!is_numeric($num)){
1344-
trigger_error('Argument supplied to inc must be a number', E_USER_ERROR);
1344+
throw new Exception('Argument supplied to inc must be a number');
13451345
}
13461346
return Array ("[I]" => "+" . $num);
13471347
}
@@ -1352,7 +1352,7 @@ public function inc($num = 1) {
13521352
*/
13531353
public function dec ($num = 1) {
13541354
if(!is_numeric($num)){
1355-
trigger_error('Argument supplied to dec must be a number', E_USER_ERROR);
1355+
throw new Exception('Argument supplied to dec must be a number');
13561356
}
13571357
return Array ("[I]" => "-" . $num);
13581358
}
@@ -1487,4 +1487,3 @@ public function tableExists ($tables) {
14871487
return $this->count == $count;
14881488
}
14891489
} // END class
1490-
?>

dbObject.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,4 +688,3 @@ public static function autoload ($path = null) {
688688
spl_autoload_register ("dbObject::dbObjectAutoload");
689689
}
690690
}
691-
?>

0 commit comments

Comments
 (0)