You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by se...@apache.org on 2017/08/31 05:08:58 UTC

[6/7] incubator-trafodion git commit: [TRAFODION-2727] Memory leak in the compiler part of the code in Trafodion

[TRAFODION-2727] Memory leak in the compiler part of the code in Trafodion

Compiler objects were refactored to use the heap infrastructure to ensure
that it is accounted and allocated within the trafodion memory management.

The commonly used NAType and derived classes are mostly created via heap,
but the heap was not passed in the constructor. The embedded objects
used the system heap though the container object is allocated in the compiler
heap. This could result in memory leak when the container object is
destroyed.


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

Branch: refs/heads/master
Commit: 35a656be9c367beb2bc3f159be9364cfc3027c69
Parents: f6f96a3
Author: selvaganesang <se...@esgyn.com>
Authored: Wed Aug 30 03:40:49 2017 +0000
Committer: selvaganesang <se...@esgyn.com>
Committed: Wed Aug 30 03:40:49 2017 +0000

----------------------------------------------------------------------
 core/sql/common/CharType.cpp                  |  77 ++---
 core/sql/common/CharType.h                    |  42 ++-
 core/sql/common/DTICommonType.h               |  10 +-
 core/sql/common/DateTimeType.cpp              |  51 ++-
 core/sql/common/DatetimeType.h                |  59 ++--
 core/sql/common/IntervalType.cpp              |   8 +-
 core/sql/common/IntervalType.h                |  24 +-
 core/sql/common/MiscType.cpp                  |  47 ++-
 core/sql/common/MiscType.h                    |  24 +-
 core/sql/common/NAString.cpp                  |   8 -
 core/sql/common/NAString.h                    |   1 -
 core/sql/common/NAType.cpp                    |  44 +--
 core/sql/common/NAType.h                      |   7 +-
 core/sql/common/NumericType.cpp               | 110 +++----
 core/sql/common/NumericType.h                 | 126 +++-----
 core/sql/generator/GenExpGenerator.cpp        |  30 +-
 core/sql/generator/GenFastTransport.cpp       |   4 +-
 core/sql/generator/GenItemFunc.cpp            |   4 +-
 core/sql/generator/GenKey.cpp                 |   6 +-
 core/sql/generator/GenPreCode.cpp             |  53 ++--
 core/sql/generator/GenProbeCache.cpp          |   4 +-
 core/sql/generator/GenRelDCL.cpp              |   4 +-
 core/sql/generator/GenRelEnforcer.cpp         |   4 +-
 core/sql/generator/GenRelExeUtil.cpp          |   2 +-
 core/sql/generator/GenRelGrby.cpp             |   2 +-
 core/sql/generator/GenRelJoin.cpp             |   4 +-
 core/sql/generator/GenRelMisc.cpp             |   8 +-
 core/sql/generator/GenRelScan.cpp             |  12 +-
 core/sql/generator/GenRelSet.cpp              |   4 +-
 core/sql/generator/GenRelUpdate.cpp           |   2 +-
 core/sql/generator/GenSequenceFunction.cpp    |  10 +-
 core/sql/generator/GenStoredProc.cpp          |   2 +-
 core/sql/generator/Generator.cpp              |   1 +
 core/sql/generator/LmExpr.cpp                 |   4 +-
 core/sql/langman/LmLangManager.cpp            |   6 +-
 core/sql/optimizer/BindItemExpr.cpp           |  88 +++---
 core/sql/optimizer/BindRelExpr.cpp            |  54 ++--
 core/sql/optimizer/BindWA.cpp                 |   2 +-
 core/sql/optimizer/ItemExpr.cpp               |  26 +-
 core/sql/optimizer/ItemSample.cpp             |   4 +-
 core/sql/optimizer/ItmBitMuxFunction.cpp      |   2 +-
 core/sql/optimizer/MVInfo.cpp                 |   4 +-
 core/sql/optimizer/MavRelRootBuilder.cpp      |   4 +-
 core/sql/optimizer/NAColumn.cpp               | 129 ++++----
 core/sql/optimizer/NARoutine.cpp              |   2 +-
 core/sql/optimizer/NATable.cpp                | 130 ++++----
 core/sql/optimizer/NormItemExpr.cpp           |  10 +-
 core/sql/optimizer/OptRange.cpp               |  39 ++-
 core/sql/optimizer/PartFunc.cpp               |  53 ++--
 core/sql/optimizer/QRDescGenerator.cpp        |  12 +-
 core/sql/optimizer/QRDescriptorExtentions.cpp |   2 +-
 core/sql/optimizer/RelCache.cpp               |   4 +-
 core/sql/optimizer/RelStoredProc.cpp          |   2 +-
 core/sql/optimizer/SynthType.cpp              | 349 ++++++++++-----------
 core/sql/optimizer/UdfDllInteraction.cpp      |  61 ++--
 core/sql/optimizer/ValueDesc.cpp              |  37 +--
 core/sql/optimizer/mdam.cpp                   |   2 +-
 core/sql/parser/SqlParserAux.cpp              |  34 +-
 core/sql/parser/StmtDDLCreate.cpp             |  10 +-
 core/sql/parser/sqlparser.y                   | 322 +++++++++----------
 core/sql/qmscommon/Range.cpp                  |  18 +-
 core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp      |   1 -
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp       |   6 +-
 core/sql/ustat/hs_cli.cpp                     |  40 +--
 64 files changed, 1053 insertions(+), 1198 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/common/CharType.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/CharType.cpp b/core/sql/common/CharType.cpp
index 10a15fc..eaedfc1 100644
--- a/core/sql/common/CharType.cpp
+++ b/core/sql/common/CharType.cpp
@@ -57,7 +57,8 @@ static const NAString LiteralBLOB("BLOB");
 static const NAString LiteralCLOB("CLOB");
 
 // constructor used for CHAR length semantics only
-CharType::CharType( const NAString&  adtName,
+CharType::CharType( NAMemory *h,
+                    const NAString&  adtName,
 		    Lng32            maxLenInBytesOrNAWchars,
 		    short            maxBytesPerChar,
 		    NABoolean        nullTerminated,
@@ -71,7 +72,7 @@ CharType::CharType( const NAString&  adtName,
 		    CharInfo::CharSet      encoding,
 		    Int32 vcIndLen // default is 0
 		  )
-      : NAType( adtName
+      : NAType(h, adtName
 		, NA_CHARACTER_TYPE
 		, (maxLenInBytesOrNAWchars + (nullTerminated ? 1 : 0)) * CharInfo::minBytesPerChar(cs)
 		, allowSQLnull
@@ -110,7 +111,8 @@ CharType::CharType( const NAString&  adtName,
 }
 
 // This constructor supports SJIS and UTF8 
-CharType::CharType( const NAString&  adtName,
+CharType::CharType( NAMemory *h,
+                    const NAString&  adtName,
 		    const CharLenInfo & maxLenInfo,
 		    short            maxBytesPerChar, // is maxBytesPerChar when cs is SJIS or UTF8
 		    NABoolean        nullTerminated,
@@ -123,7 +125,7 @@ CharType::CharType( const NAString&  adtName,
 		    CharInfo::Coercibility ce,
 		    CharInfo::CharSet      encoding
 		  )
-      : NAType( adtName
+      : NAType(h, adtName
 		, NA_CHARACTER_TYPE
 		, (maxLenInfo.getMaxLenInBytes() +
                     (nullTerminated ? CharInfo::minBytesPerChar(cs) : 0))
@@ -509,10 +511,10 @@ const NAType* CharType::synthesizeType(NATypeSynthRuleEnum synthRule,
   if (DFS2REC::isAnyVarChar(op1.getFSDatatype()) OR
       DFS2REC::isAnyVarChar(op2.getFSDatatype()) OR
       makeTypeVarchar)
-    return new(h) SQLVarChar(res_CharLenInfo, null, upshift, caseinsensitive,
+    return new(h) SQLVarChar(h, res_CharLenInfo, null, upshift, caseinsensitive,
 			     op1.getCharSet(), co, ce);
   else
-    return new(h) SQLChar(res_CharLenInfo, null, upshift, caseinsensitive, FALSE,
+    return new(h) SQLChar(h, res_CharLenInfo, null, upshift, caseinsensitive, FALSE,
 			  op1.getCharSet(), co, ce);
 } // synthesizeType()
 
@@ -894,7 +896,8 @@ NABoolean CharType::createSQLLiteral(const char * buf,
 
 
 #pragma nowarn(1506)   // warning elimination
-SQLChar::SQLChar(Lng32 maxLen,
+SQLChar::SQLChar(NAMemory *h,
+                 Lng32 maxLen,
 		 NABoolean allowSQLnull,
 		 NABoolean isUpShifted,
 		 NABoolean isCaseInsensitive,
@@ -904,7 +907,7 @@ SQLChar::SQLChar(Lng32 maxLen,
 		 CharInfo::Coercibility ce,
 		 CharInfo::CharSet encoding
 		 )
-     : CharType(varLenFlag ? LiteralVARCHAR : LiteralCHAR,
+     : CharType(h, varLenFlag ? LiteralVARCHAR : LiteralCHAR,
 		maxLen, CharInfo::maxBytesPerChar(cs),
 		FALSE, allowSQLnull, isUpShifted, isCaseInsensitive,
 		varLenFlag, cs, co, ce,
@@ -913,7 +916,8 @@ SQLChar::SQLChar(Lng32 maxLen,
 #pragma warn(1506)  // warning elimination
 
 #pragma nowarn(1506)   // warning elimination
-SQLChar::SQLChar(const CharLenInfo & maxLenInfo,
+SQLChar::SQLChar(NAMemory *h,
+                 const CharLenInfo & maxLenInfo,
 		 NABoolean allowSQLnull,
 		 NABoolean isUpShifted,
 		 NABoolean isCaseInsensitive,
@@ -923,7 +927,7 @@ SQLChar::SQLChar(const CharLenInfo & maxLenInfo,
 		 CharInfo::Coercibility ce,
 		 CharInfo::CharSet encoding
 		 )
-     : CharType(varLenFlag ? LiteralVARCHAR : LiteralCHAR,
+     : CharType(h, varLenFlag ? LiteralVARCHAR : LiteralCHAR,
 		maxLenInfo, CharInfo::maxBytesPerChar(cs),
 		FALSE, allowSQLnull, isUpShifted, isCaseInsensitive,
 		varLenFlag, cs, co, ce,
@@ -932,7 +936,8 @@ SQLChar::SQLChar(const CharLenInfo & maxLenInfo,
 #pragma warn(1506)  // warning elimination
 
 #pragma nowarn(1506)   // warning elimination
-SQLVarChar::SQLVarChar(Lng32 maxLen,
+SQLVarChar::SQLVarChar(NAMemory *h,
+                       Lng32 maxLen,
 		       NABoolean allowSQLnull,
 		       NABoolean isUpShifted,
 		       NABoolean isCaseInsensitive,
@@ -942,7 +947,7 @@ SQLVarChar::SQLVarChar(Lng32 maxLen,
 		       CharInfo::CharSet encoding,
                        Lng32 vcIndLen
 		      )
-    : CharType(LiteralVARCHAR,
+    : CharType(h, LiteralVARCHAR,
 	       maxLen, CharInfo::maxBytesPerChar(cs),
 	       FALSE, allowSQLnull, isUpShifted, isCaseInsensitive,
 	       TRUE, cs, co, ce,
@@ -953,7 +958,8 @@ SQLVarChar::SQLVarChar(Lng32 maxLen,
 #pragma warn(1506)  // warning elimination
 
 #pragma nowarn(1506)   // warning elimination
-SQLVarChar::SQLVarChar(const CharLenInfo & maxLenInfo,
+SQLVarChar::SQLVarChar(NAMemory *h, 
+                       const CharLenInfo & maxLenInfo,
 		       NABoolean allowSQLnull,
 		       NABoolean isUpShifted,
 		       NABoolean isCaseInsensitive,
@@ -962,7 +968,7 @@ SQLVarChar::SQLVarChar(const CharLenInfo & maxLenInfo,
 		       CharInfo::Coercibility ce,
 		       CharInfo::CharSet encoding
 		      )
-    : CharType(LiteralVARCHAR,
+    : CharType(h, LiteralVARCHAR,
 	       maxLenInfo, CharInfo::maxBytesPerChar(cs),
 	       FALSE, allowSQLnull, isUpShifted, isCaseInsensitive,
 	       TRUE, cs, co, ce,
@@ -1002,7 +1008,8 @@ NABoolean SQLVarChar::operator==(const NAType& other) const
 // in cli + rfork if a CharType is both nul-terminated and has a vc-header.
 // -----------------------------------------------------------------------
 #pragma nowarn(1506)   // warning elimination
-ANSIChar::ANSIChar(Lng32 maxLen,
+ANSIChar::ANSIChar(NAMemory *h,
+                   Lng32 maxLen,
 		   NABoolean allowSQLnull,
 		   NABoolean isUpShifted,
 		   NABoolean varLenFlag,	// *unused*
@@ -1011,7 +1018,7 @@ ANSIChar::ANSIChar(Lng32 maxLen,
 		   CharInfo::Coercibility ce,
 		   CharInfo::CharSet encoding
 		  )
-     : CharType(LiteralCHAR,
+     : CharType(h, LiteralCHAR,
 		maxLen, CharInfo::maxBytesPerChar(cs),
 		TRUE, allowSQLnull, isUpShifted, FALSE, FALSE, cs, co, ce,
 		encoding)
@@ -1129,7 +1136,7 @@ void CharType::generateTextThenSetDisplayDataType ( CharInfo::CharSet cs   // in
 
   if ( charLimit * getBytesPerChar() == sizeInBytes )
   {
-    ddt += LongToNAString(charLimit, (NAHeap *)ddt.heap());
+    ddt += LongToNAString(charLimit);
     if (charLimit EQU 1)
       ddt += " CHAR";
     else
@@ -1137,7 +1144,7 @@ void CharType::generateTextThenSetDisplayDataType ( CharInfo::CharSet cs   // in
   }
   else
   {
-    ddt += LongToNAString(sizeInBytes, (NAHeap *)ddt.heap());
+    ddt += LongToNAString(sizeInBytes);
     if (sizeInBytes EQU 1)
       ddt += " BYTE";
     else
@@ -1148,7 +1155,7 @@ void CharType::generateTextThenSetDisplayDataType ( CharInfo::CharSet cs   // in
 
   ddt += CharInfo::getCharSetName(cs);
 
-  setDisplayDataType(ddt.data());
+  setDisplayDataType(ddt);
 }
 
 // -----------------------------------------------------------------------
@@ -1403,11 +1410,11 @@ CharType::findPushDownCharType(CharInfo::CharSet cs,
 
 const CharType* CharType::desiredCharType(enum CharInfo::CharSet cs)
 {
-  static SQLChar unicodeChar(0, TRUE, FALSE, FALSE, FALSE, CharInfo::UNICODE);
-  static SQLChar latin1Char(0, TRUE, FALSE, FALSE, FALSE, CharInfo::ISO88591);
-  static SQLChar sjisChar(0, TRUE, FALSE, FALSE, FALSE, CharInfo::SJIS /* ... old kludge ... CharInfo::ISO88591 */, CharInfo::DefaultCollation, CharInfo::COERCIBLE, CharInfo::SJIS/*encoding*/);
-  // static SQLChar sjisUnicodeChar(0, TRUE, FALSE, FALSE, FALSE, CharInfo::SJIS, CharInfo::DefaultCollation, CharInfo::COERCIBLE, CharInfo::UNICODE/*encoding*/);
-  static SQLChar utf8Char(0, TRUE, FALSE, FALSE, FALSE, CharInfo::UTF8 /* ... old kludge ... CharInfo::ISO88591 */, CharInfo::DefaultCollation, CharInfo::COERCIBLE, CharInfo::UTF8/*encoding*/);
+  static SQLChar unicodeChar(NULL, 0, TRUE, FALSE, FALSE, FALSE, CharInfo::UNICODE);
+  static SQLChar latin1Char(NULL, 0, TRUE, FALSE, FALSE, FALSE, CharInfo::ISO88591);
+  static SQLChar sjisChar(NULL, 0, TRUE, FALSE, FALSE, FALSE, CharInfo::SJIS /* ... old kludge ... CharInfo::ISO88591 */, CharInfo::DefaultCollation, CharInfo::COERCIBLE, CharInfo::SJIS/*encoding*/);
+  // static SQLChar sjisUnicodeChar(NULL, 0, TRUE, FALSE, FALSE, FALSE, CharInfo::SJIS, CharInfo::DefaultCollation, CharInfo::COERCIBLE, CharInfo::UNICODE/*encoding*/);
+  static SQLChar utf8Char(NULL, 0, TRUE, FALSE, FALSE, FALSE, CharInfo::UTF8 /* ... old kludge ... CharInfo::ISO88591 */, CharInfo::DefaultCollation, CharInfo::COERCIBLE, CharInfo::UTF8/*encoding*/);
 
   switch ( cs ) {
     case CharInfo::UNICODE:
@@ -1458,7 +1465,7 @@ NAType* SQLVarChar::equivalentCharType(NAMemory *h, NABoolean quantizeLen)
   len_in_bytes = quantizeLen ? quantize(getNominalSize()) : getNominalSize() ;
 
   CharLenInfo CLInfo( len_in_chars, len_in_bytes );
-  return new(h) SQLChar(CLInfo, supportsSQLnull(), isUpshifted(),
+  return new(h) SQLChar(h, CLInfo, supportsSQLnull(), isUpshifted(),
                         isCaseinsensitive(), FALSE,
                         getCharSet(), getCollation(), getCoercibility());
 }
@@ -1473,7 +1480,7 @@ NAType* SQLChar::equivalentVarCharType(NAMemory *h, NABoolean quantizeLen)
   len_in_bytes = quantizeLen ? quantize(getNominalSize()) : getNominalSize() ;
 
   CharLenInfo CLInfo( len_in_chars, len_in_bytes );
-  return new(h) SQLVarChar(CLInfo, supportsSQLnull(), isUpshifted(),
+  return new(h) SQLVarChar(h, CLInfo, supportsSQLnull(), isUpshifted(),
 			   isCaseinsensitive(),
 			   getCharSet(), getCollation(), getCoercibility());
 }
@@ -1482,7 +1489,7 @@ NAType* SQLChar::equivalentVarCharType(NAMemory *h, NABoolean quantizeLen)
 NAType* ANSIChar::equivalentVarCharType(NAMemory *h, NABoolean quantizeLen)
 {
   Lng32 len = quantizeLen ? quantize(getStrCharLimit()) : getStrCharLimit();
-  return new(h) SQLVarChar(len, supportsSQLnull(), isUpshifted(),
+  return new(h) SQLVarChar(h, len, supportsSQLnull(), isUpshifted(),
 			   isCaseinsensitive(),
 			   getCharSet(), getCollation(), getCoercibility());
 }
@@ -1504,7 +1511,7 @@ short SQLLongVarChar::getTrueFSDatatype() const
 //////////////////////////////
 // class SQLlob
 //////////////////////////////
-SQLlob::SQLlob( 
+SQLlob::SQLlob(NAMemory *h, 
 	       NABuiltInTypeEnum  ev,
 	       Int64 lobLength, 
 	       LobsStorage ls,
@@ -1513,7 +1520,7 @@ SQLlob::SQLlob(
 	       NABoolean externalFormat,
 	       Lng32 extFormatLen
 		)
-  : NAType( (ev == NA_LOB_TYPE ? LiteralLOB : LiteralLOB)
+  : NAType(h, (ev == NA_LOB_TYPE ? LiteralLOB : LiteralLOB)
 	    , ev
 	    , (externalFormat ? extFormatLen : 512)
 	    , allowSQLnull
@@ -1558,7 +1565,7 @@ NAString SQLlob::getTypeSQLname(NABoolean terse) const
 /////////////////////////////////////
 // class SQLBlob
 /////////////////////////////////////
-SQLBlob::SQLBlob( 
+SQLBlob::SQLBlob(NAMemory *h, 
   Int64 blobLength, 
   LobsStorage lobStorage,
   NABoolean allowSQLnull,
@@ -1566,7 +1573,7 @@ SQLBlob::SQLBlob(
   NABoolean externalFormat,
   Lng32 extFormatLen
 )
-  : SQLlob(NA_LOB_TYPE,
+  : SQLlob(h, NA_LOB_TYPE,
 	   blobLength,
 	   lobStorage,
 	   allowSQLnull,
@@ -1600,7 +1607,7 @@ const NAType* SQLBlob::synthesizeType(NATypeSynthRuleEnum synthRule,
 
   if (synthRule == SYNTH_RULE_UNION)
     {
-      return new(h) SQLBlob(MAXOF(op1.getLobLength(), op2.getLobLength()),
+      return new(h) SQLBlob(h, MAXOF(op1.getLobLength(), op2.getLobLength()),
 			    op1.getLobStorage(),
 			    null);
     }
@@ -1611,7 +1618,7 @@ const NAType* SQLBlob::synthesizeType(NATypeSynthRuleEnum synthRule,
 /////////////////////////////////////
 // class SQLClob
 /////////////////////////////////////
-SQLClob::SQLClob( 
+SQLClob::SQLClob(NAMemory *h, 
   Int64 clobLength, 
   LobsStorage lobStorage,
   NABoolean allowSQLnull,
@@ -1619,7 +1626,7 @@ SQLClob::SQLClob(
   NABoolean externalFormat,
   Lng32 extFormatLen
 )
-  : SQLlob(NA_LOB_TYPE,
+  : SQLlob(h, NA_LOB_TYPE,
 	   clobLength,
 	   lobStorage,
 	   allowSQLnull,
@@ -1653,7 +1660,7 @@ const NAType* SQLClob::synthesizeType(NATypeSynthRuleEnum synthRule,
 
   if (synthRule == SYNTH_RULE_UNION)
     {
-      return new(h) SQLClob(MAXOF(op1.getLobLength(), op2.getLobLength()),
+      return new(h) SQLClob(h, MAXOF(op1.getLobLength(), op2.getLobLength()),
 			    op1.getLobStorage(),
 			    null);
     }

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/common/CharType.h
----------------------------------------------------------------------
diff --git a/core/sql/common/CharType.h b/core/sql/common/CharType.h
index 44064de..c92a7db 100644
--- a/core/sql/common/CharType.h
+++ b/core/sql/common/CharType.h
@@ -113,7 +113,8 @@ static const NAString LiteralCatalog;
 // ---------------------------------------------------------------------
 // Constructor functions
 // ---------------------------------------------------------------------
-CharType (const NAString&	adtName, 
+CharType (NAMemory *h,
+          const NAString&	adtName, 
 	  Lng32		maxCharStrLen,
 	  short		bytesPerChar = 0,
 	  NABoolean	nullTerminated = FALSE,
@@ -127,7 +128,8 @@ CharType (const NAString&	adtName,
 	  CharInfo::CharSet      encoding = CharInfo::UnknownCharSet,
 	  Lng32 vcIndLen = 0  // not passed in, need to be computed
          );
-CharType (const NAString&  adtName,
+CharType (NAMemory *h,
+          const NAString&  adtName,
           const CharLenInfo & maxLenInfo,
           short            /*max*/bytesPerChar = 0, // is maxBytesPerChar when cs is SJIS or UTF8
           NABoolean        nullTerminated = FALSE,
@@ -430,7 +432,8 @@ public:
 // ---------------------------------------------------------------------
 // Constructor functions 
 // ---------------------------------------------------------------------
-  SQLChar (Lng32 maxLength, 
+  SQLChar (NAMemory *h,
+           Lng32 maxLength, 
 	   NABoolean allowSQLnull	= TRUE,
 	   NABoolean isUpShifted	= FALSE, 
 	   NABoolean     isCaseInsensitive = FALSE,
@@ -440,7 +443,8 @@ public:
 	   CharInfo::Coercibility	= CharInfo::COERCIBLE,
 	   CharInfo::CharSet encoding	= CharInfo::UnknownCharSet
           );
-  SQLChar (const CharLenInfo & maxLenInfo,
+  SQLChar (NAMemory *h,
+           const CharLenInfo & maxLenInfo,
 	   NABoolean allowSQLnull	= TRUE,
 	   NABoolean isUpShifted	= FALSE, 
 	   NABoolean isCaseInsensitive	= FALSE,
@@ -497,7 +501,8 @@ public:
 // ---------------------------------------------------------------------
 // Constructor functions 
 // ---------------------------------------------------------------------
-  SQLVarChar(Lng32 maxLength,
+  SQLVarChar(NAMemory *h,
+             Lng32 maxLength,
  	     NABoolean allowSQLnull	= TRUE,
 	     NABoolean isUpShifted	= FALSE,
 	     NABoolean isCaseInsensitive = FALSE,
@@ -507,7 +512,8 @@ public:
 	     CharInfo::CharSet encoding	= CharInfo::UnknownCharSet,
              Lng32 vcIndLen             = 0
 	    );
-  SQLVarChar(const CharLenInfo & maxLenInfo,
+  SQLVarChar(NAMemory *h,
+             const CharLenInfo & maxLenInfo,
 	     NABoolean allowSQLnull	= TRUE,
 	     NABoolean isUpShifted	= FALSE,
 	     NABoolean isCaseInsensitive = FALSE,
@@ -586,7 +592,8 @@ public:
 // ---------------------------------------------------------------------
 // Constructor functions 
 // ---------------------------------------------------------------------
- ANSIChar (Lng32 maxLength,
+ ANSIChar (NAMemory *h,
+           Lng32 maxLength,
  	   NABoolean allowSQLnull	= TRUE,
 	   NABoolean isUpShifted	= FALSE,
 	   NABoolean varLenFlag		= FALSE,
@@ -604,7 +611,7 @@ NABoolean isExternalType() const 	{ return TRUE; }
 
 NAType * equivalentType(CollHeap* h=0) const
 {
-  return new(h) SQLVarChar(getNominalSize(), supportsSQLnull(),
+  return new(h) SQLVarChar(h, getNominalSize(), supportsSQLnull(),
 			     isUpshifted(), FALSE, getCharSet(), getCollation(),
                            getCoercibility());
 }
@@ -653,7 +660,8 @@ class SQLLongVarChar : public SQLVarChar
 
 public: 
 
- SQLLongVarChar(Lng32 maxLength, 
+ SQLLongVarChar(NAMemory *h,
+                Lng32 maxLength, 
 		NABoolean validLength	   = FALSE, 
 		NABoolean allowSQLnull	   = TRUE,
 		NABoolean isUpShifted	   = FALSE,
@@ -663,13 +671,14 @@ public:
 		CharInfo::Coercibility ce  = CharInfo::COERCIBLE,
 		CharInfo::CharSet encoding = CharInfo::UnknownCharSet
 	       )
-  : SQLVarChar(maxLength, allowSQLnull, isUpShifted, isCaseInsensitive,
+  : SQLVarChar(h, maxLength, allowSQLnull, isUpShifted, isCaseInsensitive,
 	       cs, co, ce)
   {
     setClientDataType("LONG VARCHAR");
     lengthNotSet_ = !validLength;
   }
- SQLLongVarChar(const CharLenInfo & maxLenInfo,
+ SQLLongVarChar(NAMemory *h,
+                const CharLenInfo & maxLenInfo,
 		NABoolean validLength	   = FALSE, 
 		NABoolean allowSQLnull	   = TRUE,
 		NABoolean isUpShifted	   = FALSE,
@@ -679,7 +688,7 @@ public:
 		CharInfo::Coercibility ce  = CharInfo::COERCIBLE,
 		CharInfo::CharSet encoding = CharInfo::UnknownCharSet
 	       )
-  : SQLVarChar(maxLenInfo, allowSQLnull, isUpShifted, isCaseInsensitive,
+  : SQLVarChar(h, maxLenInfo, allowSQLnull, isUpShifted, isCaseInsensitive,
 	       cs, co, ce)
   {
     setClientDataType("LONG VARCHAR");
@@ -724,7 +733,8 @@ class SQLlob : public NAType
 
 public: 
 
-  SQLlob(NABuiltInTypeEnum  ev,
+  SQLlob(NAMemory *h,
+         NABuiltInTypeEnum  ev,
 	 Int64 lobLength, 
 	 LobsStorage lobStorage,
 	 NABoolean allowSQLnull	= TRUE,
@@ -787,7 +797,8 @@ class SQLBlob : public SQLlob
 
 public: 
 
-  SQLBlob(Int64 blobLength, 
+  SQLBlob(NAMemory *h,
+          Int64 blobLength, 
 	  LobsStorage lobStorage = Lob_Invalid_Storage,
 	  NABoolean allowSQLnull	= TRUE,
 	  NABoolean inlineIfPossible = FALSE,
@@ -826,7 +837,8 @@ class SQLClob : public SQLlob
 
 public: 
 
-  SQLClob(Int64 blobLength, 
+  SQLClob(NAMemory *h,
+          Int64 blobLength, 
 	  LobsStorage lobStorage = Lob_Invalid_Storage,
 	  NABoolean allowSQLnull	= TRUE,
 	  NABoolean inlineIfPossible = FALSE,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/common/DTICommonType.h
----------------------------------------------------------------------
diff --git a/core/sql/common/DTICommonType.h b/core/sql/common/DTICommonType.h
index 2ba7684..dd7d8fb 100644
--- a/core/sql/common/DTICommonType.h
+++ b/core/sql/common/DTICommonType.h
@@ -59,24 +59,22 @@ public:
     UNSUPPORTED_DDL_DATA_TYPE = 1
   };
 
-  DatetimeIntervalCommonType (const NAString & adtName, 
+  DatetimeIntervalCommonType (NAMemory *h, const NAString & adtName, 
                               NABuiltInTypeEnum typeEnum,
                               Lng32 storageSize,
                               NABoolean allowSQLnull,
                               rec_datetime_field startField,
                               rec_datetime_field endField,
                               UInt32 fractionPrecision,
-                              Lng32 dataAlignment = 1 /* no data alignment */,
-                              NAMemory * h=0)
-       : NAType (adtName,
+                              Lng32 dataAlignment = 1 /* no data alignment */)
+       : NAType (h, adtName,
                  typeEnum,
                  storageSize,
                  allowSQLnull,
                  SQL_NULL_HDR_SIZE,
                  FALSE, /* fixed length */
                  0, /* length header size */
-                 dataAlignment,
-                 h),
+                 dataAlignment),
          startField_(startField),
          endField_(endField),
          fractionPrecision_(fractionPrecision)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/common/DateTimeType.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/DateTimeType.cpp b/core/sql/common/DateTimeType.cpp
index 31150d8..fb4a719 100644
--- a/core/sql/common/DateTimeType.cpp
+++ b/core/sql/common/DateTimeType.cpp
@@ -83,13 +83,12 @@ static const UInt32 daysInMonth[]   =  { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30,
 //
 // ***********************************************************************
 
-DatetimeType::DatetimeType (const NAString & adtName,
+DatetimeType::DatetimeType (NAMemory *h, const NAString & adtName,
 			    NABoolean allowSQLnull,
 			    rec_datetime_field startField,
 			    rec_datetime_field endField,
-			    UInt32 fractionPrecision,
-			    NAMemory * h)
-     : DatetimeIntervalCommonType (adtName,
+			    UInt32 fractionPrecision)
+     : DatetimeIntervalCommonType (h, adtName,
 				   NA_DATETIME_TYPE,
 				   getStorageSize(startField,
 						  endField,
@@ -98,8 +97,8 @@ DatetimeType::DatetimeType (const NAString & adtName,
 				   startField,
 				   endField,
 				   fractionPrecision,
-				   1, /* no data alignment */
-				   h)
+				   1 /* no data alignment */
+				   )
        , displayFormat_(h)
 {
   assert(validate(startField, endField, fractionPrecision) != SUBTYPE_ILLEGAL);
@@ -434,15 +433,13 @@ DatetimeType* DatetimeType::constructSubtype(NABoolean allowSQLnull,
 					     NAMemory* h)
 {
   switch (validate(startField, endField, precision)) {
-    case SUBTYPE_SQLDate:       return new (h) SQLDate(allowSQLnull,h);
-    case SUBTYPE_SQLTime:       return new (h) SQLTime(allowSQLnull, precision,h);
-    case SUBTYPE_SQLTimestamp:  return new (h) SQLTimestamp(allowSQLnull, precision, h);
-
-    case SUBTYPE_SQLMPDatetime: return new (h) SQLMPDatetime( startField,
+    case SUBTYPE_SQLDate:       return new (h) SQLDate(h, allowSQLnull);
+    case SUBTYPE_SQLTime:       return new (h) SQLTime(h, allowSQLnull, precision);
+    case SUBTYPE_SQLTimestamp:  return new (h) SQLTimestamp(h, allowSQLnull, precision);
+    case SUBTYPE_SQLMPDatetime: return new (h) SQLMPDatetime(h, startField,
 							      endField,
 							      allowSQLnull,
-							      precision,
-							      h);
+							      precision);
 
     default:		       return NULL;
   }
@@ -607,13 +604,13 @@ const NAType* DatetimeType::synthesizeType(enum NATypeSynthRuleEnum synthRule,
           {
             // this is DATE subtraction in modespecial4.
             // Result is numeric.
-            return new(h) SQLInt(); 
+            return new(h) SQLInt(h); 
           }
         else
           {
-            return new(h) SQLInterval(allowNulls, datetime1->getEndField(),
+            return new(h) SQLInterval(h, allowNulls, datetime1->getEndField(),
                                       12, datetime1->getEndField(),
-                                      fractionPrecision,h);
+                                      fractionPrecision);
           }
       }
     break;
@@ -673,7 +670,7 @@ const NAType* DatetimeType::synthesizeTernary(enum NATypeSynthRuleEnum synthRule
     const DatetimeType& op1 = (DatetimeType&) operand1;
     const DatetimeType& op2 = (DatetimeType&) operand2;
     const IntervalType& op3 = (IntervalType&) operand3;
-    return new(h) SQLInterval(op1.supportsSQLnull() || op2.supportsSQLnull(),
+    return new(h) SQLInterval(h, op1.supportsSQLnull() || op2.supportsSQLnull(),
 			      op3.getStartField(),
 			      op3.getLeadingPrecision(),
 			      op3.getEndField(),
@@ -743,7 +740,6 @@ void DatetimeType::getRepresentableValue(const char* inValueString,
       **stringLiteral += "\'";
       **stringLiteral += valueString;
       **stringLiteral += "\'";
-
 //LCOV_EXCL_START : cnu -- SQ does not support old SQLMP stuff
       if (getSubtype() == SUBTYPE_SQLMPDatetime)
        {
@@ -1303,7 +1299,6 @@ double SQLTimestamp::getMaxValue()  const
 }
 
 
-
 //LCOV_EXCL_START : cnu -- SQ does not support old SQLMP stuff
 double SQLMPDatetime::encode(void *bufPtr) const
 {
@@ -1342,6 +1337,7 @@ NABoolean SQLMPDatetime::isSupportedType(void) const
     return TRUE;
  }
 
+
 // ***********************************************************************
 //
 //  SQLMPDatetime::synthesizeType
@@ -1350,19 +1346,19 @@ NABoolean SQLMPDatetime::isSupportedType(void) const
 
 //LCOV_EXCL_START : cnu -- SQ does not support old SQLMP stuff
 const NAType*SQLMPDatetime::synthesizeType(enum NATypeSynthRuleEnum synthRule,
-					   const NAType& operand1,
-					   const NAType& operand2,
-					   NAMemory* h,
-					   UInt32 *flags) const
+                                          const NAType& operand1,
+                                          const NAType& operand2,
+                                          NAMemory* h,
+                                          UInt32 *flags) const
 {
   if (!operand1.isSupportedType() || !operand2.isSupportedType())
     return NULL;
   else
     return DatetimeType::synthesizeType(synthRule,
-					operand1,
-					operand2,
-					h,
-					flags);
+                                       operand1,
+                                       operand2,
+                                       h,
+                                       flags);
 }
 //LCOV_EXCL_STOP : cnu
 
@@ -1381,6 +1377,7 @@ NABoolean SQLMPDatetime::isCompatible(const NAType& other, UInt32 * flags) const
     return DatetimeType::isCompatible(other, flags);
  }
 
+
 // ***********************************************************************
 //
 //  DatetimeValue : A datetime value

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/common/DatetimeType.h
----------------------------------------------------------------------
diff --git a/core/sql/common/DatetimeType.h b/core/sql/common/DatetimeType.h
index 0a1ea26..4655e76 100644
--- a/core/sql/common/DatetimeType.h
+++ b/core/sql/common/DatetimeType.h
@@ -147,12 +147,11 @@ public:
   // ---------------------------------------------------------------------
   // Constructors
   // ---------------------------------------------------------------------
-  DatetimeType (const NAString & adtName,
+  DatetimeType (NAMemory *h, const NAString & adtName,
                 NABoolean allowSQLnull,
                 rec_datetime_field startField,
                 rec_datetime_field endField,
-                UInt32 fractionPrecision = 0,
-                NAMemory * h=0);
+                UInt32 fractionPrecision = 0);
 
   // copy ctor
   DatetimeType (const DatetimeType & rhs, NAMemory * h=0) :
@@ -296,13 +295,12 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions 
   // ---------------------------------------------------------------------
-  SQLDate(NABoolean allowSQLnull = TRUE, NAMemory *h=0)
-       : DatetimeType (LiteralDate,
+  SQLDate(NAMemory *h, NABoolean allowSQLnull = TRUE)
+       : DatetimeType (h, LiteralDate,
                        allowSQLnull,
                        REC_DATE_YEAR,
                        REC_DATE_DAY,
-                       0,
-                       h) 
+                       0)
   {}
 
   // copy ctor
@@ -352,15 +350,13 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-  SQLTime(NABoolean allowSQLnull = TRUE, 
-	  UInt32 fractionPrecision = DEFAULT_FRACTION_PRECISION,
-          NAMemory *h=0)
-       : DatetimeType (LiteralTime,
+  SQLTime(NAMemory *h, NABoolean allowSQLnull = TRUE, 
+	  UInt32 fractionPrecision = DEFAULT_FRACTION_PRECISION)
+       : DatetimeType (h, LiteralTime,
                        allowSQLnull,
                        REC_DATE_HOUR,
                        REC_DATE_SECOND,
-                       fractionPrecision,
-                       h)
+                       fractionPrecision)
   {}
 
   // copy ctor
@@ -420,15 +416,13 @@ public:
   // Constructor functions
   // ---------------------------------------------------------------------
 
-  SQLTimestamp(NABoolean allowSQLnull = TRUE, 
-               UInt32 fractionPrecision = DEFAULT_FRACTION_PRECISION,
-               NAMemory * h=0)
-       : DatetimeType (LiteralTimestamp,
+  SQLTimestamp(NAMemory *h, NABoolean allowSQLnull = TRUE, 
+               UInt32 fractionPrecision = DEFAULT_FRACTION_PRECISION)
+       : DatetimeType (h, LiteralTimestamp,
                        allowSQLnull,
                        REC_DATE_YEAR,
                        REC_DATE_SECOND,
-                       fractionPrecision,
-                       h)
+                       fractionPrecision)
   {}
 
   // copy ctor
@@ -472,7 +466,7 @@ protected:
 private:
   
 }; // class SQLTimestamp
-#pragma warn(1506)  // warning elimination 
+#pragma warn(1506)   // warning elimination
 
 // ***********************************************************************
 //
@@ -484,19 +478,17 @@ class SQLMPDatetime : public DatetimeType
 {
 public:
 
-    SQLMPDatetime(rec_datetime_field startField,
+    SQLMPDatetime(NAMemory *h, rec_datetime_field startField,
                   rec_datetime_field endField,
                   NABoolean allowSQLnull = TRUE, 
-                  UInt32 fractionPrecision = DEFAULT_FRACTION_PRECISION,
-                  NAMemory * h=0)
-  : DatetimeType (LiteralDateTime,
+                  UInt32 fractionPrecision = DEFAULT_FRACTION_PRECISION)
+  : DatetimeType (h, LiteralDateTime,
                   allowSQLnull,
                   startField,
                   endField,
                   ((endField >= REC_DATE_SECOND) ?
                      fractionPrecision : 
-                                                  0),
-                  h)
+                                                  0))
   {}
 
         SQLMPDatetime (const SQLMPDatetime & rhs, NAMemory * h=0)
@@ -507,23 +499,24 @@ public:
         { return new (h) SQLMPDatetime(*this, h); }
 
         virtual double encode (void* bufPtr) const;
-   
-        virtual Lng32 getPrecision() const { return SQLDTCODE_MPDATETIME; } 
  
+        virtual Lng32 getPrecision() const { return SQLDTCODE_MPDATETIME; } 
+
         virtual Lng32 getScale() const { return getFractionPrecision(); }
 
         virtual NABoolean isCompatible(const NAType& other, UInt32 * flags = NULL) const;
   
         virtual const NAType* synthesizeType(enum NATypeSynthRuleEnum synthRule,     // in common\DateTime.cpp
-					     const NAType& operand1,
-					     const NAType& operand2,
-					     NAMemory* h,
-					     UInt32 *flags = NULL
-					     ) const;
+                                            const NAType& operand1,
+                                            const NAType& operand2,
+                                            NAMemory* h,
+                                            UInt32 *flags = NULL
+                                            ) const;
         virtual NABoolean isSupportedType() const;
 
 private:                                          
 };
+ 
 #pragma warn(1506)  // warning elimination 
 // ***********************************************************************
 //

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/common/IntervalType.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/IntervalType.cpp b/core/sql/common/IntervalType.cpp
index 9456816..8bce05c 100644
--- a/core/sql/common/IntervalType.cpp
+++ b/core/sql/common/IntervalType.cpp
@@ -425,7 +425,7 @@ const NAType* IntervalType::synthesizeType(enum NATypeSynthRuleEnum synthRule,
                                            fractionPrecision);
     if (totalPrecision > SQLInterval::MAX_LEADING_PRECISION)
       leadingPrecision -= totalPrecision - SQLInterval::MAX_LEADING_PRECISION;
-    return new(h) SQLInterval(
+    return new(h) SQLInterval(h,
 		 op1.supportsSQLnull() || op2.supportsSQLnull(),
 		 startField,
 		 leadingPrecision,
@@ -445,7 +445,7 @@ const NAType* IntervalType::synthesizeType(enum NATypeSynthRuleEnum synthRule,
 
     if ((op1.getLeadingPrecision() < leadingPrecision) ||
        (op2.supportsSQLnull() && !op1.supportsSQLnull()))
-      return new(h) SQLInterval (op1.supportsSQLnull() || op2.supportsSQLnull(),
+      return new(h) SQLInterval (h, op1.supportsSQLnull() || op2.supportsSQLnull(),
                                  op1.getStartField(),
                                  leadingPrecision,
                                  op1.getEndField(),
@@ -481,7 +481,7 @@ const NAType* IntervalType::synthesizeType(enum NATypeSynthRuleEnum synthRule,
                                            intervalOp->getFractionPrecision());
     if (totalPrecision > SQLInterval::MAX_LEADING_PRECISION)
       leadingPrecision -= totalPrecision - SQLInterval::MAX_LEADING_PRECISION;
-    return new(h) SQLInterval(
+    return new(h) SQLInterval(h,
 		 intervalOp->supportsSQLnull() || numericOp->supportsSQLnull(),
 		 intervalOp->getStartField(),
 		 leadingPrecision,
@@ -757,7 +757,7 @@ IntervalValue::IntervalValue
 						  endField,
 						  fractionPrecision);
   if (storageSize == 0) {
-    SQLInterval triggerErrmsg(FALSE,
+    SQLInterval triggerErrmsg(NULL, FALSE,
 			      startField, leadingPrecision,
 			      endField,   fractionPrecision);
     return;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/common/IntervalType.h
----------------------------------------------------------------------
diff --git a/core/sql/common/IntervalType.h b/core/sql/common/IntervalType.h
index 3947001..158ebc1 100644
--- a/core/sql/common/IntervalType.h
+++ b/core/sql/common/IntervalType.h
@@ -102,15 +102,14 @@ public:
   // Constructor functions
   // ---------------------------------------------------------------------
   IntervalType
-  ( NABoolean allowSQLnull
+  ( NAMemory *heap, NABoolean allowSQLnull
   , rec_datetime_field startField
   , UInt32 leadingPrec
   , rec_datetime_field endField
   , UInt32 fractionPrec = 0
-  , NAMemory * heap =0
   )
   : DatetimeIntervalCommonType
-  ( LiteralInterval //"INTERVAL"
+  ( heap, LiteralInterval //"INTERVAL"
   , NA_INTERVAL_TYPE
   , getStorageSize(startField, leadingPrec, endField, fractionPrec)
   , allowSQLnull
@@ -118,7 +117,7 @@ public:
   , endField
   , fractionPrec
   , getStorageSize(startField, leadingPrec, endField, fractionPrec)
-  , heap)
+  )
   , leadingPrecision_(leadingPrec)
   {                                         // this could be a valid interval if we change endField to SECOND
     if (endField == REC_DATE_FRACTION_MP && startField != REC_DATE_FRACTION_MP)
@@ -337,15 +336,14 @@ public:
   // Constructor functions
   // ---------------------------------------------------------------------
   SQLInterval
-  ( NABoolean allowSQLnull
+  ( NAMemory *h, NABoolean allowSQLnull
   , rec_datetime_field startField
   , UInt32 leadingPrec
   , rec_datetime_field endField
   , UInt32 fractionPrec = DEFAULT_FRACTION_PRECISION
-  , NAMemory *h=0
   )
-  : IntervalType(allowSQLnull, startField, leadingPrec, endField,
-                 endField >= REC_DATE_SECOND ? fractionPrec : 0, h)
+  : IntervalType(h, allowSQLnull, startField, leadingPrec, endField,
+                 endField >= REC_DATE_SECOND ? fractionPrec : 0)
   {}
 
 // copy ctor
@@ -391,21 +389,19 @@ public:
 
   // Constructors
   IntervalQualifier
-  ( rec_datetime_field startField
+  ( NAMemory *h, rec_datetime_field startField
   , UInt32 leadingPrec = DEFAULT_LEADING_PRECISION
-  , NAMemory *h = 0
   )
-  : SQLInterval(FALSE, startField, leadingPrec, startField, DEFAULT_FRACTION_PRECISION,h)
+  : SQLInterval(h, FALSE, startField, leadingPrec, startField, DEFAULT_FRACTION_PRECISION)
   {}
 
   IntervalQualifier
-  ( rec_datetime_field startField
+  ( NAMemory *h, rec_datetime_field startField
   , UInt32 leadingPrec
   , rec_datetime_field endField
   , UInt32 fractionPrec
-  , NAMemory *h=0
   )
-  : SQLInterval(FALSE, startField, leadingPrec, endField, fractionPrec,h)
+  : SQLInterval(h, FALSE, startField, leadingPrec, endField, fractionPrec)
   {}
 
 private:

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/common/MiscType.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/MiscType.cpp b/core/sql/common/MiscType.cpp
index 2ca1c38..0e00472 100644
--- a/core/sql/common/MiscType.cpp
+++ b/core/sql/common/MiscType.cpp
@@ -43,18 +43,16 @@
 //  SQLBooleanBase : The boolean data type
 //
 // ***********************************************************************
-SQLBooleanBase::SQLBooleanBase(NABoolean allowSQLnull,
-                       NABoolean isRelat,
-                       NAMemory * heap) :
-     NAType(LiteralBoolean,
+SQLBooleanBase::SQLBooleanBase(NAMemory *heap, NABoolean allowSQLnull,
+                       NABoolean isRelat) :
+     NAType(heap, LiteralBoolean,
             NA_BOOLEAN_TYPE,
             (isRelat ? 4 : 1),  // dataStorageSize
             allowSQLnull,
             (allowSQLnull ? SQL_NULL_HDR_SIZE : 0),
             FALSE,              // variableLength
             0,                  // lengthHeaderSize
-            (isRelat ? 4 : 1),  // dataAlignment
-            heap                
+            (isRelat ? 4 : 1)  // dataAlignment
             )
 { 
 }
@@ -80,16 +78,15 @@ NABoolean SQLBooleanBase::errorsCanOccur(const NAType& target, NABoolean lax) co
 //  SQLBooleanRelat : The boolean data type
 //
 // ***********************************************************************
-SQLBooleanRelat::SQLBooleanRelat(NABoolean sqlUnknownFlag,
-                                 NAMemory * heap) :
-     SQLBooleanBase(FALSE, TRUE, heap),
+SQLBooleanRelat::SQLBooleanRelat(NAMemory *heap, NABoolean sqlUnknownFlag) :
+     SQLBooleanBase(heap, FALSE, TRUE),
      sqlUnknownFlag_(sqlUnknownFlag)
 { 
 }
 
 NAType * SQLBooleanRelat::newCopy(CollHeap* h) const
 {
-  return new(h) SQLBooleanRelat(sqlUnknownFlag_, h);
+  return new(h) SQLBooleanRelat(h, sqlUnknownFlag_);
 }
 
 // ***********************************************************************
@@ -121,7 +118,7 @@ const NAType* SQLBooleanRelat::synthesizeType(enum NATypeSynthRuleEnum synthRule
   // expressions.
   //
   if (synthRule == SYNTH_RULE_UNION)
-    return new(h) SQLBooleanRelat();
+    return new(h) SQLBooleanRelat(h);
 
   return NULL;
 } // synthesizeType()
@@ -132,15 +129,14 @@ const NAType* SQLBooleanRelat::synthesizeType(enum NATypeSynthRuleEnum synthRule
 //  SQLBooleanNative : The boolean data type
 //
 // ***********************************************************************
-SQLBooleanNative::SQLBooleanNative(NABoolean allowSQLnull,
-                                 NAMemory * heap) :
-     SQLBooleanBase(allowSQLnull, FALSE, heap)
+SQLBooleanNative::SQLBooleanNative(NAMemory *heap, NABoolean allowSQLnull) :
+     SQLBooleanBase(heap, allowSQLnull, FALSE)
 { 
 }
 
 NAType * SQLBooleanNative::newCopy(CollHeap* h) const
 {
-  return new(h) SQLBooleanNative(supportsSQLnull(), h);
+  return new(h) SQLBooleanNative(h, supportsSQLnull());
 }
 
 // ***********************************************************************
@@ -173,7 +169,7 @@ const NAType* SQLBooleanNative::synthesizeType(enum NATypeSynthRuleEnum synthRul
   //
   if (synthRule == SYNTH_RULE_UNION)
     return new(h) SQLBooleanNative
-      (operand1.supportsSQLnull() || operand2.supportsSQLnull());
+      (h, operand1.supportsSQLnull() || operand2.supportsSQLnull());
 
   return NULL;
 } // synthesizeType()
@@ -219,8 +215,8 @@ void SQLBooleanNative::maxRepresentableValue(void* bufPtr, Lng32* bufLen,
 //  SQLRecord : The record data type
 //
 // ***********************************************************************
-SQLRecord::SQLRecord(const NAType * elementType, const SQLRecord * restOfRecord,NAMemory * heap) :
-   NAType(LiteralRecord,
+SQLRecord::SQLRecord(NAMemory *heap, const NAType * elementType, const SQLRecord * restOfRecord) :
+   NAType(heap, LiteralRecord,
           NA_RECORD_TYPE,
           elementType->getTotalSize() +
                 (restOfRecord ? restOfRecord->getTotalSize()
@@ -231,8 +227,7 @@ SQLRecord::SQLRecord(const NAType * elementType, const SQLRecord * restOfRecord,
           0,                                      // SQLnullHdrSize
           FALSE,                                  // variableLength
           0,                                      // lengthHeaderSize
-          4,                                       // dataAlignment
-          heap),
+          4),                                       // dataAlignment
     elementType_(elementType),
     restOfRecord_(restOfRecord)
 {
@@ -244,7 +239,7 @@ SQLRecord::SQLRecord(const NAType * elementType, const SQLRecord * restOfRecord,
 
 NAType * SQLRecord::newCopy(CollHeap* h) const
 {
-  return new(h) SQLRecord(elementType_, restOfRecord_,h);
+  return new(h) SQLRecord(h, elementType_, restOfRecord_);
 }
 
 short SQLRecord::getFSDatatype() const 
@@ -351,9 +346,9 @@ NABoolean SQLRecord::errorsCanOccur(const NAType& target, NABoolean lax) const
 //  supported by SQL/MX.
 // ***********************************************************************
 
-SQLRowset::SQLRowset(NAType *elementType, Lng32 maxNumElements, 
-                     Lng32 numElements,NAMemory * heap) : 
-  NAType(LiteralRowset
+SQLRowset::SQLRowset(NAMemory *heap, NAType *elementType, Lng32 maxNumElements, 
+                     Lng32 numElements) : 
+  NAType(heap, LiteralRowset
          ,NA_ROWSET_TYPE
          ,elementType->getNominalSize()
          ,elementType->supportsSQLnull()
@@ -440,7 +435,7 @@ void SQLRowset::print(FILE* ofd, const char* indent)
 
 NAType * SQLRowset::newCopy(CollHeap* h) const
 {
-  return new(h) SQLRowset(elementType_, maxNumElements_, numElements_,h);
+  return new(h) SQLRowset(h, elementType_, maxNumElements_, numElements_);
 }
 
 NAType * SQLRowset::getElementType() const
@@ -476,7 +471,7 @@ const NAType* SQLRowset::synthesizeType(enum NATypeSynthRuleEnum synthRule,
     return NULL;
   }
 
-  return new(h) SQLRowset(elementType_, maxNumElements_, numElements_,h);
+  return new(h) SQLRowset(h, elementType_, maxNumElements_, numElements_);
 }
 
 Lng32 SQLRowset::getNumElements() const

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/common/MiscType.h
----------------------------------------------------------------------
diff --git a/core/sql/common/MiscType.h b/core/sql/common/MiscType.h
index e06d8f8..4a5c749 100644
--- a/core/sql/common/MiscType.h
+++ b/core/sql/common/MiscType.h
@@ -68,9 +68,8 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-  SQLBooleanBase(NABoolean allowSQLnull,
-             NABoolean isRelat,
-             NAMemory * heap=0);
+  SQLBooleanBase(NAMemory *heap, NABoolean allowSQLnull,
+             NABoolean isRelat);
 
   // ---------------------------------------------------------------------
   // A method which tells if a conversion error can occur when converting
@@ -93,8 +92,7 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-  SQLBooleanRelat(NABoolean sqlUnknownFlag = TRUE,
-                  NAMemory * heap=0);
+  SQLBooleanRelat(NAMemory *heap, NABoolean sqlUnknownFlag = TRUE);
   
   // ---------------------------------------------------------------------
   // A virtual function to return a copy of the type.
@@ -138,8 +136,7 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-  SQLBooleanNative(NABoolean allowSQLnull,
-                  NAMemory * heap=0);
+  SQLBooleanNative(NAMemory *heap, NABoolean allowSQLnull);
   
   // ---------------------------------------------------------------------
   // A virtual function to return a copy of the type.
@@ -192,8 +189,8 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-  SQLRowset(NAType *elementType, Lng32 maxNumElements, 
-            Lng32 numElements,NAMemory * heap=0);
+  SQLRowset(NAMemory *heap, NAType *elementType, Lng32 maxNumElements, 
+            Lng32 numElements);
   
   // ---------------------------------------------------------------------
   // Are the two types compatible?
@@ -281,9 +278,8 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-  SQLRecord(const NAType * elementType,
-            const SQLRecord * restOfRecord,
-			NAMemory * heap=0);
+  SQLRecord(NAMemory *heap, const NAType * elementType,
+            const SQLRecord * restOfRecord);
 
   // ---------------------------------------------------------------------
   // A virtual function to return a copy of the type.
@@ -350,8 +346,8 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-  SQLUnknown(NABoolean supportsSQLnull = FALSE,CollHeap * heap=0)
-  : NAType(LiteralUnknown, NA_UNKNOWN_TYPE, 2, supportsSQLnull, SQL_NULL_HDR_SIZE,FALSE,0,1,heap) {}
+  SQLUnknown(NAMemory *heap, NABoolean supportsSQLnull = FALSE)
+  : NAType(heap, LiteralUnknown, NA_UNKNOWN_TYPE, 2, supportsSQLnull, SQL_NULL_HDR_SIZE,FALSE,0,1) {}
   // copy ctor
   SQLUnknown(const SQLUnknown &unknown,NAMemory * heap=0)
 	  :NAType(unknown,heap)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/common/NAString.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/NAString.cpp b/core/sql/common/NAString.cpp
index 133aced..7431bff 100644
--- a/core/sql/common/NAString.cpp
+++ b/core/sql/common/NAString.cpp
@@ -265,14 +265,6 @@ NAString LongToNAString(Lng32 l)
   return NAString(resultstr);
 }
 
-NAString LongToNAString(Lng32 l, NAHeap *heap)
-{
-  char resultstr[100];
-  sprintf(resultstr,"%d",l);
-  return NAString(resultstr, heap);
-}
-
-
 NAString UnsignedToNAString(UInt32 u)
 {
   char resultstr[100];

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/common/NAString.h
----------------------------------------------------------------------
diff --git a/core/sql/common/NAString.h b/core/sql/common/NAString.h
index b907cf4..10fd288 100644
--- a/core/sql/common/NAString.h
+++ b/core/sql/common/NAString.h
@@ -102,7 +102,6 @@ Lng32      NAStringToLong(const NAString &ns);
 double    NAStringToReal(const NAString &ns);
 UInt32  NAStringToUnsigned(const NAString &ns);
 NAString  LongToNAString(Lng32 l);
-NAString  LongToNAString(Lng32 l, NAHeap *heap);
 NAString  RealToNAString(double d);
 NAString  UnsignedToNAString(UInt32 u);
 NAString  Int64ToNAString(Int64 l);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/common/NAType.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/NAType.cpp b/core/sql/common/NAType.cpp
index 716c615..73595f4 100644
--- a/core/sql/common/NAType.cpp
+++ b/core/sql/common/NAType.cpp
@@ -78,15 +78,15 @@ NAType::NAType (const NAType & rhs, NAMemory * h)
        displayDataType_ (rhs.displayDataType_, h)
 {}
 
-NAType::NAType( const NAString&    adtName,
+NAType::NAType( NAMemory *h, 
+                const NAString&    adtName,
                 NABuiltInTypeEnum  ev,
                 Lng32               dataStorageSize,
                 NABoolean          nullable,
                 Lng32               SQLnullHdrSize,
                 NABoolean          varLenFlag,
                 Lng32               lengthHdrSize,
-                Lng32               dataAlignment,
-                NAMemory *         h
+                Lng32               dataAlignment
                 ) : typeName_ (h) // memleak fix
                   , displayDataType_ (h)
 {
@@ -556,14 +556,14 @@ Lng32 NAType::getDisplayLength(Lng32 datatype,
 
     case REC_NUM_BIG_SIGNED:
       {
-	SQLBigNum tmp(precision,scale,FALSE,TRUE,FALSE,NULL);
+	SQLBigNum tmp(NULL, precision,scale,FALSE,TRUE,FALSE);
 	d_len = tmp.getDisplayLength();
       }
       break;
 
     case REC_NUM_BIG_UNSIGNED:
       {
-	SQLBigNum tmp(precision,scale,FALSE,FALSE,FALSE,NULL);
+	SQLBigNum tmp(NULL, precision,scale,FALSE,FALSE,FALSE);
 	d_len = tmp.getDisplayLength();
       }
       break;
@@ -622,7 +622,7 @@ Lng32 NAType::getDisplayLength(Lng32 datatype,
         rec_datetime_field startField;
         rec_datetime_field endField;
         getIntervalFields(datatype, startField, endField);
-        SQLInterval interval(FALSE,
+        SQLInterval interval(NULL, FALSE,
                              startField,
                              (UInt32) precision,
                              endField,
@@ -966,22 +966,22 @@ NAType* NAType::getNATypeForHive(const char* hiveType, NAMemory* heap)
   if ( !strcmp(hiveType, "tinyint"))
     {
       if (CmpCommon::getDefault(TRAF_TINYINT_SUPPORT) == DF_OFF)
-        return new (heap) SQLSmall(TRUE /* neg */, TRUE /* allow NULL*/, heap);
+        return new (heap) SQLSmall(heap, TRUE /* neg */, TRUE /* allow NULL*/);
       else
-        return new (heap) SQLTiny(TRUE /* neg */, TRUE /* allow NULL*/, heap);
+        return new (heap) SQLTiny(heap, TRUE /* neg */, TRUE /* allow NULL*/);
     }
 
   if ( !strcmp(hiveType, "smallint"))
-    return new (heap) SQLSmall(TRUE /* neg */, TRUE /* allow NULL*/, heap);
+    return new (heap) SQLSmall(heap, TRUE /* neg */, TRUE /* allow NULL*/);
  
   if ( !strcmp(hiveType, "int")) 
-    return new (heap) SQLInt(TRUE /* neg */, TRUE /* allow NULL*/, heap);
+    return new (heap) SQLInt(heap, TRUE /* neg */, TRUE /* allow NULL*/);
 
   if ( !strcmp(hiveType, "bigint"))
-    return new (heap) SQLLargeInt(TRUE /* neg */, TRUE /* allow NULL*/, heap);
+    return new (heap) SQLLargeInt(heap, TRUE /* neg */, TRUE /* allow NULL*/);
 
   if ( !strcmp(hiveType, "boolean"))
-    return new (heap) SQLBooleanNative(TRUE, heap);
+    return new (heap) SQLBooleanNative(heap, TRUE);
  
   if ( !strcmp(hiveType, "string"))
     {
@@ -993,7 +993,7 @@ NAType* NAType::getNATypeForHive(const char* hiveType, NAMemory* heap)
       Int32 maxNumChars = 0;
       Int32 storageLen = lenInBytes;
       SQLVarChar * nat = 
-        new (heap) SQLVarChar(CharLenInfo(maxNumChars, storageLen),
+        new (heap) SQLVarChar(heap, CharLenInfo(maxNumChars, storageLen),
                               TRUE, // allow NULL
                               FALSE, // not upshifted
                               FALSE, // not case-insensitive
@@ -1005,16 +1005,16 @@ NAType* NAType::getNATypeForHive(const char* hiveType, NAMemory* heap)
     }
   
   if ( !strcmp(hiveType, "float"))
-    return new (heap) SQLReal(TRUE /* allow NULL*/, heap);
+    return new (heap) SQLReal(heap, TRUE /* allow NULL*/);
 
   if ( !strcmp(hiveType, "double"))
-    return new (heap) SQLDoublePrecision(TRUE /* allow NULL*/, heap);
+    return new (heap) SQLDoublePrecision(heap, TRUE /* allow NULL*/);
 
   if ( !strcmp(hiveType, "timestamp"))
-    return new (heap) SQLTimestamp(TRUE /* allow NULL */ , 6, heap);
+    return new (heap) SQLTimestamp(heap, TRUE /* allow NULL */ , 6);
 
   if ( !strcmp(hiveType, "date"))
-    return new (heap) SQLDate(TRUE /* allow NULL */ , heap);
+    return new (heap) SQLDate(heap, TRUE /* allow NULL */);
 
   if ( (!strncmp(hiveType, "varchar", 7)) ||
        (!strncmp(hiveType, "char", 4)))
@@ -1059,7 +1059,7 @@ NAType* NAType::getNATypeForHive(const char* hiveType, NAMemory* heap)
     }
 
     if (!strncmp(hiveType, "char", 4))
-      return new (heap) SQLChar(CharLenInfo(maxNumChars, storageLen),
+      return new (heap) SQLChar(heap, CharLenInfo(maxNumChars, storageLen),
                                 TRUE, // allow NULL
                                 FALSE, // not upshifted
                                 FALSE, // not case-insensitive
@@ -1068,7 +1068,7 @@ NAType* NAType::getNATypeForHive(const char* hiveType, NAMemory* heap)
                                 CharInfo::DefaultCollation,
                                 CharInfo::IMPLICIT);
     else
-      return new (heap) SQLVarChar(CharLenInfo(maxNumChars, storageLen),
+      return new (heap) SQLVarChar(heap, CharLenInfo(maxNumChars, storageLen),
                                    TRUE, // allow NULL
                                    FALSE, // not upshifted
                                    FALSE, // not case-insensitive
@@ -1128,14 +1128,14 @@ NAType* NAType::getNATypeForHive(const char* hiveType, NAMemory* heap)
     if( (p>0) && (p <= MAX_PRECISION_ALLOWED) ) //have precision between 1 - 18
     {
       if( ( s >=0 )  &&  ( s<= p) ) //have valid scale
-        return new (heap) SQLDecimal( p, s, TRUE, TRUE);
+        return new (heap) SQLDecimal(heap, p, s, TRUE, TRUE);
       else
         return NULL;
     }
     else if( p > MAX_PRECISION_ALLOWED)  
     {
       if ( (s>=0) && ( s<= p ) ) //have valid scale
-        return new (heap) SQLBigNum( p, s, TRUE, TRUE, TRUE, NULL);
+        return new (heap) SQLBigNum(heap, p, s, TRUE, TRUE, TRUE);
       else
         return NULL;
     }
@@ -1143,7 +1143,7 @@ NAType* NAType::getNATypeForHive(const char* hiveType, NAMemory* heap)
     else if( ( p == -1 ) && ( s == -1 ) )
     {
       // hive define decimal as decimal ( 10, 0 )
-      return new (heap) SQLDecimal( 10, 0, TRUE, TRUE);
+      return new (heap) SQLDecimal(heap, 10, 0, TRUE, TRUE);
     }
     else
     {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/common/NAType.h
----------------------------------------------------------------------
diff --git a/core/sql/common/NAType.h b/core/sql/common/NAType.h
index 238aa4d..c66a121 100644
--- a/core/sql/common/NAType.h
+++ b/core/sql/common/NAType.h
@@ -140,22 +140,21 @@ class NAType : public NABasicObject
 public:
 
   // copy ctor
-  NAType (const NAType & rhs, NAMemory * h=0) ;
+  NAType (const NAType & rhs, NAMemory * h) ;
 
   // ---------------------------------------------------------------------
   // Constructor function (storage size and alignment needs to be
   // specified for data field only, null indicator and variable len
   // field are handled automatically)
   // ---------------------------------------------------------------------
-  NAType (const NAString &   adtName,
+  NAType (NAMemory *h, const NAString &   adtName,
           NABuiltInTypeEnum  ev,
           Lng32               dataStorageSize,
           NABoolean          nullable = FALSE,
           Lng32               SQLnullHdrSize = 0,
           NABoolean          variableLength = FALSE,
           Lng32               lengthHeaderSize = 0,
-          Lng32               dataAlignment = 1,
-          NAMemory *         h=0
+          Lng32               dataAlignment = 1
         );
 
   // ---------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/common/NumericType.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/NumericType.cpp b/core/sql/common/NumericType.cpp
index 2ee1e5c..cce8b00 100644
--- a/core/sql/common/NumericType.cpp
+++ b/core/sql/common/NumericType.cpp
@@ -199,22 +199,20 @@ enum NumericType::NumericTypeEnum
 // The constructor
 // -----------------------------------------------------------------------
 
-NumericType::NumericType( const NAString&  adtName,
+NumericType::NumericType(NAMemory *heap, const NAString&  adtName,
 			 Lng32             dataStorageSize,
 			 Lng32             precision,
 			 Lng32             scale,
 			 Lng32             alignment,
 			 NABoolean        allowNegValues,
 			 NABoolean        allowSQLnull,
-			 NABoolean        varLenFlag,
-			 CollHeap * heap
+			 NABoolean        varLenFlag
 			)
-		  : NAType(adtName, NA_NUMERIC_TYPE, dataStorageSize,
+		  : NAType(heap, adtName, NA_NUMERIC_TYPE, dataStorageSize,
 			   allowSQLnull, SQL_NULL_HDR_SIZE
 			   , varLenFlag
 			   , ( varLenFlag ? SQL_VARCHAR_HDR_SIZE : 0 )
 			   , alignment
-			   , heap
 			   )
 {
   assert (scale <= precision);
@@ -584,11 +582,11 @@ const NAType* NumericType::synthesizeType(enum NATypeSynthRuleEnum synthRule,
 
       switch (size) {
       case SQL_SMALL_SIZE:
-        return new(h) SQLSmall(isSigned, isNullable);
+        return new(h) SQLSmall(h, isSigned, isNullable);
       case SQL_INT_SIZE:
-        return new(h) SQLInt(isSigned, isNullable);
+        return new(h) SQLInt(h, isSigned, isNullable);
       case SQL_LARGE_SIZE:
-        return new(h) SQLLargeInt(isSigned, isNullable);
+        return new(h) SQLLargeInt(h, isSigned, isNullable);
       default:
         return NULL;
       }
@@ -712,18 +710,17 @@ const NAType* NumericType::synthesizeType(enum NATypeSynthRuleEnum synthRule,
     // If the hardware doesn't support a binary numeric of the result's
     // precision, make the result a Big Num.
     //
-    return new(h) SQLBigNum(precision,
+    return new(h) SQLBigNum(h, precision,
 			    scale,
 			    isRealBigNum,
 			    isSigned,
-			    isNullable,
-			    NULL);
+			    isNullable);
   }
   //
   // If the result is DECIMAL, return a DECIMAL.
   //
   if (isDecimal)
-    return new(h) SQLDecimal(precision, scale, isSigned, isNullable);
+    return new(h) SQLDecimal(h, precision, scale, isSigned, isNullable);
   //
   // If the precision is more than 9, it must be signed.
   //
@@ -743,12 +740,12 @@ const NAType* NumericType::synthesizeType(enum NATypeSynthRuleEnum synthRule,
   //
   if (makeLargeint)
     {
-      NumericType * nat = new(h) SQLLargeInt(isSigned, isNullable);
+      NumericType * nat = new(h) SQLLargeInt(h,isSigned, isNullable);
       nat->setScale(scale);
       return nat;
     }
   else
-    return new(h) SQLNumeric(size, precision, scale, isSigned, isNullable);
+    return new(h) SQLNumeric(h, size, precision, scale, isSigned, isNullable);
 }
 
 // -----------------------------------------------------------------------
@@ -847,9 +844,9 @@ NABoolean NumericType::isEncodingNeeded() const
 //  Methods for SQLTiny
 // -----------------------------------------------------------------------
 
-SQLTiny::SQLTiny(NABoolean allowNegValues, NABoolean allowSQLnull,CollHeap * heap)
+SQLTiny::SQLTiny(NAMemory *heap, NABoolean allowNegValues, NABoolean allowSQLnull)
      : NumericType
-       ( LiteralTinyInt
+       ( heap, LiteralTinyInt
          , SQL_TINY_SIZE
          , (allowNegValues ? SQL_SMALL_PRECISION:SQL_USMALL_PRECISION)
          , 0
@@ -857,7 +854,6 @@ SQLTiny::SQLTiny(NABoolean allowNegValues, NABoolean allowSQLnull,CollHeap * hea
          , allowNegValues
          , allowSQLnull
          ,FALSE
-         ,heap
          )
 {
 } // SQLTiny()
@@ -965,9 +961,9 @@ NAString* SQLTiny::convertToString(double v, CollHeap* h) const
 //  Methods for SQLSmall
 // -----------------------------------------------------------------------
 
-SQLSmall::SQLSmall(NABoolean allowNegValues, NABoolean allowSQLnull,CollHeap * heap)
+SQLSmall::SQLSmall(NAMemory *heap, NABoolean allowNegValues, NABoolean allowSQLnull)
         : NumericType
-            ( LiteralSmallInt
+            ( heap, LiteralSmallInt
 	    , SQL_SMALL_SIZE
             , (allowNegValues ? SQL_SMALL_PRECISION:SQL_USMALL_PRECISION)
 	    , 0
@@ -975,7 +971,6 @@ SQLSmall::SQLSmall(NABoolean allowNegValues, NABoolean allowSQLnull,CollHeap * h
 	    , allowNegValues
             , allowSQLnull
 			,FALSE
-			,heap
             )
 {
 } // SQLSmall()
@@ -1084,11 +1079,10 @@ NAString* SQLSmall::convertToString(double v, CollHeap* h) const
 // -----------------------------------------------------------------------
 
 #pragma nowarn(1506)   // warning elimination
-SQLBPInt::SQLBPInt(UInt32 declared,
+SQLBPInt::SQLBPInt(NAMemory *heap, UInt32 declared,
 		   NABoolean allowSQLnull,
-		   NABoolean allowNegValues,
-		   CollHeap * heap)
-      : NumericType (LiteralBPInt	 // ADT Name
+		   NABoolean allowNegValues)
+      : NumericType (heap, LiteralBPInt	 // ADT Name
 		   , SQL_SMALL_SIZE      // StorageSize
 		   , declared	         // Precision
 		   , 0		         // Scale
@@ -1096,7 +1090,6 @@ SQLBPInt::SQLBPInt(UInt32 declared,
 		   , allowNegValues
 		   , allowSQLnull
 		   , FALSE
-		   , heap
 		    )
 {
   assert (declared > 0 && declared < 16); // size between 1 & 15
@@ -1203,9 +1196,9 @@ NAString* SQLBPInt::convertToString(double v, CollHeap* h) const
 //  Methods for SQLInt
 // -----------------------------------------------------------------------
 
-SQLInt::SQLInt(NABoolean allowNegValues, NABoolean allowSQLnull,CollHeap * heap)
+SQLInt::SQLInt(NAMemory *heap, NABoolean allowNegValues, NABoolean allowSQLnull)
       : NumericType
-	  ( LiteralInteger
+	  ( heap, LiteralInteger
 	  , SQL_INT_SIZE
           , (allowNegValues ? SQL_INT_PRECISION:SQL_UINT_PRECISION)
 	  , 0
@@ -1213,7 +1206,6 @@ SQLInt::SQLInt(NABoolean allowNegValues, NABoolean allowSQLnull,CollHeap * heap)
 	  , allowNegValues
           , allowSQLnull
 		  ,FALSE
-		  ,heap
           )
 {
 } // SQLInt()
@@ -1332,10 +1324,9 @@ NAString* SQLInt::convertToString(double v, CollHeap* h) const
 //  Methods for SQLLargeInt
 // -----------------------------------------------------------------------
 
-SQLLargeInt::SQLLargeInt(NABoolean allowNegValues, NABoolean allowSQLnull,
-			 CollHeap * heap)
+SQLLargeInt::SQLLargeInt(NAMemory *heap, NABoolean allowNegValues, NABoolean allowSQLnull)
       : NumericType
-	  ( LiteralLargeInt
+	  ( heap, LiteralLargeInt
 	  , 8/*SQL_L_INT_SIZE */
           , SQL_LARGE_PRECISION
 	  , 0
@@ -1343,17 +1334,15 @@ SQLLargeInt::SQLLargeInt(NABoolean allowNegValues, NABoolean allowSQLnull,
 	  , allowNegValues
           , allowSQLnull
 		  ,FALSE
-		  ,heap
           )
 {
 }   // SQLLargeInt()
 
-SQLLargeInt::SQLLargeInt(Lng32 scale,
+SQLLargeInt::SQLLargeInt(NAMemory *heap, Lng32 scale,
 			 UInt16 disAmbiguate,
-			 NABoolean allowNegValues, NABoolean allowSQLnull,
-			 CollHeap * heap)
+			 NABoolean allowNegValues, NABoolean allowSQLnull)
       : NumericType
-	  ( LiteralLargeInt
+	  ( heap, LiteralLargeInt
 	  , 8/*SQL_L_INT_SIZE */
           , SQL_LARGE_PRECISION
 	  , scale
@@ -1361,7 +1350,6 @@ SQLLargeInt::SQLLargeInt(Lng32 scale,
 	  , allowNegValues
           , allowSQLnull
 		  ,FALSE
-		  ,heap
           )
 {
 }   // SQLLargeInt()
@@ -1479,8 +1467,8 @@ NAString* SQLLargeInt::convertToString(double v, CollHeap* h) const
 //  Methods for SQLBigInt
 // -----------------------------------------------------------------------
 
-SQLBigInt::SQLBigInt(NABoolean allowNegValues, NABoolean allowSQLnull,CollHeap * heap)
-  : SQLLargeInt(allowNegValues, allowSQLnull,heap)
+SQLBigInt::SQLBigInt(NAMemory *heap, NABoolean allowNegValues, NABoolean allowSQLnull)
+  : SQLLargeInt(heap, allowNegValues, allowSQLnull)
 {
   setClientDataType("BIGINT");
 }
@@ -1489,11 +1477,10 @@ SQLBigInt::SQLBigInt(NABoolean allowNegValues, NABoolean allowSQLnull,CollHeap *
 //  Methods for SQLNumeric
 // -----------------------------------------------------------------------
 
-SQLNumeric::SQLNumeric(Lng32 length, Lng32 precision, Lng32 scale,
-		       NABoolean allowNegValues, NABoolean allowSQLnull,
-			   CollHeap * heap)
+SQLNumeric::SQLNumeric(NAMemory *heap, Lng32 length, Lng32 precision, Lng32 scale,
+		       NABoolean allowNegValues, NABoolean allowSQLnull)
 : NumericType
-  ( LiteralNumeric
+  ( heap, LiteralNumeric
    , length
    , precision
    , scale
@@ -1501,7 +1488,6 @@ SQLNumeric::SQLNumeric(Lng32 length, Lng32 precision, Lng32 scale,
    , allowNegValues
    , allowSQLnull
    ,FALSE
-   ,heap
    )
 {
 } // SQLNumeric()
@@ -1509,11 +1495,11 @@ SQLNumeric::SQLNumeric(Lng32 length, Lng32 precision, Lng32 scale,
 
 // Note: DisAmbiguate arg added so Compiler can distinguish between
 //       this constructor and the one above...for 64bit project.
-SQLNumeric::SQLNumeric(NABoolean allowNegValues, Lng32 precision, Lng32 scale,
+SQLNumeric::SQLNumeric(NAMemory *heap, NABoolean allowNegValues, Lng32 precision, Lng32 scale,
                        const Int16 DisAmbiguate,
                        NABoolean allowSQLnull)
 : NumericType
-  ( LiteralNumeric
+  ( heap, LiteralNumeric
    , getBinaryStorageSize(precision)
    , precision
    , scale
@@ -1996,12 +1982,11 @@ double SQLNumeric::getMaxValue() const
 //  Methods for SQLDecimal
 // -----------------------------------------------------------------------
 
-SQLDecimal::SQLDecimal(Lng32 length, Lng32 scale,
+SQLDecimal::SQLDecimal(NAMemory *heap, Lng32 length, Lng32 scale,
 		       NABoolean allowNegValues,
-		       NABoolean allowSQLnull,
-			   CollHeap * heap)
+		       NABoolean allowSQLnull)
 : NumericType
-  ( LiteralDecimal
+  ( heap, LiteralDecimal
    , length
    , length
    , scale
@@ -2009,7 +1994,6 @@ SQLDecimal::SQLDecimal(Lng32 length, Lng32 scale,
    , allowNegValues
    , allowSQLnull
    ,FALSE
-   ,heap
    )
 {
 } // SQLDecimal()
@@ -2185,13 +2169,12 @@ double SQLDecimal::getMaxValue()  const
 // methods for class SQLBigNum
 // ------------------------------------------------------
 
-SQLBigNum::SQLBigNum(Lng32 precision, Lng32 scale,
+SQLBigNum::SQLBigNum(NAMemory *heap, Lng32 precision, Lng32 scale,
 		     NABoolean isARealBigNum,
 		     NABoolean allowNegValues,
-		     NABoolean allowSQLnull,
-		     CollHeap * heap)
+		     NABoolean allowSQLnull)
 : NumericType
-  ( LiteralBigNum
+  ( heap, LiteralBigNum
    , BigNumHelper::ConvPrecisionToStorageLengthHelper(precision)
    , precision
    , scale
@@ -2199,7 +2182,6 @@ SQLBigNum::SQLBigNum(Lng32 precision, Lng32 scale,
    , allowNegValues
    , allowSQLnull
    , FALSE
-   , heap
    ),
   isARealBigNum_(isARealBigNum)
 {
@@ -2295,12 +2277,11 @@ const NAType* SQLBigNum::synthesizeType(
     return NULL;
   }
 
-  return new(h) SQLBigNum(precision,
+  return new(h) SQLBigNum(h, precision,
                           scale,
                           isRealBigNum,
                           isSigned,
-                          isNullable,
-			  NULL);
+                          isNullable);
 }
 
 double SQLBigNum::getNormalizedValue(void* buf) const
@@ -2451,10 +2432,10 @@ NAType* SQLBigNum::closestEquivalentExternalType(CollHeap* heap)const
 //  Methods for LSDecimal
 // -----------------------------------------------------------------------
 
-LSDecimal::LSDecimal(Lng32 length, Lng32 scale,
-		     NABoolean allowSQLnull,CollHeap * heap)
+LSDecimal::LSDecimal(NAMemory *heap, Lng32 length, Lng32 scale,
+		     NABoolean allowSQLnull)
 : NumericType
-( LiteralLSDecimal
+( heap, LiteralLSDecimal
   , length + 1    // first byte is sign, i.e., stargae size is length + 1
   , length
   , scale
@@ -2462,7 +2443,6 @@ LSDecimal::LSDecimal(Lng32 length, Lng32 scale,
   , TRUE
   , allowSQLnull
   ,FALSE
-  ,heap
   )
 {
 } // LSDecimal()
@@ -2584,8 +2564,8 @@ const NAType* SQLFloat::synthesizeType(enum NATypeSynthRuleEnum synthRule,
     return NULL;
   }
   precision = MINOF(precision, SQL_DOUBLE_PRECISION);
-  //  return new(h) SQLFloat(isNullable, precision);
-  return new(h) SQLDoublePrecision(isNullable, h, precision);
+  //  return new(h) SQLFloat(h, isNullable, precision);
+  return new(h) SQLDoublePrecision(h, isNullable, precision);
 }
 
 double SQLFloat::encode (void* bufPtr) const

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/common/NumericType.h
----------------------------------------------------------------------
diff --git a/core/sql/common/NumericType.h b/core/sql/common/NumericType.h
index 2dd513c..09c4bd8 100644
--- a/core/sql/common/NumericType.h
+++ b/core/sql/common/NumericType.h
@@ -247,22 +247,22 @@ public:
   // A virtual function to return a copy of the type.
   // ---------------------------------------------------------------------
   virtual NAType *newCopy(CollHeap* h=0) const 
-    { return new(h) NumericType(*this,h); }
+    { return new(h) NumericType(*this, h); }
 
 protected:
 
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-  NumericType ( const NAString&  adtName, 
+  NumericType ( NAMemory *heap,
+                       const NAString&  adtName, 
 	    	       Lng32             dataStorageSize,
 		       Lng32             precision,
 		       Lng32             scale,
 		       Lng32             alignment,
 		       NABoolean        allowNegValues = TRUE,
 		       NABoolean        allowSQLnull = TRUE,
- 		       NABoolean        varLenFlag = FALSE,
-			   CollHeap * heap = 0
+ 		       NABoolean        varLenFlag = FALSE
                      );
    NumericType ( const NumericType& numeric, CollHeap * heap =0);
 
@@ -363,10 +363,9 @@ class SQLBPInt : public NumericType
 {
 public: 
   // Constructor function
-   SQLBPInt (UInt32 declared, 
+   SQLBPInt (NAMemory *heap, UInt32 declared, 
                    NABoolean allowSQLnull = TRUE, 
-                   NABoolean allowNegValues = FALSE,
-				   CollHeap * heap=0
+                   NABoolean allowNegValues = FALSE
                   );
 
   short getFSDatatype () const
@@ -433,7 +432,7 @@ public:
   // ---------------------------------------------------------------------
   virtual NAType *newCopy(CollHeap* h=0) const
   {
-    return new(h) SQLBPInt(declaredSize_, supportsSQLnull(), !isUnsigned(),h);
+    return new(h) SQLBPInt(h, declaredSize_, supportsSQLnull(), !isUnsigned());
   }
 
 private:
@@ -452,10 +451,8 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-  SQLTiny (NABoolean allowNegValues = TRUE, 
-           NABoolean allowSQLnull = TRUE,
-           CollHeap * heap =0);
-  
+  SQLTiny (NAMemory *heap, NABoolean allowNegValues = TRUE, 
+           NABoolean allowSQLnull = TRUE);
    short getFSDatatype() const
     {
       if (isUnsigned())
@@ -517,8 +514,8 @@ public:
   // ---------------------------------------------------------------------
   virtual NAType *newCopy(CollHeap* h=0) const
   {
-    return new(h) SQLTiny(!isUnsigned()
-                          ,supportsSQLnull(),h
+    return new(h) SQLTiny(h, !isUnsigned()
+                          ,supportsSQLnull()
                           );
   }
 
@@ -545,9 +542,8 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-  SQLSmall (NABoolean allowNegValues = TRUE, 
-                   NABoolean allowSQLnull = TRUE,
-				   CollHeap * heap =0);
+  SQLSmall (NAMemory *heap, NABoolean allowNegValues = TRUE, 
+                   NABoolean allowSQLnull = TRUE);
 
    short getFSDatatype() const
     {
@@ -610,8 +606,8 @@ public:
   // ---------------------------------------------------------------------
   virtual NAType *newCopy(CollHeap* h=0) const
   {
-    return new(h) SQLSmall(!isUnsigned()
-			   ,supportsSQLnull(),h
+    return new(h) SQLSmall(h, !isUnsigned()
+			   ,supportsSQLnull()
 			   );
   }
 
@@ -638,9 +634,8 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-  SQLInt (NABoolean allowNegValues = TRUE, 
-		 NABoolean allowSQLnull = TRUE,
-		 CollHeap * heap =0 );
+  SQLInt (NAMemory *heap, NABoolean allowNegValues = TRUE, 
+		 NABoolean allowSQLnull = TRUE);
 
   short getFSDatatype() const
     {
@@ -703,8 +698,8 @@ public:
   // ---------------------------------------------------------------------
   virtual NAType *newCopy(CollHeap* h=0) const
   {
-    return new(h) SQLInt(!isUnsigned()
-			 ,supportsSQLnull(),h
+    return new(h) SQLInt(h, !isUnsigned()
+			 ,supportsSQLnull()
 			 );
   }
 
@@ -733,15 +728,13 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-  SQLLargeInt (NABoolean allowNegValues = TRUE, 
-	       NABoolean allowSQLnull = TRUE,
-	       CollHeap * heap =0);
+  SQLLargeInt (NAMemory *heap, NABoolean allowNegValues = TRUE, 
+	       NABoolean allowSQLnull = TRUE);
 
-  SQLLargeInt (Lng32 scale,
+  SQLLargeInt (NAMemory *heap, Lng32 scale,
                UInt16 disAmbiguate,  // 64bit
 	       NABoolean allowNegValues = TRUE, 
-	       NABoolean allowSQLnull = TRUE,
-	       CollHeap * heap =0);
+	       NABoolean allowSQLnull = TRUE);
 
   short getFSDatatype() const
     {
@@ -810,11 +803,10 @@ public:
   // ---------------------------------------------------------------------
   virtual NAType *newCopy(CollHeap* h=0) const
   {
-    return new(h) SQLLargeInt(getScale(),
+    return new(h) SQLLargeInt(h, getScale(),
                               (UInt16) 0,
 			      !isUnsigned()
 			      ,supportsSQLnull()
-				  ,h
 			      );
   }
 
@@ -861,18 +853,16 @@ class SQLBigInt : public SQLLargeInt
     
 public: 
       
-  SQLBigInt (NABoolean allowNegValues = TRUE, 
-		      NABoolean allowSQLnull = TRUE,
-			  CollHeap * heap =0);
+  SQLBigInt (NAMemory *heap, NABoolean allowNegValues = TRUE, 
+		      NABoolean allowSQLnull = TRUE);
 
   // ---------------------------------------------------------------------
   // A virtual function to return a copy of the type.
   // ---------------------------------------------------------------------
   virtual NAType *newCopy(CollHeap* h=0) const
   {
-    return new(h) SQLBigInt(!isUnsigned()
+    return new(h) SQLBigInt(h, !isUnsigned()
 			    ,supportsSQLnull()
-				,h
 			    );
   }
 
@@ -894,14 +884,13 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-  SQLNumeric (Lng32 length, Lng32 precision, Lng32 scale,
+  SQLNumeric (NAMemory *heap, Lng32 length, Lng32 precision, Lng32 scale,
 		     NABoolean allowNegValues = TRUE, 
-		     NABoolean allowSQLnull = TRUE,
-			 CollHeap * heap =0);
+		     NABoolean allowSQLnull = TRUE);
 
    // Note: DisAmbiguate arg added so Compiler can distinguish between
    //       this constructor and the one above....for 64bit project.
-   SQLNumeric (NABoolean allowNegValues,
+   SQLNumeric (NAMemory *heap, NABoolean allowNegValues,
                      Lng32 precision,
                      Lng32 scale,
                      const Int16 DisAmbiguate,
@@ -975,12 +964,11 @@ public:
   // ---------------------------------------------------------------------
   virtual NAType *newCopy(CollHeap* h=0) const
   {
-    return new(h) SQLNumeric(getNominalSize()
+    return new(h) SQLNumeric(h, getNominalSize()
 			     ,getPrecision()
 			     ,getScale()
 			     ,!isUnsigned()
 			     ,supportsSQLnull()
-				 ,h
 			     );
   }
 
@@ -1004,10 +992,9 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-  SQLDecimal (Lng32 length, Lng32 scale,
+  SQLDecimal (NAMemory *heap, Lng32 length, Lng32 scale,
 		     NABoolean allowNegValues = TRUE, 
-		     NABoolean allowSQLnull = TRUE,
-			 CollHeap * heap =0);
+		     NABoolean allowSQLnull = TRUE);
 
    short getFSDatatype() const
     {
@@ -1051,11 +1038,10 @@ public:
   // ---------------------------------------------------------------------
   virtual NAType *newCopy(CollHeap* h=0) const
   {
-    return new(h) SQLDecimal(getNominalSize()
+    return new(h) SQLDecimal(h, getNominalSize()
 			     ,getScale()
 			     ,!isUnsigned()
 			     ,supportsSQLnull()
-				 ,h
 			     );
   }
 
@@ -1079,11 +1065,10 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-   SQLBigNum ( Lng32 precision, Lng32 scale,
+   SQLBigNum ( NAMemory *heap, Lng32 precision, Lng32 scale,
 	       NABoolean isARealBigNum, // = TRUE,
 	       NABoolean allowNegValues, // = TRUE, 
-	       NABoolean allowSQLnull, // = TRUE,
-	       CollHeap * heap);
+	       NABoolean allowSQLnull ); // = TRUE);
 
    short getFSDatatype() const
     {
@@ -1159,12 +1144,11 @@ public:
   // ---------------------------------------------------------------------
   virtual NAType *newCopy(CollHeap* h=0) const
   {
-    return new(h) SQLBigNum(getPrecision()
+    return new(h) SQLBigNum(h, getPrecision()
 			    ,getScale()
 			    ,isARealBigNum()
 			    ,!isUnsigned()
 			    ,supportsSQLnull()
-			    , h
 			    );
   }
 
@@ -1194,10 +1178,9 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-   LSDecimal (Lng32 length,
+   LSDecimal (NAMemory *heap, Lng32 length,
 		    Lng32 scale, 
-		    NABoolean allowSQLnull = TRUE,
-			CollHeap * heap =0);
+		    NABoolean allowSQLnull = TRUE);
 
    short getFSDatatype() const
     {
@@ -1211,7 +1194,7 @@ public:
 
    NAType * equivalentType(CollHeap* h=0) const
     {
-      return new(h) SQLDecimal(getNominalSize() - 1, getScale(),
+      return new(h) SQLDecimal(h, getNominalSize() - 1, getScale(),
 			       TRUE, supportsSQLnull());
     }
 
@@ -1244,10 +1227,9 @@ public:
   // ---------------------------------------------------------------------
   virtual NAType *newCopy(CollHeap* h=0) const
   {
-    return new(h) LSDecimal(getNominalSize()
+    return new(h) LSDecimal(h, getNominalSize()
 			    ,getScale()
 			    ,supportsSQLnull()
-				,h
 			    );
   }
 
@@ -1268,14 +1250,13 @@ public:
   // Constructor functions
   // ---------------------------------------------------------------------
   SQLFloat
-  ( NABoolean allowSQLnull
+  ( NAMemory *heap, NABoolean allowSQLnull
   , Lng32 dataStorageSize
   , Lng32 precision = SQL_FLOAT_PRECISION
   , const NAString& adtName = LiteralFloat
-  , CollHeap * heap =0
   )
   : NumericType
-  ( adtName
+  ( heap, adtName
   , dataStorageSize
   , precision
   , 0
@@ -1283,7 +1264,6 @@ public:
   , TRUE
   , allowSQLnull
   ,FALSE
-  ,heap
   )
   { 
     // Should not assert precision <= SQL_FLOAT_PRECISION. 
@@ -1356,12 +1336,11 @@ public:
   // ---------------------------------------------------------------------
   virtual NAType *newCopy(CollHeap* h=0) const
   {
-    return new(h) SQLFloat(
+    return new(h) SQLFloat(h,
 			   supportsSQLnull(), 
 			   getNominalSize(),
 			   getPrecision(), 
-			   getSimpleTypeName(),
-			   h);
+			   getSimpleTypeName());
   }
 
   virtual double getMaxValue() const { return 1.7976931348623157e+308; }
@@ -1385,9 +1364,9 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-   SQLReal (NABoolean allowSQLnull = TRUE,CollHeap * heap = 0,
+   SQLReal (NAMemory *heap, NABoolean allowSQLnull = TRUE,
 		  Lng32 precision = 0)
-  : SQLFloat(allowSQLnull, SQL_REAL_SIZE, 0, LiteralReal,heap)
+  : SQLFloat(heap, allowSQLnull, SQL_REAL_SIZE, 0, LiteralReal)
   {}
  
   // The above constructor can mislead callers of getPrecision() into
@@ -1401,7 +1380,7 @@ public:
   // A virtual function to return a copy of the type.
   // ---------------------------------------------------------------------
   virtual NAType *newCopy(CollHeap* h=0) const 
-    { return new(h) SQLReal(supportsSQLnull(),h); }
+    { return new(h) SQLReal(h, supportsSQLnull()); }
 
   virtual double getMaxValue() const { return 3.40282347e+38; }
 
@@ -1422,12 +1401,11 @@ public:
   // ---------------------------------------------------------------------
   // Constructor functions
   // ---------------------------------------------------------------------
-   SQLDoublePrecision (NABoolean allowSQLnull = TRUE,
-                       CollHeap * heap =0,
+   SQLDoublePrecision (NAMemory *heap, NABoolean allowSQLnull = TRUE,
                        Lng32 precision = SQL_DOUBLE_PRECISION,
                        NABoolean fromFloat = FALSE)
-  : SQLFloat(allowSQLnull, SQL_DOUBLE_PRECISION_SIZE, 
-	     precision, LiteralDoublePrecision,heap),
+  : SQLFloat(heap, allowSQLnull, SQL_DOUBLE_PRECISION_SIZE, 
+	     precision, LiteralDoublePrecision),
     fromFloat_(fromFloat),
     origPrecision_(precision)
   {}
@@ -1445,7 +1423,7 @@ public:
   // ---------------------------------------------------------------------
   virtual NAType *newCopy(CollHeap* h=0) const
   {
-    return new(h) SQLDoublePrecision(supportsSQLnull(),h,getPrecision(), fromFloat());
+    return new(h) SQLDoublePrecision(h, supportsSQLnull(),getPrecision(), fromFloat());
   }
 
   // ---------------------------------------------------------------------