Pear MDB2 class and raiserror exceptions in MSSQL
- by drholzmichl
Hi,
in MSSQL it's possible to raise an error with raiserror(). I want to use a severity, which doesn't interrupt the connection. This error is raised in a stored procedure. In SQL Management Studio all is fine and I get my error code when executing this SP. But when trying to execute this SP via MDB2 in PHP5 this doesn't work. All I get is an empty array.
MDB2 object is created via (including needed options):
$db =& MDB2::connect($dsn);
$db->setFetchMode(MDB2_FETCHMODE_ASSOC);
$db->setOption('portability',MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL);
The following works (I get a PEAR error):
$db->query("RAISERROR('test',11,0);");
But when calling a stored procedure which raises this error via
$db->query("EXEC sp_raise_error");
there is not output. What's wrong?