本文整理匯總了C++中DgString0函數的典型用法代碼示例。如果您正苦於以下問題:C++ DgString0函數的具體用法?C++ DgString0怎麽用?C++ DgString0使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DgString0函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: module
//ss_cc_change : This file is obsolete and is not used
//LCOV_EXCL_START
// read and return module header structure
module_header_struct*
readModuleHeader
(fstream &mf, // (IN): binary module file
module_header_struct &hdr, // (IN): target of read
const char * name, // (IN): name of module (for error msg)
ComDiagsArea &diags) // (IN): deposit any error msg here
{
// read the module header
mf.seekg(0, ios::beg);
mf.read((char *)&hdr, sizeof(module_header_struct));
if (mf.fail()) {
diags << DgSqlCode(-CLI_READ_ERROR) << DgString0(name);
return NULL;
}
// give versioning a chance to massage/migrate it to this version
module_header_struct modHdrCls, *latestModHdr = (module_header_struct*)
hdr.driveUnpack(&hdr, &modHdrCls, NULL);
if (!latestModHdr) {
// error: version is no longer supported
diags << DgSqlCode(-CLI_MODULE_HDR_VERSION_ERROR)
<< DgString0(name);
return NULL;
}
// verify its validity
Lng32 errCode = latestModHdr->RtduStructIsCorrupt();
if (errCode) {
// the module file is corrupted or has invalid data
diags << DgSqlCode(errCode) << DgString0(name);
return NULL;
}
return latestModHdr;
}
示例2: currContext
Lng32 CliGlobals::sendEnvironToMxcmp()
{
ComDiagsArea & diags = currContext()->diags();
if (NOT getArkcmp()->isConnected())
return 0;
// send the current environment to mxcmp
ExSqlComp::ReturnStatus sendStatus =
getArkcmp()->sendRequest(CmpMessageObj::ENVS_REFRESH, NULL,0);
if (sendStatus != ExSqlComp::SUCCESS)
{
if (sendStatus == ExSqlComp::ERROR)
{
diags << DgSqlCode(-CLI_SEND_REQUEST_ERROR)
<< DgString0("SET ENVIRON");
return -CLI_SEND_REQUEST_ERROR;
// return SQLCLI_ReturnCode(&currContext,-CLI_SEND_REQUEST_ERROR);
}
//else
// retcode = WARNING;
}
if (getArkcmp()->status() != ExSqlComp::FINISHED)
{
diags << DgSqlCode(-CLI_IO_REQUESTS_PENDING)
<< DgString0("SET ENVIRON");
return -CLI_IO_REQUESTS_PENDING;
//return SQLCLI_ReturnCode(&currContext,-CLI_IO_REQUESTS_PENDING);
}
return 0;
}
示例3: Int64ToNAString
void ElemDDLUdfOptimizationHint::synthesize(void)
{
if (getOptimizationKind() NEQ COM_UDF_NUMBER_OF_UNIQUE_OUTPUT_VALUES OR
uniqueOutputValuesParseTree_ EQU NULL)
return;
NABoolean isErrMsgIssued = FALSE;
ComSInt64 value = 0;
ItemExpr * pItemExpr = NULL;
ConstValue * pConstVal = NULL;
for (CollIndex i = 0; i < uniqueOutputValuesParseTree_->entries(); i++)
{
pItemExpr = (*uniqueOutputValuesParseTree_)[i];
pConstVal = (ConstValue *)pItemExpr;
if (NOT pConstVal->canGetExactNumericValue() AND NOT isErrMsgIssued)
{
*SqlParser_Diags << DgSqlCode(-3017) << DgString0(pConstVal->getConstStr());
isErrMsgIssued = TRUE;
}
value = pConstVal->getExactNumericValue();
uniqueOutputValues_.insert(value);
if (value < -1 AND NOT isErrMsgIssued) // only issue the error message once
{
// Error: Expected a positive value or -1 (representing the default SYSTEM setting option)
NAString valueStr = Int64ToNAString(value);
*SqlParser_Diags << DgSqlCode(-3017) << DgString0(valueStr);
isErrMsgIssued = TRUE;
}
} // for
} // ElemDDLUdfOptimizationHint::synthesize()
示例4: NADELETEBASIC
LmResult LmRoutineCppObj::dealloc(ComDiagsArea *diagsArea)
{
LmResult result = LM_OK;
delete invocationInfo_;
invocationInfo_ = NULL;
for (CollIndex i=0; i<planInfos_.getUsedLength(); i++)
if (planInfos_.used(i))
delete planInfos_[i];
planInfos_.clear();
if (paramRow_)
{
NADELETEBASIC(paramRow_, collHeap());
paramRow_ = NULL;
}
if (inputRows_)
{
for (int i=0; i<numInputTables_; i++)
if (inputRows_[i])
NADELETEBASIC((inputRows_[i]), collHeap());
NADELETEBASIC(inputRows_, collHeap());
inputRows_ = NULL;
}
if (outputRow_)
{
// actually allocated buffer started where the wall starts
NADELETEBASIC((outputRow_ - WALL_STRING_LEN), collHeap());
outputRow_ = NULL;
}
try
{
// delete the interface object, the virtual destructor may call user code
delete interfaceObj_;
}
catch (tmudr::UDRException e)
{
*diagsArea << DgSqlCode(-LME_UDR_METHOD_ERROR)
<< DgString0("destructor")
<< DgString1(getNameForDiags())
<< DgString2(e.getMessage().c_str());
result = LM_ERR;
}
catch (...)
{
*diagsArea << DgSqlCode(-LME_UDR_METHOD_ERROR)
<< DgString0("destructor")
<< DgString1(getNameForDiags())
<< DgString2("General exception.");
result = LM_ERR;
}
interfaceObj_ = NULL;
return result;
}
示例5: main
Int32 main(Int32 argc, char **argv)
{
_set_new_handler(mainNewHandler);
// for NA_YOS newHandler_NSK needs to be added, once it is ready -- Sri gadde
mxCompileUserModule mxCUM;
mxCUMptr = &mxCUM;
// process command line arguments
Cmdline_Args args;
args.processArgs(argc, argv);
ApplicationFile *appFile=NULL;
// check if application file exists
if (ACCESS(args.application().c_str(), READABLE) != 0) {
mxCUM << ERROR << DgSqlCode(-2223)
<< DgString0(args.application().c_str());
}
else {
// ask factory to create an ELFFile or a SQLJFile
appFile = ApplicationFile::makeApplicationFile(args.application());
if (!appFile) { // no, it's not an application file
mxCUM << ERROR << DgSqlCode(-2202)
<< DgString0(args.application().c_str());
}
else {
// open the application file
if (appFile->openFile(args)) {
// process appFile's embedded module definitions
std::string modName;
while (appFile->findNextModule(modName)) {
// extract embedded module definition & SQL compile it
if (!appFile->processModule()) {
mxCUM << WARNING << DgSqlCode(-2204) << DgString0(modName.c_str());
// set mxCUM to WARNING at least. processModule may have set
// it to WARNING, ERROR, or FAIL. If we get here, mxCUM
// should never be set to SUCCEED.
}
}
// close the application file
appFile->closeFile();
appFile->logErrors();
}
}
}
mxCUM.dumpDiags();
if (appFile) {
appFile->printSummary();
delete appFile;
}
return mxCUM.returnCode();
}
示例6: loadDll
LmHandle loadDll(
const char *containerName,
const char *externalPath,
LmHandle extLoader,
ComUInt32 *containerSize,
ComDiagsArea *da,
NAMemory *heap)
{
#ifdef LMCOMMON_CANNOT_CALL_DLOPEN
*da << DgSqlCode(-LME_INTERNAL_ERROR)
<< DgString0(": dlopen() is not supported");
*da << DgSqlCode(-LME_DLL_CONT_NOT_FOUND)
<< DgString0(containerName)
<< DgString1(externalPath);
return NULL;
#else
char *libraryName = NULL;
if (str_len(externalPath) == 0)
externalPath = ".";
libraryName = new (heap)
char[str_len(externalPath) + str_len(containerName) + 2];
sprintf(libraryName, "%s/%s", externalPath, containerName);
// TBD: For now, set container size to 0. Need to see how to get
// the actual size
if (containerSize)
*containerSize = 0;
// extLoader is an object of LmCLoader class. It's not used to
// load the library. We can simply load the DLL.
LmHandle container = NULL;
const char *operation = "dlopen";
container = (LmHandle) dlopen(libraryName, RTLD_NOW | RTLD_GLOBAL);
LM_DEBUG3("%s(%s) returned 0x%08x\n", operation, libraryName, container);
if (container == NULL)
{
*da << DgSqlCode(-LME_DLL_CONT_NOT_FOUND)
<< DgString0(containerName)
<< DgString1(externalPath);
addDllErrors(*da, operation, FALSE);
}
NADELETEBASIC(libraryName, heap);
return container;
#endif // LMCOMMON_CANNOT_CALL_DLOPEN
}
示例7: addDllErrors
void addDllErrors(ComDiagsArea &diags,
const char *operation,
NABoolean isWarningOnly)
{
Int32 errorCode = 0;
Int32 errorDetail = 0;
char *errorString = (char *)"";
#ifndef LMCOMMON_CANNOT_CALL_DLOPEN
// dlresultcode() is not applicable to Linux
errorString = dlerror();
#endif
// Remove trailing period and linefeed characters from the message
// string
ComUInt32 msglen = 0;
while (errorString && (msglen = strlen(errorString)) > 0)
{
ComUInt32 idx = msglen - 1;
if (errorString[idx] == '\n' || errorString[idx] == '\r' ||
errorString[idx] == '.')
errorString[idx] = 0;
else
break;
}
diags << DgSqlCode((isWarningOnly ? LME_DLFCN_ERROR : -LME_DLFCN_ERROR))
<< DgString0(operation)
<< DgInt0(errorCode)
<< DgInt1(errorDetail)
<< DgString1(errorString);
}
示例8: DgSqlCode
short SqlciRWExecuteCmd::process(SqlciEnv * sqlci_env)
{
short rc = 0;
PrepStmt * prepStmt = sqlci_env->get_prep_stmts()->get(stmtName_);
if (! prepStmt)
{
sqlci_env->diagsArea() << DgSqlCode(-SQLCI_STMT_NOT_FOUND)
<< DgString0(stmtName_);
return 0;
}
sqlci_env->sqlciRWEnv()->rwExe()->setExecutePrepStmt(prepStmt);
sqlci_env->sqlciRWEnv()->rwExe()->setExecuteCmd(stmtName_);
if (usingParamStr_)
{
rc =
sqlci_env->sqlciRWEnv()->rwExe()->setUsingParamInfo(usingParamStr_);
if (rc)
return 0;
}
sqlci_env->sqlciRWEnv()->rwExe()->setState(SqlciRWInterfaceExecutor::SELECT_STARTED_);
sqlci_env->sqlciRWEnv()->rwExe()->setResetListFlag(FALSE);
rc = sqlci_env->sqlciRWEnv()->rwExe()->process(sqlci_env);
sqlci_env->sqlciRWEnv()->setSelectInProgress(TRUE);
return rc;
}
示例9: name
// read and return descriptor area (headers + entries)
Int32
readDescArea
(fstream &mf, // (IN) : binary module file
module_header_struct &latestModHdr,// (IN) : its module header
NAHeap &heap, // (IN) : allocate DESC area from here
const char * name, // (IN) : module name (for error msg)
ComDiagsArea &diags, // (IN) : deposit any error msg here
char *&descArea) // (OUT): desc headers + entries
{
// make sure we have reasonable arguments
if (latestModHdr.descriptor_area_offset <= 0 ||
latestModHdr.descriptor_area_length <= 0)
return -1;
// allocate space for DESC headers + entries
descArea = (char*)
heap.allocateMemory((size_t)latestModHdr.descriptor_area_length);
// read DESC headers + entries
mf.seekg(latestModHdr.descriptor_area_offset, ios::beg);
mf.read(descArea, (Int32)latestModHdr.descriptor_area_length);
if (mf.fail()) {
diags << DgSqlCode(-CLI_READ_ERROR) << DgString0(name);
return -1;
}
return 1; // all OK
}
示例10: validateLibraryFileExists
// *****************************************************************************
// * *
// * Function: validateLibraryFileExists *
// * *
// * Determines if a library file exists, and if not, reports an error. *
// * *
// * *
// *****************************************************************************
// * *
// * Parameters: *
// * *
// * <libraryFilename> const ComString & In *
// * is the file whose existence is to be validated. *
// * *
// * <isSystemObject> bool In *
// * if true, indicates the filename should be prepended with the value of *
// * MY_SQROOT before validating existence. *
// * *
// *****************************************************************************
static int validateLibraryFileExists(
const NAString &libraryFilename,
bool isSystemObject)
{
NAString completeLibraryFilename(libraryFilename);
if (isSystemObject) {
completeLibraryFilename.insert(0,'/');
completeLibraryFilename.insert(0,getenv("MY_SQROOT"));
}
else
if (CmpCommon::getDefault(CAT_LIBRARY_PATH_RELATIVE) == DF_ON)
completeLibraryFilename.insert(0,getenv("MY_UDR_ROOT"));
char *libraryFilenameString = convertNAString(completeLibraryFilename,STMTHEAP);
struct stat sts;
if ((stat(libraryFilenameString,&sts)) == -1 && errno == ENOENT) {
*CmpCommon::diags() << DgSqlCode(-1382)
<< DgString0(libraryFilename);
return 1;
}
return 0;
}
示例11: cliInterface
short ExExeUtilLongRunningTcb::processContinuing(Lng32 &rc)
{
Int64 rowsAffected = 0;
rc = cliInterface()->execContinuingRows(getContinuingOutputVarPtrList(),
rowsAffected);
if (rc < 0)
{
return -1;
}
if (rowsAffected > 0)
addRowsDeleted(rowsAffected);
#ifdef _DEBUG
if ((rowsAffected > 0) && lrTdb().longRunningQueryPlan()) {
char lruQPInfo[100];
str_sprintf(lruQPInfo, "Continuing rows deleted: %ld\n\n",
rowsAffected);
ComDiagsArea * diagsArea = getDiagAreaFromUpQueueTail();
(*diagsArea) << DgSqlCode(8427) << DgString0(lruQPInfo);
}
#endif
return 0;
}
示例12: csn
NABoolean CmpSqlSession::validateVolatileSchemaName(NAString &schName)
{
if (NOT schName.isNull())
{
ComSchemaName csn(schName);
if (NOT csn.isValid())
{
// Schema name $0~SchemaName is not valid.
*CmpCommon::diags() << DgSqlCode(-8009)
<< DgSchemaName(schName);
return FALSE;
}
Lng32 len = MINOF(strlen(csn.getSchemaNamePartAsAnsiString().data()),
strlen(COM_VOLATILE_SCHEMA_PREFIX));
NAString upSch(csn.getSchemaNamePartAsAnsiString().data());
upSch.toUpper();
if ((NOT Get_SqlParser_Flags(ALLOW_VOLATILE_SCHEMA_IN_TABLE_NAME)) &&
(len > 0) &&
(strncmp(upSch.data(), COM_VOLATILE_SCHEMA_PREFIX, len) == 0))
{
*CmpCommon::diags() << DgSqlCode(-4193)
<< DgString0(COM_VOLATILE_SCHEMA_PREFIX);
return FALSE;
}
}
return TRUE;
}
示例13: 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;
}
示例14: schemaName
// *****************************************************************************
// * *
// * Function: CmpSeabaseDDL::createSeabaseSchema *
// * *
// * Implements the CREATE SCHEMA command. *
// * *
// *****************************************************************************
// * *
// * Parameters: *
// * *
// * <createSchemaNode> StmtDDLCreateSchema * In *
// * is a pointer to a create schema parser node. *
// * *
// * <currentCatalogName> NAString & In *
// * is the name of the current catalog. *
// * *
// *****************************************************************************
void CmpSeabaseDDL::createSeabaseSchema(
StmtDDLCreateSchema * createSchemaNode,
NAString & currentCatalogName)
{
ComSchemaName schemaName (createSchemaNode->getSchemaName());
if (schemaName.getCatalogNamePart().isEmpty())
schemaName.setCatalogNamePart(currentCatalogName);
NAString catName = schemaName.getCatalogNamePartAsAnsiString();
ComAnsiNamePart schNameAsComAnsi = schemaName.getSchemaNamePart();
NAString schName = schNameAsComAnsi.getInternalName();
ExeCliInterface cliInterface(STMTHEAP, NULL, NULL,
CmpCommon::context()->sqlSession()->getParentQid());
ComSchemaClass schemaClass;
Int32 objectOwner = NA_UserIdDefault;
Int32 schemaOwner = NA_UserIdDefault;
int32_t retCode = verifyDDLCreateOperationAuthorized(&cliInterface,
SQLOperation::CREATE_SCHEMA,
catName,
schName,
schemaClass,
objectOwner,
schemaOwner);
if (retCode != 0)
{
handleDDLCreateAuthorizationError(retCode,catName,schName);
return;
}
Int32 schemaOwnerID = NA_UserIdDefault;
// If the AUTHORIZATION clause was not specified, the current user becomes
// the schema owner.
if (createSchemaNode->getAuthorizationID().isNull())
schemaOwnerID = ComUser::getCurrentUser();
else
if (ComUser::getAuthIDFromAuthName(createSchemaNode->getAuthorizationID().data(),
schemaOwnerID) != 0)
{
*CmpCommon::diags() << DgSqlCode(-CAT_AUTHID_DOES_NOT_EXIST_ERROR)
<< DgString0(createSchemaNode->getAuthorizationID().data());
return;
}
addSchemaObject(cliInterface,
schemaName,
createSchemaNode->getSchemaClass(),
schemaOwnerID,
createSchemaNode->createIfNotExists());
}
示例15: match
void ExtQualModuleNames::parseModule
(std::string& cat, std::string& sch, std::string& mod)
{
// parse [[<catalog>.]<schema>.]<module>
std::string id1, id2;
if (nextToken() == ID) {
id1 = currentToken_;
match(ID);
if (nextToken() == DOT) {
match(DOT);
if (nextToken() == ID) {
id2 = currentToken_;
match(ID);
if (nextToken() == DOT) {
match(DOT);
if (nextToken() == ID) { // module is <cat>.<sch>.<mod>
cat = id1;
sch = id2;
mod = currentToken_;
match(ID);
}
else {
*mxCUMptr << FAIL << DgSqlCode(-2213)
<< DgString0(currentToken_.c_str());
}
}
else { // nextToken != DOT
sch = id1; // module is <sch>.<mod>
mod = id2;
cat = moduleCatalog_;
}
}
else {
*mxCUMptr << FAIL << DgSqlCode(-2213)
<< DgString0(currentToken_.c_str());
}
}
else { // nextToken != DOT
mod = id1; // module is just <mod>
sch = moduleSchema_;
cat = moduleCatalog_;
}
}
}