[Groonga-mysql-commit] mroonga/mroonga [master] [storage][test] add a test for timestamp fractional seconds.

Zurück zum Archiv-Index

null+****@clear***** null+****@clear*****
2012年 2月 3日 (金) 21:39:03 JST


Kouhei Sutou	2012-02-03 21:39:03 +0900 (Fri, 03 Feb 2012)

  New Revision: 160f1fc3cdeecb3d7c82c6753b847fe7c8f1f0cd

  Log:
    [storage][test] add a test for timestamp fractional seconds.

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

  Added: test/sql/suite/mroonga_storage/r/column_timestamp_fractional_seconds.result (+42 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/suite/mroonga_storage/r/column_timestamp_fractional_seconds.result    2012-02-03 21:39:03 +0900 (b6e2560)
@@ -0,0 +1,42 @@
+DROP TABLE IF EXISTS diaries;
+CREATE TABLE diaries (
+id INT PRIMARY KEY AUTO_INCREMENT,
+title TEXT,
+created_at TIMESTAMP(6),
+updated_at TIMESTAMP(6),
+KEY (updated_at)
+) DEFAULT CHARSET UTF8;
+SHOW CREATE TABLE diaries;
+Table	Create Table
+diaries	CREATE TABLE `diaries` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `title` text,
+  `created_at` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+  `updated_at` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
+  PRIMARY KEY (`id`),
+  KEY `updated_at` (`updated_at`)
+) ENGINE=mroonga DEFAULT CHARSET=utf8
+INSERT INTO diaries (title, created_at, updated_at)
+VALUES ("clear day",
+"2012-01-29 21:51:01.111111",
+"2012-01-29 21:51:02.222222");
+INSERT INTO diaries (title, created_at, updated_at)
+VALUES ("rainy day",
+"2012-01-30 01:23:45.333",
+"2012-01-30 01:23:46.444");
+INSERT INTO diaries (title, created_at, updated_at)
+VALUES ("cloudy day",
+"2012-01-31 08:32:10.5555",
+"2012-01-31 08:32:11.6666");
+SELECT * FROM diaries;
+id	title	created_at	updated_at
+1	clear day	2012-01-29 21:51:01.111111	2012-01-29 21:51:02.222222
+2	rainy day	2012-01-30 01:23:45.333000	2012-01-30 01:23:46.444000
+3	cloudy day	2012-01-31 08:32:10.555500	2012-01-31 08:32:11.666600
+SELECT * FROM diaries
+WHERE updated_at BETWEEN "2012-01-29 00:00:00.123456" AND
+"2012-01-31 00:00:00.999999";
+id	title	created_at	updated_at
+1	clear day	2012-01-29 21:51:01.111111	2012-01-29 21:51:02.222222
+2	rainy day	2012-01-30 01:23:45.333000	2012-01-30 01:23:46.444000
+DROP TABLE diaries;

  Added: test/sql/suite/mroonga_storage/t/column_timestamp_fractional_seconds.test (+54 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/suite/mroonga_storage/t/column_timestamp_fractional_seconds.test    2012-02-03 21:39:03 +0900 (b575751)
@@ -0,0 +1,54 @@
+# 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_fractional_seconds.inc
+--source include/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS diaries;
+--enable_warnings
+
+CREATE TABLE diaries (
+  id INT PRIMARY KEY AUTO_INCREMENT,
+  title TEXT,
+  created_at TIMESTAMP(6),
+  updated_at TIMESTAMP(6),
+  KEY (updated_at)
+) DEFAULT CHARSET UTF8;
+SHOW CREATE TABLE diaries;
+
+INSERT INTO diaries (title, created_at, updated_at)
+       VALUES ("clear day",
+               "2012-01-29 21:51:01.111111",
+               "2012-01-29 21:51:02.222222");
+INSERT INTO diaries (title, created_at, updated_at)
+       VALUES ("rainy day",
+               "2012-01-30 01:23:45.333",
+               "2012-01-30 01:23:46.444");
+INSERT INTO diaries (title, created_at, updated_at)
+       VALUES ("cloudy day",
+               "2012-01-31 08:32:10.5555",
+               "2012-01-31 08:32:11.6666");
+
+SELECT * FROM diaries;
+
+SELECT * FROM diaries
+         WHERE updated_at BETWEEN "2012-01-29 00:00:00.123456" AND
+                                  "2012-01-31 00:00:00.999999";
+
+DROP TABLE diaries;
+
+--source include/have_mroonga_deinit.inc




Groonga-mysql-commit メーリングリストの案内
Zurück zum Archiv-Index