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


PHP Column::setLimit方法代码示例

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


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

示例1: getColumns

 /**
  * {@inheritdoc}
  */
 public function getColumns($tableName)
 {
     $columns = array();
     $sql = sprintf("SELECT column_name, data_type, is_identity, is_nullable,\n             column_default, character_maximum_length, numeric_precision, numeric_scale\n             FROM information_schema.columns\n             WHERE table_name ='%s'", $tableName);
     $columnsInfo = $this->fetchAll($sql);
     foreach ($columnsInfo as $columnInfo) {
         $column = new Column();
         $column->setName($columnInfo['column_name'])->setType($this->getPhinxType($columnInfo['data_type']))->setNull($columnInfo['is_nullable'] === 'YES')->setDefault($columnInfo['column_default'])->setIdentity($columnInfo['is_identity'] === 'YES')->setPrecision($columnInfo['numeric_precision'])->setScale($columnInfo['numeric_scale']);
         if (preg_match('/\\bwith time zone$/', $columnInfo['data_type'])) {
             $column->setTimezone(true);
         }
         if (isset($columnInfo['character_maximum_length'])) {
             $column->setLimit($columnInfo['character_maximum_length']);
         }
         $columns[] = $column;
     }
     return $columns;
 }
开发者ID:jaambageek,项目名称:cakeboot-template,代码行数:21,代码来源:PostgresAdapter.php

示例2: getColumns

 /**
  * {@inheritdoc}
  */
 public function getColumns($tableName)
 {
     $columns = array();
     $sql = sprintf("SELECT DISTINCT TABLE_SCHEMA AS [schema], TABLE_NAME as [table_name], COLUMN_NAME AS [name], DATA_TYPE AS [type],\n            IS_NULLABLE AS [null], COLUMN_DEFAULT AS [default],\n            CHARACTER_MAXIMUM_LENGTH AS [char_length],\n            NUMERIC_PRECISION AS [precision],\n            NUMERIC_SCALE AS [scale], ORDINAL_POSITION AS [ordinal_position],\n            COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') as [identity]\n        FROM INFORMATION_SCHEMA.COLUMNS\n        WHERE TABLE_NAME = '%s'\n        ORDER BY ordinal_position", $tableName);
     $rows = $this->fetchAll($sql);
     foreach ($rows as $columnInfo) {
         $column = new Column();
         $column->setName($columnInfo['name'])->setType($this->getPhinxType($columnInfo['type']))->setNull($columnInfo['null'] !== 'NO')->setDefault($this->parseDefault($columnInfo['default']))->setIdentity($columnInfo['identity'] === '1')->setComment($this->getColumnComment($columnInfo['table_name'], $columnInfo['name']));
         if (!empty($columnInfo['char_length'])) {
             $column->setLimit($columnInfo['char_length']);
         }
         $columns[$columnInfo['name']] = $column;
     }
     return $columns;
 }
开发者ID:lhas,项目名称:pep,代码行数:18,代码来源:SqlServerAdapter.php

示例3: setLimit

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


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