I am using php 4.2.0
'./configure' '--with-apache=../apache_1.3.22' '--enable-trans-sid' '--with-sybase=/usr/local/freetds' '--with-openssl=../openssl-0.9.6' '--with-mm=../mm-1.1.3' '--enable-track-vars'
on a linux 2.4.18-3
(freetds.0.61, track_errors and display_errors is on, register_globals as well)
There are 4 different cases to handle (coming from MS SQL Server 2000):
- dataset (select...)
- no valid resultset (insert, update....)
- system errors e.g. select cast('a string' as integer)
- raiserrors e.g. show_error
(create procedure show_error
as
raiserror ('My Errortext', 18, 1))
Playing around with "error_reporting-levels" did not solve the problem.
After a while I got a workaround for the first 3 cases:
Code: Select all
<?
.....
error_reporting (E_ALL);
ob_start();
$php_errormsg = ''; // to block: : Notice: Undefined variable:...
$conn = mssql_connect(......) or die ("$php_errormsg");
mssql_select_db(...) or die ("$php_errormsg");
$query_result = mssql_query($sql) or die ("$php_errormsg");
// here would come the cast error if not ob_start() were set
if(is_integer($query_result) and ($php_errormsg == null))
{
......the dataset output stuff
}
elseif($php_errormsg != null)
{
ob_end_clean();
ob_start();
.....the system error message via $php_errormsg.....
}
else
{
..........the insert, update...output
}
ob_end_flush();
?>I've looked for help from the freetds developers but they say that it is not a freetds problem resp. the errors where sent from freetds.
Now my 2 questions:
- is anybody having a better workaround for "my first 3 cases"?
resp. why does the error_reporting levels not act as expected?
- how do i get my "raiserror stuff" displayed?
Thx in advance for any idea...
Stefan