[Groonga-mysql-commit] mroonga/mroonga [master] test: add a test for YEAR for PRIMARY KEY.

Back to archive index

null+****@clear***** null+****@clear*****
2012年 2月 17日 (金) 18:28:59 JST


Kouhei Sutou	2012-02-17 18:28:59 +0900 (Fri, 17 Feb 2012)

  New Revision: 7a9af5612aa407ad79b6ec55ef0ceeeaf570c8a3

  Log:
    test: add a test for YEAR for PRIMARY KEY.

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

  Added: test/sql/suite/mroonga_storage/r/primary_key_year.result (+29 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/suite/mroonga_storage/r/primary_key_year.result    2012-02-17 18:28:59 +0900 (747ae8f)
@@ -0,0 +1,29 @@
+DROP TABLE IF EXISTS aniversary_memos;
+CREATE TABLE aniversary_memos (
+party_year YEAR PRIMARY KEY,
+title TEXT
+) DEFAULT CHARSET UTF8;
+SHOW CREATE TABLE aniversary_memos;
+Table	Create Table
+aniversary_memos	CREATE TABLE `aniversary_memos` (
+  `party_year` year(4) NOT NULL,
+  `title` text,
+  PRIMARY KEY (`party_year`)
+) ENGINE=mroonga DEFAULT CHARSET=utf8
+INSERT INTO aniversary_memos (party_year, title)
+VALUES ("11", "We need a big cake!");
+INSERT INTO aniversary_memos (party_year, title)
+VALUES ("2012", "Invitations are sent.");
+INSERT INTO aniversary_memos (party_year, title)
+VALUES ("13", "Wow! Today is the anniversary party day!");
+SELECT * FROM aniversary_memos;
+party_year	title
+2011	We need a big cake!
+2012	Invitations are sent.
+2013	Wow! Today is the anniversary party day!
+SELECT * FROM aniversary_memos
+WHERE party_year BETWEEN "12" AND "2013";
+party_year	title
+2012	Invitations are sent.
+2013	Wow! Today is the anniversary party day!
+DROP TABLE aniversary_memos;

  Added: test/sql/suite/mroonga_storage/t/primary_key_year.test (+43 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/suite/mroonga_storage/t/primary_key_year.test    2012-02-17 18:28:59 +0900 (027e7e1)
@@ -0,0 +1,43 @@
+# 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 TABLE IF EXISTS aniversary_memos;
+--enable_warnings
+
+CREATE TABLE aniversary_memos (
+  party_year YEAR PRIMARY KEY,
+  title TEXT
+) DEFAULT CHARSET UTF8;
+SHOW CREATE TABLE aniversary_memos;
+
+INSERT INTO aniversary_memos (party_year, title)
+       VALUES ("11", "We need a big cake!");
+INSERT INTO aniversary_memos (party_year, title)
+       VALUES ("2012", "Invitations are sent.");
+INSERT INTO aniversary_memos (party_year, title)
+       VALUES ("13", "Wow! Today is the anniversary party day!");
+
+SELECT * FROM aniversary_memos;
+
+SELECT * FROM aniversary_memos
+         WHERE party_year BETWEEN "12" AND "2013";
+
+DROP TABLE aniversary_memos;
+
+--source include/have_mroonga_deinit.inc




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