本文整理汇总了PHP中Column::setLength方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::setLength方法的具体用法?PHP Column::setLength怎么用?PHP Column::setLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Column
的用法示例。
在下文中一共展示了Column::setLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInternalColumns
protected function getInternalColumns()
{
if (is_null($this->columns)) {
$this->columns = array();
$keyLength = $this->getKeyLength();
if (is_null($keyLength)) {
throw new ErrorException("Cannot create meta-table-schema for indicies when no key-length is specified!");
}
$columnPage = new Column();
for ($i = 1; $i <= 33; $i++) {
$columnPage->setName("ref{$i}");
$columnPage->setDataType(DataType::INT());
$columnPage->setLength($keyLength);
$columnPage->setExtraFlags(Column::EXTRA_PRIMARY_KEY);
$this->columns[] = clone $columnPage;
$columnPage->setName("val{$i}");
$columnPage->setDataType(DataType::INT());
$columnPage->setLength($keyLength);
$columnPage->setExtraFlags(Column::EXTRA_PRIMARY_KEY);
$this->columns[] = clone $columnPage;
$columnPage->setName("row{$i}");
$columnPage->setDataType(DataType::INT());
$columnPage->setLength($keyLength);
$columnPage->setExtraFlags(Column::EXTRA_PRIMARY_KEY);
$this->columns[] = clone $columnPage;
}
}
return $this->columns;
}
示例2: setColumns
/**
* Creates the column from a given array
*
* @param array $columns
*/
public function setColumns($columns)
{
if (false == is_array($columns)) {
return;
}
foreach ($columns as $name => $options) {
$column = new Column();
$type = $this->getOptionByKey("type", $options);
$length = $this->getOptionByKey("length", $options);
$notNull = $this->getOptionByKey("notNull", $options);
$autoIncrement = $this->getOptionByKey("autoIncrement", $options);
$index = $this->getOptionByKey("index", $options);
$collate = $this->getOptionByKey("collate", $options);
$column->setName($name);
// Set all options if set
if (false != $type) {
$column->setType($type);
}
if (false != $length) {
$column->setLength($length);
}
if (false != $notNull) {
$column->setNotNull($notNull);
}
if (false != $autoIncrement) {
$column->setAutoIncrement($autoIncrement);
}
if (false != $index) {
$column->setIndex($index);
}
if (false != $collate) {
$column->setCollate($collate);
}
// Add column
$this->columns[] = $column;
}
}
示例3: getInternalColumns
protected function getInternalColumns()
{
$columns = array();
$columnPage = new Column();
$columnPage->setName("TABLE_CATALOG");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(512);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("TABLE_SCHEMA");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(64);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("TABLE_NAME");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(64);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("TABLE_TYPE");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(64);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("ENGINE");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(64);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("VERSION");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("ROW_FORMAT");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(10);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("TABLE_ROWS");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("AVG_ROW_LENGTH");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("DATA_LENGTH");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("MAX_DATA_LENGTH");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("INDEX_LENGTH");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("DATA_FREE");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("AUTO_INCREMENT");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("CREATE_TIME");
$columnPage->setDataType(DataType::DATETIME());
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("UPDATE_TIME");
$columnPage->setDataType(DataType::DATETIME());
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("CHECK_TIME");
$columnPage->setDataType(DataType::DATETIME());
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("TABLE_COLLATION");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(32);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("CHECKSUM");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("CREATE_OPTIONS");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(32);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("TABLE_COMMENT");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(32);
$columns[$columnPage->getName()] = clone $columnPage;
return $columns;
}