本文整理汇总了PHP中Column::getAutoIncrementString方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::getAutoIncrementString方法的具体用法?PHP Column::getAutoIncrementString怎么用?PHP Column::getAutoIncrementString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Column
的用法示例。
在下文中一共展示了Column::getAutoIncrementString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getColumnDDL
/**
* Builds the DDL SQL for a Column object.
* @return string
*/
public function getColumnDDL(Column $col)
{
$platform = $this->getPlatform();
$domain = $col->getDomain();
$sb = "";
$sb .= $this->quoteIdentifier($col->getName()) . " ";
$sb .= $domain->getSqlType();
if ($platform->hasSize($domain->getSqlType())) {
$sb .= $domain->printSize();
}
$sb .= " ";
$sb .= $col->getDefaultSetting() . " ";
$sb .= $col->getNotNullString() . " ";
$sb .= $col->getAutoIncrementString();
return trim($sb);
}
示例2: getColumnDDL
/**
* Builds the DDL SQL for a Column object.
* @return string
*/
public function getColumnDDL(Column $col)
{
$platform = $this->getPlatform();
$domain = $col->getDomain();
$sqlType = $domain->getSqlType();
$notNullString = $col->getNotNullString();
$defaultSetting = $col->getDefaultSetting();
// Special handling of TIMESTAMP/DATETIME types ...
// See: http://propel.phpdb.org/trac/ticket/538
if ($sqlType == 'DATETIME') {
$def = $domain->getDefaultValue();
if ($def && $def->isExpression()) {
// DATETIME values can only have constant expressions
$sqlType = 'TIMESTAMP';
}
} elseif ($sqlType == 'DATE') {
$def = $domain->getDefaultValue();
if ($def && $def->isExpression()) {
// DATE values don't support expressions in MySQL
throw new EngineException("DATE columns cannot have default *expressions* in MySQL.");
}
}
$sb = "";
$sb .= $this->quoteIdentifier($col->getName()) . " ";
$sb .= $sqlType;
if ($platform->hasSize($sqlType)) {
$sb .= $domain->printSize();
}
$sb .= " ";
if ($sqlType == 'TIMESTAMP') {
$notNullString = $col->getNotNullString();
$defaultSetting = $col->getDefaultSetting();
if ($notNullString == '') {
$notNullString = 'NULL';
}
if ($defaultSetting == '' && $notNullString == 'NOT NULL') {
$defaultSetting = 'DEFAULT CURRENT_TIMESTAMP';
}
$sb .= $notNullString . " " . $defaultSetting . " ";
} else {
$sb .= $defaultSetting . " ";
$sb .= $notNullString . " ";
}
$sb .= $col->getAutoIncrementString();
return trim($sb);
}
示例3: getColumnDDL
/**
* Builds the DDL SQL for a Column object.
* @return string
*/
public function getColumnDDL(Column $col)
{
$platform = $this->getPlatform();
$domain = $col->getDomain();
$sqlType = $domain->getSqlType();
$notNullString = $col->getNotNullString();
$defaultSetting = $col->getDefaultSetting();
// Special handling of TIMESTAMP/DATETIME types ...
// See: http://propel.phpdb.org/trac/ticket/538
if ($sqlType == 'DATETIME') {
$def = $domain->getDefaultValue();
if ($def && $def->isExpression()) {
// DATETIME values can only have constant expressions
$sqlType = 'TIMESTAMP';
}
} elseif ($sqlType == 'DATE') {
$def = $domain->getDefaultValue();
if ($def && $def->isExpression()) {
throw new EngineException("DATE columns cannot have default *expressions* in MySQL.");
}
} elseif ($sqlType == 'TEXT' || $sqlType == 'BLOB') {
if ($domain->getDefaultValue()) {
throw new EngineException("BLOB and TEXT columns cannot have DEFAULT values. in MySQL.");
}
}
$sb = "";
$sb .= $this->quoteIdentifier($col->getName()) . " ";
$sb .= $sqlType;
if ($platform->hasSize($sqlType)) {
$sb .= $domain->printSize();
}
$colinfo = $col->getVendorInfoForType($platform->getDatabaseType());
if ($colinfo->hasParameter('Charset')) {
$sb .= ' CHARACTER SET ' . $platform->quote($colinfo->getParameter('Charset'));
}
if ($colinfo->hasParameter('Collation')) {
$sb .= ' COLLATE ' . $platform->quote($colinfo->getParameter('Collation'));
} elseif ($colinfo->hasParameter('Collate')) {
$sb .= ' COLLATE ' . $platform->quote($colinfo->getParameter('Collate'));
}
if ($sqlType == 'TIMESTAMP') {
$notNullString = $col->getNotNullString();
$defaultSetting = $col->getDefaultSetting();
if ($notNullString == '') {
$notNullString = 'NULL';
}
if ($defaultSetting == '' && $notNullString == 'NOT NULL') {
$defaultSetting = 'DEFAULT CURRENT_TIMESTAMP';
}
$sb .= ' ' . $notNullString . ' ' . $defaultSetting;
} else {
$sb .= ' ' . $defaultSetting . ' ' . $notNullString;
}
if ($autoIncrement = $col->getAutoIncrementString()) {
$sb .= ' ' . $autoIncrement;
}
if ($col->getDescription()) {
$sb .= ' COMMENT ' . $platform->quote($col->getDescription());
}
return trim($sb);
}