Skip to Content.
Sympa Menu

freetds - Re: Trapping mssql raiserror statements in PHP4 via FreeTDS

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Mark Gruetzner" <mgruetzner AT rw3.com>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Trapping mssql raiserror statements in PHP4 via FreeTDS
  • Date: Wed, 8 May 2002 11:02:53 -0500


Thanks, but in this case, I really need to trap it as a warning message. In
the php.ini file, the track_errors = On/Off setting says to turn it on to
trap both warning and error messages. If I were writing the code from
scratch, I would do all this a different way, but I am porting a LOT of
existing code which uses raiserror with a level of 9 (warning) to warn that
a query limit has been exceeded. In that way, the query still succeeds and
you get a result set, but the mssql_get_last_message() will return the
'QueryLimit' string that I passed in with raiserror to indicate to me that a
query limit was exceeded. I could modify the code to get around this, but
there is a lot of code I would have to touch....I'd rather figure out how to
make php/freetds work as documented...

Mark


-----Original Message-----
From: bounce-freetds-143882 AT franklin.oit.unc.edu
[mailto:bounce-freetds-143882 AT franklin.oit.unc.edu]On Behalf Of Kaeptn
Weltall
Sent: Wednesday, May 08, 2002 10:28 AM
To: TDS Development Group
Subject: [freetds] Re: Trapping mssql raiserror statements in PHP4 via
FreeTDS


an error is considered having a severity between 12 and 16,
messages with severitys below are considered messages but
not errormessages; maybe therefor the 'track_error' setting
will not apply.
If you want to return from query execution at the 'raiserror'
event anyway, turn up to severity 12 or more and catch the error
message with prepending @ to the sybase_query(...) command:

$sql = "exec myproc ...";
if( ! $myErrorString = @sybase_query($sql) ) {
YOUR ACTIONS ON ERROR;
}
cheers

robert

---
You are currently subscribed to freetds as: [mgruetzner AT rw3.com]
To unsubscribe, forward this message to
$subst('Email.Unsub')





Archive powered by MHonArc 2.6.24.

Top of Page