Bug #63498 [NEW]: Wrong order of options in sqlsrv_query can throw "Invalid cursor state" error
| From: | oleg at mastak dot fi | Date: | Mon, 12 Nov 2012 19:26:24 +0000 |
| Subject: | Bug #63498 [NEW]: Wrong order of options in sqlsrv_query can throw "Invalid cursor state" error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-174644@lists.php.net to get a copy of this message | ||
From: oleg at mastak dot fi
Operating system: Windows 7
PHP version: 5.4.8
Package: MSSQL related
Bug Type: Bug
Bug description:Wrong order of options in sqlsrv_query can throw "Invalid cursor state"
error
Description:
------------
In sqlsrv_query function, fourth parameter is array that can contain
following three options with corresponding keys : QueryTimeout,
SendStreamParamsAtExec , Scrollable
You would assume that you can specify options in any order, however, this
is not true.
If you run following script, you will hit unspecified error
"[Microsoft][ODBC Driver Manager] Invalid cursor state"
However, if you change order to:
$config = array(
'Scrollable' => SQLSRV_CURSOR_KEYSET,
'QueryTimeout' => 2,
);
then everything works OK.
As this is illogical, I think this is bug and should be fixed.
Test script:
---------------
$link = sqlsrv_connect ( 'serverName\sqlexpress', $connectionInfo );
$config = array(
'QueryTimeout' => 2,
'Scrollable' => SQLSRV_CURSOR_KEYSET,
);
$query = "CREATE TABLE #MY_TABLE([var1] [bigint] NOT NULL);";
$result = sqlsrv_query($link,$query,array(),$config) or die("ERROR ".
print_r(sqlsrv_errors(),true));
Expected result:
----------------
OK
Actual result:
--------------
ERROR Array ( [0] => Array ( [0] => 24000 [SQLSTATE] => 24000 [1] => 0
[code] => 0 [2] => [Microsoft][ODBC Driver Manager] Invalid cursor state
[message] => [Microsoft][ODBC Driver Manager] Invalid cursor state ) )
--
Edit bug report at https://bugs.php.net/bug.php?id=63498&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63498&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63498&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63498&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63498&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63498&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63498&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63498&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63498&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63498&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63498&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=63498&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=63498&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63498&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63498&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63498&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63498&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63498&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63498&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63498&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63498&r=mysqlcfg