php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #48122
Patch odbc-bug-48122 revision 2011-01-17 15:48 UTC by kalle@php.net

Patch odbc-bug-48122 for ODBC related Bug #48122

Patch version 2011-01-17 15:48 UTC

Return to Bug #48122 | Download this patch
Patch Revisions:

Developer: kalle@php.net

Index: php_odbc.c
===================================================================
--- php_odbc.c	(revision 307531)
+++ php_odbc.c	(working copy)
@@ -1470,8 +1470,8 @@
 	if (max_len > 0) {
 		cursorname = emalloc(max_len + 1);
 		rc = SQLGetCursorName(result->stmt,cursorname,(SQLSMALLINT)max_len,&len);
-		if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
-			char        state[6];     /* Not used */
+		if ((rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) || !cursorname) {
+			char        state[6];
 	 		SQLINTEGER  error;        /* Not used */
 			char        errormsg[SQL_MAX_MESSAGE_LENGTH];
 			SQLSMALLINT errormsgsize; /* Not used */
@@ -1479,7 +1479,7 @@
 			SQLError( result->conn_ptr->henv, result->conn_ptr->hdbc,
 						result->stmt, state, &error, errormsg,
 						sizeof(errormsg)-1, &errormsgsize);
-			if (!strncmp(state,"S1015",5)) {
+			if (!cursorname || !strncmp(state,"S1015",5)) {
 				snprintf(cursorname, max_len+1, "php_curs_%d", (int)result->stmt);
 				if (SQLSetCursorName(result->stmt,cursorname,SQL_NTS) != SQL_SUCCESS) {
 					odbc_sql_error(result->conn_ptr, result->stmt, "SQLSetCursorName");
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 00:01:29 2024 UTC