Beispiel #1
0
// test Index
void PrintIndex(int blockId, BaseNode *p){
	int i;
	int pb;
//	BaseNode *p;
	queue<int> que;

	//pb = GetRootBlockId(indexId);
	pb = blockId;
	p = (BaseNode *)GetBlock(pb);
	if(pb == -1){
		cout << "Empty index" << '\n' << endl;
		return;
	}

	cout << "Key length: " << p->keyLen
		<< "\tKey type: " << p->type
		<< "\tKey offset: " << p->KeyOffset
		<< "\tTuple length: " << p->TupleLen
		<< endl;

	que.push(pb);
	while(!que.empty()){
		pb = que.front();
		que.pop();
		p = (BaseNode *)GetBlock(pb);
		if(p->isLeaf)
			PrintLeaf(p);
		else{
			PrintNonleaf(p);
			for(i = 0; i < p->num; i++)
				que.push(DataToPointer(p->Pointer(i)));
		}
	}
}
Beispiel #2
0
void dbc::PrintSyntaxTree(LeafPtr SyntaxTree, const char* Side, uint64 Deep)
{
	if (SyntaxTree != nullptr)
	{
		for (size_t index = 0; index < Deep; ++index)
		{
			printf("    ");
		}
		printf("%s ", Side);
		PrintLeaf(SyntaxTree);
		PrintSyntaxTree(SyntaxTree->Left, "L => ", Deep + 1);
		PrintSyntaxTree(SyntaxTree->Right, "R => ", Deep + 1);
	}
}