/** * Load collation with properties and relations. */ public function testLoad() { // Load collation $col = Collation::model()->findByPk('utf8_general_ci'); // Assert properties $this->assertEquals('utf8_general_ci', $col->COLLATION_NAME); $this->assertEquals('utf8', $col->CHARACTER_SET_NAME); $this->assertEquals(33, $col->ID); $this->assertEquals('Yes', $col->IS_DEFAULT); $this->assertEquals('Yes', $col->IS_COMPILED); $this->assertEquals(1, $col->SORTLEN); // Assert character set $this->assertType('CharacterSet', $col->characterSet); }
/** * Updates a table. */ public function actionUpdate() { $this->layout = false; $isSubmitted = false; $sql = false; $table = Table::model()->findByPk(array('TABLE_SCHEMA' => $this->schema, 'TABLE_NAME' => $this->table)); if (isset($_POST['Table'])) { $table->attributes = $_POST['Table']; $sql = $table->save(); if ($sql) { $isSubmitted = true; } } $collations = Collation::model()->findAll(array('order' => 'COLLATION_NAME', 'select' => 'COLLATION_NAME, CHARACTER_SET_NAME AS collationGroup')); CHtml::generateRandomIdPrefix(); $this->render('form', array('table' => $table, 'collations' => $collations, 'storageEngines' => StorageEngine::getSupportedEngines(), 'isSubmitted' => $isSubmitted, 'sql' => $sql)); }
/** * Update a schema. * * @todo(mburtscher): Renaming. Requires copying the whole schema. */ public function actionUpdate() { $isSubmitted = false; $sql = null; $schema = $this->loadSchema(); if (isset($_POST['Schema'])) { $schema->attributes = $_POST['Schema']; if ($sql = $schema->save()) { $isSubmitted = true; } } $collations = Collation::model()->findAll(array('order' => 'COLLATION_NAME', 'select' => 'COLLATION_NAME, CHARACTER_SET_NAME AS collationGroup')); $this->render('form', array('schema' => $schema, 'collations' => $collations, 'isSubmitted' => $isSubmitted, 'sql' => $sql)); }
public function actionUpdate() { $isSubmitted = false; $sql = false; $column = Column::model()->findByPk(array('TABLE_SCHEMA' => $this->schema, 'TABLE_NAME' => $this->table, 'COLUMN_NAME' => $this->column)); if (isset($_POST['Column'])) { $column->attributes = $_POST['Column']; $sql = $column->save(); if ($sql) { $isSubmitted = true; } } $collations = Collation::model()->findAll(array('order' => 'COLLATION_NAME', 'select' => 'COLLATION_NAME, CHARACTER_SET_NAME AS collationGroup')); CHtml::generateRandomIdPrefix(); $data = array('column' => $column, 'collations' => $collations, 'isSubmitted' => $isSubmitted, 'sql' => $sql); $data['formBody'] = $this->renderPartial('formBody', $data, true); $this->render('form', $data); }