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


C++ ParseVariableBool函数代码示例

本文整理汇总了C++中ParseVariableBool函数的典型用法代码示例。如果您正苦于以下问题:C++ ParseVariableBool函数的具体用法?C++ ParseVariableBool怎么用?C++ ParseVariableBool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: on_error_rollback_hook

static void
on_error_rollback_hook(const char *newval)
{
    if (newval == NULL)
        pset.on_error_rollback = PSQL_ERROR_ROLLBACK_OFF;
    else if (pg_strcasecmp(newval, "interactive") == 0)
        pset.on_error_rollback = PSQL_ERROR_ROLLBACK_INTERACTIVE;
    else if (ParseVariableBool(newval, "ON_ERROR_ROLLBACK"))
        pset.on_error_rollback = PSQL_ERROR_ROLLBACK_ON;
    else	/* ParseVariableBool printed msg if needed */
        pset.on_error_rollback = PSQL_ERROR_ROLLBACK_OFF;
}
开发者ID:stalkerg,项目名称:postgres_cpp,代码行数:12,代码来源:startup.c

示例2: echo_hidden_hook

static void
echo_hidden_hook(const char *newval)
{
    if (newval == NULL)
        pset.echo_hidden = PSQL_ECHO_HIDDEN_OFF;
    else if (pg_strcasecmp(newval, "noexec") == 0)
        pset.echo_hidden = PSQL_ECHO_HIDDEN_NOEXEC;
    else if (ParseVariableBool(newval, "ECHO_HIDDEN"))
        pset.echo_hidden = PSQL_ECHO_HIDDEN_ON;
    else	/* ParseVariableBool printed msg if needed */
        pset.echo_hidden = PSQL_ECHO_HIDDEN_OFF;
}
开发者ID:stalkerg,项目名称:postgres_cpp,代码行数:12,代码来源:startup.c

示例3: singlestep_hook

static void
singlestep_hook(const char *newval)
{
    pset.singlestep = ParseVariableBool(newval, "SINGLESTEP");
}
开发者ID:stalkerg,项目名称:postgres_cpp,代码行数:5,代码来源:startup.c

示例4: quiet_hook

static void
quiet_hook(const char *newval)
{
    pset.quiet = ParseVariableBool(newval, "QUIET");
}
开发者ID:stalkerg,项目名称:postgres_cpp,代码行数:5,代码来源:startup.c

示例5: singleline_hook

static void
singleline_hook(const char *newval)
{
    pset.singleline = ParseVariableBool(newval, "SINGLELINE");
}
开发者ID:stalkerg,项目名称:postgres_cpp,代码行数:5,代码来源:startup.c

示例6: on_error_stop_hook

static void
on_error_stop_hook(const char *newval)
{
    pset.on_error_stop = ParseVariableBool(newval, "ON_ERROR_STOP");
}
开发者ID:stalkerg,项目名称:postgres_cpp,代码行数:5,代码来源:startup.c

示例7: autocommit_hook

static void
autocommit_hook(const char *newval)
{
    pset.autocommit = ParseVariableBool(newval, "AUTOCOMMIT");
}
开发者ID:stalkerg,项目名称:postgres_cpp,代码行数:5,代码来源:startup.c

示例8: on_error_stop_hook

static void
on_error_stop_hook(const char *newval)
{
    pset.on_error_stop = ParseVariableBool(newval);
}
开发者ID:pguyot,项目名称:postgres,代码行数:5,代码来源:startup.c

示例9: do_pset

bool
do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
{
	size_t		vallen = 0;

	psql_assert(param);

	if (value)
		vallen = strlen(value);

	/* set format */
	if (strcmp(param, "format") == 0)
	{
		if (!value)
			;
		else if (pg_strncasecmp("unaligned", value, vallen) == 0)
			popt->topt.format = PRINT_UNALIGNED;
		else if (pg_strncasecmp("aligned", value, vallen) == 0)
			popt->topt.format = PRINT_ALIGNED;
		else if (pg_strncasecmp("wrapped", value, vallen) == 0)
			popt->topt.format = PRINT_WRAPPED;
		else if (pg_strncasecmp("html", value, vallen) == 0)
			popt->topt.format = PRINT_HTML;
		else if (pg_strncasecmp("latex", value, vallen) == 0)
			popt->topt.format = PRINT_LATEX;
		else if (pg_strncasecmp("troff-ms", value, vallen) == 0)
			popt->topt.format = PRINT_TROFF_MS;
		else
		{
			psql_error("\\pset: allowed formats are unaligned, aligned, wrapped, html, latex, troff-ms\n");
			return false;
		}

		if (!quiet)
			printf(_("Output format is %s.\n"), _align2string(popt->topt.format));
	}

	/* set table line style */
	else if (strcmp(param, "linestyle") == 0)
	{
		if (!value)
			;
		else if (pg_strncasecmp("ascii", value, vallen) == 0)
			popt->topt.line_style = &pg_asciiformat;
		else if (pg_strncasecmp("old-ascii", value, vallen) == 0)
			popt->topt.line_style = &pg_asciiformat_old;
		else if (pg_strncasecmp("unicode", value, vallen) == 0)
			popt->topt.line_style = &pg_utf8format;
		else
		{
			psql_error("\\pset: allowed line styles are ascii, old-ascii, unicode\n");
			return false;
		}

		if (!quiet)
			printf(_("Line style is %s.\n"),
				   get_line_style(&popt->topt)->name);
	}

	/* set border style/width */
	else if (strcmp(param, "border") == 0)
	{
		if (value)
			popt->topt.border = atoi(value);

		if (!quiet)
			printf(_("Border style is %d.\n"), popt->topt.border);
	}

	/* set expanded/vertical mode */
	else if (strcmp(param, "x") == 0 || strcmp(param, "expanded") == 0 || strcmp(param, "vertical") == 0)
	{
		if (value)
			popt->topt.expanded = ParseVariableBool(value);
		else
			popt->topt.expanded = !popt->topt.expanded;
		if (!quiet)
			printf(popt->topt.expanded
				   ? _("Expanded display is on.\n")
				   : _("Expanded display is off.\n"));
	}

	/* locale-aware numeric output */
	else if (strcmp(param, "numericlocale") == 0)
	{
		if (value)
			popt->topt.numericLocale = ParseVariableBool(value);
		else
			popt->topt.numericLocale = !popt->topt.numericLocale;
		if (!quiet)
		{
			if (popt->topt.numericLocale)
				puts(_("Showing locale-adjusted numeric output."));
			else
				puts(_("Locale-adjusted numeric output is off."));
		}
	}

	/* null display */
	else if (strcmp(param, "null") == 0)
//.........这里部分代码省略.........
开发者ID:50wu,项目名称:gpdb,代码行数:101,代码来源:command.c

示例10: exec_command


//.........这里部分代码省略.........
			free(newval);
		}
		free(opt0);
	}

	/* \t -- turn off headers and row count */
	else if (strcmp(cmd, "t") == 0)
	{
		char	   *opt = psql_scan_slash_option(scan_state,
												 OT_NORMAL, NULL, true);

		success = do_pset("tuples_only", opt, &pset.popt, pset.quiet);
		free(opt);
	}


	/* \T -- define html <table ...> attributes */
	else if (strcmp(cmd, "T") == 0)
	{
		char	   *value = psql_scan_slash_option(scan_state,
												   OT_NORMAL, NULL, false);

		success = do_pset("tableattr", value, &pset.popt, pset.quiet);
		free(value);
	}

	/* \timing -- toggle timing of queries */
	else if (strcmp(cmd, "timing") == 0)
	{
		char	   *opt = psql_scan_slash_option(scan_state,
												 OT_NORMAL, NULL, false);

		if (opt)
			pset.timing = ParseVariableBool(opt);
		else
			pset.timing = !pset.timing;
		if (!pset.quiet)
		{
			if (pset.timing)
				puts(_("Timing is on."));
			else
				puts(_("Timing is off."));
		}
		free(opt);
	}

	/* \unset */
	else if (strcmp(cmd, "unset") == 0)
	{
		char	   *opt = psql_scan_slash_option(scan_state,
												 OT_NORMAL, NULL, false);

		if (!opt)
		{
			psql_error("\\%s: missing required argument\n", cmd);
			success = false;
		}
		else if (!SetVariable(pset.vars, opt, NULL))
		{
			psql_error("\\%s: error\n", cmd);
			success = false;
		}
		free(opt);
	}

	/* \w -- write query buffer to file */
开发者ID:50wu,项目名称:gpdb,代码行数:67,代码来源:command.c


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