コード例 #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
ファイル: OW_WQLCompile.cpp プロジェクト: kkaempf/openwbem
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();
}