diff options
author | George Peter Banyard <girgias@php.net> | 2020-12-23 02:17:46 +0100 |
---|---|---|
committer | George Peter Banyard <girgias@php.net> | 2021-01-06 10:20:57 +0000 |
commit | d04adf60bee30a167845644c3d480583ca755420 (patch) | |
tree | 531f72ea2f7b6b5a1db76431b2bd6eef9d89268b /ext/pdo_odbc/odbc_driver.c | |
parent | 6728c1bd72f2ddb46528a0c61ac833b1036a12a2 (diff) | |
download | php-git-d04adf60bee30a167845644c3d480583ca755420.tar.gz |
Boolify PDO's transaction handlers
This includes begin(), commit(), rollBack(), and inTransaction()
Diffstat (limited to 'ext/pdo_odbc/odbc_driver.c')
-rw-r--r-- | ext/pdo_odbc/odbc_driver.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c index 123d86e2cf..732512eb58 100644 --- a/ext/pdo_odbc/odbc_driver.c +++ b/ext/pdo_odbc/odbc_driver.c @@ -266,7 +266,7 @@ static int odbc_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unquo } */ -static int odbc_handle_begin(pdo_dbh_t *dbh) +static bool odbc_handle_begin(pdo_dbh_t *dbh) { if (dbh->auto_commit) { /* we need to disable auto-commit now, to be able to initiate a transaction */ @@ -276,13 +276,13 @@ static int odbc_handle_begin(pdo_dbh_t *dbh) rc = SQLSetConnectAttr(H->dbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER)SQL_AUTOCOMMIT_OFF, SQL_IS_INTEGER); if (rc != SQL_SUCCESS) { pdo_odbc_drv_error("SQLSetConnectAttr AUTOCOMMIT = OFF"); - return 0; + return false; } } - return 1; + return true; } -static int odbc_handle_commit(pdo_dbh_t *dbh) +static bool odbc_handle_commit(pdo_dbh_t *dbh) { pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; RETCODE rc; @@ -293,7 +293,7 @@ static int odbc_handle_commit(pdo_dbh_t *dbh) pdo_odbc_drv_error("SQLEndTran: Commit"); if (rc != SQL_SUCCESS_WITH_INFO) { - return 0; + return false; } } @@ -302,13 +302,13 @@ static int odbc_handle_commit(pdo_dbh_t *dbh) rc = SQLSetConnectAttr(H->dbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER)SQL_AUTOCOMMIT_ON, SQL_IS_INTEGER); if (rc != SQL_SUCCESS) { pdo_odbc_drv_error("SQLSetConnectAttr AUTOCOMMIT = ON"); - return 0; + return false; } } - return 1; + return true; } -static int odbc_handle_rollback(pdo_dbh_t *dbh) +static bool odbc_handle_rollback(pdo_dbh_t *dbh) { pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; RETCODE rc; @@ -319,7 +319,7 @@ static int odbc_handle_rollback(pdo_dbh_t *dbh) pdo_odbc_drv_error("SQLEndTran: Rollback"); if (rc != SQL_SUCCESS_WITH_INFO) { - return 0; + return false; } } if (dbh->auto_commit && H->dbc) { @@ -327,11 +327,11 @@ static int odbc_handle_rollback(pdo_dbh_t *dbh) rc = SQLSetConnectAttr(H->dbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER)SQL_AUTOCOMMIT_ON, SQL_IS_INTEGER); if (rc != SQL_SUCCESS) { pdo_odbc_drv_error("SQLSetConnectAttr AUTOCOMMIT = ON"); - return 0; + return false; } } - return 1; + return true; } static int odbc_handle_set_attr(pdo_dbh_t *dbh, zend_long attr, zval *val) @@ -386,7 +386,7 @@ static const struct pdo_dbh_methods odbc_methods = { NULL, /* check_liveness */ NULL, /* get_driver_methods */ NULL, /* request_shutdown */ - NULL, /* in_transaction */ + NULL, /* in transaction, use PDO's internal tracking mechanism */ NULL /* get_gc */ }; |