null+****@clear*****
null+****@clear*****
2011年 11月 2日 (水) 11:50:46 JST
Kouhei Sutou 2011-11-02 02:50:46 +0000 (Wed, 02 Nov 2011)
New Revision: 0a4b30a32da76708df950f6192262d2d5064309b
Log:
[test][storeage] add tests for REPLACE. refs #1153
Added files:
test/sql/groonga_storage/r/replace_text.result
test/sql/groonga_storage/r/replace_varchar.result
test/sql/groonga_storage/t/replace_text.test
test/sql/groonga_storage/t/replace_varchar.test
Added: test/sql/groonga_storage/r/replace_text.result (+35 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/groonga_storage/r/replace_text.result 2011-11-02 02:50:46 +0000 (dd95058)
@@ -0,0 +1,35 @@
+drop table if exists diaries;
+set names utf8;
+create table diaries (
+id int primary key,
+content text,
+fulltext index (content)
+) default charset utf8;
+show create table diaries;
+Table Create Table
+diaries CREATE TABLE `diaries` (
+ `id` int(11) NOT NULL,
+ `content` text,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `content` (`content`)
+) ENGINE=groonga DEFAULT CHARSET=utf8
+insert into diaries values(1, "今日からはじめました。");
+insert into diaries values(2, "明日の富士山の天気について");
+insert into diaries values(3, "今日も天気がよくてきれいに見える。");
+select * from diaries;
+id content
+1 今日からはじめました。
+2 明日の富士山の天気について
+3 今日も天気がよくてきれいに見える。
+select * from diaries where match(content) against("天気");
+id content
+2 明日の富士山の天気について
+3 今日も天気がよくてきれいに見える。
+replace into diaries values(2, "明日の天気は雨みたい。");
+Warnings:
+Warning 1265 data truncated for primary key column: <id>
+select * from diaries where match(content) against("天気");
+id content
+2 明日の天気は雨みたい。
+3 今日も天気がよくてきれいに見える。
+drop table diaries;
Added: test/sql/groonga_storage/r/replace_varchar.result (+35 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/groonga_storage/r/replace_varchar.result 2011-11-02 02:50:46 +0000 (d0582ac)
@@ -0,0 +1,35 @@
+drop table if exists diaries;
+set names utf8;
+create table diaries (
+id int primary key,
+content varchar(256),
+fulltext index (content)
+) default charset utf8;
+show create table diaries;
+Table Create Table
+diaries CREATE TABLE `diaries` (
+ `id` int(11) NOT NULL,
+ `content` varchar(256) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `content` (`content`)
+) ENGINE=groonga DEFAULT CHARSET=utf8
+insert into diaries values(1, "今日からはじめました。");
+insert into diaries values(2, "明日の富士山の天気について");
+insert into diaries values(3, "今日も天気がよくてきれいに見える。");
+select * from diaries;
+id content
+1 今日からはじめました。
+2 明日の富士山の天気について
+3 今日も天気がよくてきれいに見える。
+select * from diaries where match(content) against("天気");
+id content
+2 明日の富士山の天気について
+3 今日も天気がよくてきれいに見える。
+replace into diaries values(2, "明日の天気は雨みたい。");
+Warnings:
+Warning 1265 data truncated for primary key column: <id>
+select * from diaries where match(content) against("天気");
+id content
+2 明日の天気は雨みたい。
+3 今日も天気がよくてきれいに見える。
+drop table diaries;
Added: test/sql/groonga_storage/t/replace_text.test (+44 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/groonga_storage/t/replace_text.test 2011-11-02 02:50:46 +0000 (6461b7b)
@@ -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 suite/groonga_include/groonga_init.inc
+
+--disable_warnings
+drop table if exists diaries;
+--enable_warnings
+
+set names utf8;
+create table diaries (
+ id int primary key,
+ content text,
+ fulltext index (content)
+) default charset utf8;
+show create table diaries;
+
+insert into diaries values(1, "今日からはじめました。");
+insert into diaries values(2, "明日の富士山の天気について");
+insert into diaries values(3, "今日も天気がよくてきれいに見える。");
+
+select * from diaries;
+
+select * from diaries where match(content) against("天気");
+
+replace into diaries values(2, "明日の天気は雨みたい。");
+select * from diaries where match(content) against("天気");
+
+drop table diaries;
+
+--source suite/groonga_include/groonga_deinit.inc
Added: test/sql/groonga_storage/t/replace_varchar.test (+44 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/groonga_storage/t/replace_varchar.test 2011-11-02 02:50:46 +0000 (ee4d363)
@@ -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 suite/groonga_include/groonga_init.inc
+
+--disable_warnings
+drop table if exists diaries;
+--enable_warnings
+
+set names utf8;
+create table diaries (
+ id int primary key,
+ content varchar(256),
+ fulltext index (content)
+) default charset utf8;
+show create table diaries;
+
+insert into diaries values(1, "今日からはじめました。");
+insert into diaries values(2, "明日の富士山の天気について");
+insert into diaries values(3, "今日も天気がよくてきれいに見える。");
+
+select * from diaries;
+
+select * from diaries where match(content) against("天気");
+
+replace into diaries values(2, "明日の天気は雨みたい。");
+select * from diaries where match(content) against("天気");
+
+drop table diaries;
+
+--source suite/groonga_include/groonga_deinit.inc