当前位置: 首页>>代码示例>>PHP>>正文


PHP Column::getDefaultSetting方法代码示例

本文整理汇总了PHP中Column::getDefaultSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::getDefaultSetting方法的具体用法?PHP Column::getDefaultSetting怎么用?PHP Column::getDefaultSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Column的用法示例。


在下文中一共展示了Column::getDefaultSetting方法的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);
 }
开发者ID:DBezemer,项目名称:server,代码行数:20,代码来源:DDLBuilder.php

示例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);
 }
开发者ID:nhemsley,项目名称:propel,代码行数:50,代码来源:MysqlDDLBuilder.php

示例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);
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:65,代码来源:MysqlDDLBuilder.php


注:本文中的Column::getDefaultSetting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。