Пример #1
0
CorrName CmpSqlSession::getVolatileCorrName(CorrName &corrName)
{
  NAString volTabName = corrName.getQualifiedNameObj().getObjectName();
  
  CorrName newCorrName(volTabName, heap_,
		       volatileSchemaName(), volatileCatalogName(),
		       corrName.getCorrNameAsString());
  newCorrName.setSpecialType(corrName.getSpecialType());
  
  return newCorrName;
}
Пример #2
0
// Real comparison operator
//
// Are you adding an extra field to be compared here (like specialType was)?
// Then modify CorrName::isEmpty() and RETDesc.C and TableNameMap.C accordingly
// (emulate the setSpecialType() logic).
//
NABoolean CorrName::operator==(const CorrName& other) const
{
  // if two corrnames have different Partition clauses then they are different.
  // This is needed because we are caching natables for which PARTITION or LOCATION 
  // clause is specified.
  if (getPartnClause() != other.getPartnClause())
    return FALSE;

  return isEqualWithPartnClauseSkipped(other);
}
Пример #3
0
NABoolean CmpSqlSession::validateVolatileCorrName(CorrName &corrName)
{
  // make sure that if schema name was specified as part of tablename,
  // it is the current user name.
  NABoolean isValid = FALSE;
  if (NOT corrName.isVolatile())
    {
      //BYPASS_CHECK_FOR_VOLATILE_SCHEMA_NAME CQD was introduced as a workaround for problem seen in ALM case# 4764.
      if (((corrName.isSpecialTable()) && (CmpCommon::getDefault(BYPASS_CHECK_FOR_VOLATILE_SCHEMA_NAME) == DF_ON)) 
	|| 
	  validateVolatileQualifiedName(corrName.getQualifiedNameObj()))
	{
	  isValid = TRUE;
	}
    }
  else
    {
      isValid = TRUE;
    }
 
  return isValid;
}
Пример #4
0
// This method was the == operator before the partnClause was added
// Since we need to skip PartnClause when comparing corrnames that are
// contained in a ColRefName, we are placing the comparision of all
// other data members in this method. This method will be called
// by the new == operator.
NABoolean CorrName::isEqualWithPartnClauseSkipped(const CorrName& other) const
{
  if (isFabricated() ^ other.isFabricated())
    return FALSE;

  NABoolean result;
  if (!corrName_.isNull()) {
    if (!other.corrName_.isNull())
      result = corrName_ == other.corrName_;
    else {
      QualifiedName thisQual(corrName_);
      result = thisQual == other.getQualifiedNameObj();
    }
  } else if (!other.corrName_.isNull()) {
      QualifiedName otherQual(other.corrName_);
      result = getQualifiedNameObj() == otherQual;
  } else {
      result = getQualifiedNameObj() == other.getQualifiedNameObj();
  }
  //  // The names must match, and
  //  // the special types must match OR one of them must be "normal" --
  //  // thus in "delete from TABLE (RESOURCE_FORK %s) where rfsection = ?;",
  //  // unbound column "rfsection"'s corrname is initially empty/default/normal
  //  // but it will hereby compare equal to the RETDesc xcnm "rfsection" which
  //  // is marked "special/rfork type".
  //  return result && (getSpecialType() == other.getSpecialType()	||
  // 		        getSpecialType() == NORMAL_TABLE		||
  // 		        NORMAL_TABLE     == other.getSpecialType()
  //		       );
  //
  // The preceding is foolishly, overly rigorous -- it would only ever catch
  // a situation where we had two distinct special types in the same query,
  // or if we were reusing (cached) NATables across queries --
  // neither of which we are currently doing.
  // So, the names must match, and that's all!
  
  return result;
}
Пример #5
0
// -----------------------------------------------------------------------
// Constructor (but note that much more useful stuff goes on in
// static createTableDesc in BindRelExpr.C)
// -----------------------------------------------------------------------
TableDesc::TableDesc(BindWA *bindWA,
                     const NATable *table,
                     CorrName& corrName)
    : table_(table),
      indexes_(bindWA->wHeap()),
      uniqueIndexes_(bindWA->wHeap()),
      vertParts_(bindWA->wHeap()),
      hintIndexes_(bindWA->wHeap()),
      colStats_(bindWA->wHeap()),
      corrName_("",bindWA->wHeap()),
      analysis_(NULL)
{
    corrName.applyDefaults(bindWA, bindWA->getDefaultSchema());
    corrName_ = corrName ;
    selectivityHint_ = NULL;
    cardinalityHint_ = NULL;
    histogramsCompressed_ = FALSE;
    minRC_ = csOne;
    maxRC_ = COSTSCALAR_MAX;

    // Fix up the name location list to help with the computing
    // of view text, check constraint search condition text, etc.
    //
    if (corrName.getSpecialType() == ExtendedQualName::TRIGTEMP_TABLE)  // -- Triggers
        return;

    ParNameLocList *pNameLocList = bindWA->getNameLocListPtr();
    if (pNameLocList)
    {
        ParNameLoc * pNameLoc
            = pNameLocList->getNameLocPtr(corrName_.getNamePosition());
        if (pNameLoc AND pNameLoc->getExpandedName(FALSE).isNull())
        {
            pNameLoc->setExpandedName(corrName_.getQualifiedNameObj().
                                      getQualifiedNameAsAnsiString());
        }
    }
}
Пример #6
0
ULng32 hashKey(const CorrName&      name) { return name.hash(); }