null+****@clear*****
null+****@clear*****
2011年 11月 26日 (土) 17:16:56 JST
Kouhei Sutou 2011-11-26 08:16:56 +0000 (Sat, 26 Nov 2011) New Revision: 86efa8037ecad8672e934457e0123e66dfe8b29d Log: [storage][test] add tests for adding column. Added files: test/sql/suite/groonga_storage/r/alter_table_add_column.result test/sql/suite/groonga_storage/t/alter_table_add_column.test Added: test/sql/suite/groonga_storage/r/alter_table_add_column.result (+37 -0) 100644 =================================================================== --- /dev/null +++ test/sql/suite/groonga_storage/r/alter_table_add_column.result 2011-11-26 08:16:56 +0000 (aff91f5) @@ -0,0 +1,37 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + PRIMARY KEY (`id`) +) ENGINE=groonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; +id title +1 survey +ALTER TABLE diaries ADD COLUMN body TEXT; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; +id title body +1 survey will start groonga! +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started 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`) +) ENGINE=groonga DEFAULT CHARSET=utf8 +DROP TABLE diaries; Added: test/sql/suite/groonga_storage/t/alter_table_add_column.test (+44 -0) 100644 =================================================================== --- /dev/null +++ test/sql/suite/groonga_storage/t/alter_table_add_column.test 2011-11-26 08:16:56 +0000 (a4ad7e5) @@ -0,0 +1,44 @@ +# 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 +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; + +ALTER TABLE diaries ADD COLUMN body TEXT; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; + +SHOW CREATE TABLE diaries; + +DROP TABLE diaries; + +--source include/have_groonga_deinit.inc