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: Support for [TRAFODION-1891] and...
Date Tue, 19 Apr 2016 22:54:09 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/438#discussion_r60326304
  
    --- Diff: core/sql/executor/ExExeUtilGet.cpp ---
    @@ -6116,4 +6116,588 @@ short ExExeUtilRegionStatsFormatTcb::work()
       return WORK_OK;
     }
     
    +
    +///////////////////////////////////////////////////////////////////
    +ex_tcb * ExExeUtilLobInfoTdb::build(ex_globals * glob)
    +{
    +
    +  if (isTableFormat())
    +    {
    +      ExExeUtilLobInfoTableTcb *exe_util_tcb = new(glob->getSpace()) ExExeUtilLobInfoTableTcb(*this,glob);
    +      exe_util_tcb->registerSubtasks();
    +
    +      return (exe_util_tcb);
    +    }
    +  else
    +    {
    +
    +
    +    ExExeUtilLobInfoTcb *exe_util_tcb = new(glob->getSpace()) ExExeUtilLobInfoTcb(*this,
glob);
    +    exe_util_tcb->registerSubtasks();
    +
    +    return (exe_util_tcb);
    +    }
    + 
    +}
    +
    +////////////////////////////////////////////////////////////////
    +// Constructor for class ExExeUtilLobInfoTcb
    +///////////////////////////////////////////////////////////////
    +ExExeUtilLobInfoTcb::ExExeUtilLobInfoTcb(
    +     const ComTdbExeUtilLobInfo & exe_util_tdb,
    +     ex_globals * glob)
    +     : ExExeUtilTcb( exe_util_tdb, NULL, glob)
    +{
    +  
    +
    +  inputNameBuf_ = NULL;
    +  if (exe_util_tdb.inputExpr_)
    +    {
    +      inputNameBuf_ = new(glob->getDefaultHeap()) char[exe_util_tdb.inputRowlen_];
    +    }
    +
    +  tableName_ = new(glob->getDefaultHeap()) char[2000];
    +  currLobNum_ = 1;
    +  step_ = INITIAL_;
    +}
    +
    +ExExeUtilLobInfoTcb::~ExExeUtilLobInfoTcb()
    +{
    +  if (tableName_)
    +    NADELETEBASIC(tableName_, getGlobals()->getDefaultHeap());
    +  if(inputNameBuf_) 
    +     NADELETEBASIC(inputNameBuf_, getGlobals()->getDefaultHeap());
    + 
    +  tableName_ = NULL;
    +  inputNameBuf_ = NULL;
    +}
    +
    +short ExExeUtilLobInfoTcb::collectAndReturnLobInfo(char * tableName,Int32 currLobNum,
ContextCli *currContext)
    +{
    +  char *catName = NULL;
    +  char *schName = NULL;
    +  char *objName = NULL;
    +  Int32 offset = 0;
    +  char columnName[LOBINFO_MAX_FILE_LEN]= {'\0'};
    +  char lobLocation[LOBINFO_MAX_FILE_LEN]={'\0'};
    +  char lobDataFilePath[LOBINFO_MAX_FILE_LEN]={'\0'};
    +  Int64 lobEOD=0;
    +
    +  char buf[1000];
    --- End diff --
    
    Looks like this buffer is plenty long enough. Though I did have to hunt for LOBINFO_MAX_FILE_LEN
to be sure (it is 256). Something to consider in the future is to use an expression here involving
LOBINFO_MAX_FILE_LEN + some constant to make it easier for a reader to judge correctness.
(It also has the benefit that if you change the value of LOBINFO_MAX_FILE_LEN later, say to
1024, this code doesn't break.)


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