Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Db / Sql / Ddl / Constraint / UniqueKey.php
blobadb496cbe703ae57c3fbd0443ff511c89ded0fa4
1 <?php
2 /**
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
8 */
10 namespace Zend\Db\Sql\Ddl\Constraint;
12 class UniqueKey extends AbstractConstraint
14 /**
15 * @var string
17 protected $specification = 'CONSTRAINT UNIQUE KEY %s(...)';
19 /**
20 * @param string $column
21 * @param null|string $name
23 public function __construct($column, $name = null)
25 $this->setColumns($column);
26 $this->name = $name;
29 /**
30 * @return array
32 public function getExpressionData()
34 $colCount = count($this->columns);
36 $values = array();
37 $values[] = ($this->name) ? $this->name : '';
39 $newSpecTypes = array(self::TYPE_IDENTIFIER);
40 $newSpecParts = array();
42 for ($i = 0; $i < $colCount; $i++) {
43 $newSpecParts[] = '%s';
44 $newSpecTypes[] = self::TYPE_IDENTIFIER;
47 $newSpec = str_replace('...', implode(', ', $newSpecParts), $this->specification);
49 return array(array(
50 $newSpec,
51 array_merge($values, $this->columns),
52 $newSpecTypes,
53 ));