List:Internals« Previous MessageNext Message »
From:Bjorn Borud Date:November 23 2000 4:02pm
Subject:what am I missing here...
View as plain text  
I have the following struct

typedef struct {
    char id[31];
    char data[128];
} record;

I created MyISAM files using the following definitions:
    memset(recinfo, 0, sizeof(recinfo));
    memset(keyinfo, 0, sizeof(keyinfo));
    /* let's define two columns like in the "record" struct */
    recinfo[0].type   = FIELD_NORMAL;
    recinfo[0].length = sizeof(;

    recinfo[1].type   = FIELD_NORMAL;
    recinfo[1].length = sizeof(;

    /* lets define the key */
    keyinfo[0].seg = &keyseg[0][0];   
    keyinfo[0].seg[0].start = 0;
    keyinfo[0].seg[0].length = 30;
    keyinfo[0].seg[0].type = HA_KEYTYPE_TEXT; /* sort as text */
    keyinfo[0].seg[0].flag = 0;
    keyinfo[0].flag = (uint8) HA_NOSAME;      /* don't allow duplicates */

then I created the myisam files and filled some data into the tables
and tried to look up the data:

lookuptest (MI_INFO *file, char *key)
    record rec;
    int res;

    memset(&rec, 0, sizeof(rec));
    strcpy(, key);
    res = mi_rfirst(file, (byte *) &rec, 0);
    if (res != 0) {
	fprintf(stderr, "*** Err: %d\n", my_errno);
    fprintf(stderr, "<RESP> id='%s'  data='%s'\n",,;

giving the entry I am looking for in the "key" parameter.  what
happens is that I just get the first row and not the one I am looking
for.  what am I missing here?

MyISAM C APIBjorn Borud13 Nov
  • Re: MyISAM C APIsasha13 Nov
    • what am I missing here...Bjorn Borud23 Nov