本文整理汇总了C++中NAString::index方法的典型用法代码示例。如果您正苦于以下问题:C++ NAString::index方法的具体用法?C++ NAString::index怎么用?C++ NAString::index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NAString
的用法示例。
在下文中一共展示了NAString::index方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initializeISPCaches
NABoolean ISPIterator::initializeISPCaches(SP_ROW_DATA inputData, SP_EXTRACT_FUNCPTR eFunc, SP_ERROR_STRUCT* error,
const NAArray<CmpContextInfo*> & ctxs, //input
NAString & contextName,
Int32 & index //output, set initial index in arrary of CmpContextInfos
)
{
//extract ISP input, find QueryCache belonging to specified context
//and use it for fetch later
Lng32 maxSize = 16;
char receivingField[maxSize+1];
if (eFunc (0, inputData, (Lng32)maxSize, receivingField, FALSE) == SP_ERROR_EXTRACT_DATA)
{
error->error = arkcmpErrorISPFieldDef;
return FALSE;
}
//choose context
// 1. Search ctxInfos_ for all context with specified name('USER', 'META', 'USTATS'),
// 'ALL' option will fetch all context in ctxInfos_, index is set to 0, qcache is always NULL,
// 2. For remote arkcmp, which has 0 context in ctxInfos_, index is always -1,
NAString qCntxt = receivingField;
qCntxt.toLower();
//the receivingField is of pattern xxx$trafodion.yyy,
//where xxx is the desired input string.
Int32 dollarIdx = qCntxt.index("$");
CMPASSERT(dollarIdx > 0);
//find the specified context
if(ctxs.entries() == 0){
//for remote compiler
if( (dollarIdx==3 && strncmp(qCntxt.data(), "all", dollarIdx)==0)
||(dollarIdx==4 && strncmp(qCntxt.data(), "user", dollarIdx)==0) )
index = -1;
}
else
{
if(dollarIdx==3 && strncmp(qCntxt.data(), "all", dollarIdx)==0)
{
contextName = "ALL";
index = 0;
}
else if(dollarIdx==4 && strncmp(qCntxt.data(), "user", dollarIdx)==0)
{
contextName = "NONE";
index = 0;
}
else if(dollarIdx==4 && strncmp(qCntxt.data(), "meta", dollarIdx)==0)
{
contextName = "META";
index = 0;
}
else if(dollarIdx==6 && strncmp(qCntxt.data(), "ustats", dollarIdx)==0)
{
contextName = "USTATS";
index = 0;
}
}
return TRUE;
}
示例2: if
ExplainTuple *PhysicalFastExtract::addSpecificExplainInfo(ExplainTupleMaster *explainTuple, ComTdb *tdb,
Generator *generator)
{
NAString description = "Target_type: ";
if (getTargetType() == FILE)
{
if (isHiveInsert())
description += "hive table";
else
description += "file";
}
else if (getTargetType() == SOCKET)
description += "socket";
else
description += "none";
if (isHiveInsert())
{
NAString str = getTargetName();
size_t colonIndex = str.index(":", 1,0,NAString::ignoreCase);
while (colonIndex != NA_NPOS)
{
str = str.replace(colonIndex, 1, "_", 1);
colonIndex = str.index(":", 1,0,NAString::ignoreCase);
}
description += " location: ";
description += str;
}
if (isHiveInsert())
{
description += " table_name: ";
description += getHiveTableName();
}
else
{
description += " target_name: ";
description += getTargetName();
}
description += " delimiter: ";
description += getDelimiter();
if (isAppend())
description += " append: yes";
if ( !isHiveInsert() && includeHeader())
{
description += " header: ";
description += getHeader();
}
if (getCompressionType() != NONE)
{
description += " compression_type: ";
if (getCompressionType() == LZO)
description += "LZO";
else
description += "error";
}
description += " null_string: ";
description += getNullString();
description += " record_separator: ";
description += getRecordSeparator();
explainTuple->setDescription(description);
if (isHiveInsert())
explainTuple->setTableName(getHiveTableName());
return explainTuple;
}