本文整理汇总了PHP中Schema::db方法的典型用法代码示例。如果您正苦于以下问题:PHP Schema::db方法的具体用法?PHP Schema::db怎么用?PHP Schema::db使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schema
的用法示例。
在下文中一共展示了Schema::db方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Setup test databases.
*/
protected function setUp()
{
$this->executeSqlFile('models/ForeignKeyTest.sql');
Column::$db = ForeignKey::$db = Index::$db = Routine::$db = Row::$db = Schema::$db = Table::$db = Trigger::$db = View::$db = $this->createDbConnection('tabletest');
}
示例2: setUp
protected function setUp()
{
$this->executeSqlFile('models/SchemaTest.sql');
Schema::$db = $this->createDbConnection('information_schema');
}
示例3: actionDrop
/**
* Drop a schema.
*/
public function actionDrop()
{
$response = new AjaxResponse();
$response->refresh = true;
$response->executeJavaScript('sideBar.loadSchemata()');
$schemata = (array) $_POST['schemata'];
$droppedSchemata = $droppedSqls = array();
Schema::$db = Yii::app()->getDb();
foreach ($schemata as $schema) {
$schemaObj = Schema::model()->findByPk($schema);
$schemaObj->throwExceptions = true;
try {
$sql = $schemaObj->delete();
$droppedSchemata[] = $schema;
$droppedSqls[] = $sql;
} catch (DbException $ex) {
$response->addNotification('error', Yii::t('core', 'errorDropSchema', array('{schema}' => $schema)), $ex->getText(), $ex->getSql());
}
}
$count = count($droppedSchemata);
if ($count > 0) {
$response->addNotification('success', Yii::t('core', 'successDropSchema', array($count, '{schema}' => $droppedSchemata[0], '{schemaCount}' => $count)), $count > 1 ? implode(', ', $droppedSchemata) : null, implode("\n", $droppedSqls));
}
$this->sendJSON($response);
}