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

    https://github.com/apache/incubator-trafodion/pull/28#discussion_r34756162
  
    --- Diff: core/conn/jdbc_type2/native/SrvrCommon.cpp ---
    @@ -2210,3 +2266,136 @@ void print_outputValueList(SQLValueList_def *oVL, 
long colCount, const char * fc
         fflush(stdout);
     }
     #endif
    +
    +// DO NOT call this function using pSrvrStmt->sqlWarningOrErrorLength and 
pSrvrStmt->sqlWarningOrError,
    +// Since the WarningOrError is static and pSrvrStmt->sqlWarningOrError 
will deallocate this memory. 
    +extern "C" void GETMXCSWARNINGORERROR(
    +          /* In    */ Int32 sqlcode
    +        , /* In    */ char *sqlState
    +        , /* In    */ char *msg_buf
    +        , /* Out   */ Int32 *MXCSWarningOrErrorLength
    +        , /* Out   */ BYTE *&MXCSWarningOrError)
    +{
    +    Int32 total_conds = 1;
    +    Int32 buf_len;
    +    Int32 curr_cond = 1;
    +    Int32 msg_buf_len = strlen(msg_buf)+1;
    +    Int32 time_and_msg_buf_len = 0;
    +    Int32 msg_total_len = 0;
    +    Int32 rowId = 0; // use this for rowset recovery.
    +    char tsqlState[6];
    +    BYTE WarningOrError[1024];
    +    char  strNow[TIMEBUFSIZE + 1];
    +    char* time_and_msg_buf = NULL;
    +
    +    memset(tsqlState,0,sizeof(tsqlState));
    +    memcpy(tsqlState,sqlState,sizeof(tsqlState)-1);
    +
    +    bzero(WarningOrError,sizeof(WarningOrError));
    +
    +    *MXCSWarningOrErrorLength = 0;
    +    MXCSWarningOrError = WarningOrError; // Size of internally generated 
message should be enough
    +
    +    *(Int32 *)(WarningOrError+msg_total_len) = total_conds;
    +    msg_total_len += sizeof(total_conds);
    +    *(Int32 *)(WarningOrError+msg_total_len) = rowId;
    +    msg_total_len += sizeof(rowId);
    +    *(Int32 *)(WarningOrError+msg_total_len) = sqlcode;
    +    msg_total_len += sizeof(sqlcode);
    +    time_and_msg_buf_len   = msg_buf_len + TIMEBUFSIZE;
    +    *(Int32 *)(WarningOrError+msg_total_len) = time_and_msg_buf_len;
    +    msg_total_len += sizeof(time_and_msg_buf_len);
    +    //Get the timetsamp
    +        time_and_msg_buf = new char[time_and_msg_buf_len];
    +    strncpy(time_and_msg_buf, msg_buf, msg_buf_len);
    +    time_t  now = time(NULL);
    +    bzero(strNow, sizeof(strNow));
    +    strftime(strNow, sizeof(strNow), " [%Y-%m-%d %H:%M:%S]", 
localtime(&now));
    +    strcat(time_and_msg_buf, strNow);
    +    memcpy(WarningOrError+msg_total_len, time_and_msg_buf, 
time_and_msg_buf_len);
    +    msg_total_len += time_and_msg_buf_len;
    +    delete time_and_msg_buf;
    +    memcpy(WarningOrError+msg_total_len, tsqlState, sizeof(tsqlState));
    +    msg_total_len += sizeof(tsqlState);
    +
    +    memcpy(MXCSWarningOrError, WarningOrError, sizeof(WarningOrError));
    +    *MXCSWarningOrErrorLength = msg_total_len;
    +    return;
    +}
    +
    +bool isUTF8(const char *str)
    +{
    +    char c;
    --- End diff --
    
    Sorry for this, this is a whole sale copy for testing purpose, will remove 
it. However, strcpyUTF8() will be needed.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to