aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2009-03-08 13:24:12 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2009-03-08 13:24:12 +0000
commit63ed82313764391db77f38e7e7bfe379280fdf4a (patch)
tree052a6b1e4b173af45c24743f8ea359ef6abec5ef /phpBB/includes
parent169a2288995276837a2476cf32fa237d52414817 (diff)
downloadforums-63ed82313764391db77f38e7e7bfe379280fdf4a.tar
forums-63ed82313764391db77f38e7e7bfe379280fdf4a.tar.gz
forums-63ed82313764391db77f38e7e7bfe379280fdf4a.tar.bz2
forums-63ed82313764391db77f38e7e7bfe379280fdf4a.tar.xz
forums-63ed82313764391db77f38e7e7bfe379280fdf4a.zip
fix bug #42635 (missed identity)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9361 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/db/db_tools.php30
1 files changed, 27 insertions, 3 deletions
diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php
index 601f1be38b..70c946574b 100644
--- a/phpBB/includes/db/db_tools.php
+++ b/phpBB/includes/db/db_tools.php
@@ -338,7 +338,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)
@@ -347,7 +356,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)
@@ -972,6 +990,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';
@@ -1013,7 +1037,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';
}