type
stringclasses
5 values
content
stringlengths
9
163k
functions
bool tctdbmemsync(TCTDB *tdb, bool phys){ assert(tdb); if(!tdb->open || !tdb->wmode){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); return false; }
functions
uint64_t tctdbbnum(TCTDB *tdb){ assert(tdb); if(!tdb->open){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); return 0; }
functions
uint32_t tctdbalign(TCTDB *tdb){ assert(tdb); if(!tdb->open){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); return 0; }
functions
uint32_t tctdbfbpmax(TCTDB *tdb){ assert(tdb); if(!tdb->open){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); return 0; }
functions
uint64_t tctdbinode(TCTDB *tdb){ assert(tdb); if(!tdb->open){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); return 0; }
functions
time_t tctdbmtime(TCTDB *tdb){ assert(tdb); if(!tdb->open){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); return 0; }
functions
uint8_t tctdbflags(TCTDB *tdb){ assert(tdb); if(!tdb->open){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); return 0; }
functions
uint8_t tctdbopts(TCTDB *tdb){ assert(tdb); if(!tdb->open){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); return 0; }
functions
uint64_t tctdbbnumused(TCTDB *tdb){ assert(tdb); if(!tdb->open){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); return 0; }
functions
int tctdbinum(TCTDB *tdb){ assert(tdb); if(!tdb->open){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); return 0; }
functions
int64_t tctdbuidseed(TCTDB *tdb){ assert(tdb); if(!TDBLOCKMETHOD(tdb, false)) return -1; if(!tdb->open){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); TDBUNLOCKMETHOD(tdb); return -1; }
functions
bool tctdbsetinvcache(TCTDB *tdb, int64_t iccmax, double iccsync){ assert(tdb); if(tdb->open){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); return false; }
functions
bool tctdbsetuidseed(TCTDB *tdb, int64_t seed){ assert(tdb && seed >= 0); if(!TDBLOCKMETHOD(tdb, true)) return -1; if(!tdb->open || !tdb->wmode){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); TDBUNLOCKMETHOD(tdb); return false; }
functions
bool tctdbsetcodecfunc(TCTDB *tdb, TCCODEC enc, void *encop, TCCODEC dec, void *decop){ assert(tdb && enc && dec); if(!TDBLOCKMETHOD(tdb, true)) return false; if(tdb->open){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); TDBUNLOCKMETHOD(tdb); return false; }
functions
uint32_t tctdbdfunit(TCTDB *tdb){ assert(tdb); return tchdbdfunit(tdb->hdb); }
functions
bool tctdbdefrag(TCTDB *tdb, int64_t step){ assert(tdb); if(!TDBLOCKMETHOD(tdb, false)) return false; if(!tdb->open || !tdb->wmode){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); TDBUNLOCKMETHOD(tdb); return false; }
functions
bool tctdbcacheclear(TCTDB *tdb){ assert(tdb); if(!TDBLOCKMETHOD(tdb, true)) return false; if(!tdb->open){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); TDBUNLOCKMETHOD(tdb); return false; }
functions
bool tctdbputproc(TCTDB *tdb, const void *pkbuf, int pksiz, const void *cbuf, int csiz, TCPDPROC proc, void *op){ assert(tdb && pkbuf && pksiz >= 0 && proc); if(!TDBLOCKMETHOD(tdb, true)) return false; if(!tdb->open || !tdb->wmode){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__...
functions
else if(ncbuf){ TCMAP *ncols = tcstrsplit4(ncbuf, ncsiz); if(!tctdbputimpl(tdb, pkbuf, pksiz, ncols, TDBPDOVER)) err = true; tcmapdel(ncols); TCFREE(ncbuf); }
functions
bool tctdbiterinit2(TCTDB *tdb, const void *pkbuf, int pksiz){ assert(tdb && pkbuf && pksiz >= 0); if(!TDBLOCKMETHOD(tdb, true)) return false; if(!tdb->open){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); TDBUNLOCKMETHOD(tdb); return false; }
functions
bool tctdbiterinit3(TCTDB *tdb, const char *kstr){ assert(tdb && kstr); return tctdbiterinit2(tdb, kstr, strlen(kstr)); }
functions
bool tctdbforeach(TCTDB *tdb, TCITER iter, void *op){ assert(tdb && iter); if(!TDBLOCKMETHOD(tdb, false)) return false; if(!tdb->open){ tctdbsetecode(tdb, TCEINVALID, __FILE__, __LINE__, __func__); TDBUNLOCKMETHOD(tdb); return false; }
functions
bool tctdbqryproc2(TDBQRY *qry, TDBQRYPROC proc, void *op){ assert(qry && proc); TCTDB *tdb = qry->tdb; TDBCOND *conds = qry->conds; int cnum = qry->cnum; bool err = false; int64_t getnum = 0; int64_t putnum = 0; int64_t outnum = 0; TCLIST *res = tctdbqrysearch(qry); int rnum = TCLISTNUM(res); for...
functions
else if(flags & TDBQPOUT){ if(tctdboutimpl(tdb, pkbuf, pksiz)){ outnum++; }
functions
bool tctdbqrysearchout2(TDBQRY *qry){ assert(qry); return tctdbqryproc2(qry, tctdbqryprocoutcb, NULL); }
functions
int tctdbstrtoindextype(const char *str){ assert(str); int type = -1; int flags = 0; if(*str == '+'){ flags |= TDBITKEEP; str++; }
functions
int tctdbstrtometasearcytype(const char *str){ assert(str); int type = -1; if(!tcstricmp(str, "UNION") || !tcstricmp(str, "OR")){ type = TDBMSUNION; }
functions
int tctdbqrycount(TDBQRY *qry){ assert(qry); return qry->count; }
functions
else if(cnum > 0){ cond = conds; name = cond->name; }
functions
else if(cond->op == TDBQCFTSPH){ TDBFTSUNIT *ftsunits = cond->ftsunits; int ftsnum = cond->ftsnum; if(ftsnum > 0){ words = tclistnew2(ftsnum * 2 + 1); for(int i = 0; i < ftsnum; i++){ if(!ftsunits[i].sign) continue; TCLIST *tokens = ftsunits[i].tokens; int tnum = TCLISTNU...
functions
int tctdbqrystrtocondop(const char *str){ assert(str); int op = -1; int flags = 0; if(*str == '~' || *str == '!'){ flags |= TDBQCNEGATE; str++; }
functions
int tctdbqrystrtoordertype(const char *str){ assert(str); int type = -1; if(!tcstricmp(str, "STRASC") || !tcstricmp(str, "STR") || !tcstricmp(str, "ASC")){ type = TDBQOSTRASC; }
functions
int tctdbmetastrtosettype(const char *str){ assert(str); int type = -1; if(!tcstricmp(str, "UNION") || !tcstricmp(str, "CUP") || !tcstricmp(str, "+")){ type = TDBMSUNION; }
functions
void tctdbclear(TCTDB *tdb){ assert(tdb); tdb->mmtx = NULL; tdb->hdb = NULL; tdb->open = false; tdb->wmode = false; tdb->opts = 0; tdb->lcnum = TDBDEFLCNUM; tdb->ncnum = TDBDEFNCNUM; tdb->iccmax = TDBIDXICCMAX; tdb->iccsync = TDBIDXICCSYNC; tdb->idxs = NULL; tdb->inum = 0; tdb->tran = false; }
functions
bool tctdbopenimpl(TCTDB *tdb, const char *path, int omode){ assert(tdb && path); int dbgfd = tchdbdbgfd(tdb->hdb); TCCODEC enc, dec; void *encop, *decop; tchdbcodecfunc(tdb->hdb, &enc, &encop, &dec, &decop); int homode = HDBOREADER; int bomode = BDBOREADER; if(omode & TDBOWRITER){ homode = HDBOWRIT...
functions
else if(idxs[inum].type == TDBITQGRAM){ idxs[inum].cc = tcmapnew2(TDBIDXICCBNUM); }
functions
bool tctdbcloseimpl(TCTDB *tdb){ assert(tdb); bool err = false; if(tdb->tran && !tctdbtranabortimpl(tdb)) err = true; TDBIDX *idxs = tdb->idxs; int inum = tdb->inum; for(int i = 0; i < inum; i++){ TDBIDX *idx = idxs + i; switch(idx->type){ case TDBITTOKEN: case TDBITQGRAM: if(!tctdbidx...
functions
bool tctdbputimpl(TCTDB *tdb, const void *pkbuf, int pksiz, TCMAP *cols, int dmode){ assert(tdb && pkbuf && pksiz >= 0 && cols); bool err = false; int osiz; char *obuf = tchdbget(tdb->hdb, pkbuf, pksiz, &osiz); if(obuf){ if(dmode == TDBPDKEEP){ tctdbsetecode(tdb, TCEKEEP, __FILE__, __LINE__, __func_...
functions
bool tctdboutimpl(TCTDB *tdb, const char *pkbuf, int pksiz){ assert(tdb && pkbuf && pksiz >= 0); int csiz; char *cbuf = tchdbget(tdb->hdb, pkbuf, pksiz, &csiz); if(!cbuf) return false; bool err = false; TCMAP *cols = tcmapload(cbuf, csiz); if(!tctdbidxout(tdb, pkbuf, pksiz, cols)) err = true; if(!tchdbo...
functions
double tctdbaddnumber(TCTDB *tdb, const void *pkbuf, int pksiz, double num){ assert(tdb && pkbuf && pksiz >= 0); int csiz; char *cbuf = tchdbget(tdb->hdb, pkbuf, pksiz, &csiz); TCMAP *cols = cbuf ? tcmapload(cbuf, csiz) : tcmapnew2(1); if(cbuf){ const char *vbuf = tcmapget2(cols, TDBNUMCNTCOL); if(vbu...
functions
bool tctdboptimizeimpl(TCTDB *tdb, int64_t bnum, int8_t apow, int8_t fpow, uint8_t opts){ assert(tdb); bool err = false; TCHDB *hdb = tdb->hdb; TDBIDX *idxs = tdb->idxs; int inum = tdb->inum; for(int i = 0; i < inum; i++){ TDBIDX *idx = idxs + i; switch(idx->type){ case TDBITTOKEN: case TDBI...
functions
bool tctdbvanishimpl(TCTDB *tdb){ assert(tdb); bool err = false; if(!tchdbvanish(tdb->hdb)) err = true; TDBIDX *idxs = tdb->idxs; int inum = tdb->inum; for(int i = 0; i < inum; i++){ TDBIDX *idx = idxs + i; switch(idx->type){ case TDBITTOKEN: case TDBITQGRAM: tcmapclear(idx->cc); ...
functions
bool tctdbcopyimpl(TCTDB *tdb, const char *path){ assert(tdb); bool err = false; if(!tchdbcopy(tdb->hdb, path)) err = true; const char *opath = tchdbpath(tdb->hdb); TDBIDX *idxs = tdb->idxs; int inum = tdb->inum; for(int i = 0; i < inum; i++){ TDBIDX *idx = idxs + i; switch(idx->type){ case TD...
functions
bool tctdbtranbeginimpl(TCTDB *tdb){ assert(tdb); if(!tctdbmemsync(tdb, false)) return false; if(!tchdbtranbegin(tdb->hdb)) return false; bool err = false; TDBIDX *idxs = tdb->idxs; int inum = tdb->inum; for(int i = 0; i < inum; i++){ TDBIDX *idx = idxs + i; switch(idx->type){ case TDBITTOKEN:...
functions
bool tctdbtrancommitimpl(TCTDB *tdb){ assert(tdb); bool err = false; if(!tctdbmemsync(tdb, false)) err = true; if(!tchdbtrancommit(tdb->hdb)) err = true; TDBIDX *idxs = tdb->idxs; int inum = tdb->inum; for(int i = 0; i < inum; i++){ TDBIDX *idx = idxs + i; switch(idx->type){ case TDBITTOKEN: ...
functions
bool tctdbtranabortimpl(TCTDB *tdb){ assert(tdb); bool err = false; if(!tchdbtranabort(tdb->hdb)) err = true; TDBIDX *idxs = tdb->idxs; int inum = tdb->inum; for(int i = 0; i < inum; i++){ TDBIDX *idx = idxs + i; switch(idx->type){ case TDBITTOKEN: case TDBITQGRAM: tcmapclear(idx->cc);...
functions
bool tctdbsetindeximpl(TCTDB *tdb, const char *name, int type){ assert(tdb && name); bool err = false; bool keep = false; if(type & TDBITKEEP){ type &= ~TDBITKEEP; keep = true; }
functions
int64_t tctdbgenuidimpl(TCTDB *tdb, int64_t inc){ assert(tdb); void *opq = tchdbopaque(tdb->hdb); uint64_t llnum, uid; if(inc < 0){ uid = -inc - 1; }
functions
else if(!ncond){ ncond = cond; nidx = idx; }
functions
else if(!ncond){ ncond = cond; nidx = idx; }
functions
else if(!ncond){ ncond = cond; nidx = idx; }
functions
else if(!ncond){ ncond = cond; nidx = idx; }
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, vbuf, vsiz)) TCLISTPUSH(res, vbuf, vsiz); }
functions
else if(mcond->op == TDBQCSTRBW){ tcxstrprintf(hint, "using an index: \"%s\" asc (STRBW)\n", mcond->name); BDBCUR *cur = tcbdbcurnew(midx->db); tcbdbcurjump(cur, expr, esiz + trim); bool all = oname && (strcmp(oname, mcond->name) || otype != TDBQOSTRASC); if(!all && max < INT_MAX) tcxstrpr...
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, vbuf, vsiz)) TCLISTPUSH(res, vbuf, vsiz); }
functions
else if(otype == TDBQOSTRDESC){ tclistinvert(res); oname = NULL; }
functions
else if(mcond->op == TDBQCSTROREQ){ tcxstrprintf(hint, "using an index: \"%s\" skip (STROREQ)\n", mcond->name); BDBCUR *cur = tcbdbcurnew(midx->db); TCLIST *tokens = tcstrsplit(expr, "\t\n\r ,"); tclistsort(tokens); for(int i = 1; i < TCLISTNUM(tokens); i++){ if(!strcmp(TCLISTVALPT...
functions
else if(otype == TDBQOSTRDESC){ tclistinvert(tokens); oname = NULL; }
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, vbuf, vsiz)) TCLISTPUSH(res, vbuf, vsiz); }
functions
else if(mcond->op == TDBQCNUMEQ){ tcxstrprintf(hint, "using an index: \"%s\" asc (NUMEQ)\n", mcond->name); BDBCUR *cur = tcbdbcurnew(midx->db); if(oname && !strcmp(oname, mcond->name)) oname = NULL; long double xnum = tctdbatof(expr); tctdbqryidxcurjumpnum(cur, expr, esiz, true); boo...
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, vbuf, vsiz)) TCLISTPUSH(res, vbuf, vsiz); }
functions
else if(mcond->op == TDBQCNUMGT || mcond->op == TDBQCNUMGE){ if(oname && !strcmp(oname, mcond->name) && otype == TDBQONUMDESC){ tcxstrprintf(hint, "using an index: \"%s\" desc (NUMGT/NUMGE)\n", mcond->name); long double xnum = tctdbatof(expr); BDBCUR *cur = tcbdbcurnew(midx->db); t...
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, vbuf, vsiz)) TCLISTPUSH(res, vbuf, vsiz); }
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, vbuf, vsiz)) TCLISTPUSH(res, vbuf, vsiz); }
functions
else if(mcond->op == TDBQCNUMLT || mcond->op == TDBQCNUMLE){ if(oname && !strcmp(oname, mcond->name) && otype == TDBQONUMASC){ tcxstrprintf(hint, "using an index: \"%s\" asc (NUMLT/NUMLE)\n", mcond->name); long double xnum = tctdbatof(expr); BDBCUR *cur = tcbdbcurnew(midx->db); tcb...
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, vbuf, vsiz)) TCLISTPUSH(res, vbuf, vsiz); }
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, vbuf, vsiz)) TCLISTPUSH(res, vbuf, vsiz); }
functions
else if(mcond->op == TDBQCNUMBT){ tcxstrprintf(hint, "using an index: \"%s\" asc (NUMBT)\n", mcond->name); while(*expr == ' ' || *expr == ','){ expr++; }
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, vbuf, vsiz)) TCLISTPUSH(res, vbuf, vsiz); }
functions
else if(otype == TDBQONUMDESC){ tclistinvert(res); oname = NULL; }
functions
else if(mcond->op == TDBQCNUMOREQ){ tcxstrprintf(hint, "using an index: \"%s\" skip (NUMOREQ)\n", mcond->name); BDBCUR *cur = tcbdbcurnew(midx->db); TCLIST *tokens = tcstrsplit(expr, "\t\n\r ,"); tclistsortex(tokens, tdbcmppkeynumasc); for(int i = 1; i < TCLISTNUM(tokens); i++){ if...
functions
else if(otype == TDBQONUMDESC){ tclistinvert(tokens); oname = NULL; }
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, vbuf, vsiz)) TCLISTPUSH(res, vbuf, vsiz); }
functions
else if(mcond->op == TDBQCSTRAND || mcond->op == TDBQCSTROR){ tcxstrprintf(hint, "using an index: \"%s\" inverted (%s)\n", mcond->name, mcond->op == TDBQCSTRAND ? "STRAND" : "STROR"); bool all = oname != NULL; if(!all && max < INT_MAX) tcxstrprintf(hint, "limited matching: %d\n", ma...
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, kbuf, ksiz)) TCLISTPUSH(res, kbuf, ksiz); }
functions
else if(mcond->op == TDBQCFTSPH){ tcxstrprintf(hint, "using an index: \"%s\" inverted (FTS)\n", mcond->name); TCMAP *tres = tctdbidxgetbyfts(tdb, midx, mcond, hint); bool all = oname != NULL; if(!all && max < INT_MAX) tcxstrprintf(hint, "limited matching: %d\n", max); tcmapiterinit(tres); ...
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, kbuf, ksiz)) TCLISTPUSH(res, kbuf, ksiz); }
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, vbuf, vsiz)) TCLISTPUSH(res, vbuf, vsiz); }
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, vbuf, vsiz)) TCLISTPUSH(res, vbuf, vsiz); }
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, vbuf, vsiz)) TCLISTPUSH(res, vbuf, vsiz); }
functions
else if(ucond){ if(tctdbqryonecondmatch(qry, ucond, vbuf, vsiz)) TCLISTPUSH(res, vbuf, vsiz); }
functions
else if(isord){ tcxstrprintf(hint, "leaving the index order\n"); }
functions
else if(cond->op == TDBQCSTRBW){ tcxstrprintf(hint, "using an auxiliary index: \"%s\" asc (STRBW)\n", cond->name); BDBCUR *cur = tcbdbcurnew(idx->db); tcbdbcurjump(cur, expr, esiz + trim); const char *kbuf; int ksiz; while((kbuf = tcbdbcurkey3(cur, &ksiz)) != NULL){ if(trim) ksiz -= 3; ...
functions
else if(cond->op == TDBQCSTROREQ){ tcxstrprintf(hint, "using an auxiliary index: \"%s\" skip (STROREQ)\n", cond->name); TCLIST *tokens = tcstrsplit(expr, "\t\n\r ,"); tclistsort(tokens); for(int i = 1; i < TCLISTNUM(tokens); i++){ if(!strcmp(TCLISTVALPTR(tokens, i), TCLISTVALPTR(tokens, i - 1))){ ...
functions
else if(cond->op == TDBQCNUMEQ){ tcxstrprintf(hint, "using an auxiliary index: \"%s\" asc (NUMEQ)\n", cond->name); long double xnum = tctdbatof(expr); BDBCUR *cur = tcbdbcurnew(idx->db); tctdbqryidxcurjumpnum(cur, expr, esiz, true); const char *kbuf; int ksiz; while((kbuf = tcbdbcurkey3(cur,...
functions
else if(cond->op == TDBQCNUMGT || cond->op == TDBQCNUMGE){ tcxstrprintf(hint, "using an auxiliary index: \"%s\" asc (NUMGT/NUMGE)\n", cond->name); long double xnum = tctdbatof(expr); BDBCUR *cur = tcbdbcurnew(idx->db); tctdbqryidxcurjumpnum(cur, expr, esiz, true); const char *kbuf; int ksiz; ...
functions
else if(cond->op == TDBQCNUMLT || cond->op == TDBQCNUMLE){ tcxstrprintf(hint, "using an auxiliary index: \"%s\" desc (NUMLT/NUMLE)\n", cond->name); long double xnum = tctdbatof(expr); BDBCUR *cur = tcbdbcurnew(idx->db); tctdbqryidxcurjumpnum(cur, expr, esiz, false); const char *kbuf; int ksiz; ...
functions
else if(cond->op == TDBQCNUMBT){ tcxstrprintf(hint, "using an auxiliary index: \"%s\" asc (NUMBT)\n", cond->name); while(*expr == ' ' || *expr == ','){ expr++; }
functions
else if(cond->op == TDBQCNUMOREQ){ tcxstrprintf(hint, "using an auxiliary index: \"%s\" skip (NUMOREQ)\n", cond->name); BDBCUR *cur = tcbdbcurnew(idx->db); TCLIST *tokens = tcstrsplit(expr, "\t\n\r ,"); tclistsortex(tokens, tdbcmppkeynumasc); for(int i = 1; i < TCLISTNUM(tokens); i++){ if(tctd...
functions
else if(cond->op == TDBQCSTRAND || cond->op == TDBQCSTROR){ tcxstrprintf(hint, "using an auxiliary index: \"%s\" inverted (%s)\n", cond->name, cond->op == TDBQCSTRAND ? "STRAND" : "STROR"); TCLIST *tokens = tcstrsplit(expr, "\t\n\r ,"); tclistsort(tokens); for(int i = 1; i < TCLISTNUM(t...
functions
else if(cond->op == TDBQCFTSPH){ tcxstrprintf(hint, "using an auxiliary index: \"%s\" inverted (FTS)\n", cond->name); tcmapdel(nmap); nmap = tctdbidxgetbyfts(tdb, idx, cond, hint); }
functions
double tctdbatof(const char *str){ assert(str); while(*str > '\0' && *str <= ' '){ str++; }
functions
else if(*str == '+'){ str++; }
functions
bool tctdbqryidxcurjumpnum(BDBCUR *cur, const char *expr, int esiz, bool first){ assert(cur && expr && esiz >= 0); char stack[TCNUMBUFSIZ], *rbuf; if(esiz < sizeof(stack)){ rbuf = stack; }
functions
bool tctdbqryonecondmatch(TDBQRY *qry, TDBCOND *cond, const char *pkbuf, int pksiz){ assert(qry && cond && pkbuf && pksiz >= 0); if(cond->nsiz < 1) return tctdbqrycondmatch(cond, pkbuf, pksiz) == cond->sign; int csiz; char *cbuf = tchdbget(qry->tdb->hdb, pkbuf, pksiz, &csiz); if(!cbuf) return false; bool rv...
functions
bool tctdbqryallcondmatch(TDBQRY *qry, const char *pkbuf, int pksiz){ assert(qry && pkbuf && pksiz >= 0); TCTDB *tdb = qry->tdb; TDBCOND *conds = qry->conds; int cnum = qry->cnum; int csiz; char *cbuf = tchdbget(tdb->hdb, pkbuf, pksiz, &csiz); if(!cbuf) return false; TCMAP *cols = tcmapload(cbuf, csiz);...
functions
bool tctdbqrycondmatch(TDBCOND *cond, const char *vbuf, int vsiz){ assert(cond && vbuf && vsiz >= 0); bool hit = false; switch(cond->op){ case TDBQCSTREQ: hit = vsiz == cond->esiz && !memcmp(vbuf, cond->expr, cond->esiz); break; case TDBQCSTRINC: hit = strstr(vbuf, cond->expr) != NULL; break; ...
functions
bool tctdbqrycondcheckstrand(const char *vbuf, const char *expr){ assert(vbuf && expr); const unsigned char *sp = (unsigned char *)expr; while(*sp != '\0'){ while((*sp != '\0' && *sp <= ' ') || *sp == ','){ sp++; }
functions
bool tctdbqrycondcheckstror(const char *vbuf, const char *expr){ assert(vbuf && expr); const unsigned char *sp = (unsigned char *)expr; while(*sp != '\0'){ while((*sp != '\0' && *sp <= ' ') || *sp == ','){ sp++; }
functions
bool tctdbqrycondcheckstroreq(const char *vbuf, const char *expr){ assert(vbuf && expr); const unsigned char *sp = (unsigned char *)expr; while(*sp != '\0'){ while((*sp != '\0' && *sp <= ' ') || *sp == ','){ sp++; }