Re: Getting error messages to the (PHP) user

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
On Tue, 05 Mar 2013 09:18:31 -0500
"Mark A. Hershberger" <[email protected]> wrote:

> I found that _dblib_handle_info_message() in dbutil.c handles both
> actions: logging the actual SQL Server error message and returning the
> hard-coded error message ("General SQL Server error...").
> 
> This hard-coded error message seems pretty useless to me -- especially
> when the actual error message is right there.  Is there a reason it
> was done this way?

I think you'll find, if you look again, that the hard-coded message is
in response to a severity > 10.  db-lib distinguishes between *message*
arriving from the server, and *errors* returned because of improper use
of the API.  Errors happen without the server; messages come from the
server.  

Server messages arrive with a severity code.  By convention, severity
codes >= 10 are "errors" in the sense that the user can't fix them.  

select count(*), severity from sys.sysmessages group by severity order
by severity;
	
	 severity
 ----------- --------
        1130        0
       13260       10
        1460       11
          10       12
          10       13
         700       14
        2290       15
       55490       16
         530       17
          90       18
          50       19
         890       20
         430       21
          70       22
         140       23
          90       24

The message handler treats such messages as errors.  Instead of
repeating the text of the message, it says to check for messages.
Which makes a certain amount of sense if you can keep messages and
errors straight in your mind.  


--jkl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.