null+****@clear*****
null+****@clear*****
2011年 11月 27日 (日) 12:00:38 JST
Kouhei Sutou 2011-11-27 03:00:38 +0000 (Sun, 27 Nov 2011)
New Revision: 149e0a03262bf46e05c2a705ff40e708accb1617
Log:
[storage][test] add a test for changing engine. refs #1168
Added files:
test/sql/suite/groonga_storage/r/alter_table_change_engine.result
test/sql/suite/groonga_storage/t/alter_table_change_engine.test
Added: test/sql/suite/groonga_storage/r/alter_table_change_engine.result (+49 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/suite/groonga_storage/r/alter_table_change_engine.result 2011-11-27 03:00:38 +0000 (8b0c545)
@@ -0,0 +1,49 @@
+DROP TABLE IF EXISTS diaries;
+CREATE TABLE diaries (
+id INT PRIMARY KEY AUTO_INCREMENT,
+title TEXT,
+body TEXT,
+FULLTEXT INDEX title_index (title),
+FULLTEXT INDEX body_index (body)
+) ENGINE MyISAM DEFAULT CHARSET UTF8;
+SHOW CREATE TABLE diaries;
+Table Create Table
+diaries CREATE TABLE `diaries` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `title` text,
+ `body` text,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `title_index` (`title`),
+ FULLTEXT KEY `body_index` (`body`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8
+INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!");
+INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga...");
+SELECT * FROM diaries
+WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND
+MATCH(body) AGAINST("groonga" IN BOOLEAN MODE);
+id title body
+1 survey will start groonga!
+ALTER TABLE diaries ENGINE = groonga;
+SHOW CREATE TABLE diaries;
+Table Create Table
+diaries CREATE TABLE `diaries` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `title` text,
+ `body` text,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `title_index` (`title`),
+ FULLTEXT KEY `body_index` (`body`)
+) ENGINE=groonga DEFAULT CHARSET=utf8
+SELECT * FROM diaries
+WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND
+MATCH(body) AGAINST("groonga" IN BOOLEAN MODE);
+id title body
+1 survey will start groonga!
+INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga.");
+SELECT * FROM diaries
+WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AND
+MATCH(body) AGAINST("groonga" IN BOOLEAN MODE);
+id title body
+2 groonga (1) starting groonga...
+3 groonga (2) started groonga.
+DROP TABLE diaries;
Added: test/sql/suite/groonga_storage/t/alter_table_change_engine.test (+53 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/suite/groonga_storage/t/alter_table_change_engine.test 2011-11-27 03:00:38 +0000 (3113211)
@@ -0,0 +1,53 @@
+# Copyright(C) 2011 Kouhei Sutou <kou****@clear*****>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source include/have_groonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS diaries;
+--enable_warnings
+
+CREATE TABLE diaries (
+ id INT PRIMARY KEY AUTO_INCREMENT,
+ title TEXT,
+ body TEXT,
+ FULLTEXT INDEX title_index (title),
+ FULLTEXT INDEX body_index (body)
+) ENGINE MyISAM DEFAULT CHARSET UTF8;
+SHOW CREATE TABLE diaries;
+
+INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!");
+INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga...");
+SELECT * FROM diaries
+ WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND
+ MATCH(body) AGAINST("groonga" IN BOOLEAN MODE);
+
+ALTER TABLE diaries ENGINE = groonga;
+SHOW CREATE TABLE diaries;
+
+SELECT * FROM diaries
+ WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND
+ MATCH(body) AGAINST("groonga" IN BOOLEAN MODE);
+
+INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga.");
+
+SELECT * FROM diaries
+ WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AND
+ MATCH(body) AGAINST("groonga" IN BOOLEAN MODE);
+
+DROP TABLE diaries;
+
+--source include/have_groonga_deinit.inc