php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28433 sybase_query always returns 1 on non-select queries
Submitted: 2004-05-18 15:28 UTC Modified: 2004-05-18 16:23 UTC
From: r dot vanicek at seznam dot cz Assigned:
Status: Not a bug Package: Sybase (dblib) related
PHP Version: 4.3.6 OS: Debian GNU/Linux
Private report: No CVE-ID: None
 [2004-05-18 15:28 UTC] r dot vanicek at seznam dot cz
Description:
------------
sybase_query call should return false when the query fails. This is true if the query is a "select..." command. But for the other commands (eg. insert), sybase_query always return 1 no matter if the command is OK or not. This makes testing the query success/failure nearly impossible.



Reproduce code:
---------------
$ret = sybase_query("insert");
var_dump($ret);

Expected result:
----------------
false

Actual result:
--------------
1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-18 15:42 UTC] r dot vanicek at seznam dot cz
Sorry, this is probably not a bug of php_sybase client. If there is a syntax error in the query, sybase reports "Error" and sybase_query returns FALSE as expected.

But is there is eg. NULL value specified for a NOT NULL column, sybase reports "Warning" and sybase_query returns 1 (OK).

The other SQL servers take this as error, and rightly so (I think), because operation is not completed and no row is entered in the table, sigh.
 [2004-05-18 16:23 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

The return value returned by sybase does not indicate an 
error, which is why PHP does not return false. 
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 06:01:26 2019 UTC