mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-09 20:12:14 +09:00
Issue 1741: Create table with combined primary key fails on MSSQL
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10458 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
867af986f4
commit
a75e4a6384
1 changed files with 8 additions and 3 deletions
|
|
@ -348,20 +348,25 @@
|
||||||
$default = $column->attrs->default;
|
$default = $column->attrs->default;
|
||||||
$auto_increment = $column->attrs->auto_increment;
|
$auto_increment = $column->attrs->auto_increment;
|
||||||
|
|
||||||
$column_schema[] = sprintf('[%s] %s%s %s %s %s %s',
|
$column_schema[] = sprintf('[%s] %s%s %s %s %s',
|
||||||
$name,
|
$name,
|
||||||
$this->column_type[$type],
|
$this->column_type[$type],
|
||||||
!in_array($type,array('number','text'))&&$size?'('.$size.')':'',
|
!in_array($type,array('number','text'))&&$size?'('.$size.')':'',
|
||||||
$primary_key?'primary key':'',
|
|
||||||
isset($default)?"default '".$default."'":'',
|
isset($default)?"default '".$default."'":'',
|
||||||
$notnull?'not null':'null',
|
$notnull?'not null':'null',
|
||||||
$auto_increment?'identity(1,1)':''
|
$auto_increment?'identity(1,1)':''
|
||||||
);
|
);
|
||||||
|
|
||||||
if($unique) $unique_list[$unique][] = $name;
|
if($primary_key) $primary_list[] = $name;
|
||||||
|
else if($unique) $unique_list[$unique][] = $name;
|
||||||
else if($index) $index_list[$index][] = $name;
|
else if($index) $index_list[$index][] = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(count($primary_list))
|
||||||
|
{
|
||||||
|
$column_schema[] = sprintf("primary key (%s)", '"'.implode($primary_list,'","').'"');
|
||||||
|
}
|
||||||
|
|
||||||
$schema = sprintf('create table [%s] (xe_seq int identity(1,1),%s%s)', $this->addQuotes($table_name), "\n", implode($column_schema,",\n"));
|
$schema = sprintf('create table [%s] (xe_seq int identity(1,1),%s%s)', $this->addQuotes($table_name), "\n", implode($column_schema,",\n"));
|
||||||
$output = $this->_query($schema);
|
$output = $this->_query($schema);
|
||||||
if(!$output) return false;
|
if(!$output) return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue