You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by li...@apache.org on 2016/11/17 16:19:16 UTC
[3/5] incubator-trafodion git commit: error handle in mxosrvr side
for get lob
error handle in mxosrvr side for get lob
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/dbcd4125
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/dbcd4125
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/dbcd4125
Branch: refs/heads/master
Commit: dbcd41254ee6ae8ccef1da567a36aa8aaac0f608
Parents: a4a1f1b
Author: Weiqing Xu <we...@esgyn.cn>
Authored: Thu Nov 10 12:48:24 2016 +0000
Committer: Weiqing Xu <we...@esgyn.cn>
Committed: Thu Nov 10 12:48:24 2016 +0000
----------------------------------------------------------------------
.../src/odbc/Krypton/generated_incs/odbc_sv.h | 1 +
.../nsksrvr/Interface/marshalingsrvr_srvr.cpp | 16 +++++++++++++++
.../odbc/nsksrvr/Interface/odbcs_srvr_res.cpp | 10 +++++++---
.../odbc/src/odbc/nsksrvrcore/srvrothers.cpp | 21 +++++++++++++++-----
4 files changed, 40 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/dbcd4125/core/conn/odbc/src/odbc/Krypton/generated_incs/odbc_sv.h
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/Krypton/generated_incs/odbc_sv.h b/core/conn/odbc/src/odbc/Krypton/generated_incs/odbc_sv.h
index 296d0a7..55fad48 100644
--- a/core/conn/odbc/src/odbc/Krypton/generated_incs/odbc_sv.h
+++ b/core/conn/odbc/src/odbc/Krypton/generated_incs/odbc_sv.h
@@ -3520,6 +3520,7 @@ odbc_SQLSvc_UpdateServerContext_msms_(
#define odbc_SQLsrvr_ExtractLob_InvalidConnection_exn_ 2
#define odbc_SQLSrvr_ExtractLob_SQLError_exn_ 3
#define odbc_SQLSrvr_ExtractLob_SQLInvalidhandle_exn_ 4
+#define obdc_SQLSrvr_ExtractLob_AllocLOBDataError_exn_ 5
/*
* Exception struct for
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/dbcd4125/core/conn/odbc/src/odbc/nsksrvr/Interface/marshalingsrvr_srvr.cpp
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/nsksrvr/Interface/marshalingsrvr_srvr.cpp b/core/conn/odbc/src/odbc/nsksrvr/Interface/marshalingsrvr_srvr.cpp
index 56e9148..526f8c4 100644
--- a/core/conn/odbc/src/odbc/nsksrvr/Interface/marshalingsrvr_srvr.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvr/Interface/marshalingsrvr_srvr.cpp
@@ -2311,6 +2311,7 @@ odbc_SQLsrvr_ExtractLob_param_res_(
, IDL_char * lobDataValue
)
{
+ CEE_status sts = CEE_SUCCESS;
IDL_long wlength = 0;
char* curptr;
@@ -2339,6 +2340,14 @@ odbc_SQLsrvr_ExtractLob_param_res_(
case odbc_SQLsrvr_ExtractLob_InvalidConnection_exn_:
case odbc_SQLSrvr_ExtractLob_SQLInvalidhandle_exn_:
break;
+ case obdc_SQLSrvr_ExtractLob_AllocLOBDataError_exn_:
+ wlength += sizeof(exceptionLength);
+ if (exception_->u.ParamError.ParamDesc != NULL)
+ {
+ exceptionLength = strlen(exception_->u.ParamError.ParamDesc) + 1;
+ wlength += exceptionLength;
+ }
+ break;
default:
break;
}
@@ -2355,6 +2364,10 @@ odbc_SQLsrvr_ExtractLob_param_res_(
message_length = wlength;
buffer = pnode->w_allocate(message_length);
+ if (buffer == NULL)
+ {
+ return CEE_ALLOCFAIL;
+ }
curptr = (IDL_char*)(buffer + sizeof(HEADER));
// copy odbc_SQLsrvr_ExtractLob_exc_
@@ -2364,6 +2377,7 @@ odbc_SQLsrvr_ExtractLob_param_res_(
switch(exception_->exception_nr)
{
case odbc_SQLsrvr_ExtractLob_ParamError_exn_:
+ case obdc_SQLSrvr_ExtractLob_AllocLOBDataError_exn_:
IDL_long_copy(&exceptionLength, curptr);
if (exception_->u.ParamError.ParamDesc != NULL)
IDL_charArray_copy((const IDL_char *)exception_->u.ParamError.ParamDesc, curptr);
@@ -2385,4 +2399,6 @@ odbc_SQLsrvr_ExtractLob_param_res_(
{
IDL_charArray_copy(lobDataValue, curptr);
}
+
+ return sts;
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/dbcd4125/core/conn/odbc/src/odbc/nsksrvr/Interface/odbcs_srvr_res.cpp
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/nsksrvr/Interface/odbcs_srvr_res.cpp b/core/conn/odbc/src/odbc/nsksrvr/Interface/odbcs_srvr_res.cpp
index b407973..f4ecdab 100644
--- a/core/conn/odbc/src/odbc/nsksrvr/Interface/odbcs_srvr_res.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvr/Interface/odbcs_srvr_res.cpp
@@ -661,7 +661,7 @@ odbc_SQLSrvr_ExtractLob_ts_res_(
char * buffer = NULL;
UInt32 message_length = 0;
- odbc_SQLsrvr_ExtractLob_param_res_(
+ sts = odbc_SQLsrvr_ExtractLob_param_res_(
pnode
, buffer
, message_length
@@ -670,10 +670,14 @@ odbc_SQLSrvr_ExtractLob_ts_res_(
, lobDataValue
);
- pnode->send_response(buffer, message_length, call_id_);
+ if (sts == CEE_SUCCESS)
+ sts = pnode->send_response(buffer, message_length, call_id_);
if (lobDataValue != NULL)
- delete[] lobDataValue;
+ {
+ delete [] lobDataValue;
+ lobDataValue = NULL;
+ }
return sts;
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/dbcd4125/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp b/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
index 41d6e9a..f8ca05f 100644
--- a/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
@@ -6393,7 +6393,7 @@ odbc_SQLSrvr_ExtractLob_sme_(
char RequestError[200] = {0};
SRVR_STMT_HDL *QryLobExtractSrvrStmt = NULL;
- if ((QryLobExtractSrvrStmt = getSrvrStmt("", TRUE)) == NULL)
+ if ((QryLobExtractSrvrStmt = getSrvrStmt("MXOSRVR_EXTRACRTLOB", TRUE)) == NULL)
{
SendEventMsg(MSG_MEMORY_ALLOCATION_ERROR,
EVENTLOG_ERROR_TYPE,
@@ -6411,13 +6411,12 @@ odbc_SQLSrvr_ExtractLob_sme_(
try
{
- SQL_EXEC_SetParserFlagsForExSqlComp_Internal(INTERNAL_QUERY_FROM_EXEUTIL);
-
short retcode = QryLobExtractSrvrStmt->ExecDirect(NULL, LobExtractQuery, EXTERNAL_STMT, TYPE_CALL, SQL_ASYNC_ENABLE_OFF, 0);
if (retcode == SQL_ERROR)
{
- ERROR_DESC_def *p_buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer; strncpy(RequestError, p_buffer->errorText, sizeof(RequestError) - 1);
+ ERROR_DESC_def *p_buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer;
+ strncpy(RequestError, p_buffer->errorText, sizeof(RequestError) - 1);
SendEventMsg(MSG_SQL_ERROR,
EVENTLOG_ERROR_TYPE,
@@ -6448,7 +6447,13 @@ odbc_SQLSrvr_ExtractLob_sme_(
exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_EXECDIRECT_FAILED;
}
- lobDataValue = new IDL_char(lobDataLen + 1);
+ lobDataValue = new IDL_char[lobDataLen + 1];
+ if (lobDataValue == NULL)
+ {
+ exception_->exception_nr = odbc_SQLsrvr_ExtractLob_ParamError_exn_;
+ exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_BUFFER_ALLOC_FAILED;
+ }
+
memset(lobDataValue, 0, lobDataLen + 1);
memset(LobExtractQuery, 0, sizeof(LobExtractQuery));
@@ -6493,6 +6498,12 @@ odbc_SQLSrvr_ExtractLob_sme_(
exception_->exception_nr = odbc_SQLsrvr_ExtractLob_ParamError_exn_;
exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_EXECDIRECT_FAILED;
}
+
+ if (exception_->exception_nr != 0) {
+ lobDataLen = 0;
+ delete [] lobDataValue;
+ lobDataValue = NULL;
+ }
}
}