From efbc4a2566ddb0c6d8d7c095579d4b5178a6e870 Mon Sep 17 00:00:00 2001 From: Stig Bakken Date: Fri, 8 Dec 2000 02:30:43 +0000 Subject: [PATCH] * applied fetch modes patch for odbc by Richard M. Yumul * added DB::isManip so we have _one_ place for testing whether something is a data manipulation query * when passed a string as its first constructor arg, DB_Error now uses the error code DB_ERROR rather than just 0 * implemented auto-commit for ibase (not yet fully tested) * fixed persistent connections in odbc --- pear/DB.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pear/DB.php b/pear/DB.php index 11e46b1497..5bddb607fe 100644 --- a/pear/DB.php +++ b/pear/DB.php @@ -247,6 +247,24 @@ class DB 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, @@ -437,7 +455,7 @@ class DB_Error extends PEAR_Error 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); } } } -- 2.40.0