trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DaveBirdsall <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #644: Trafodion 1788
Date Mon, 08 Aug 2016 20:52:29 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/644#discussion_r73952091
  
    --- Diff: core/sql/sqlcomp/CmpSeabaseDDLview.cpp ---
    @@ -247,6 +249,65 @@ short CmpSeabaseDDL::buildViewColInfo(StmtDDLCreateView * createViewParseNode,
       return 0;
     }
     
    +// Build view column usages -> relate view-col <=> referenced-col
    +// This relationship is a string of values that gets stored in the TEXT table
    +short CmpSeabaseDDL::buildViewTblColUsage(const StmtDDLCreateView * createViewParseNode,
    +                                          const ComTdbVirtTableColumnInfo * colInfoArray,
    +                                          const Int64 objUID, NAString &viewColUsageText)
    +{
    +  const ParViewUsages &vu = createViewParseNode->getViewUsages();
    +  const ParViewColTableColsUsageList &vctcul = vu.getViewColTableColsUsageList();
    +  BindWA bindWA(ActiveSchemaDB(),CmpCommon::context(),FALSE/*inDDL*/);
    +
    +  for (size_t i = 0; i < vctcul.entries(); i++)
    +  {
    +     const ParViewColTableColsUsage &vctcu = vctcul[i];
    +     int32_t usingColNum = vctcu.getUsingViewColumnNumber();
    +
    +     // Get column name for view
    +     const ComTdbVirtTableColumnInfo * colInfo = &colInfoArray[usingColNum];
    +
    +     // Get column number for referenced table
    +     const ColRefName &usedColRef = vctcu.getUsedObjectColumnName();
    +     ComObjectName usedObjName;
    +     usedObjName = usedColRef.getCorrNameObj().getQualifiedNameObj().
    +                   getQualifiedNameAsAnsiString();
    +
    +     const NAString catalogNamePart = usedObjName.getCatalogNamePartAsAnsiString();
    +     const NAString schemaNamePart = usedObjName.getSchemaNamePartAsAnsiString(TRUE);
    +     const NAString objectNamePart = usedObjName.getObjectNamePartAsAnsiString(TRUE);
    +     CorrName cn(objectNamePart,STMTHEAP,schemaNamePart,catalogNamePart);
    +
    +     NATable *naTable = bindWA.getNATable(cn);
    +     if (naTable == NULL)
    +     {
    +        SEABASEDDL_INTERNAL_ERROR("Bad NATable pointer in createSeabaseView");
    +        return -1;
    +     }
    +
    +     const NAColumnArray &nacolArr = naTable->getNAColumnArray();
    +     ComString usedObjColName(usedColRef.getColName());
    +     const NAColumn * naCol = nacolArr.getColumn(usedObjColName);
    +     if (naCol == NULL)
    +     {
    +       *CmpCommon::diags() << DgSqlCode(-CAT_COLUMN_DOES_NOT_EXIST_ERROR)
    +                           << DgColumnName(usedObjColName);
    +        return -1;
    +     }
    +
    +     ComViewColUsage colUsage;
    --- End diff --
    
    Just curious: Why did you choose to set all the members using setter members rather than
simply having a constructor do it all?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message