note 70994 added to function.mssql-get-last-message
| From: | lanflett at hotmail dot com | Date: | Tue, 07 Nov 2006 17:17:24 +0000 |
| Subject: | note 70994 added to function.mssql-get-last-message | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119479@lists.php.net to get a copy of this message | ||
Deleting an unexistent record causes mssql_query() to return FALSE (error)
======================================================
I wrote a code that deletes a set of records without verifying if that record ID exists before. I
made this because of performance issues, since checking the existence of that record before deletion
would require more interpreter and database processing.
Problem is that, if I tried to delete a record ID that didn't exist (i.e. DELETE FROM X WHERE
ID = 999, and 999 is an unexistent rec) mssql_query() returned FALSE, wich, by the function
documentation means an execution error.
Even when I tried to retrieve the error by using mssql_get_last_message() function or by selecting
the error code from the system tables in SQL Server, there was no error.
Therefore, I don't know if this is a mssql functions bug in PHP or a misconfiguration in SQL
Server (wich doesn't seems to be the case, since it returns error code ZERO, meaning that the
query executed successfully), but the only workaround I found was to do a verification of existence
of the ID record by record before deleting them.
Hope this helps someone that eventually came to face the same problem.
----
Server IP: 66.163.161.117
Probable Submitter: 200.203.179.125 (proxied: 172.16.224.55)
----
Manual Page -- http://www.php.net/manual/en/function.mssql-get-last-message.php
Edit -- https://master.php.net/note/edit/70994
Del: integrated -- https://master.php.net/note/delete/70994/integrated
Del: useless -- https://master.php.net/note/delete/70994/useless
Del: bad code -- https://master.php.net/note/delete/70994/bad+code
Del: spam -- https://master.php.net/note/delete/70994/spam
Del: non-english -- https://master.php.net/note/delete/70994/non-english
Del: in docs -- https://master.php.net/note/delete/70994/in+docs
Del: other reasons-- https://master.php.net/note/delete/70994
Reject -- https://master.php.net/note/reject/70994
Search -- https://master.php.net/manage/user-notes.php