]> granicus.if.org Git - php/commitdiff
More sensible error codes in the exceptions we throw for broken transactions
authorWez Furlong <wez@php.net>
Fri, 24 Sep 2004 18:49:33 +0000 (18:49 +0000)
committerWez Furlong <wez@php.net>
Fri, 24 Sep 2004 18:49:33 +0000 (18:49 +0000)
ext/pdo/pdo_dbh.c

index 97c6ce45b395e0495fecdac95582230f3f3d93b6..8d38327f97443fb76006e249db8f1d35701bb5a9 100755 (executable)
@@ -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;
        }