本文整理汇总了PHP中Cake\Database\Schema\Table::temporary方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::temporary方法的具体用法?PHP Table::temporary怎么用?PHP Table::temporary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Database\Schema\Table
的用法示例。
在下文中一共展示了Table::temporary方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createTableSql
/**
* {@inheritDoc}
*/
public function createTableSql(Table $table, $columns, $constraints, $indexes)
{
$lines = array_merge($columns, $constraints);
$content = implode(",\n", array_filter($lines));
$temporary = $table->temporary() ? ' TEMPORARY ' : ' ';
$table = sprintf("CREATE%sTABLE \"%s\" (\n%s\n)", $temporary, $table->name(), $content);
$out = [$table];
foreach ($indexes as $index) {
$out[] = $index;
}
return $out;
}
示例2: createTableSql
/**
* {@inheritDoc}
*/
public function createTableSql(Table $table, $columns, $constraints, $indexes)
{
$content = implode(",\n", array_merge($columns, $constraints, $indexes));
$temporary = $table->temporary() ? ' TEMPORARY ' : ' ';
$content = sprintf("CREATE%sTABLE `%s` (\n%s\n)", $temporary, $table->name(), $content);
$options = $table->options();
if (isset($options['engine'])) {
$content .= sprintf(' ENGINE=%s', $options['engine']);
}
if (isset($options['charset'])) {
$content .= sprintf(' DEFAULT CHARSET=%s', $options['charset']);
}
if (isset($options['collate'])) {
$content .= sprintf(' COLLATE=%s', $options['collate']);
}
return [$content];
}
示例3: createTableSql
/**
* {@inheritDoc}
*/
public function createTableSql(Table $table, $columns, $constraints, $indexes)
{
$content = array_merge($columns, $constraints);
$content = implode(",\n", array_filter($content));
$tableName = $this->_driver->quoteIdentifier($table->name());
$temporary = $table->temporary() ? ' TEMPORARY ' : ' ';
$out = [];
$out[] = sprintf("CREATE%sTABLE %s (\n%s\n)", $temporary, $tableName, $content);
foreach ($indexes as $index) {
$out[] = $index;
}
foreach ($table->columns() as $column) {
$columnData = $table->column($column);
if (isset($columnData['comment'])) {
$out[] = sprintf('COMMENT ON COLUMN %s.%s IS %s', $tableName, $this->_driver->quoteIdentifier($column), $this->_driver->schemaValue($columnData['comment']));
}
}
return $out;
}
示例4: testTemporary
/**
* Tests the temporary() method
*
* @return void
*/
public function testTemporary()
{
$table = new Table('articles');
$this->assertFalse($table->temporary());
$this->assertSame($table, $table->temporary(true));
$this->assertTrue($table->temporary());
$table->temporary(false);
$this->assertFalse($table->temporary());
}