本文整理汇总了PHP中Phinx\Db\Table\Column::getProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::getProperties方法的具体用法?PHP Column::getProperties怎么用?PHP Column::getProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phinx\Db\Table\Column
的用法示例。
在下文中一共展示了Column::getProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getColumnSqlDefinition
/**
* Gets the SqlServer Column Definition for a Column object.
*
* @param Column $column Column
* @return string
*/
protected function getColumnSqlDefinition(Column $column, $create = true)
{
$buffer = array();
$sqlType = $this->getSqlType($column->getType());
$buffer[] = strtoupper($sqlType['name']);
// integers cant have limits in SQlServer
$noLimits = array('bigint', 'int', 'tinyint');
if (!in_array($sqlType['name'], $noLimits) && ($column->getLimit() || isset($sqlType['limit']))) {
$buffer[] = sprintf('(%s)', $column->getLimit() ? $column->getLimit() : $sqlType['limit']);
}
$properties = $column->getProperties();
$buffer[] = $column->getType() == 'filestream' ? 'FILESTREAM' : '';
$buffer[] = isset($properties['rowguidcol']) ? 'ROWGUIDCOL' : '';
$buffer[] = $column->isNull() ? 'NULL' : 'NOT NULL';
$default = $column->getDefault();
if ($create) {
if (is_numeric($default) || 'CURRENT_TIMESTAMP' === $default) {
$buffer[] = 'DEFAULT';
$buffer[] = $default;
} elseif ($default) {
$buffer[] = "DEFAULT '{$default}'";
}
}
if ($column->isIdentity()) {
$buffer[] = 'IDENTITY(1, 1)';
}
// TODO - add precision & scale for decimals
return implode(' ', $buffer);
}
示例2: getColumnSqlDefinition
/**
* Gets the SqlServer Column Definition for a Column object.
*
* @param Column $column Column
* @return string
*/
protected function getColumnSqlDefinition(Column $column, $create = true)
{
$buffer = array();
$sqlType = $this->getSqlType($column->getType());
$buffer[] = strtoupper($sqlType['name']);
// integers cant have limits in SQlServer
$noLimits = array('bigint', 'int', 'tinyint');
if (!in_array($sqlType['name'], $noLimits) && ($column->getLimit() || isset($sqlType['limit']))) {
$buffer[] = sprintf('(%s)', $column->getLimit() ? $column->getLimit() : $sqlType['limit']);
}
if ($column->getPrecision() && $column->getScale()) {
$buffer[] = '(' . $column->getPrecision() . ',' . $column->getScale() . ')';
}
$properties = $column->getProperties();
$buffer[] = $column->getType() === 'filestream' ? 'FILESTREAM' : '';
$buffer[] = isset($properties['rowguidcol']) ? 'ROWGUIDCOL' : '';
$buffer[] = $column->isNull() ? 'NULL' : 'NOT NULL';
if ($create === true) {
if ($column->getDefault() === null && $column->isNull()) {
$buffer[] = ' DEFAULT NULL';
} else {
$buffer[] = $this->getDefaultValueDefinition($column->getDefault());
}
}
if ($column->isIdentity()) {
$buffer[] = 'IDENTITY(1, 1)';
}
return implode(' ', $buffer);
}
示例3: getProperties
/**
* Gets field properties
*
* @return array
*/
public function getProperties()
{
return $this->column->getProperties();
}