#31428 [Com]: Useless results from mssql_get_last_message()
| From: | shuleux at datix dot co dot uk | Date: | Thu, 24 Mar 2005 12:00:21 +0000 |
| Subject: | #31428 [Com]: Useless results from mssql_get_last_message() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-75808@lists.php.net to get a copy of this message | ||
ID: 31428
Comment by: shuleux at datix dot co dot uk
Reported By: klaus dot kuehne at gga-hannover dot de
Status: No Feedback
Bug Type: MSSQL related
Operating System: Windows XP Server
PHP Version: 4.3.10
New Comment:
We are getting the same results with the latest win32 CVS snapshot.
When MS SQL returns an error message on more than one line,
mssql_get_last_message() only returns the last line of the error
message. For example, inserting a duplicate row into a table gives the
following error message with display_errors turned on:
Cannot insert duplicate key row in object 'INCIDENTS_REPORT' with
unique index 'INC_INDX'.
The statement has been terminated.
mssql_get_last_message(), however, gives only the following error
message:
The statement has been terminated.
The correct behaviour of mssql_get_last_message() should be to return
the whole error message, not just the last line.
Regards
Sebastien Huleux
Previous Comments:
------------------------------------------------------------------------
[2005-02-02 01:00:04] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2005-01-17 18:33:22] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2005-01-06 16:58:53] klaus dot kuehne at gga-hannover dot de
Description:
------------
Hello,
in many cases, mssql_get_last_message() delivers useless results, which
are differing from the original SQL Server messages. An example:
..
$ret = mssql_query("insert into TAB (KEY) values (13)", $con);
if (!$ret) {
$errtxt = mssql_get_last_message();
die($errtxt);
}
..
if value 13 already exists in the unique indexed column KEY of TAB,
$errtxt will be set to "Die Anweisung wurde beendet" (in german,
translated to english like "statement aborted"). Instead of this, one
could expect the message "Cannot insert duplicate key row in object ...
with unique index ..." (Code = 2601).
This occurs in many other cases, too. In other cases (e. g. SQL-access
failed caused by missing user rights on the table),
mssql_get_last_message() delivers an empty string, even if the return
code of mssql_query() is FALSE.
What ist the reason for mhis?
Regards
Klaus Kühne, GGA Institute Hannover, Germany
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31428&edit=1