[freetds] Re: freetds/mssql/php message handler?
fdsubs at axelero.hu
Wed Mar 10 21:32:17 EST 2004
On Mar 11, 2004, at 2:44, Ron Creamer wrote:
> I do have a question however. What is the best way to get both error,
> and simple messages back from the server after issuing queries?
> According to the PHP man, there is a nice function called
> sybase-set-message-handler that would do the trick, but I'm using
> mssql 7 database, not Sybase.
> Does such a function/handler exist for MSSQL? If not, how are you
> getting the messages, errors raised by the server?
> mssql_get_last_message() seems to be severely lacking, in that it can
> only retrieve one message, often irrelevant.
Actually with FreeTDS + PHP you can use the Sybase and MSSQL functions
interchangeably. So you can use the sybase extension and the sybase
functions for accessing an MS SQL Server and vice versa. It's FreeTDS'
tds version setting which matters, and that is outside the scope of
In fact if you compile PHP with --with-sybase_ct, you actually get a
function called mssql_set_message_handler too, but you could use
sybase_set_message_handler just the same.
You don't get this function if you used --with-mssql, but you get some
others extra calls in exchange (unrelated to message handling).
Generally if you use one of the sybase extensions on Linux, you get a
mirrored set of mssql_* functions for every sybase_* function (and both
does the same). On the other hand, if you use --with-mssql, you get a
set of functions which mimic those previously only available on the
formerly Windows-exlusive MSSQL extension, and none of the sybase_
functions -- yet you can access Sybase databases through the mssql
calls just fine as long as it's properly configured in freetds.conf.
Now I'm not sure if this was of any help. I myself never really cared
about the specific messages and just relied on catching failure through
a false return value.
More information about the FreeTDS