#31243 [Opn->Csd]: mssql_query returns false despite query succeeded (with 0 results)
| From: | derick@php.net | Date: | Wed, 22 Dec 2004 13:14:57 +0000 |
| Subject: | #31243 [Opn->Csd]: mssql_query returns false despite query succeeded (with 0 results) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-70904@lists.php.net to get a copy of this message | ||
ID: 31243
Updated by: derick@php.net
Reported By: php at pilif dot ch
-Status: Open
+Status: Closed
Bug Type: MSSQL related
Operating System: Gentoo Linux
PHP Version: 5.0.3
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Next time, search the bug database first! This has been reported
atleast 10 times.
Previous Comments:
------------------------------------------------------------------------
[2004-12-22 13:44:36] php at pilif dot ch
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 this bug report at http://bugs.php.net/?id=31243&edit=1