diff options
| author | Stig Bakken <ssb@php.net> | 2000-12-08 02:30:43 +0000 |
|---|---|---|
| committer | Stig Bakken <ssb@php.net> | 2000-12-08 02:30:43 +0000 |
| commit | efbc4a2566ddb0c6d8d7c095579d4b5178a6e870 (patch) | |
| tree | 0b887a359a531910bd45d6e173ea24ae197cd605 | |
| parent | 3288325bd4387d05940bf8471fc043a63575a594 (diff) | |
| download | php-git-efbc4a2566ddb0c6d8d7c095579d4b5178a6e870.tar.gz | |
* 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
| -rw-r--r-- | pear/DB.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/pear/DB.php b/pear/DB.php index 11e46b1497..5bddb607fe 100644 --- a/pear/DB.php +++ b/pear/DB.php @@ -248,6 +248,24 @@ class DB } /** + * 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, * and are not fatal. @@ -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); } } } |
