Kouhei Sutou
null+****@clear*****
Thu Apr 5 12:25:57 JST 2018
Kouhei Sutou 2018-04-05 12:25:57 +0900 (Thu, 05 Apr 2018) New Revision: b46947b28f0bbbff0f664f45bee90c9ed4596719 https://github.com/groonga/groonga/commit/b46947b28f0bbbff0f664f45bee90c9ed4596719 Message: Add convenient API to set option to object Modified files: include/groonga/obj.h lib/obj.c Modified: include/groonga/obj.h (+16 -1) =================================================================== --- include/groonga/obj.h 2018-04-05 12:20:20 +0900 (7bc554950) +++ include/groonga/obj.h 2018-04-05 12:25:57 +0900 (2ab37ee42) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2015-2017 Brazil + Copyright(C) 2015-2018 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -19,6 +19,8 @@ #pragma once +#include <groonga/option.h> + #ifdef __cplusplus extern "C" { #endif @@ -76,6 +78,19 @@ GRN_API grn_bool grn_obj_name_is_column(grn_ctx *ctx, GRN_API grn_bool grn_obj_is_corrupt(grn_ctx *ctx, grn_obj *obj); GRN_API size_t grn_obj_get_disk_usage(grn_ctx *ctx, grn_obj *obj); +GRN_API grn_rc grn_obj_set_option_values(grn_ctx *ctx, + grn_obj *obj, + const char *name, + int name_length, + grn_obj *values); +GRN_API grn_option_revision +grn_obj_get_option_values(grn_ctx *ctx, + grn_obj *obj, + const char *name, + int name_length, + grn_option_revision revision, + grn_obj *values); + #ifdef __cplusplus } #endif Modified: lib/obj.c (+44 -1) =================================================================== --- lib/obj.c 2018-04-05 12:20:20 +0900 (09d71ec07) +++ lib/obj.c 2018-04-05 12:25:57 +0900 (e0c6a7e1b) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2015-2017 Brazil + Copyright(C) 2015-2018 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -687,3 +687,46 @@ grn_obj_get_disk_usage(grn_ctx *ctx, grn_obj *obj) GRN_API_RETURN(usage); } + +grn_rc +grn_obj_set_option_values(grn_ctx *ctx, + grn_obj *obj, + const char *name, + int name_length, + grn_obj *values) +{ + grn_rc rc; + + GRN_API_ENTER; + + rc = grn_db_set_option_values(ctx, + grn_ctx_db(ctx), + grn_obj_id(ctx, obj), + name, + name_length, + values); + + GRN_API_RETURN(rc); +} + +grn_option_revision +grn_obj_get_option_values(grn_ctx *ctx, + grn_obj *obj, + const char *name, + int name_length, + grn_option_revision revision, + grn_obj *values) +{ + grn_option_revision returned_revision; + + GRN_API_ENTER; + returned_revision = grn_db_get_option_values(ctx, + grn_ctx_db(ctx), + grn_obj_id(ctx, obj), + name, + name_length, + revision, + values); + + GRN_API_RETURN(returned_revision); +} -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180405/d02babdd/attachment-0001.htm