Bug #13628: error handling for odbc_execute()

From: Date: Wed, 10 Oct 2001 14:42:21 +0000
Subject: Bug #13628: error handling for odbc_execute()
Groups: php.dev 
Request: Send a blank email to php-dev+get-67692@lists.php.net to get a copy of this message
From: cawa@csa.ru Operating system: PHP version: 4.0.6 PHP Bug Type: ODBC related Bug description: error handling for odbc_execute() 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 bug report at: http://bugs.php.net/?id=13628&edit=1

« previous php.dev (#67692) next »