Browse Source

Updated code styling and added braces.

tags/2.0.0-beta
gevik 12 years ago
parent
commit
c338d4b76b
  1. 8
      framework/yii/db/QueryBuilder.php

8
framework/yii/db/QueryBuilder.php

@ -278,10 +278,14 @@ class QueryBuilder extends \yii\base\Object
*/
public function addPrimaryKey($name, $table, $columns)
{
if(is_string($columns))
if (is_string($columns)) {
$columns=preg_split('/\s*,\s*/',$columns,-1,PREG_SPLIT_NO_EMPTY);
foreach($columns as $i=>$col)
}
foreach ($columns as $i=>$col) {
$columns[$i]=$this->db->quoteColumnName($col);
}
return 'ALTER TABLE ' . $this->db->quoteTableName($table) . ' ADD CONSTRAINT '
. $this->db->quoteColumnName($name) . ' PRIMARY KEY ('
. implode(', ', $columns). ' )';

Loading…
Cancel
Save