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 21:13:20 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/644#discussion_r73955914
  
    --- Diff: core/sql/sqlcomp/PrivMgrPrivileges.cpp ---
    @@ -2101,17 +2093,114 @@ PrivStatus PrivMgrPrivileges::dealWithViews(
             pUsage->describe(traceMsg);
             log (__FILE__, traceMsg, i);
     
    -        retcode = dealWithViews(*pUsage, command, listOfAffectedObjects);
    -        if (retcode != STATUS_GOOD && retcode != STATUS_WARNING)
    -          return retcode;
    -      }
    -    }
    -  } 
    +#if 0
    +        // When cascade is supported, the list of down stream views must be 
    +        // included in the list of affected objects.
    +        // Also, need to understand ANSI SQL rules for propagating view privs,
    +        // that is, should down stream views be updated if it parent view
    +        // privs are changed  and the parent has WGO specified.
    +
    +        // get list of grantee ID's that have been granted privileges on the
    +        // current view.  
    +        std::set<int32_t> granteeList;
    +        if (getGranteesForViewUsage(viewUsage, granteeList) == STATUS_ERROR)
    +        {
    +          PRIVMGR_INTERNAL_ERROR("Error while getting grantees for down stream views");
    +          return STATUS_ERROR;
    +        }
    +
    +        // Call dealWithViews to see if the down stream views should be adjusted.
    +        for (std::set<int32_t>::iterator it = granteeList.begin(); it!= granteeList.end();
++it)
    +        {
    +          pUsage->granteeID = *it;
    +          retcode = dealWithViews(*pUsage, command, viewUsage.viewOwner, listOfAffectedObjects);
    +          if (retcode != STATUS_GOOD && retcode != STATUS_WARNING)
    +            return retcode;
    +        }
    +        pUsage->granteeID = viewUsage.viewOwner;
    +#endif
    +      } // updatable views 
    +    } // view privs changed
    +  } // list of view usages
       
       return STATUS_GOOD;
     }
     
     // ----------------------------------------------------------------------------
    +// method: gatherViewColUsages
    +//
    +// This method gathers the view-col <=> referenced-col usages and creates a
    +// list of ComViewColUsage's for the referenced object. Each ComViewColUsage 
    +// is identified the view column number, and the related UID and column number 
    +// of the referenced object.
    +//
    +// parameters:
    +//   objectRef - description of the referenced object 
    +//   viewUsage - description of the view
    +//   viewColUsages - list of view column, referenced column usages
    +//
    +// Returns: PrivStatus                                               
    +//                                                                    
    +// STATUS_GOOD: Operation successful
    +//           *: Unable to gather usages, see diags.     
    +//                                                                 
    +// ----------------------------------------------------------------------------
    +PrivStatus PrivMgrPrivileges::gatherViewColUsages(
    +  ObjectReference *objectRef,
    +  ViewUsage &viewUsage,
    +  std::vector<ComViewColUsage> &viewColUsages)
    +{
    +  std::string traceMsg;
    +  PrivStatus retcode;
    +
    +  PrivMgrMDAdmin admin(trafMetadataLocation_, metadataLocation_, pDiags_);
    +
    +  // Get columns for referenced object if they are  not already present
    +  if (objectRef->columnReferences == NULL)
    +  {
    +    retcode = admin.getColumnReferences(objectRef);
    +    if (objectRef->columnReferences)
    +    {
    +      traceMsg += "getting column references: number references found ";
    +      traceMsg += to_string((long long int)objectRef->columnReferences->size());
    +    }
    +    traceMsg += ", retcode is ";
    +    traceMsg += privStatusEnumToLit(retcode);
    +    log (__FILE__, traceMsg, -1);
    +    if (retcode == STATUS_ERROR)
    +      return retcode;
    +  }
    +
    +  // Extract view <=> object column relationship from the TEXT table 
    +  // and add it to the viewUsage
    +  if (viewUsage.viewColUsagesStr.empty())
    +  {
    +    retcode = admin.getViewColUsages(viewUsage);
    +    traceMsg += "getting view column usages";
    --- End diff --
    
    Do you want "=" here instead of "+="? (With "+=" you will be repeating the traceMsg info
that you already logged above.


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