[
https://issues.apache.org/jira/browse/TRAFODION-2308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15646851#comment-15646851
]
ASF GitHub Bot commented on TRAFODION-2308:
-------------------------------------------
Github user xwq commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/799#discussion_r86940126
--- Diff: core/conn/odbc/src/odbc/nsksrvr/Interface/marshalingsrvr_srvr.cpp
---
@@ -2300,3 +2300,89 @@ MxoSrvr_ValidateToken_param_res_(
return CEE_SUCCESS;
} // MxoSrvr_ValidateToken_param_res_()
+
+CEE_status
+odbc_SQLsrvr_ExtractLob_param_res_(
+ CInterface * pnode
+ , char* &buffer
+ , UInt32& message_length
+ , const struct odbc_SQLsrvr_ExtractLob_exc_ *exception_
+ , IDL_long_long lobDataLen
+ , IDL_char * lobDataValue
+)
+{
+ IDL_long wlength = 0;
+ char* curptr;
+
+ IDL_long exceptionLength = 0;
+ wlength += sizeof(HEADER);
+
+ // calculate length of the buffer for each parameter
+
+ // length of odbc_SQLsrvr_ExtractLob_exc_
+ wlength += sizeof(exception_->exception_nr);
+ wlength += sizeof(exception_->exception_detail);
+
+ switch(exception_->exception_nr)
+ {
+ case odbc_SQLsrvr_ExtractLob_ParamError_exn_:
+ wlength += sizeof(exceptionLength);
+ if (exception_->u.ParamError.ParamDesc != NULL)
+ {
+ exceptionLength =
strlen(exception_->u.ParamError.ParamDesc) + 1;
+ wlength += exceptionLength;
+ }
+ break;
+ case odbc_SQLSrvr_ExtractLob_SQLError_exn_:
+ ERROR_DESC_LIST_length((ERROR_DESC_LIST_def
*)&exception_->u.SQLError.errorList, wlength);
+ break;
+ case odbc_SQLsrvr_ExtractLob_InvalidConnection_exn_:
+ case odbc_SQLSrvr_ExtractLob_SQLInvalidhandle_exn_:
+ break;
+ default:
+ break;
+ }
+
+ // length of IDL_long LOB len
+ wlength += sizeof(IDL_long);
+ if (lobDataValue != NULL)
+ {
+ wlength += lobDataLen;
+ }
+ wlength += lobDataLen;
+
+ // update the length of message
+ message_length = wlength;
+
+ buffer = pnode->w_allocate(message_length);
+ curptr = (IDL_char*)(buffer + sizeof(HEADER));
+
+ // copy odbc_SQLsrvr_ExtractLob_exc_
+ IDL_long_copy((IDL_long *)&exception_->exception_nr, curptr);
+ IDL_long_copy((IDL_long *)&exception_->exception_detail, curptr);
+
+ switch(exception_->exception_nr)
+ {
+ case odbc_SQLsrvr_ExtractLob_ParamError_exn_:
+ IDL_long_copy(&exceptionLength, curptr);
+ if (exception_->u.ParamError.ParamDesc != NULL)
+ IDL_charArray_copy((const IDL_char
*)exception_->u.ParamError.ParamDesc, curptr);
+ break;
+
+ case odbc_SQLSrvr_ExtractLob_SQLError_exn_:
+ ERROR_DESC_LIST_copy((ERROR_DESC_LIST_def
*)&exception_->u.SQLError.errorList, curptr);
+ break;
+
+ case odbc_SQLsrvr_ExtractLob_InvalidConnection_exn_:
+ case odbc_SQLSrvr_ExtractLob_SQLInvalidhandle_exn_:
+ break;
+
+ default:
+ break;
+ }
+ IDL_long_copy((IDL_long *)&lobDataLen, curptr);
--- End diff --
I think the message_length was calculated that enough to put the message. I
don't know which case it will be overflow.
> JDBC T4 support read LOB
> ------------------------
>
> Key: TRAFODION-2308
> URL: https://issues.apache.org/jira/browse/TRAFODION-2308
> Project: Apache Trafodion
> Issue Type: Sub-task
> Components: client-jdbc-t4, connectivity-mxosrvr
> Reporter: Weiqing Xu
> Assignee: Weiqing Xu
>
> JDBC T4 need implement some API to support CLOB and BLOB.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)