ext/groonga/rb-grn-database.c in rroonga-1.0.1 vs ext/groonga/rb-grn-database.c in rroonga-1.0.2

- old
+ new

@@ -1,8 +1,8 @@ /* -*- c-file-style: "ruby" -*- */ /* - Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com> + Copyright (C) 2009-2010 Kouhei Sutou <kou@clear-code.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. @@ -439,10 +439,31 @@ NULL, NULL, NULL, NULL); return CBOOL2RVAL(grn_obj_is_locked(context, database)); } +/* + * Document-method: touch + * + * call-seq: + * database.touch + * + * _database_の最終更新時刻を現在時刻にする。 + */ +static VALUE +rb_grn_database_touch (VALUE self) +{ + grn_ctx *context; + grn_obj *database; + + rb_grn_database_deconstruct(SELF(self), &database, &context, + NULL, NULL, NULL, NULL); + + grn_db_touch(context, database); + return Qnil; +} + void rb_grn_init_database (VALUE mGrn) { rb_cGrnDatabase = rb_define_class_under(mGrn, "Database", rb_cGrnObject); rb_define_alloc_func(rb_cGrnDatabase, rb_grn_database_alloc); @@ -467,6 +488,8 @@ rb_define_method(rb_cGrnDatabase, "lock", rb_grn_database_lock, -1); rb_define_method(rb_cGrnDatabase, "unlock", rb_grn_database_unlock, 0); rb_define_method(rb_cGrnDatabase, "clear_lock", rb_grn_database_clear_lock, 0); rb_define_method(rb_cGrnDatabase, "locked?", rb_grn_database_is_locked, 0); + + rb_define_method(rb_cGrnDatabase, "touch", rb_grn_database_touch, 0); }