예제 #1
0
// *************************************************************** 
// * Obtain all the MV descriptor text and MV attributes
// * for a specific MV UID in a specific catalog.
// *
// * A static SQL query is used to obtain the MV descriptor
// * text rows for a specific CATALOG, system schema VERSION
// * and MV UID from the system metadata.
// *************************************************************** 
NAString* QRQueriesImpl::getMvDescriptor(const NAString& textTable,
				         const char * uid)
{
  _int64 objectUID = atoInt64(uid);

  Lng32 sqlCode = queries_->openMvDescriptorText(textTable, objectUID);
  assertLogAndThrow1(CAT_SQL_COMP_QR_COMMON, LL_ERROR,
                    sqlCode==SQL_Success || sqlCode==SQL_Eof, QRDatabaseException, 
 	            "Error %d performing get MV descriptor.", sqlCode); 

  NAString* mvDescriptorText = new(heap_) NAString(heap_);
  Int32 buffNum = 1;
  while (sqlCode == SQL_Success)
  {
    sqlCode = queries_->fetchMvDescriptorText(data_);
    assertLogAndThrow1(CAT_SQL_COMP_QR_COMMON, LL_ERROR,
                      sqlCode==SQL_Success || sqlCode==SQL_Eof, QRDatabaseException, 
   	              "Error %d performing get MV descriptor.", sqlCode); 

    if (sqlCode == SQL_Success)
    {
      *mvDescriptorText += data_->mvText_;
    }
  }

  // Always close to free up resources
  queries_->closeMvDescriptorText();

  TrimNAStringSpace ( *mvDescriptorText // NAString &ns
                    , FALSE             // NABoolean leading
                    , TRUE              // NABoolean trailing
                    );

  return mvDescriptorText;
}  // End of getMvDescriptor
예제 #2
0
void ComUID::make_UID(void)
{

// A UID is based on a 64-bit unique value
//
// For packaging purposes, the generation happens in CatSQLShare, see sqlshare/CatSQLShare.cpp
#ifdef _DEBUG
  // Debug code, to read the UID values from a file specified by an envvar
  char lineFromFile[80];

  if (ComRtGetValueFromFile ("MX_FAKE_UID_FILE", lineFromFile, sizeof(lineFromFile)))
  {
    this->data = atoInt64 (lineFromFile);
    return;
  }
#endif
  this->data = generateUniqueValue ();

}
NAFileSet::NAFileSet(const QualifiedName & fileSetName,
		     const QualifiedName & extFileSetObj,
		     const NAString & extFileSetName,
		     enum FileOrganizationEnum org,
		     NABoolean isSystemTable,
		     Lng32 numberOfFiles,
		     Cardinality estimatedNumberOfRecords,
		     Lng32 recordLength,
		     Lng32 blockSize,
		     Int32 indexLevels,
		     const NAColumnArray & allColumns,
		     const NAColumnArray & indexKeyColumns,
		     const NAColumnArray & horizontalPartKeyColumns,
		     PartitioningFunction * forHorizontalPartitioning,
		     short keytag, 
		     Int64 redefTime,
		     NABoolean audited,
		     NABoolean auditCompressed,
		     NABoolean compressed,
		     ComCompressionType dcompressed,
		     NABoolean icompressed,
		     NABoolean buffered,
		     NABoolean clearOnPurge,
		     NABoolean packedRows,
                     NABoolean hasRemotePartition,
		     NABoolean isUniqueSecondaryIndex,
                     NABoolean isDecoupledRangePartitioned,
                     Lng32 fileCode,
		     NABoolean isVolatile,
		     NABoolean inMemObjectDefn,
                     desc_struct *keysDesc,
                     HHDFSTableStats *hHDFSTableStats,
                     Lng32 numSaltPartns,
                     NAList<HbaseCreateOption*>* hbaseCreateOptions,
                     CollHeap * h)
         : fileSetName_(fileSetName, h),
	   extFileSetObj_(extFileSetObj, h),
	   extFileSetName_(extFileSetName, h),
           fileOrganization_(org), 
	   isSystemTable_(isSystemTable),
           countOfFiles_(numberOfFiles),
	   estimatedNumberOfRecords_(estimatedNumberOfRecords),
	   recordLength_(recordLength),
	   blockSize_(blockSize),
	   indexLevels_(indexLevels),
           allColumns_(allColumns, h), 
           indexKeyColumns_(indexKeyColumns, h),
	   partitioningKeyColumns_(horizontalPartKeyColumns, h),
           partFunc_(forHorizontalPartitioning),
	   keytag_(keytag),
	   redefTime_(redefTime),
	   audited_(audited),
	   auditCompressed_(auditCompressed),
	   compressed_(compressed),
	   dcompressed_(dcompressed),
	   icompressed_(icompressed),
	   buffered_(buffered),
	   clearOnPurge_(clearOnPurge),
	   packedRows_(packedRows),
           hasRemotePartition_(hasRemotePartition),
           setupForStatement_(FALSE),
           resetAfterStatement_(FALSE),
	   bitFlags_(0),
	   keyLength_(0),
	   encodedKeyLength_(0),
           thisRemoteIndexGone_(FALSE),
           isDecoupledRangePartitioned_(isDecoupledRangePartitioned),
           fileCode_(fileCode),
           keysDesc_(keysDesc),
           hHDFSTableStats_(hHDFSTableStats),
           numSaltPartns_(numSaltPartns),
           hbaseCreateOptions_(hbaseCreateOptions),
           numMaxVersions_(1)
{
  setUniqueIndex(isUniqueSecondaryIndex);
  setIsVolatile(isVolatile);
  setInMemoryObjectDefn(inMemObjectDefn);

  if (hbaseCreateOptions_)
    {
      for (Lng32 i = 0; i < hbaseCreateOptions_->entries(); i++)
        {
          HbaseCreateOption * hco = (*hbaseCreateOptions_)[i];
          
          if (hco->key() == "MAX_VERSIONS")
            {
              numMaxVersions_ = atoInt64(hco->val().data());
            }
        }
      
    }
}