From: Wez Furlong Date: Fri, 24 Sep 2004 18:49:33 +0000 (+0000) Subject: More sensible error codes in the exceptions we throw for broken transactions X-Git-Tag: PRE_NEW_VM_GEN_PATCH~228 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2416481fd15c86d9a5908b291e58b839e754e019;p=php More sensible error codes in the exceptions we throw for broken transactions --- diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 97c6ce45b3..8d38327f97 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -378,14 +378,14 @@ static PHP_METHOD(PDO, beginTransaction) pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC); if (dbh->in_txn) { - zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_NONE TSRMLS_CC, "There is already an active transaction"); + zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_ALREADY_EXISTS TSRMLS_CC, "There is already an active transaction"); RETURN_FALSE; } if (!dbh->methods->begin) { /* TODO: this should be an exception; see the auto-commit mode * comments below */ - zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_NONE TSRMLS_CC, "This driver doesn't support transactions"); + zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_NOT_IMPLEMENTED TSRMLS_CC, "This driver doesn't support transactions"); RETURN_FALSE; } @@ -427,7 +427,7 @@ static PHP_METHOD(PDO, rollBack) pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC); if (!dbh->in_txn) { - zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_NONE TSRMLS_CC, "There is no active transaction"); + zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_NOT_FOUND TSRMLS_CC, "There is no active transaction"); RETURN_FALSE; }