Index: includes/acp/acp_database.php =================================================================== --- includes/acp/acp_database.php (revision 10460) +++ includes/acp/acp_database.php (working copy) @@ -109,6 +109,7 @@ case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $extractor = new mssql_extractor($download, $store, $format, $filename, $time); break; @@ -138,6 +139,7 @@ case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $extractor->flush('TRUNCATE TABLE ' . $table_name . "GO\n"); break; @@ -1509,6 +1511,10 @@ { $this->write_data_mssql($table_name); } + else if($db->sql_layer === 'mssqlnative') + { + $this->write_data_mssqlnative($table_name); + } else { $this->write_data_odbc($table_name); @@ -1608,7 +1614,103 @@ } $this->flush($sql_data); } + + function write_data_mssqlnative($table_name) + { + global $db; + $ary_type = $ary_name = $meta_array = array(); + $ident_set = false; + $sql_data = ''; + // Grab all of the data from current table. + $sql = "SELECT * FROM $table_name"; + $result = $db->sql_query($sql); + + $retrieved_data = $db->mssqlnative_numRows($result); + + $meta_array = sqlsrv_field_metadata($result); + $i_num_fields = sqlsrv_num_fields($result); + + for ($i = 0; $i < $i_num_fields; $i++) + { + $info = $db->mssqlnative_fieldInfo($table_name, $meta_array[$i]['Name']); + $ary_type[$i] = $info->type(); + $ary_name[$i] = $info->name(); + } + + if ($retrieved_data) + { + $sql = "SELECT 1 as has_identity + FROM INFORMATION_SCHEMA.COLUMNS + WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1"; + $result2 = $db->sql_query($sql); + $row2 = $db->sql_fetchrow($result2); + + if (!empty($row2['has_identity'])) + { + $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n"; + $ident_set = true; + } + $db->sql_freeresult($result2); + } + + while ($row = $db->sql_fetchrow($result)) + { + $schema_vals = $schema_fields = array(); + + // Build the SQL statement to recreate the data. + for ($i = 0; $i < $i_num_fields; $i++) + { + $str_val = $row[$ary_name[$i]]; + + if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) + { + $str_quote = ''; + $str_empty = "''"; + $str_val = sanitize_data_mssql(str_replace("'", "''", $str_val)); + } + else if (preg_match('#date|timestamp#i', $ary_type[$i])) + { + if (empty($str_val)) + { + $str_quote = ''; + } + else + { + $str_quote = "'"; + } + } + else + { + $str_quote = ''; + $str_empty = 'NULL'; + } + + if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val))) + { + $str_val = $str_empty; + } + + $schema_vals[$i] = $str_quote . $str_val . $str_quote; + $schema_fields[$i] = $ary_name[$i]; + } + + // Take the ordered fields and their associated data and build it + // into a valid sql statement to recreate that field in the data. + $sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\nGO\n"; + + $this->flush($sql_data); + $sql_data = ''; + } + $db->sql_freeresult($result); + + if ($retrieved_data && $ident_set) + { + $sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n"; + } + $this->flush($sql_data); + } + function write_data_odbc($table_name) { global $db; Index: includes/cache.php =================================================================== --- includes/cache.php (revision 10460) +++ includes/cache.php (working copy) @@ -297,6 +297,7 @@ { case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $sql = 'SELECT user_id, bot_agent, bot_ip FROM ' . BOTS_TABLE . ' WHERE bot_active = 1 Index: includes/db/db_tools.php =================================================================== --- includes/db/db_tools.php (revision 10460) +++ includes/db/db_tools.php (working copy) @@ -159,7 +159,37 @@ 'VCHAR_CI' => '[varchar] (255)', 'VARBINARY' => '[varchar] (255)', ), - + + 'mssqlnative' => array( + 'INT:' => '[int]', + 'BINT' => '[float]', + 'UINT' => '[int]', + 'UINT:' => '[int]', + 'TINT:' => '[int]', + 'USINT' => '[int]', + 'BOOL' => '[int]', + 'VCHAR' => '[varchar] (255)', + 'VCHAR:' => '[varchar] (%d)', + 'CHAR:' => '[char] (%d)', + 'XSTEXT' => '[varchar] (1000)', + 'STEXT' => '[varchar] (3000)', + 'TEXT' => '[varchar] (8000)', + 'MTEXT' => '[text]', + 'XSTEXT_UNI'=> '[varchar] (100)', + 'STEXT_UNI' => '[varchar] (255)', + 'TEXT_UNI' => '[varchar] (4000)', + 'MTEXT_UNI' => '[text]', + 'TIMESTAMP' => '[int]', + 'DECIMAL' => '[float]', + 'DECIMAL:' => '[float]', + 'PDECIMAL' => '[float]', + 'PDECIMAL:' => '[float]', + 'VCHAR_UNI' => '[varchar] (255)', + 'VCHAR_UNI:'=> '[varchar] (%d)', + 'VCHAR_CI' => '[varchar] (255)', + 'VARBINARY' => '[varchar] (255)', + ), + 'oracle' => array( 'INT:' => 'number(%d)', 'BINT' => 'number(20)', @@ -261,7 +291,7 @@ * A list of supported DBMS. We change this class to support more DBMS, the DBMS itself only need to follow some rules. * @var array */ - var $supported_dbms = array('firebird', 'mssql', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite'); + var $supported_dbms = array('firebird', 'mssql', 'mssqlnative', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite'); /** * This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array). @@ -306,6 +336,10 @@ case 'mssql_odbc': $this->sql_layer = 'mssql'; break; + + case 'mssqlnative': + $this->sql_layer = 'mssqlnative'; + break; default: $this->sql_layer = $this->db->sql_layer; @@ -368,6 +402,7 @@ switch ($this->sql_layer) { case 'mssql': + case 'mssqlnative': $table_sql = 'CREATE TABLE [' . $table_name . '] (' . "\n"; break; @@ -386,6 +421,7 @@ switch ($this->sql_layer) { case 'mssql': + case 'mssqlnative': $columns[] = "\t [{$column_name}] " . $prepared_column['column_type_sql_default']; break; @@ -425,6 +461,7 @@ break; case 'mssql': + case 'mssqlnative': $table_sql .= "\n) ON [PRIMARY]" . (($create_textimage) ? ' TEXTIMAGE_ON [PRIMARY]' : ''); $statements[] = $table_sql; break; @@ -453,6 +490,7 @@ case 'firebird': case 'mssql': + case 'mssqlnative': // We need the data here $old_return_statements = $this->return_statements; $this->return_statements = true; @@ -970,6 +1008,7 @@ // same deal with PostgreSQL, we must perform more complex operations than // we technically could case 'mssql': + case 'mssqlnative': $sql = "SELECT c.name FROM syscolumns c LEFT JOIN sysobjects o ON c.id = o.id @@ -1187,6 +1226,7 @@ break; case 'mssql': + case 'mssqlnative': $sql .= " {$column_type} "; $sql_default = " {$column_type} "; @@ -1335,6 +1375,7 @@ break; case 'mssql': + case 'mssqlnative': $statements[] = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default']; break; @@ -1455,6 +1496,7 @@ break; case 'mssql': + case 'mssqlnative': $statements[] = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']'; break; @@ -1549,6 +1591,7 @@ switch ($this->sql_layer) { case 'mssql': + case 'mssqlnative': $statements[] = 'DROP INDEX ' . $table_name . '.' . $index_name; break; @@ -1652,6 +1695,7 @@ break; case 'mssql': + case 'mssqlnative': $sql = "ALTER TABLE [{$table_name}] WITH NOCHECK ADD "; $sql .= "CONSTRAINT [PK_{$table_name}] PRIMARY KEY CLUSTERED ("; $sql .= '[' . implode("],\n\t\t[", $column) . ']'; @@ -1745,6 +1789,7 @@ break; case 'mssql': + case 'mssqlnative': $statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; break; } @@ -1774,6 +1819,7 @@ break; case 'mssql': + case 'mssqlnative': $statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; break; } @@ -1791,7 +1837,7 @@ { $index_array = array(); - if ($this->sql_layer == 'mssql') + if ($this->sql_layer == 'mssql' || $this->sql_laery == 'mssqlnative') { $sql = "EXEC sp_statistics '$table_name'"; $result = $this->db->sql_query($sql); @@ -1900,6 +1946,7 @@ break; case 'mssql': + case 'mssqlnative': $statements[] = 'ALTER TABLE [' . $table_name . '] ALTER COLUMN [' . $column_name . '] ' . $column_data['column_type_sql']; if (!empty($column_data['default'])) Index: includes/db/mssqlnative.php =================================================================== --- includes/db/mssqlnative.php (revision 0) +++ includes/db/mssqlnative.php (revision 0) @@ -0,0 +1,592 @@ +m_cursor = 0; + $this->m_rows = array(); + $this->m_num_fields = sqlsrv_num_fields($queryresult); + $this->m_field_meta = sqlsrv_field_metadata($queryresult); + + while($row = sqlsrv_fetch_array($queryresult, SQLSRV_FETCH_ASSOC)) + { + if($row !== null) + { + foreach($row as $k => $v) + { + if (is_object($v) && method_exists($v, 'format')) + { + $row[$k] = $v->format("Y-m-d\TH:i:s\Z"); + } + } + $this->m_rows[] = $row;//read results into memory, cursors are not supported + } + } + + $this->m_row_count = count($this->m_rows); + sqlsrv_free_stmt($queryresult); + } + + private function array_to_obj($array, &$obj) + { + foreach ($array as $key => $value) + { + if (is_array($value)) + { + $obj->$key = new stdClass(); + array_to_obj($value, $obj->$key); + } + else + { + $obj->$key = $value; + } + } + return $obj; + } + + public function fetch($mode=SQLSRV_FETCH_BOTH, $object_class = 'stdClass') + { + if($this->m_cursor >= $this->m_row_count || $this->m_row_count == 0) + { + return false; + } + + $ret = false; + $arr_num = array(); + + if($mode == SQLSRV_FETCH_NUMERIC || $mode == SQLSRV_FETCH_BOTH) + { + foreach($this->m_rows[$this->m_cursor] as $key=>$value) + { + $arr_num[] = $value; + } + } + + switch($mode) + { + case SQLSRV_FETCH_ASSOC: + $ret = $this->m_rows[$this->m_cursor]; + break; + case SQLSRV_FETCH_NUMERIC: + $ret = $arr_num; + break; + case 'OBJECT': + $ret = $this->array_to_obj($this->m_rows[$this->m_cursor], $o = new $object_class); + break; + case SQLSRV_FETCH_BOTH: + default: + $ret = $this->m_rows[$this->m_cursor] + $arr_num; + break; + } + $this->m_cursor++; + return $ret; + } + + public function get($pos, $fld) + { + return $this->m_rows[$pos][$fld]; + } + + public function num_rows() + { + return $this->m_row_count; + } + + public function seek($iRow) + { + $this->m_cursor = min($iRow, $this->m_row_count); + } + + public function num_fields() + { + return $this->m_num_fields; + } + + public function field_name($nr) + { + $arr_keys = array_keys($this->m_rows[0]); + return $arr_keys[$nr]; + } + + public function field_type($nr) + { + $i=0; + $int_type = -1; + $str_type = ''; + + foreach($this->m_field_meta as $meta) + { + if($nr==$i) + { + $int_type = $meta['Type']; + break; + } + $i++; + } + + //http://msdn.microsoft.com/en-us/library/cc296183.aspx contains type table + switch($int_type) + { + case SQLSRV_SQLTYPE_BIGINT: $str_type = 'bigint'; break; + case SQLSRV_SQLTYPE_BINARY: $str_type = 'binary'; break; + case SQLSRV_SQLTYPE_BIT: $str_type = 'bit'; break; + case SQLSRV_SQLTYPE_CHAR: $str_type = 'char'; break; + case SQLSRV_SQLTYPE_DATETIME: $str_type = 'datetime'; break; + case SQLSRV_SQLTYPE_DECIMAL/*($precision, $scale)*/: $str_type = 'decimal'; break; + case SQLSRV_SQLTYPE_FLOAT: $str_type = 'float'; break; + case SQLSRV_SQLTYPE_IMAGE: $str_type = 'image'; break; + case SQLSRV_SQLTYPE_INT: $str_type = 'int'; break; + case SQLSRV_SQLTYPE_MONEY: $str_type = 'money'; break; + case SQLSRV_SQLTYPE_NCHAR/*($charCount)*/: $str_type = 'nchar'; break; + case SQLSRV_SQLTYPE_NUMERIC/*($precision, $scale)*/: $str_type = 'numeric'; break; + case SQLSRV_SQLTYPE_NVARCHAR/*($charCount)*/: $str_type = 'nvarchar'; break; + case SQLSRV_SQLTYPE_NTEXT: $str_type = 'ntext'; break; + case SQLSRV_SQLTYPE_REAL: $str_type = 'real'; break; + case SQLSRV_SQLTYPE_SMALLDATETIME: $str_type = 'smalldatetime'; break; + case SQLSRV_SQLTYPE_SMALLINT: $str_type = 'smallint'; break; + case SQLSRV_SQLTYPE_SMALLMONEY: $str_type = 'smallmoney'; break; + case SQLSRV_SQLTYPE_TEXT: $str_type = 'text'; break; + case SQLSRV_SQLTYPE_TIMESTAMP: $str_type = 'timestamp'; break; + case SQLSRV_SQLTYPE_TINYINT: $str_type = 'tinyint'; break; + case SQLSRV_SQLTYPE_UNIQUEIDENTIFIER: $str_type = 'uniqueidentifier'; break; + case SQLSRV_SQLTYPE_UDT: $str_type = 'UDT'; break; + case SQLSRV_SQLTYPE_VARBINARY/*($byteCount)*/: $str_type = 'varbinary'; break; + case SQLSRV_SQLTYPE_VARCHAR/*($charCount)*/: $str_type = 'varchar'; break; + case SQLSRV_SQLTYPE_XML: $str_type = 'xml'; break; + default: $str_type = $int_type; + } + return $str_type; + } + + public function free() + { + unset($this->m_rows); + return; + } +} + +/** +* @package dbal +*/ +class dbal_mssqlnative extends dbal +{ + var $m_insert_id = NULL; + var $last_query_text = ''; + + /** + * Connect to server + */ + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + # Test for driver support, to avoid suppressed fatal error + if (!function_exists('sqlsrv_connect')) + { + die('MS Sql Server Native (sqlsrv) functions missing. You can download the driver from: http://go.microsoft.com/fwlink/?LinkId=123470\n'); + } + + //set up connection variables + $this->persistency = $persistency; + $this->user = $sqluser; + $this->dbname = $database; + $port_delimiter = (defined('PHP_OS') && substr(PHP_OS, 0, 3) === 'WIN') ? ',' : ':'; + $this->server = $sqlserver . (($port) ? $port_delimiter . $port : ''); + + //connect to database + error_reporting( E_ALL ); + $this->db_connect_id = sqlsrv_connect($this->server, array('Database'=>$this->dbname,'UID'=>$this->user,'PWD'=>$sqlpassword)); + + if($this->db_connect_id === false) + { + print_r('Unable to connect to database:
'); + die(print_r(sqlsrv_errors(), true)); + } + return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); + } + + /** + * Version information about used database + * @param bool $raw if true, only return the fetched sql_server_version + * @return string sql server version + */ + function sql_server_info($raw = false) + { + global $cache; + + if (empty($cache) || ($this->sql_server_version = $cache->get('mssql_version')) === false) + { + $arr_server_info = sqlsrv_server_info($this->db_connect_id); + $this->sql_server_version = $arr_server_info['SQLServerVersion']; + + if (!empty($cache)) + { + $cache->put('mssql_version', $this->sql_server_version); + } + } + + if ($raw) + { + return $this->sql_server_version; + } + + return ($this->sql_server_version) ? 'MSSQL
' . $this->sql_server_version : 'MSSQL'; + } + + /** + * SQL Transaction + * @access private + */ + function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return sqlsrv_begin_transaction($this->db_connect_id); + break; + + case 'commit': + return sqlsrv_commit($this->db_connect_id); + break; + + case 'rollback': + return sqlsrv_rollback($this->db_connect_id); + break; + } + return true; + } + + /** + * Base query method + * + * @param string $query Contains the SQL query which shall be executed + * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache + * @return mixed When casted to bool the returned value returns true on success and false on failure + * + * @access public + */ + function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + // EXPLAIN only in extra debug mode + if (defined('DEBUG_EXTRA')) + { + $this->sql_report('start', $query); + } + + $this->last_query_text = $query; + $this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + if (($this->query_result = @sqlsrv_query($this->db_connect_id, $query)) === false) + { + $this->sql_error($query); + } + + if (defined('DEBUG_EXTRA')) + { + $this->sql_report('stop', $query); + } + + if ($cache_ttl && method_exists($cache, 'sql_save')) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + $cache->sql_save($query, $this->query_result, $cache_ttl); + } + else if (strpos($query, 'SELECT') === 0 && $this->query_result) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + } + } + else if (defined('DEBUG_EXTRA')) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + return $this->query_result; + } + + /** + * Build LIMIT query + */ + function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + $this->query_result = false; + + if($offset === false || $offset == 0) + { + if (strpos($query, "SELECT") === false) + { + $query = "TOP {$total} " . $query; + } + else + { + $query = preg_replace('/SELECT(\s*DISTINCT)?/Dsi', 'SELECT$1 TOP '.$total, $query); + } + } + else + { + $query = preg_replace('/SELECT(\s*DISTINCT)?/Dsi', 'SELECT$1 TOP(10000000) ', $query); + $query = 'SELECT * + FROM (SELECT sub2.*, ROW_NUMBER() OVER(ORDER BY sub2.line2) AS line3 + FROM (SELECT 1 AS line2, sub1.* FROM (' . $query . ') AS sub1) as sub2) AS sub3 + WHERE line3 BETWEEN ' . ($offset+1) . ' AND ' . ($offset + $total); + } + + $result = $this->sql_query($query, $cache_ttl); + + return $result; + } + + /** + * Return number of affected rows + */ + function sql_affectedrows() + { + return ($this->db_connect_id) ? @sqlsrv_rows_affected($this->db_connect_id) : false; + } + + /** + * Fetch current row + */ + function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_fetchrow($query_id); + } + + if ($query_id === false) + { + return false; + } + + $row = @sqlsrv_fetch_array($query_id, SQLSRV_FETCH_ASSOC); + + // I hope i am able to remove this later... hopefully only a PHP or MSSQL bug + if ($row) + { + foreach ($row as $key => $value) + { + $row[$key] = ($value === ' ' || $value === NULL) ? '' : $value; + } + } + return $row; + } + + /** + * Seek to given row number + * rownum is zero-based + */ + function sql_rowseek($rownum, &$query_id) + { + global $cache; + + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_rowseek($rownum, $query_id); + } + + $seek = new result_mssqlnative($query_id); + $row = $seek->seek($rownum); + return ($row = $seek->fetch()) ? $row : false; + } + + /** + * Get last inserted id after insert statement + */ + function sql_nextid() + { + $result_id = @sqlsrv_query($this->db_connect_id, 'SELECT @@IDENTITY'); + + if ($result_id !== false) + { + $row = @sqlsrv_fetch_array($result_id); + $id = $row[0]; + @sqlsrv_free_stmt($result_id); + return $id; + } + else + { + return false; + } + } + + /** + * Free sql result + */ + function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_freeresult($query_id); + } + + if (isset($this->open_queries[$query_id])) + { + unset($this->open_queries[$query_id]); + return @sqlsrv_free_stmt($query_id); + } + return false; + } + + /** + * Escape string used in sql query + */ + function sql_escape($msg) + { + return str_replace(array("'", "\0"), array("''", ''), $msg); + } + + /** + * Build LIKE expression + * @access private + */ + function _sql_like_expression($expression) + { + return $expression . " ESCAPE '\\'"; + } + + /** + * return sql error array + * @access private + */ + function _sql_error() + { + $errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS); + $error_message = ''; + + if($errors != null) + { + foreach($errors as $error) + { + $error_message .= "SQLSTATE: ".$error[ 'SQLSTATE']."\n"; + $error_message .= "code: ".$error[ 'code']."\n"; + $error_message .= "message: ".$error[ 'message']."\n"; + } + $this->last_error_result = $error_message; + $error = $this->last_error_result; + } + else + { + $error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array(); + } + return $error; + } + + /** + * Build db-specific query data + * @access private + */ + function _sql_custom_build($stage, $data) + { + return $data; + } + + /** + * Close sql connection + * @access private + */ + function _sql_close() + { + return @sqlsrv_close($this->db_connect_id); + } + + /** + * Build db-specific report + * @access private + */ + function _sql_report($mode, $query = '') + { + switch ($mode) + { + case 'start': + $html_table = false; + @sqlsrv_query($this->db_connect_id, 'SET SHOWPLAN_TEXT ON;'); + if ($result = @sqlsrv_query($this->db_connect_id, $query)) + { + @sqlsrv_next_result($result); + while ($row = @sqlsrv_fetch_array($result)) + { + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + } + @sqlsrv_query($this->db_connect_id, 'SET SHOWPLAN_TEXT OFF;'); + @sqlsrv_free_stmt($result); + + if ($html_table) + { + $this->html_hold .= ''; + } + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = @sqlsrv_query($this->db_connect_id, $query); + while ($void = @sqlsrv_fetch_array($result)) + { + // Take the time spent on parsing rows into account + } + @sqlsrv_free_stmt($result); + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } +} + +?> \ No newline at end of file Index: includes/functions_admin.php =================================================================== --- includes/functions_admin.php (revision 10460) +++ includes/functions_admin.php (working copy) @@ -3041,6 +3041,7 @@ case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize FROM sysfiles'; $result = $db->sql_query($sql, 7200); Index: includes/functions_convert.php =================================================================== --- includes/functions_convert.php (revision 10460) +++ includes/functions_convert.php (working copy) @@ -1629,6 +1629,7 @@ case 'mssql': case 'sqlite': + case 'mssqlnative': $sql = implode(' UNION ALL ', preg_replace('#^(.*?)$#', 'SELECT \1', $sql_subary)); break; Index: includes/functions_install.php =================================================================== --- includes/functions_install.php (revision 10460) +++ includes/functions_install.php (working copy) @@ -95,6 +95,16 @@ 'AVAILABLE' => true, '2.0.x' => true, ), + 'mssqlnative' => array( + 'LABEL' => 'MS SQL Server 2005+ [ Native ]', + 'SCHEMA' => 'mssqlnative', + 'MODULE' => 'sqlsrv', + 'DELIM' => 'GO', + 'COMMENTS' => 'remove_comments', + 'DRIVER' => 'mssqlnative', + 'AVAILABLE' => true, + '2.0.x' => false, + ), 'oracle' => array( 'LABEL' => 'Oracle', 'SCHEMA' => 'oracle', @@ -220,6 +230,7 @@ case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $sql = "SELECT name FROM sysobjects WHERE type='U'"; @@ -313,6 +324,7 @@ case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $prefix_length = 90; break; Index: includes/message_parser.php =================================================================== --- includes/message_parser.php (revision 10460) +++ includes/message_parser.php (working copy) @@ -1284,6 +1284,7 @@ { case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $sql = 'SELECT * FROM ' . SMILIES_TABLE . ' ORDER BY LEN(code) DESC'; Index: install/database_update.php =================================================================== --- install/database_update.php (revision 10460) +++ install/database_update.php (working copy) @@ -1738,7 +1738,37 @@ 'VCHAR_CI' => '[varchar] (255)', 'VARBINARY' => '[varchar] (255)', ), - + + 'mssqlnative' => array( + 'INT:' => '[int]', + 'BINT' => '[float]', + 'UINT' => '[int]', + 'UINT:' => '[int]', + 'TINT:' => '[int]', + 'USINT' => '[int]', + 'BOOL' => '[int]', + 'VCHAR' => '[varchar] (255)', + 'VCHAR:' => '[varchar] (%d)', + 'CHAR:' => '[char] (%d)', + 'XSTEXT' => '[varchar] (1000)', + 'STEXT' => '[varchar] (3000)', + 'TEXT' => '[varchar] (8000)', + 'MTEXT' => '[text]', + 'XSTEXT_UNI'=> '[varchar] (100)', + 'STEXT_UNI' => '[varchar] (255)', + 'TEXT_UNI' => '[varchar] (4000)', + 'MTEXT_UNI' => '[text]', + 'TIMESTAMP' => '[int]', + 'DECIMAL' => '[float]', + 'DECIMAL:' => '[float]', + 'PDECIMAL' => '[float]', + 'PDECIMAL:' => '[float]', + 'VCHAR_UNI' => '[varchar] (255)', + 'VCHAR_UNI:'=> '[varchar] (%d)', + 'VCHAR_CI' => '[varchar] (255)', + 'VARBINARY' => '[varchar] (255)', + ), + 'oracle' => array( 'INT:' => 'number(%d)', 'BINT' => 'number(20)', @@ -1840,7 +1870,7 @@ * A list of supported DBMS. We change this class to support more DBMS, the DBMS itself only need to follow some rules. * @var array */ - var $supported_dbms = array('firebird', 'mssql', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite'); + var $supported_dbms = array('firebird', 'mssql', 'mssqlnative', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite'); /** * This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array). @@ -1885,6 +1915,10 @@ case 'mssql_odbc': $this->sql_layer = 'mssql'; break; + + case 'mssqlnative': + $this->sql_layer = 'mssqlnative'; + break; default: $this->sql_layer = $this->db->sql_layer; @@ -2317,6 +2351,7 @@ // same deal with PostgreSQL, we must perform more complex operations than // we technically could case 'mssql': + case 'mssqlnative': $sql = "SELECT c.name FROM syscolumns c LEFT JOIN sysobjects o ON c.id = o.id @@ -2420,7 +2455,7 @@ */ function sql_index_exists($table_name, $index_name) { - if ($this->sql_layer == 'mssql') + if ($this->sql_layer == 'mssql' || $this->sql_layer == 'mssqlnative') { $sql = "EXEC sp_statistics '$table_name'"; $result = $this->db->sql_query($sql); @@ -2525,7 +2560,7 @@ */ function sql_unique_index_exists($table_name, $index_name) { - if ($this->sql_layer == 'mssql') + if ($this->sql_layer == 'mssql' || $this->sql_layer == 'mssqlnative') { $sql = "EXEC sp_statistics '$table_name'"; $result = $this->db->sql_query($sql); @@ -2764,6 +2799,7 @@ break; case 'mssql': + case 'mssqlnative': $sql .= " {$column_type} "; $sql_default = " {$column_type} "; @@ -2913,6 +2949,7 @@ break; case 'mssql': + case 'mssqlnative': // Does not support AFTER, only through temporary table $statements[] = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default']; break; @@ -3037,6 +3074,7 @@ break; case 'mssql': + case 'mssqlnative': $statements[] = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']'; break; @@ -3131,6 +3169,7 @@ switch ($this->sql_layer) { case 'mssql': + case 'mssqlnative': $statements[] = 'DROP INDEX ' . $table_name . '.' . $index_name; break; @@ -3167,6 +3206,7 @@ break; case 'mssql': + case 'mssqlnative': $sql = "ALTER TABLE [{$table_name}] WITH NOCHECK ADD "; $sql .= "CONSTRAINT [PK_{$table_name}] PRIMARY KEY CLUSTERED ("; $sql .= '[' . implode("],\n\t\t[", $column) . ']'; @@ -3260,6 +3300,7 @@ break; case 'mssql': + case 'mssqlnative': $statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; break; } @@ -3289,6 +3330,7 @@ break; case 'mssql': + case 'mssqlnative': $statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; break; } @@ -3321,6 +3363,7 @@ break; case 'mssql': + case 'mssqlnative': $statements[] = 'ALTER TABLE [' . $table_name . '] ALTER COLUMN [' . $column_name . '] ' . $column_data['column_type_sql']; if (!empty($column_data['default'])) Index: install/install_convert.php =================================================================== --- install/install_convert.php (revision 10460) +++ install/install_convert.php (working copy) @@ -1248,6 +1248,7 @@ { case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $db->sql_query('SET IDENTITY_INSERT ' . $schema['target'] . ' ON'); break; } @@ -1375,6 +1376,7 @@ { case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $db->sql_query('SET IDENTITY_INSERT ' . $schema['target'] . ' OFF'); break; Index: install/install_install.php =================================================================== --- install/install_install.php (revision 10460) +++ install/install_install.php (working copy) @@ -1203,6 +1203,7 @@ { case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $sql_query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $sql_query); break; Index: install/schemas/mssqlnative_schema.sql =================================================================== --- install/schemas/mssqlnative_schema.sql (revision 0) +++ install/schemas/mssqlnative_schema.sql (revision 0) @@ -0,0 +1,1732 @@ +/* + + $Id: mssql_schema.sql 10107 2009-09-04 17:27:13Z bantu $ + +*/ + +/* + Table: 'phpbb_attachments' +*/ +CREATE TABLE [phpbb_attachments] ( + [attach_id] [int] IDENTITY (1, 1) NOT NULL , + [post_msg_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [in_message] [int] DEFAULT (0) NOT NULL , + [poster_id] [int] DEFAULT (0) NOT NULL , + [is_orphan] [int] DEFAULT (1) NOT NULL , + [physical_filename] [varchar] (255) DEFAULT ('') NOT NULL , + [real_filename] [varchar] (255) DEFAULT ('') NOT NULL , + [download_count] [int] DEFAULT (0) NOT NULL , + [attach_comment] [varchar] (4000) DEFAULT ('') NOT NULL , + [extension] [varchar] (100) DEFAULT ('') NOT NULL , + [mimetype] [varchar] (100) DEFAULT ('') NOT NULL , + [filesize] [int] DEFAULT (0) NOT NULL , + [filetime] [int] DEFAULT (0) NOT NULL , + [thumbnail] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_attachments] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_attachments] PRIMARY KEY CLUSTERED + ( + [attach_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [filetime] ON [phpbb_attachments]([filetime]) ON [PRIMARY] +GO + +CREATE INDEX [post_msg_id] ON [phpbb_attachments]([post_msg_id]) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_attachments]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [poster_id] ON [phpbb_attachments]([poster_id]) ON [PRIMARY] +GO + +CREATE INDEX [is_orphan] ON [phpbb_attachments]([is_orphan]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_acl_groups' +*/ +CREATE TABLE [phpbb_acl_groups] ( + [group_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [auth_option_id] [int] DEFAULT (0) NOT NULL , + [auth_role_id] [int] DEFAULT (0) NOT NULL , + [auth_setting] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [group_id] ON [phpbb_acl_groups]([group_id]) ON [PRIMARY] +GO + +CREATE INDEX [auth_opt_id] ON [phpbb_acl_groups]([auth_option_id]) ON [PRIMARY] +GO + +CREATE INDEX [auth_role_id] ON [phpbb_acl_groups]([auth_role_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_acl_options' +*/ +CREATE TABLE [phpbb_acl_options] ( + [auth_option_id] [int] IDENTITY (1, 1) NOT NULL , + [auth_option] [varchar] (50) DEFAULT ('') NOT NULL , + [is_global] [int] DEFAULT (0) NOT NULL , + [is_local] [int] DEFAULT (0) NOT NULL , + [founder_only] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_acl_options] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_acl_options] PRIMARY KEY CLUSTERED + ( + [auth_option_id] + ) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [auth_option] ON [phpbb_acl_options]([auth_option]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_acl_roles' +*/ +CREATE TABLE [phpbb_acl_roles] ( + [role_id] [int] IDENTITY (1, 1) NOT NULL , + [role_name] [varchar] (255) DEFAULT ('') NOT NULL , + [role_description] [varchar] (4000) DEFAULT ('') NOT NULL , + [role_type] [varchar] (10) DEFAULT ('') NOT NULL , + [role_order] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_acl_roles] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_acl_roles] PRIMARY KEY CLUSTERED + ( + [role_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [role_type] ON [phpbb_acl_roles]([role_type]) ON [PRIMARY] +GO + +CREATE INDEX [role_order] ON [phpbb_acl_roles]([role_order]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_acl_roles_data' +*/ +CREATE TABLE [phpbb_acl_roles_data] ( + [role_id] [int] DEFAULT (0) NOT NULL , + [auth_option_id] [int] DEFAULT (0) NOT NULL , + [auth_setting] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_acl_roles_data] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_acl_roles_data] PRIMARY KEY CLUSTERED + ( + [role_id], + [auth_option_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [ath_op_id] ON [phpbb_acl_roles_data]([auth_option_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_acl_users' +*/ +CREATE TABLE [phpbb_acl_users] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [auth_option_id] [int] DEFAULT (0) NOT NULL , + [auth_role_id] [int] DEFAULT (0) NOT NULL , + [auth_setting] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_acl_users]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [auth_option_id] ON [phpbb_acl_users]([auth_option_id]) ON [PRIMARY] +GO + +CREATE INDEX [auth_role_id] ON [phpbb_acl_users]([auth_role_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_banlist' +*/ +CREATE TABLE [phpbb_banlist] ( + [ban_id] [int] IDENTITY (1, 1) NOT NULL , + [ban_userid] [int] DEFAULT (0) NOT NULL , + [ban_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [ban_email] [varchar] (100) DEFAULT ('') NOT NULL , + [ban_start] [int] DEFAULT (0) NOT NULL , + [ban_end] [int] DEFAULT (0) NOT NULL , + [ban_exclude] [int] DEFAULT (0) NOT NULL , + [ban_reason] [varchar] (255) DEFAULT ('') NOT NULL , + [ban_give_reason] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_banlist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_banlist] PRIMARY KEY CLUSTERED + ( + [ban_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [ban_end] ON [phpbb_banlist]([ban_end]) ON [PRIMARY] +GO + +CREATE INDEX [ban_user] ON [phpbb_banlist]([ban_userid], [ban_exclude]) ON [PRIMARY] +GO + +CREATE INDEX [ban_email] ON [phpbb_banlist]([ban_email], [ban_exclude]) ON [PRIMARY] +GO + +CREATE INDEX [ban_ip] ON [phpbb_banlist]([ban_ip], [ban_exclude]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_bbcodes' +*/ +CREATE TABLE [phpbb_bbcodes] ( + [bbcode_id] [int] DEFAULT (0) NOT NULL , + [bbcode_tag] [varchar] (16) DEFAULT ('') NOT NULL , + [bbcode_helpline] [varchar] (255) DEFAULT ('') NOT NULL , + [display_on_posting] [int] DEFAULT (0) NOT NULL , + [bbcode_match] [varchar] (4000) DEFAULT ('') NOT NULL , + [bbcode_tpl] [text] DEFAULT ('') NOT NULL , + [first_pass_match] [text] DEFAULT ('') NOT NULL , + [first_pass_replace] [text] DEFAULT ('') NOT NULL , + [second_pass_match] [text] DEFAULT ('') NOT NULL , + [second_pass_replace] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_bbcodes] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_bbcodes] PRIMARY KEY CLUSTERED + ( + [bbcode_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [display_on_post] ON [phpbb_bbcodes]([display_on_posting]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_bookmarks' +*/ +CREATE TABLE [phpbb_bookmarks] ( + [topic_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_bookmarks] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_bookmarks] PRIMARY KEY CLUSTERED + ( + [topic_id], + [user_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_bots' +*/ +CREATE TABLE [phpbb_bots] ( + [bot_id] [int] IDENTITY (1, 1) NOT NULL , + [bot_active] [int] DEFAULT (1) NOT NULL , + [bot_name] [varchar] (255) DEFAULT ('') NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [bot_agent] [varchar] (255) DEFAULT ('') NOT NULL , + [bot_ip] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_bots] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_bots] PRIMARY KEY CLUSTERED + ( + [bot_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [bot_active] ON [phpbb_bots]([bot_active]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_config' +*/ +CREATE TABLE [phpbb_config] ( + [config_name] [varchar] (255) DEFAULT ('') NOT NULL , + [config_value] [varchar] (255) DEFAULT ('') NOT NULL , + [is_dynamic] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_config] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_config] PRIMARY KEY CLUSTERED + ( + [config_name] + ) ON [PRIMARY] +GO + +CREATE INDEX [is_dynamic] ON [phpbb_config]([is_dynamic]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_confirm' +*/ +CREATE TABLE [phpbb_confirm] ( + [confirm_id] [char] (32) DEFAULT ('') NOT NULL , + [session_id] [char] (32) DEFAULT ('') NOT NULL , + [confirm_type] [int] DEFAULT (0) NOT NULL , + [code] [varchar] (8) DEFAULT ('') NOT NULL , + [seed] [int] DEFAULT (0) NOT NULL , + [attempts] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_confirm] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_confirm] PRIMARY KEY CLUSTERED + ( + [session_id], + [confirm_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [confirm_type] ON [phpbb_confirm]([confirm_type]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_disallow' +*/ +CREATE TABLE [phpbb_disallow] ( + [disallow_id] [int] IDENTITY (1, 1) NOT NULL , + [disallow_username] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_disallow] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_disallow] PRIMARY KEY CLUSTERED + ( + [disallow_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_drafts' +*/ +CREATE TABLE [phpbb_drafts] ( + [draft_id] [int] IDENTITY (1, 1) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [save_time] [int] DEFAULT (0) NOT NULL , + [draft_subject] [varchar] (255) DEFAULT ('') NOT NULL , + [draft_message] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_drafts] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_drafts] PRIMARY KEY CLUSTERED + ( + [draft_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [save_time] ON [phpbb_drafts]([save_time]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_extensions' +*/ +CREATE TABLE [phpbb_extensions] ( + [extension_id] [int] IDENTITY (1, 1) NOT NULL , + [group_id] [int] DEFAULT (0) NOT NULL , + [extension] [varchar] (100) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_extensions] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_extensions] PRIMARY KEY CLUSTERED + ( + [extension_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_extension_groups' +*/ +CREATE TABLE [phpbb_extension_groups] ( + [group_id] [int] IDENTITY (1, 1) NOT NULL , + [group_name] [varchar] (255) DEFAULT ('') NOT NULL , + [cat_id] [int] DEFAULT (0) NOT NULL , + [allow_group] [int] DEFAULT (0) NOT NULL , + [download_mode] [int] DEFAULT (1) NOT NULL , + [upload_icon] [varchar] (255) DEFAULT ('') NOT NULL , + [max_filesize] [int] DEFAULT (0) NOT NULL , + [allowed_forums] [varchar] (8000) DEFAULT ('') NOT NULL , + [allow_in_pm] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_extension_groups] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_extension_groups] PRIMARY KEY CLUSTERED + ( + [group_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_forums' +*/ +CREATE TABLE [phpbb_forums] ( + [forum_id] [int] IDENTITY (1, 1) NOT NULL , + [parent_id] [int] DEFAULT (0) NOT NULL , + [left_id] [int] DEFAULT (0) NOT NULL , + [right_id] [int] DEFAULT (0) NOT NULL , + [forum_parents] [text] DEFAULT ('') NOT NULL , + [forum_name] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_desc] [varchar] (4000) DEFAULT ('') NOT NULL , + [forum_desc_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_desc_options] [int] DEFAULT (7) NOT NULL , + [forum_desc_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [forum_link] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_password] [varchar] (40) DEFAULT ('') NOT NULL , + [forum_style] [int] DEFAULT (0) NOT NULL , + [forum_image] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_rules] [varchar] (4000) DEFAULT ('') NOT NULL , + [forum_rules_link] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_rules_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_rules_options] [int] DEFAULT (7) NOT NULL , + [forum_rules_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [forum_topics_per_page] [int] DEFAULT (0) NOT NULL , + [forum_type] [int] DEFAULT (0) NOT NULL , + [forum_status] [int] DEFAULT (0) NOT NULL , + [forum_posts] [int] DEFAULT (0) NOT NULL , + [forum_topics] [int] DEFAULT (0) NOT NULL , + [forum_topics_real] [int] DEFAULT (0) NOT NULL , + [forum_last_post_id] [int] DEFAULT (0) NOT NULL , + [forum_last_poster_id] [int] DEFAULT (0) NOT NULL , + [forum_last_post_subject] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_last_post_time] [int] DEFAULT (0) NOT NULL , + [forum_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , + [forum_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [forum_flags] [int] DEFAULT (32) NOT NULL , + [forum_options] [int] DEFAULT (0) NOT NULL , + [display_subforum_list] [int] DEFAULT (1) NOT NULL , + [display_on_index] [int] DEFAULT (1) NOT NULL , + [enable_indexing] [int] DEFAULT (1) NOT NULL , + [enable_icons] [int] DEFAULT (1) NOT NULL , + [enable_prune] [int] DEFAULT (0) NOT NULL , + [prune_next] [int] DEFAULT (0) NOT NULL , + [prune_days] [int] DEFAULT (0) NOT NULL , + [prune_viewed] [int] DEFAULT (0) NOT NULL , + [prune_freq] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_forums] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums] PRIMARY KEY CLUSTERED + ( + [forum_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [left_right_id] ON [phpbb_forums]([left_id], [right_id]) ON [PRIMARY] +GO + +CREATE INDEX [forum_lastpost_id] ON [phpbb_forums]([forum_last_post_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_forums_access' +*/ +CREATE TABLE [phpbb_forums_access] ( + [forum_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [session_id] [char] (32) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_forums_access] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums_access] PRIMARY KEY CLUSTERED + ( + [forum_id], + [user_id], + [session_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_forums_track' +*/ +CREATE TABLE [phpbb_forums_track] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [mark_time] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_forums_track] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums_track] PRIMARY KEY CLUSTERED + ( + [user_id], + [forum_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_forums_watch' +*/ +CREATE TABLE [phpbb_forums_watch] ( + [forum_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [notify_status] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_forums_watch]([forum_id]) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_forums_watch]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [notify_stat] ON [phpbb_forums_watch]([notify_status]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_groups' +*/ +CREATE TABLE [phpbb_groups] ( + [group_id] [int] IDENTITY (1, 1) NOT NULL , + [group_type] [int] DEFAULT (1) NOT NULL , + [group_founder_manage] [int] DEFAULT (0) NOT NULL , + [group_skip_auth] [int] DEFAULT (0) NOT NULL , + [group_name] [varchar] (255) DEFAULT ('') NOT NULL , + [group_desc] [varchar] (4000) DEFAULT ('') NOT NULL , + [group_desc_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [group_desc_options] [int] DEFAULT (7) NOT NULL , + [group_desc_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [group_display] [int] DEFAULT (0) NOT NULL , + [group_avatar] [varchar] (255) DEFAULT ('') NOT NULL , + [group_avatar_type] [int] DEFAULT (0) NOT NULL , + [group_avatar_width] [int] DEFAULT (0) NOT NULL , + [group_avatar_height] [int] DEFAULT (0) NOT NULL , + [group_rank] [int] DEFAULT (0) NOT NULL , + [group_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [group_sig_chars] [int] DEFAULT (0) NOT NULL , + [group_receive_pm] [int] DEFAULT (0) NOT NULL , + [group_message_limit] [int] DEFAULT (0) NOT NULL , + [group_max_recipients] [int] DEFAULT (0) NOT NULL , + [group_legend] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_groups] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_groups] PRIMARY KEY CLUSTERED + ( + [group_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [group_legend_name] ON [phpbb_groups]([group_legend], [group_name]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_icons' +*/ +CREATE TABLE [phpbb_icons] ( + [icons_id] [int] IDENTITY (1, 1) NOT NULL , + [icons_url] [varchar] (255) DEFAULT ('') NOT NULL , + [icons_width] [int] DEFAULT (0) NOT NULL , + [icons_height] [int] DEFAULT (0) NOT NULL , + [icons_order] [int] DEFAULT (0) NOT NULL , + [display_on_posting] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_icons] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_icons] PRIMARY KEY CLUSTERED + ( + [icons_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [display_on_posting] ON [phpbb_icons]([display_on_posting]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_lang' +*/ +CREATE TABLE [phpbb_lang] ( + [lang_id] [int] IDENTITY (1, 1) NOT NULL , + [lang_iso] [varchar] (30) DEFAULT ('') NOT NULL , + [lang_dir] [varchar] (30) DEFAULT ('') NOT NULL , + [lang_english_name] [varchar] (100) DEFAULT ('') NOT NULL , + [lang_local_name] [varchar] (255) DEFAULT ('') NOT NULL , + [lang_author] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_lang] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_lang] PRIMARY KEY CLUSTERED + ( + [lang_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [lang_iso] ON [phpbb_lang]([lang_iso]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_log' +*/ +CREATE TABLE [phpbb_log] ( + [log_id] [int] IDENTITY (1, 1) NOT NULL , + [log_type] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [reportee_id] [int] DEFAULT (0) NOT NULL , + [log_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [log_time] [int] DEFAULT (0) NOT NULL , + [log_operation] [varchar] (4000) DEFAULT ('') NOT NULL , + [log_data] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_log] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_log] PRIMARY KEY CLUSTERED + ( + [log_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [log_type] ON [phpbb_log]([log_type]) ON [PRIMARY] +GO + +CREATE INDEX [log_time] ON [phpbb_log]([log_time]) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_log]([forum_id]) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_log]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [reportee_id] ON [phpbb_log]([reportee_id]) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_log]([user_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_moderator_cache' +*/ +CREATE TABLE [phpbb_moderator_cache] ( + [forum_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [username] [varchar] (255) DEFAULT ('') NOT NULL , + [group_id] [int] DEFAULT (0) NOT NULL , + [group_name] [varchar] (255) DEFAULT ('') NOT NULL , + [display_on_index] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [disp_idx] ON [phpbb_moderator_cache]([display_on_index]) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_moderator_cache]([forum_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_modules' +*/ +CREATE TABLE [phpbb_modules] ( + [module_id] [int] IDENTITY (1, 1) NOT NULL , + [module_enabled] [int] DEFAULT (1) NOT NULL , + [module_display] [int] DEFAULT (1) NOT NULL , + [module_basename] [varchar] (255) DEFAULT ('') NOT NULL , + [module_class] [varchar] (10) DEFAULT ('') NOT NULL , + [parent_id] [int] DEFAULT (0) NOT NULL , + [left_id] [int] DEFAULT (0) NOT NULL , + [right_id] [int] DEFAULT (0) NOT NULL , + [module_langname] [varchar] (255) DEFAULT ('') NOT NULL , + [module_mode] [varchar] (255) DEFAULT ('') NOT NULL , + [module_auth] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_modules] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_modules] PRIMARY KEY CLUSTERED + ( + [module_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [left_right_id] ON [phpbb_modules]([left_id], [right_id]) ON [PRIMARY] +GO + +CREATE INDEX [module_enabled] ON [phpbb_modules]([module_enabled]) ON [PRIMARY] +GO + +CREATE INDEX [class_left_id] ON [phpbb_modules]([module_class], [left_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_poll_options' +*/ +CREATE TABLE [phpbb_poll_options] ( + [poll_option_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [poll_option_text] [varchar] (4000) DEFAULT ('') NOT NULL , + [poll_option_total] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [poll_opt_id] ON [phpbb_poll_options]([poll_option_id]) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_poll_options]([topic_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_poll_votes' +*/ +CREATE TABLE [phpbb_poll_votes] ( + [topic_id] [int] DEFAULT (0) NOT NULL , + [poll_option_id] [int] DEFAULT (0) NOT NULL , + [vote_user_id] [int] DEFAULT (0) NOT NULL , + [vote_user_ip] [varchar] (40) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_poll_votes]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [vote_user_id] ON [phpbb_poll_votes]([vote_user_id]) ON [PRIMARY] +GO + +CREATE INDEX [vote_user_ip] ON [phpbb_poll_votes]([vote_user_ip]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_posts' +*/ +CREATE TABLE [phpbb_posts] ( + [post_id] [int] IDENTITY (1, 1) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [poster_id] [int] DEFAULT (0) NOT NULL , + [icon_id] [int] DEFAULT (0) NOT NULL , + [poster_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [post_time] [int] DEFAULT (0) NOT NULL , + [post_approved] [int] DEFAULT (1) NOT NULL , + [post_reported] [int] DEFAULT (0) NOT NULL , + [enable_bbcode] [int] DEFAULT (1) NOT NULL , + [enable_smilies] [int] DEFAULT (1) NOT NULL , + [enable_magic_url] [int] DEFAULT (1) NOT NULL , + [enable_sig] [int] DEFAULT (1) NOT NULL , + [post_username] [varchar] (255) DEFAULT ('') NOT NULL , + [post_subject] [varchar] (255) DEFAULT ('') NOT NULL , + [post_text] [text] DEFAULT ('') NOT NULL , + [post_checksum] [varchar] (32) DEFAULT ('') NOT NULL , + [post_attachment] [int] DEFAULT (0) NOT NULL , + [bbcode_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [bbcode_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [post_postcount] [int] DEFAULT (1) NOT NULL , + [post_edit_time] [int] DEFAULT (0) NOT NULL , + [post_edit_reason] [varchar] (255) DEFAULT ('') NOT NULL , + [post_edit_user] [int] DEFAULT (0) NOT NULL , + [post_edit_count] [int] DEFAULT (0) NOT NULL , + [post_edit_locked] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_posts] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_posts] PRIMARY KEY CLUSTERED + ( + [post_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_posts]([forum_id]) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_posts]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [poster_ip] ON [phpbb_posts]([poster_ip]) ON [PRIMARY] +GO + +CREATE INDEX [poster_id] ON [phpbb_posts]([poster_id]) ON [PRIMARY] +GO + +CREATE INDEX [post_approved] ON [phpbb_posts]([post_approved]) ON [PRIMARY] +GO + +CREATE INDEX [post_username] ON [phpbb_posts]([post_username]) ON [PRIMARY] +GO + +CREATE INDEX [tid_post_time] ON [phpbb_posts]([topic_id], [post_time]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_privmsgs' +*/ +CREATE TABLE [phpbb_privmsgs] ( + [msg_id] [int] IDENTITY (1, 1) NOT NULL , + [root_level] [int] DEFAULT (0) NOT NULL , + [author_id] [int] DEFAULT (0) NOT NULL , + [icon_id] [int] DEFAULT (0) NOT NULL , + [author_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [message_time] [int] DEFAULT (0) NOT NULL , + [enable_bbcode] [int] DEFAULT (1) NOT NULL , + [enable_smilies] [int] DEFAULT (1) NOT NULL , + [enable_magic_url] [int] DEFAULT (1) NOT NULL , + [enable_sig] [int] DEFAULT (1) NOT NULL , + [message_subject] [varchar] (255) DEFAULT ('') NOT NULL , + [message_text] [text] DEFAULT ('') NOT NULL , + [message_edit_reason] [varchar] (255) DEFAULT ('') NOT NULL , + [message_edit_user] [int] DEFAULT (0) NOT NULL , + [message_attachment] [int] DEFAULT (0) NOT NULL , + [bbcode_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [bbcode_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [message_edit_time] [int] DEFAULT (0) NOT NULL , + [message_edit_count] [int] DEFAULT (0) NOT NULL , + [to_address] [varchar] (4000) DEFAULT ('') NOT NULL , + [bcc_address] [varchar] (4000) DEFAULT ('') NOT NULL , + [message_reported] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_privmsgs] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs] PRIMARY KEY CLUSTERED + ( + [msg_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [author_ip] ON [phpbb_privmsgs]([author_ip]) ON [PRIMARY] +GO + +CREATE INDEX [message_time] ON [phpbb_privmsgs]([message_time]) ON [PRIMARY] +GO + +CREATE INDEX [author_id] ON [phpbb_privmsgs]([author_id]) ON [PRIMARY] +GO + +CREATE INDEX [root_level] ON [phpbb_privmsgs]([root_level]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_privmsgs_folder' +*/ +CREATE TABLE [phpbb_privmsgs_folder] ( + [folder_id] [int] IDENTITY (1, 1) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [folder_name] [varchar] (255) DEFAULT ('') NOT NULL , + [pm_count] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_privmsgs_folder] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs_folder] PRIMARY KEY CLUSTERED + ( + [folder_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_privmsgs_folder]([user_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_privmsgs_rules' +*/ +CREATE TABLE [phpbb_privmsgs_rules] ( + [rule_id] [int] IDENTITY (1, 1) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [rule_check] [int] DEFAULT (0) NOT NULL , + [rule_connection] [int] DEFAULT (0) NOT NULL , + [rule_string] [varchar] (255) DEFAULT ('') NOT NULL , + [rule_user_id] [int] DEFAULT (0) NOT NULL , + [rule_group_id] [int] DEFAULT (0) NOT NULL , + [rule_action] [int] DEFAULT (0) NOT NULL , + [rule_folder_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_privmsgs_rules] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs_rules] PRIMARY KEY CLUSTERED + ( + [rule_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_privmsgs_rules]([user_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_privmsgs_to' +*/ +CREATE TABLE [phpbb_privmsgs_to] ( + [msg_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [author_id] [int] DEFAULT (0) NOT NULL , + [pm_deleted] [int] DEFAULT (0) NOT NULL , + [pm_new] [int] DEFAULT (1) NOT NULL , + [pm_unread] [int] DEFAULT (1) NOT NULL , + [pm_replied] [int] DEFAULT (0) NOT NULL , + [pm_marked] [int] DEFAULT (0) NOT NULL , + [pm_forwarded] [int] DEFAULT (0) NOT NULL , + [folder_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [msg_id] ON [phpbb_privmsgs_to]([msg_id]) ON [PRIMARY] +GO + +CREATE INDEX [author_id] ON [phpbb_privmsgs_to]([author_id]) ON [PRIMARY] +GO + +CREATE INDEX [usr_flder_id] ON [phpbb_privmsgs_to]([user_id], [folder_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_profile_fields' +*/ +CREATE TABLE [phpbb_profile_fields] ( + [field_id] [int] IDENTITY (1, 1) NOT NULL , + [field_name] [varchar] (255) DEFAULT ('') NOT NULL , + [field_type] [int] DEFAULT (0) NOT NULL , + [field_ident] [varchar] (20) DEFAULT ('') NOT NULL , + [field_length] [varchar] (20) DEFAULT ('') NOT NULL , + [field_minlen] [varchar] (255) DEFAULT ('') NOT NULL , + [field_maxlen] [varchar] (255) DEFAULT ('') NOT NULL , + [field_novalue] [varchar] (255) DEFAULT ('') NOT NULL , + [field_default_value] [varchar] (255) DEFAULT ('') NOT NULL , + [field_validation] [varchar] (20) DEFAULT ('') NOT NULL , + [field_required] [int] DEFAULT (0) NOT NULL , + [field_show_on_reg] [int] DEFAULT (0) NOT NULL , + [field_show_on_vt] [int] DEFAULT (0) NOT NULL , + [field_show_profile] [int] DEFAULT (0) NOT NULL , + [field_hide] [int] DEFAULT (0) NOT NULL , + [field_no_view] [int] DEFAULT (0) NOT NULL , + [field_active] [int] DEFAULT (0) NOT NULL , + [field_order] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_profile_fields] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_fields] PRIMARY KEY CLUSTERED + ( + [field_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [fld_type] ON [phpbb_profile_fields]([field_type]) ON [PRIMARY] +GO + +CREATE INDEX [fld_ordr] ON [phpbb_profile_fields]([field_order]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_profile_fields_data' +*/ +CREATE TABLE [phpbb_profile_fields_data] ( + [user_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_profile_fields_data] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_fields_data] PRIMARY KEY CLUSTERED + ( + [user_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_profile_fields_lang' +*/ +CREATE TABLE [phpbb_profile_fields_lang] ( + [field_id] [int] DEFAULT (0) NOT NULL , + [lang_id] [int] DEFAULT (0) NOT NULL , + [option_id] [int] DEFAULT (0) NOT NULL , + [field_type] [int] DEFAULT (0) NOT NULL , + [lang_value] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_profile_fields_lang] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_fields_lang] PRIMARY KEY CLUSTERED + ( + [field_id], + [lang_id], + [option_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_profile_lang' +*/ +CREATE TABLE [phpbb_profile_lang] ( + [field_id] [int] DEFAULT (0) NOT NULL , + [lang_id] [int] DEFAULT (0) NOT NULL , + [lang_name] [varchar] (255) DEFAULT ('') NOT NULL , + [lang_explain] [varchar] (4000) DEFAULT ('') NOT NULL , + [lang_default_value] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_profile_lang] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_profile_lang] PRIMARY KEY CLUSTERED + ( + [field_id], + [lang_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_ranks' +*/ +CREATE TABLE [phpbb_ranks] ( + [rank_id] [int] IDENTITY (1, 1) NOT NULL , + [rank_title] [varchar] (255) DEFAULT ('') NOT NULL , + [rank_min] [int] DEFAULT (0) NOT NULL , + [rank_special] [int] DEFAULT (0) NOT NULL , + [rank_image] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_ranks] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_ranks] PRIMARY KEY CLUSTERED + ( + [rank_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_reports' +*/ +CREATE TABLE [phpbb_reports] ( + [report_id] [int] IDENTITY (1, 1) NOT NULL , + [reason_id] [int] DEFAULT (0) NOT NULL , + [post_id] [int] DEFAULT (0) NOT NULL , + [pm_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [user_notify] [int] DEFAULT (0) NOT NULL , + [report_closed] [int] DEFAULT (0) NOT NULL , + [report_time] [int] DEFAULT (0) NOT NULL , + [report_text] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_reports] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_reports] PRIMARY KEY CLUSTERED + ( + [report_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [post_id] ON [phpbb_reports]([post_id]) ON [PRIMARY] +GO + +CREATE INDEX [pm_id] ON [phpbb_reports]([pm_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_reports_reasons' +*/ +CREATE TABLE [phpbb_reports_reasons] ( + [reason_id] [int] IDENTITY (1, 1) NOT NULL , + [reason_title] [varchar] (255) DEFAULT ('') NOT NULL , + [reason_description] [text] DEFAULT ('') NOT NULL , + [reason_order] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_reports_reasons] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_reports_reasons] PRIMARY KEY CLUSTERED + ( + [reason_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_search_results' +*/ +CREATE TABLE [phpbb_search_results] ( + [search_key] [varchar] (32) DEFAULT ('') NOT NULL , + [search_time] [int] DEFAULT (0) NOT NULL , + [search_keywords] [text] DEFAULT ('') NOT NULL , + [search_authors] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_search_results] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_search_results] PRIMARY KEY CLUSTERED + ( + [search_key] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_search_wordlist' +*/ +CREATE TABLE [phpbb_search_wordlist] ( + [word_id] [int] IDENTITY (1, 1) NOT NULL , + [word_text] [varchar] (255) DEFAULT ('') NOT NULL , + [word_common] [int] DEFAULT (0) NOT NULL , + [word_count] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_search_wordlist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_search_wordlist] PRIMARY KEY CLUSTERED + ( + [word_id] + ) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [wrd_txt] ON [phpbb_search_wordlist]([word_text]) ON [PRIMARY] +GO + +CREATE INDEX [wrd_cnt] ON [phpbb_search_wordlist]([word_count]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_search_wordmatch' +*/ +CREATE TABLE [phpbb_search_wordmatch] ( + [post_id] [int] DEFAULT (0) NOT NULL , + [word_id] [int] DEFAULT (0) NOT NULL , + [title_match] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [unq_mtch] ON [phpbb_search_wordmatch]([word_id], [post_id], [title_match]) ON [PRIMARY] +GO + +CREATE INDEX [word_id] ON [phpbb_search_wordmatch]([word_id]) ON [PRIMARY] +GO + +CREATE INDEX [post_id] ON [phpbb_search_wordmatch]([post_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_sessions' +*/ +CREATE TABLE [phpbb_sessions] ( + [session_id] [char] (32) DEFAULT ('') NOT NULL , + [session_user_id] [int] DEFAULT (0) NOT NULL , + [session_forum_id] [int] DEFAULT (0) NOT NULL , + [session_last_visit] [int] DEFAULT (0) NOT NULL , + [session_start] [int] DEFAULT (0) NOT NULL , + [session_time] [int] DEFAULT (0) NOT NULL , + [session_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [session_browser] [varchar] (150) DEFAULT ('') NOT NULL , + [session_forwarded_for] [varchar] (255) DEFAULT ('') NOT NULL , + [session_page] [varchar] (255) DEFAULT ('') NOT NULL , + [session_viewonline] [int] DEFAULT (1) NOT NULL , + [session_autologin] [int] DEFAULT (0) NOT NULL , + [session_admin] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_sessions] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_sessions] PRIMARY KEY CLUSTERED + ( + [session_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [session_time] ON [phpbb_sessions]([session_time]) ON [PRIMARY] +GO + +CREATE INDEX [session_user_id] ON [phpbb_sessions]([session_user_id]) ON [PRIMARY] +GO + +CREATE INDEX [session_fid] ON [phpbb_sessions]([session_forum_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_sessions_keys' +*/ +CREATE TABLE [phpbb_sessions_keys] ( + [key_id] [char] (32) DEFAULT ('') NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [last_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [last_login] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_sessions_keys] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_sessions_keys] PRIMARY KEY CLUSTERED + ( + [key_id], + [user_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [last_login] ON [phpbb_sessions_keys]([last_login]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_sitelist' +*/ +CREATE TABLE [phpbb_sitelist] ( + [site_id] [int] IDENTITY (1, 1) NOT NULL , + [site_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [site_hostname] [varchar] (255) DEFAULT ('') NOT NULL , + [ip_exclude] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_sitelist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_sitelist] PRIMARY KEY CLUSTERED + ( + [site_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_smilies' +*/ +CREATE TABLE [phpbb_smilies] ( + [smiley_id] [int] IDENTITY (1, 1) NOT NULL , + [code] [varchar] (50) DEFAULT ('') NOT NULL , + [emotion] [varchar] (50) DEFAULT ('') NOT NULL , + [smiley_url] [varchar] (50) DEFAULT ('') NOT NULL , + [smiley_width] [int] DEFAULT (0) NOT NULL , + [smiley_height] [int] DEFAULT (0) NOT NULL , + [smiley_order] [int] DEFAULT (0) NOT NULL , + [display_on_posting] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_smilies] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_smilies] PRIMARY KEY CLUSTERED + ( + [smiley_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [display_on_post] ON [phpbb_smilies]([display_on_posting]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_styles' +*/ +CREATE TABLE [phpbb_styles] ( + [style_id] [int] IDENTITY (1, 1) NOT NULL , + [style_name] [varchar] (255) DEFAULT ('') NOT NULL , + [style_copyright] [varchar] (255) DEFAULT ('') NOT NULL , + [style_active] [int] DEFAULT (1) NOT NULL , + [template_id] [int] DEFAULT (0) NOT NULL , + [theme_id] [int] DEFAULT (0) NOT NULL , + [imageset_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_styles] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles] PRIMARY KEY CLUSTERED + ( + [style_id] + ) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [style_name] ON [phpbb_styles]([style_name]) ON [PRIMARY] +GO + +CREATE INDEX [template_id] ON [phpbb_styles]([template_id]) ON [PRIMARY] +GO + +CREATE INDEX [theme_id] ON [phpbb_styles]([theme_id]) ON [PRIMARY] +GO + +CREATE INDEX [imageset_id] ON [phpbb_styles]([imageset_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_styles_template' +*/ +CREATE TABLE [phpbb_styles_template] ( + [template_id] [int] IDENTITY (1, 1) NOT NULL , + [template_name] [varchar] (255) DEFAULT ('') NOT NULL , + [template_copyright] [varchar] (255) DEFAULT ('') NOT NULL , + [template_path] [varchar] (100) DEFAULT ('') NOT NULL , + [bbcode_bitfield] [varchar] (255) DEFAULT ('kNg=') NOT NULL , + [template_storedb] [int] DEFAULT (0) NOT NULL , + [template_inherits_id] [int] DEFAULT (0) NOT NULL , + [template_inherit_path] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_styles_template] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles_template] PRIMARY KEY CLUSTERED + ( + [template_id] + ) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [tmplte_nm] ON [phpbb_styles_template]([template_name]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_styles_template_data' +*/ +CREATE TABLE [phpbb_styles_template_data] ( + [template_id] [int] DEFAULT (0) NOT NULL , + [template_filename] [varchar] (100) DEFAULT ('') NOT NULL , + [template_included] [varchar] (8000) DEFAULT ('') NOT NULL , + [template_mtime] [int] DEFAULT (0) NOT NULL , + [template_data] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +CREATE INDEX [tid] ON [phpbb_styles_template_data]([template_id]) ON [PRIMARY] +GO + +CREATE INDEX [tfn] ON [phpbb_styles_template_data]([template_filename]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_styles_theme' +*/ +CREATE TABLE [phpbb_styles_theme] ( + [theme_id] [int] IDENTITY (1, 1) NOT NULL , + [theme_name] [varchar] (255) DEFAULT ('') NOT NULL , + [theme_copyright] [varchar] (255) DEFAULT ('') NOT NULL , + [theme_path] [varchar] (100) DEFAULT ('') NOT NULL , + [theme_storedb] [int] DEFAULT (0) NOT NULL , + [theme_mtime] [int] DEFAULT (0) NOT NULL , + [theme_data] [text] DEFAULT ('') NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_styles_theme] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles_theme] PRIMARY KEY CLUSTERED + ( + [theme_id] + ) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [theme_name] ON [phpbb_styles_theme]([theme_name]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_styles_imageset' +*/ +CREATE TABLE [phpbb_styles_imageset] ( + [imageset_id] [int] IDENTITY (1, 1) NOT NULL , + [imageset_name] [varchar] (255) DEFAULT ('') NOT NULL , + [imageset_copyright] [varchar] (255) DEFAULT ('') NOT NULL , + [imageset_path] [varchar] (100) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_styles_imageset] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles_imageset] PRIMARY KEY CLUSTERED + ( + [imageset_id] + ) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [imgset_nm] ON [phpbb_styles_imageset]([imageset_name]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_styles_imageset_data' +*/ +CREATE TABLE [phpbb_styles_imageset_data] ( + [image_id] [int] IDENTITY (1, 1) NOT NULL , + [image_name] [varchar] (200) DEFAULT ('') NOT NULL , + [image_filename] [varchar] (200) DEFAULT ('') NOT NULL , + [image_lang] [varchar] (30) DEFAULT ('') NOT NULL , + [image_height] [int] DEFAULT (0) NOT NULL , + [image_width] [int] DEFAULT (0) NOT NULL , + [imageset_id] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_styles_imageset_data] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_styles_imageset_data] PRIMARY KEY CLUSTERED + ( + [image_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [i_d] ON [phpbb_styles_imageset_data]([imageset_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_topics' +*/ +CREATE TABLE [phpbb_topics] ( + [topic_id] [int] IDENTITY (1, 1) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [icon_id] [int] DEFAULT (0) NOT NULL , + [topic_attachment] [int] DEFAULT (0) NOT NULL , + [topic_approved] [int] DEFAULT (1) NOT NULL , + [topic_reported] [int] DEFAULT (0) NOT NULL , + [topic_title] [varchar] (255) DEFAULT ('') NOT NULL , + [topic_poster] [int] DEFAULT (0) NOT NULL , + [topic_time] [int] DEFAULT (0) NOT NULL , + [topic_time_limit] [int] DEFAULT (0) NOT NULL , + [topic_views] [int] DEFAULT (0) NOT NULL , + [topic_replies] [int] DEFAULT (0) NOT NULL , + [topic_replies_real] [int] DEFAULT (0) NOT NULL , + [topic_status] [int] DEFAULT (0) NOT NULL , + [topic_type] [int] DEFAULT (0) NOT NULL , + [topic_first_post_id] [int] DEFAULT (0) NOT NULL , + [topic_first_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , + [topic_first_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [topic_last_post_id] [int] DEFAULT (0) NOT NULL , + [topic_last_poster_id] [int] DEFAULT (0) NOT NULL , + [topic_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , + [topic_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [topic_last_post_subject] [varchar] (255) DEFAULT ('') NOT NULL , + [topic_last_post_time] [int] DEFAULT (0) NOT NULL , + [topic_last_view_time] [int] DEFAULT (0) NOT NULL , + [topic_moved_id] [int] DEFAULT (0) NOT NULL , + [topic_bumped] [int] DEFAULT (0) NOT NULL , + [topic_bumper] [int] DEFAULT (0) NOT NULL , + [poll_title] [varchar] (255) DEFAULT ('') NOT NULL , + [poll_start] [int] DEFAULT (0) NOT NULL , + [poll_length] [int] DEFAULT (0) NOT NULL , + [poll_max_options] [int] DEFAULT (1) NOT NULL , + [poll_last_vote] [int] DEFAULT (0) NOT NULL , + [poll_vote_change] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_topics] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics] PRIMARY KEY CLUSTERED + ( + [topic_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_topics]([forum_id]) ON [PRIMARY] +GO + +CREATE INDEX [forum_id_type] ON [phpbb_topics]([forum_id], [topic_type]) ON [PRIMARY] +GO + +CREATE INDEX [last_post_time] ON [phpbb_topics]([topic_last_post_time]) ON [PRIMARY] +GO + +CREATE INDEX [topic_approved] ON [phpbb_topics]([topic_approved]) ON [PRIMARY] +GO + +CREATE INDEX [forum_appr_last] ON [phpbb_topics]([forum_id], [topic_approved], [topic_last_post_id]) ON [PRIMARY] +GO + +CREATE INDEX [fid_time_moved] ON [phpbb_topics]([forum_id], [topic_last_post_time], [topic_moved_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_topics_track' +*/ +CREATE TABLE [phpbb_topics_track] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [forum_id] [int] DEFAULT (0) NOT NULL , + [mark_time] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_topics_track] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics_track] PRIMARY KEY CLUSTERED + ( + [user_id], + [topic_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [forum_id] ON [phpbb_topics_track]([forum_id]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_topics_posted' +*/ +CREATE TABLE [phpbb_topics_posted] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [topic_id] [int] DEFAULT (0) NOT NULL , + [topic_posted] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_topics_posted] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics_posted] PRIMARY KEY CLUSTERED + ( + [user_id], + [topic_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_topics_watch' +*/ +CREATE TABLE [phpbb_topics_watch] ( + [topic_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [notify_status] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [topic_id] ON [phpbb_topics_watch]([topic_id]) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_topics_watch]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [notify_stat] ON [phpbb_topics_watch]([notify_status]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_user_group' +*/ +CREATE TABLE [phpbb_user_group] ( + [group_id] [int] DEFAULT (0) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [group_leader] [int] DEFAULT (0) NOT NULL , + [user_pending] [int] DEFAULT (1) NOT NULL +) ON [PRIMARY] +GO + +CREATE INDEX [group_id] ON [phpbb_user_group]([group_id]) ON [PRIMARY] +GO + +CREATE INDEX [user_id] ON [phpbb_user_group]([user_id]) ON [PRIMARY] +GO + +CREATE INDEX [group_leader] ON [phpbb_user_group]([group_leader]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_users' +*/ +CREATE TABLE [phpbb_users] ( + [user_id] [int] IDENTITY (1, 1) NOT NULL , + [user_type] [int] DEFAULT (0) NOT NULL , + [group_id] [int] DEFAULT (3) NOT NULL , + [user_permissions] [text] DEFAULT ('') NOT NULL , + [user_perm_from] [int] DEFAULT (0) NOT NULL , + [user_ip] [varchar] (40) DEFAULT ('') NOT NULL , + [user_regdate] [int] DEFAULT (0) NOT NULL , + [username] [varchar] (255) DEFAULT ('') NOT NULL , + [username_clean] [varchar] (255) DEFAULT ('') NOT NULL , + [user_password] [varchar] (40) DEFAULT ('') NOT NULL , + [user_passchg] [int] DEFAULT (0) NOT NULL , + [user_pass_convert] [int] DEFAULT (0) NOT NULL , + [user_email] [varchar] (100) DEFAULT ('') NOT NULL , + [user_email_hash] [float] DEFAULT (0) NOT NULL , + [user_birthday] [varchar] (10) DEFAULT ('') NOT NULL , + [user_lastvisit] [int] DEFAULT (0) NOT NULL , + [user_lastmark] [int] DEFAULT (0) NOT NULL , + [user_lastpost_time] [int] DEFAULT (0) NOT NULL , + [user_lastpage] [varchar] (200) DEFAULT ('') NOT NULL , + [user_last_confirm_key] [varchar] (10) DEFAULT ('') NOT NULL , + [user_last_search] [int] DEFAULT (0) NOT NULL , + [user_warnings] [int] DEFAULT (0) NOT NULL , + [user_last_warning] [int] DEFAULT (0) NOT NULL , + [user_login_attempts] [int] DEFAULT (0) NOT NULL , + [user_inactive_reason] [int] DEFAULT (0) NOT NULL , + [user_inactive_time] [int] DEFAULT (0) NOT NULL , + [user_posts] [int] DEFAULT (0) NOT NULL , + [user_lang] [varchar] (30) DEFAULT ('') NOT NULL , + [user_timezone] [float] DEFAULT (0) NOT NULL , + [user_dst] [int] DEFAULT (0) NOT NULL , + [user_dateformat] [varchar] (30) DEFAULT ('d M Y H:i') NOT NULL , + [user_style] [int] DEFAULT (0) NOT NULL , + [user_rank] [int] DEFAULT (0) NOT NULL , + [user_colour] [varchar] (6) DEFAULT ('') NOT NULL , + [user_new_privmsg] [int] DEFAULT (0) NOT NULL , + [user_unread_privmsg] [int] DEFAULT (0) NOT NULL , + [user_last_privmsg] [int] DEFAULT (0) NOT NULL , + [user_message_rules] [int] DEFAULT (0) NOT NULL , + [user_full_folder] [int] DEFAULT (-3) NOT NULL , + [user_emailtime] [int] DEFAULT (0) NOT NULL , + [user_topic_show_days] [int] DEFAULT (0) NOT NULL , + [user_topic_sortby_type] [varchar] (1) DEFAULT ('t') NOT NULL , + [user_topic_sortby_dir] [varchar] (1) DEFAULT ('d') NOT NULL , + [user_post_show_days] [int] DEFAULT (0) NOT NULL , + [user_post_sortby_type] [varchar] (1) DEFAULT ('t') NOT NULL , + [user_post_sortby_dir] [varchar] (1) DEFAULT ('a') NOT NULL , + [user_notify] [int] DEFAULT (0) NOT NULL , + [user_notify_pm] [int] DEFAULT (1) NOT NULL , + [user_notify_type] [int] DEFAULT (0) NOT NULL , + [user_allow_pm] [int] DEFAULT (1) NOT NULL , + [user_allow_viewonline] [int] DEFAULT (1) NOT NULL , + [user_allow_viewemail] [int] DEFAULT (1) NOT NULL , + [user_allow_massemail] [int] DEFAULT (1) NOT NULL , + [user_options] [int] DEFAULT (230271) NOT NULL , + [user_avatar] [varchar] (255) DEFAULT ('') NOT NULL , + [user_avatar_type] [int] DEFAULT (0) NOT NULL , + [user_avatar_width] [int] DEFAULT (0) NOT NULL , + [user_avatar_height] [int] DEFAULT (0) NOT NULL , + [user_sig] [text] DEFAULT ('') NOT NULL , + [user_sig_bbcode_uid] [varchar] (8) DEFAULT ('') NOT NULL , + [user_sig_bbcode_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [user_from] [varchar] (100) DEFAULT ('') NOT NULL , + [user_icq] [varchar] (15) DEFAULT ('') NOT NULL , + [user_aim] [varchar] (255) DEFAULT ('') NOT NULL , + [user_yim] [varchar] (255) DEFAULT ('') NOT NULL , + [user_msnm] [varchar] (255) DEFAULT ('') NOT NULL , + [user_jabber] [varchar] (255) DEFAULT ('') NOT NULL , + [user_website] [varchar] (200) DEFAULT ('') NOT NULL , + [user_occ] [varchar] (4000) DEFAULT ('') NOT NULL , + [user_interests] [varchar] (4000) DEFAULT ('') NOT NULL , + [user_actkey] [varchar] (32) DEFAULT ('') NOT NULL , + [user_newpasswd] [varchar] (40) DEFAULT ('') NOT NULL , + [user_form_salt] [varchar] (32) DEFAULT ('') NOT NULL , + [user_new] [int] DEFAULT (1) NOT NULL , + [user_reminded] [int] DEFAULT (0) NOT NULL , + [user_reminded_time] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE [phpbb_users] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_users] PRIMARY KEY CLUSTERED + ( + [user_id] + ) ON [PRIMARY] +GO + +CREATE INDEX [user_birthday] ON [phpbb_users]([user_birthday]) ON [PRIMARY] +GO + +CREATE INDEX [user_email_hash] ON [phpbb_users]([user_email_hash]) ON [PRIMARY] +GO + +CREATE INDEX [user_type] ON [phpbb_users]([user_type]) ON [PRIMARY] +GO + +CREATE UNIQUE INDEX [username_clean] ON [phpbb_users]([username_clean]) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_warnings' +*/ +CREATE TABLE [phpbb_warnings] ( + [warning_id] [int] IDENTITY (1, 1) NOT NULL , + [user_id] [int] DEFAULT (0) NOT NULL , + [post_id] [int] DEFAULT (0) NOT NULL , + [log_id] [int] DEFAULT (0) NOT NULL , + [warning_time] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_warnings] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_warnings] PRIMARY KEY CLUSTERED + ( + [warning_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_words' +*/ +CREATE TABLE [phpbb_words] ( + [word_id] [int] IDENTITY (1, 1) NOT NULL , + [word] [varchar] (255) DEFAULT ('') NOT NULL , + [replacement] [varchar] (255) DEFAULT ('') NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_words] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_words] PRIMARY KEY CLUSTERED + ( + [word_id] + ) ON [PRIMARY] +GO + + +/* + Table: 'phpbb_zebra' +*/ +CREATE TABLE [phpbb_zebra] ( + [user_id] [int] DEFAULT (0) NOT NULL , + [zebra_id] [int] DEFAULT (0) NOT NULL , + [friend] [int] DEFAULT (0) NOT NULL , + [foe] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_zebra] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_zebra] PRIMARY KEY CLUSTERED + ( + [user_id], + [zebra_id] + ) ON [PRIMARY] +GO + Index: language/en/install.php =================================================================== --- language/en/install.php (revision 10460) +++ language/en/install.php (working copy) @@ -147,6 +147,7 @@ 'DLL_MBSTRING' => 'Multi-byte character support', 'DLL_MSSQL' => 'MSSQL Server 2000+', 'DLL_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC', + 'DLL_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]', 'DLL_MYSQL' => 'MySQL', 'DLL_MYSQLI' => 'MySQL with MySQLi Extension', 'DLL_ORACLE' => 'Oracle', @@ -214,6 +215,7 @@
  • SQLite 2.8.2+
  • Firebird 2.1+
  • MS SQL Server 2000 or above (directly or via ODBC)
  • +
  • MS SQL Server 2005 or above (native)
  • Oracle