本文整理汇总了C++中NAString::first方法的典型用法代码示例。如果您正苦于以下问题:C++ NAString::first方法的具体用法?C++ NAString::first怎么用?C++ NAString::first使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NAString
的用法示例。
在下文中一共展示了NAString::first方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: userIDStr
CmpStatement::ReturnStatus
CmpStatement::process(const CmpMessageDatabaseUser &statement)
{
NABoolean doDebug = FALSE;
NAString message = statement.data();
size_t delimPos = message.first(',');
CMPASSERT(delimPos <= MAX_AUTHID_AS_STRING_LEN);
NAString userIDStr (message.data(), delimPos);
Int32 userID = atoi(userIDStr.data());
char * userName = (char *)message.data();
userName += delimPos + 1;
if (doDebug)
{
printf("[DBUSER:%d] Received user ID %d\n",
(int) getpid(), (int) userID);
printf("[DBUSER:%d] Received username %s\n",
(int) getpid(), userName);
}
CmpSqlSession *session = CmpCommon::context()->sqlSession();
CMPASSERT(session);
Lng32 sqlcode = session->setDatabaseUser(userID, userName);
if (doDebug)
printf("[DBUSER:%d] session->setDatabaseUser() returned %d\n",
(int) getpid(), (int) sqlcode);
if (doDebug)
printf("[DBUSER:%d] END process(CmpMessageDatabaseUser)\n",
(int) getpid());
if (sqlcode < 0)
return CmpStatement_ERROR;
return CmpStatement_SUCCESS;
}
示例2: extractAndDefaultNameParts
// Name parts return in string parameters, defaulted if not yet present;
// this object is not modified.
// Function return value is the number of names that match the default,
// {0, 1, 2} = {no matches, catalog matches, catalog&schema match}.
//
// If NAMETYPE is NSK, the SchemaDB puts the current MPLOC into the defCatSch;
// so this method has to handle **only one** tiny NSK naming detail.
//
Int32 QualifiedName::extractAndDefaultNameParts(const SchemaName& defCatSch
, NAString& catName // OUT
, NAString& schName // OUT
, NAString& objName // OUT
) const
{
catName = getCatalogName();
schName = getSchemaName();
objName = getObjectName();
CMPASSERT(NOT objName.isNull()); // no default for this!
{
if (catName.isNull()) {
if((ActiveSchemaDB()->getDefaults().schSetToUserID()) &&
(SqlParser_NAMETYPE == DF_SHORTANSI))
{
// If NAMETYPE is SHORTANSI and schema is not set
// in DEFAULTS table or by user, for dml, catName
// gets \SYS.$VOL from set or default MPLOC.
catName = SqlParser_MPLOC.getSysDotVol();
}
else
{
// If NAMETYPE NSK, catName will become \SYS.$VOL
catName = defCatSch.getCatalogName();
}
}
else if (SqlParser_NAMETYPE == DF_NSK &&
*catName.data() == '$' &&
SqlParser_MPLOC.hasSystemName()) {
// If user specified only a $VOL, fill in the current default \SYS.
catName.prepend(SqlParser_MPLOC.getSystemName() + ".");
}
if (schName.isNull()) {
if((ActiveSchemaDB()->getDefaults().schSetToUserID()) &&
(SqlParser_NAMETYPE == DF_SHORTANSI))
{
// If NAMETYPE is SHORTANSI and schema is not set
// in DEFAULTS table or by user, for dml, schName
// gets subvol from set or default MPLOC.
schName = SqlParser_MPLOC.getSubvolName();
}
else
schName = defCatSch.getSchemaName();
}
}
CMPASSERT(NOT catName.isNull());
CMPASSERT(NOT schName.isNull());
Int32 defaultMatches = 0;
if (catName == defCatSch.getCatalogName()) {
defaultMatches++;
if (schName == defCatSch.getSchemaName())
defaultMatches++;
}
// Next comes support for table name resolution for SHORTANSI nametype,
// implemented as internal feature for ODBC use only.
//
// For the name resolution of table name when nametype is SHORTANSI,
// check is made to see if schName contains an '_', thus ensuring
// the method applyShortAnsiDefault is called only once.
// Correct syntax for schName is "systemName_volumeName_subvolName"
// of the MPLoc where the objName is actually located.
// Complete syntax checking is done inside applyShortAnsiDefault.
//
if (SqlParser_NAMETYPE == DF_SHORTANSI && schName.first('_') != NA_NPOS) {
applyShortAnsiDefault(catName, schName);
}
return defaultMatches;
}