|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-12-07 12:22 UTC] kalowsky@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 05:00:01 2025 UTC |
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.