[Groonga-mysql-commit] mroonga/mroonga [master] test storage: add a test case

Back to archive index

null+****@clear***** null+****@clear*****
2012年 5月 21日 (月) 10:11:15 JST


Kouhei Sutou	2012-05-21 10:11:15 +0900 (Mon, 21 May 2012)

  New Revision: 4f8e32daf582e4d95f1e6025ded55332168a20e0

  Log:
    test storage: add a test case
    
    It tests that adding a new multiple column index to a table that has
    some data.

  Added files:
    test/sql/suite/mroonga_storage/r/alter_table_add_key_multiple_column_with_data.result
    test/sql/suite/mroonga_storage/t/alter_table_add_key_multiple_column_with_data.test

  Added: test/sql/suite/mroonga_storage/r/alter_table_add_key_multiple_column_with_data.result (+31 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/suite/mroonga_storage/r/alter_table_add_key_multiple_column_with_data.result    2012-05-21 10:11:15 +0900 (486cc26)
@@ -0,0 +1,31 @@
+DROP TABLE IF EXISTS scores;
+SET NAMES UTF8;
+CREATE TABLE scores (
+id BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL,
+name CHAR(30) NOT NULL,
+score INT NOT NULL
+) DEFAULT CHARSET=UTF8;
+SHOW CREATE TABLE scores;
+Table	Create Table
+scores	CREATE TABLE `scores` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `name` char(30) NOT NULL,
+  `score` int(11) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=mroonga DEFAULT CHARSET=utf8
+INSERT INTO scores (name, score) VALUES("Taro Yamada", 29);
+INSERT INTO scores (name, score) VALUES("Taro Yamada", -12);
+INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27);
+INSERT INTO scores (name, score) VALUES("Taro Yamada", 10);
+SELECT * FROM scores
+WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29);
+id	name	score
+2	Taro Yamada	-12
+4	Taro Yamada	10
+ALTER TABLE scores ADD KEY property (name, score);
+SELECT * FROM scores
+WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29);
+id	name	score
+2	Taro Yamada	-12
+4	Taro Yamada	10
+DROP TABLE scores;

  Added: test/sql/suite/mroonga_storage/t/alter_table_add_key_multiple_column_with_data.test (+45 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/suite/mroonga_storage/t/alter_table_add_key_multiple_column_with_data.test    2012-05-21 10:11:15 +0900 (9c54672)
@@ -0,0 +1,45 @@
+# Copyright(C) 2012 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/not_embedded.inc
+--source include/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS scores;
+--enable_warnings
+
+SET NAMES UTF8;
+CREATE TABLE scores (
+  id BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL,
+  name CHAR(30) NOT NULL,
+  score INT NOT NULL
+) DEFAULT CHARSET=UTF8;
+SHOW CREATE TABLE scores;
+
+INSERT INTO scores (name, score) VALUES("Taro Yamada", 29);
+INSERT INTO scores (name, score) VALUES("Taro Yamada", -12);
+INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27);
+INSERT INTO scores (name, score) VALUES("Taro Yamada", 10);
+SELECT * FROM scores
+         WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29);
+
+ALTER TABLE scores ADD KEY property (name, score);
+SELECT * FROM scores
+         WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29);
+
+DROP TABLE scores;
+
+--source include/have_mroonga_deinit.inc




Groonga-mysql-commit メーリングリストの案内
Back to archive index