#31243 [NEW]: mssql_query returns false despite query succeeded (with 0 results)
| From: | php at pilif dot ch | Date: | Wed, 22 Dec 2004 12:44:38 +0000 |
| Subject: | #31243 [NEW]: mssql_query returns false despite query succeeded (with 0 results) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-70900@lists.php.net to get a copy of this message | ||
From: php at pilif dot ch
Operating system: Gentoo Linux
PHP version: 5.0.3
PHP Bug Type: MSSQL related
Bug description: mssql_query returns false despite query succeeded (with 0 results)
Description:
------------
mssql_query() returns false despite a query being successfully executed if
it's a query returning empty (or none) result sets (queries like INSERT or
BEGIN TRANSACTION)
Concerning my exmaple blelow: In the second two queries (where mssql_query
falsly returned false), mssql_get_last_message() is empty.
Looking at the MS-SQL-Server I could confirm that the queries where
executed correctly (the ones in the example do nothing, but even when
INSERTing something, I'm getting the same results).
I'm quite positive that this working in PHP 5.0.2 and below.
As this is quite a simple testcase and always reproducible, I'm pretty
confident to have actually hit a bug here.
Versions:
php-5.3.0 (--with-mssql)
freetds-0.62.3 (mssql support compiled in)
Looking more thorugh the bug tracker, I came across
#31195 which is the same thing for PHP 4.3. I can definitely confirm this
happening with PHP5.
Thanks for listening...
Philip
Reproduce code:
---------------
<?
$link = mssql_connect('srv', 'user', 'pass');
mssql_select_db('db', $link);
$r = mssql_query('select something', $link);
if ($r === false){
echo "1st query failed\n";
}else{
echo "1st query succeeded\n";
}
$r = mssql_query('begin transaction', $link);
if ($r === false){
echo "2nd query failed\n";
}else{
echo "2nd query succeeded\n";
}
$r = mssql_query('rollback', $link);
if ($r === false){
echo "3rd query failed\n";
}else{
echo "3rd query succeeded\n";
}
?>
Expected result:
----------------
1st query succeeded
2nd query succeeded
3rd query succeeded
Actual result:
--------------
1st query succeeded
2nd query failed
3rd query failed
--
Edit bug report at http://bugs.php.net/?id=31243&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31243&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31243&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31243&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31243&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31243&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31243&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31243&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31243&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31243&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31243&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31243&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31243&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31243&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31243&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31243&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31243&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31243&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31243&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31243&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31243&r=mysqlcfg