Пример #1
0
void CMPI_Wql2Dnf::compile(const WQLSelectStatement * wqs)
{
    PEG_METHOD_ENTER(TRC_CMPIPROVIDERINTERFACE, "CMPI_Wql2Dnf::compile()");
    if( !wqs->hasWhereClause() )
    {
        PEG_METHOD_EXIT();
        return;
    }
    _tableau.clear();

    _buildEvalHeap(wqs);
    _pushNOTDown();
    _factoring();

    Array<CMPI_stack_el> disj;
    _gatherDisj(disj);
    if( disj.size() == 0 )
    {
        if( terminal_heap.size() > 0 )
        {
            // point to the remaining terminal element
            disj.append(CMPI_stack_el(0,true));
        }
    }

    for( Uint32 i=0, n =disj.size(); i< n; i++ )
    {
        TableauRow_WQL tr;
        Array<CMPI_stack_el> conj;

        if( !disj[i].is_terminal )
        {
            _gatherConj(conj, disj[i]);
            for( Uint32 j=0, m = conj.size(); j < m; j++ )
            {
                addIfNotExists(tr,terminal_heap[conj[j].opn]);
//               tr.append(terminal_heap[conj[j].opn]);
            }
        }
        else
        {
            addIfNotExists(tr,terminal_heap[disj[i].opn]);
//          tr.append(terminal_heap[disj[i].opn]);
        }
        _tableau.append(tr);
    }

    eval_heap.clear();

    _populateTableau();
    PEG_METHOD_EXIT();
}
Пример #2
0
/*
void Cql2Dnf::compile(CQLSelectStatement * cqs){
	CQLPredicate topLevel = cqs->getPredicate();
	compile(topLevel);
}
*/
void Cql2Dnf::compile(CQLPredicate& topLevel)
{
	PEG_METHOD_ENTER(TRC_CQL, "Cql2Dnf::compile");

    _strip_ops_operands(topLevel);
    _buildEvalHeap();
    _pushNOTDown();
    _factoring();
    _construct();
    eval_heap.clear();

	PEG_METHOD_EXIT();
}
Пример #3
0
void WQLCompile::compile(const WQLSelectStatement * wqs)
{
	if (!wqs->hasWhereClause())	
	{
		return;
	}
	_tableau.clear();
	_buildEvalHeap(wqs);
	_pushNOTDown();
	_factoring();
	Array<stack_el> disj;
	_gatherDisj(disj);
	if (disj.size() == 0)
	{
		if (terminal_heap.size() > 0)
		{
			// point to the remaining terminal element
			disj.append(stack_el(0, TERMINAL_HEAP));
		}
	}

	for (UInt32 i=0, n =disj.size(); i< n; i++)
	{
		TableauRow tr;
		Array<stack_el> conj;
		if (disj[i].type == EVAL_HEAP)
		{
			_gatherConj(conj, disj[i]);
			for ( UInt32 j=0, m = conj.size(); j < m; j++)
			{
				tr.append(terminal_heap[conj[j].opn]);
			}
		}
		else
		{
			tr.append(terminal_heap[disj[i].opn]);
		}
		_tableau.append(tr);
	}
	eval_heap.clear();
	//printTableau();
	_sortTableau();
}