|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1998-01-27 07:49 UTC] ssb
[2014-01-01 17:38 UTC] bukka@php.net
[2016-03-07 03:10 UTC] ae@php.net
[2017-10-06 16:16 UTC] willfitch@php.net
[2020-12-09 10:49 UTC] cmb@php.net
[2020-12-09 10:50 UTC] phpdocbot@php.net
[2020-12-09 13:18 UTC] mumumu@php.net
[2020-12-09 13:20 UTC] phpdocbot@php.net
[2020-12-30 11:58 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 18:00:01 2025 UTC |
[Reposted for entry into the nifty new bug database] We've been calling stored procedures in MS-SQL thusly: $result = odbc_exec($conn,"exec sp_asp_dmsGetArtist 303"); That has worked up to and including 3.0b2a. However in more recent versions, including 3.0b4-dev, that code has produced: Warning: Function SQLExecDirect in testodbc.php3 on line 22 Warning: SQL error: [Microsoft][ODBC SQL Server Driver]Cursor type changed, SQL state 01S02 in testodbc.php3 on line 22 According to ODBC docs: SQLSTATE: 01S02 Error: Option value changed Description: The driver did not support the specified value of the vParam argument and substituted a similar value. (Function returns SQL_SUCCESS_WITH_INFO.) By comparing the 3.0b2a and 3.0b3-dev unified_odbc.c files, we've located the probable cause of this error. In php3_uodbc_do() on line 763 (in 3.0b3-dev) we see: if(SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC) != SQL_SUCCESS){ That function call appears to complete successfully. Then, on line 776 we see: if((rc = SQLExecDirect(result->stmt, query, SQL_NTS)) != SQL_SUCCESS){ It is this function that appears to generate the error. My guess is that our ODBC driver doesn't support SQL_CURSOR_DYNAMIC and falls back to the default cursor type (which works fine in 3.0b2a). The query then completes successfully (according to SQLTrace), and returns SQL_SUCCESS_WITH_INFO (according to ODBC doc quote above). Based on this information, I believe the fix is to replace line 776 with: rc = SQLExecDirect(result->stmt, query, SQL_NTS); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {