aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2011-10-14 17:50:08 +0200
committerIgor Wiedler <igor@wiedler.ch>2011-10-14 17:50:08 +0200
commitcafefe9379059dd40a5e259c9bb36f07943c72c7 (patch)
treeaac4345b7e233c5df0aa5a297b2033815398653e
parent4effe8fb8bdf493e539b7bf883fbf1e290bf7ab2 (diff)
parent607761e8303f456929e4755d8fabb69d9d16561a (diff)
downloadforums-cafefe9379059dd40a5e259c9bb36f07943c72c7.tar
forums-cafefe9379059dd40a5e259c9bb36f07943c72c7.tar.gz
forums-cafefe9379059dd40a5e259c9bb36f07943c72c7.tar.bz2
forums-cafefe9379059dd40a5e259c9bb36f07943c72c7.tar.xz
forums-cafefe9379059dd40a5e259c9bb36f07943c72c7.zip
Merge remote-tracking branch 'bantu/ticket/10327' into develop-olympus
* bantu/ticket/10327: [ticket/10327] Use $this->tools instead of creating a new instance of db_tools. [ticket/10327] Also change CREATE UNIQUE INDEX to use ALTER TABLE.
-rw-r--r--phpBB/includes/db/db_tools.php2
-rw-r--r--tests/dbal/db_tools_test.php13
2 files changed, 4 insertions, 11 deletions
diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php
index 317b8c6083..2cba11133a 100644
--- a/phpBB/includes/db/db_tools.php
+++ b/phpBB/includes/db/db_tools.php
@@ -2115,7 +2115,7 @@ class phpbb_db_tools
case 'mysql_40':
case 'mysql_41':
- $statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')';
+ $statements[] = 'ALTER TABLE ' . $table_name . ' ADD UNIQUE INDEX (' . implode(', ', $column) . ')';
break;
case 'mssql':
diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php
index b34b471e5c..c0c66b5be7 100644
--- a/tests/dbal/db_tools_test.php
+++ b/tests/dbal/db_tools_test.php
@@ -351,19 +351,12 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
public function test_index_exists()
{
- $db_tools = new phpbb_db_tools($this->db);
-
- $this->assertTrue($db_tools->sql_index_exists('prefix_table_name', 'i_simple'));
+ $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'i_simple'));
}
public function test_create_index_against_index_exists()
{
- $db_tools = new phpbb_db_tools($this->db);
-
- $table_name = 'prefix_table_name';
- $index_name = 'fookey';
-
- $db_tools->sql_create_index($table_name, $index_name, array('c_timestamp', 'c_decimal'));
- $this->assertTrue($db_tools->sql_index_exists($table_name, $index_name));
+ $this->tools->sql_create_index('prefix_table_name', 'fookey', array('c_timestamp', 'c_decimal'));
+ $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'fookey'));
}
}