Navigation Menu

Skip to content

Commit

Permalink
add grn_ctx to ha_groonga. constructor and destructor handle this.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikdttr committed Jun 18, 2009
1 parent beaf8e9 commit fb7c00a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions driver.c
Expand Up @@ -18,6 +18,7 @@ grn_obj *mrn_db_sys, *mrn_lexicon_sys;
pthread_mutex_t *mrn_mutex_sys;
const char *mrn_logfile_name=MRN_LOG_FILE_NAME;
FILE *mrn_logfile = NULL;
uint mrn_ctx_counter = 0;

grn_logger_info mrn_logger_info = {
GRN_LOG_DUMP,
Expand Down
2 changes: 2 additions & 0 deletions driver.h
Expand Up @@ -88,4 +88,6 @@ extern FILE *mrn_logfile;

extern grn_logger_info mrn_logger_info;

extern uint mrn_ctx_counter;

#endif /* _mroonga_h */
7 changes: 6 additions & 1 deletion ha_groonga.cc
Expand Up @@ -126,11 +126,16 @@ mysql_declare_plugin_end;
ha_groonga::ha_groonga(handlerton *hton, TABLE_SHARE *share)
:handler(hton, share)
{
mrn_counter=0;
ctx = (grn_ctx*) malloc(sizeof(grn_ctx));
grn_ctx_init(ctx,0);
mrn_ctx_counter++;
}

ha_groonga::~ha_groonga()
{
grn_ctx_fin(ctx);
free(ctx);
mrn_ctx_counter--;
}

const char *ha_groonga::table_type() const
Expand Down
3 changes: 2 additions & 1 deletion ha_groonga.h
Expand Up @@ -17,7 +17,8 @@ class ha_groonga: public handler
grn_table_cursor *cursor;
grn_id record_id;
grn_obj *res;
int mrn_counter;

grn_ctx *ctx;

public:
ha_groonga(handlerton *hton, TABLE_SHARE *share);
Expand Down

0 comments on commit fb7c00a

Please sign in to comment.