null+****@clear*****
null+****@clear*****
2012年 3月 4日 (日) 23:02:42 JST
Kouhei Sutou 2012-03-04 23:02:42 +0900 (Sun, 04 Mar 2012) New Revision: f0117e712c7a31f5ba1f5981550333d7e9c8e4ab Log: [wrapper][test] add a test for INSERT ON DUPLICATE KEY UPDATE wiht MyISAM refs #1301 This test is failed for now. Reported by @104yuki_n. Thanks!!! Added files: test/sql/suite/mroonga_wrapper/r/multiple_column_index_unique_myisam.result test/sql/suite/mroonga_wrapper/t/multiple_column_index_unique_myisam.test Added: test/sql/suite/mroonga_wrapper/r/multiple_column_index_unique_myisam.result (+33 -0) 100644 =================================================================== --- /dev/null +++ test/sql/suite/mroonga_wrapper/r/multiple_column_index_unique_myisam.result 2012-03-04 23:02:42 +0900 (bf6c871) @@ -0,0 +1,33 @@ +DROP TEMPORARY TABLE IF EXISTS diaries; +CREATE TEMPORARY TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +date TIMESTAMP NOT NULL, +title VARCHAR(100) NOT NULL, +content TEXT NOT NULL, +UNIQUE INDEX (date, title) +) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "MyISAM"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TEMPORARY TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `title` varchar(100) NOT NULL, + `content` text NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `date` (`date`,`title`) +) ENGINE=mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "MyISAM"' +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-04", "cloudy day", "Today is cloudy day..."); +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-04", "shopping", "I buy a new shirt."); +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-05", "rainy day", "Today is rainy day..."); +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-04", "shopping", "I buy new shoes.") +ON DUPLICATE KEY UPDATE content = "I buy a new hat."; +SELECT * FROM diaries; +id date title content +1 2012-03-04 00:00:00 cloudy day Today is cloudy day... +2 2012-03-04 16:49:23 shopping I buy a new hat. +3 2012-03-05 00:00:00 rainy day Today is rainy day... +DROP TABLE diaries; Added: test/sql/suite/mroonga_wrapper/t/multiple_column_index_unique_myisam.test (+46 -0) 100644 =================================================================== --- /dev/null +++ test/sql/suite/mroonga_wrapper/t/multiple_column_index_unique_myisam.test 2012-03-04 23:02:42 +0900 (ddba6e5) @@ -0,0 +1,46 @@ +# 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/have_mroonga.inc + +--disable_warnings +DROP TEMPORARY TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TEMPORARY TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + date TIMESTAMP NOT NULL, + title VARCHAR(100) NOT NULL, + content TEXT NOT NULL, + UNIQUE INDEX (date, title) +) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "MyISAM"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-04", "cloudy day", "Today is cloudy day..."); +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-04", "shopping", "I buy a new shirt."); +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-05", "rainy day", "Today is rainy day..."); +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-04", "shopping", "I buy new shoes.") + ON DUPLICATE KEY UPDATE content = "I buy a new hat."; + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source include/have_mroonga_deinit.inc