本文整理汇总了C++中NAString类的典型用法代码示例。如果您正苦于以下问题:C++ NAString类的具体用法?C++ NAString怎么用?C++ NAString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NAString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: logDiags
void QRLogger::logDiags(ComDiagsArea* diagsArea, std::string &cat)
{
const NAWchar* diagMsg;
NAString* diagStr;
Int32 i;
ComCondition* condition;
log4cxx::LoggerPtr myLogger = log4cxx::Logger::getLogger(cat);
if ( myLogger )
{
log4cxx::LevelPtr myLevel = myLogger->getLevel();
if ( myLevel )
{
// If configured Level is the same or less restrictive than WARN (30000)
// than report the warning
if ( myLevel != log4cxx::Level::getOff() && myLevel->toInt() <= LL_WARN )
{
for (i=1; i<=diagsArea->getNumber(DgSqlCode::WARNING_); i++)
{
condition = diagsArea->getWarningEntry(i);
diagMsg = condition->getMessageText();
diagStr = unicodeToChar(diagMsg, NAWstrlen(diagMsg),
CharInfo::ISO88591, NULL, TRUE);
log(cat, LL_WARN, condition->getSQLCODE(), "",
" warn condition %d: %s", i, diagStr->data());
delete diagStr;
}
}
}
}
}
示例2: str_sprintf
// ----------------------------------------------------------------------------
// method: getAuthDetails
//
// Create the CmpSeabaseDDLauth class containing auth details for the
// request authID
//
// Input:
// authID - the database authorization ID to search for
//
// Output:
// A returned parameter:
// 0 - authorization details are available
// < 0 - an error was returned trying to get details
// 100 - authorization details were not found
// > 0 - (not 100) warning was returned
// ----------------------------------------------------------------------------
Int32 CmpSeabaseDDLauth::getAuthDetails (Int32 authID)
{
try
{
NAString sysCat = CmpSeabaseDDL::getSystemCatalogStatic();
char buf[1000];
str_sprintf(buf, "select auth_id, auth_db_name, auth_ext_name, auth_type, auth_creator, auth_is_valid, auth_create_time, auth_redef_time from %s.\"%s\".%s where auth_id = %s ",
sysCat.data(), SEABASE_MD_SCHEMA, SEABASE_AUTHS, authID);
NAString cmd (buf);
if (selectExactRow(cmd))
return 0;
return 100;
}
catch (DDLException e)
{
// At this time, an error should be in the diags area.
return e.getSqlcode();
}
catch (...)
{
// If there is no error in the diags area, set up an internal error
Int32 numErrors = CmpCommon::diags()->getNumber(DgSqlCode::ERROR_);
if (numErrors == 0)
*CmpCommon::diags() << DgSqlCode (-CAT_INTERNAL_EXCEPTION_ERROR)
<< DgInt0(__LINE__)
<< DgString0("getAuthDetails for authID");
return -CAT_INTERNAL_EXCEPTION_ERROR;
}
}
示例3: sprintf
short
IsolatedScalarUDF::generateShape(CollHeap * c, char * buf,
NAString * shapeStr)
{
Space *space = (Space *)c;
char mybuf[100];
sprintf (mybuf, "isolated_scalar_udf");
outputBuffer (space, buf, mybuf, shapeStr);
if (getRoutineDesc() &&
getRoutineDesc()->getNARoutine() &&
getRoutineDesc()->getNARoutine()->getRoutineName())
{
NAString fmtdStr;
ToQuotedString(fmtdStr, getRoutineDesc()->getNARoutine()->
getRoutineName()->getQualifiedNameObj().
getQualifiedNameAsAnsiString().data());
snprintf (mybuf, 100, "(scalar_udf %s", fmtdStr.data());
outputBuffer (space, buf, mybuf, shapeStr);
if (getRoutineDesc()->isUUDFRoutine() &&
getRoutineDesc()->getActionNARoutine() &&
getRoutineDesc()->getActionNARoutine()->getActionName())
{
ToQuotedString(fmtdStr, getRoutineDesc()->getActionNARoutine()->
getActionName()->data());
snprintf (mybuf, 100, ", udf_action %s", fmtdStr.data());
outputBuffer (space, buf, mybuf, shapeStr);
}
strcpy(mybuf, ")");
outputBuffer (space, buf, mybuf, shapeStr);
}
return 0;
}
示例4: ActiveSchemaDB
NABoolean SchemaName::matchDefaultPublicSchema()
{
if (schemaName_.isNull())
return TRUE;
NABoolean matched = FALSE;
// get default schema
NAString defCat;
NAString defSch;
ActiveSchemaDB()->getDefaults().getCatalogAndSchema(defCat, defSch);
ToInternalIdentifier(defCat);
ToInternalIdentifier(defSch);
// get public schema
NAString publicSchema = ActiveSchemaDB()->getDefaults().getValue(PUBLIC_SCHEMA_NAME);
ComSchemaName pubSchema(publicSchema);
NAString pubCat = pubSchema.getCatalogNamePart().getInternalName();
NAString pubSch = pubSchema.getSchemaNamePart().getInternalName();
// if catalog was not specified
NAString catName = (catalogName_.isNull()? defCat:catalogName_);
pubCat = (pubCat.isNull()? defCat:pubCat);
if (((catName==defCat) && (schemaName_==defSch)) ||
((catName==pubCat) && (schemaName_==pubSch)))
matched = TRUE;
return matched;
}
示例5: pubSchema
// This function copies the above applyDefaults() function
// and includes checking for the object existence and
// search in the public schema if necessary.
// This is used to replace the above function when
// we need to consider PUBLIC_SCHEMA_NAME
Int32 QualifiedName::applyDefaultsValidate(const SchemaName& defCatSch,
ComAnsiNameSpace nameSpace)
{
// need to try public schema if it is specified
// and the object schema is not specified
NAString publicSchema = "";
CmpCommon::getDefault(PUBLIC_SCHEMA_NAME, publicSchema, FALSE);
ComSchemaName pubSchema(publicSchema);
NAString pubSchemaIntName = "";
if ( getSchemaName().isNull() &&
!pubSchema.isEmpty() )
{
pubSchemaIntName = pubSchema.getSchemaNamePart().getInternalName();
}
Int32 ret = extractAndDefaultNameParts( defCatSch
, catalogName_
, schemaName_
, objectName_
);
// try public schema if the table does not exist
if (!pubSchemaIntName.isNull())
{
*(CmpCommon::diags()) << DgSqlCode(-4222)
<< DgString0("Public Access Schema");
}
return ret;
}
示例6: hdfsCleanUnloadPath
HDFS_Client_RetCode HdfsClient::hdfsCleanUnloadPath( const NAString& uldPath)
{
QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "HdfsClient::hdfsCleanUnloadPath(%s) called.",
uldPath.data());
if (initJNIEnv() != JOI_OK)
return HDFS_CLIENT_ERROR_HDFS_CLEANUP_PARAM;
if (getInstance() == NULL)
return HDFS_CLIENT_ERROR_HDFS_CLEANUP_PARAM;
jstring js_UldPath = jenv_->NewStringUTF(uldPath.data());
if (js_UldPath == NULL) {
GetCliGlobals()->setJniErrorStr(getErrorText(HDFS_CLIENT_ERROR_HDFS_CLEANUP_PARAM));
jenv_->PopLocalFrame(NULL);
return HDFS_CLIENT_ERROR_HDFS_CLEANUP_PARAM;
}
tsRecentJMFromJNI = JavaMethods_[JM_HDFS_CLEAN_UNLOAD_PATH].jm_full_name;
jboolean jresult = jenv_->CallStaticBooleanMethod(javaClass_, JavaMethods_[JM_HDFS_CLEAN_UNLOAD_PATH].methodID, js_UldPath);
if (jenv_->ExceptionCheck())
{
getExceptionDetails();
logError(CAT_SQL_HDFS, __FILE__, __LINE__);
logError(CAT_SQL_HDFS, "HdfsClient::hdfsCleanUnloadPath()", getLastError());
jenv_->PopLocalFrame(NULL);
return HDFS_CLIENT_ERROR_HDFS_CLEANUP_EXCEPTION;
}
jenv_->PopLocalFrame(NULL);
return HDFS_CLIENT_OK;
}
示例7: applyModuleCatalogSchema
void StmtModule::applyModuleCatalogSchema(const NAString& cat,
const NAString& sch)
{
// apply moduleCatalog if necessary
if (name().getCatalogName().isNull()) {
if (!cat.isNull())
name().setCatalogName(cat);
}
// apply moduleSchema if necessary
if (name().getSchemaName().isNull()) {
if (!sch.isNull())
name().setSchemaName(sch);
}
// module catalog & schema must be non-null now. Otherwise, a fatal
// exception can occur in mxsqlc/mxsqlco in
// mod_def::setModule() --> mod_def::outputModule()
// --> StmtModule::unparseSimple() -->
// QualifiedName::getQualifiedNameAsAnsiString() -->
// QualifiedName::getQualifiedNameAsString() -->
// CMPASSERT(NOT getSchemaName().isNull());
// as reported in genesis case 10-030708-8735.
if (name().getCatalogName().isNull() || name().getSchemaName().isNull()) {
const SchemaName& defcs =
ActiveSchemaDB()->getDefaultSchema(
SchemaDB::REFRESH_CACHE | SchemaDB::FORCE_ANSI_NAMETYPE);
if (name().getCatalogName().isNull())
name().setCatalogName(defcs.getCatalogName());
if (name().getSchemaName().isNull())
name().setSchemaName(defcs.getSchemaName());
}
}
示例8: convHexToChar
// a helper function converting a hexdecimal digit to a single-byte string
static NAString *
convHexToChar(const NAWchar *s, Int32 inputLen, CharInfo::CharSet cs, CollHeap* heap)
{
ComASSERT((inputLen % SQL_DBCHAR_SIZE) == 0);
NAString *r = new (heap) NAString(heap);
if (!s || inputLen <= 0) return r;
unsigned char upper4Bits;
unsigned char lower4Bits;
for (Int32 i = 0; i < inputLen; i=i+2) {
if (isHexDigit8859_1(s[i]) AND isHexDigit8859_1(s[i+1])) {
#pragma warning (disable : 4244) //warning elimination
#pragma nowarn(1506) // warning elimination
upper4Bits = getHexDigitValue(s[i]);
#pragma warn(1506) // warning elimination
#pragma nowarn(1506) // warning elimination
lower4Bits = getHexDigitValue(s[i+1]);
#pragma warn(1506) // warning elimination
#pragma warning (default : 4244) //warning elimination
#pragma nowarn(1506) // warning elimination
char c = (upper4Bits << 4) | lower4Bits;
#pragma warn(1506) // warning elimination
r->append(c);
} else {
NADELETE(r, NAString, heap);
return NULL;
}
}
return r;
}
示例9: hdfsExists
HDFS_Client_RetCode HdfsClient::hdfsExists( const NAString& uldPath, NABoolean & exist)
{
QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "HdfsClient::hdfsExists(%s) called.",
uldPath.data());
if (initJNIEnv() != JOI_OK)
return HDFS_CLIENT_ERROR_HDFS_EXISTS_PARAM;
if (getInstance() == NULL)
return HDFS_CLIENT_ERROR_HDFS_EXISTS_PARAM;
jstring js_UldPath = jenv_->NewStringUTF(uldPath.data());
if (js_UldPath == NULL) {
jenv_->PopLocalFrame(NULL);
return HDFS_CLIENT_ERROR_HDFS_EXISTS_PARAM;
}
tsRecentJMFromJNI = JavaMethods_[JM_HDFS_EXISTS].jm_full_name;
jboolean jresult = jenv_->CallStaticBooleanMethod(javaClass_, JavaMethods_[JM_HDFS_EXISTS].methodID, js_UldPath);
exist = jresult;
if (jenv_->ExceptionCheck())
{
getExceptionDetails();
logError(CAT_SQL_HDFS, __FILE__, __LINE__);
logError(CAT_SQL_HDFS, "HdfsClient::hdfsExists()", getLastError());
jenv_->PopLocalFrame(NULL);
return HDFS_CLIENT_ERROR_HDFS_EXISTS_EXCEPTION;
}
jenv_->PopLocalFrame(NULL);
return HDFS_CLIENT_OK;
}
示例10: extractKeyValuePairs
//
// data (begin or end) is in this format:
// <length><data> ... <length><data>
//
// a). length is 2-bytes long
// b). data is <length>-bytes long
// c). there are <n> such pairs, where <n> is determined by
// the total length of the source and the length of each pair.
//
static NABoolean extractKeyValuePairs(const NAString& source, NAString& result)
{
char buf[1024];
const char* data = source.data();
const char* end = data + source.length();
NABoolean hasData = ( data < end);
while ( data < end ) {
UInt16 len = 0;
memcpy((char*)&len, data, sizeof(len));
memcpy(buf, data+sizeof(len), len);
buf[len] = NULL;
result.append(buf);
data += sizeof(len) + len;
if ( data < end )
result.append(",");
}
return hasData;
}
示例11: getCharsetsToUse
static NABoolean getCharsetsToUse(
Lng32 msgCharSet, Lng32 &inputCS, Lng32 &defaultCS)
{
if (msgCharSet == SQLCHARSETCODE_ISO_MAPPING)
{
// return the value isoMapping set for this system.
NAString cs;
CmpCommon::getDefault(ISO_MAPPING, cs);
inputCS = (Lng32)CharInfo::getCharSetEnum(cs.data());
defaultCS = (Lng32)SQLCHARSETCODE_ISO88591;
SetSqlParser_DEFAULT_CHARSET(CharInfo::ISO88591);
}
else
{
inputCS = msgCharSet;
defaultCS = (Lng32)SQLCHARSETCODE_UNKNOWN;
// no change to default charset, if ISO_MAPPING was not specified.
// Just set it to the same value as the original charset.
SetSqlParser_DEFAULT_CHARSET(SqlParser_ORIG_DEFAULT_CHARSET);
}
return FALSE;
}
示例12: getUudfUID
// The following method returns TRUE if parameter "output" is populated.
NABoolean
ComRoutineActionNamePart::getRoutineActionNameStoredInOBJECTS_OBJECT_NAME
(ComAnsiNamePart &output, // out
ComBoolean performCheck) // in - default is TRUE
{
if (NOT isValid())
return FALSE;
ComString funnyNameInInternalFormat;
getUudfUID().convertTo19BytesFixedWidthStringWithZeroesPrefix(funnyNameInInternalFormat/*out*/);
funnyNameInInternalFormat += "_";
funnyNameInInternalFormat += getInternalName();
NAWString ucs2FunnyInternalName;
ComAnsiNameToUCS2(funnyNameInInternalFormat, ucs2FunnyInternalName /* out */);
if (performCheck AND ucs2FunnyInternalName.length() > MAX_IDENTIFIER_INT_LEN)
return FALSE;
NAString extName = ToAnsiIdentifier(funnyNameInInternalFormat,
performCheck);
if (extName.isNull()) // the generated external name is invalid
return FALSE;
output.setInternalName(funnyNameInInternalFormat);
output.setExternalName(extName);
return TRUE;
}
示例13: ExprNodeFlagsToString
NAString TDBDlgExprList::ExprNodeFlagsToString(ex_expr* exprNode)
{
NAString string;
if (exprNode->getFixupConstsAndTemps())
string += "FIXUP_CONSTS_AND_TEMPS|";
if (exprNode->generateNoPCode())
string += "GENERATE_NO_PCODE|";
if (exprNode->getPCodeGenCompile())
string += "PCODE_GEN_COMPILE|";
if (exprNode->getPCodeMoveFastpath())
string += "PCODE_MOVE_FASTPATH|";
if (exprNode->forInsertUpdate())
string += "FOR_INSERT_UPDATE|";
if (exprNode->usePCodeEvalAligned())
string += "PCODE_EVAL_ALIGNED|";
if (exprNode->handleIndirectVC())
string += "HANDLE_INDIRECT_VC|";
if (exprNode-> getPCodeNative())
string += "PCODE_EVAL_NATIVE";
int len = string.length();
string.remove(len-1);
return string;
}
示例14: CMPASSERT
NABoolean CmpInternalSP::OutputFormat(CmpSPOutputFormat& t)
{
NABoolean retStatus = TRUE;
CMPASSERT(state_ == COMPILE);
initSP_ERROR_STRUCT();
Lng32 num;
NAString outTableName = OutTableName();
if ( (*(procFuncs_.outNumFormatFunc_))( &num, compHandle_,
procFuncs_.spHandle_, &spError_[0])
== SP_SUCCESS )
{
if ( num == 0 )
{
// Create a dummy column if there is no output, since otherwise
// NATable generated later on will break later in binder.
SP_FIELDDESC_STRUCT fields;
strcpy(fields.COLUMN_DEF, "Dummy1 int");
if ( !(t.SetFormat(1, outTableName.data(), &fields, 0, 0) ) )
retStatus = FALSE;
}
else
{
SP_FIELDDESC_STRUCT* fields = allocSP_FIELDDESC_STRUCT(num);
SP_KEYDESC_STRUCT* keys = allocSP_KEYDESC_STRUCT(num);
Lng32 nKeys = 0;
initSP_ERROR_STRUCT();
if ( (*(procFuncs_.outFormatFunc_))
(fields, keys, &nKeys, compHandle_, procFuncs_.spHandle_, &spError_[0])
== SP_SUCCESS )
{
if (!(t.SetFormat(num, outTableName.data(), fields, nKeys, keys ) ) )
{
retStatus = FALSE;
}
}
else
{
appendDiags();
retStatus = FALSE;
}
// It is not supposed to jump out of this function before this
// delete[]
deleteSP_FIELDDESC_STRUCT(fields);
deleteSP_KEYDESC_STRUCT(keys);
}
}
else
{
appendDiags();
retStatus = FALSE;
}
if ( !retStatus )
*(cmpContext()->diags()) << DgSqlCode(arkcmpErrorISPFieldDef);
return retStatus;
}
示例15: getText
const NAString ListOfRangeRows::getText() const
{
NAString result;
for (CollIndex i=0; i<entries(); i++) {
HbaseRangeRows rangeRow = (*this)[i];
result.append(rangeRow.getText());
}
return result;
}