Source for file Exception.php
Documentation is available at Exception.php
* $Id: Exception.php 1080 2007-02-10 18:17:08Z romanb $
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.com>.
* Doctrine_Connection_Firebird_Exception
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @version $Revision: 1080 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Lorenzo Alberton <l.alberton@quipo.it> (PEAR MDB2 Interbase driver)
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @var array $errorCodeMap an array that is used for determining portable
* error code from a native database error code
protected static $errorCodeMap =
array(
-
158 =>
Doctrine::ERR_VALUE_COUNT_ON_ROW,
// -204 => // Covers too many errors, need to use regex on msg
// -607 => // Covers too many errors, need to use regex on msg
-
625 =>
Doctrine::ERR_CONSTRAINT_NOT_NULL,
-
804 =>
Doctrine::ERR_VALUE_COUNT_ON_ROW,
* @var array $errorRegexps an array that is used for determining portable
* error code from a native database error message
protected static $errorRegexps =
array(
'/generator .* is not defined/'
=>
Doctrine::ERR_SYNTAX, // for compat. w ibase_errcode()
'/table.*(not exist|not found|unknown)/i'
'/table .* already exists/i'
'/unsuccessful metadata update .* failed attempt to store duplicate value/i'
'/unsuccessful metadata update .* not found/i'
'/validation error for column .* value "\*\*\* null/i'
'/violation of [\w ]+ constraint/i'
'/conversion error from string/i'
'/arithmetic exception, numeric overflow, or string truncation/i'
* This method checks if native error code/message can be
* converted into a portable code and then adds this
* portable error code to errorInfo array and returns the modified array
* the portable error code is added at the end of array
* @param array $errorInfo error info array
// todo: are the following lines needed?
// memo for the interbase php module hackers: we need something similar
// to mysql_errno() to retrieve error codes instead of this ugly hack
if (preg_match('/^([^0-9\-]+)([0-9\-]+)\s+(.*)$/', $native_msg, $m)) {
$native_code = (int)$m[2];
foreach (self::$errorRegexps as $regexp =>
$code) {
if (isset
(self::$errorCodeMap[$errorInfo[1]])) {
$errorInfo[3] =
self::$errorCodeMap[$errorInfo[1]];