diff options
Diffstat (limited to 'phpBB/includes')
| -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';  				} | 
