Bug #13628 Updated: error handling for odbc_execute()

From: Date: Fri, 07 Dec 2001 17:22:11 +0000
Subject: Bug #13628 Updated: error handling for odbc_execute()
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-72871@lists.php.net to get a copy of this message
ID: 13628 Updated by: kalowsky Reported By: cawa@csa.ru Old Status: Open Status: Closed Bug Type: ODBC related Operating System: PHP Version: 4.0.6 New Comment: Fixed in CVS. Thanks for your report! Previous Comments: ------------------------------------------------------------------------ [2001-10-10 10:42:20] cawa@csa.ru After odbc_execute() call odbc_error doesn't return SQLSTATE (returns last occured SQLSTATE). The cause is that SQL_ERROR return code of SQLExecute() is not processed. Please change php_odbc.c near ------------------------- /* * Execute prepared SQL statement. Supports only input parameters. */ /* {{{ proto int odbc_execute(int result_id [, array parameters_array]) Execute a prepared statement */ PHP_FUNCTION(odbc_execute) ------------------------- ------------------------- rc = SQLExecute(result->stmt); result->fetched = 0; if (rc == SQL_NEED_DATA) { char buf[4096]; int fp, nbytes; while(rc == SQL_NEED_DATA) { rc = SQLParamData(result->stmt, (void*)&fp); if (rc == SQL_NEED_DATA) { while((nbytes = read(fp, &buf, 4096)) > 0) SQLPutData(result->stmt, (void*)&buf, nbytes); } } } else { switch (rc) { case SQL_SUCCESS: break; case SQL_NO_DATA_FOUND: case SQL_SUCCESS_WITH_INFO: odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute"); break; default: RETVAL_FALSE; } } ------------------------- ==========> ------------------------- rc = SQLExecute(result->stmt); result->fetched = 0; if (rc == SQL_NEED_DATA) { char buf[4096]; int fp, nbytes; while(rc == SQL_NEED_DATA) { rc = SQLParamData(result->stmt, (void*)&fp); if (rc == SQL_NEED_DATA) { while((nbytes = read(fp, &buf, 4096)) > 0) SQLPutData(result->stmt, (void*)&buf, nbytes); } } } else { switch (rc) { case SQL_SUCCESS: break; case SQL_NO_DATA_FOUND: case SQL_SUCCESS_WITH_INFO: odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute"); break; default: odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute"); RETVAL_FALSE; } } ------------------------- With best regards, Alexander Veremyev. ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=13628&edit=1

« previous php.dev (#72871) next »