Review comments incorporated
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/53a64734 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/53a64734 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/53a64734 Branch: refs/heads/master Commit: 53a647345f85db005c5b0d39d8531748ad546ee5 Parents: 13f897e Author: Sandhya Sundaresan <sand...@apache.org> Authored: Wed Jan 6 16:50:24 2016 +0000 Committer: Sandhya Sundaresan <sand...@apache.org> Committed: Wed Jan 6 16:50:24 2016 +0000 ---------------------------------------------------------------------- core/sql/clitest/blobtest.cpp | 24 +++++++-- core/sql/comexe/ComTdbExeUtil.cpp | 10 +--- core/sql/executor/ExExeUtilCli.cpp | 69 -------------------------- core/sql/executor/ExExeUtilCli.h | 6 +-- core/sql/executor/ExExeUtilLoad.cpp | 53 ++++++++++---------- core/sql/nskgmake/clitestdriver/Makefile~ | 35 ------------- 6 files changed, 48 insertions(+), 149 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53a64734/core/sql/clitest/blobtest.cpp ---------------------------------------------------------------------- diff --git a/core/sql/clitest/blobtest.cpp b/core/sql/clitest/blobtest.cpp index bd787f5..5bcba01 100644 --- a/core/sql/clitest/blobtest.cpp +++ b/core/sql/clitest/blobtest.cpp @@ -63,8 +63,6 @@ Int32 extractLobHandle(CliGlobals *cliglob, char *& lobHandle, retcode = cliInterface.executeImmediate(query,lobHandle,&lobHandleLen,FALSE); - if (retcode) - return retcode; lobHandle[lobHandleLen]='\0'; delete query; @@ -182,7 +180,13 @@ Int32 insertBufferToLob(CliGlobals *cliglob, char *tableName) retcode = cliInterface.executeImmediate(query); if (retcode <0) - return retcode; + { + cliInterface.executeImmediate("rollback work"); + delete query; + delete lobDataBuf; + + return retcode; + } retcode = cliInterface.executeImmediate("commit work"); delete query; @@ -212,7 +216,12 @@ Int32 updateBufferToLob(CliGlobals *cliglob, char *tableName, char *columnName) retcode = cliInterface.executeImmediate(query); if (retcode <0) - return retcode; + { + cliInterface.executeImmediate("rollback work"); + delete query; + delete lobDataBuf; + return retcode; + } retcode = cliInterface.executeImmediate("commit work"); delete query; @@ -243,7 +252,12 @@ Int32 updateAppendBufferToLob(CliGlobals *cliglob, char *tableName, char *column retcode = cliInterface.executeImmediate(query); if (retcode <0) - return retcode; + { + cliInterface.executeImmediate("rollback work"); + delete query; + delete lobDataBuf; + return retcode; + } retcode = cliInterface.executeImmediate("commit work"); delete query; http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53a64734/core/sql/comexe/ComTdbExeUtil.cpp ---------------------------------------------------------------------- diff --git a/core/sql/comexe/ComTdbExeUtil.cpp b/core/sql/comexe/ComTdbExeUtil.cpp index 53661a4..b1bc62a 100644 --- a/core/sql/comexe/ComTdbExeUtil.cpp +++ b/core/sql/comexe/ComTdbExeUtil.cpp @@ -2245,15 +2245,7 @@ ComTdbExeUtilLobExtract::ComTdbExeUtilLobExtract flags_(0) { setNodeType(ComTdb::ex_LOB_EXTRACT); - if ((toType_ == ExtractToType::TO_BUFFER_) || (toType_ == ExtractToType::TO_STRING_)) - { - /*// intparam1 contains the rowsize passed in via syntax - // intparam2 constains the total buf size user has allocated - rowSize_ = intParam1; - bufSize_ = intParam2; */ - - } - else if (toType_ == ExtractToType::TO_FILE_) + if (toType_ == ExtractToType::TO_FILE_) { // extractSize_ is irrelevant since the whole lob will be read into the output file // bufAddr_ is not passed in by user. It is a CQD value LOB_OUTPUT_SIZE http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53a64734/core/sql/executor/ExExeUtilCli.cpp ---------------------------------------------------------------------- diff --git a/core/sql/executor/ExExeUtilCli.cpp b/core/sql/executor/ExExeUtilCli.cpp index b42715f..451d884 100644 --- a/core/sql/executor/ExExeUtilCli.cpp +++ b/core/sql/executor/ExExeUtilCli.cpp @@ -1053,76 +1053,7 @@ Lng32 ExeCliInterface::executeImmediateExec(const char * stmtStr, } -Lng32 ExeCliInterface::executeImmediateExecNoDealloc(const char * stmtStr, - char * outputBuf, - Lng32 * outputBufLen, - NABoolean nullTerminate, - Int64 * rowsAffected - ) -{ - Lng32 retcode = 0; - - retcode = exec(); - if (retcode < 0) - { - deallocStuff(module_, stmt_, sql_src_, input_desc_, output_desc_); - return retcode; - } - - retcode = fetch(); - if (retcode < 0) - { - deallocStuff(module_, stmt_, sql_src_, input_desc_, output_desc_); - return retcode; - } - - if ((outputBuf) && - (outputBufLen)) - { - *outputBufLen = 0; - if (retcode != 100) - { - char * ptr; - Lng32 len; - getPtrAndLen(1, ptr, len); - - str_cpy_all(outputBuf, ptr, len); - - if (nullTerminate) - outputBuf[len] = 0; - *outputBufLen = len; - } - } - - Lng32 cliRetcode = -1; - if (retcode >= 0) - { - cliRetcode = retcode; - if (rowsAffected) - { - Int64 tmpRowsAffected = 0; - retcode = SQL_EXEC_GetDiagnosticsStmtInfo2(NULL, SQLDIAG_ROW_COUNT, - &tmpRowsAffected, NULL, - 0, NULL); - if(retcode == EXE_NUMERIC_OVERFLOW) - { - GetRowsAffected(rowsAffected); - } - else - *rowsAffected = tmpRowsAffected; - } - } - - clearGlobalDiags(); - - retcode = close(); - - /*deallocStuff(module_, stmt_, sql_src_, input_desc_, output_desc_); - - clearGlobalDiags();*/ - return ((cliRetcode != -1) ? cliRetcode : retcode); -} Lng32 ExeCliInterface::executeImmediate(const char * stmtStr, char * outputBuf, Lng32 * outputBufLen, http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53a64734/core/sql/executor/ExExeUtilCli.h ---------------------------------------------------------------------- diff --git a/core/sql/executor/ExExeUtilCli.h b/core/sql/executor/ExExeUtilCli.h index b94c61b..13feebe 100644 --- a/core/sql/executor/ExExeUtilCli.h +++ b/core/sql/executor/ExExeUtilCli.h @@ -100,11 +100,7 @@ private: Lng32 * outputBufLen = NULL, NABoolean nullTerminate = TRUE, Int64 * rowsAffected = NULL); - Lng32 executeImmediateExecNoDealloc(const char * stmt, - char * outputBuf = NULL, - Lng32 * outputBufLen = NULL, - NABoolean nullTerminate = TRUE, - Int64 * rowsAffected = NULL); + Lng32 prepare(const char * stmtStr, SQLMODULE_ID * module, SQLSTMT_ID * stmt, http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53a64734/core/sql/executor/ExExeUtilLoad.cpp ---------------------------------------------------------------------- diff --git a/core/sql/executor/ExExeUtilLoad.cpp b/core/sql/executor/ExExeUtilLoad.cpp index aa509ec..1db4bee 100644 --- a/core/sql/executor/ExExeUtilLoad.cpp +++ b/core/sql/executor/ExExeUtilLoad.cpp @@ -2895,7 +2895,19 @@ short ExExeUtilLobExtractTcb::work() else if ((lobTdb().getToType() == ComTdbExeUtilLobExtract::RETRIEVE_LENGTH_) || (lobTdb().getToType() == ComTdbExeUtilLobExtract::TO_FILE_)) step_ = RETRIEVE_LOB_LENGTH_; - + else + { + // invalid "toType" + ex_queue_entry * up_entry = qparent_.up->getTailEntry(); + ComDiagsArea * da = up_entry->getDiagsArea(); + ExRaiseSqlError(getMyHeap(), + &da, + (ExeErrorCode)(EXE_INTERNAL_ERROR)); + step_ = CANCEL_; + + break; + + } break; } case RETRIEVE_LOB_LENGTH_ : @@ -3128,8 +3140,7 @@ short ExExeUtilLobExtractTcb::work() remainingBytes_ = (Lng32)lobDataOutputLen; currPos_ = 0; - /*if (lobTdb().getToType() == ComTdbExeUtilLobExtract::TO_FILE_) - step_ = INSERT_FROM_STRING_;*/ + if (lobTdb().getToType() == ComTdbExeUtilLobExtract::TO_BUFFER_) { str_sprintf(statusString_," Success: LOB data length returned : %d", lobDataOutputLen); @@ -3138,6 +3149,19 @@ short ExExeUtilLobExtractTcb::work() memcpy((char *)lobTdb().dataExtractSizeIOAddr(), (char *)&lobDataOutputLen,sizeof(Int64)); step_ = RETURN_STATUS_; } + else + { + // No other "toType" shoudl reach here - i.e TO_FILE_ or TO_STRING + ex_queue_entry * up_entry = qparent_.up->getTailEntry(); + ComDiagsArea * da = up_entry->getDiagsArea(); + ExRaiseSqlError(getMyHeap(), + &da, + (ExeErrorCode)(EXE_INTERNAL_ERROR)); + step_ = CANCEL_; + + break; + + } } break; @@ -3491,29 +3515,6 @@ short ExExeUtilFileExtractTcb::work() } break; - - /*case RETURN_STRING_: - { - if (qparent_.up->isFull()) - return WORK_OK; - - Lng32 size = MINOF((Lng32)lobTdb().dataExtractSizeIOAddr(), (Lng32)remainingBytes_); - - // eval expression to convert lob data to sql row. - // TBD. - - moveRowToUpQueue(&lobData_[currPos_], size); - - remainingBytes_ -= size; - currPos_ += size; - - if (remainingBytes_ <= 0) - step_ = READ_CURSOR_; - - return WORK_RESCHEDULE_AND_RETURN; - } - break;*/ - case HANDLE_ERROR_: { retcode = handleError(); http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53a64734/core/sql/nskgmake/clitestdriver/Makefile~ ---------------------------------------------------------------------- diff --git a/core/sql/nskgmake/clitestdriver/Makefile~ b/core/sql/nskgmake/clitestdriver/Makefile~ deleted file mode 100755 index 767ebdc..0000000 --- a/core/sql/nskgmake/clitestdriver/Makefile~ +++ /dev/null @@ -1,35 +0,0 @@ -####################################################################### -# @@@ START COPYRIGHT @@@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# @@@ END COPYRIGHT @@@ -####################################################################### - -CPPSRC := SqlciMain.cpp \ - MxciEHCallBack.cpp - -EARLY_DLLS:= -ljsig - -DEP_LIBS += tdm_sqlcli sqlcilib arkcmp_dll - -CPPSRC += vprocsqlci.cpp - - -SRCPATH := sqlci bin -