How to handle sql custom error message ( raiserror ) in yii framework with linux os. Now Yii throw that message as php warning. How to over come this error
this is my code
$sql = "[sp_Language] :Language_Code, :Language_Name, :Active, :Disp_Order, :Action ";
$command = $this->createCommand($sql);
$command->bindParam(":Language_Code", $languageCode, PDO::PARAM_INT);
$command->bindParam(":Language_Name", $language, PDO::PARAM_STR);
$command->bindParam(":Active", $active, PDO::PARAM_STR);
$command->bindParam(":Disp_Order", $displayOrder, PDO::PARAM_INT);
$command->bindParam(":Action", $action, PDO::PARAM_INT);
try
{
$this->msg = '';
$command->queryAll();
}
catch(CDbException $ex)
{
$this->msg = substr($ex->errorInfo[2],0,-30);
//throw new ExceptionClass('tet');
}
Thanks in advance
karthik123
(Mailtoksd)
January 28, 2013, 11:20am
2
karthik123:
How to handle sql custom error message ( raiserror ) in yii framework with linux os. Now Yii throw that message as php warning. How to over come this error
this is my code
$sql = "[sp_Language] :Language_Code, :Language_Name, :Active, :Disp_Order, :Action ";
$command = $this->createCommand($sql);
$command->bindParam(":Language_Code", $languageCode, PDO::PARAM_INT);
$command->bindParam(":Language_Name", $language, PDO::PARAM_STR);
$command->bindParam(":Active", $active, PDO::PARAM_STR);
$command->bindParam(":Disp_Order", $displayOrder, PDO::PARAM_INT);
$command->bindParam(":Action", $action, PDO::PARAM_INT);
try
{
$this->msg = '';
$command->queryAll();
}
catch(CDbException $ex)
{
$this->msg = substr($ex->errorInfo[2],0,-30);
//throw new ExceptionClass('tet');
}
Thanks in advance
Any one help me am new one in yii frame
CPzee
(Cpimation666)
February 20, 2013, 9:20am
3
Hi,
Don’t know actually is there any way to get rid of this.But how I handle those exceptions from the php function set_error_handler
EG:
$old_error_handler = set_error_handler(array('ClassName', 'handleErrors'));
try
{
if (.................)
{
..............................
..............................
}
else
{
..............................
..............................
}
............................
if ($model->save())
{
..............................
}
}
catch (CDbException $ex)
{
..................................
throw new Exception(".....................");
}
catch (Exception $ex)
{
....................
throw new Exception($ex->getMessage(), $ex->getCode());
}
set_error_handler($old_error_handler);
yugenekr
(Yugenekr)
February 21, 2013, 10:44am
4
Have you read the guide:
http://www.yiiframew …en/topics.error ?
Usually, all you need is to d[size="2"]isable debug mode in production environment[/size]
and to use something like
'errorHandler' => array(
'errorAction' => (YII_DEBUG ? null : 'site/error'),
),
in your config file to handle error in a desired method.