[Groonga-commit] groonga/groonga [master] Added grn_obj_path_by_id

Back to archive index

null+****@clear***** null+****@clear*****
2012年 1月 23日 (月) 22:06:15 JST


Daijiro MORI	2012-01-23 22:06:15 +0900 (Mon, 23 Jan 2012)

  New Revision: 5f26c1cef1a4765fb6b945f7dc68d4a20a51e2d7

  Log:
    Added grn_obj_path_by_id

  Modified files:
    include/groonga.h
    lib/db.c
    lib/ii.c

  Modified: include/groonga.h (+10 -0)
===================================================================
--- include/groonga.h    2012-01-20 15:07:56 +0900 (f108759)
+++ include/groonga.h    2012-01-23 22:06:15 +0900 (0ea76cd)
@@ -1826,6 +1826,16 @@ GRN_API int grn_column_index(grn_ctx *ctx, grn_obj *column, grn_operator op,
  **/
 GRN_API grn_rc grn_obj_delete_by_id(grn_ctx *ctx, grn_obj *db, grn_id id, grn_bool removep);
 
+/**
+ * grn_obj_path_by_id:
+ * @db: The target database.
+ * @id: The object (table, column and so on) ID to be deleted.
+ * @buffer: path string corresponding to the id willl be set in this buffer.
+ *
+ * dbのidに対応するpathを返します。mroonga向けに用意した内部APIです。
+ **/
+GRN_API grn_rc grn_obj_path_by_id(grn_ctx *ctx, grn_obj *db, grn_id id, char *buffer);
+
 /* geo */
 
 typedef struct {

  Modified: lib/db.c (+14 -0)
===================================================================
--- lib/db.c    2012-01-20 15:07:56 +0900 (0c84f06)
+++ lib/db.c    2012-01-23 22:06:15 +0900 (a6c728c)
@@ -6551,6 +6551,20 @@ grn_obj_delete_by_id(grn_ctx *ctx, grn_obj *db, grn_id id, grn_bool removep)
   GRN_API_RETURN(rc);
 }
 
+
+grn_rc
+grn_obj_path_by_id(grn_ctx *ctx, grn_obj *db, grn_id id, char *buffer)
+{
+  grn_rc rc = GRN_SUCCESS;
+  GRN_API_ENTER;
+  if (!GRN_DB_P(db) || !buffer) {
+    rc = GRN_INVALID_ARGUMENT;
+  } else {
+    gen_pathname(grn_obj_io(db)->path, buffer, id);
+  }
+  GRN_API_RETURN(rc);
+}
+
 /* db must be validated by caller */
 grn_rc
 grn_db_obj_init(grn_ctx *ctx, grn_obj *db, grn_id id, grn_db_obj *obj)

  Modified: lib/ii.c (+1 -0)
===================================================================
--- lib/ii.c    2012-01-20 15:07:56 +0900 (1890f2b)
+++ lib/ii.c    2012-01-23 22:06:15 +0900 (27b257f)
@@ -6377,6 +6377,7 @@ typedef struct {
   grn_obj *target;
   grn_obj *lexicon;
   grn_obj *source;
+  grn_obj *tmp_lexicon;
   builder_block *blocks;
   uint32_t nblocks;
   int tmpfd;




Groonga-commit メーリングリストの案内
Back to archive index