trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traflm <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #684: [TRAFODION-1676] rework, fix executor...
Date Fri, 02 Sep 2016 00:24:23 GMT
Github user traflm commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/684#discussion_r77277081
  
    --- Diff: core/sql/exp/exp_datetime.cpp ---
    @@ -92,6 +92,30 @@ copyDatetimeFields(rec_datetime_field startField,
                        Lng32 dstLen,
                        NABoolean *roundedDownFlag);
     
    +// Helper function to format extra error message text and report error
    +// srcData is not null terminated, so need a buffer copy to build a C-style string
    +// 
    +static void 
    +raiseDateConvErrorWithSrcData(int srcLen, ComDiagsArea** diagsArea, char *srcData, CollHeap
*heap)
    +{
    +    char errstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
    +    memset(errstr, 0 , sizeof(errstr) );
    +    if(srcLen > MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN -1 )
    +      srcLen = MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN -1;
    +    strncpy(errstr, srcData, srcLen);
    +    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,errstr);
    +}
    +
    +// Helper function to format extra error message text and report error
    +// 
    +static void 
    +raiseDateConvErrorWithSrcDataNumeric(ComDiagsArea** diagsArea, long srcData, CollHeap
*heap)
    +{
    +   char errstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
    +   memset(errstr, 0 , sizeof(errstr) );
    +   sprintf(errstr,"%ld",srcData);
    --- End diff --
    
    thanks Hans, Anoop, this is very good guidance, I will use these functions instead of
C functions now and in the future.
    In fact, there are a lot of Trafodion's own underlying libraries, such as C-style string
manipulation like above, and C++-style lib like NAString...
    However, there is no description about them, so it is rather difficult for new Trafodion
engineer to use them, I will track down them as much as I learned during the process, and
add into wiki page, people can enhance it one by one.
    Or maybe there is such a reference that I missed.


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