예제 #1
0
//////////////////////////////////////////////////////////////////////////////
// Get all the ref constraints from this NATable, filter the ones that are to
// tables in this graph, and mark them on both tables. For example, use the
// RI on Orderes and Customers: O->C ( O is referencing C ). Because of the 
// semantics of the order of the tables in the join graph, in order for RI
// optimization to be utilized, C must appear in the graph solution AFTER O.
// The result is that C has an incoming bit for table O, and O has an 
// outgoing bit for table C.
// Other conditions that must be met for the RI to be usable:
// 1. C must have non-empty, insert only delta.
// 2. O must not be inner tables of left joins.
// 3. Each of the columns of the RI constraint must be covered by a predicate.
//    So if O(a,b) is referencing C(x,y) the join should use these two equal 
//    predicates: (O.a = C.x) AND (O.b = C.y).
// In this method, this table is O, and otherTable is C.
Lng32 MVJoinTable::markRiConstraints(BindWA *bindWA, MVInfo *mvInfo)
{
  LIST (MVUsedObjectInfo*)& usedObjects = mvInfo->getUsedObjectsList();
  if (usedObjects[tableIndex_]->isInnerTableOfLeftJoin())
    return 0;	// O must not be inner table of a left join.

  Lng32 howManyRIs=0;
  const AbstractRIConstraintList& refConstraints = 
    naTable_->getRefConstraints();

  for (CollIndex i=0; i<refConstraints.entries(); i++)
  {
    RefConstraint *const ref = (RefConstraint *const)(refConstraints[i]);
    CMPASSERT(ref->getOperatorType() == ITM_REF_CONSTRAINT);
    // Ignore self referencing RIs.
    if (ref->selfRef())
      continue;

    // Find the table the RI is referencing.
    const NAString& otherTableName = 
      ref->getOtherTableName().getQualifiedNameAsString();
    MVJoinTable *otherTable =
      mvInfo->getJoinGraph()->getTableObjectFor(&otherTableName);
    if (otherTable == NULL)
      continue;	 // The other table must be on the graph.

    if (otherTable->deltaType_ != INSERTONLY_DELTA)
      continue;  // C must be insert only.

    Lng32 otherTableIndex = otherTable->getTableIndex();

    // The RI must be covered by equal predicates on the same columns
    LIST(Lng32) myCols;
    LIST(Lng32) otherCols;
    ref->getMyKeyColumns(myCols);
    ref->getOtherTableKeyColumns(bindWA, otherCols);
    CMPASSERT(myCols.entries() == otherCols.entries());

    NABoolean matchingPredicatesExist=TRUE;
    for (CollIndex currentCol=0; currentCol<myCols.entries(); currentCol++)
    {
      if (!mvInfo->isEqPredicateBetween(naTable_->getTableName(),
					myCols[currentCol],
					ref->getOtherTableName(),
					otherCols[currentCol]))
	matchingPredicatesExist = FALSE;
    }
    if (!matchingPredicatesExist)
      continue;

    // OK - we found a qualifying RI that we can use for optimization.
    // Now mark the bits.
    markRiTo(otherTableIndex);
    otherTable->markRiFrom(getTableIndex());
    howManyRIs++;
  }
  return howManyRIs;
}	
예제 #2
0
void CWTOscillator::selectTable()
{
	m_nCurrentTableIndex = getTableIndex();

	// if the frequency is high enough, the sine table will be returned
	// even for non-sinusoidal waves; anything about 10548 Hz is one
	// harmonic only (sine)
	if(m_nCurrentTableIndex < 0)
	{
		m_pCurrentTable = &m_dSineTable[0];
		return;
	}

	// choose table
	if(m_uWaveform == SAW1 || m_uWaveform == SAW2 || m_uWaveform == SAW3 || m_uWaveform == SQUARE)
		m_pCurrentTable = m_pSawTables[m_nCurrentTableIndex];
	else if(m_uWaveform == TRI)
		m_pCurrentTable = m_pTriangleTables[m_nCurrentTableIndex];
}
예제 #3
0
void odkFormReader::createItemsTree()
{
    treeItems.clear();

    int tblindex;
    int parentindex;

    qSort(tables.begin(),tables.end(),tblComp);

    for (int pos = 0; pos <= tables.count()-1;pos++)
    {
        if (tables[pos].islookup == false)
        {
            if (tables[pos].xmlCode != "NONE")
            {
                //qDebug() << "Table:" + tables[pos].name;
                if (tables[pos].parentTable == "NULL")
                {
                    tblindex = insertNodes(-1,tables[pos].name,tables[pos].name,tables[pos].xmlCode);
                    //qDebug() << tables[pos].xmlCode;
                    tables[pos].parentIndex = tblindex;
                }
                else
                {
                    //qDebug() << "Parent:" + tables[pos].parentTable;
                    parentindex = getTableIndex(tables[pos].parentTable);
                    //qDebug() << "Parent index:" + QString::number(parentindex);

                    tblindex = insertNodes(parentindex,tables[pos].name,tables[pos].name,tables[pos].xmlCode);
                    tables[pos].parentIndex = tblindex;
                }
            }
        }
    }

}