#36662 [Opn]: PDO_ODBC->MSSQL: exec() returns false when doing "DELETE" on nonexisting row
| From: | gustav at cst dot co dot za | Date: | Thu, 09 Mar 2006 10:44:55 +0000 |
| Subject: | #36662 [Opn]: PDO_ODBC->MSSQL: exec() returns false when doing "DELETE" on nonexisting row | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-94077@lists.php.net to get a copy of this message | ||
ID: 36662
User updated by: gustav at cst dot co dot za
Reported By: gustav at cst dot co dot za
Status: Open
Bug Type: PDO related
Operating System: Microsoft Windows XP
PHP Version: 5.1.2
New Comment:
The problem seems more general than I realised. an UPDATE affecting 0
rows *also* returns FALSE instead of int(0).
This following error message is returned in both cases:
SQLExecDirect[0] at ext\pdo_odbc\odbc_driver.c:230
NOTE: A temporary workaround is to use query() instead of exec().
Previous Comments:
------------------------------------------------------------------------
[2006-03-09 08:02:47] gustav at cst dot co dot za
Description:
------------
Hi,
I use PDO_ODBC (linked against Win32 ODBC) to connect to MSSQL.
Webserver is IIS 5.
When I run a "DELETE" statement that tries to delete a nonexisting row,
exec() returned FALSE instead of int(0).
An existing row deletes fine.
Reproduce code:
---------------
<?php
$dsn = 'odbc:database';
$user = 'user';
$password = 'pass';
$dbh = new PDO($dsn, $user, $password);
$result =
$dbh->exec("DELETE FROM radio WHERE station_id = 10");
if ($result===false)
echo "FALSE";
else
$result;
?>
Expected result:
----------------
0
Actual result:
--------------
FALSE
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36662&edit=1