Github user robertamarton commented on a diff in the pull request:

    
https://github.com/apache/incubator-trafodion/pull/1288#discussion_r148654665
  
    --- Diff: core/sql/sqlcomp/CmpSeabaseDDLtable.cpp ---
    @@ -12940,6 +12940,142 @@ TrafDesc 
*CmpSeabaseDDL::getSeabaseRoutineDescInternal(const NAString &catName,
     }
     
     
    +short CmpSeabaseDDL::getSeabaseObjectComment(Int64 object_uid, 
    +                                                    enum ComObjectType 
object_type, 
    +                                                    
ComTdbVirtObjCommentInfo * & comment_info)
    +{
    +  Lng32 retcode = 0;
    +  Lng32 cliRC = 0;
    +
    +  char query[4000];
    +
    +  comment_info = NULL;
    +
    +
    +  ExeCliInterface cliInterface(STMTHEAP, 
    +                               NULL, NULL, 
    +                               
CmpCommon::context()->sqlSession()->getParentQid());
    +
    +  //get object comment
    +  str_sprintf(query, "select comment from %s.\"%s\".%s where object_uid = 
%ld and object_type = '%s' and comment <> '' ;",
    +              getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_OBJECTS,
    +              object_uid, comObjectTypeLit(object_type));
    +
    +  Queue * objQueue = NULL;
    +  cliRC = cliInterface.fetchAllRows(objQueue, query, 0, FALSE, FALSE, 
TRUE);
    +  if (cliRC < 0)
    +    {
    +      cliInterface.retrieveSQLDiagnostics(CmpCommon::diags());
    +      processReturn();
    +      return -1;
    +    }
    +
    +  if (objQueue->numEntries() == 1)
    +    {
    +      objQueue->position();
    +      
    +      OutputInfo * vi = (OutputInfo*)objQueue->getNext(); 
    +
    +      comment_info = new(STMTHEAP) ComTdbVirtObjCommentInfo[1];
    +      comment_info->objectUid = object_uid;
    +      comment_info->numColumnComment = 0;
    +      comment_info->columnCommentArray = NULL;
    +      comment_info->numIndexComment = 0;
    +      comment_info->indexCommentArray = NULL;
    +      comment_info->objectComment = (char*)vi->get(0);
    +    }
    +  else
    +    {
    +      return -1;
    --- End diff --
    
    Should there be an error placed in ComDiags area?   It looks like all the 
consumers just ignore the error and base their decision on the comment_info 
variable.  Earlier, after the select request, an error is placed in ComDiags.


---

Reply via email to