You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by sa...@apache.org on 2016/01/08 20:11:29 UTC

[04/13] incubator-trafodion git commit: Changed output param for SIZE to be an input/output address.

Changed output param for SIZE to be an input/output address.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/781682af
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/781682af
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/781682af

Branch: refs/heads/master
Commit: 781682afe4ee662e06e9e9da6b0753e4f3d9d673
Parents: 353e1f3
Author: Sandhya Sundaresan <sa...@apache.org>
Authored: Fri Dec 11 19:25:39 2015 +0000
Committer: Sandhya Sundaresan <sa...@apache.org>
Committed: Fri Dec 11 19:25:39 2015 +0000

----------------------------------------------------------------------
 core/sql/bin/clitest.cpp             | 80 +++++++++++++++++++++++++++----
 core/sql/bin/vprocclitestdriver.cpp  | 51 ++++++++++++++++++++
 core/sql/clitest/blobtest.cpp        | 47 +++++++++++++++++-
 core/sql/clitest/blobtest.h          |  2 +
 core/sql/comexe/ComTdbExeUtil.cpp    |  6 +--
 core/sql/comexe/ComTdbExeUtil.h      |  6 +--
 core/sql/executor/ExExeUtilLoad.cpp  | 14 ++++--
 core/sql/generator/GenRelExeUtil.cpp |  2 +-
 core/sql/optimizer/RelExeUtil.cpp    |  2 +-
 core/sql/optimizer/RelExeUtil.h      |  6 +--
 core/sql/parser/sqlparser.y          | 25 ++--------
 11 files changed, 193 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/781682af/core/sql/bin/clitest.cpp
----------------------------------------------------------------------
diff --git a/core/sql/bin/clitest.cpp b/core/sql/bin/clitest.cpp
index e88ee9d..37baf68 100644
--- a/core/sql/bin/clitest.cpp
+++ b/core/sql/bin/clitest.cpp
@@ -75,9 +75,10 @@ int main(int argc, const char * argv[])
     {
       cout << "Error -  provide an option: " << endl;
       cout << "Usage : clitestdriver <option number>" << endl;
-      cout << "TEST            : OPTION        "<<endl;
-      cout << "--------------------------------"<<endl;
-      cout << "Blob test          1 "<< endl;
+      cout << "TEST                                OPTION        "<<endl;
+      cout << "-------------------------------------------"<<endl;
+      cout << "Blob test extract to buffer         1      "<< endl;
+      cout << "Blob test extract to file in chunks 2      "<< endl;
       return 0;
     }
   Int32 retcode = 0;
@@ -93,13 +94,69 @@ int main(int argc, const char * argv[])
   CliGlobals * cliGlob = GetCliGlobals();
   char tablename[50] = {'\0'};
   char columnname[50] = {'\0'};
- 
+  char filename[50] = {'\0'};
   switch (option) 
     {
     case 1:
       {
 	cout <<"***********"  <<endl;
-	cout << "Blob test " << endl;
+	cout << "   Blob test extract to user buffer " << endl;
+	cout <<"***********"  <<endl;
+	cout << "Extract from a lob column in a lob table" << endl << endl;
+	cout << "Input lob table name :" << endl;
+	cin.getline(tablename,40);
+	cout << "Table name : " << tablename << endl;
+	cout << "Input lob column name to extract from :" << endl;
+	cin.getline(columnname,40); 
+	cout << "Column Name : " << columnname << endl;
+
+      //extract lob handle
+      
+      char *lobHandle = new char[1024];
+      str_cpy_all(lobHandle," ",1024);
+      cout << "Extracting  lob handle for column " << columnname << "..." << endl;
+      retcode = extractLobHandle(cliGlob, lobHandle, (char *)columnname,(char *)tablename);
+      if (retcode)
+	{
+	  cout << "extractLobHandle returned " << retcode <<endl;
+	
+	  delete lobHandle;
+	  return retcode;
+	}
+      cout << "LOB handle for "<< columnname << ": " << lobHandle << endl;
+      //extract length of lob column from a table with 1 lob column.
+
+      cout << "Extracting LOB data length for the above handle..." << endl;
+      Int64 lengthOfLob= 0;
+      retCode = extractLengthOfLobColumn(cliGlob, lobHandle, lengthOfLob,columnname,(char *)tablename);
+      if (retcode)
+	{
+	  cout << "extractLengthOfLobColumn returned " << retcode <<endl;
+	 
+	  delete lobHandle;
+	  return retcode;
+	}
+      cout << "LOB data length :" << lengthOfLob << endl;
+      //extract lob data to buffer
+      cout << "Extracting lob data into user buffer in a loop ..." << endl;
+      retCode = extractLobToBuffer(cliGlob,lobHandle, lengthOfLob,columnname,tablename);
+      if (retcode)
+	{
+	  cout << "extractLobToBuffer returned " << retcode <<endl;
+
+	  delete lobHandle;
+	  return retcode;
+	}
+      delete lobHandle;
+      return retcode;
+      }
+     
+      break;
+    
+     case 2:
+      {
+	cout <<"***********"  <<endl;
+	cout << "Blob test extract to file in chunks " << endl;
 	cout <<"***********"  <<endl;
 	cout << " Extract from a lob column in a lob table" << endl << endl;
 	cout << " Input lob table name :" << endl;
@@ -108,13 +165,16 @@ int main(int argc, const char * argv[])
 	cout << "Input lob column name to extract from :" << endl;
 	cin.getline(columnname,40); 
 	cout << "Column Name : " << columnname << endl;
+	cout <<"Input a filename to extract to : " << endl;
+	cin.getline(filename,40); 
+	cout << "Output File Name : " << filename << endl;
 
       //extract lob handle
       
       char *lobHandle = new char[1024];
       str_cpy_all(lobHandle," ",1024);
       cout << "Extracting  lob handle for column " << columnname << "..." << endl;
-      retcode = extractLobHandle(cliGlob, lobHandle, (char *)"c2",(char *)"tlob1");
+      retcode = extractLobHandle(cliGlob, lobHandle, (char *)columnname,tablename);
       if (retcode)
 	{
 	  cout << "extractLobHandle returned " << retcode <<endl;
@@ -127,7 +187,7 @@ int main(int argc, const char * argv[])
 
       cout << "Extracting LOB data length for the above handle..." << endl;
       Int64 lengthOfLob= 0;
-      retCode = extractLengthOfLobColumn(cliGlob, lobHandle, lengthOfLob,(char *)"c2",(char *)"tlob1");
+      retCode = extractLengthOfLobColumn(cliGlob, lobHandle, lengthOfLob,columnname,tablename);
       if (retcode)
 	{
 	  cout << "extractLengthOfLobColumn returned " << retcode <<endl;
@@ -137,11 +197,11 @@ int main(int argc, const char * argv[])
 	}
       cout << "LOB data length :" << lengthOfLob << endl;
       //extract lob data to buffer
-      cout << "Extracting lob data into user buffer in a loop ..." << endl;
-      retCode = extractLobToBuffer(cliGlob,lobHandle, lengthOfLob,(char *)"c2",(char *)"tlob1");
+      cout << "Extracting lob data into file in chunks of 1000 ..." << endl;
+      retCode = extractLobToFileInChunks(cliGlob,lobHandle, filename, lengthOfLob,columnname,tablename);
       if (retcode)
 	{
-	  cout << "extractLobToBuffer returned " << retcode <<endl;
+	  cout << "extractLobToFileInChunks returned " << retcode <<endl;
 
 	  delete lobHandle;
 	  return retcode;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/781682af/core/sql/bin/vprocclitestdriver.cpp
----------------------------------------------------------------------
diff --git a/core/sql/bin/vprocclitestdriver.cpp b/core/sql/bin/vprocclitestdriver.cpp
new file mode 100644
index 0000000..60a11fb
--- /dev/null
+++ b/core/sql/bin/vprocclitestdriver.cpp
@@ -0,0 +1,51 @@
+/**********************************************************************
+// @@@ 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 @@@
+**********************************************************************/
+/* -*-C++-*-
+ *****************************************************************************
+ *
+ * File:         vproctestdriver.CPP
+ * Created:      02/26/99
+ * Language:     C++
+ *
+ *
+//=============================================================================
+//
+*
+*****************************************************************************
+*/
+
+#include "vproc.h"
+#include <stdio.h>
+
+extern "C" { void
+VPROC (PRODNUMMXCI,DATE1MXCI,MXCI_CC_LABEL)
+() {} }
+
+#include "SCMVersHelp.h"
+
+#define VERS_CV_MAJ 1
+#define VERS_CV_MIN 0
+#define VERS_CV_UPD 1
+
+VERS_BIN (clitestdriver)
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/781682af/core/sql/clitest/blobtest.cpp
----------------------------------------------------------------------
diff --git a/core/sql/clitest/blobtest.cpp b/core/sql/clitest/blobtest.cpp
index d7d700d..6abc04f 100644
--- a/core/sql/clitest/blobtest.cpp
+++ b/core/sql/clitest/blobtest.cpp
@@ -50,7 +50,7 @@ Int32 extractLobToBuffer(CliGlobals *cliglob, char * lobHandle, Int64 &lengthOfL
   char *lobFinalBuf = new char[lengthOfLob];
   char statusBuf[200] = {'\0'};
   Int32 statusBufLen = 0;
-  Int64 lobExtractLen = 10;
+  Int64 lobExtractLen = 1000;
   char *lobDataBuf = new char[lobExtractLen];
   
   str_sprintf(query,"extract lobtobuffer(lob '%s', LOCATION %Ld, SIZE %Ld) ", lobHandle, (Int64)lobDataBuf, lobExtractLen);
@@ -72,7 +72,7 @@ Int32 extractLobToBuffer(CliGlobals *cliglob, char * lobHandle, Int64 &lengthOfL
       FILE * lobFileId = fopen("lob_output_file","w");
   
       int byteCount=fwrite(lobFinalBuf,sizeof(char),lengthOfLob, lobFileId);
-      cout << "Wrote " << byteCount << " bytes to file lob_output_file" << endl;
+      cout << "Writing " << byteCount << " bytes from user buffer to file lob_output_file in current directory" << endl;
 
       fclose(lobFileId);
     }
@@ -86,3 +86,46 @@ Int32 extractLobToBuffer(CliGlobals *cliglob, char * lobHandle, Int64 &lengthOfL
 }
 
 
+Int32 extractLobToFileInChunks(CliGlobals *cliglob,  char * lobHandle, char *filename,Int64 &lengthOfLob, 
+				char *lobColumnName, char *tableName)
+{
+  Int32 retcode = 0;
+  ExeCliInterface cliInterface((cliglob->currContext())->exHeap(), (Int32)SQLCHARSETCODE_UTF8, cliglob->currContext(),NULL);
+  // Extract lob data into a buffer.
+  char * query = new char [500];
+  
+  
+  char statusBuf[200] = {'\0'};
+  Int32 statusBufLen = 0;
+  Int64 lobExtractLen = 1000;
+  char *lobDataBuf = new char[lobExtractLen];
+  Int64 *inputOutputAddr = &lobExtractLen;
+
+  str_sprintf(query,"extract lobtobuffer(lob '%s', LOCATION %Ld, SIZE %Ld) ", lobHandle, (Int64)lobDataBuf, inputOutputAddr);
+ 
+ 
+  retcode = cliInterface.executeImmediatePrepare(query);
+  short i = 0;
+  FILE * lobFileId = fopen(filename,"a+");
+  int byteCount = 0;
+  while ((retcode != 100) && !(retcode<0))
+    {    
+      retcode = cliInterface.clearExecFetchClose(NULL,NULL,statusBuf, &statusBufLen);
+      if (!retcode)
+	{
+	  byteCount=fwrite(lobDataBuf,sizeof(char),*inputOutputAddr, lobFileId);
+	 cout << "Wrote " << byteCount << " bytes to file : " << filename << endl;
+	}
+    }
+  
+
+  fclose(lobFileId);
+
+ 
+  delete query;
+  delete lobDataBuf;
+    
+
+  return retcode;
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/781682af/core/sql/clitest/blobtest.h
----------------------------------------------------------------------
diff --git a/core/sql/clitest/blobtest.h b/core/sql/clitest/blobtest.h
index 4ec96dc..da34fa7 100644
--- a/core/sql/clitest/blobtest.h
+++ b/core/sql/clitest/blobtest.h
@@ -35,3 +35,5 @@ Int32 extractLengthOfLobColumn(CliGlobals *cliglob, char * lobHandle, Int64 &len
 
 Int32 extractLobToBuffer(CliGlobals *cliglob, char * lobHandle, Int64 &lengthOfLob, 
 			 char *lobColumnName, char *tableName);
+Int32 extractLobToFileInChunks(CliGlobals *cliglob, char * lobHandle, char *filename, Int64 &lengthOfLob, 
+			 char *lobColumnName, char *tableName);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/781682af/core/sql/comexe/ComTdbExeUtil.cpp
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdbExeUtil.cpp b/core/sql/comexe/ComTdbExeUtil.cpp
index 773df33..1cb64a8 100644
--- a/core/sql/comexe/ComTdbExeUtil.cpp
+++ b/core/sql/comexe/ComTdbExeUtil.cpp
@@ -2201,7 +2201,7 @@ ComTdbExeUtilLobExtract::ComTdbExeUtilLobExtract
  Lng32 handleLen,
  ExtractToType toType,
  Int64 bufAddr,
- Int64 extractSize,
+ Int64 extractSizeAddr,
  Int64 intParam1,
  Int64 intParam2,
  Lng32 lobStorageType,
@@ -2234,7 +2234,7 @@ ComTdbExeUtilLobExtract::ComTdbExeUtilLobExtract
     handleLen_(handleLen),
     toType_((short)toType),
     bufAddr_(bufAddr),
-    extractSize_(extractSize),
+    extractSizeIOAddr_(extractSizeAddr),
     lobStorageType_(lobStorageType),
     stringParam1_(stringParam1),
     stringParam2_(stringParam2),
@@ -2257,7 +2257,7 @@ ComTdbExeUtilLobExtract::ComTdbExeUtilLobExtract
       {
 	// 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
-	extractSize_ = 0;
+	extractSizeIOAddr_ = 0;
 	bufAddr_ = 0;
 	
       }

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/781682af/core/sql/comexe/ComTdbExeUtil.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdbExeUtil.h b/core/sql/comexe/ComTdbExeUtil.h
index afe1a69..99f80f8 100644
--- a/core/sql/comexe/ComTdbExeUtil.h
+++ b/core/sql/comexe/ComTdbExeUtil.h
@@ -2753,8 +2753,8 @@ public:
   {(v ? flags_ |= APPEND_OR_CREATE : flags_ &= ~APPEND_OR_CREATE); };
   NABoolean appendOrCreate() { return (flags_ & APPEND_OR_CREATE) != 0; };
 
-  void setExtractSize(Int64 extractSize) { extractSize_ = extractSize; };
-  Int64 getExtractSize() { return extractSize_;}
+  void setExtractSizeIOAddr(Int64 ext_addr){ extractSizeIOAddr_ = ext_addr;};
+  Int64 dataExtractSizeIOAddr() { return extractSizeIOAddr_;}
   void setTotalBufSize(Int64 bufSize) { totalBufSize_ = bufSize;};
   Int64 getTotalBufSize() { return totalBufSize_;};
   void setBufAddr(Int64 bufAddr) {bufAddr_ = bufAddr;};
@@ -2779,7 +2779,7 @@ private:
   short toType_;                                           // 08-09
   Int32 flags_;    
   Lng32 handleLen_;
-  Int64 extractSize_; // as passed in via syntax size
+  Int64 extractSizeIOAddr_; // as passed in via syntax size
   Int64 totalBufSize_; // buf size
   Int64 bufAddr_ ; //buffer addressed as passed in by user via syntax
   Int64 intParam1_;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/781682af/core/sql/executor/ExExeUtilLoad.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilLoad.cpp b/core/sql/executor/ExExeUtilLoad.cpp
index 07d7902..b4e32d9 100644
--- a/core/sql/executor/ExExeUtilLoad.cpp
+++ b/core/sql/executor/ExExeUtilLoad.cpp
@@ -3029,6 +3029,7 @@ short ExExeUtilLobExtractTcb::work()
 	      {
 		so = Lob_Buffer;
 		lobData_ =  (char *)lobTdb().getBufAddr();
+		lobDataSpecifiedExtractLen_ = *((Int64 *)(lobTdb().dataExtractSizeIOAddr()));
 		step_ = OPEN_CURSOR_;
 	      }
 	  }
@@ -3080,7 +3081,7 @@ short ExExeUtilLobExtractTcb::work()
 	  {
 	    if (lobTdb().getToType() == ComTdbExeUtilLobExtract::TO_BUFFER_)
 	      so = Lob_Buffer;
-	    lobDataSpecifiedExtractLen_ = lobTdb().getExtractSize();
+	    lobDataSpecifiedExtractLen_ = *((Int64 *)(lobTdb().dataExtractSizeIOAddr()));
 	    retcode = ExpLOBInterfaceSelectCursor
 	      (lobGlobs,
 	       lobName_, 
@@ -3131,6 +3132,9 @@ short ExExeUtilLobExtractTcb::work()
             if (lobTdb().getToType() == ComTdbExeUtilLobExtract::TO_BUFFER_)
 	      {
 		str_sprintf(statusString_," Success: LOB data length returned : %d", lobDataOutputLen);
+	       
+		//lobTdb().setExtractSizeIOAddr((Int64)(&lobDataOutputLen));
+		memcpy((char *)lobTdb().dataExtractSizeIOAddr(), (char *)&lobDataOutputLen,sizeof(Int64));
 		step_ = RETURN_STATUS_;
 	      }
 	  }
@@ -3182,7 +3186,7 @@ short ExExeUtilLobExtractTcb::work()
 	    if (qparent_.up->isFull())
 	      return WORK_OK;
 
-	    Lng32 size = MINOF((Lng32)lobTdb().extractSize_, (Lng32)remainingBytes_);
+	    Lng32 size = MINOF((Lng32)lobTdb().dataExtractSizeIOAddr(), (Lng32)remainingBytes_);
 
 	    moveRowToUpQueue(&lobData_[currPos_], size);
 
@@ -3487,12 +3491,12 @@ short ExExeUtilFileExtractTcb::work()
 	  break;
 
 
-	case RETURN_STRING_:
+	  /*case RETURN_STRING_:
 	  {
 	    if (qparent_.up->isFull())
 	      return WORK_OK;
 
-	    Lng32 size = MINOF((Lng32)lobTdb().extractSize_, (Lng32)remainingBytes_);
+	    Lng32 size = MINOF((Lng32)lobTdb().dataExtractSizeIOAddr(), (Lng32)remainingBytes_);
 
 	    // eval expression to convert lob data to sql row.
 	    // TBD.
@@ -3507,7 +3511,7 @@ short ExExeUtilFileExtractTcb::work()
 
 	    return WORK_RESCHEDULE_AND_RETURN;
 	  }
-	  break;
+	  break;*/
 
 	case HANDLE_ERROR_:
 	  {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/781682af/core/sql/generator/GenRelExeUtil.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenRelExeUtil.cpp b/core/sql/generator/GenRelExeUtil.cpp
index d1b73e2..80bd5aa 100644
--- a/core/sql/generator/GenRelExeUtil.cpp
+++ b/core/sql/generator/GenRelExeUtil.cpp
@@ -3687,7 +3687,7 @@ short ExeUtilLobExtract::codeGen(Generator * generator)
 	 (toType_ == TO_EXTERNAL_FROM_FILE_ ? ComTdbExeUtilLobExtract::TO_EXTERNAL_FROM_FILE_ :
 	  ComTdbExeUtilLobExtract::NOOP_)))))),
      bufAddr_,
-     extractSize_,
+     extractSizeAddr_,
      intParam_,
      intParam2_,
      lst,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/781682af/core/sql/optimizer/RelExeUtil.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/RelExeUtil.cpp b/core/sql/optimizer/RelExeUtil.cpp
index 3690c6f..dfff976 100644
--- a/core/sql/optimizer/RelExeUtil.cpp
+++ b/core/sql/optimizer/RelExeUtil.cpp
@@ -5205,7 +5205,7 @@ RelExpr * ExeUtilLobExtract::copyTopNode(RelExpr *derivedNode, CollHeap* outHeap
   result->handle_ = handle_;
   result->toType_ = toType_;
   result->bufAddr_ = bufAddr_;
-  result->extractSize_ = extractSize_;
+  result->extractSizeAddr_ = extractSizeAddr_;
   result->intParam_ = intParam_;
   result->intParam2_ = intParam2_;
   result->stringParam_ = stringParam_;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/781682af/core/sql/optimizer/RelExeUtil.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/RelExeUtil.h b/core/sql/optimizer/RelExeUtil.h
index 28edeba..07a6c31 100644
--- a/core/sql/optimizer/RelExeUtil.h
+++ b/core/sql/optimizer/RelExeUtil.h
@@ -1871,7 +1871,7 @@ public:
  ExeUtilLobExtract(ItemExpr * handle, 
 		   ExtractToType toType,
 		   Int64 bufaddr=0,
-		   Int64 extractSize=0,
+		   Int64 extractSizeAddr=0,
 		   Int64 intParam = 0,
 		   Int64 intParam2 = 0,
 		   char * stringParam = NULL,
@@ -1885,7 +1885,7 @@ public:
     handle_(handle),
     toType_(toType),
     bufAddr_(bufaddr),
-    extractSize_(extractSize),
+    extractSizeAddr_(extractSizeAddr),
     intParam_(intParam),
     intParam2_(intParam2),
     handleInStringFormat_(TRUE),
@@ -1942,7 +1942,7 @@ public:
   ExtractToType toType_;
   
   Int64 bufAddr_;
-  Int64 extractSize_;
+  Int64 extractSizeAddr_;
   
   Int64 intParam_;   // options for create or size limit
   Int64 intParam2_;// options for file behavior

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/781682af/core/sql/parser/sqlparser.y
----------------------------------------------------------------------
diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y
index 6c686b4..7baa141 100755
--- a/core/sql/parser/sqlparser.y
+++ b/core/sql/parser/sqlparser.y
@@ -15616,34 +15616,19 @@ exe_util_lob_extract : TOK_EXTRACT TOK_LOBLENGTH '(' TOK_LOB QUOTED_STRING  ')'
 
               | TOK_EXTRACT TOK_LOBTOBUFFER '(' TOK_LOB QUOTED_STRING ',' TOK_LOCATION NUMERIC_LITERAL_EXACT_NO_SCALE ',' TOK_SIZE NUMERIC_LITERAL_EXACT_NO_SCALE ')'
                {
-		 /* if (NOT (($8->getOperatorType() == ITM_DYN_PARAM) ||
-                          ($8->getOperatorType() == ITM_CONSTANT)))
-                   {
-                     YYERROR;
-                   }
+		 /* TOK_LOCATION points to a user allocated data buffer ehich needs to be enough to hold alreast TOK_SIZE worth of data .
+TOK_SIZE points to the address of an Int64 container This size is the input specified by user for length to extract. One return, it will give the caller the size that was extracted */
 
-                 if (NOT (($11->getOperatorType() == ITM_DYN_PARAM) ||
-                          ($11->getOperatorType() == ITM_CONSTANT)))
-                   {
-                     YYERROR;
-		     }*/
 		 Int64 bufAddr = atoInt64($8->data());
-		 Int64 bufSize = atoInt64($11->data());
-		 /* ItemExpr * bufaddr = $8;
-		 bufaddr = new (PARSERHEAP()) 
-		   Cast(bufaddr, new (PARSERHEAP()) SQLLargeInt(TRUE, FALSE));
-
-		 ItemExpr * bufsize = $11;
-		 bufsize = new (PARSERHEAP()) 
-		   Cast(bufsize, new (PARSERHEAP()) SQLLargeInt(TRUE, FALSE));
-		 */
+		 Int64 sizeAddr = atoInt64($11->data());
+		 
 		 ConstValue * handle = new(PARSERHEAP()) ConstValue(*$5);
 
 		 ExeUtilLobExtract * lle =
 		   new (PARSERHEAP ()) ExeUtilLobExtract
 		   (handle, 
 		    ExeUtilLobExtract::TO_BUFFER_,
-		    bufAddr, bufSize, 0, 0);
+		    bufAddr, sizeAddr, 0, 0);
 
 		 $$ = lle;
 	       }