当前位置: 首页>>代码示例>>C++>>正文


C++ MsgFormat::SafeArg方法代码示例

本文整理汇总了C++中MsgFormat::SafeArg方法的典型用法代码示例。如果您正苦于以下问题:C++ MsgFormat::SafeArg方法的具体用法?C++ MsgFormat::SafeArg怎么用?C++ MsgFormat::SafeArg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MsgFormat的用法示例。


在下文中一共展示了MsgFormat::SafeArg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: execute_abort

static void execute_abort( qli_nod* node)
{
/**************************************
 *
 *	e x e c u t e _ a b o r t
 *
 **************************************
 *
 * Functional description
 *	Abort a statement.
 *
 **************************************/
	if (node->nod_count)
	{
	    const TEXT* ptr = NULL;
		Firebird::VaryStr<80> temp;
		const USHORT l =
			MOVQ_get_string(EVAL_value(node->nod_arg[0]), &ptr, &temp, sizeof(temp));

		UCHAR msg[128];
		MOVQ_terminate(ptr, (SCHAR*) msg, l, sizeof(msg));
		ERRQ_error(40, SafeArg() << msg);
		// Msg40 Request terminated by statement: %s
	}

	IBERROR(41);				// Msg41 Request terminated by statement
}
开发者ID:tux-mind,项目名称:platform_external_firebird,代码行数:27,代码来源:exe.cpp

示例2: CMD_rename_proc

void CMD_rename_proc( qli_syntax* node)
{
/**************************************
 *
 *	C M D _ r e n a m e _ p r o c
 *
 **************************************
 *
 * Functional description
 *	Rename a procedure in the named database,
 *	or the most recently readied database.
 *
 **************************************/
	qli_proc* old_proc = (qli_proc*) node->syn_arg[0];
	qli_proc* new_proc = (qli_proc*) node->syn_arg[1];

	qli_dbb* database = old_proc->qpr_database;
	if (!database)
		database = QLI_databases;

	if (new_proc->qpr_database && (new_proc->qpr_database != database))
		IBERROR(84);			// Msg84 Procedures can not be renamed across databases. Try COPY
	const qli_name* old_name = old_proc->qpr_name;
	const qli_name* new_name = new_proc->qpr_name;

	if (PRO_rename_procedure(database, old_name->nam_string, new_name->nam_string))
	{
		return;
	}

	ERRQ_error(85, SafeArg() << old_name->nam_string << database->dbb_symbol->sym_string);
	// Msg85 Procedure %s not found in database %s
}
开发者ID:andrewleech,项目名称:firebird,代码行数:33,代码来源:command.cpp

示例3: reconnect

static bool reconnect(FB_API_HANDLE handle, SLONG number, const TEXT* name, SINT64 switches)
{
    ISC_STATUS_ARRAY status_vector;

    const SLONG id = gds__vax_integer(reinterpret_cast<const UCHAR*>(&number), 4);
    FB_API_HANDLE transaction = 0;
    if (isc_reconnect_transaction(status_vector, &handle, &transaction,
                                  sizeof(id), reinterpret_cast<const char*>(&id)))
    {
        ALICE_print(90, SafeArg() << name);
        // msg 90: failed to reconnect to a transaction in database %s
        ALICE_print_status(true, status_vector);
        return true;
    }

    if (!(switches & (sw_commit | sw_rollback)))
    {
        ALICE_print(91, SafeArg() << number);
        // msg 91: Transaction %ld:
        switches = ask();
        if (switches == ~SINT64(0))
        {
            ALICE_print(84);
            // msg 84: unexpected end of input
            return true;
        }
    }

    if (switches & sw_commit)
        isc_commit_transaction(status_vector, &transaction);
    else if (switches & sw_rollback)
        isc_rollback_transaction(status_vector, &transaction);
    else
        return false;

    if (status_vector[1])
    {
        ALICE_print_status(true, status_vector);
        return true;
    }

    return false;
}
开发者ID:ariska-net,项目名称:firebird,代码行数:43,代码来源:tdr.cpp

示例4: CMD_extract

void CMD_extract( qli_syntax* node)
{
/**************************************
 *
 *	C M D _ e x t r a c t
 *
 **************************************
 *
 * Functional description
 *	Extract a series of procedures.
 *
 **************************************/
	FILE* file = (FILE*) EXEC_open_output((qli_nod*) node->syn_arg[1]);

	qli_syntax* list = node->syn_arg[0];
	if (list)
	{
		qli_syntax** ptr = list->syn_arg;
		for (const qli_syntax* const* const end = ptr + list->syn_count; ptr < end; ptr++)
		{
			qli_proc* proc = (qli_proc*) *ptr;
			qli_dbb* database = proc->qpr_database;
			if (!database)
				database = QLI_databases;

			const qli_name* name = proc->qpr_name;
			FB_API_HANDLE blob = PRO_fetch_procedure(database, name->nam_string);
			if (!blob)
			{
				ERRQ_msg_put(89, SafeArg() << name->nam_string << database->dbb_symbol->sym_string);
				// Msg89 Procedure %s not found in database %s
				continue;
			}
			dump_procedure(database, file, name->nam_string, name->nam_length, blob);
		}
	}
	else
	{
		CMD_check_ready();
		for (qli_dbb* database = QLI_databases; database; database = database->dbb_next)
		{
			PRO_scan(database, extract_procedure, file);
		}
	}

#ifdef WIN_NT
	if (((qli_nod*) node->syn_arg[1])->nod_arg[e_out_pipe])
		_pclose(file);
	else
#endif
		fclose(file);
}
开发者ID:andrewleech,项目名称:firebird,代码行数:52,代码来源:command.cpp

示例5: yes_no

static bool yes_no(USHORT number, const TEXT* arg1)
{
/**************************************
 *
 *	y e s _ n o
 *
 **************************************
 *
 * Functional description
 *	Put out a prompt that expects a yes/no
 *	answer, and keep trying until we get an
 *	acceptable answer (e.g. y, Yes, N, etc.)
 *
 **************************************/
	TEXT prompt[256];

	ERRQ_msg_format(number, sizeof(prompt), prompt, SafeArg() << arg1);

	if (!yes_no_loaded)
	{
		yes_no_loaded = true;
		// Msg498 NO
		if (!ERRQ_msg_get(498, answer_table[0].answer, sizeof(answer_table[0].answer)))
			strcpy(answer_table[0].answer, "NO");	// default if msg_get fails

		// Msg497 YES
		if (!ERRQ_msg_get(497, answer_table[1].answer, sizeof(answer_table[1].answer)))
			strcpy(answer_table[1].answer, "YES");
	}

	TEXT buffer[256];
	while (true)
	{
		buffer[0] = 0;
		if (!LEX_get_line(prompt, buffer, sizeof(buffer)))
			return true;
		for (const answer_t* response = answer_table; *response->answer != '\0'; response++)
		{
			const TEXT* p = buffer;
			while (*p == ' ')
				p++;
			if (*p == EOF)
				return true;
			for (const TEXT* q = response->answer; *p && UPPER(*p) == *q++; p++)
				;
			if (!*p || *p == '\n')
				return response->value;
		}
	}
}
开发者ID:mp-lee,项目名称:core,代码行数:50,代码来源:dtr.cpp

示例6: ERRQ_print_error

void ERRQ_print_error(USHORT number, const char* str)
{
/**************************************
 *
 *	E R R Q _ p r i n t _ e r r o r
 *
 **************************************
 *
 * Functional description
 *	An error has occurred.  Put out an error message and
 *	unwind.
 *
 **************************************/

	ERRQ_error(number, SafeArg() << str);
}
开发者ID:Alexpux,项目名称:firebird,代码行数:16,代码来源:err.cpp

示例7: ERRQ_msg_put

void ERRQ_msg_put(USHORT number, const char* str)
{
/**************************************
 *
 *	E R R Q _ m s g _ p u t
 *
 **************************************
 *
 * Functional description
 *	Retrieve a message from the error file, format it, and print it
 * It's same outcome as ERRQ_msg_partial but with a newline at the end.
 *
 **************************************/

	fb_msg_format(0, QLI_MSG_FAC, number, sizeof(ERRQ_message), ERRQ_message, SafeArg() << str);
	printf("%s\n", ERRQ_message);
}
开发者ID:Alexpux,项目名称:firebird,代码行数:17,代码来源:err.cpp

示例8: ERRQ_error

void ERRQ_error(USHORT number, const char* str)
{
/**************************************
 *
 *	E R R Q _ e r r o r
 *
 **************************************
 *
 * Functional description
 *	An error has occurred.  Put out an error message and
 *	unwind.  If this was called before the unwind path
 *	was established, don't unwind just print error and exit.
 *
 **************************************/

	ERRQ_error(number, SafeArg() << str);
}
开发者ID:Alexpux,项目名称:firebird,代码行数:17,代码来源:err.cpp

示例9: ERRQ_bugcheck

void ERRQ_bugcheck( USHORT number)
{
/**************************************
 *
 *	E R R Q _ b u g c h e c k
 *
 **************************************
 *
 * Functional description
 *	Somebody has screwed up.  Bugcheck.
 *
 **************************************/
	TEXT s[256];

	ERRQ_msg_format(number, sizeof(s), s);
	ERRQ_error(9, SafeArg() << s);	// Msg9 INTERNAL: %s
}
开发者ID:Alexpux,项目名称:firebird,代码行数:17,代码来源:err.cpp

示例10: TDR_attach_database

bool TDR_attach_database(ISC_STATUS* status_vector, tdr* trans, const TEXT* pathname)
{
    AliceGlobals* tdgbl = AliceGlobals::getSpecific();

    if (tdgbl->ALICE_data.ua_debug)
        ALICE_print(68, SafeArg() << pathname); // msg 68: ATTACH_DATABASE: attempted attach of %s

    Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
    dpb.insertTag(isc_dpb_no_garbage_collect);
    dpb.insertTag(isc_dpb_gfix_attach);
    tdgbl->uSvc->fillDpb(dpb);
    if (tdgbl->ALICE_data.ua_user) {
        dpb.insertString(isc_dpb_user_name, tdgbl->ALICE_data.ua_user, fb_strlen(tdgbl->ALICE_data.ua_user));
    }
    if (tdgbl->ALICE_data.ua_password)
    {
        dpb.insertString(tdgbl->uSvc->isService() ? isc_dpb_password_enc : isc_dpb_password,
                         tdgbl->ALICE_data.ua_password, fb_strlen(tdgbl->ALICE_data.ua_password));
    }

    trans->tdr_db_handle = 0;

    isc_attach_database(status_vector, 0, pathname,
                        &trans->tdr_db_handle, dpb.getBufferLength(),
                        reinterpret_cast<const char*>(dpb.getBuffer()));

    if (status_vector[1])
    {
        if (tdgbl->ALICE_data.ua_debug)
        {
            ALICE_print(69);	// msg 69:  failed
            ALICE_print_status(false, status_vector);
        }
        return false;
    }

    MET_set_capabilities(status_vector, trans);

    if (tdgbl->ALICE_data.ua_debug)
        ALICE_print(70);	// msg 70:  succeeded

    return true;
}
开发者ID:ariska-net,项目名称:firebird,代码行数:43,代码来源:tdr.cpp

示例11: ERRQ_syntax

void ERRQ_syntax( USHORT number)
{
/**************************************
 *
 *	E R R Q _ s y n t a x
 *
 **************************************
 *
 * Functional description
 *	Syntax error has occurred.  Give some hint of what went
 *	wrong.
 *
 **************************************/
	TEXT s[256];

	ERRQ_msg_format(number, sizeof(s), s);
	ERRQ_error(13, SafeArg() << s << QLI_token->tok_string);
	// Msg13 expected %s, encountered %s
}
开发者ID:Alexpux,项目名称:firebird,代码行数:19,代码来源:err.cpp

示例12: ERRQ_error_format

void ERRQ_error_format(USHORT number, const SafeArg& arg)
{
/**************************************
 *
 *	E R R Q _ e r r o r _ f o r m a t
 *
 **************************************
 *
 * Functional description
 *	Retrieve a message from the error file and format it
 *      in the standard qli error format, put it where
 *      ERRQ_pending expects to find it.
 **************************************/
	TEXT s[256];

	fb_msg_format(0, QLI_MSG_FAC, number, sizeof(s), s, arg);
	fb_msg_format(0, QLI_MSG_FAC, 12, sizeof(ERRQ_message), ERRQ_message, SafeArg() << s);
	// Msg12 ** QLI error: %s **
	QLI_error = ERRQ_message;
	QLI_skip_line = true;
}
开发者ID:Alexpux,项目名称:firebird,代码行数:21,代码来源:err.cpp

示例13: CMD_delete_proc

void CMD_delete_proc( qli_syntax* node)
{
/**************************************
 *
 *	C M D _ d e l e t e _ p r o c
 *
 **************************************
 *
 * Functional description
 *	Delete a procedure in the named database
 *	or in the most recently readied database.
 *
 **************************************/
	qli_proc* proc = (qli_proc*) node->syn_arg[0];

	if (!proc->qpr_database)
		proc->qpr_database = QLI_databases;

	if (PRO_delete_procedure(proc->qpr_database, proc->qpr_name->nam_string))
		return;

	ERRQ_msg_put(88, SafeArg() << proc->qpr_name->nam_string <<	// Msg88 Procedure %s not found in database %s
				 proc->qpr_database->dbb_symbol->sym_string);
}
开发者ID:andrewleech,项目名称:firebird,代码行数:24,代码来源:command.cpp

示例14: alice

int alice(Firebird::UtilSvc* uSvc)
{
	AliceGlobals gblInstance(uSvc);
	AliceGlobals* tdgbl = &gblInstance;
	AliceGlobals::putSpecific(tdgbl);
	int exit_code = FINI_ERROR;

	try {

//  Perform some special handling when run as a Firebird service.  The
//  first switch can be "-svc" (lower case!) or it can be "-svc_re" followed
//  by 3 file descriptors to use in re-directing stdin, stdout, and stderr.

	tdgbl->ALICE_data.ua_user = NULL;
	tdgbl->ALICE_data.ua_password = NULL;
#ifdef TRUSTED_AUTH
	tdgbl->ALICE_data.ua_trusted = false;
#endif
	tdgbl->ALICE_data.ua_tr_user = NULL;
	tdgbl->ALICE_data.ua_tr_role = false;

//  Start by parsing switches

	bool error = false, help = false;
	SINT64 flags = 0;
	tdgbl->ALICE_data.ua_shutdown_delay = 0;
	const TEXT* database = NULL;
	TEXT	string[512];

	const char** argv = uSvc->argv.begin();
	int argc = uSvc->argv.getCount();
	++argv;

	// tested outside the loop
	const in_sw_tab_t* table = alice_in_sw_table;

	while (--argc > 0)
	{
		if ((*argv)[0] != '-')
		{
			if (database)
			{
				ALICE_error(1, SafeArg() << database);
				// msg 1: "data base file name (%s) already given",
			}
			database = *argv++;

			continue;
		}

		ALICE_down_case(*argv++, string, sizeof(string));
		if (!string[1]) {
			continue;
		}
		if (strcmp(string, "-?") == 0)
		{
			error = help = true;
			break;
		}

		for (table = alice_in_sw_table; true; ++table)
		{
			const TEXT* p = (TEXT*) table->in_sw_name;
			if (!p)
			{
				ALICE_print(2, SafeArg() << (*--argv));	// msg 2: invalid switch %s
				error = true;
				break;
			}

			TEXT* q = &string[1];
			while (*q && *p++ == *q)
			{
				q++;
			}
			if (!*q && (q - &string[1] >= table->in_sw_min_length))
			{
				break;
			}
		}
		if (error) {
			break;
		}
		if (*table->in_sw_name == 'x') {
			tdgbl->ALICE_data.ua_debug++;
		}
        if (table->in_sw_value & sw_trusted_svc)
        {
			uSvc->checkService();
			if (--argc <= 0) {
				ALICE_error(13);	// msg 13: user name required
			}
			tdgbl->ALICE_data.ua_tr_user = *argv++;
			continue;
		}
        if (table->in_sw_value & sw_trusted_role)
        {
			uSvc->checkService();
			tdgbl->ALICE_data.ua_tr_role = true;
			continue;
//.........这里部分代码省略.........
开发者ID:ASSmodeus,项目名称:dsploit,代码行数:101,代码来源:alice.cpp

示例15: LEX_token

qli_tok* LEX_token()
{
/**************************************
 *
 *	L E X _ t o k e n
 *
 **************************************
 *
 * Functional description
 *	Parse and return the next token.
 *
 **************************************/
	qli_tok* token = QLI_token;
	TEXT* p = token->tok_string;

	// Get next significant byte.  If it's the last EOL of a blob, throw it away

	SSHORT c;

	for (;;)
	{
		c = skip_white();
		if (c != '\n' || QLI_line->line_type != line_blob)
			break;
		qli_line* prior = QLI_line;
		next_line(true);
		if (prior == QLI_line)
			break;
	}

	// If we hit end of file, make up a phoney token

	if (!QLI_line)
	{
		const TEXT* q = eof_string;
		while (*p++ = *q++);
		token->tok_type = tok_eof;
		token->tok_keyword = KW_none;
		return NULL;
	}

	*p++ = c;
	QLI_token->tok_position = QLI_line->line_position + QLI_line->line_ptr - QLI_line->line_data - 1;

	// On end of file, generate furious but phone end of line tokens

	char char_class = classes(c);

	if (char_class & CHR_letter)
	{
		for (c = nextchar(true); classes(c) & CHR_ident; c = nextchar(true))
			*p++ = c;
		retchar();
		token->tok_type = tok_ident;
	}
	else if (((char_class & CHR_digit) || c == '.') && scan_number(c, &p))
		token->tok_type = tok_number;
	else if (char_class & CHR_quote)
	{
		token->tok_type = tok_quoted;
		while (true)
		{
			const SSHORT next = nextchar(false);
			if (!next || next == '\n')
			{
				retchar();
				IBERROR(63);	// Msg 63 unterminated quoted string
				break;
			}
			*p++ = next;
			if ((p - token->tok_string) >= MAXSYMLEN)
				ERRQ_msg_put(470, SafeArg() << MAXSYMLEN);	// Msg 470 literal too long

			// If there are 2 quotes in a row, interpret 2nd as a literal

			if (next == c)
			{
				const SSHORT peek = nextchar(false);
				retchar();
				if (peek != c)
					break;
				nextchar(false);
			}
		}
	}
	else if (c == '\n')
	{
	    // end of line, signal it properly with a phoney token.
		token->tok_type = tok_eol;
		--p;
		const TEXT* q = eol_string;
		while (*q)
			*p++ = *q++;
	}
	else
	{
		token->tok_type = tok_punct;
		*p++ = nextchar(true);
		if (!HSH_lookup(token->tok_string, 2))
		{
//.........这里部分代码省略.........
开发者ID:narolez571,项目名称:firebird,代码行数:101,代码来源:lex.cpp


注:本文中的MsgFormat::SafeArg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。