is_subclass_of($value, "db_error"));
}
+ /**
+ * Tell whether a query is a data manipulation query (insert, update
+ * or delete).
+ *
+ * @access public
+ *
+ * @param string the query
+ *
+ * @return bool whether $query is a data manipulation query
+ */
+ function isManip($query)
+ {
+ if (preg_match('/^\s*(INSERT|UPDATE|DELETE)\s+/i', $query)) {
+ return true;
+ }
+ return false;
+ }
+
/**
* Tell whether a result code from a DB method is a warning.
* Warnings differ from errors in that they are generated by DB,
if (is_int($code)) {
$this->PEAR_Error("DB Error: " . DB::errorMessage( $code ), $code, $mode, $level, $debuginfo);
} else {
- $this->PEAR_Error("DB Error: $code", 0, $mode, $level, $debuginfo);
+ $this->PEAR_Error("DB Error: $code", DB_ERROR, $mode, $level, $debuginfo);
}
}
}