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 #1288: New COMMENT-ON SQL statement
Date Thu, 02 Nov 2017 20:45:32 GMT
Github user robertamarton commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/1288#discussion_r148654633
  
    --- 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];
    --- End diff --
    
    You allocate space here.  Who is responsible for deleting it?


---

Mime
View raw message