diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2009-03-08 13:31:41 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2009-03-08 13:31:41 +0000 |
commit | fac9c024ff370eb4c34f7a7ffa9048732e5c74c7 (patch) | |
tree | 251d0e23986a6c3f30b27918c715fb671f0276d1 /phpBB | |
parent | e40d9c4386f2b2e1ec01ee668934808247fbaf6f (diff) | |
download | forums-fac9c024ff370eb4c34f7a7ffa9048732e5c74c7.tar forums-fac9c024ff370eb4c34f7a7ffa9048732e5c74c7.tar.gz forums-fac9c024ff370eb4c34f7a7ffa9048732e5c74c7.tar.bz2 forums-fac9c024ff370eb4c34f7a7ffa9048732e5c74c7.tar.xz forums-fac9c024ff370eb4c34f7a7ffa9048732e5c74c7.zip |
fix bug #42635 (missed identity)
git-svn-id: file:///svn/phpbb/trunk@9362 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/db/db_tools.php | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php index 3eb8785bd7..32ee807952 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/includes/db/db_tools.php @@ -88,7 +88,16 @@ class phpbb_db_tools $create_sequence = false; // Begin table sql statement - $table_sql = 'CREATE TABLE ' . $table_name . ' (' . "\n"; + switch ($this->sql_layer) + { + case 'mssql': + $table_sql = 'CREATE TABLE [' . $table_name . '] (' . "\n"; + break; + + default: + $table_sql = 'CREATE TABLE ' . $table_name . ' (' . "\n"; + break; + } // Iterate through the columns to create a table 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); // here we add the definition of the new column to the list of columns - $columns[] = "\t {$column_name} " . $prepared_column['column_type_sql']; + 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']; + break; + } // 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) @@ -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]'; $sql .= 'NOT NULL'; @@ -1595,7 +1619,7 @@ class phpbb_db_tools // In Oracle empty strings ('') are treated as NULL. // 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) - if (preg_match('/number/i', $column_type)) + if (!preg_match('/number/i', $column_type)) { $sql .= ($column_data[1] === '') ? '' : 'NOT NULL'; } |