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


PHP Column::setType方法代码示例

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


在下文中一共展示了Column::setType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getColumns

 /**
  * {@inheritdoc}
  */
 public function getColumns($tableName)
 {
     $columns = array();
     $rows = $this->fetchAll(sprintf('SHOW COLUMNS FROM %s', $tableName));
     foreach ($rows as $columnInfo) {
         $column = new Column();
         $column->setName($columnInfo['Field'])->setType($columnInfo['Type'])->setNull($columnInfo['Null'] != 'NO')->setDefault($columnInfo['Default']);
         $phinxType = $this->getPhinxType($columnInfo['Type']);
         $column->setType($phinxType['name'])->setLimit($phinxType['limit']);
         if ($columnInfo['Extra'] == 'auto_increment') {
             $column->setIdentity(true);
         }
         $columns[] = $column;
     }
     return $columns;
 }
开发者ID:alprs,项目名称:phinx,代码行数:19,代码来源:MysqlAdapter.php

示例2: getColumns

 /**
  * {@inheritdoc}
  */
 public function getColumns($tableName)
 {
     $columns = array();
     $rows = $this->fetchAll(sprintf('pragma table_info(%s)', $this->quoteTableName($tableName)));
     foreach ($rows as $columnInfo) {
         $column = new Column();
         $type = strtolower($columnInfo['type']);
         $column->setName($columnInfo['name'])->setNull($columnInfo['notnull'] != '1')->setDefault($columnInfo['dflt_value']);
         $phinxType = $this->getPhinxType($type);
         $column->setType($phinxType['name'])->setLimit($phinxType['limit']);
         if ($columnInfo['pk'] == 1) {
             $column->setIdentity(true);
         }
         $columns[] = $column;
     }
     return $columns;
 }
开发者ID:elliotwms,项目名称:phinx,代码行数:20,代码来源:SQLiteAdapter.php

示例3: changeColumn

 /**
  * Change a table column type.
  *
  * @param string        $columnName    Column Name
  * @param string|Column $newColumnType New Column Type
  * @param array         $options       Options
  * @return Table
  */
 public function changeColumn($columnName, $newColumnType, $options = array())
 {
     // create a column object if one wasn't supplied
     if (!$newColumnType instanceof Column) {
         $newColumn = new Column();
         $newColumn->setType($newColumnType);
         $newColumn->setOptions($options);
     } else {
         $newColumn = $newColumnType;
     }
     // if the name was omitted use the existing column name
     if (null === $newColumn->getName() || strlen($newColumn->getName()) === 0) {
         $newColumn->setName($columnName);
     }
     $this->getAdapter()->changeColumn($this->getName(), $columnName, $newColumn);
     return $this;
 }
开发者ID:stephenorr,项目名称:phinx,代码行数:25,代码来源:Table.php

示例4: setType

 /**
  * Sets the column dbType.
  *
  * @param string $type
  *
  * @return $this
  */
 public function setType($type)
 {
     $this->column->setType($type);
     return $this;
 }
开发者ID:nilopc-interesting-libs,项目名称:sql-schema-builder,代码行数:12,代码来源:Column.php


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