/dbal/src/drivers/sqlite/lmbSqliteColumnInfo.class.php
PHP | 69 lines | 44 code | 12 blank | 13 comment | 0 complexity | 3229b0680f1192964440f0e901199a58 MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-3.0, MPL-2.0-no-copyleft-exception, GPL-2.0
- <?php
- /*
- * Limb PHP Framework
- *
- * @link http://limb-project.com
- * @copyright Copyright © 2004-2009 BIT(http://bit-creative.com)
- * @license LGPL http://www.gnu.org/copyleft/lesser.html
- */
- lmb_require('limb/dbal/src/drivers/lmbDbColumnInfo.class.php');
- lmb_require(dirname(__FILE__) . '/lmbSqliteTypeInfo.class.php');
- /**
- * class lmbSqliteColumnInfo.
- *
- * @package dbal
- * @version $Id$
- */
- class lmbSqliteColumnInfo extends lmbDbColumnInfo
- {
- protected $nativeType;
- protected $isAutoIncrement;
- protected $isExisting = false;
- function __construct(
- $table,
- $name,
- $nativeType = null,
- $size = null,
- $scale = null,
- $isNullable = null,
- $default = null,
- $isAutoIncrement = null,
- $isExisting = false)
- {
- $this->nativeType = $this->canonicalizeNativeType($nativeType);
- $this->isAutoIncrement = $this->canonicalizeIsAutoincrement($isAutoIncrement);
- $typeinfo = new lmbSqliteTypeInfo();
- $typemap = $typeinfo->getNativeToColumnTypeMapping();
- $type = $typemap[$this->nativeType];
- $this->isExisting = $isExisting;
- parent::__construct($table, $name, $type, $size, $scale, $isNullable, $default);
- }
- function getNativeType()
- {
- return $this->nativeType;
- }
- function canonicalizeNativeType($nativeType)
- {
- return strtolower($nativeType);
- }
- function isAutoIncrement()
- {
- return $this->isAutoIncrement === true;
- }
- function canonicalizeIsAutoIncrement($isAutoIncrement)
- {
- return is_null($isAutoIncrement) ? null : (bool) $isAutoIncrement;
- }
- }