null+****@clear*****
null+****@clear*****
2011年 3月 15日 (火) 16:42:24 JST
Kouhei Sutou 2011-03-15 07:42:24 +0000 (Tue, 15 Mar 2011)
New Revision: 71265db85a9d605f3c09a8b1e9cb22447e38c577
Log:
fix load drops msec info. #880
Modified files:
lib/db.c
test/unit/core/test-command-load.c
Modified: lib/db.c (+1 -1)
===================================================================
--- lib/db.c 2011-03-13 12:56:18 +0000 (11504c1)
+++ lib/db.c 2011-03-15 07:42:24 +0000 (4144797)
@@ -3824,7 +3824,7 @@ grn_obj_is_persistent(grn_ctx *ctx, grn_obj *obj)
GRN_UINT32_SET(ctx, dest, getvalue(src));\
break;\
case GRN_DB_TIME :\
- GRN_TIME_SET(ctx, dest, (long long int)(getvalue(src)) * GRN_TIME_USEC_PER_SEC);\
+ GRN_TIME_SET(ctx, dest, (long long int)(getvalue(src) * GRN_TIME_USEC_PER_SEC)); \
break;\
case GRN_DB_INT64 :\
GRN_INT64_SET(ctx, dest, getvalue(src));\
Modified: test/unit/core/test-command-load.c (+19 -0)
===================================================================
--- test/unit/core/test-command-load.c 2011-03-13 12:56:18 +0000 (4ff28ff)
+++ test/unit/core/test-command-load.c 2011-03-15 07:42:24 +0000 (9227c44)
@@ -28,6 +28,7 @@ void attributes_bool(void);
void data_bool(void);
void test_bool(gconstpointer data);
void test_int32_key(void);
+void test_time_float(void);
void data_null(void);
void test_null(gconstpointer data);
void test_index_geo_point(void);
@@ -198,6 +199,24 @@ test_int32_key(void)
}
void
+test_time_float(void)
+{
+ assert_send_command("table_create Logs TABLE_NO_KEY");
+ assert_send_command("column_create Logs time_stamp COLUMN_SCALAR Time");
+ cut_assert_equal_string("1",
+ send_command("load --table Logs\n"
+ "[{\"time_stamp\": 1295851581.41798}]"));
+ cut_assert_equal_string("[[[1],"
+ "["
+ "[\"_id\",\"UInt32\"],"
+ "[\"time_stamp\",\"Time\"]"
+ "],"
+ "[1,1295851581.41798]"
+ "]]",
+ send_command("select Logs"));
+}
+
+void
data_null(void)
{
#define ADD_DATUM(label, expected, load) \