diff options
author | Wez Furlong <wez@php.net> | 2005-09-26 21:37:33 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2005-09-26 21:37:33 +0000 |
commit | 006922ba18af56c532112219af79580a919a2656 (patch) | |
tree | 9917b6d396fa6b653b3cb84af4d13d7e1df107bc | |
parent | ef04eea4939738a98101e29350057a325db13120 (diff) | |
download | php-git-006922ba18af56c532112219af79580a919a2656.tar.gz |
ensure that this size is initialized correctly
-rwxr-xr-x | ext/pdo_odbc/odbc_driver.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c index 99e05e1322..5ae45a7e64 100755 --- a/ext/pdo_odbc/odbc_driver.c +++ b/ext/pdo_odbc/odbc_driver.c @@ -59,7 +59,7 @@ static int pdo_odbc_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *inf void pdo_odbc_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, PDO_ODBC_HSTMT statement, char *what, const char *file, int line TSRMLS_DC) /* {{{ */ { RETCODE rc; - SWORD errmsgsize; + SWORD errmsgsize = 0; pdo_odbc_db_handle *H = (pdo_odbc_db_handle*)dbh->driver_data; pdo_odbc_errinfo *einfo = &H->einfo; pdo_odbc_stmt *S = NULL; @@ -79,6 +79,10 @@ void pdo_odbc_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, PDO_ODBC_HSTMT statement, rc = SQLError(H->env, H->dbc, statement, einfo->last_state, &einfo->last_error, einfo->last_err_msg, sizeof(einfo->last_err_msg)-1, &errmsgsize); + if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { + errmsgsize = 0; + } + einfo->last_err_msg[errmsgsize] = '\0'; einfo->file = file; einfo->line = line; |