[GitHub] incubator-trafodion pull request: [TRAFODION-37] Prepare ROLLBACK...
Github user ryzuo commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/28#discussion_r34756095 --- Diff: core/conn/jdbc_type2/native/SqlInterface.cpp --- @@ -4440,3 +4440,45 @@ void CreateModulePlan(long inputParamCount, InputDescInfo *inputDescInfo, char * } } } + +SQLRETURN COMMIT_ROWSET(long dialogueId, bool bSQLMessageSet, odbc_SQLSvc_SQLError* SQLError, Int32 currentRowCount) +{ +SQLRETURN retcode; +long sqlcode; +SQLValueList_def inValueList; +inValueList._buffer = NULL; +inValueList._length = 0; + +SRVR_STMT_HDL *CmwSrvrStmt = getInternalSrvrStmt(dialogueId, STMT_COMMIT_1, sqlcode); +/* Should process the error here if CmwSrvrStmt is NULL */ --- End diff -- For now we make sure this statement is prepared during the connection phase, MXOSRVR do it the same way without a NULL validation, I'm not sure has anyone ever met this kind of problem yet. T2 now has no mechanism to process this kind of null statement error. I'm thinking to return the error back to JAVA layer to throw an exception out, it will be included in the new rowset execute() operation code. --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: [TRAFODION-37] Prepare ROLLBACK...
Github user DaveBirdsall commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/28#discussion_r34706740 --- 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; +unsigned short byte = 1; +size_t len = strlen(str); + +for (size_t i=0; ilen; i++) +{ +c = str[i]; + +if (c = 0x00 c 0x80 byte == 1) // ascii +continue; +else if (c = 0x80 c 0xc0 byte 1) // second, third, or fourth byte of a multi-byte sequence +byte--; +else if (c == 0xc0 || c == 0xc1) // overlong encoding +return false; +else if (c = 0xc2 c 0xe0 byte == 1) // start of 2-byte sequence +byte = 2; +else if (c = 0xe0 c 0xf0 byte == 1) // start of 3-byte sequence +byte = 3; +else if (c = 0xf0 c 0xf5 byte == 1) // start of 4-byte sequence +byte = 4; +else +return false; +} +return true; +} + +char* strcpyUTF8(char *dest, const char *src, size_t destSize, size_t copySize) +{ +char c; +size_t len; + +if (copySize == 0) +len = strlen(src); +else +len = copySize; + +if (len = destSize) +len = destSize-1; // truncation + +while (len 0) +{ +c = src[len-1]; +if (c 0x80 || c 0xbf) --- End diff -- I'm not sure these comparisons will work the way you want with signed char. --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: [TRAFODION-30]dcs start fails on...
GitHub user hegdean opened a pull request: https://github.com/apache/incubator-trafodion/pull/29 [TRAFODION-30]dcs start fails on development workspaces when using install_local_hadoop Fixed the local hadoop script so servers file in $DCS_INSTALL_DIR /conf folder is generated correctly. Also took care of the default github location for DCS/REST and Phoenix tests You can merge this pull request into a Git repository by running: $ git pull https://github.com/hegdean/incubator-trafodion traf-30 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-trafodion/pull/29.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #29 commit 0fe0c4134279c3550d2100c4c79ed1982cbbe264 Author: Anuradha Hegde hegd...@dev02.trafodion.org Date: 2015-07-15T18:43:27Z [TRAFODION-30]dcs start fails on development workspaces when using install_local_hadoop Fixed the local hadoop script so servers file in $DCS_INSTALL_DIR /conf folder is generated correctly. Also took care of the default github location for DCS/REST and Phoenix tests --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-trafodion pull request: [TRAFODION-37] Prepare ROLLBACK...
Github user arvind-narain commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/28#discussion_r34718734 --- Diff: core/conn/jdbc_type2/native/CSrvrConnect.cpp --- @@ -268,10 +268,10 @@ void SRVR_CONNECT_HDL::addSrvrStmt(SRVR_STMT_HDL *pSrvrStmt,BOOL internalStmt) mapOfInternalSrvrStmt[pSrvrStmt-stmtName]= pSrvrStmt; // +++ map error } - //End of Soln. No.: 10-100202-7923 count++; +//pSrvrStmt-myKey = count; --- End diff -- Thanks for removing some unneeded comments. Is this particular one needed ? In general if it might be good to clean up the method being touched (remove sol numbers, commented out code if not needed or add more comments, remove any MFC related code etc) --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---