trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DaveBirdsall <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #889: [TRAFODION-2408] Changes to support "...
Date Tue, 03 Jan 2017 18:26:06 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/889#discussion_r94451157
  
    --- Diff: core/sql/clitest/blobtest.cpp ---
    @@ -267,3 +267,107 @@ Int32 updateAppendBufferToLob(CliGlobals *cliglob, char *tableName,
char *column
       return retcode;
     
     }
    +
    +
    +Int32 updateBufferToLobHandle(CliGlobals *cliglob,char *handle)
    +{
    +  Int32 retcode = 0;
    +  ExeCliInterface cliInterface((cliglob->currContext())->exHeap(), (Int32)SQLCHARSETCODE_UTF8,
cliglob->currContext(),NULL);
    +  // update lob data into via a buffer.
    +  char * query = new char [500];
    +  
    + 
    +  char statusBuf[200] = {'\0'};
    +  Int32 statusBufLen = 0;
    +  Int64 lobUpdateLen = 10;
    +  char *lobDataBuf = new char[lobUpdateLen];
    +  memcpy(lobDataBuf, "zzzzzzzzzzzzzzzzzzzz",20);
    +  str_sprintf(query,"update lob (LOB '%s' , LOCATION %Ld, SIZE %Ld)", handle, (Int64)lobDataBuf,
lobUpdateLen);
    + 
    + 
    +  retcode = cliInterface.executeImmediate(query);
    +  if (retcode <0)
    +    {
    +      cliInterface.executeImmediate("rollback work");
    +      delete query;
    +      delete lobDataBuf;
    +      return retcode;
    +    }
    +
    +  retcode = cliInterface.executeImmediate("commit work");
    +  delete query;
    +  delete lobDataBuf;
    +    
    +
    +  return retcode;
    +
    +}
    +
    +Int32 updateAppendBufferToLobHandle(CliGlobals *cliglob,char *handle)
    +{
    +  Int32 retcode = 0;
    +  ExeCliInterface cliInterface((cliglob->currContext())->exHeap(), (Int32)SQLCHARSETCODE_UTF8,
cliglob->currContext(),NULL);
    +  // update lob data into via a buffer.
    +  char * query = new char [500];
    +  
    + 
    +  char statusBuf[200] = {'\0'};
    +  Int32 statusBufLen = 0;
    +  Int64 lobUpdateLen = 10;
    +  char *lobDataBuf = new char[lobUpdateLen];
    +  memcpy(lobDataBuf, "zzzzzzzzzzzzzzzzzzzz",20);
    +  str_sprintf(query,"update lob (LOB '%s' , LOCATION %Ld, SIZE %Ld,append )", handle,
(Int64)lobDataBuf, lobUpdateLen);
    + 
    + 
    +  retcode = cliInterface.executeImmediate(query);
    +  if (retcode <0)
    +    {
    +      cliInterface.executeImmediate("rollback work");
    +      delete query;
    +      delete lobDataBuf;
    +      return retcode;
    +    }
    +
    +  retcode = cliInterface.executeImmediate("commit work");
    +  delete query;
    +  delete lobDataBuf;
    +    
    +
    +  return retcode;
    +
    +}
    +
    +
    +Int32 updateTruncateLobHandle(CliGlobals *cliglob,char *handle)
    +{
    +  Int32 retcode = 0;
    +  ExeCliInterface cliInterface((cliglob->currContext())->exHeap(), (Int32)SQLCHARSETCODE_UTF8,
cliglob->currContext(),NULL);
    +  // update lob data into via a buffer.
    +  char * query = new char [500];
    +  
    + 
    +  char statusBuf[200] = {'\0'};
    +  Int32 statusBufLen = 0;
    +  Int64 lobUpdateLen = 10;
    +  char *lobDataBuf = new char[lobUpdateLen];
    +  memcpy(lobDataBuf, "zzzzzzzzzzzzzzzzzzzz",20);
    --- End diff --
    
    Buffer overrun


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message