Kouhei Sutou
null+****@clear*****
Wed Feb 13 23:03:19 JST 2013
Kouhei Sutou 2013-02-13 23:03:19 +0900 (Wed, 13 Feb 2013) New Revision: 3515e45a71eb6b302d69fe6f5d3a41e025e077f1 https://github.com/groonga/groonga/commit/3515e45a71eb6b302d69fe6f5d3a41e025e077f1 Log: Support Bool -> Time cast Added files: test/command/suite/load/bool/cast/time.expected test/command/suite/load/bool/cast/time.test Modified files: lib/db.c Modified: lib/db.c (+3 -0) =================================================================== --- lib/db.c 2013-02-13 22:59:30 +0900 (51f83b8) +++ lib/db.c 2013-02-13 23:03:19 +0900 (8a14431) @@ -4236,6 +4236,9 @@ grn_obj_cast_bool(grn_ctx *ctx, grn_obj *src, grn_obj *dest, grn_bool addp) case GRN_DB_UINT64 : GRN_UINT64_SET(ctx, dest, GRN_BOOL_VALUE(src)); break; + case GRN_DB_TIME : + GRN_TIME_SET(ctx, dest, GRN_BOOL_VALUE(src)); + break; default : SRC2RECORD(); } Added: test/command/suite/load/bool/cast/time.expected (+49 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/load/bool/cast/time.expected 2013-02-13 23:03:19 +0900 (5dca4a7) @@ -0,0 +1,49 @@ +table_create Entries TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Entries created_at COLUMN_SCALAR Time +[[0,0.0,0.0],true] +load --table Entries +[ +{"_key": "Special news!", "created_at": true}, +{"_key": "Surprise news!", "created_at": false} +] +[[0,0.0,0.0],2] +select Entries +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 2 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "created_at", + "Time" + ] + ], + [ + 1, + "Special news!", + 1.0e-06 + ], + [ + 2, + "Surprise news!", + 0.0 + ] + ] + ] +] Added: test/command/suite/load/bool/cast/time.test (+10 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/load/bool/cast/time.test 2013-02-13 23:03:19 +0900 (73dea9b) @@ -0,0 +1,10 @@ +table_create Entries TABLE_HASH_KEY ShortText +column_create Entries created_at COLUMN_SCALAR Time + +load --table Entries +[ +{"_key": "Special news!", "created_at": true}, +{"_key": "Surprise news!", "created_at": false} +] + +select Entries -------------- next part -------------- HTML����������������������������...Download