本文整理汇总了PHP中Trigger::addError方法的典型用法代码示例。如果您正苦于以下问题:PHP Trigger::addError方法的具体用法?PHP Trigger::addError怎么用?PHP Trigger::addError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trigger
的用法示例。
在下文中一共展示了Trigger::addError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUpdate
/**
* Updates a trigger.
*/
public function actionUpdate()
{
$trigger = Trigger::model()->findByPk(array('TRIGGER_SCHEMA' => $this->schema, 'TRIGGER_NAME' => $this->trigger));
if (is_null($trigger)) {
$trigger = new Trigger();
}
if (isset($_POST['query'])) {
$query = $_POST['query'];
try {
// Split queries
$splitter = new SqlSplitter($query);
$splitter->delimiter = self::$delimiter;
$queries = $splitter->getQueries();
foreach ($queries as $query2) {
$cmd = $this->db->createCommand($query2);
$cmd->prepare();
$cmd->execute();
}
$response = new AjaxResponse();
$response->addNotification('success', Yii::t('core', 'successAlterTrigger'), null, $query);
$response->refresh = true;
$this->sendJSON($response);
} catch (CDbException $ex) {
$errorInfo = $cmd->getPdoStatement()->errorInfo();
$trigger->addError(null, Yii::t('core', 'sqlErrorOccured', array('{errno}' => $errorInfo[1], '{errmsg}' => $errorInfo[2])));
}
} else {
$query = 'DROP TRIGGER ' . $this->db->quoteTableName($trigger->TRIGGER_NAME) . self::$delimiter . "\n" . $trigger->getCreateTrigger();
}
CHtml::generateRandomIdPrefix();
$this->render('form', array('trigger' => $trigger, 'query' => $query));
}