本文整理汇总了C++中ExExeStmtGlobals类的典型用法代码示例。如果您正苦于以下问题:C++ ExExeStmtGlobals类的具体用法?C++ ExExeStmtGlobals怎么用?C++ ExExeStmtGlobals使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExExeStmtGlobals类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getGlobals
short ExExeUtilTcb::alterObjectState(NABoolean online,
char * tableName,
char * failReason,
NABoolean forPurgedata)
{
char buf[4000];
Lng32 cliRC = 0;
// Get the globals stucture of the master executor.
ExExeStmtGlobals *exeGlob = getGlobals()->castToExExeStmtGlobals();
ExMasterStmtGlobals *masterGlob = exeGlob->castToExMasterStmtGlobals();
// make object online
str_sprintf(buf, "ALTER TABLE %s %s %s",
tableName,
(online ? "ONLINE" : "OFFLINE"),
(forPurgedata ? "FOR PURGEDATA" : " "));
// set sqlparserflags to allow 'FOR PURGEDATA' syntax
masterGlob->getStatement()->getContext()->setSqlParserFlags(0x1);
cliRC = cliInterface()->executeImmediate(buf);
masterGlob->getStatement()->getContext()->resetSqlParserFlags(0x1);
if (cliRC < 0)
{
str_sprintf(failReason, "Could not alter the state of table %s to %s.",
tableName, (online ? "online" : "offline"));
return -1;
}
return 0;
}
示例2: getGlobals
short ExExeUtilPopulateInMemStatsTcb::work()
{
// short rc = 0;
Lng32 cliRC = 0;
// if no parent request, return
if (qparent_.down->isEmpty())
return WORK_OK;
// if no room in up queue, won't be able to return data/status.
// Come back later.
if (qparent_.up->isFull())
return WORK_OK;
ex_queue_entry * pentry_down = qparent_.down->getHeadEntry();
ExExeUtilPrivateState & pstate =
*((ExExeUtilPrivateState*) pentry_down->pstate);
// Get the globals stucture of the master executor.
ExExeStmtGlobals *exeGlob = getGlobals()->castToExExeStmtGlobals();
ExMasterStmtGlobals *masterGlob = exeGlob->castToExMasterStmtGlobals();
ContextCli * currContext = masterGlob->getStatement()->getContext();
while (1)
{
switch (step_)
{
case INITIAL_:
{
if (getDiagsArea())
{
getDiagsArea()->clear();
getDiagsArea()->deAllocate();
}
setDiagsArea(ComDiagsArea::allocate(getHeap()));
step_ = PROLOGUE_;
}
break;
case PROLOGUE_:
{
if (disableCQS())
{
step_ = ERROR_;
break;
}
if (setSchemaVersion(pimsTdb().sourceTableCatName_))
{
step_ = ERROR_;
break;
}
// set sqlparserflags to allow use of volatile schema in queries.
masterGlob->getStatement()->getContext()->
setSqlParserFlags(0x10000);//ALLOW_VOLATILE_SCHEMA_IN_TABLE_NAME
step_ = DELETE_STATS_;
}
break;
case DELETE_STATS_:
{
Int32 qry_array_size = sizeof(deleteStatsQuery)
/ sizeof(QueryString);
const QueryString * queryString = deleteStatsQuery;;
char * gluedQuery;
Lng32 gluedQuerySize;
glueQueryFragments(qry_array_size, queryString,
gluedQuery, gluedQuerySize);
Lng32 extraSpace =
ComMAX_3_PART_EXTERNAL_UTF8_NAME_LEN_IN_BYTES /* fullyQualTableName */
+ 20 /* UID */
+ 200 /* overhead */;
char * query = new(getHeap()) char[gluedQuerySize + extraSpace];
str_sprintf(query, gluedQuery,
(char*)pimsTdb().inMemHistogramsTableName_,
pimsTdb().uid_);
cliRC =
cliInterface()->executeImmediate(query);
if (cliRC >= 0)
{
str_sprintf(query, gluedQuery,
(char*)pimsTdb().inMemHistintsTableName_,
pimsTdb().uid_);
cliRC =
cliInterface()->executeImmediate(query);
}
// Delete new'd string
NADELETEBASIC(gluedQuery, getHeap());
//.........这里部分代码省略.........
示例3: setInitialOutputVarPtrList
short ExExeUtilLongRunningTcb::processInitial(Lng32 &rc)
{
Int64 rowsAffected = 0;
setInitialOutputVarPtrList(new(getHeap()) Queue(getHeap()));
setContinuingOutputVarPtrList(new(getHeap()) Queue(getHeap()));
lruStmtAndPartInfo_ = new(getHeap()) char[(UInt32)(lrTdb().getLruStmtLen() + lrTdb().getPredicateLen() + 10)];
ExExeStmtGlobals *exeGlob = getGlobals()->castToExExeStmtGlobals();
ExEspStmtGlobals *espGlob = exeGlob->castToExEspStmtGlobals();
ContextCli *currContext = NULL;
CliGlobals *cliGlobals = NULL;
if (espGlob)
{
cliGlobals = GetCliGlobals();
currContext = cliGlobals->currContext();
}
else
{
currContext = exeGlob->castToExMasterStmtGlobals()->getStatement()->getContext();
}
Int32 espNum = 1;
// we are executing inside an ESP go ahead and set the partition number to the
// ESP instance number. The added one is because ESP instances are 0 based
if (espGlob)
{
espNum = (Int32) espGlob->getMyInstanceNumber() + 1;
}
if (lrTdb().getPredicate() != NULL)
str_sprintf(lruStmtAndPartInfo_,
lrTdb().getLruStmt(),
espNum,
lrTdb().getPredicate());
else
str_sprintf(lruStmtAndPartInfo_,
lrTdb().getLruStmt(),
espNum);
lruStmtWithCKAndPartInfo_ = new(getHeap()) char[(UInt32)(lrTdb().getLruStmtWithCKLen() + lrTdb().getPredicateLen() + 10)];
if (lrTdb().getPredicate() != NULL)
str_sprintf(lruStmtWithCKAndPartInfo_,
lrTdb().getLruStmtWithCK(),
espNum,
lrTdb().getPredicate());
else
str_sprintf(lruStmtWithCKAndPartInfo_,
lrTdb().getLruStmtWithCK(),
espNum);
// All internal queries issued from CliInterface assume that
// they are in ISO_MAPPING.
// For LongRunning we need to send the actual ISO_MAPPING.
// Save it and restore after the prepare
Int32 savedIsoMapping =
cliInterface()->getIsoMapping();
cliInterface()->setIsoMapping
(currContext->getSessionDefaults()->getIsoMappingEnum());
// If the table we are deleting from is an IUD log table,
// we need to set the parserflags to accept the special
// table type and the quoted column names
if (lrTdb().useParserflags())
currContext->setSqlParserFlags(0x3);
rc = cliInterface()->prepareAndExecRowsPrologue(lruStmtAndPartInfo_,
lruStmtWithCKAndPartInfo_,
getInitialOutputVarPtrList(),
getContinuingOutputVarPtrList(),
rowsAffected);
cliInterface()->setIsoMapping(savedIsoMapping);
if (rc < 0)
{
return -1;
}
if (rc >= 0 && rowsAffected > 0)
addRowsDeleted(rowsAffected);
return 0;
}
示例4: getGlobals
ExWorkProcRetcode ExHbaseAccessInitMDTcb::work()
{
short retcode = 0;
short rc = 0;
Lng32 cliRC = 0;
ExExeStmtGlobals *exeGlob = getGlobals()->castToExExeStmtGlobals();
ExMasterStmtGlobals *masterGlob = exeGlob->castToExMasterStmtGlobals();
ComDiagsArea *da = exeGlob->getDiagsArea();
// if no parent request, return
if (qparent_.down->isEmpty())
return WORK_OK;
ex_queue_entry *pentry_down = qparent_.down->getHeadEntry();
while (1)
{
switch (step_)
{
case NOT_STARTED:
{
if (! masterGlob)
{
step_ = HANDLE_ERROR;
break;
}
matches_ = 0;
if (hbaseAccessTdb().accessType_ == ComTdbHbaseAccess::INIT_MD_)
step_ = INIT_MD;
else if (hbaseAccessTdb().accessType_ == ComTdbHbaseAccess::DROP_MD_)
step_ = DROP_MD;
else
step_ = HANDLE_ERROR;
}
break;
case INIT_MD:
{
step_ = UPDATE_MD;
}
break;
case UPDATE_MD:
{
step_ = DONE;
}
break;
case DROP_MD:
{
step_ = DONE;
}
break;
case HANDLE_ERROR:
{
if (handleError(rc))
return rc;
step_ = DONE;
}
break;
case DONE:
{
if (handleDone(rc))
return rc;
step_ = NOT_STARTED;
return WORK_OK;
}
break;
}// switch
} // while
}