本文整理汇总了C++中pg_strcasecmp函数的典型用法代码示例。如果您正苦于以下问题:C++ pg_strcasecmp函数的具体用法?C++ pg_strcasecmp怎么用?C++ pg_strcasecmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pg_strcasecmp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: echo_hidden_hook
static void
echo_hidden_hook(const char *newval)
{
if (newval == NULL)
pset.echo_hidden = PSQL_ECHO_HIDDEN_OFF;
else if (strcmp(newval, "noexec") == 0)
pset.echo_hidden = PSQL_ECHO_HIDDEN_NOEXEC;
else if (pg_strcasecmp(newval, "off") == 0)
pset.echo_hidden = PSQL_ECHO_HIDDEN_OFF;
else
pset.echo_hidden = PSQL_ECHO_HIDDEN_ON;
}
示例2: verbosity_hook
static void
verbosity_hook(const char *newval)
{
if (newval == NULL)
pset.verbosity = PQERRORS_DEFAULT;
else if (pg_strcasecmp(newval, "default") == 0)
pset.verbosity = PQERRORS_DEFAULT;
else if (pg_strcasecmp(newval, "terse") == 0)
pset.verbosity = PQERRORS_TERSE;
else if (pg_strcasecmp(newval, "verbose") == 0)
pset.verbosity = PQERRORS_VERBOSE;
else
{
psql_error("unrecognized value \"%s\" for \"%s\"; assuming \"%s\"\n",
newval, "VERBOSITY", "default");
pset.verbosity = PQERRORS_DEFAULT;
}
if (pset.db)
PQsetErrorVerbosity(pset.db, pset.verbosity);
}
示例3: 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;
}
示例4: 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;
}
示例5: locate_stem_module
static void
locate_stem_module(DictSnowball *d, char *lang)
{
const stemmer_module *m;
/*
* First, try to find exact match of stemmer module. Stemmer with
* PG_SQL_ASCII encoding is treated as working with any server encoding
*/
for (m = stemmer_modules; m->name; m++)
{
if ((m->enc == PG_SQL_ASCII || m->enc == GetDatabaseEncoding()) &&
pg_strcasecmp(m->name, lang) == 0)
{
d->stem = m->stem;
d->z = m->create();
d->needrecode = false;
return;
}
}
/*
* Second, try to find stemmer for needed language for UTF8 encoding.
*/
for (m = stemmer_modules; m->name; m++)
{
if (m->enc == PG_UTF8 && pg_strcasecmp(m->name, lang) == 0)
{
d->stem = m->stem;
d->z = m->create();
d->needrecode = true;
return;
}
}
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("no Snowball stemmer available for language \"%s\" and encoding \"%s\"",
lang, GetDatabaseEncodingName())));
}
示例6: thesaurus_init
Datum
thesaurus_init(PG_FUNCTION_ARGS)
{
List *dictoptions = (List *) PG_GETARG_POINTER(0);
DictThesaurus *d;
char *subdictname = NULL;
bool fileloaded = false;
ListCell *l;
d = (DictThesaurus *) palloc0(sizeof(DictThesaurus));
foreach(l, dictoptions)
{
DefElem *defel = (DefElem *) lfirst(l);
if (pg_strcasecmp("DictFile", defel->defname) == 0)
{
if (fileloaded)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("multiple DictFile parameters")));
thesaurusRead(defGetString(defel), d);
fileloaded = true;
}
else if (pg_strcasecmp("Dictionary", defel->defname) == 0)
{
if (subdictname)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("multiple Dictionary parameters")));
subdictname = pstrdup(defGetString(defel));
}
else
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("unrecognized Thesaurus parameter: \"%s\"",
defel->defname)));
}
}
示例7: defGetTypeLength
/*
* Extract a type length indicator (either absolute bytes, or
* -1 for "variable") from a DefElem.
*/
int
defGetTypeLength(DefElem *def)
{
if (def->arg == NULL)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("%s requires a parameter",
def->defname)));
switch (nodeTag(def->arg))
{
case T_Integer:
return intVal(def->arg);
case T_Float:
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("%s requires an integer value",
def->defname)));
break;
case T_String:
if (pg_strcasecmp(strVal(def->arg), "variable") == 0)
return -1; /* variable length */
break;
case T_TypeName:
/* cope if grammar chooses to believe "variable" is a typename */
if (pg_strcasecmp(TypeNameToString((TypeName *) def->arg),
"variable") == 0)
return -1; /* variable length */
break;
case T_List:
/* must be an operator name */
break;
default:
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(def->arg));
}
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid argument for %s: \"%s\"",
def->defname, defGetString(def))));
return 0; /* keep compiler quiet */
}
示例8: ParseVariableBool
/*
* Try to interpret "value" as a boolean value, and if successful,
* store it in *result. Otherwise don't clobber *result.
*
* Valid values are: true, false, yes, no, on, off, 1, 0; as well as unique
* prefixes thereof.
*
* "name" is the name of the variable we're assigning to, to use in error
* report if any. Pass name == NULL to suppress the error report.
*
* Return true when "value" is syntactically valid, false otherwise.
*/
bool
ParseVariableBool(const char *value, const char *name, bool *result)
{
size_t len;
bool valid = true;
/* Treat "unset" as an empty string, which will lead to error below */
if (value == NULL)
value = "";
len = strlen(value);
if (len > 0 && pg_strncasecmp(value, "true", len) == 0)
*result = true;
else if (len > 0 && pg_strncasecmp(value, "false", len) == 0)
*result = false;
else if (len > 0 && pg_strncasecmp(value, "yes", len) == 0)
*result = true;
else if (len > 0 && pg_strncasecmp(value, "no", len) == 0)
*result = false;
/* 'o' is not unique enough */
else if (pg_strncasecmp(value, "on", (len > 2 ? len : 2)) == 0)
*result = true;
else if (pg_strncasecmp(value, "off", (len > 2 ? len : 2)) == 0)
*result = false;
else if (pg_strcasecmp(value, "1") == 0)
*result = true;
else if (pg_strcasecmp(value, "0") == 0)
*result = false;
else
{
/* string is not recognized; don't clobber *result */
if (name)
psql_error("unrecognized value \"%s\" for \"%s\": boolean expected\n",
value, name);
valid = false;
}
return valid;
}
示例9: assign_regex_flavor
/*
* assign_regex_flavor - GUC hook to validate and set REGEX_FLAVOR
*/
const char *
assign_regex_flavor(const char *value, bool doit, GucSource source)
{
if (pg_strcasecmp(value, "advanced") == 0)
{
if (doit)
regex_flavor = REG_ADVANCED;
}
else if (pg_strcasecmp(value, "extended") == 0)
{
if (doit)
regex_flavor = REG_EXTENDED;
}
else if (pg_strcasecmp(value, "basic") == 0)
{
if (doit)
regex_flavor = REG_BASIC;
}
else
return NULL; /* fail */
return value; /* OK */
}
示例10: gpvars_assign_gp_resqueue_memory_policy
/*
* gpvars_assign_gp_resqueue_memory_policy
* gpvars_show_gp_resqueue_memory_policy
*/
const char *
gpvars_assign_gp_resqueue_memory_policy(const char *newval, bool doit, GucSource source __attribute__((unused)) )
{
ResQueueMemoryPolicy newtype = RESQUEUE_MEMORY_POLICY_NONE;
if (newval == NULL || newval[0] == 0 ||
!pg_strcasecmp("none", newval))
newtype = RESQUEUE_MEMORY_POLICY_NONE;
else if (!pg_strcasecmp("auto", newval))
newtype = RESQUEUE_MEMORY_POLICY_AUTO;
else if (!pg_strcasecmp("eager_free", newval))
newtype = RESQUEUE_MEMORY_POLICY_EAGER_FREE;
else
elog(ERROR, "unknown resource queue memory policy: current policy is '%s'", gpvars_show_gp_resqueue_memory_policy());
if (doit)
{
gp_resqueue_memory_policy = newtype;
}
return newval;
}
示例11: IsoLocaleName
/*
* Convert Windows locale name to the ISO formatted one
* if possible.
*
* This function returns NULL if conversion is impossible,
* otherwise returns the pointer to a static area which
* contains the iso formatted locale name.
*/
static
char *
IsoLocaleName(const char *winlocname)
{
#if (_MSC_VER >= 1400) /* VC8.0 or later */
static char iso_lc_messages[32];
_locale_t loct = NULL;
if (pg_strcasecmp("c", winlocname) == 0 ||
pg_strcasecmp("posix", winlocname) == 0)
{
strcpy(iso_lc_messages, "C");
return iso_lc_messages;
}
loct = _create_locale(LC_CTYPE, winlocname);
if (loct != NULL)
{
char isolang[32],
isocrty[32];
LCID lcid;
lcid = loct->locinfo->lc_handle[LC_CTYPE];
if (lcid == 0)
lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
_free_locale(loct);
if (!GetLocaleInfoA(lcid, LOCALE_SISO639LANGNAME, isolang, sizeof(isolang)))
return NULL;
if (!GetLocaleInfoA(lcid, LOCALE_SISO3166CTRYNAME, isocrty, sizeof(isocrty)))
return NULL;
snprintf(iso_lc_messages, sizeof(iso_lc_messages) - 1, "%s_%s", isolang, isocrty);
return iso_lc_messages;
}
return NULL;
#else
return NULL; /* Not supported on this version of msvc/mingw */
#endif /* _MSC_VER >= 1400 */
}
示例12: dsnowball_init
Datum
dsnowball_init(PG_FUNCTION_ARGS)
{
List *dictoptions = (List *) PG_GETARG_POINTER(0);
DictSnowball *d;
bool stoploaded = false;
ListCell *l;
d = (DictSnowball *) palloc0(sizeof(DictSnowball));
foreach(l, dictoptions)
{
DefElem *defel = (DefElem *) lfirst(l);
if (pg_strcasecmp("StopWords", defel->defname) == 0)
{
if (stoploaded)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("multiple StopWords parameters")));
readstoplist(defGetString(defel), &d->stoplist, lowerstr);
stoploaded = true;
}
else if (pg_strcasecmp("Language", defel->defname) == 0)
{
if (d->stem)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("multiple Language parameters")));
locate_stem_module(d, defGetString(defel));
}
else
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("unrecognized Snowball parameter: \"%s\"",
defel->defname)));
}
}
示例13: gpvars_assign_gp_interconnect_type
/*
* gpvars_assign_gp_interconnect_type
* gpvars_show_gp_interconnect_type
*/
const char *
gpvars_assign_gp_interconnect_type(const char *newval, bool doit, GucSource source __attribute__((unused)) )
{
int newtype = 0;
if (newval == NULL || newval[0] == 0 ||
!pg_strcasecmp("tcp", newval))
newtype = INTERCONNECT_TYPE_TCP;
else if (!pg_strcasecmp("udp", newval))
newtype = INTERCONNECT_TYPE_UDP;
else if (!pg_strcasecmp("nil", newval))
newtype = INTERCONNECT_TYPE_NIL;
else
elog(ERROR, "Unknown interconnect type. (current type is '%s')", gpvars_show_gp_interconnect_type());
if (doit)
{
if (newtype == INTERCONNECT_TYPE_NIL)
{
if (Gp_role == GP_ROLE_DISPATCH)
elog(WARNING, "Nil-Interconnect diagnostic mode enabled (tuple will be dropped).");
else
elog(LOG, "Nil-Interconnect diagnostic mode enabled (tuple will be dropped).");
}
else if (Gp_interconnect_type == INTERCONNECT_TYPE_NIL)
{
if (Gp_role == GP_ROLE_DISPATCH)
elog(WARNING, "Nil-Interconnect diagnostic mode disabled.");
else
elog(LOG, "Nil-Interconnect diagnostic mode disabled.");
}
Gp_interconnect_type = newtype;
}
return newval;
} /* gpvars_assign_gp_log_interconnect */
示例14: pg_timezone_initialize
/*
* Initialize timezone library
*
* This is called after initial loading of postgresql.conf. If no TimeZone
* setting was found therein, we try to derive one from the environment.
*/
void
pg_timezone_initialize(void)
{
/* Do we need to try to figure the timezone? */
if (pg_strcasecmp(GetConfigOption("timezone"), "UNKNOWN") == 0)
{
const char *def_tz;
/* Select setting */
def_tz = select_default_timezone();
/* Tell GUC about the value. Will redundantly call pg_tzset() */
SetConfigOption("timezone", def_tz, PGC_POSTMASTER, PGC_S_ARGV);
}
}
示例15: lookup_prop_name
static IndexAMProperty
lookup_prop_name(const char *name)
{
int i;
for (i = 0; i < lengthof(am_propnames); i++)
{
if (pg_strcasecmp(am_propnames[i].name, name) == 0)
return am_propnames[i].prop;
}
/* We do not throw an error, so that AMs can define their own properties */
return AMPROP_UNKNOWN;
}