mirror of
https://github.com/php/php-src.git
synced 2025-01-01 16:35:00 +08:00
check SQLError() return value and output a meaningful errmsg when it fails
This commit is contained in:
parent
4c4d865e9b
commit
86f29b0cf7
@ -587,6 +587,10 @@ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS)
|
||||
do {
|
||||
*/
|
||||
rc = SQLError(henv, conn, stmt, state, &error, errormsg, sizeof(errormsg)-1, &errormsgsize);
|
||||
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
|
||||
sprintf(state, "HY000");
|
||||
sprintf(errormsg, "Failed to fetch error message");
|
||||
}
|
||||
if (conn_resource) {
|
||||
memcpy(conn_resource->laststate, state, sizeof(state));
|
||||
memcpy(conn_resource->lasterrormsg, errormsg, sizeof(errormsg));
|
||||
@ -1217,7 +1221,7 @@ PHP_FUNCTION(odbc_data_source)
|
||||
|
||||
if (rc != SQL_SUCCESS) {
|
||||
/* ummm.... he did it */
|
||||
odbc_sql_error(conn, NULL, "SQLDataSources");
|
||||
odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLDataSources");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user