Zeile 1093 | Zeile 1093 |
---|
$primary_key = array(); $primary_key_name = '';
|
$primary_key = array(); $primary_key_name = '';
|
| $unique_keys = array();
|
// We do this in two steps. It makes placing the comma easier while($row = $this->fetch_array($query)) { if($row['primary_key'] == 't')
|
// We do this in two steps. It makes placing the comma easier while($row = $this->fetch_array($query)) { if($row['primary_key'] == 't')
|
{
| {
|
$primary_key[] = $row['column_name']; $primary_key_name = $row['index_name']; }
|
$primary_key[] = $row['column_name']; $primary_key_name = $row['index_name']; }
|
| if($row['unique_key'] == 't') { $unique_keys[$row['index_name']][] = $row['column_name']; } }
if(!empty($primary_key)) { $lines[] = " CONSTRAINT $primary_key_name PRIMARY KEY (".implode(', ', $primary_key).")";
|
}
|
}
|
if(!empty($primary_key))
| foreach($unique_keys as $key_name => $key_columns)
|
{
|
{
|
$lines[] = " CONSTRAINT $primary_key_name PRIMARY KEY (".implode(', ', $primary_key).")";
| $lines[] = " CONSTRAINT $key_name UNIQUE (".implode(', ', $key_columns).")";
|
}
$table_lines .= implode(", \n", $lines);
| }
$table_lines .= implode(", \n", $lines);
|