Navigation Menu

Skip to content

Commit

Permalink
Merge git@github.com:mroonga/mroonga
Browse files Browse the repository at this point in the history
  • Loading branch information
ikdttr committed Jul 28, 2009
2 parents 3b88159 + 47c8562 commit 21153a6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
5 changes: 4 additions & 1 deletion driver.c
Expand Up @@ -515,7 +515,10 @@ int mrn_rewind_record(grn_ctx *ctx, mrn_record *record)
int i;
for (i=0; i < record->n_columns; i++)
{
GRN_BULK_REWIND(record->value[i]);
if (record->value[i])
{
GRN_BULK_REWIND(record->value[i]);
}
}
return 0;
}
Expand Down
17 changes: 11 additions & 6 deletions ha_groonga.cc
Expand Up @@ -131,6 +131,7 @@ ha_groonga::ha_groonga(handlerton *hton, TABLE_SHARE *share)
grn_ctx_use(ctx, mrn_db);
minfo = NULL;
mcond = NULL;
cur = NULL;
}

ha_groonga::~ha_groonga()
Expand Down Expand Up @@ -449,6 +450,7 @@ int ha_groonga::rnd_init(bool scan)
int ha_groonga::rnd_init(bool scan)
{
MRN_HTRACE;
this->cur = mrn_init_record(ctx, minfo);
return mrn_rnd_init(ctx, minfo);
}
#endif
Expand Down Expand Up @@ -507,7 +509,7 @@ int ha_groonga::rnd_next(uchar *buf)
int rc;
mrn_record *record;
mrn_info *info = this->minfo;
record = mrn_init_record(ctx, info);
record = this->cur;
if (mcond == NULL)
{
rc = mrn_rnd_next(ctx, record, NULL);
Expand All @@ -528,35 +530,38 @@ int ha_groonga::rnd_next(uchar *buf)
}
else
{
int *vint;
int vint;
char *vchar;
switch ((*field)->type())
{
case (MYSQL_TYPE_LONG) :
vint = (int*) GRN_BULK_HEAD(record->value[i]);
vint = GRN_INT32_VALUE(record->value[i]);
(*field)->set_notnull();
(*field)->store(*vint);
(*field)->store(vint);
break;
case (MYSQL_TYPE_VARCHAR) :
vchar = (char*) GRN_BULK_HEAD(record->value[i]);
vchar = GRN_TEXT_VALUE(record->value[i]);
(*field)->set_notnull();
(*field)->store(vchar, GRN_BULK_WSIZE(record->value[i]), system_charset_info);
break;
}
}
}
mrn_deinit_record(ctx, record);
mrn_rewind_record(ctx, record);
return 0;
}
else if (rc == 1)
{
mcond = NULL;
mrn_deinit_record(ctx, record);
cur = NULL;
return HA_ERR_END_OF_FILE;
}
else
{
mcond = NULL;
mrn_deinit_record(ctx, record);
cur = NULL;
return -1;
}
}
Expand Down
1 change: 1 addition & 0 deletions ha_groonga.h
Expand Up @@ -40,6 +40,7 @@ class ha_groonga: public handler

mrn_info *minfo;
mrn_cond *mcond;
mrn_record *cur;

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

0 comments on commit 21153a6

Please sign in to comment.