DaveBirdsall commented on a change in pull request #1857: [TRAFODION-3327] LOB
support in T2 driver
URL: https://github.com/apache/trafodion/pull/1857#discussion_r330703710
##########
File path: core/conn/jdbc_type2/native/SrvrOthers.cpp
##########
@@ -1529,3 +1529,127 @@ odbc_SQLSvc_CloseUsingLabel_sme_(
}
FUNCTION_RETURN_VOID((NULL));
}
+
+extern "C" void
+odbc_SQLSrvr_ExtractLob_sme_(
+ /* In */ void *objtag_
+ , /* In */ const CEE_handle_def *call_id_
+ , /* Out */ odbc_SQLsrvr_ExtractLob_exc_ *exception_
+ , /* In */ long dialogueId
+ , /* In */ IDL_short extractLobAPI
+ , /* In */ IDL_string lobHandle
+ , /* In */ IDL_long_long &lobLength
+ , /* Out */ IDL_long_long &extractLen
+ , /* Out */ BYTE *& extractData
+ )
+{
+ char lobExtractQuery[1000] = {0};
+ long sqlcode;
+ SRVR_STMT_HDL *QryLobExtractSrvrStmt = NULL;
+
+ if ((QryLobExtractSrvrStmt = createSrvrStmt(dialogueId,
"MXOSRVR_EXTRACTLOB", &sqlcode,
+ NULL, 0, 0, TYPE_UNKNOWN, false,false)) == NULL)
+ {
+ exception_->exception_nr = odbc_SQLSvc_ExtractLob_SQLInvalidhandle_exn_;
+ return;
+ }
+ switch (extractLobAPI) {
+ case 0:
+ snprintf(lobExtractQuery, sizeof(lobExtractQuery), "EXTRACT
LOBLENGTH(LOB'%s') LOCATION %llu", lobHandle, (Int64)&lobLength);
Review comment:
Is there a maximum size on strlen(lobHandle)? If not, then long lobHandle
values (on the order of 980 characters or so) will cause truncation of
lobExtractQuery, resulting in a SQL error. One way to work around this is to
use a dynamic array size when declaring the lobExtractQuery array, so we can
guarantee enough space.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services