mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
fix bug #42635 (missed identity)
git-svn-id: file:///svn/phpbb/trunk@9362 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
e40d9c4386
commit
fac9c024ff
1 changed files with 27 additions and 3 deletions
|
@ -88,7 +88,16 @@ class phpbb_db_tools
|
||||||
$create_sequence = false;
|
$create_sequence = false;
|
||||||
|
|
||||||
// Begin table sql statement
|
// Begin table sql statement
|
||||||
|
switch ($this->sql_layer)
|
||||||
|
{
|
||||||
|
case 'mssql':
|
||||||
|
$table_sql = 'CREATE TABLE [' . $table_name . '] (' . "\n";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
$table_sql = 'CREATE TABLE ' . $table_name . ' (' . "\n";
|
$table_sql = 'CREATE TABLE ' . $table_name . ' (' . "\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Iterate through the columns to create a table
|
// Iterate through the columns to create a table
|
||||||
foreach ($table_data['COLUMNS'] as $column_name => $column_data)
|
foreach ($table_data['COLUMNS'] as $column_name => $column_data)
|
||||||
|
@ -97,7 +106,16 @@ class phpbb_db_tools
|
||||||
$prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data);
|
$prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data);
|
||||||
|
|
||||||
// here we add the definition of the new column to the list of columns
|
// here we add the definition of the new column to the list of columns
|
||||||
|
switch ($this->sql_layer)
|
||||||
|
{
|
||||||
|
case 'mssql':
|
||||||
|
$columns[] = "\t [{$column_name}] " . $prepared_column['column_type_sql_default'];
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
$columns[] = "\t {$column_name} " . $prepared_column['column_type_sql'];
|
$columns[] = "\t {$column_name} " . $prepared_column['column_type_sql'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// see if we have found a primary key set due to a column definition if we have found it, we can stop looking
|
// see if we have found a primary key set due to a column definition if we have found it, we can stop looking
|
||||||
if (!$primary_key_gen)
|
if (!$primary_key_gen)
|
||||||
|
@ -1556,6 +1574,12 @@ class phpbb_db_tools
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($column_data[2]) && $column_data[2] == 'auto_increment')
|
||||||
|
{
|
||||||
|
// $sql .= 'IDENTITY (1, 1) ';
|
||||||
|
$sql_default .= 'IDENTITY (1, 1) ';
|
||||||
|
}
|
||||||
|
|
||||||
$return_array['textimage'] = $column_type === '[text]';
|
$return_array['textimage'] = $column_type === '[text]';
|
||||||
|
|
||||||
$sql .= 'NOT NULL';
|
$sql .= 'NOT NULL';
|
||||||
|
@ -1595,7 +1619,7 @@ class phpbb_db_tools
|
||||||
// In Oracle empty strings ('') are treated as NULL.
|
// In Oracle empty strings ('') are treated as NULL.
|
||||||
// Therefore in oracle we allow NULL's for all DEFAULT '' entries
|
// Therefore in oracle we allow NULL's for all DEFAULT '' entries
|
||||||
// Oracle does not like setting NOT NULL on a column that is already NOT NULL (this happens only on number fields)
|
// Oracle does not like setting NOT NULL on a column that is already NOT NULL (this happens only on number fields)
|
||||||
if (preg_match('/number/i', $column_type))
|
if (!preg_match('/number/i', $column_type))
|
||||||
{
|
{
|
||||||
$sql .= ($column_data[1] === '') ? '' : 'NOT NULL';
|
$sql .= ($column_data[1] === '') ? '' : 'NOT NULL';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue