trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertamarton <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #644: Trafodion 1788
Date Tue, 09 Aug 2016 16:30:19 GMT
Github user robertamarton commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/644#discussion_r74093958
  
    --- 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 --
    
    Good suggestion to add a constructor.


---
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