Esempio n. 1
0
bool BTreeSearchExecStream::innerSearchLoop()
{
    while (!pReader->isPositioned()) {
        if (!pInAccessor->demandData()) {
            return false;
        }

        readSearchKey();
        readDirectives();
        pSearchKey = &inputKeyData;
        readUpperBoundKey();
        if (!searchForKey()) {
            pInAccessor->consumeTuple();
        }
    }
    return true;
}
Esempio n. 2
0
int loadZoneFromStr(char *errstr, int socket_id, char *zbuf, zone **zpp) {
    char dotOrigin[MAX_DOMAIN_LEN+2] = {0};
    char rbuf[RECORD_SIZE];
    uint32_t default_ttl = 1800;
    zone *z = NULL;
    int err;
    int line_idx = 0;
    RRParser *psr = NULL;
    char *ss = zbuf;

    if(readDirectives(errstr, &ss, dotOrigin, &default_ttl, &line_idx) == ERR_CODE) {
        goto error;
    }
    LOG_DEBUG("origin: %s, default ttl: %d", dotOrigin, default_ttl);
    if (strlen(dotOrigin) == 0) {
        snprintf(errstr, ERR_STR_LEN, "line %d syntax error: no origin", line_idx);
        goto error;
    }
    psr = RRParserCreate("@", default_ttl, dotOrigin);
    z = zoneCreate(dotOrigin, socket_id);
    z->default_ttl = default_ttl;

    while ((err= readFullRecord(errstr, &ss, rbuf, RECORD_SIZE, &line_idx)) == OK_CODE) {
        LOG_DEBUG("line: %s", rbuf);
        if (RRParserFeed(psr, rbuf, NULL, z) == ERR_CODE) {
            snprintf(errstr, ERR_STR_LEN, "Line %d %s", line_idx, psr->errstr);
            goto error;
        }
    }
    if (err != EOF_CODE) goto error;

    *zpp = z;
    goto ok;

error:
    err = ERR_CODE;
    zoneDestroy(z);
ok:
    RRParserDestroy(psr);
    return err;
}