#31428 [NoF]: Useless results from mssql_get_last_message()
ID: 31428
Updated by: fmk@php.net
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:
The function is called mssql_get_last_message() for a reason. It
returns the last message from the server. In this case the server
returns multiple messages and only the last is returned. The internal
message handler is called once for each message issued by the server,
this causes the printing of multiple lines. Omly the last message is
stored.
Previous Comments:
------------------------------------------------------------------------
[2005-03-24 13:00:19] shuleux at datix dot co dot uk
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
------------------------------------------------------------------------
[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
Thread (5 messages)