⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bat5.c

📁 一个内存数据库的源代码这是服务器端还有客户端
💻 C
📖 第 1 页 / 共 4 页
字号:
#line 2472 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"strBKCgetKey(bit *ret, int *bid){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.setPersistence", "Cannot access descriptor");	}	CMDgetkey(ret, b);	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}strBKCpersists(int *r, int *bid, bit *flg){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.setPersistence", "Cannot access descriptor");	}	BATmode(b, (*flg == TRUE) ? PERSISTENT : (*flg ==FALSE) ? TRANSIENT : SESSION);	BBPreleaseref(b->batCacheid);	*r = 0;	return MAL_SUCCEED;}strBKCsetPersistent(int *r, int *bid){	bit flag= TRUE;	return BKCpersists(r,bid, &flag);}strBKCisPersistent(bit *res, int *bid){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.setPersistence", "Cannot access descriptor");	}	*res = (b->batPersistence == PERSISTENT) ? TRUE :FALSE;	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}strBKCsetTransient(int *r, int *bid){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.setTransient", "Cannot access descriptor");	}	BATmode(b, TRANSIENT);	*r = 0;	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}strBKCisTransient(bit *res, int *bid){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.setTransient", "Cannot access descriptor");	}	*res = b->batPersistence == TRANSIENT;	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}#line 2574 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"#line 2549 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"bat5_export str BKCsetWriteMode(int *res, int *bid) ;str BKCsetWriteMode(int *res, int *bid) {	BAT *b, *bn = NULL;	int param=0;    if( (b= BATdescriptor(*bid)) == NULL ){        throw(MAL, "bat.setWriteMode", "Cannot access descriptor");    }	CMDsetaccess(&bn,b,&param);	*res =bn->batCacheid;	BBPkeepref(bn->batCacheid);	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}bat5_export str BKChasWriteMode(bit *res, int *bid);str BKChasWriteMode(bit *res, int *bid) {	BAT *b;    if( (b= BATdescriptor(*bid)) == NULL ){        throw(MAL, "bat.setWriteMode", "Cannot access descriptor");    }	*res = BATgetaccess(b)=='w';	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}#line 2574 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"#line 2549 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"bat5_export str BKCsetReadMode(int *res, int *bid) ;str BKCsetReadMode(int *res, int *bid) {	BAT *b, *bn = NULL;	int param=1;    if( (b= BATdescriptor(*bid)) == NULL ){        throw(MAL, "bat.setReadMode", "Cannot access descriptor");    }	CMDsetaccess(&bn,b,&param);	*res =bn->batCacheid;	BBPkeepref(bn->batCacheid);	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}bat5_export str BKChasReadMode(bit *res, int *bid);str BKChasReadMode(bit *res, int *bid) {	BAT *b;    if( (b= BATdescriptor(*bid)) == NULL ){        throw(MAL, "bat.setReadMode", "Cannot access descriptor");    }	*res = BATgetaccess(b)=='r';	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}#line 2575 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"#line 2549 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"bat5_export str BKCsetAppendMode(int *res, int *bid) ;str BKCsetAppendMode(int *res, int *bid) {	BAT *b, *bn = NULL;	int param=2;    if( (b= BATdescriptor(*bid)) == NULL ){        throw(MAL, "bat.setAppendMode", "Cannot access descriptor");    }	CMDsetaccess(&bn,b,&param);	*res =bn->batCacheid;	BBPkeepref(bn->batCacheid);	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}bat5_export str BKChasAppendMode(bit *res, int *bid);str BKChasAppendMode(bit *res, int *bid) {	BAT *b;    if( (b= BATdescriptor(*bid)) == NULL ){        throw(MAL, "bat.setAppendMode", "Cannot access descriptor");    }	*res = BATgetaccess(b)=='a';	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}#line 2576 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"strBKCaccess(int *res, int *bid, int *m){	BAT *b, *bn = NULL;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.setAccess", "Cannot access descriptor");	}	CMDsetaccess(&bn, b, m);	*res = bn->batCacheid;	BBPkeepref(bn->batCacheid);	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}strBKCsetAccess(int *res, int *bid, str *param){	BAT *b, *bn = NULL;	int m;	int oldid;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.setAccess", "Cannot access descriptor");	}	switch (*param[0]) {	case 'r':		m = 1;		break;	case 'a':		m = 2;		break;	case 'w':		m = 0;		break;	default:		*res = 0;		throw(MAL, "bat.setAccess", " illegal access mode");	}	/* CMDsetaccess(&bn, b, &m);*/	oldid= b->batCacheid;	bn = BATsetaccess(b, m);	if ((bn)->batCacheid == b->batCacheid) {		BBPkeepref(bn->batCacheid);	} else {		BBPreleaseref(oldid);		BBPfix(bn->batCacheid);		BBPkeepref(bn->batCacheid);	}	*res = bn->batCacheid;	return MAL_SUCCEED;}strBKCgetAccess(str *res, int *bid){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.getAccess", "Cannot access descriptor");	}	switch (BATgetaccess(b)) {	case 1:		*res = GDKstrdup("read");		break;	case 2:		*res = GDKstrdup("append");		break;	case 0:		*res = GDKstrdup("write");		break;	}	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}#line 2660 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"strBKCinfo(int *retval, int *bid){	BAT *bn = NULL, *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.getInfo", "Cannot access descriptor");	}	if (CMDinfo(&bn, b) == GDK_SUCCEED) {		*retval = bn->batCacheid;		BBPkeepref(bn->batCacheid);		BBPreleaseref(*bid);		return MAL_SUCCEED;	}	BBPreleaseref(*bid);	BBPreleaseref(b->batCacheid);	throw(MAL, "BKCinfo", "GDKerror");}#define ROUND_UP(x,y) ((y)*(((x)+(y)-1)/(y)))strBKCbatsize(lng *tot, int *bid){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL)		throw(MAL, "bat.batsize", "Cannot access descriptor");	CMDbatsize(tot,b);	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}strBKCbatsize_str(lng *tot, str batname){	int bid = BBPindex(batname);	if (bid == 0) 		throw(MAL, "BKCbatsizes", "no such bat.\n");	return BKCbatsize(tot, &bid);}#line 2705 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"strBKCisSynced(bit *ret, int *bid1, int *bid2){	BAT *b1, *b2;	if ((b1 = BATdescriptor(*bid1)) == NULL) {		throw(MAL, "bat.isSynced", "Cannot access descriptor");	}	if ((b2 = BATdescriptor(*bid2)) == NULL) {		BBPreleaseref(b1->batCacheid);		throw(MAL, "bat.isSynced", "Cannot access descriptor");	}	CMDsynced(ret, b1, b2);	BBPreleaseref(b1->batCacheid);	BBPreleaseref(b2->batCacheid);	return MAL_SUCCEED;}#line 2725 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"char *BKCsetRole(int *r, int *bid, char **hname, char **tname){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.setRole", "Cannot access descriptor");	}	if (hname == 0 || *hname == 0 || **hname == 0){		BBPreleaseref(b->batCacheid);		throw(MAL, "bat.setRole", "head name missing");	}	if (tname == 0 || *tname == 0 || **tname == 0){		BBPreleaseref(b->batCacheid);		throw(MAL, "bat.setRole", "tail name missing");	}	BATroles(b, *hname, *tname);	BBPreleaseref(b->batCacheid);	*r = 0;	return MAL_SUCCEED;}strBKCsetColumn(int *r, int *bid, str *tname){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.setColumn", "Cannot access descriptor");	}	if (tname == 0 || *tname == 0 || **tname == 0){		BBPreleaseref(b->batCacheid);		throw(MAL, "bat.setColumn", "column name missing");	}	BATroles(b, b->hident, *tname);	BBPreleaseref(b->batCacheid);	*r =0;	return MAL_SUCCEED;}strBKCsetColumns(int *r, int *bid, str *hname, str *tname){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.setColumns", "Cannot access descriptor");	}	if (hname == 0 || *hname == 0 || **hname == 0){		BBPreleaseref(b->batCacheid);		throw(MAL, "bat.setRole", "head name missing");	}	if (tname == 0 || *tname == 0 || **tname == 0){		BBPreleaseref(b->batCacheid);		throw(MAL, "bat.setRole", "tail name missing");	}	BATroles(b, *hname, *tname);	BBPreleaseref(b->batCacheid);	*r =0;	return MAL_SUCCEED;}strBKCsetName(int *r, int *bid, str *s){	BAT *b;	bit res, *rp = &res;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.setName", "Cannot access descriptor");	}	CMDrename(rp, b, *s);	BBPreleaseref(b->batCacheid);	*r = 0;	return MAL_SUCCEED;}strBKCgetBBPname(str *ret, int *bid){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.getName", "Cannot access descriptor");	}	*ret = GDKstrdup(BBPname(b->batCacheid));	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}strBKCunload(bit *res, str *input){	CMDunload(res, *input);	return MAL_SUCCEED;}strBKCisCached(int *res, int *bid){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.isCached", "Cannot access descriptor");	}	*res = 0;	BBPreleaseref(b->batCacheid);	throw(MAL, "bat.isCached", "not yet implemented");}strBKCload(int *res, str *input){	bat bid = BBPindex(*input);	*res = bid;	if (bid) {		BBPincref(bid,TRUE);		return MAL_SUCCEED;	}	throw(MAL, "bat.unload", " file name missing");}strBKChot(int *res, str *input){	(void) res;		/* fool compiler */	BBPhot(BBPindex(*input));	return MAL_SUCCEED;}strBKCcold(int *res, str *input){	(void) res;		/* fool compiler */	BBPcold(BBPindex(*input));	return MAL_SUCCEED;}strBKCcoldBAT(int *res, int *bid){	BAT *b;	(void) res;	(void) bid;		/* fool compiler */	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.isCached", "Cannot access descriptor");	}	BBPcold(b->batCacheid);	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}strBKCheat(int *res, str *input){	int bid = BBPindex(*input);	if (bid) {		*res = BBP_lastused(bid) & 0x7fffffff;	}	throw(MAL, "bat", "heat not yet implemented\n");}strBKChotBAT(int *res, int *bid){	BAT *b;	(void) res;	(void) bid;		/* fool compiler */	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.isCached", "Cannot access descriptor");	}	BBPhot(b->batCacheid);	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}strBKCsave(bit *res, str *input){	CMDsave(res, *input);	return MAL_SUCCEED;}strBKCsave2(int *r, int *bid){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.save", "Cannot access descriptor");	}	if (b && BATdirty(b))		BBPsave(b);	BBPreleaseref(b->batCacheid);	*r = 0;	return MAL_SUCCEED;}#line 2930 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"strBKCmmap(int *res, int *bid, int *bns, int *hhp, int *thp){	BAT *b, *bn = NULL;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.mmap", "Cannot access descriptor");	}	if (CMDmmap(&bn, b, bns, hhp, thp) == GDK_SUCCEED) {		*res = TRUE;		BBPreleaseref(bn->batCacheid);		BBPreleaseref(b->batCacheid);		return MAL_SUCCEED;	}	*res =FALSE;	BBPreleaseref(b->batCacheid);	throw(MAL, "bat.mmap", " failed");}strBKCmmap2(int *res, int *bid, int *bns){	return BKCmmap(res, bid, bns, bns, bns);}strBKCmadvise(int *res, int *bid, int *bns, int *hhp, int *thp){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.madvice", "Cannot access descriptor");	}	*res = BATmadvise(b, (*bns == int_nil) ? -1 : *bns, (*hhp == int_nil) ? -1 : *hhp, (*thp == int_nil) ? -1 : *thp);	BBPreleaseref(b->batCacheid);	if (*res)		throw(MAL, "bat.madvise", " failed");	return MAL_SUCCEED;}strBKCmadvise2(int *res, int *bid, int *mode){	return BKCmadvise(res, bid, mode, mode, mode);}#line 2978 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"strBKCaccbuild(int *ret, int *bid, str *acc, ptr *param){	(void) bid;	(void) acc;	(void) param;	*ret = TRUE;	throw(MAL, "Accelerator", "Obsolete functionality");}strBKCaccbuild_std(int *ret, int *bid, int *acc){	(void) bid;	(void) acc;	*ret = TRUE;	throw(MAL, "Accelerator", "Obsolete functionality");}strBKCsetHash(bit *ret, int *bid, bit *prop){	BAT *b;	(void) ret;	(void) prop;		/* fool compiler */	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.setHash", "Cannot access descriptor");	}	BAThash(b, 0);	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}strBKCsetSequenceBase(int *r, int *bid, oid *o){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.setSequenceBase", "Cannot access descriptor");	}	BATseqbase(b, *o);	*r = b->batCacheid;	BBPkeepref(b->batCacheid);	return MAL_SUCCEED;}strBKCsetSequenceBaseNil(int *r, int *bid, oid *o){	oid ov = oid_nil;	(void) o;	return BKCsetSequenceBase(r, bid, &ov);}strBKCgetSequenceBase(oid *r, int *bid){	BAT *b;	if ((b = BATdescriptor(*bid)) == NULL) {		throw(MAL, "bat.setSequenceBase", "Cannot access descriptor");	}	*r = b->hseqbase;	BBPreleaseref(b->batCacheid);	return MAL_SUCCEED;}#line 3050 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/bat5.mx"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -