3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Db\Sql\Ddl\Column
;
12 class Decimal
extends Column
27 protected $specification = '%s DECIMAL(%s) %s %s';
30 * @param null|string $name
31 * @param int $precision
32 * @param null|int $scale
34 public function __construct($name, $precision, $scale = null)
37 $this->precision
= $precision;
38 $this->scale
= $scale;
44 public function getExpressionData()
46 $spec = $this->specification
;
49 $types = array(self
::TYPE_IDENTIFIER
, self
::TYPE_LITERAL
);
50 $params[] = $this->name
;
51 $params[] = $this->precision
;
53 if ($this->scale
!== null) {
54 $params[1] .= ', ' . $this->scale
;
57 $types[] = self
::TYPE_LITERAL
;
58 $params[] = (!$this->isNullable
) ?
'NOT NULL' : '';
60 $types[] = ($this->default !== null) ? self
::TYPE_VALUE
: self
::TYPE_LITERAL
;
61 $params[] = ($this->default !== null) ?
$this->default : '';